gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
274 stars 61 forks source link

Format with $ doesn't work as intended and as it used to #1796

Closed peter-sondhauss closed 4 months ago

peter-sondhauss commented 4 months ago

According to IDL documentation if the format code $ occurs anywhere in the format string, the new line implied by the closing parenthesis of the format string is suppressed. Hence the following consecutive print commands should provide the same results, but they don't:

printf, 1, format='($,I0)', 123 printf, 1, format='(I0)', 456

provides 123456 as it should, but

printf, 1, format='(I0,$)', 123 printf, 1, format='(I0)', 456

provides 123 456 which is wrong. I guess this bug was introduced during some recent bug fixes in the format interpretation.

alaingdl commented 4 months ago

Ok, thanks, I is able to replicate it on my U2204

Since Formats are tricky and lot of details and need larges tests, just or the record I recall we have two other bugs related to that : #1712 and #1706

pro test_issue1796
openw, lun, GDL_IDL_FL()+'_issue1796.txt',/get_lun
printf, lun, format='($,I0)', 123
printf, lun, format='(I0)', 456
printf, lun, format='(I0,$)', 123
printf, lun, format='(I0)', 456
close, lun
end

diff IDL_issue1796.txt GDL_issue1796.txt 
2c2,3
< 123456
---
> 123
> 456