Browse Source

* patch by "rs" to support lines longer than 255 chars in h2pas, resolves #15056

git-svn-id: trunk@29425 -
florian 10 years ago
parent
commit
15537361ee

+ 2 - 2
utils/h2pas/h2pas.pas

@@ -4,7 +4,7 @@
 (* global definitions: *)
 
 program h2pas;
-
+{$H+}
 (*
     Copyright (c) 1998-2000 by Florian Klaempfl
 
@@ -9392,4 +9392,4 @@ begin
   PTypeList.Free;
   freedynlibproc.free;
   loaddynlibproc.free;
-end.
+end.

+ 1 - 1
utils/h2pas/h2pas.y

@@ -1,6 +1,6 @@
 %{
 program h2pas;
-
+{$H+}
 (*
     Copyright (c) 1998-2000 by Florian Klaempfl
 

+ 13 - 17
utils/h2pas/h2plexlib.pas

@@ -1,6 +1,5 @@
-
 unit h2pLexLib;
-
+{$H+}
 (* Standard Lex library unit for TP Lex Version 3.0.
    2-11-91 AG *)
 
@@ -25,7 +24,8 @@ interface
 
 (* Variables:
 
-   The variable yytext contains the current match, yyleng its length.
+   The variable yytext contains the current match, yyleng(was removed because of
+   $H+) its length.
    The variable yyline contains the current input line, and yylineno and
    yycolno denote the current input position (line, column). These values
    are often used in giving error diagnostics (however, they will only be
@@ -43,8 +43,6 @@ yyinput, yyoutput : Text;        (* input and output file *)
 yyline,yyprevline : String;      (* current and previous input line *)
 yylineno, yycolno : Integer;     (* current input position *)
 yytext            : String;      (* matched text (should be considered r/o) *)
-yyleng            : Byte         (* length of matched text *)
-  absolute yytext;
 
 (* I/O routines:
 
@@ -256,14 +254,14 @@ yysstate, yylstate : Integer;
 yymatches          : Integer;
 yystack            : array [1..max_matches] of Integer;
 yypos              : array [1..max_rules] of Integer;
-yysleng            : Byte;
+yysleng            : Integer;
 
 (* Utilities: *)
 
 procedure echo;
   var i : Integer;
   begin
-    for i := 1 to yyleng do
+    for i := 1 to Length(yytext) do
       put_char(yytext[i])
   end(*echo*);
 
@@ -275,16 +273,16 @@ procedure yymore;
 procedure yyless ( n : Integer );
   var i : Integer;
   begin
-    for i := yyleng downto n+1 do
+    for i := Length(yytext) downto n+1 do
       unget_char(yytext[i]);
-    yyleng := n;
+    SetLength(yytext,n);
   end(*yyless*);
 
 procedure reject;
   var i : Integer;
   begin
     yyreject := true;
-    for i := yyleng+1 to yysleng do
+    for i := Length(yytext)+1 to yysleng do
       yytext := yytext+get_char;
     dec(yymatches);
   end(*reject*);
@@ -333,16 +331,14 @@ procedure yynew;
 
 procedure yyscan;
   begin
-    if yyleng=255 then fatal('yytext overflow');
     yyactchar := get_char;
-    inc(yyleng);
-    yytext[yyleng] := yyactchar;
+    yytext:=yytext+yyactchar;
   end(*yyscan*);
 
 procedure yymark ( n : Integer );
   begin
     if n>max_rules then fatal('too many rules');
-    yypos[n] := yyleng;
+    yypos[n] := Length(yytext);
   end(*yymark*);
 
 procedure yymatch ( n : Integer );
@@ -359,12 +355,12 @@ function yyfind ( var n : Integer ) : Boolean;
       dec(yymatches);
     if yymatches>0 then
       begin
-        yysleng := yyleng;
+        yysleng := Length(yytext);
         n       := yystack[yymatches];
         yyless(yypos[n]);
         yypos[n] := 0;
-        if yyleng>0 then
-          yylastchar := yytext[yyleng]
+        if Length(yytext)>0 then
+          yylastchar := yytext[Length(yytext)]
         else
           yylastchar := #0;
         yyfind := true;

+ 3 - 1
utils/h2pas/h2poptions.pas

@@ -16,7 +16,9 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
  ****************************************************************************}
+
 unit h2poptions;
+{$H+}
 interface
 
 const
@@ -138,7 +140,7 @@ end;
 
 Procedure ProcessOptions;
 Var
-  cp : string;
+  cp : string[255];   {because of cp[3] indexing}
   I : longint;
 
   Function GetNextParam (const Opt,Name : String) : string;

+ 1 - 1
utils/h2pas/h2pyacclib.pas

@@ -34,7 +34,7 @@ $History: YACCLIB.PAS $
 
 
 {$I-}
-
+{$H+}
 unit h2pYaccLib;
 
 (* Yacc Library Unit for TP Yacc Version 3.0, 6-17-91 AG *)

+ 1 - 0
utils/h2pas/scan.l

@@ -20,6 +20,7 @@
 
 
 unit scan;
+{$H+}
 
   interface
 

+ 1 - 0
utils/h2pas/scan.pas

@@ -23,6 +23,7 @@
 
 
 unit scan;
+{$H+}
 
   interface