If I feed this into h2pas: #error "This is an error" #warning "This is a warning" #define nothing 0
I get an error message: Illegal character in line 2 "#warning "This is a warning"" at line 2 error : syntax error and the output is: {$error "This is an error"} (* error #warning "This is a warning" (* error #warning "This is a warning" in define line 3 *) For some reason, h2pas is writing the message twice, and not properly closing the comment for the first message. ( This also causes it to skip the #define on line 3 ) Here is a simple patch so it will recognize the #warning, and keep it from falling through on unknown directives... [PATCH] --- scan.l.old Wed Feb 26 12:45:31 2003 +++ scan.l.new Sun Mar 2 01:25:26 2003 @@ -584,6 +584,12 @@ writeln(outfile,'}'); flush(outfile); end; +"#"[ \t]*"warning" begin + write(outfile,'{$warning'); + copy_until_eol; + writeln(outfile,'}'); + flush(outfile); + end; "#"[ \t]*"include" begin write(outfile,'{$include'); copy_until_eol; @@ -630,6 +636,20 @@ in_define:=true; in_space_define:=1; return(DEFINE); + end; +"#" begin + writeln('at line ',yylineno, + ' error : unknown directive'); + if not stripinfo then + begin + write(outfile,'(** unknown directive: #'); + copy_until_eol; + writeln(outfile,' *)'); + flush(outfile); + end + else + skip_until_eol; + block_type:=bt_no; end; "char" return(_CHAR); "union" return(UNION); [/PATCH] Now the output is: {$error "This is an error"} {$warning "This is a warning"} const nothing = 0; This will also let it handle things like: #strange "This is something strange" Prints the message: at line 3 error : unknown directive And becomes: (** unknown directive: #strange "This is something strange" *) __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ _______________________________________________ fpc-devel maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-devel