Open jodavies opened 8 years ago
Hi Josh,
I would say, that this is not a FORM problem. If you have an editor that does this the obvious repair is to put an empty line after the #include inc1.h line. As things are at the moment you have the option to not end a file with a linefeed and do something creative with it. And maybe somebody does. I will only put in changes that break (possibly) existing programs if those programs make use of bugs against what it says in the manual.
Cannot you tell the editor to terminate with a linefeed cq carriage return? FORM will accept any of the conventions that are in use. It writes in the convention that belongs to the OS. This means just a linefeed for UNIX and carriage return+linefeed for MS products. The compilers are not that flexible.
Actually the whole concept of how streams are managed internally is rather transparent and processes characters the way they come, irrespective from where they come. Hence a stream can be a procedure, and include file, the contents of a do-loop, the contents of a preprocessor variable, an external program, etc.
Cheers
Jos
On 19 okt. 2016, at 12:20, Josh Davies notifications@github.com wrote:
Some editors do not put an end-of-line character at the end of the file. This leads to problems with a form script such as
define TEST "1"
Symbol a,b;
ifdef `TEST'
#message control should pass here #include inc1.h
else
#message control should NOT pass here #include inc2.h
endif
.end if inc1.h does not have a final eol character, and the last line is a comment or something like a #call, (i.e., doesn't end with a ";". For eg,
$ form-git test.frm FORM 4.1 (Sep 21 2016, v4.1-20131025-245-g104d5d8) 64-bits Run: Wed Oct 19 12:17:22 2016
define TEST "1"
Symbol a,b; #ifdef `TEST' #message control should pass here
#include inc1.h Identify a = b; \* a comment!#else #message control should NOT pass here ~~~control should NOT pass here #include inc2.h Identify b = a; #endif ``` .end ``` 0.00 sec out of 0.00 sec Maybe form should check for a final eol when a file is included? Thanks, Josh Davies. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/131, or mute the thread https://github.com/notifications/unsubscribe-auth/AFLxEhtcfb-D9j-wP9FRZ6XO99R1ZU8aks5q1e8EgaJpZM4KazMp.
Thanks. I will tell the user of this editor (leafpad) to always ensure there is a blank line at the end of a file to be included, or after the include statement. Or to use a different editor...
Josh.
Actually, editors without EOL at the end come from the convention of MS.
POSIX defines: a text file consists of zero or more lines, a line is zero or more non-newline characters plus a terminating new line character (required).
MS defines: a text file consists of lines separated by CR+LF, so usually the last line is without a CR+LF marker.
Some editors do not put an end-of-line character at the end of the file. This leads to problems with a form script such as
if inc1.h does not have a final eol character, and the last line is a comment or something like a #call, (i.e., doesn't end with a ";". For eg,
Maybe form should check for a final eol when a file is included?
Thanks, Josh Davies.