[fpc-devel] Patch for lexlib

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sun Mar 16 12:10:42 CET 2008


Indeed. Like this?


Index: h2pas/lexlib.pas
===================================================================
--- h2pas/lexlib.pas	(revision 10497)
+++ h2pas/lexlib.pas	(working copy)
@@ -115,7 +115,10 @@
    file. In particular, yywrap may arrange for more input and return false
    in which case the yylex routine resumes lexical analysis. *)

-function yywrap : Boolean;
+type
+  yywrap_t = function (): Boolean;
+var
+  yywrap: yywrap_t;
   (* The default yywrap routine supplied here closes input and output files
      and returns true (causing yylex to terminate). *)

@@ -305,10 +308,11 @@

 (* yywrap: *)

-function yywrap : Boolean;
+function lexlib_yywrap : Boolean;
   begin
-    close(yyinput); close(yyoutput);
-    yywrap := true;
+    close(yyinput);
+    close(yyoutput);
+    lexlib_yywrap := true;
   end(*yywrap*);

 (* Internal routines: *)
@@ -401,6 +405,7 @@
   end(*yyclear*);

 begin
+  yywrap := @lexlib_yywrap;
   assign(yyinput, '');
   assign(yyoutput, '');
   reset(yyinput);



More information about the fpc-devel mailing list