peter преди 26 години
родител
ревизия
3a56cae749
променени са 21 файла, в които са добавени 20469 реда и са изтрити 0 реда
  1. 159 0
      utils/Makefile
  2. 25 0
      utils/README
  3. 159 0
      utils/h2pas/Makefile
  4. 52 0
      utils/h2pas/README
  5. 72 0
      utils/h2pas/converu.pas
  6. 6544 0
      utils/h2pas/h2pas.pas
  7. 2155 0
      utils/h2pas/h2pas.y
  8. 407 0
      utils/h2pas/lexlib.pas
  9. 210 0
      utils/h2pas/options.pas
  10. 707 0
      utils/h2pas/scan.l
  11. 4705 0
      utils/h2pas/scan.pas
  12. 38 0
      utils/h2pas/testit.h
  13. 120 0
      utils/h2pas/yacclib.pas
  14. 80 0
      utils/h2pas/yylex.cod
  15. 184 0
      utils/h2pas/yyparse.cod
  16. 629 0
      utils/ppdep.pp
  17. 1013 0
      utils/ppu.pas
  18. 1275 0
      utils/ppudump.pp
  19. 570 0
      utils/ppumove.pp
  20. 161 0
      utils/ptop.pp
  21. 1204 0
      utils/ptopu.pp

+ 159 - 0
utils/Makefile

@@ -0,0 +1,159 @@
+#
+#   $Id$
+#   Copyright (c) 1999 by the Free Pascal Development Team
+#
+#   Makefile for Free Pascal Utils
+#
+#   See the file COPYING.FPC, included in this distribution,
+#   for details about the copyright.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+
+
+#####################################################################
+# Defaults
+#####################################################################
+
+# Default place of the makefile.fpc
+DEFAULTFPCDIR=..
+
+
+#####################################################################
+# Real targets
+#####################################################################
+
+EXEOBJECTS=ppudump ppumove ppdep ptop
+UNITOBJECTS=
+
+
+#####################################################################
+# Common targets
+#####################################################################
+
+.PHONY: all clean install info \
+        staticlib sharedlib libsclean \
+        staticinstall sharedinstall libinstall \
+        extra_clean \
+        h2pas_all h2pas_clean h2pas_install \
+        
+all: testfpcmake fpc_all h2pas_all
+
+clean: testfpcmake fpc_clean extra_clean h2pas_clean
+
+install: testfpcmake fpc_install h2pas_install
+
+info: testfpcmake fpc_info
+
+staticlib: testfpcmake fpc_staticlib
+
+sharedlib: testfpcmake fpc_sharedlib
+
+libsclean: testfpcmake fpc_libsclean
+
+staticinstall: testfpcmake fpc_staticinstall
+
+sharedinstall: testfpcmake fpc_sharedinstall
+
+libinstall: testfpcmake fpc_libinstall
+
+
+#####################################################################
+# Include default makefile
+#####################################################################
+
+# test if FPCMAKE is still valid
+ifdef FPCMAKE
+ifeq ($(strip $(wildcard $(FPCMAKE))),)
+FPCDIR=
+FPCMAKE=
+endif
+endif
+
+ifndef FPCDIR
+ifdef DEFAULTFPCDIR
+FPCDIR=$(DEFAULTFPCDIR)
+endif
+endif
+
+ifndef FPCMAKE
+ifdef FPCDIR
+FPCMAKE=$(FPCDIR)/makefile.fpc
+else
+FPCMAKE=makefile.fpc
+endif
+endif
+
+override FPCMAKE:=$(strip $(wildcard $(FPCMAKE)))
+ifeq ($(FPCMAKE),)
+testfpcmake:
+	@echo makefile.fpc not found!
+	@echo Check the FPCMAKE and FPCDIR environment variables.
+	@exit
+else
+include $(FPCMAKE)
+testfpcmake:
+endif
+
+
+
+#####################################################################
+# Dependencies
+#####################################################################
+
+#
+# PPU Tools
+#
+ppu$(PPUEXT): ppu.pas
+
+ppudump$(EXEEXT): ppudump.pp ppu$(PPUEXT)
+
+ppumove$(EXEEXT): ppumove.pp ppu$(PPUEXT)
+
+#
+# Pascal beautifier
+#
+ptop$(EXEEXT): ptop.pp ptopu$(PPUEXT)
+
+ptopu$(PPUEXT): ptopu.pp
+
+#
+# Clean also the .ppu's
+#
+extra_clean:
+	$(DEL) ppu$(PPUEXT) ptopu$(PPUEXT)
+
+#
+# H2Pas
+#
+h2pas_all:
+	$(MAKE) -C h2pas all
+
+h2pas_clean:
+	$(MAKE) -C h2pas clean
+
+h2pas_install:
+	$(MAKE) -C h2pas install
+
+#
+# $Log$
+# Revision 1.1  1999-05-12 16:11:39  peter
+#   * moved
+#
+# Revision 1.14  1999/05/03 18:03:13  peter
+#   * renamed mkdep -> ppdep
+#   * removed obsolete units
+#   * add .cod files
+#
+# Revision 1.13  1999/04/02 00:01:49  peter
+#   + ptop to exeobjects
+#
+# Revision 1.12  1999/04/01 22:52:00  peter
+#   * update for makefile.fpc
+#
+# Revision 1.1  1999/03/16 00:50:29  peter
+#   + init
+#
+#

+ 25 - 0
utils/README

@@ -0,0 +1,25 @@
+This dirctory contains some utilities that come with the Free Pascal
+Compiler. They can be compiled by typing 'make all' in this directory,
+or 'make utils_all' in the top directory.
+
+Currently, the following things are provided:
+
+ppudump : This program prints the contents of a unit (.ppu or .ppl) file
+          to screen. It should handle units of all versions of the compiler.
+
+ppumove : Similar to tpumove from Borland, Inc. this program can be used
+          to combine several (or one) units in a shared or static library.
+          usage is straightforward. running the program without arguments
+          gives possible arguments.
+
+ppdep   : Creates a makefile which includes all interdependant units.
+
+ptop    : Pascal source beautifier
+
+h2pas/  : Contains the h2pas program, which converts C header files to pascal
+          unit files.
+
+Typing a 'make install' will put everything into place.
+
+Happy Coding !
+The Free Pascal Development Team.

+ 159 - 0
utils/h2pas/Makefile

@@ -0,0 +1,159 @@
+#
+#   $Id$
+#   Copyright (c) 1999 by the Free Pascal Development Team
+#
+#   Makefile for Free Pascal Utils
+#
+#   See the file COPYING.FPC, included in this distribution,
+#   for details about the copyright.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+
+
+#####################################################################
+# Defaults
+#####################################################################
+
+# Default place of the makefile.fpc
+DEFAULTFPCDIR=../..
+
+# We need -Sg
+NEEDOPT=-Sg
+
+
+#####################################################################
+# Real targets
+#####################################################################
+
+# the files in this dir use .pas
+PASEXT=.pas
+
+EXEOBJECTS=h2pas
+UNITOBJECTS=
+
+
+#####################################################################
+# Common targets
+#####################################################################
+
+.PHONY: all clean install info \
+        staticlib sharedlib libsclean \
+        staticinstall sharedinstall libinstall \
+        
+all: testfpcmake fpc_all
+
+clean: testfpcmake fpc_cleanall
+
+install: testfpcmake fpc_install
+
+info: testfpcmake fpc_info
+
+staticlib: testfpcmake fpc_staticlib
+
+sharedlib: testfpcmake fpc_sharedlib
+
+libsclean: testfpcmake fpc_libsclean
+
+staticinstall: testfpcmake fpc_staticinstall
+
+sharedinstall: testfpcmake fpc_sharedinstall
+
+libinstall: testfpcmake fpc_libinstall
+
+
+#####################################################################
+# Include default makefile
+#####################################################################
+
+# test if FPCMAKE is still valid
+ifdef FPCMAKE
+ifeq ($(strip $(wildcard $(FPCMAKE))),)
+FPCDIR=
+FPCMAKE=
+endif
+endif
+
+ifndef FPCDIR
+ifdef DEFAULTFPCDIR
+FPCDIR=$(DEFAULTFPCDIR)
+endif
+endif
+
+ifndef FPCMAKE
+ifdef FPCDIR
+FPCMAKE=$(FPCDIR)/makefile.fpc
+else
+FPCMAKE=makefile.fpc
+endif
+endif
+
+override FPCMAKE:=$(strip $(wildcard $(FPCMAKE)))
+ifeq ($(FPCMAKE),)
+testfpcmake:
+	@echo makefile.fpc not found!
+	@echo Check the FPCMAKE and FPCDIR environment variables.
+	@exit
+else
+include $(FPCMAKE)
+testfpcmake:
+endif
+
+
+
+#####################################################################
+# Dependencies
+#####################################################################
+
+# do we have pyacc?
+ifndef PYACC
+PYACC=$(strip $(wildcard $(addsuffix /pyacc$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PYACC),)
+PYACC=
+else
+export PYACC:=$(firstword $(PYACC))
+endif
+endif
+
+# do we have plex?
+ifndef PLEX
+PLEX=$(strip $(wildcard $(addsuffix /plex$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PLEX),)
+PLEX=
+else
+export PLEX:=$(firstword $(PLEX))
+endif
+endif
+
+h2pas$(EXEEXT): h2pas$(PASEXT)
+
+#
+# Lex and Yacc (only if pyacc is found)
+#
+ifdef  PYACC
+h2pas$(PASEXT): h2pas.y
+	$(PYACC) h2pas.y
+
+yacclex: yacc lex
+
+yacc:
+	$(PYACC) h2pas.y
+
+lex :
+	$(PLEX) scan.l
+endif
+
+#
+# $Log$
+# Revision 1.1  1999-05-12 16:11:39  peter
+#   * moved
+#
+# Revision 1.12  1999/04/01 22:52:01  peter
+#   * update for makefile.fpc
+#
+# Revision 1.1  1999/03/16 00:50:29  peter
+#   + init
+#
+#

+ 52 - 0
utils/h2pas/README

@@ -0,0 +1,52 @@
+This is the h2pas program, a utility to convert C header files to pascal
+units. It is part of the Free Pascal distribution.
+
+COMPILING
+
+To compile the program, a simple
+ 'make' 
+should be sufficient; you need GNU make for this. When using TP, a simple
+  tpc h2pas.pas
+should also be possible. 
+
+USAGE
+
+h2pas [-p] [-t] [-o outputfilename] [-l libname] [-u unitname] filename
+
+-t : Prepend 'T' to all type names in typedef definitions. This may help
+     when the C header use uppercase types and lowercase variables of the
+     same name.
+
+-p : Use 'P' instead of ^ as a pointer symbol;
+     This will convert 
+        ^char to pchar
+        ^longint to plongint 
+     etc. It will also define a PSOMETYPE pointer for each SOMETYPE struct type 
+     definition in the header file.
+     Thus 
+     typedef struct somestruct {
+       ...
+     }
+     Will be converted to
+     somestruct = record
+       ...
+     end;
+     PSomestruct = ^Somestruct;
+     If the -t options is used, the -p option takes care of that too.
+
+-l : In the implementation part, the external functions will be
+     written with 'external libname;' behind it.
+     If you omit this option, all functions will be declared as 
+     cdecl; external; 
+
+-o : specify the outputname. By default, the inputname is used, with
+     extension '.pp'.
+
+-u : Specify the unit name. By default, the outputname is used, without
+     extension.
+
+-v : Replaces pointer types in parameter list by call by reference
+     parameters:
+        void p(int *i)  =>   procedure p(var i : longint);
+
+Enjoy !

+ 72 - 0
utils/h2pas/converu.pas

@@ -0,0 +1,72 @@
+unit converu;
+
+interface
+
+const TYPEDEF = 257;
+const DEFINE = 258;
+const COLON = 259;
+const SEMICOLON = 260;
+const COMMA = 261;
+const LKLAMMER = 262;
+const RKLAMMER = 263;
+const LECKKLAMMER = 264;
+const RECKKLAMMER = 265;
+const LGKLAMMER = 266;
+const RGKLAMMER = 267;
+const STRUCT = 268;
+const UNION = 269;
+const ENUM = 270;
+const ID = 271;
+const NUMBER = 272;
+const CSTRING = 273;
+const SHORT = 274;
+const UNSIGNED = 275;
+const LONG = 276;
+const INT = 277;
+const REAL = 278;
+const _CHAR = 279;
+const VOID = 280;
+const _CONST = 281;
+const _FAR = 282;
+const _HUGE = 283;
+const _NEAR = 284;
+const _ASSIGN = 285;
+const NEW_LINE = 286;
+const SPACE_DEFINE = 287;
+const EXTERN = 288;
+const STDCALL = 289;
+const CDECL = 290;
+const CALLBACK = 291;
+const PASCAL = 292;
+const WINAPI = 293;
+const APIENTRY = 294;
+const WINGDIAPI = 295;
+const SYS_TRAP = 296;
+const _PACKED = 297;
+const ELLIPSIS = 298;
+const R_AND = 299;
+const EQUAL = 300;
+const UNEQUAL = 301;
+const GT = 302;
+const LT = 303;
+const GTE = 304;
+const LTE = 305;
+const QUESTIONMARK = 306;
+const _OR = 307;
+const _AND = 308;
+const _PLUS = 309;
+const MINUS = 310;
+const _SHR = 311;
+const _SHL = 312;
+const STAR = 313;
+const _SLASH = 314;
+const _NOT = 315;
+const PSTAR = 316;
+const P_AND = 317;
+const POINT = 318;
+const DEREF = 319;
+const STICK = 320;
+
+
+implementation
+end.

+ 6544 - 0
utils/h2pas/h2pas.pas

@@ -0,0 +1,6544 @@
+
+(* Yacc parser template (TP Yacc V3.0), V1.2 6-17-91 AG *)
+
+(* global definitions: *)
+
+program h2pas;
+
+(*
+    $Id$
+    Copyright (c) 1993-98 by Florian Klaempfl
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************)
+
+
+
+  uses
+   {$ifdef go32v2}
+   {$ifndef NOEXCP}
+   dpmiexcp,
+   {$endif NOEXCP}
+   {$endif}
+   {$IFDEF WIN32}
+   SysUtils,
+   {$else}
+   strings,
+   {$endif}
+   options,scan,converu,lexlib,yacclib;
+
+  type
+     YYSTYPE = presobject;
+
+  const
+     INT_STR = 'longint';
+     UINT_STR = 'cardinal';
+     SHORT_STR = 'integer';
+     USHORT_STR = 'word';
+     CHAR_STR = 'char';
+     { should we use byte or char for 'unsigned char' ?? }
+     UCHAR_STR = 'byte';
+     REAL_STR = 'real';
+
+  var
+     debug : boolean;
+     hp,ph : presobject;
+     extfile: text;  (* file for implementation headers extern procs *)
+     IsExtern:boolean;
+     must_write_packed_field : boolean;
+     tempfile : text;
+     No_pop:boolean;
+     s,TN,PN : String;
+
+(* $ define yydebug
+ compile with -dYYDEBUG to get debugging info *)
+
+  const
+     (* number of a?b:c construction in one define *)
+     if_nb : longint = 0;
+     is_packed : boolean = false;
+     is_procvar : boolean = false;
+
+  var space_array : array [0..255] of byte;
+      space_index : byte;
+
+        procedure shift(space_number : byte);
+          var
+             i : byte;
+          begin
+             space_array[space_index]:=space_number;
+             inc(space_index);
+             for i:=1 to space_number do
+               aktspace:=aktspace+' ';
+          end;
+
+        procedure popshift;
+          begin
+             dec(space_index);
+             if space_index<0 then
+               internalerror(20);
+             dec(byte(aktspace[0]),space_array[space_index]);
+          end;
+
+    function str(i : longint) : string;
+      var
+         s : string;
+      begin
+         system.str(i,s);
+         str:=s;
+      end;
+
+    function hexstr(i : cardinal) : string;
+
+    const
+      HexTbl : array[0..15] of char='0123456789ABCDEF';
+    var
+      str : string;
+    begin
+      str:='';
+      while i<>0 do
+        begin
+           str:=hextbl[i and $F]+str;
+           i:=i shr 4;
+        end;
+      if str='' then str:='0';
+      hexstr:='$'+str;
+    end;
+
+    function uppercase(s : string) : string;
+      var
+         i : byte;
+      begin
+         for i:=1 to length(s) do
+           s[i]:=UpCase(s[i]);
+         uppercase:=s;
+      end;
+
+    procedure write_type_specifier(var outfile:text; p : presobject);forward;
+    procedure write_p_a_def(var outfile:text; p,simple_type : presobject);forward;
+    procedure write_ifexpr(var outfile:text; p : presobject);forward;
+    procedure write_funexpr(var outfile:text; p : presobject);forward;
+
+    procedure yymsg(const msg : string);
+      begin
+         writeln('line ',line_no,': ',msg);
+      end;
+
+    procedure write_packed_fields_info(var outfile:text; p : presobject; ph : string);
+
+      var
+         hp1,hp2,hp3 : presobject;
+         is_sized : boolean;
+         line : string;
+         flag_index : longint;
+         name : pchar;
+         ps : byte;
+
+      begin
+         { write out the tempfile created }
+         close(tempfile);
+         reset(tempfile);
+         is_sized:=false;
+         flag_index:=0;
+         writeln(outfile,aktspace,'const');
+         shift(3);
+         while not eof(tempfile) do
+           begin
+              readln(tempfile,line);
+              ps:=pos('&',line);
+              if ps>0 then
+                line:=copy(line,1,ps-1)+ph+'_'+copy(line,ps+1,255);
+              writeln(outfile,aktspace,line);
+           end;
+         close(tempfile);
+         rewrite(tempfile);
+         popshift;
+         (* walk through all members *)
+         hp1 := p^.p1;
+         while assigned(hp1) do
+           begin
+              (* hp2 is t_memberdec *)
+              hp2:=hp1^.p1;
+              (*  hp3 is t_declist *)
+              hp3:=hp2^.p2;
+              while assigned(hp3) do
+                begin
+                   if assigned(hp3^.p1^.p3) and
+                      (hp3^.p1^.p3^.typ = t_size_specifier) then
+                     begin
+                        is_sized:=true;
+                        name:=hp3^.p1^.p2^.p;
+                        { get function in interface }
+                        write(outfile,aktspace,'function ',name);
+                        write(outfile,'(var a : ',ph,') : ');
+                        shift(2);
+                        write_p_a_def(outfile,hp3^.p1^.p1,hp2^.p1);
+                        writeln(outfile,';');
+                        popshift;
+                        { get function in implementation }
+                        write(extfile,aktspace,'function ',name);
+                        write(extfile,'(var a : ',ph,') : ');
+                        shift(2);
+                        write_p_a_def(extfile,hp3^.p1^.p1,hp2^.p1);
+                        writeln(extfile,';');
+                        writeln(extfile,aktspace,'begin');
+                        shift(3);
+                        write(extfile,aktspace,name,':=(a.flag',flag_index);
+                        writeln(extfile,' and bm_',ph,'_',name,') shr bp_',ph,'_',name,';');
+                        popshift;
+                        writeln(extfile,aktspace,'end;');
+                        popshift;
+                        writeln(extfile);
+                        { set function in interface }
+                        write(outfile,aktspace,'procedure set_',name);
+                        write(outfile,'(var a : ',ph,'; __',name,' : ');
+                        shift(2);
+                        write_p_a_def(outfile,hp3^.p1^.p1,hp2^.p1);
+                        writeln(outfile,');');
+                        popshift;
+                        { set function in implementation }
+                        write(extfile,aktspace,'procedure set_',name);
+                        write(extfile,'(var a : ',ph,'; __',name,' : ');
+                        shift(2);
+                        write_p_a_def(extfile,hp3^.p1^.p1,hp2^.p1);
+                        writeln(extfile,');');
+                        writeln(extfile,aktspace,'begin');
+                        shift(3);
+                        write(extfile,aktspace,'a.flag',flag_index,':=');
+                        write(extfile,'a.flag',flag_index,' or ');
+                        writeln(extfile,'((__',name,' shl bp_',ph,'_',name,') and bm_',ph,'_',name,');');
+                        popshift;
+                        writeln(extfile,aktspace,'end;');
+                        popshift;
+                        writeln(extfile);
+                     end
+                   else if is_sized then
+                     begin
+                        is_sized:=false;
+                        inc(flag_index);
+                     end;
+                   hp3:=hp3^.next;
+                end;
+              hp1:=hp1^.next;
+           end;
+         must_write_packed_field:=false;
+         block_type:=bt_no;
+      end;
+
+    procedure write_expr(var outfile:text; p : presobject);
+      begin
+      if assigned(p) then
+        begin
+         case p^.typ of
+            t_id,t_ifexpr : write(outfile,p^.p);
+            t_funexprlist : write_funexpr(outfile,p);
+            t_preop : begin
+                         write(outfile,p^.p,'(');
+                         write_expr(outfile,p^.p1);
+                         write(outfile,')');
+                         flush(outfile);
+                      end;
+            t_typespec : begin
+                         write_type_specifier(outfile,p^.p1);
+                         write(outfile,'(');
+                         write_expr(outfile,p^.p2);
+                         write(outfile,')');
+                         flush(outfile);
+                      end;
+            t_bop : begin
+                       if p^.p1^.typ<>t_id then
+                         write(outfile,'(');
+                       write_expr(outfile,p^.p1);
+                       if p^.p1^.typ<>t_id then
+                       write(outfile,')');
+                       write(outfile,p^.p);
+                       if p^.p2^.typ<>t_id then
+                         write(outfile,'(');
+                       write_expr(outfile,p^.p2);
+                       if p^.p2^.typ<>t_id then
+                         write(outfile,')');
+                    flush(outfile);
+                    end;
+            else internalerror(2);
+            end;
+         end;
+      end;
+
+    procedure write_ifexpr(var outfile:text; p : presobject);
+      begin
+         flush(outfile);
+         write(outfile,'if ');
+         write_expr(outfile,p^.p1);
+         writeln(outfile,' then');
+         write(outfile,aktspace,'  ');
+         write(outfile,p^.p);
+         write(outfile,':=');
+         write_expr(outfile,p^.p2);
+         writeln(outfile);
+         writeln(outfile,aktspace,'else');
+         write(outfile,aktspace,'  ');
+         write(outfile,p^.p);
+         write(outfile,':=');
+         write_expr(outfile,p^.p3);
+         writeln(outfile,';');
+         write(outfile,aktspace);
+         flush(outfile);
+      end;
+
+    procedure write_all_ifexpr(var outfile:text; p : presobject);
+      begin
+      if assigned(p) then
+        begin
+           case p^.typ of
+             t_id :;
+             t_preop :
+               write_all_ifexpr(outfile,p^.p1);
+             t_bop :
+               begin
+                  write_all_ifexpr(outfile,p^.p1);
+                  write_all_ifexpr(outfile,p^.p2);
+               end;
+             t_ifexpr :
+               begin
+                  write_all_ifexpr(outfile,p^.p1);
+                  write_all_ifexpr(outfile,p^.p2);
+                  write_all_ifexpr(outfile,p^.p3);
+                  write_ifexpr(outfile,p);
+               end;
+             t_typespec :
+                  write_all_ifexpr(outfile,p^.p2);
+             t_funexprlist,
+             t_exprlist :
+               begin
+                 if assigned(p^.p1) then
+                   write_all_ifexpr(outfile,p^.p1);
+                 if assigned(p^.next) then
+                   write_all_ifexpr(outfile,p^.next);
+               end
+             else
+               internalerror(6);
+           end;
+        end;
+      end;
+
+    procedure write_funexpr(var outfile:text; p : presobject);
+      var
+         i : longint;
+
+      begin
+      if assigned(p) then
+        begin
+           case p^.typ of
+             t_ifexpr :
+               write(outfile,p^.p);
+             t_exprlist :
+               begin
+                  write_expr(outfile,p^.p1);
+                  if assigned(p^.next) then
+                    begin
+                      write(outfile,',');
+                      write_funexpr(outfile,p^.next);
+                    end
+               end;
+             t_funcname :
+               begin
+                  shift(2);
+                  if if_nb>0 then
+                    begin
+                       writeln(outfile,aktspace,'var');
+                       write(outfile,aktspace,'   ');
+                       for i:=1 to if_nb do
+                         begin
+                            write(outfile,'if_local',i);
+                            if i<if_nb then
+                              write(outfile,', ')
+                            else
+                              writeln(outfile,' : longint;');
+                         end;
+                       writeln(outfile,aktspace,'(* result types are not known *)');
+                       if_nb:=0;
+                    end;
+                  writeln(outfile,aktspace,'begin');
+                  shift(3);
+                  write(outfile,aktspace);
+                  write_all_ifexpr(outfile,p^.p2);
+                  write_expr(outfile,p^.p1);
+                  write(outfile,':=');
+                  write_funexpr(outfile,p^.p2);
+                  writeln(outfile,';');
+                  popshift;
+                  writeln(outfile,aktspace,'end;');
+                  popshift;
+                  flush(outfile);
+               end;
+             t_funexprlist :
+               begin
+                  if assigned(p^.p3) then
+                    begin
+                       write_type_specifier(outfile,p^.p3);
+                       write(outfile,'(');
+                    end;
+                  if assigned(p^.p1) then
+                    write_funexpr(outfile,p^.p1);
+                  if assigned(p^.p2) then
+                    begin
+                      write(outfile,'(');
+                      write_funexpr(outfile,p^.p2);
+                      write(outfile,')');
+                    end;
+                  if assigned(p^.p3) then
+                    write(outfile,')');
+               end
+             else internalerror(5);
+           end;
+        end;
+      end;
+
+     function ellipsisarg : presobject;
+       begin
+          ellipsisarg:=new(presobject,init_two(t_arg,nil,nil));
+       end;
+
+    const
+       (* if in args *dname is replaced by pdname *)
+       in_args : boolean = false;
+       typedef_level : longint = 0;
+
+    (* writes an argument list, where p is t_arglist *)
+
+    procedure write_args(var outfile:text; p : presobject);
+      var
+         length,para : longint;
+         old_in_args : boolean;
+         varpara : boolean;
+
+      begin
+         para:=1;
+         length:=0;
+         old_in_args:=in_args;
+         in_args:=true;
+         write(outfile,'(');
+         shift(2);
+
+         (* walk through all arguments *)
+         (* p must be of type t_arglist *)
+         while assigned(p) do
+           begin
+              if p^.typ<>t_arglist then
+                internalerror(10);
+              (* is ellipsis ? *)
+              if not assigned(p^.p1^.p1) and
+                 not assigned(p^.p1^.next) then
+                begin
+                   { write(outfile,'...'); }
+                   write(outfile,'args:array of const');
+                   { if variable number of args we must allways pop }
+                   no_pop:=false;
+                end
+              (* we need to correct this in the pp file after *)
+              else
+                begin
+                   (* generate a call by reference parameter ?       *)
+                   varpara:=usevarparas and assigned(p^.p1^.p2^.p1) and
+                     ((p^.p1^.p2^.p1^.typ=t_pointerdef) or
+                     (p^.p1^.p2^.p1^.typ=t_addrdef));
+                   (* do not do it for char pointer !!               *)
+                   (* para : pchar; and var para : char; are         *)
+                   (* completely different in pascal                 *)
+                   (* here we exclude all typename containing char   *)
+                   (* is this a good method ??                       *)
+
+
+                   if varpara and
+                      (p^.p1^.p2^.p1^.typ=t_pointerdef) and
+                      (p^.p1^.p2^.p1^.p1^.typ=t_id) and
+                     (pos('CHAR',uppercase(p^.p1^.p2^.p1^.p1^.str))<>0) then
+                     varpara:=false;
+                   if varpara then
+                     begin
+                        write(outfile,'var ');
+                        length:=length+4;
+                     end;
+
+                   (* write new type name *)
+                   if assigned(p^.p1^.p2^.p2) then
+                     begin
+                        write(outfile,p^.p1^.p2^.p2^.p);
+                        length:=length+p^.p1^.p2^.p2^.strlength;
+                     end
+                   else
+                     begin
+                        write(outfile,'_para',para);
+                        { not exact but unimportant }
+                        length:=length+6;
+                     end;
+                   write(outfile,':');
+                   if varpara then
+                     write_p_a_def(outfile,p^.p1^.p2^.p1^.p1,p^.p1^.p1)
+                   else
+                     write_p_a_def(outfile,p^.p1^.p2^.p1,p^.p1^.p1);
+
+                end;
+              p:=p^.next;
+              if assigned(p) then
+                begin
+                   write(outfile,'; ');
+                   { if length>40 then : too complicated to compute }
+                   if (para mod 5) = 0 then
+                     begin
+                        writeln(outfile);
+                        write(outfile,aktspace);
+                     end;
+                end;
+              inc(para);
+           end;
+         write(outfile,')');
+         flush(outfile);
+         in_args:=old_in_args;
+         popshift;
+      end;
+
+    procedure write_p_a_def(var outfile:text; p,simple_type : presobject);
+      var
+         i : longint;
+         error : integer;
+         constant : boolean;
+
+      begin
+         if not(assigned(p)) then
+           begin
+              write_type_specifier(outfile,simple_type);
+              exit;
+           end;
+         case p^.typ of
+            t_pointerdef : begin
+                              (* procedure variable ? *)
+                              if assigned(p^.p1) and (p^.p1^.typ=t_procdef) then
+                                begin
+                                   is_procvar:=true;
+                                   (* distinguish between procedure and function *)
+                                   if (simple_type^.typ=t_void) and (p^.p1^.p1=nil) then
+                                     begin
+                                        write(outfile,'procedure ');
+
+                                        shift(10);
+                                        (* write arguments *)
+                                        if assigned(p^.p1^.p2) then
+                                          write_args(outfile,p^.p1^.p2);
+                                        flush(outfile);
+                                        popshift;
+                                     end
+                                   else
+                                     begin
+                                        write(outfile,'function ');
+                                        shift(9);
+                                        (* write arguments *)
+                                        if assigned(p^.p1^.p2) then
+                                          write_args(outfile,p^.p1^.p2);
+                                        write(outfile,':');
+                                        flush(outfile);
+                                        write_p_a_def(outfile,p^.p1^.p1,simple_type);
+                                        popshift;
+                                     end
+                                end
+                              else
+                                begin
+                                   (* generate "pointer" ? *)
+                                   if (simple_type^.typ=t_void) and (p^.p1=nil) then
+                                      begin
+                                       write(outfile,'pointer');
+                                       flush(outfile);
+                                      end
+                                   else
+                                     begin
+                                        if in_args then
+                                          write(outfile,'p')
+                                        else
+                                          write(outfile,'^');
+                                        flush(outfile);
+                                        write_p_a_def(outfile,p^.p1,simple_type);
+                                     end;
+                                end;
+                           end;
+            t_arraydef : begin
+                             constant:=false;
+                             if p^.p2^.typ=t_id then
+                               begin
+                                  val(p^.p2^.str,i,error);
+                                  if error=0 then
+                                    begin
+                                       dec(i);
+                                       constant:=true;
+                                    end;
+                               end;
+                             if not constant then
+                               begin
+                                  write(outfile,'array[0..(');
+                                  write_expr(outfile,p^.p2);
+                                  write(outfile,')-1] of ');
+                               end
+                             else
+                               begin
+                                  write(outfile,'array[0..',i,'] of ');
+                               end;
+                             flush(outfile);
+                             write_p_a_def(outfile,p^.p1,simple_type);
+                          end;
+            else internalerror(1);
+         end;
+      end;
+
+    procedure write_type_specifier(var outfile:text; p : presobject);
+      var
+         hp1,hp2,hp3,lastexpr : presobject;
+         i,l,w : longint;
+         error : integer;
+         mask : cardinal;
+         flag_index,current_power : longint;
+         current_level : byte;
+         is_sized : boolean;
+
+      begin
+         case p^.typ of
+            t_id :
+              write(outfile,p^.p);
+            { what can we do with void defs  ? }
+            t_void :
+              write(outfile,'void');
+            t_pointerdef :
+              begin
+                 write(outfile,'p');
+                 write_type_specifier(outfile,p^.p1);
+              end;
+            t_enumdef :
+              begin
+                 if (typedef_level>1) and (p^.p1=nil) and
+                    (p^.p2^.typ=t_id) then
+                   begin
+                      write(outfile,p^.p2^.p);
+                   end
+                 else
+                 if not EnumToConst then
+                   begin
+                      write(outfile,'(');
+                      hp1:=p^.p1;
+                      w:=length(aktspace);
+                      while assigned(hp1) do
+                        begin
+                           write(outfile,hp1^.p1^.p);
+                           if assigned(hp1^.p2) then
+                             begin
+                                write(outfile,' := ');
+                                write_expr(outfile,hp1^.p2);
+                                w:=w+6;(* strlen(hp1^.p); *)
+                             end;
+                           w:=w+length(hp1^.p1^.str);
+                           hp1:=hp1^.next;
+                           if assigned(hp1) then
+                             write(outfile,',');
+                           if w>40 then
+                             begin
+                                 writeln(outfile);
+                                 write(outfile,aktspace);
+                                 w:=length(aktspace);
+                             end;
+                           flush(outfile);
+                        end;
+                      write(outfile,')');
+                      flush(outfile);
+                   end
+                 else
+                   begin
+                      Writeln (outfile,' Longint;');
+                      hp1:=p^.p1;
+                      l:=0;
+                      lastexpr:=nil;
+                      Writeln (outfile,aktspace,'Const');
+                      while assigned(hp1) do
+                        begin
+                           write (outfile,aktspace,hp1^.p1^.p,' = ');
+                           if assigned(hp1^.p2) then
+                             begin
+                                write_expr(outfile,hp1^.p2);
+                                writeln(outfile,';');
+                                lastexpr:=hp1^.p2;
+                                if lastexpr^.typ=t_id then
+                                  begin
+                                     val(lastexpr^.str,l,error);
+                                     if error=0 then
+                                       begin
+                                          inc(l);
+                                          lastexpr:=nil;
+                                       end
+                                     else
+                                       l:=1;
+                                  end
+                                else
+                                  l:=1;
+                             end
+                           else
+                             begin
+                                if assigned(lastexpr) then
+                                  begin
+                                     write(outfile,'(');
+                                     write_expr(outfile,lastexpr);
+                                     writeln(outfile,')+',l,';');
+                                  end
+                                else
+                                  writeln (outfile,l,';');
+                                inc(l);
+                             end;
+                           hp1:=hp1^.next;
+                           flush(outfile);
+                        end;
+                      block_type:=bt_const;
+                  end;
+               end;
+            t_structdef :
+              begin
+                 inc(typedef_level);
+                 flag_index:=-1;
+                 is_sized:=false;
+                 current_level:=0;
+                 if (typedef_level>1) and (p^.p1=nil) and
+                    (p^.p2^.typ=t_id) then
+                   begin
+                      write(outfile,p^.p2^.p);
+                   end
+                 else
+                   begin
+                      writeln(outfile,'record');
+                      shift(3);
+                      hp1:=p^.p1;
+
+                      (* walk through all members *)
+                      while assigned(hp1) do
+                        begin
+                           (* hp2 is t_memberdec *)
+                           hp2:=hp1^.p1;
+                           (*  hp3 is t_declist *)
+                           hp3:=hp2^.p2;
+                           while assigned(hp3) do
+                             begin
+                                if not assigned(hp3^.p1^.p3) or
+                                   (hp3^.p1^.p3^.typ <> t_size_specifier) then
+                                  begin
+                                     if is_sized then
+                                       begin
+                                          if current_level <= 16 then
+                                            writeln(outfile,'word;')
+                                          else if current_level <= 32 then
+                                            writeln(outfile,'longint;')
+                                          else
+                                            internalerror(11);
+                                          is_sized:=false;
+                                       end;
+
+                                     write(outfile,aktspace,hp3^.p1^.p2^.p);
+                                     write(outfile,' : ');
+                                     shift(2);
+                                     write_p_a_def(outfile,hp3^.p1^.p1,hp2^.p1);
+                                     popshift;
+                                  end;
+                                { size specifier  or default value ? }
+                                if assigned(hp3^.p1^.p3) then
+                                  begin
+                                     { we could use mask to implement this }
+                                     { because we need to respect the positions }
+                                     if hp3^.p1^.p3^.typ = t_size_specifier then
+                                       begin
+                                          if not is_sized then
+                                            begin
+                                               current_power:=1;
+                                               current_level:=0;
+                                               inc(flag_index);
+                                               write(outfile,aktspace,'flag',flag_index,' : ');
+                                            end;
+                                          must_write_packed_field:=true;
+                                          is_sized:=true;
+                                          { can it be something else than a constant ? }
+                                          { it can be a macro !! }
+                                          if hp3^.p1^.p3^.p1^.typ=t_id then
+                                            begin
+                                              val(hp3^.p1^.p3^.p1^.str,l,error);
+                                              if error=0 then
+                                                begin
+                                                   mask:=0;
+                                                   for i:=1 to l do
+                                                     begin
+                                                        mask:=mask+current_power;
+                                                        current_power:=current_power*2;
+                                                     end;
+                                                   write(tempfile,'bm_&',hp3^.p1^.p2^.p);
+                                                   writeln(tempfile,' = ',hexstr(mask),';');
+                                                   write(tempfile,'bp_&',hp3^.p1^.p2^.p);
+                                                   writeln(tempfile,' = ',current_level,';');
+                                                   current_level:=current_level + l;
+                                                   { go to next flag if 31 }
+                                                   if current_level = 32 then
+                                                     begin
+                                                        write(outfile,'longint');
+                                                        is_sized:=false;
+                                                     end;
+                                                end;
+                                            end;
+
+                                       end
+                                     else if hp3^.p1^.p3^.typ = t_default_value then
+                                       begin
+                                          write(outfile,'{=');
+                                          write_expr(outfile,hp3^.p1^.p3^.p1);
+                                          write(outfile,' ignored}');
+                                       end;
+                                  end;
+                                if not is_sized then
+                                  begin
+                                     if is_procvar then
+                                       begin
+                                          if not no_pop then
+                                            begin
+                                               write(outfile,';cdecl');
+                                               no_pop:=true;
+                                            end;
+                                          is_procvar:=false;
+                                       end;
+                                     writeln(outfile,';');
+                                  end;
+                                hp3:=hp3^.next;
+                             end;
+                           hp1:=hp1^.next;
+                        end;
+                      if is_sized then
+                        begin
+                           if current_level <= 16 then
+                             writeln(outfile,'word;')
+                           else if current_level <= 32 then
+                             writeln(outfile,'longint;')
+                           else
+                             internalerror(11);
+                           is_sized:=false;
+                        end;
+                      popshift;
+                      write(outfile,aktspace,'end');
+                      flush(outfile);
+                   end;
+                 dec(typedef_level);
+              end;
+            t_uniondef :
+              begin
+                 if (typedef_level>1) and (p^.p1=nil) and
+                    (p^.p2^.typ=t_id) then
+                   begin
+                      write(outfile,p^.p2^.p);
+                   end
+                 else
+                   begin
+                      inc(typedef_level);
+                      writeln(outfile,'record');
+                      shift(2);
+                      writeln(outfile,aktspace,'case longint of');
+                      shift(3);
+                      l:=0;
+                      hp1:=p^.p1;
+
+                      (* walk through all members *)
+                      while assigned(hp1) do
+                        begin
+                           (* hp2 is t_memberdec *)
+                           hp2:=hp1^.p1;
+                           (* hp3 is t_declist *)
+                           hp3:=hp2^.p2;
+                           while assigned(hp3) do
+                             begin
+                                write(outfile,aktspace,l,' : ( ');
+                                write(outfile,hp3^.p1^.p2^.p,' : ');
+                                shift(2);
+                                write_p_a_def(outfile,hp3^.p1^.p1,hp2^.p1);
+                                popshift;
+                                writeln(outfile,' );');
+                                hp3:=hp3^.next;
+                                inc(l);
+                             end;
+                           hp1:=hp1^.next;
+                        end;
+                      popshift;
+                      write(outfile,aktspace,'end');
+                      popshift;
+                      flush(outfile);
+                      dec(typedef_level);
+                   end;
+              end;
+            else
+              internalerror(3);
+         end;
+      end;
+
+    procedure write_def_params(var outfile:text; p : presobject);
+      var
+         hp1 : presobject;
+      begin
+         case p^.typ of
+            t_enumdef : begin
+                           hp1:=p^.p1;
+                           while assigned(hp1) do
+                             begin
+                                write(outfile,hp1^.p1^.p);
+                                hp1:=hp1^.next;
+                                if assigned(hp1) then
+                                  write(outfile,',')
+                                else
+                                  write(outfile);
+                                flush(outfile);
+                             end;
+                           flush(outfile);
+                        end;
+         else internalerror(4);
+         end;
+      end;
+
+const TYPEDEF = 257;
+const DEFINE = 258;
+const COLON = 259;
+const SEMICOLON = 260;
+const COMMA = 261;
+const LKLAMMER = 262;
+const RKLAMMER = 263;
+const LECKKLAMMER = 264;
+const RECKKLAMMER = 265;
+const LGKLAMMER = 266;
+const RGKLAMMER = 267;
+const STRUCT = 268;
+const UNION = 269;
+const ENUM = 270;
+const ID = 271;
+const NUMBER = 272;
+const CSTRING = 273;
+const SHORT = 274;
+const UNSIGNED = 275;
+const LONG = 276;
+const INT = 277;
+const REAL = 278;
+const _CHAR = 279;
+const VOID = 280;
+const _CONST = 281;
+const _FAR = 282;
+const _HUGE = 283;
+const _NEAR = 284;
+const _ASSIGN = 285;
+const NEW_LINE = 286;
+const SPACE_DEFINE = 287;
+const EXTERN = 288;
+const STDCALL = 289;
+const CDECL = 290;
+const CALLBACK = 291;
+const PASCAL = 292;
+const WINAPI = 293;
+const APIENTRY = 294;
+const WINGDIAPI = 295;
+const SYS_TRAP = 296;
+const _PACKED = 297;
+const ELLIPSIS = 298;
+const R_AND = 299;
+const EQUAL = 300;
+const UNEQUAL = 301;
+const GT = 302;
+const LT = 303;
+const GTE = 304;
+const LTE = 305;
+const QUESTIONMARK = 306;
+const _OR = 307;
+const _AND = 308;
+const _PLUS = 309;
+const MINUS = 310;
+const _SHR = 311;
+const _SHL = 312;
+const STAR = 313;
+const _SLASH = 314;
+const _NOT = 315;
+const PSTAR = 316;
+const P_AND = 317;
+const POINT = 318;
+const DEREF = 319;
+const STICK = 320;
+
+var yylval : YYSType;
+
+function yylex : Integer; forward;
+
+function yyparse : Integer;
+
+var yystate, yysp, yyn : Integer;
+    yys : array [1..yymaxdepth] of Integer;
+    yyv : array [1..yymaxdepth] of YYSType;
+    yyval : YYSType;
+
+procedure yyaction ( yyruleno : Integer );
+  (* local definitions: *)
+begin
+  (* actions: *)
+  case yyruleno of
+   1 : begin
+         yyval := yyv[yysp-0];
+       end;
+   2 : begin
+         writeln(outfile,'(* error ');
+         writeln(outfile,prev_line);
+         writeln(outfile,last_source_line);
+         
+       end;
+   3 : begin
+         if yydebug then writeln('declaration reduced at line ',line_no);
+         if yydebug then writeln(outfile,'(* declaration reduced *)');
+         
+       end;
+   4 : begin
+         if yydebug then writeln('define declaration reduced at line ',line_no);
+         if yydebug then writeln(outfile,'(* define declaration reduced *)');
+         
+       end;
+   5 : begin
+         if yydebug then writeln('declaration reduced at line ',line_no);
+         
+       end;
+   6 : begin
+         if yydebug then writeln('define declaration reduced at line ',line_no);
+         
+       end;
+   7 : begin
+         yyval:=new(presobject,init_id('extern')); 
+       end;
+   8 : begin
+         yyval:=new(presobject,init_id('intern')); 
+       end;
+   9 : begin
+         yyval:=new(presobject,init_id('no_pop')); 
+       end;
+  10 : begin
+         yyval:=new(presobject,init_id('cdecl')); 
+       end;
+  11 : begin
+         yyval:=new(presobject,init_id('no_pop')); 
+       end;
+  12 : begin
+         yyval:=new(presobject,init_id('no_pop')); 
+       end;
+  13 : begin
+         yyval:=new(presobject,init_id('no_pop')); 
+       end;
+  14 : begin
+         yyval:=new(presobject,init_id('no_pop')); 
+       end;
+  15 : begin
+         yyval:=new(presobject,init_id('no_pop')); 
+       end;
+  16 : begin
+         yyval:=nil 
+       end;
+  17 : begin
+         yyval:=yyv[yysp-1]; 
+       end;
+  18 : begin
+         yyval:=nil; 
+       end;
+  19 : begin
+         IsExtern:=false;
+         (* by default we must pop the args pushed on stack *)
+         no_pop:=false;
+         (* writeln(outfile,'{ dec_specifier type_specifier declarator_list SEMICOLON}');
+         
+         if assigned(yyv[yysp-3]) then writeln(outfile,'{*$3}');
+         if assigned(yyv[yysp-3])and assigned(yyv[yysp-3].p1)
+         then writeln(outfile,'{*$3^.p1}');
+         if assigned(yyv[yysp-3])and assigned(yyv[yysp-3]^.p1)and assigned(yyv[yysp-3]^.p1^.p1)
+         then writeln(outfile,'{*$3^.p1^.p1}');
+         *)
+         
+         if (assigned(yyv[yysp-2])and assigned(yyv[yysp-2]^.p1)and assigned(yyv[yysp-2]^.p1^.p1))
+         and (yyv[yysp-2]^.p1^.p1^.typ=t_procdef) then
+         begin
+         If UseLib then
+         IsExtern:=true
+         else
+         IsExtern:=assigned(yyv[yysp-5])and(yyv[yysp-5]^.str='extern');
+         no_pop:=assigned(yyv[yysp-3]) and (yyv[yysp-3]^.str='no_pop');
+         if block_type<>bt_func then
+         writeln(outfile);
+         
+         block_type:=bt_func;
+         write(outfile,aktspace);
+         write(extfile,aktspace);
+         (* distinguish between procedure and function *)
+         if assigned(yyv[yysp-4]) then
+         if (yyv[yysp-4]^.typ=t_void) and (yyv[yysp-2]^.p1^.p1^.p1=nil) then
+         begin
+         write(outfile,'procedure ',yyv[yysp-2]^.p1^.p2^.p);
+         (* write arguments *)
+         shift(10);
+         if assigned(yyv[yysp-2]^.p1^.p1^.p2) then
+         write_args(outfile,yyv[yysp-2]^.p1^.p1^.p2);
+         write(extfile,'procedure ',yyv[yysp-2]^.p1^.p2^.p);
+         (* write arguments *)
+         if assigned(yyv[yysp-2]^.p1^.p1^.p2) then
+         write_args(extfile,yyv[yysp-2]^.p1^.p1^.p2);
+         end
+         else
+         begin
+         write(outfile,'function ',yyv[yysp-2]^.p1^.p2^.p);
+         write(extfile,'function ',yyv[yysp-2]^.p1^.p2^.p);
+         
+         shift(9);
+         (* write arguments *)
+         if assigned(yyv[yysp-2]^.p1^.p1^.p2) then
+         write_args(outfile,yyv[yysp-2]^.p1^.p1^.p2);
+         if assigned(yyv[yysp-2]^.p1^.p1^.p2) then
+         write_args(extfile,yyv[yysp-2]^.p1^.p1^.p2);
+         
+         write(outfile,':');
+         write(extfile,':');
+         write_p_a_def(outfile,yyv[yysp-2]^.p1^.p1^.p1,yyv[yysp-4]);
+         write_p_a_def(extfile,yyv[yysp-2]^.p1^.p1^.p1,yyv[yysp-4]);
+         end;
+         
+         if assigned(yyv[yysp-1]) then
+         write(outfile,';systrap ',yyv[yysp-1]^.p);
+         
+         (* No CDECL in interface for Uselib *)
+         if IsExtern and (not no_pop) then
+         begin
+         write(outfile,';cdecl');
+         write(extfile,';cdecl');
+         end;
+         popshift;
+         if UseLib then
+         begin
+         if IsExtern then
+         begin
+         write (extfile,';external');
+         If UseName then
+         Write(extfile,' External_library name ''',yyv[yysp-2]^.p1^.p2^.p,'''');
+         end;
+         writeln(extfile,';');
+         writeln(outfile,';');
+         end
+         else
+         begin
+         writeln(extfile,';');
+         writeln(outfile,';');
+         if not IsExtern then
+         begin
+         writeln(extfile,aktspace,'  begin');
+         writeln(extfile,aktspace,'     { You must implemented this function }');
+         writeln(extfile,aktspace,'  end;');
+         end;
+         end;
+         IsExtern:=false;
+         writeln(outfile);
+         if Uselib then
+         writeln(extfile);
+         end
+         else (* yyv[yysp-2]^.p1^.p1^.typ=t_procdef *)
+         if assigned(yyv[yysp-2])and assigned(yyv[yysp-2]^.p1) then
+         begin
+         shift(2);
+         if block_type<>bt_var then
+         begin
+         writeln(outfile);
+         writeln(outfile,aktspace,'var');
+         end;
+         block_type:=bt_var;
+         
+         shift(3);
+         
+         IsExtern:=assigned(yyv[yysp-5])and(yyv[yysp-5]^.str='extern');
+         (* walk through all declarations *)
+         hp:=yyv[yysp-2];
+         while assigned(hp) and assigned(hp^.p1) do
+         begin
+         (* write new var name *)
+         if assigned(hp^.p1^.p2)and assigned(hp^.p1^.p2^.p)then
+         write(outfile,aktspace,hp^.p1^.p2^.p);
+         write(outfile,' : ');
+         shift(2);
+         (* write its type *)
+         write_p_a_def(outfile,hp^.p1^.p1,yyv[yysp-4]);
+         if assigned(hp^.p1^.p2)and assigned(hp^.p1^.p2^.p)then
+         begin
+         if isExtern then
+         write(outfile,';cvar;external')
+         else
+         write(outfile,';cvar;export');
+         write(outfile,hp^.p1^.p2^.p);
+         end;
+         writeln(outfile,''';');
+         popshift;
+         hp:=hp^.p2;
+         end;
+         popshift;
+         popshift;
+         end;
+         if assigned(yyv[yysp-5])then  dispose(yyv[yysp-5],done);
+         if assigned(yyv[yysp-4])then  dispose(yyv[yysp-4],done);
+         if assigned(yyv[yysp-2])then  dispose(yyv[yysp-2],done);
+         
+       end;
+  20 : begin
+         
+         if block_type<>bt_type then
+         begin
+         writeln(outfile);
+         writeln(outfile,aktspace,'type');
+         end;
+         block_type:=bt_type;
+         shift(3);
+         (* write new type name *)
+         TN:=strpas(yyv[yysp-1]^.p2^.p);
+         if (yyv[yysp-1]^.typ=t_structdef) or (yyv[yysp-1]^.typ=t_uniondef) then
+         begin
+         PN:='P'+strpas(yyv[yysp-1]^.p2^.p);
+         if PrependTypes then
+         TN:='T'+TN;
+         if UsePPointers then
+         Writeln (outfile,aktspace,PN,' = ^',TN,';');
+         end;
+         write(outfile,aktspace,TN,' = ');
+         shift(2);
+         hp:=yyv[yysp-1];
+         write_type_specifier(outfile,hp);
+         popshift;
+         (* enum_to_const can make a switch to const *)
+         if block_type=bt_type then writeln(outfile,';');
+         writeln(outfile);
+         flush(outfile);
+         popshift;
+         if must_write_packed_field then
+         write_packed_fields_info(outfile,hp,TN);
+         if assigned(hp) then
+         dispose(hp,done);
+         
+       end;
+  21 : begin
+         
+         if block_type<>bt_type then
+         begin
+         writeln(outfile);
+         writeln(outfile,aktspace,'type');
+         end;
+         block_type:=bt_type;
+         
+         no_pop:=assigned(yyv[yysp-2]) and (yyv[yysp-2]^.str='no_pop');
+         shift(3);
+         (* walk through all declarations *)
+         hp:=yyv[yysp-1];
+         ph:=nil;
+         is_procvar:=false;
+         while assigned(hp) do
+         begin
+         writeln(outfile);
+         (* write new type name *)
+         write(outfile,aktspace,hp^.p1^.p2^.p);
+         write(outfile,' = ');
+         shift(2);
+         if assigned(ph) then
+         write_p_a_def(outfile,hp^.p1^.p1,ph)
+         else
+         write_p_a_def(outfile,hp^.p1^.p1,yyv[yysp-3]);
+         (* simple def ?
+         keep the name for the other defs *)
+         if (ph=nil) and (hp^.p1^.p1=nil) then
+         ph:=hp^.p1^.p2;
+         popshift;
+         (* if no_pop it is normal fpc calling convention *)
+         if is_procvar and
+         (not no_pop) then
+         write(outfile,';cdecl');
+         writeln(outfile,';');
+         flush(outfile);
+         hp:=hp^.next;
+         end;
+         (* write tag name *)
+         if assigned(ph) and
+         ((yyv[yysp-3]^.typ=t_structdef) or
+         (yyv[yysp-3]^.typ=t_enumdef) or
+         (yyv[yysp-3]^.typ=t_uniondef)) and
+         assigned(yyv[yysp-3]^.p2) then
+         begin
+         writeln(outfile);
+         write(outfile,aktspace,yyv[yysp-3]^.p2^.p,' = ');
+         if assigned(ph) then
+         writeln(outfile,ph^.p,';')
+         else
+         begin
+         write_p_a_def(outfile,hp^.p1^.p1,yyv[yysp-3]);
+         writeln(outfile,';');
+         end;
+         end;
+         popshift;
+         if must_write_packed_field then
+         if assigned(ph) then
+         write_packed_fields_info(outfile,yyv[yysp-3],ph^.str)
+         else if assigned(yyv[yysp-3]^.p2) then
+         write_packed_fields_info(outfile,yyv[yysp-3],yyv[yysp-3]^.p2^.str);
+         if assigned(yyv[yysp-3])then
+         dispose(yyv[yysp-3],done);
+         if assigned(yyv[yysp-2])then
+         dispose(yyv[yysp-2],done);
+         if assigned(yyv[yysp-1])then
+         dispose(yyv[yysp-1],done);
+         
+       end;
+  22 : begin
+         
+         if block_type<>bt_type then
+         begin
+         writeln(outfile);
+         writeln(outfile,aktspace,'type');
+         end;
+         block_type:=bt_type;
+         
+         shift(3);
+         (* write as pointer *)
+         writeln(outfile);
+         writeln(outfile,'(* generic typedef  *)');
+         writeln(outfile,aktspace,yyv[yysp-1]^.p,' = pointer;');
+         flush(outfile);
+         popshift;
+         if assigned(yyv[yysp-1])then
+         dispose(yyv[yysp-1],done);
+         
+       end;
+  23 : begin
+         writeln(outfile,'in declaration at line ',line_no,' *)');
+         aktspace:='';
+         in_space_define:=0;
+         in_define:=false;
+         arglevel:=0;
+         if_nb:=0;
+         aktspace:='    ';
+         space_index:=1;
+         yyerrok;
+       end;
+  24 : begin
+         
+         writeln (outfile,aktspace,'{ was #define dname(params) def_expr }');
+         writeln (extfile,aktspace,'{ was #define dname(params) def_expr }');
+         if assigned(yyv[yysp-4]) then
+         begin
+         writeln (outfile,aktspace,'{ argument types are unknown }');
+         writeln (extfile,aktspace,'{ argument types are unknown }');
+         end;
+         if not assigned(yyv[yysp-1]^.p3) then
+         begin
+         writeln(outfile,aktspace,'{ return type might be wrong }   ');
+         writeln(extfile,aktspace,'{ return type might be wrong }   ');
+         end;
+         block_type:=bt_func;
+         write(outfile,aktspace,'function ',yyv[yysp-6]^.p);
+         write(extfile,aktspace,'function ',yyv[yysp-6]^.p);
+         
+         if assigned(yyv[yysp-4]) then
+         begin
+         write(outfile,'(');
+         write(extfile,'(');
+         ph:=new(presobject,init_one(t_enumdef,yyv[yysp-4]));
+         write_def_params(outfile,ph);
+         write_def_params(extfile,ph);
+         if assigned(ph) then dispose(ph,done);
+         ph:=nil;
+         (* types are unknown *)
+         write(outfile,' : longint)');
+         write(extfile,' : longint)');
+         end;
+         if not assigned(yyv[yysp-1]^.p3) then
+         begin
+         writeln(outfile,' : longint;');
+         writeln(outfile,aktspace,'  { return type might be wrong }   ');
+         flush(outfile);
+         writeln(extfile,' : longint;');
+         writeln(extfile,aktspace,'  { return type might be wrong }   ');
+         end
+         else
+         begin
+         write(outfile,' : ');
+         write_type_specifier(outfile,yyv[yysp-1]^.p3);
+         writeln(outfile,';');
+         flush(outfile);
+         write(extfile,' : ');
+         write_type_specifier(extfile,yyv[yysp-1]^.p3);
+         writeln(extfile,';');
+         end;
+         writeln(outfile);
+         flush(outfile);
+         hp:=new(presobject,init_two(t_funcname,yyv[yysp-6],yyv[yysp-1]));
+         write_funexpr(extfile,hp);
+         writeln(extfile);
+         flush(extfile);
+         if assigned(hp)then dispose(hp,done);
+         
+       end;
+  25 : begin
+         
+         writeln(outfile,'{$define ',yyv[yysp-2]^.p,'}');
+         flush(outfile);
+         if assigned(yyv[yysp-2])then
+         dispose(yyv[yysp-2],done);
+         
+       end;
+  26 : begin
+         
+         writeln(outfile,'{$define ',yyv[yysp-1]^.p,'}');
+         flush(outfile);
+         if assigned(yyv[yysp-1])then
+         dispose(yyv[yysp-1],done);
+         
+       end;
+  27 : begin
+         
+         if (yyv[yysp-1]^.typ=t_exprlist) and
+         yyv[yysp-1]^.p1^.is_const and
+         not assigned(yyv[yysp-1]^.next) then
+         begin
+         if block_type<>bt_const then
+         begin
+         writeln(outfile);
+         writeln(outfile,aktspace,'const');
+         end;
+         block_type:=bt_const;
+         
+         aktspace:=aktspace+'   ';
+         write(outfile,aktspace,yyv[yysp-3]^.p);
+         write(outfile,' = ');
+         flush(outfile);
+         write_expr(outfile,yyv[yysp-1]^.p1);
+         writeln(outfile,';');
+         dec(byte(aktspace[0]),3);
+         if assigned(yyv[yysp-3]) then
+         dispose(yyv[yysp-3],done);
+         if assigned(yyv[yysp-1]) then
+         dispose(yyv[yysp-1],done);
+         end
+         else
+         begin
+         aktspace:=aktspace+'  ';
+         writeln (outfile,aktspace,'{ was #define dname def_expr }');
+         writeln (extfile,aktspace,'{ was #define dname def_expr }');
+         block_type:=bt_func;
+         write(outfile,aktspace,'function ',yyv[yysp-3]^.p);
+         write(extfile,aktspace,'function ',yyv[yysp-3]^.p);
+         if not assigned(yyv[yysp-1]^.p3) then
+         begin
+         writeln(outfile,' : longint;');
+         writeln(outfile,aktspace,'  { return type might be wrong }');
+         flush(outfile);
+         writeln(extfile,' : longint;');
+         writeln(extfile,aktspace,'  { return type might be wrong }');
+         end
+         else
+         begin
+         write(outfile,' : ');
+         write_type_specifier(outfile,yyv[yysp-1]^.p3);
+         writeln(outfile,';');
+         flush(outfile);
+         write(extfile,' : ');
+         write_type_specifier(extfile,yyv[yysp-1]^.p3);
+         writeln(extfile,';');
+         end;
+         writeln(outfile);
+         flush(outfile);
+         hp:=new(presobject,init_two(t_funcname,yyv[yysp-3],yyv[yysp-1]));
+         write_funexpr(extfile,hp);
+         dec(byte(aktspace[0]),2);
+         dispose(hp,done);
+         writeln(extfile);
+         flush(extfile);
+         end;
+         
+       end;
+  28 : begin
+         writeln(outfile,'in define line ',line_no,' *)');
+         aktspace:='';
+         in_space_define:=0;
+         in_define:=false;
+         arglevel:=0;
+         if_nb:=0;
+         aktspace:='    ';
+         space_index:=1;
+         
+         yyerrok;
+       end;
+  29 : begin
+         yyval:=yyv[yysp-1];
+       end;
+  30 : begin
+         writeln(outfile,' in member_list *)');
+         yyerrok;
+         yyval:=nil;
+         
+       end;
+  31 : begin
+         yyval:=yyv[yysp-1];
+       end;
+  32 : begin
+         writeln(outfile,' in enum_list *)');
+         yyerrok;
+         yyval:=nil;
+         
+       end;
+  33 : begin
+         
+         if not is_packed then
+         writeln(outfile,'{$PACKRECORDS 1}');
+         is_packed:=true;
+         yyval:=new(presobject,init_two(t_structdef,yyv[yysp-1],yyv[yysp-2]));
+         
+       end;
+  34 : begin
+         
+         if is_packed then
+         writeln(outfile,'{$PACKRECORDS 4}');
+         is_packed:=false;
+         yyval:=new(presobject,init_two(t_structdef,yyv[yysp-0],yyv[yysp-1]));
+         
+       end;
+  35 : begin
+         
+         if not is_packed then
+         writeln(outfile,'{$PACKRECORDS 1}');
+         is_packed:=true;
+         yyval:=new(presobject,init_two(t_uniondef,yyv[yysp-1],yyv[yysp-2]));
+         
+       end;
+  36 : begin
+         
+         yyval:=new(presobject,init_two(t_uniondef,yyv[yysp-0],yyv[yysp-1]));
+         
+       end;
+  37 : begin
+         
+         yyval:=new(presobject,init_two(t_uniondef,nil,yyv[yysp-0]));
+         
+       end;
+  38 : begin
+         
+         yyval:=new(presobject,init_two(t_structdef,nil,yyv[yysp-0]));
+         
+       end;
+  39 : begin
+         
+         yyval:=new(presobject,init_two(t_enumdef,yyv[yysp-0],yyv[yysp-1]));
+         
+       end;
+  40 : begin
+         
+         yyval:=new(presobject,init_two(t_enumdef,nil,yyv[yysp-0]));
+         
+       end;
+  41 : begin
+         
+         writeln(outfile,'(* Const before type ignored *)');
+         yyval:=yyv[yysp-0];
+         
+       end;
+  42 : begin
+         
+         if not is_packed then
+         writeln(outfile,'{$PACKRECORDS 1}');
+         is_packed:=true;
+         yyval:=new(presobject,init_one(t_uniondef,yyv[yysp-1]));
+         
+       end;
+  43 : begin
+         
+         yyval:=new(presobject,init_one(t_uniondef,yyv[yysp-0]));
+         
+       end;
+  44 : begin
+         
+         if not is_packed then
+         writeln(outfile,'{$PACKRECORDS 1}');
+         is_packed:=true;
+         yyval:=new(presobject,init_one(t_structdef,yyv[yysp-1]));
+         
+       end;
+  45 : begin
+         
+         if is_packed then
+         writeln(outfile,'{$PACKRECORDS 4}');
+         is_packed:=false;
+         yyval:=new(presobject,init_one(t_structdef,yyv[yysp-0]));
+         
+       end;
+  46 : begin
+         
+         yyval:=new(presobject,init_one(t_enumdef,yyv[yysp-0]));
+         
+       end;
+  47 : begin
+         
+         yyval:=yyv[yysp-0];
+         
+       end;
+  48 : begin
+         yyval:=yyv[yysp-0]; 
+       end;
+  49 : begin
+         
+         yyval:=new(presobject,init_one(t_memberdeclist,yyv[yysp-1]));
+         yyval^.next:=yyv[yysp-0];
+         
+       end;
+  50 : begin
+         
+         yyval:=new(presobject,init_one(t_memberdeclist,yyv[yysp-0]));
+         
+       end;
+  51 : begin
+         
+         yyval:=new(presobject,init_two(t_memberdec,yyv[yysp-2],yyv[yysp-1]));
+         
+       end;
+  52 : begin
+         (*dname*)
+         yyval:=new(presobject,init_id(act_token));
+         
+       end;
+  53 : begin
+         
+         yyval:=new(presobject,init_id(INT_STR));
+         
+       end;
+  54 : begin
+         
+         yyval:=new(presobject,init_id(UINT_STR));
+         
+       end;
+  55 : begin
+         
+         yyval:=new(presobject,init_id(INT_STR));
+         
+       end;
+  56 : begin
+         
+         yyval:=new(presobject,init_id(REAL_STR));
+         
+       end;
+  57 : begin
+         
+         yyval:=new(presobject,init_id(INT_STR));
+         
+       end;
+  58 : begin
+         
+         yyval:=new(presobject,init_id(UINT_STR));
+         
+       end;
+  59 : begin
+         
+         yyval:=new(presobject,init_id(UINT_STR));
+         
+       end;
+  60 : begin
+         
+         yyval:=new(presobject,init_id(UINT_STR));
+         
+       end;
+  61 : begin
+         
+         yyval:=new(presobject,init_id(USHORT_STR));
+         
+       end;
+  62 : begin
+         
+         yyval:=new(presobject,init_id(UCHAR_STR));
+         
+       end;
+  63 : begin
+         
+         yyval:=new(presobject,init_no(t_void));
+         
+       end;
+  64 : begin
+         
+         yyval:=new(presobject,init_id(SHORT_STR));
+         
+       end;
+  65 : begin
+         
+         yyval:=new(presobject,init_id(CHAR_STR));
+         
+       end;
+  66 : begin
+         
+         yyval:=yyv[yysp-0];
+         
+       end;
+  67 : begin
+         
+         yyval:=yyv[yysp-0];
+         
+       end;
+  68 : begin
+         
+         yyval:=yyv[yysp-2];
+         hp:=yyv[yysp-2];
+         while assigned(hp^.next) do
+         hp:=hp^.next;
+         hp^.next:=new(presobject,init_one(t_declist,yyv[yysp-0]));
+         
+       end;
+  69 : begin
+         
+         writeln(outfile,' in declarator_list *)');
+         yyval:=yyv[yysp-0];
+         yyerrok;
+         
+       end;
+  70 : begin
+         
+         writeln(outfile,' in declarator_list *)');
+         yyerrok;
+         
+       end;
+  71 : begin
+         
+         yyval:=new(presobject,init_one(t_declist,yyv[yysp-0]));
+         
+       end;
+  72 : begin
+         
+         yyval:=new(presobject,init_two(t_arg,yyv[yysp-1],yyv[yysp-0]));
+         
+       end;
+  73 : begin
+         
+         yyval:=new(presobject,init_two(t_arg,yyv[yysp-1],yyv[yysp-0]));
+         
+       end;
+  74 : begin
+         
+         yyval:=new(presobject,init_two(t_arglist,yyv[yysp-0],nil));
+         
+       end;
+  75 : begin
+         
+         yyval:=new(presobject,init_two(t_arglist,yyv[yysp-2],nil));
+         yyval^.next:=yyv[yysp-0];
+         
+       end;
+  76 : begin
+         
+         yyval:=new(presobject,init_two(t_arglist,ellipsisarg,nil));
+         (*** ELLIPSIS PROBLEM ***)
+         
+       end;
+  77 : begin
+         yyval:=new(presobject,init_id('far'));
+       end;
+  78 : begin
+         yyval:=new(presobject,init_id('near'));
+       end;
+  79 : begin
+         yyval:=new(presobject,init_id('huge'));
+       end;
+  80 : begin
+         
+         writeln(outfile,'(* Const before declarator ignored *)');
+         yyval:=yyv[yysp-0];
+         
+       end;
+  81 : begin
+         
+         writeln(outfile,aktspace,'(* ',yyv[yysp-2]^.p,' ignored *)');
+         dispose(yyv[yysp-2],done);
+         hp:=yyv[yysp-0];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_one(t_pointerdef,nil));
+         
+       end;
+  82 : begin
+         
+         (* %prec PSTAR     this was wrong!! *)
+         hp:=yyv[yysp-0];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_one(t_pointerdef,nil));
+         
+       end;
+  83 : begin
+         
+         hp:=yyv[yysp-0];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_one(t_addrdef,nil));
+         
+       end;
+  84 : begin
+         
+         (*  size specifier supported *)
+         hp:=new(presobject,init_one(t_size_specifier,yyv[yysp-0]));
+         yyval:=new(presobject,init_three(t_dec,nil,yyv[yysp-2],hp));
+         
+       end;
+  85 : begin
+         
+         writeln(outfile,'(* Warning : default value for ',yyv[yysp-2]^.p,' ignored *)');
+         hp:=new(presobject,init_one(t_default_value,yyv[yysp-0]));
+         yyval:=new(presobject,init_three(t_dec,nil,yyv[yysp-2],hp));
+         
+       end;
+  86 : begin
+         
+         yyval:=new(presobject,init_two(t_dec,nil,yyv[yysp-0]));
+         
+       end;
+  87 : begin
+         
+         hp:=yyv[yysp-3];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_two(t_procdef,nil,yyv[yysp-1]));
+         
+       end;
+  88 : begin
+         
+         hp:=yyv[yysp-1];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_two(t_procdef,nil,nil));
+         
+       end;
+  89 : begin
+         
+         hp:=yyv[yysp-3];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_two(t_arraydef,nil,yyv[yysp-1]));
+         
+       end;
+  90 : begin
+         yyval:=yyv[yysp-1]; 
+       end;
+  91 : begin
+         yyval := yyv[yysp-1];
+       end;
+  92 : begin
+         yyval := yyv[yysp-2];
+       end;
+  93 : begin
+         
+         writeln(outfile,'(* Const before abstract_declarator ignored *)');
+         yyval:=yyv[yysp-0];
+         
+       end;
+  94 : begin
+         
+         writeln(outfile,aktspace,'(* ',yyv[yysp-2]^.p,' ignored *)');
+         dispose(yyv[yysp-2],done);
+         hp:=yyv[yysp-0];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_one(t_pointerdef,nil));
+         
+       end;
+  95 : begin
+         
+         hp:=yyv[yysp-0];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_one(t_pointerdef,nil));
+         
+       end;
+  96 : begin
+         
+         hp:=yyv[yysp-3];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_two(t_procdef,nil,yyv[yysp-1]));
+         
+       end;
+  97 : begin
+         
+         hp:=yyv[yysp-1];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_two(t_procdef,nil,nil));
+         
+       end;
+  98 : begin
+         
+         hp:=yyv[yysp-3];
+         yyval:=hp;
+         while assigned(hp^.p1) do
+         hp:=hp^.p1;
+         hp^.p1:=new(presobject,init_two(t_arraydef,nil,yyv[yysp-1]));
+         
+       end;
+  99 : begin
+         yyval:=yyv[yysp-1]; 
+       end;
+ 100 : begin
+         
+         yyval:=new(presobject,init_two(t_dec,nil,nil));
+         
+       end;
+ 101 : begin
+         yyval:=yyv[yysp-0];
+       end;
+ 102 : begin
+         yyval:=new(presobject,init_bop(' = ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 103 : begin
+         yyval:=new(presobject,init_bop(' <> ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 104 : begin
+         yyval:=new(presobject,init_bop(' > ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 105 : begin
+         yyval:=new(presobject,init_bop(' >= ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 106 : begin
+         yyval:=new(presobject,init_bop(' < ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 107 : begin
+         yyval:=new(presobject,init_bop(' <= ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 108 : begin
+         yyval:=new(presobject,init_bop(' + ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 109 : begin
+         yyval:=new(presobject,init_bop(' - ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 110 : begin
+         yyval:=new(presobject,init_bop(' * ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 111 : begin
+         yyval:=new(presobject,init_bop(' / ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 112 : begin
+         yyval:=new(presobject,init_bop(' or ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 113 : begin
+         yyval:=new(presobject,init_bop(' and ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 114 : begin
+         yyval:=new(presobject,init_bop(' not ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 115 : begin
+         yyval:=new(presobject,init_bop(' shl ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 116 : begin
+         yyval:=new(presobject,init_bop(' shr ',yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 117 : begin
+         yyv[yysp-0]^.p1:=yyv[yysp-2];
+         yyval:=yyv[yysp-0];
+         inc(if_nb);
+         yyval^.p:=strpnew('if_local'+str(if_nb));
+         
+       end;
+ 118 : begin
+         yyval:=yyv[yysp-0];
+       end;
+ 119 : begin
+         (* if A then B else C *)
+         yyval:=new(presobject,init_three(t_ifexpr,nil,yyv[yysp-2],yyv[yysp-0]));
+       end;
+ 120 : begin
+         yyval:=yyv[yysp-0]; 
+       end;
+ 121 : begin
+         yyval:=nil;
+       end;
+ 122 : begin
+         
+         yyval:=yyv[yysp-0];
+         
+       end;
+ 123 : begin
+         
+         (* remove L prefix for widestrings *)
+         s:=act_token;
+         if Win32headers and (s[1]='L') then
+         delete(s,1,1);
+         yyval:=new(presobject,init_id(''''+copy(s,2,length(s)-2)+''''));
+         
+       end;
+ 124 : begin
+         
+         yyval:=new(presobject,init_id(act_token));
+         
+       end;
+ 125 : begin
+         
+         yyval:=new(presobject,init_bop('.',yyv[yysp-2],yyv[yysp-0]));
+         
+       end;
+ 126 : begin
+         
+         yyval:=new(presobject,init_bop('^.',yyv[yysp-2],yyv[yysp-0]));
+         
+       end;
+ 127 : begin
+         
+         yyval:=new(presobject,init_preop('-',yyv[yysp-0]));
+         
+       end;
+ 128 : begin
+         
+         yyval:=new(presobject,init_preop('@',yyv[yysp-0]));
+         
+       end;
+ 129 : begin
+         
+         yyval:=new(presobject,init_preop(' not ',yyv[yysp-0]));
+         
+       end;
+ 130 : begin
+         
+         if assigned(yyv[yysp-0]) then
+         yyval:=new(presobject,init_two(t_typespec,yyv[yysp-2],yyv[yysp-0]))
+         else
+         yyval:=yyv[yysp-2];
+         
+       end;
+ 131 : begin
+         
+         yyval:=new(presobject,init_two(t_typespec,yyv[yysp-2],yyv[yysp-0]));
+         
+       end;
+ 132 : begin
+         
+         hp:=new(presobject,init_one(t_pointerdef,yyv[yysp-3]));
+         yyval:=new(presobject,init_two(t_typespec,hp,yyv[yysp-0]));
+         
+       end;
+ 133 : begin
+         
+         writeln(outfile,aktspace,'(* ',yyv[yysp-3]^.p,' ignored *)');
+         dispose(yyv[yysp-3],done);
+         write_type_specifier(outfile,yyv[yysp-4]);
+         writeln(outfile,' ignored *)');
+         hp:=new(presobject,init_one(t_pointerdef,yyv[yysp-4]));
+         yyval:=new(presobject,init_two(t_typespec,hp,yyv[yysp-0]));
+         
+       end;
+ 134 : begin
+         
+         hp:=new(presobject,init_one(t_exprlist,yyv[yysp-3]));
+         yyval:=new(presobject,init_three(t_funexprlist,hp,yyv[yysp-1],nil));
+         
+       end;
+ 135 : begin
+         
+         yyval:=yyv[yysp-1];
+         
+       end;
+ 136 : begin
+         (*enum_element COMMA enum_list *)
+         yyval:=yyv[yysp-2];
+         yyval^.next:=yyv[yysp-0];
+         
+       end;
+ 137 : begin
+         
+         yyval:=yyv[yysp-0];
+         
+       end;
+ 138 : begin
+         (* empty enum list *)
+         yyval:=nil;
+       end;
+ 139 : begin
+         begin (*enum_element: dname _ASSIGN expr *)
+         yyval:=new(presobject,init_two(t_enumlist,yyv[yysp-2],yyv[yysp-0]));
+         end;
+         
+       end;
+ 140 : begin
+         
+         begin (*enum_element: dname*)
+         yyval:=new(presobject,init_two(t_enumlist,yyv[yysp-0],nil));
+         end;
+         
+       end;
+ 141 : begin
+         
+         if yyv[yysp-0]^.typ=t_funexprlist then
+         yyval:=yyv[yysp-0]
+         else
+         yyval:=new(presobject,init_two(t_exprlist,yyv[yysp-0],nil));
+         (* if here is a type specifier
+         we know the return type *)
+         if (yyv[yysp-0]^.typ=t_typespec) then
+         yyval^.p3:=yyv[yysp-0]^.p1^.get_copy;
+         
+       end;
+ 142 : begin
+         (*exprlist COMMA expr*)
+         yyval:=yyv[yysp-2];
+         yyv[yysp-2]^.next:=yyv[yysp-0];
+         
+       end;
+ 143 : begin
+         
+         yyval:=yyv[yysp-0];
+         
+       end;
+ 144 : begin
+         (* empty expression list *)
+         yyval:=nil; 
+       end;
+ 145 : begin
+         
+         yyval:=new(presobject,init_one(t_exprlist,yyv[yysp-0]));
+         
+       end;
+  end;
+end(*yyaction*);
+
+(* parse table: *)
+
+type YYARec = record
+                sym, act : Integer;
+              end;
+     YYRRec = record
+                len, sym : Integer;
+              end;
+
+const
+
+yynacts   = 1862;
+yyngotos  = 297;
+yynstates = 250;
+yynrules  = 145;
+
+yya : array [1..yynacts] of YYARec = (
+{ 0: }
+  ( sym: 256; act: 7 ),
+  ( sym: 257; act: 8 ),
+  ( sym: 258; act: 9 ),
+  ( sym: 268; act: 10 ),
+  ( sym: 269; act: 11 ),
+  ( sym: 270; act: 12 ),
+  ( sym: 288; act: 13 ),
+  ( sym: 271; act: -8 ),
+  ( sym: 274; act: -8 ),
+  ( sym: 275; act: -8 ),
+  ( sym: 276; act: -8 ),
+  ( sym: 277; act: -8 ),
+  ( sym: 278; act: -8 ),
+  ( sym: 279; act: -8 ),
+  ( sym: 280; act: -8 ),
+  ( sym: 281; act: -8 ),
+{ 1: }
+  ( sym: 260; act: 14 ),
+{ 2: }
+  ( sym: 268; act: 20 ),
+  ( sym: 269; act: 21 ),
+  ( sym: 270; act: 22 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 274; act: 24 ),
+  ( sym: 275; act: 25 ),
+  ( sym: 276; act: 26 ),
+  ( sym: 277; act: 27 ),
+  ( sym: 278; act: 28 ),
+  ( sym: 279; act: 29 ),
+  ( sym: 280; act: 30 ),
+  ( sym: 281; act: 31 ),
+{ 3: }
+{ 4: }
+{ 5: }
+  ( sym: 256; act: 7 ),
+  ( sym: 257; act: 8 ),
+  ( sym: 258; act: 9 ),
+  ( sym: 268; act: 10 ),
+  ( sym: 269; act: 11 ),
+  ( sym: 270; act: 12 ),
+  ( sym: 288; act: 13 ),
+  ( sym: 0; act: -1 ),
+  ( sym: 271; act: -8 ),
+  ( sym: 274; act: -8 ),
+  ( sym: 275; act: -8 ),
+  ( sym: 276; act: -8 ),
+  ( sym: 277; act: -8 ),
+  ( sym: 278; act: -8 ),
+  ( sym: 279; act: -8 ),
+  ( sym: 280; act: -8 ),
+  ( sym: 281; act: -8 ),
+{ 6: }
+  ( sym: 0; act: 0 ),
+{ 7: }
+{ 8: }
+  ( sym: 268; act: 20 ),
+  ( sym: 269; act: 21 ),
+  ( sym: 270; act: 22 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 274; act: 24 ),
+  ( sym: 275; act: 25 ),
+  ( sym: 276; act: 26 ),
+  ( sym: 277; act: 27 ),
+  ( sym: 278; act: 28 ),
+  ( sym: 279; act: 29 ),
+  ( sym: 280; act: 30 ),
+  ( sym: 281; act: 31 ),
+{ 9: }
+  ( sym: 271; act: 23 ),
+{ 10: }
+  ( sym: 271; act: 23 ),
+{ 11: }
+  ( sym: 271; act: 23 ),
+{ 12: }
+  ( sym: 271; act: 23 ),
+{ 13: }
+{ 14: }
+{ 15: }
+{ 16: }
+{ 17: }
+{ 18: }
+  ( sym: 289; act: 42 ),
+  ( sym: 290; act: 43 ),
+  ( sym: 291; act: 44 ),
+  ( sym: 292; act: 45 ),
+  ( sym: 293; act: 46 ),
+  ( sym: 294; act: 47 ),
+  ( sym: 295; act: 48 ),
+  ( sym: 256; act: -16 ),
+  ( sym: 262; act: -16 ),
+  ( sym: 271; act: -16 ),
+  ( sym: 281; act: -16 ),
+  ( sym: 282; act: -16 ),
+  ( sym: 283; act: -16 ),
+  ( sym: 284; act: -16 ),
+  ( sym: 308; act: -16 ),
+  ( sym: 313; act: -16 ),
+{ 19: }
+{ 20: }
+  ( sym: 256; act: 50 ),
+  ( sym: 266; act: 51 ),
+  ( sym: 271; act: 23 ),
+{ 21: }
+  ( sym: 256; act: 50 ),
+  ( sym: 266; act: 51 ),
+  ( sym: 271; act: 23 ),
+{ 22: }
+  ( sym: 256; act: 54 ),
+  ( sym: 266; act: 55 ),
+  ( sym: 271; act: 23 ),
+{ 23: }
+{ 24: }
+{ 25: }
+  ( sym: 274; act: 56 ),
+  ( sym: 276; act: 57 ),
+  ( sym: 277; act: 58 ),
+  ( sym: 279; act: 59 ),
+  ( sym: 256; act: -60 ),
+  ( sym: 261; act: -60 ),
+  ( sym: 262; act: -60 ),
+  ( sym: 263; act: -60 ),
+  ( sym: 264; act: -60 ),
+  ( sym: 271; act: -60 ),
+  ( sym: 281; act: -60 ),
+  ( sym: 282; act: -60 ),
+  ( sym: 283; act: -60 ),
+  ( sym: 284; act: -60 ),
+  ( sym: 289; act: -60 ),
+  ( sym: 290; act: -60 ),
+  ( sym: 291; act: -60 ),
+  ( sym: 292; act: -60 ),
+  ( sym: 293; act: -60 ),
+  ( sym: 294; act: -60 ),
+  ( sym: 295; act: -60 ),
+  ( sym: 308; act: -60 ),
+  ( sym: 313; act: -60 ),
+{ 26: }
+  ( sym: 277; act: 60 ),
+  ( sym: 256; act: -55 ),
+  ( sym: 261; act: -55 ),
+  ( sym: 262; act: -55 ),
+  ( sym: 263; act: -55 ),
+  ( sym: 264; act: -55 ),
+  ( sym: 271; act: -55 ),
+  ( sym: 281; act: -55 ),
+  ( sym: 282; act: -55 ),
+  ( sym: 283; act: -55 ),
+  ( sym: 284; act: -55 ),
+  ( sym: 289; act: -55 ),
+  ( sym: 290; act: -55 ),
+  ( sym: 291; act: -55 ),
+  ( sym: 292; act: -55 ),
+  ( sym: 293; act: -55 ),
+  ( sym: 294; act: -55 ),
+  ( sym: 295; act: -55 ),
+  ( sym: 308; act: -55 ),
+  ( sym: 313; act: -55 ),
+{ 27: }
+{ 28: }
+{ 29: }
+{ 30: }
+{ 31: }
+  ( sym: 268; act: 20 ),
+  ( sym: 269; act: 21 ),
+  ( sym: 270; act: 22 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 274; act: 24 ),
+  ( sym: 275; act: 25 ),
+  ( sym: 276; act: 26 ),
+  ( sym: 277; act: 27 ),
+  ( sym: 278; act: 28 ),
+  ( sym: 279; act: 29 ),
+  ( sym: 280; act: 30 ),
+  ( sym: 281; act: 31 ),
+{ 32: }
+{ 33: }
+{ 34: }
+  ( sym: 260; act: 62 ),
+  ( sym: 286; act: 63 ),
+{ 35: }
+  ( sym: 289; act: 42 ),
+  ( sym: 290; act: 43 ),
+  ( sym: 291; act: 44 ),
+  ( sym: 292; act: 45 ),
+  ( sym: 293; act: 46 ),
+  ( sym: 294; act: 47 ),
+  ( sym: 295; act: 48 ),
+  ( sym: 256; act: -16 ),
+  ( sym: 262; act: -16 ),
+  ( sym: 271; act: -16 ),
+  ( sym: 281; act: -16 ),
+  ( sym: 282; act: -16 ),
+  ( sym: 283; act: -16 ),
+  ( sym: 284; act: -16 ),
+  ( sym: 308; act: -16 ),
+  ( sym: 313; act: -16 ),
+{ 36: }
+  ( sym: 260; act: 65 ),
+  ( sym: 256; act: -67 ),
+  ( sym: 262; act: -67 ),
+  ( sym: 271; act: -67 ),
+  ( sym: 281; act: -67 ),
+  ( sym: 282; act: -67 ),
+  ( sym: 283; act: -67 ),
+  ( sym: 284; act: -67 ),
+  ( sym: 289; act: -67 ),
+  ( sym: 290; act: -67 ),
+  ( sym: 291; act: -67 ),
+  ( sym: 292; act: -67 ),
+  ( sym: 293; act: -67 ),
+  ( sym: 294; act: -67 ),
+  ( sym: 295; act: -67 ),
+  ( sym: 308; act: -67 ),
+  ( sym: 313; act: -67 ),
+{ 37: }
+  ( sym: 262; act: 66 ),
+  ( sym: 286; act: 67 ),
+  ( sym: 287; act: 68 ),
+{ 38: }
+  ( sym: 256; act: 50 ),
+  ( sym: 266; act: 51 ),
+  ( sym: 260; act: -38 ),
+  ( sym: 261; act: -38 ),
+  ( sym: 262; act: -38 ),
+  ( sym: 263; act: -38 ),
+  ( sym: 264; act: -38 ),
+  ( sym: 271; act: -38 ),
+  ( sym: 281; act: -38 ),
+  ( sym: 282; act: -38 ),
+  ( sym: 283; act: -38 ),
+  ( sym: 284; act: -38 ),
+  ( sym: 289; act: -38 ),
+  ( sym: 290; act: -38 ),
+  ( sym: 291; act: -38 ),
+  ( sym: 292; act: -38 ),
+  ( sym: 293; act: -38 ),
+  ( sym: 294; act: -38 ),
+  ( sym: 295; act: -38 ),
+  ( sym: 308; act: -38 ),
+  ( sym: 313; act: -38 ),
+{ 39: }
+  ( sym: 256; act: 50 ),
+  ( sym: 266; act: 51 ),
+  ( sym: 260; act: -37 ),
+  ( sym: 261; act: -37 ),
+  ( sym: 262; act: -37 ),
+  ( sym: 263; act: -37 ),
+  ( sym: 264; act: -37 ),
+  ( sym: 271; act: -37 ),
+  ( sym: 281; act: -37 ),
+  ( sym: 282; act: -37 ),
+  ( sym: 283; act: -37 ),
+  ( sym: 284; act: -37 ),
+  ( sym: 289; act: -37 ),
+  ( sym: 290; act: -37 ),
+  ( sym: 291; act: -37 ),
+  ( sym: 292; act: -37 ),
+  ( sym: 293; act: -37 ),
+  ( sym: 294; act: -37 ),
+  ( sym: 295; act: -37 ),
+  ( sym: 308; act: -37 ),
+  ( sym: 313; act: -37 ),
+{ 40: }
+  ( sym: 256; act: 54 ),
+  ( sym: 266; act: 55 ),
+  ( sym: 260; act: -40 ),
+  ( sym: 261; act: -40 ),
+  ( sym: 262; act: -40 ),
+  ( sym: 263; act: -40 ),
+  ( sym: 264; act: -40 ),
+  ( sym: 271; act: -40 ),
+  ( sym: 281; act: -40 ),
+  ( sym: 282; act: -40 ),
+  ( sym: 283; act: -40 ),
+  ( sym: 284; act: -40 ),
+  ( sym: 289; act: -40 ),
+  ( sym: 290; act: -40 ),
+  ( sym: 291; act: -40 ),
+  ( sym: 292; act: -40 ),
+  ( sym: 293; act: -40 ),
+  ( sym: 294; act: -40 ),
+  ( sym: 295; act: -40 ),
+  ( sym: 308; act: -40 ),
+  ( sym: 313; act: -40 ),
+{ 41: }
+  ( sym: 256; act: 76 ),
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 42: }
+{ 43: }
+{ 44: }
+{ 45: }
+{ 46: }
+{ 47: }
+{ 48: }
+{ 49: }
+  ( sym: 297; act: 84 ),
+  ( sym: 256; act: -45 ),
+  ( sym: 261; act: -45 ),
+  ( sym: 262; act: -45 ),
+  ( sym: 263; act: -45 ),
+  ( sym: 264; act: -45 ),
+  ( sym: 271; act: -45 ),
+  ( sym: 281; act: -45 ),
+  ( sym: 282; act: -45 ),
+  ( sym: 283; act: -45 ),
+  ( sym: 284; act: -45 ),
+  ( sym: 289; act: -45 ),
+  ( sym: 290; act: -45 ),
+  ( sym: 291; act: -45 ),
+  ( sym: 292; act: -45 ),
+  ( sym: 293; act: -45 ),
+  ( sym: 294; act: -45 ),
+  ( sym: 295; act: -45 ),
+  ( sym: 308; act: -45 ),
+  ( sym: 313; act: -45 ),
+{ 50: }
+{ 51: }
+  ( sym: 268; act: 20 ),
+  ( sym: 269; act: 21 ),
+  ( sym: 270; act: 22 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 274; act: 24 ),
+  ( sym: 275; act: 25 ),
+  ( sym: 276; act: 26 ),
+  ( sym: 277; act: 27 ),
+  ( sym: 278; act: 28 ),
+  ( sym: 279; act: 29 ),
+  ( sym: 280; act: 30 ),
+  ( sym: 281; act: 31 ),
+{ 52: }
+  ( sym: 297; act: 89 ),
+  ( sym: 256; act: -43 ),
+  ( sym: 261; act: -43 ),
+  ( sym: 262; act: -43 ),
+  ( sym: 263; act: -43 ),
+  ( sym: 264; act: -43 ),
+  ( sym: 271; act: -43 ),
+  ( sym: 281; act: -43 ),
+  ( sym: 282; act: -43 ),
+  ( sym: 283; act: -43 ),
+  ( sym: 284; act: -43 ),
+  ( sym: 289; act: -43 ),
+  ( sym: 290; act: -43 ),
+  ( sym: 291; act: -43 ),
+  ( sym: 292; act: -43 ),
+  ( sym: 293; act: -43 ),
+  ( sym: 294; act: -43 ),
+  ( sym: 295; act: -43 ),
+  ( sym: 308; act: -43 ),
+  ( sym: 313; act: -43 ),
+{ 53: }
+{ 54: }
+{ 55: }
+  ( sym: 271; act: 23 ),
+  ( sym: 267; act: -138 ),
+{ 56: }
+{ 57: }
+  ( sym: 277; act: 94 ),
+  ( sym: 256; act: -59 ),
+  ( sym: 261; act: -59 ),
+  ( sym: 262; act: -59 ),
+  ( sym: 263; act: -59 ),
+  ( sym: 264; act: -59 ),
+  ( sym: 271; act: -59 ),
+  ( sym: 281; act: -59 ),
+  ( sym: 282; act: -59 ),
+  ( sym: 283; act: -59 ),
+  ( sym: 284; act: -59 ),
+  ( sym: 289; act: -59 ),
+  ( sym: 290; act: -59 ),
+  ( sym: 291; act: -59 ),
+  ( sym: 292; act: -59 ),
+  ( sym: 293; act: -59 ),
+  ( sym: 294; act: -59 ),
+  ( sym: 295; act: -59 ),
+  ( sym: 308; act: -59 ),
+  ( sym: 313; act: -59 ),
+{ 58: }
+{ 59: }
+{ 60: }
+{ 61: }
+{ 62: }
+{ 63: }
+{ 64: }
+  ( sym: 256; act: 76 ),
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 65: }
+{ 66: }
+  ( sym: 271; act: 23 ),
+  ( sym: 263; act: -138 ),
+{ 67: }
+{ 68: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 286; act: 103 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 69: }
+  ( sym: 297; act: 107 ),
+  ( sym: 256; act: -34 ),
+  ( sym: 260; act: -34 ),
+  ( sym: 261; act: -34 ),
+  ( sym: 262; act: -34 ),
+  ( sym: 263; act: -34 ),
+  ( sym: 264; act: -34 ),
+  ( sym: 271; act: -34 ),
+  ( sym: 281; act: -34 ),
+  ( sym: 282; act: -34 ),
+  ( sym: 283; act: -34 ),
+  ( sym: 284; act: -34 ),
+  ( sym: 289; act: -34 ),
+  ( sym: 290; act: -34 ),
+  ( sym: 291; act: -34 ),
+  ( sym: 292; act: -34 ),
+  ( sym: 293; act: -34 ),
+  ( sym: 294; act: -34 ),
+  ( sym: 295; act: -34 ),
+  ( sym: 308; act: -34 ),
+  ( sym: 313; act: -34 ),
+{ 70: }
+  ( sym: 297; act: 108 ),
+  ( sym: 256; act: -36 ),
+  ( sym: 260; act: -36 ),
+  ( sym: 261; act: -36 ),
+  ( sym: 262; act: -36 ),
+  ( sym: 263; act: -36 ),
+  ( sym: 264; act: -36 ),
+  ( sym: 271; act: -36 ),
+  ( sym: 281; act: -36 ),
+  ( sym: 282; act: -36 ),
+  ( sym: 283; act: -36 ),
+  ( sym: 284; act: -36 ),
+  ( sym: 289; act: -36 ),
+  ( sym: 290; act: -36 ),
+  ( sym: 291; act: -36 ),
+  ( sym: 292; act: -36 ),
+  ( sym: 293; act: -36 ),
+  ( sym: 294; act: -36 ),
+  ( sym: 295; act: -36 ),
+  ( sym: 308; act: -36 ),
+  ( sym: 313; act: -36 ),
+{ 71: }
+{ 72: }
+  ( sym: 313; act: 109 ),
+{ 73: }
+  ( sym: 262; act: 111 ),
+  ( sym: 264; act: 112 ),
+  ( sym: 260; act: -71 ),
+  ( sym: 261; act: -71 ),
+  ( sym: 296; act: -71 ),
+{ 74: }
+  ( sym: 261; act: 114 ),
+  ( sym: 296; act: 115 ),
+  ( sym: 260; act: -18 ),
+{ 75: }
+  ( sym: 259; act: 117 ),
+  ( sym: 260; act: -86 ),
+  ( sym: 261; act: -86 ),
+  ( sym: 262; act: -86 ),
+  ( sym: 263; act: -86 ),
+  ( sym: 264; act: -86 ),
+  ( sym: 296; act: -86 ),
+{ 76: }
+{ 77: }
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 78: }
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 79: }
+{ 80: }
+{ 81: }
+{ 82: }
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 83: }
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 84: }
+{ 85: }
+  ( sym: 267; act: 123 ),
+{ 86: }
+  ( sym: 268; act: 20 ),
+  ( sym: 269; act: 21 ),
+  ( sym: 270; act: 22 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 274; act: 24 ),
+  ( sym: 275; act: 25 ),
+  ( sym: 276; act: 26 ),
+  ( sym: 277; act: 27 ),
+  ( sym: 278; act: 28 ),
+  ( sym: 279; act: 29 ),
+  ( sym: 280; act: 30 ),
+  ( sym: 281; act: 31 ),
+  ( sym: 267; act: -50 ),
+{ 87: }
+  ( sym: 267; act: 125 ),
+{ 88: }
+  ( sym: 256; act: 76 ),
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 89: }
+{ 90: }
+  ( sym: 267; act: 127 ),
+{ 91: }
+  ( sym: 261; act: 128 ),
+  ( sym: 263; act: -137 ),
+  ( sym: 267; act: -137 ),
+{ 92: }
+  ( sym: 267; act: 129 ),
+{ 93: }
+  ( sym: 285; act: 130 ),
+  ( sym: 261; act: -140 ),
+  ( sym: 263; act: -140 ),
+  ( sym: 267; act: -140 ),
+{ 94: }
+{ 95: }
+  ( sym: 260; act: 131 ),
+  ( sym: 261; act: 114 ),
+{ 96: }
+  ( sym: 263; act: 132 ),
+{ 97: }
+  ( sym: 318; act: 133 ),
+  ( sym: 319; act: 134 ),
+  ( sym: 286; act: -141 ),
+{ 98: }
+  ( sym: 286; act: 135 ),
+{ 99: }
+  ( sym: 262; act: 136 ),
+  ( sym: 259; act: -122 ),
+  ( sym: 260; act: -122 ),
+  ( sym: 261; act: -122 ),
+  ( sym: 263; act: -122 ),
+  ( sym: 264; act: -122 ),
+  ( sym: 265; act: -122 ),
+  ( sym: 267; act: -122 ),
+  ( sym: 286; act: -122 ),
+  ( sym: 296; act: -122 ),
+  ( sym: 300; act: -122 ),
+  ( sym: 301; act: -122 ),
+  ( sym: 302; act: -122 ),
+  ( sym: 303; act: -122 ),
+  ( sym: 304; act: -122 ),
+  ( sym: 305; act: -122 ),
+  ( sym: 306; act: -122 ),
+  ( sym: 307; act: -122 ),
+  ( sym: 308; act: -122 ),
+  ( sym: 309; act: -122 ),
+  ( sym: 310; act: -122 ),
+  ( sym: 311; act: -122 ),
+  ( sym: 312; act: -122 ),
+  ( sym: 313; act: -122 ),
+  ( sym: 314; act: -122 ),
+  ( sym: 315; act: -122 ),
+  ( sym: 318; act: -122 ),
+  ( sym: 319; act: -122 ),
+{ 100: }
+  ( sym: 262; act: 100 ),
+  ( sym: 268; act: 20 ),
+  ( sym: 269; act: 21 ),
+  ( sym: 270; act: 22 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 274; act: 24 ),
+  ( sym: 275; act: 25 ),
+  ( sym: 276; act: 26 ),
+  ( sym: 277; act: 27 ),
+  ( sym: 278; act: 28 ),
+  ( sym: 279; act: 29 ),
+  ( sym: 280; act: 30 ),
+  ( sym: 281; act: 31 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 101: }
+{ 102: }
+{ 103: }
+{ 104: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 105: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 106: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 107: }
+{ 108: }
+{ 109: }
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 110: }
+{ 111: }
+  ( sym: 263; act: 149 ),
+  ( sym: 268; act: 20 ),
+  ( sym: 269; act: 21 ),
+  ( sym: 270; act: 22 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 274; act: 24 ),
+  ( sym: 275; act: 25 ),
+  ( sym: 276; act: 26 ),
+  ( sym: 277; act: 27 ),
+  ( sym: 278; act: 28 ),
+  ( sym: 279; act: 29 ),
+  ( sym: 280; act: 150 ),
+  ( sym: 281; act: 31 ),
+  ( sym: 298; act: 151 ),
+{ 112: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 113: }
+  ( sym: 260; act: 154 ),
+{ 114: }
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 115: }
+  ( sym: 262; act: 156 ),
+{ 116: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 117: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 118: }
+  ( sym: 261; act: 159 ),
+  ( sym: 260; act: -70 ),
+  ( sym: 296; act: -70 ),
+{ 119: }
+  ( sym: 262; act: 111 ),
+  ( sym: 263; act: 160 ),
+  ( sym: 264; act: 112 ),
+{ 120: }
+  ( sym: 262; act: 111 ),
+  ( sym: 264; act: 112 ),
+  ( sym: 260; act: -80 ),
+  ( sym: 261; act: -80 ),
+  ( sym: 263; act: -80 ),
+  ( sym: 296; act: -80 ),
+{ 121: }
+  ( sym: 264; act: 112 ),
+  ( sym: 260; act: -83 ),
+  ( sym: 261; act: -83 ),
+  ( sym: 262; act: -83 ),
+  ( sym: 263; act: -83 ),
+  ( sym: 296; act: -83 ),
+{ 122: }
+  ( sym: 262; act: 111 ),
+  ( sym: 264; act: 112 ),
+  ( sym: 260; act: -82 ),
+  ( sym: 261; act: -82 ),
+  ( sym: 263; act: -82 ),
+  ( sym: 296; act: -82 ),
+{ 123: }
+{ 124: }
+{ 125: }
+{ 126: }
+  ( sym: 260; act: 161 ),
+  ( sym: 261; act: 114 ),
+{ 127: }
+{ 128: }
+  ( sym: 271; act: 23 ),
+  ( sym: 263; act: -138 ),
+  ( sym: 267; act: -138 ),
+{ 129: }
+{ 130: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 131: }
+{ 132: }
+  ( sym: 287; act: 164 ),
+{ 133: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 134: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 135: }
+{ 136: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+  ( sym: 263; act: -144 ),
+{ 137: }
+  ( sym: 318; act: 133 ),
+  ( sym: 319; act: 134 ),
+  ( sym: 259; act: -118 ),
+  ( sym: 260; act: -118 ),
+  ( sym: 261; act: -118 ),
+  ( sym: 262; act: -118 ),
+  ( sym: 263; act: -118 ),
+  ( sym: 264; act: -118 ),
+  ( sym: 265; act: -118 ),
+  ( sym: 267; act: -118 ),
+  ( sym: 286; act: -118 ),
+  ( sym: 296; act: -118 ),
+  ( sym: 300; act: -118 ),
+  ( sym: 301; act: -118 ),
+  ( sym: 302; act: -118 ),
+  ( sym: 303; act: -118 ),
+  ( sym: 304; act: -118 ),
+  ( sym: 305; act: -118 ),
+  ( sym: 306; act: -118 ),
+  ( sym: 307; act: -118 ),
+  ( sym: 308; act: -118 ),
+  ( sym: 309; act: -118 ),
+  ( sym: 310; act: -118 ),
+  ( sym: 311; act: -118 ),
+  ( sym: 312; act: -118 ),
+  ( sym: 313; act: -118 ),
+  ( sym: 314; act: -118 ),
+  ( sym: 315; act: -118 ),
+{ 138: }
+  ( sym: 263; act: 170 ),
+  ( sym: 300; act: -101 ),
+  ( sym: 301; act: -101 ),
+  ( sym: 302; act: -101 ),
+  ( sym: 303; act: -101 ),
+  ( sym: 304; act: -101 ),
+  ( sym: 305; act: -101 ),
+  ( sym: 306; act: -101 ),
+  ( sym: 307; act: -101 ),
+  ( sym: 308; act: -101 ),
+  ( sym: 309; act: -101 ),
+  ( sym: 310; act: -101 ),
+  ( sym: 311; act: -101 ),
+  ( sym: 312; act: -101 ),
+  ( sym: 313; act: -101 ),
+  ( sym: 314; act: -101 ),
+  ( sym: 315; act: -101 ),
+{ 139: }
+  ( sym: 300; act: 171 ),
+  ( sym: 301; act: 172 ),
+  ( sym: 302; act: 173 ),
+  ( sym: 303; act: 174 ),
+  ( sym: 304; act: 175 ),
+  ( sym: 305; act: 176 ),
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+{ 140: }
+  ( sym: 263; act: 188 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 313; act: 189 ),
+{ 141: }
+  ( sym: 262; act: 136 ),
+  ( sym: 263; act: 190 ),
+  ( sym: 282; act: -67 ),
+  ( sym: 283; act: -67 ),
+  ( sym: 284; act: -67 ),
+  ( sym: 313; act: -67 ),
+  ( sym: 300; act: -122 ),
+  ( sym: 301; act: -122 ),
+  ( sym: 302; act: -122 ),
+  ( sym: 303; act: -122 ),
+  ( sym: 304; act: -122 ),
+  ( sym: 305; act: -122 ),
+  ( sym: 306; act: -122 ),
+  ( sym: 307; act: -122 ),
+  ( sym: 308; act: -122 ),
+  ( sym: 309; act: -122 ),
+  ( sym: 310; act: -122 ),
+  ( sym: 311; act: -122 ),
+  ( sym: 312; act: -122 ),
+  ( sym: 314; act: -122 ),
+  ( sym: 315; act: -122 ),
+  ( sym: 318; act: -122 ),
+  ( sym: 319; act: -122 ),
+{ 142: }
+  ( sym: 318; act: 133 ),
+  ( sym: 319; act: 134 ),
+  ( sym: 259; act: -128 ),
+  ( sym: 260; act: -128 ),
+  ( sym: 261; act: -128 ),
+  ( sym: 262; act: -128 ),
+  ( sym: 263; act: -128 ),
+  ( sym: 264; act: -128 ),
+  ( sym: 265; act: -128 ),
+  ( sym: 267; act: -128 ),
+  ( sym: 286; act: -128 ),
+  ( sym: 296; act: -128 ),
+  ( sym: 300; act: -128 ),
+  ( sym: 301; act: -128 ),
+  ( sym: 302; act: -128 ),
+  ( sym: 303; act: -128 ),
+  ( sym: 304; act: -128 ),
+  ( sym: 305; act: -128 ),
+  ( sym: 306; act: -128 ),
+  ( sym: 307; act: -128 ),
+  ( sym: 308; act: -128 ),
+  ( sym: 309; act: -128 ),
+  ( sym: 310; act: -128 ),
+  ( sym: 311; act: -128 ),
+  ( sym: 312; act: -128 ),
+  ( sym: 313; act: -128 ),
+  ( sym: 314; act: -128 ),
+  ( sym: 315; act: -128 ),
+{ 143: }
+  ( sym: 318; act: 133 ),
+  ( sym: 319; act: 134 ),
+  ( sym: 259; act: -127 ),
+  ( sym: 260; act: -127 ),
+  ( sym: 261; act: -127 ),
+  ( sym: 262; act: -127 ),
+  ( sym: 263; act: -127 ),
+  ( sym: 264; act: -127 ),
+  ( sym: 265; act: -127 ),
+  ( sym: 267; act: -127 ),
+  ( sym: 286; act: -127 ),
+  ( sym: 296; act: -127 ),
+  ( sym: 300; act: -127 ),
+  ( sym: 301; act: -127 ),
+  ( sym: 302; act: -127 ),
+  ( sym: 303; act: -127 ),
+  ( sym: 304; act: -127 ),
+  ( sym: 305; act: -127 ),
+  ( sym: 306; act: -127 ),
+  ( sym: 307; act: -127 ),
+  ( sym: 308; act: -127 ),
+  ( sym: 309; act: -127 ),
+  ( sym: 310; act: -127 ),
+  ( sym: 311; act: -127 ),
+  ( sym: 312; act: -127 ),
+  ( sym: 313; act: -127 ),
+  ( sym: 314; act: -127 ),
+  ( sym: 315; act: -127 ),
+{ 144: }
+  ( sym: 318; act: 133 ),
+  ( sym: 319; act: 134 ),
+  ( sym: 259; act: -129 ),
+  ( sym: 260; act: -129 ),
+  ( sym: 261; act: -129 ),
+  ( sym: 262; act: -129 ),
+  ( sym: 263; act: -129 ),
+  ( sym: 264; act: -129 ),
+  ( sym: 265; act: -129 ),
+  ( sym: 267; act: -129 ),
+  ( sym: 286; act: -129 ),
+  ( sym: 296; act: -129 ),
+  ( sym: 300; act: -129 ),
+  ( sym: 301; act: -129 ),
+  ( sym: 302; act: -129 ),
+  ( sym: 303; act: -129 ),
+  ( sym: 304; act: -129 ),
+  ( sym: 305; act: -129 ),
+  ( sym: 306; act: -129 ),
+  ( sym: 307; act: -129 ),
+  ( sym: 308; act: -129 ),
+  ( sym: 309; act: -129 ),
+  ( sym: 310; act: -129 ),
+  ( sym: 311; act: -129 ),
+  ( sym: 312; act: -129 ),
+  ( sym: 313; act: -129 ),
+  ( sym: 314; act: -129 ),
+  ( sym: 315; act: -129 ),
+{ 145: }
+  ( sym: 262; act: 111 ),
+  ( sym: 264; act: 112 ),
+  ( sym: 260; act: -81 ),
+  ( sym: 261; act: -81 ),
+  ( sym: 263; act: -81 ),
+  ( sym: 296; act: -81 ),
+{ 146: }
+  ( sym: 263; act: 191 ),
+{ 147: }
+  ( sym: 261; act: 192 ),
+  ( sym: 263; act: -74 ),
+{ 148: }
+  ( sym: 262; act: 196 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 197 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 198 ),
+  ( sym: 261; act: -100 ),
+  ( sym: 263; act: -100 ),
+  ( sym: 264; act: -100 ),
+{ 149: }
+{ 150: }
+  ( sym: 263; act: 199 ),
+  ( sym: 261; act: -63 ),
+  ( sym: 262; act: -63 ),
+  ( sym: 264; act: -63 ),
+  ( sym: 271; act: -63 ),
+  ( sym: 281; act: -63 ),
+  ( sym: 282; act: -63 ),
+  ( sym: 283; act: -63 ),
+  ( sym: 284; act: -63 ),
+  ( sym: 308; act: -63 ),
+  ( sym: 313; act: -63 ),
+{ 151: }
+{ 152: }
+{ 153: }
+  ( sym: 265; act: 200 ),
+  ( sym: 300; act: 171 ),
+  ( sym: 301; act: 172 ),
+  ( sym: 302; act: 173 ),
+  ( sym: 303; act: 174 ),
+  ( sym: 304; act: 175 ),
+  ( sym: 305; act: 176 ),
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+{ 154: }
+{ 155: }
+  ( sym: 262; act: 111 ),
+  ( sym: 264; act: 112 ),
+  ( sym: 260; act: -68 ),
+  ( sym: 261; act: -68 ),
+  ( sym: 296; act: -68 ),
+{ 156: }
+  ( sym: 271; act: 23 ),
+{ 157: }
+  ( sym: 300; act: 171 ),
+  ( sym: 301; act: 172 ),
+  ( sym: 302; act: 173 ),
+  ( sym: 303; act: 174 ),
+  ( sym: 304; act: 175 ),
+  ( sym: 305; act: 176 ),
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 260; act: -85 ),
+  ( sym: 261; act: -85 ),
+  ( sym: 262; act: -85 ),
+  ( sym: 263; act: -85 ),
+  ( sym: 264; act: -85 ),
+  ( sym: 296; act: -85 ),
+{ 158: }
+  ( sym: 300; act: 171 ),
+  ( sym: 301; act: 172 ),
+  ( sym: 302; act: 173 ),
+  ( sym: 303; act: 174 ),
+  ( sym: 304; act: 175 ),
+  ( sym: 305; act: 176 ),
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 260; act: -84 ),
+  ( sym: 261; act: -84 ),
+  ( sym: 262; act: -84 ),
+  ( sym: 263; act: -84 ),
+  ( sym: 264; act: -84 ),
+  ( sym: 296; act: -84 ),
+{ 159: }
+  ( sym: 256; act: 76 ),
+  ( sym: 262; act: 77 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 78 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 83 ),
+{ 160: }
+{ 161: }
+{ 162: }
+{ 163: }
+  ( sym: 300; act: 171 ),
+  ( sym: 301; act: 172 ),
+  ( sym: 302; act: 173 ),
+  ( sym: 303; act: 174 ),
+  ( sym: 304; act: 175 ),
+  ( sym: 305; act: 176 ),
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 261; act: -139 ),
+  ( sym: 263; act: -139 ),
+  ( sym: 267; act: -139 ),
+{ 164: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 165: }
+{ 166: }
+{ 167: }
+  ( sym: 261; act: 204 ),
+  ( sym: 263; act: -143 ),
+{ 168: }
+  ( sym: 263; act: 205 ),
+{ 169: }
+  ( sym: 300; act: 171 ),
+  ( sym: 301; act: 172 ),
+  ( sym: 302; act: 173 ),
+  ( sym: 303; act: 174 ),
+  ( sym: 304; act: 175 ),
+  ( sym: 305; act: 176 ),
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 261; act: -145 ),
+  ( sym: 263; act: -145 ),
+{ 170: }
+{ 171: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 172: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 173: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 174: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 175: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 176: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 177: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 178: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 179: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 180: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 181: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 182: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 183: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 184: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 185: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 186: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 187: }
+  ( sym: 313; act: 223 ),
+{ 188: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 189: }
+  ( sym: 263; act: 225 ),
+{ 190: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+  ( sym: 259; act: -121 ),
+  ( sym: 260; act: -121 ),
+  ( sym: 261; act: -121 ),
+  ( sym: 263; act: -121 ),
+  ( sym: 264; act: -121 ),
+  ( sym: 265; act: -121 ),
+  ( sym: 267; act: -121 ),
+  ( sym: 286; act: -121 ),
+  ( sym: 296; act: -121 ),
+  ( sym: 300; act: -121 ),
+  ( sym: 301; act: -121 ),
+  ( sym: 302; act: -121 ),
+  ( sym: 303; act: -121 ),
+  ( sym: 304; act: -121 ),
+  ( sym: 305; act: -121 ),
+  ( sym: 306; act: -121 ),
+  ( sym: 307; act: -121 ),
+  ( sym: 309; act: -121 ),
+  ( sym: 311; act: -121 ),
+  ( sym: 312; act: -121 ),
+  ( sym: 313; act: -121 ),
+  ( sym: 314; act: -121 ),
+  ( sym: 318; act: -121 ),
+  ( sym: 319; act: -121 ),
+{ 191: }
+{ 192: }
+  ( sym: 268; act: 20 ),
+  ( sym: 269; act: 21 ),
+  ( sym: 270; act: 22 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 274; act: 24 ),
+  ( sym: 275; act: 25 ),
+  ( sym: 276; act: 26 ),
+  ( sym: 277; act: 27 ),
+  ( sym: 278; act: 28 ),
+  ( sym: 279; act: 29 ),
+  ( sym: 280; act: 30 ),
+  ( sym: 281; act: 31 ),
+  ( sym: 298; act: 151 ),
+{ 193: }
+  ( sym: 313; act: 229 ),
+{ 194: }
+  ( sym: 262; act: 231 ),
+  ( sym: 264; act: 232 ),
+  ( sym: 261; act: -73 ),
+  ( sym: 263; act: -73 ),
+{ 195: }
+  ( sym: 262; act: 111 ),
+  ( sym: 264; act: 112 ),
+  ( sym: 261; act: -72 ),
+  ( sym: 263; act: -72 ),
+{ 196: }
+  ( sym: 262; act: 196 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 197 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 198 ),
+  ( sym: 263; act: -100 ),
+  ( sym: 264; act: -100 ),
+{ 197: }
+  ( sym: 262; act: 196 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 197 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 198 ),
+  ( sym: 261; act: -100 ),
+  ( sym: 263; act: -100 ),
+  ( sym: 264; act: -100 ),
+{ 198: }
+  ( sym: 262; act: 196 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 197 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 198 ),
+  ( sym: 261; act: -100 ),
+  ( sym: 263; act: -100 ),
+  ( sym: 264; act: -100 ),
+{ 199: }
+{ 200: }
+{ 201: }
+  ( sym: 263; act: 236 ),
+{ 202: }
+{ 203: }
+  ( sym: 286; act: 237 ),
+{ 204: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+  ( sym: 263; act: -144 ),
+{ 205: }
+{ 206: }
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -102 ),
+  ( sym: 260; act: -102 ),
+  ( sym: 261; act: -102 ),
+  ( sym: 262; act: -102 ),
+  ( sym: 263; act: -102 ),
+  ( sym: 264; act: -102 ),
+  ( sym: 265; act: -102 ),
+  ( sym: 267; act: -102 ),
+  ( sym: 286; act: -102 ),
+  ( sym: 296; act: -102 ),
+  ( sym: 300; act: -102 ),
+  ( sym: 301; act: -102 ),
+  ( sym: 302; act: -102 ),
+  ( sym: 303; act: -102 ),
+  ( sym: 304; act: -102 ),
+  ( sym: 305; act: -102 ),
+  ( sym: 318; act: -102 ),
+  ( sym: 319; act: -102 ),
+{ 207: }
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -103 ),
+  ( sym: 260; act: -103 ),
+  ( sym: 261; act: -103 ),
+  ( sym: 262; act: -103 ),
+  ( sym: 263; act: -103 ),
+  ( sym: 264; act: -103 ),
+  ( sym: 265; act: -103 ),
+  ( sym: 267; act: -103 ),
+  ( sym: 286; act: -103 ),
+  ( sym: 296; act: -103 ),
+  ( sym: 300; act: -103 ),
+  ( sym: 301; act: -103 ),
+  ( sym: 302; act: -103 ),
+  ( sym: 303; act: -103 ),
+  ( sym: 304; act: -103 ),
+  ( sym: 305; act: -103 ),
+  ( sym: 318; act: -103 ),
+  ( sym: 319; act: -103 ),
+{ 208: }
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -104 ),
+  ( sym: 260; act: -104 ),
+  ( sym: 261; act: -104 ),
+  ( sym: 262; act: -104 ),
+  ( sym: 263; act: -104 ),
+  ( sym: 264; act: -104 ),
+  ( sym: 265; act: -104 ),
+  ( sym: 267; act: -104 ),
+  ( sym: 286; act: -104 ),
+  ( sym: 296; act: -104 ),
+  ( sym: 300; act: -104 ),
+  ( sym: 301; act: -104 ),
+  ( sym: 302; act: -104 ),
+  ( sym: 303; act: -104 ),
+  ( sym: 304; act: -104 ),
+  ( sym: 305; act: -104 ),
+  ( sym: 318; act: -104 ),
+  ( sym: 319; act: -104 ),
+{ 209: }
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -106 ),
+  ( sym: 260; act: -106 ),
+  ( sym: 261; act: -106 ),
+  ( sym: 262; act: -106 ),
+  ( sym: 263; act: -106 ),
+  ( sym: 264; act: -106 ),
+  ( sym: 265; act: -106 ),
+  ( sym: 267; act: -106 ),
+  ( sym: 286; act: -106 ),
+  ( sym: 296; act: -106 ),
+  ( sym: 300; act: -106 ),
+  ( sym: 301; act: -106 ),
+  ( sym: 302; act: -106 ),
+  ( sym: 303; act: -106 ),
+  ( sym: 304; act: -106 ),
+  ( sym: 305; act: -106 ),
+  ( sym: 318; act: -106 ),
+  ( sym: 319; act: -106 ),
+{ 210: }
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -105 ),
+  ( sym: 260; act: -105 ),
+  ( sym: 261; act: -105 ),
+  ( sym: 262; act: -105 ),
+  ( sym: 263; act: -105 ),
+  ( sym: 264; act: -105 ),
+  ( sym: 265; act: -105 ),
+  ( sym: 267; act: -105 ),
+  ( sym: 286; act: -105 ),
+  ( sym: 296; act: -105 ),
+  ( sym: 300; act: -105 ),
+  ( sym: 301; act: -105 ),
+  ( sym: 302; act: -105 ),
+  ( sym: 303; act: -105 ),
+  ( sym: 304; act: -105 ),
+  ( sym: 305; act: -105 ),
+  ( sym: 318; act: -105 ),
+  ( sym: 319; act: -105 ),
+{ 211: }
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -107 ),
+  ( sym: 260; act: -107 ),
+  ( sym: 261; act: -107 ),
+  ( sym: 262; act: -107 ),
+  ( sym: 263; act: -107 ),
+  ( sym: 264; act: -107 ),
+  ( sym: 265; act: -107 ),
+  ( sym: 267; act: -107 ),
+  ( sym: 286; act: -107 ),
+  ( sym: 296; act: -107 ),
+  ( sym: 300; act: -107 ),
+  ( sym: 301; act: -107 ),
+  ( sym: 302; act: -107 ),
+  ( sym: 303; act: -107 ),
+  ( sym: 304; act: -107 ),
+  ( sym: 305; act: -107 ),
+  ( sym: 318; act: -107 ),
+  ( sym: 319; act: -107 ),
+{ 212: }
+{ 213: }
+  ( sym: 259; act: 239 ),
+  ( sym: 300; act: 171 ),
+  ( sym: 301; act: 172 ),
+  ( sym: 302; act: 173 ),
+  ( sym: 303; act: 174 ),
+  ( sym: 304; act: 175 ),
+  ( sym: 305; act: 176 ),
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+{ 214: }
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -112 ),
+  ( sym: 260; act: -112 ),
+  ( sym: 261; act: -112 ),
+  ( sym: 262; act: -112 ),
+  ( sym: 263; act: -112 ),
+  ( sym: 264; act: -112 ),
+  ( sym: 265; act: -112 ),
+  ( sym: 267; act: -112 ),
+  ( sym: 286; act: -112 ),
+  ( sym: 296; act: -112 ),
+  ( sym: 300; act: -112 ),
+  ( sym: 301; act: -112 ),
+  ( sym: 302; act: -112 ),
+  ( sym: 303; act: -112 ),
+  ( sym: 304; act: -112 ),
+  ( sym: 305; act: -112 ),
+  ( sym: 306; act: -112 ),
+  ( sym: 307; act: -112 ),
+  ( sym: 318; act: -112 ),
+  ( sym: 319; act: -112 ),
+{ 215: }
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -113 ),
+  ( sym: 260; act: -113 ),
+  ( sym: 261; act: -113 ),
+  ( sym: 262; act: -113 ),
+  ( sym: 263; act: -113 ),
+  ( sym: 264; act: -113 ),
+  ( sym: 265; act: -113 ),
+  ( sym: 267; act: -113 ),
+  ( sym: 286; act: -113 ),
+  ( sym: 296; act: -113 ),
+  ( sym: 300; act: -113 ),
+  ( sym: 301; act: -113 ),
+  ( sym: 302; act: -113 ),
+  ( sym: 303; act: -113 ),
+  ( sym: 304; act: -113 ),
+  ( sym: 305; act: -113 ),
+  ( sym: 306; act: -113 ),
+  ( sym: 307; act: -113 ),
+  ( sym: 308; act: -113 ),
+  ( sym: 318; act: -113 ),
+  ( sym: 319; act: -113 ),
+{ 216: }
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -108 ),
+  ( sym: 260; act: -108 ),
+  ( sym: 261; act: -108 ),
+  ( sym: 262; act: -108 ),
+  ( sym: 263; act: -108 ),
+  ( sym: 264; act: -108 ),
+  ( sym: 265; act: -108 ),
+  ( sym: 267; act: -108 ),
+  ( sym: 286; act: -108 ),
+  ( sym: 296; act: -108 ),
+  ( sym: 300; act: -108 ),
+  ( sym: 301; act: -108 ),
+  ( sym: 302; act: -108 ),
+  ( sym: 303; act: -108 ),
+  ( sym: 304; act: -108 ),
+  ( sym: 305; act: -108 ),
+  ( sym: 306; act: -108 ),
+  ( sym: 307; act: -108 ),
+  ( sym: 308; act: -108 ),
+  ( sym: 309; act: -108 ),
+  ( sym: 310; act: -108 ),
+  ( sym: 318; act: -108 ),
+  ( sym: 319; act: -108 ),
+{ 217: }
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -109 ),
+  ( sym: 260; act: -109 ),
+  ( sym: 261; act: -109 ),
+  ( sym: 262; act: -109 ),
+  ( sym: 263; act: -109 ),
+  ( sym: 264; act: -109 ),
+  ( sym: 265; act: -109 ),
+  ( sym: 267; act: -109 ),
+  ( sym: 286; act: -109 ),
+  ( sym: 296; act: -109 ),
+  ( sym: 300; act: -109 ),
+  ( sym: 301; act: -109 ),
+  ( sym: 302; act: -109 ),
+  ( sym: 303; act: -109 ),
+  ( sym: 304; act: -109 ),
+  ( sym: 305; act: -109 ),
+  ( sym: 306; act: -109 ),
+  ( sym: 307; act: -109 ),
+  ( sym: 308; act: -109 ),
+  ( sym: 309; act: -109 ),
+  ( sym: 310; act: -109 ),
+  ( sym: 318; act: -109 ),
+  ( sym: 319; act: -109 ),
+{ 218: }
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -116 ),
+  ( sym: 260; act: -116 ),
+  ( sym: 261; act: -116 ),
+  ( sym: 262; act: -116 ),
+  ( sym: 263; act: -116 ),
+  ( sym: 264; act: -116 ),
+  ( sym: 265; act: -116 ),
+  ( sym: 267; act: -116 ),
+  ( sym: 286; act: -116 ),
+  ( sym: 296; act: -116 ),
+  ( sym: 300; act: -116 ),
+  ( sym: 301; act: -116 ),
+  ( sym: 302; act: -116 ),
+  ( sym: 303; act: -116 ),
+  ( sym: 304; act: -116 ),
+  ( sym: 305; act: -116 ),
+  ( sym: 306; act: -116 ),
+  ( sym: 307; act: -116 ),
+  ( sym: 308; act: -116 ),
+  ( sym: 309; act: -116 ),
+  ( sym: 310; act: -116 ),
+  ( sym: 311; act: -116 ),
+  ( sym: 312; act: -116 ),
+  ( sym: 318; act: -116 ),
+  ( sym: 319; act: -116 ),
+{ 219: }
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -115 ),
+  ( sym: 260; act: -115 ),
+  ( sym: 261; act: -115 ),
+  ( sym: 262; act: -115 ),
+  ( sym: 263; act: -115 ),
+  ( sym: 264; act: -115 ),
+  ( sym: 265; act: -115 ),
+  ( sym: 267; act: -115 ),
+  ( sym: 286; act: -115 ),
+  ( sym: 296; act: -115 ),
+  ( sym: 300; act: -115 ),
+  ( sym: 301; act: -115 ),
+  ( sym: 302; act: -115 ),
+  ( sym: 303; act: -115 ),
+  ( sym: 304; act: -115 ),
+  ( sym: 305; act: -115 ),
+  ( sym: 306; act: -115 ),
+  ( sym: 307; act: -115 ),
+  ( sym: 308; act: -115 ),
+  ( sym: 309; act: -115 ),
+  ( sym: 310; act: -115 ),
+  ( sym: 311; act: -115 ),
+  ( sym: 312; act: -115 ),
+  ( sym: 318; act: -115 ),
+  ( sym: 319; act: -115 ),
+{ 220: }
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -110 ),
+  ( sym: 260; act: -110 ),
+  ( sym: 261; act: -110 ),
+  ( sym: 262; act: -110 ),
+  ( sym: 263; act: -110 ),
+  ( sym: 264; act: -110 ),
+  ( sym: 265; act: -110 ),
+  ( sym: 267; act: -110 ),
+  ( sym: 286; act: -110 ),
+  ( sym: 296; act: -110 ),
+  ( sym: 300; act: -110 ),
+  ( sym: 301; act: -110 ),
+  ( sym: 302; act: -110 ),
+  ( sym: 303; act: -110 ),
+  ( sym: 304; act: -110 ),
+  ( sym: 305; act: -110 ),
+  ( sym: 306; act: -110 ),
+  ( sym: 307; act: -110 ),
+  ( sym: 308; act: -110 ),
+  ( sym: 309; act: -110 ),
+  ( sym: 310; act: -110 ),
+  ( sym: 311; act: -110 ),
+  ( sym: 312; act: -110 ),
+  ( sym: 313; act: -110 ),
+  ( sym: 314; act: -110 ),
+  ( sym: 318; act: -110 ),
+  ( sym: 319; act: -110 ),
+{ 221: }
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -111 ),
+  ( sym: 260; act: -111 ),
+  ( sym: 261; act: -111 ),
+  ( sym: 262; act: -111 ),
+  ( sym: 263; act: -111 ),
+  ( sym: 264; act: -111 ),
+  ( sym: 265; act: -111 ),
+  ( sym: 267; act: -111 ),
+  ( sym: 286; act: -111 ),
+  ( sym: 296; act: -111 ),
+  ( sym: 300; act: -111 ),
+  ( sym: 301; act: -111 ),
+  ( sym: 302; act: -111 ),
+  ( sym: 303; act: -111 ),
+  ( sym: 304; act: -111 ),
+  ( sym: 305; act: -111 ),
+  ( sym: 306; act: -111 ),
+  ( sym: 307; act: -111 ),
+  ( sym: 308; act: -111 ),
+  ( sym: 309; act: -111 ),
+  ( sym: 310; act: -111 ),
+  ( sym: 311; act: -111 ),
+  ( sym: 312; act: -111 ),
+  ( sym: 313; act: -111 ),
+  ( sym: 314; act: -111 ),
+  ( sym: 318; act: -111 ),
+  ( sym: 319; act: -111 ),
+{ 222: }
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -114 ),
+  ( sym: 260; act: -114 ),
+  ( sym: 261; act: -114 ),
+  ( sym: 262; act: -114 ),
+  ( sym: 263; act: -114 ),
+  ( sym: 264; act: -114 ),
+  ( sym: 265; act: -114 ),
+  ( sym: 267; act: -114 ),
+  ( sym: 286; act: -114 ),
+  ( sym: 296; act: -114 ),
+  ( sym: 300; act: -114 ),
+  ( sym: 301; act: -114 ),
+  ( sym: 302; act: -114 ),
+  ( sym: 303; act: -114 ),
+  ( sym: 304; act: -114 ),
+  ( sym: 305; act: -114 ),
+  ( sym: 306; act: -114 ),
+  ( sym: 307; act: -114 ),
+  ( sym: 308; act: -114 ),
+  ( sym: 309; act: -114 ),
+  ( sym: 310; act: -114 ),
+  ( sym: 311; act: -114 ),
+  ( sym: 312; act: -114 ),
+  ( sym: 313; act: -114 ),
+  ( sym: 314; act: -114 ),
+  ( sym: 318; act: -114 ),
+  ( sym: 319; act: -114 ),
+{ 223: }
+  ( sym: 263; act: 240 ),
+{ 224: }
+  ( sym: 318; act: 133 ),
+  ( sym: 319; act: 134 ),
+  ( sym: 259; act: -131 ),
+  ( sym: 260; act: -131 ),
+  ( sym: 261; act: -131 ),
+  ( sym: 262; act: -131 ),
+  ( sym: 263; act: -131 ),
+  ( sym: 264; act: -131 ),
+  ( sym: 265; act: -131 ),
+  ( sym: 267; act: -131 ),
+  ( sym: 286; act: -131 ),
+  ( sym: 296; act: -131 ),
+  ( sym: 300; act: -131 ),
+  ( sym: 301; act: -131 ),
+  ( sym: 302; act: -131 ),
+  ( sym: 303; act: -131 ),
+  ( sym: 304; act: -131 ),
+  ( sym: 305; act: -131 ),
+  ( sym: 306; act: -131 ),
+  ( sym: 307; act: -131 ),
+  ( sym: 308; act: -131 ),
+  ( sym: 309; act: -131 ),
+  ( sym: 310; act: -131 ),
+  ( sym: 311; act: -131 ),
+  ( sym: 312; act: -131 ),
+  ( sym: 313; act: -131 ),
+  ( sym: 314; act: -131 ),
+  ( sym: 315; act: -131 ),
+{ 225: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 226: }
+{ 227: }
+  ( sym: 318; act: 133 ),
+  ( sym: 319; act: 134 ),
+  ( sym: 259; act: -120 ),
+  ( sym: 260; act: -120 ),
+  ( sym: 261; act: -120 ),
+  ( sym: 262; act: -120 ),
+  ( sym: 263; act: -120 ),
+  ( sym: 264; act: -120 ),
+  ( sym: 265; act: -120 ),
+  ( sym: 267; act: -120 ),
+  ( sym: 286; act: -120 ),
+  ( sym: 296; act: -120 ),
+  ( sym: 300; act: -120 ),
+  ( sym: 301; act: -120 ),
+  ( sym: 302; act: -120 ),
+  ( sym: 303; act: -120 ),
+  ( sym: 304; act: -120 ),
+  ( sym: 305; act: -120 ),
+  ( sym: 306; act: -120 ),
+  ( sym: 307; act: -120 ),
+  ( sym: 308; act: -120 ),
+  ( sym: 309; act: -120 ),
+  ( sym: 310; act: -120 ),
+  ( sym: 311; act: -120 ),
+  ( sym: 312; act: -120 ),
+  ( sym: 313; act: -120 ),
+  ( sym: 314; act: -120 ),
+  ( sym: 315; act: -120 ),
+{ 228: }
+{ 229: }
+  ( sym: 262; act: 196 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 281; act: 197 ),
+  ( sym: 282; act: 79 ),
+  ( sym: 283; act: 80 ),
+  ( sym: 284; act: 81 ),
+  ( sym: 308; act: 82 ),
+  ( sym: 313; act: 198 ),
+  ( sym: 261; act: -100 ),
+  ( sym: 263; act: -100 ),
+  ( sym: 264; act: -100 ),
+{ 230: }
+{ 231: }
+  ( sym: 263; act: 149 ),
+  ( sym: 268; act: 20 ),
+  ( sym: 269; act: 21 ),
+  ( sym: 270; act: 22 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 274; act: 24 ),
+  ( sym: 275; act: 25 ),
+  ( sym: 276; act: 26 ),
+  ( sym: 277; act: 27 ),
+  ( sym: 278; act: 28 ),
+  ( sym: 279; act: 29 ),
+  ( sym: 280; act: 150 ),
+  ( sym: 281; act: 31 ),
+  ( sym: 298; act: 151 ),
+{ 232: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 233: }
+  ( sym: 262; act: 231 ),
+  ( sym: 263; act: 245 ),
+  ( sym: 264; act: 232 ),
+{ 234: }
+  ( sym: 262; act: 231 ),
+  ( sym: 264; act: 232 ),
+  ( sym: 261; act: -93 ),
+  ( sym: 263; act: -93 ),
+{ 235: }
+  ( sym: 264; act: 232 ),
+  ( sym: 261; act: -95 ),
+  ( sym: 262; act: -95 ),
+  ( sym: 263; act: -95 ),
+{ 236: }
+{ 237: }
+{ 238: }
+{ 239: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 240: }
+  ( sym: 262; act: 100 ),
+  ( sym: 271; act: 23 ),
+  ( sym: 272; act: 101 ),
+  ( sym: 273; act: 102 ),
+  ( sym: 308; act: 104 ),
+  ( sym: 310; act: 105 ),
+  ( sym: 315; act: 106 ),
+{ 241: }
+  ( sym: 318; act: 133 ),
+  ( sym: 319; act: 134 ),
+  ( sym: 259; act: -132 ),
+  ( sym: 260; act: -132 ),
+  ( sym: 261; act: -132 ),
+  ( sym: 262; act: -132 ),
+  ( sym: 263; act: -132 ),
+  ( sym: 264; act: -132 ),
+  ( sym: 265; act: -132 ),
+  ( sym: 267; act: -132 ),
+  ( sym: 286; act: -132 ),
+  ( sym: 296; act: -132 ),
+  ( sym: 300; act: -132 ),
+  ( sym: 301; act: -132 ),
+  ( sym: 302; act: -132 ),
+  ( sym: 303; act: -132 ),
+  ( sym: 304; act: -132 ),
+  ( sym: 305; act: -132 ),
+  ( sym: 306; act: -132 ),
+  ( sym: 307; act: -132 ),
+  ( sym: 308; act: -132 ),
+  ( sym: 309; act: -132 ),
+  ( sym: 310; act: -132 ),
+  ( sym: 311; act: -132 ),
+  ( sym: 312; act: -132 ),
+  ( sym: 313; act: -132 ),
+  ( sym: 314; act: -132 ),
+  ( sym: 315; act: -132 ),
+{ 242: }
+  ( sym: 262; act: 231 ),
+  ( sym: 264; act: 232 ),
+  ( sym: 261; act: -94 ),
+  ( sym: 263; act: -94 ),
+{ 243: }
+  ( sym: 263; act: 248 ),
+{ 244: }
+  ( sym: 265; act: 249 ),
+  ( sym: 300; act: 171 ),
+  ( sym: 301; act: 172 ),
+  ( sym: 302; act: 173 ),
+  ( sym: 303; act: 174 ),
+  ( sym: 304; act: 175 ),
+  ( sym: 305; act: 176 ),
+  ( sym: 306; act: 177 ),
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+{ 245: }
+{ 246: }
+  ( sym: 307; act: 178 ),
+  ( sym: 308; act: 179 ),
+  ( sym: 309; act: 180 ),
+  ( sym: 310; act: 181 ),
+  ( sym: 311; act: 182 ),
+  ( sym: 312; act: 183 ),
+  ( sym: 313; act: 184 ),
+  ( sym: 314; act: 185 ),
+  ( sym: 315; act: 186 ),
+  ( sym: 259; act: -119 ),
+  ( sym: 260; act: -119 ),
+  ( sym: 261; act: -119 ),
+  ( sym: 262; act: -119 ),
+  ( sym: 263; act: -119 ),
+  ( sym: 264; act: -119 ),
+  ( sym: 265; act: -119 ),
+  ( sym: 267; act: -119 ),
+  ( sym: 286; act: -119 ),
+  ( sym: 296; act: -119 ),
+  ( sym: 300; act: -119 ),
+  ( sym: 301; act: -119 ),
+  ( sym: 302; act: -119 ),
+  ( sym: 303; act: -119 ),
+  ( sym: 304; act: -119 ),
+  ( sym: 305; act: -119 ),
+  ( sym: 306; act: -119 ),
+  ( sym: 318; act: -119 ),
+  ( sym: 319; act: -119 ),
+{ 247: }
+  ( sym: 318; act: 133 ),
+  ( sym: 319; act: 134 ),
+  ( sym: 259; act: -133 ),
+  ( sym: 260; act: -133 ),
+  ( sym: 261; act: -133 ),
+  ( sym: 262; act: -133 ),
+  ( sym: 263; act: -133 ),
+  ( sym: 264; act: -133 ),
+  ( sym: 265; act: -133 ),
+  ( sym: 267; act: -133 ),
+  ( sym: 286; act: -133 ),
+  ( sym: 296; act: -133 ),
+  ( sym: 300; act: -133 ),
+  ( sym: 301; act: -133 ),
+  ( sym: 302; act: -133 ),
+  ( sym: 303; act: -133 ),
+  ( sym: 304; act: -133 ),
+  ( sym: 305; act: -133 ),
+  ( sym: 306; act: -133 ),
+  ( sym: 307; act: -133 ),
+  ( sym: 308; act: -133 ),
+  ( sym: 309; act: -133 ),
+  ( sym: 310; act: -133 ),
+  ( sym: 311; act: -133 ),
+  ( sym: 312; act: -133 ),
+  ( sym: 313; act: -133 ),
+  ( sym: 314; act: -133 ),
+  ( sym: 315; act: -133 )
+{ 248: }
+{ 249: }
+);
+
+yyg : array [1..yyngotos] of YYARec = (
+{ 0: }
+  ( sym: -13; act: 1 ),
+  ( sym: -7; act: 2 ),
+  ( sym: -6; act: 3 ),
+  ( sym: -5; act: 4 ),
+  ( sym: -3; act: 5 ),
+  ( sym: -2; act: 6 ),
+{ 1: }
+{ 2: }
+  ( sym: -21; act: 15 ),
+  ( sym: -19; act: 16 ),
+  ( sym: -13; act: 17 ),
+  ( sym: -11; act: 18 ),
+  ( sym: -10; act: 19 ),
+{ 3: }
+{ 4: }
+{ 5: }
+  ( sym: -13; act: 1 ),
+  ( sym: -7; act: 2 ),
+  ( sym: -6; act: 32 ),
+  ( sym: -5; act: 33 ),
+{ 6: }
+{ 7: }
+  ( sym: -4; act: 34 ),
+{ 8: }
+  ( sym: -21; act: 15 ),
+  ( sym: -19; act: 16 ),
+  ( sym: -13; act: 17 ),
+  ( sym: -11; act: 35 ),
+  ( sym: -10; act: 36 ),
+{ 9: }
+  ( sym: -10; act: 37 ),
+{ 10: }
+  ( sym: -10; act: 38 ),
+{ 11: }
+  ( sym: -10; act: 39 ),
+{ 12: }
+  ( sym: -10; act: 40 ),
+{ 13: }
+{ 14: }
+{ 15: }
+{ 16: }
+{ 17: }
+{ 18: }
+  ( sym: -8; act: 41 ),
+{ 19: }
+{ 20: }
+  ( sym: -16; act: 49 ),
+  ( sym: -10; act: 38 ),
+{ 21: }
+  ( sym: -16; act: 52 ),
+  ( sym: -10; act: 39 ),
+{ 22: }
+  ( sym: -18; act: 53 ),
+  ( sym: -10; act: 40 ),
+{ 23: }
+{ 24: }
+{ 25: }
+{ 26: }
+{ 27: }
+{ 28: }
+{ 29: }
+{ 30: }
+{ 31: }
+  ( sym: -21; act: 15 ),
+  ( sym: -19; act: 16 ),
+  ( sym: -13; act: 17 ),
+  ( sym: -11; act: 61 ),
+  ( sym: -10; act: 19 ),
+{ 32: }
+{ 33: }
+{ 34: }
+{ 35: }
+  ( sym: -8; act: 64 ),
+{ 36: }
+{ 37: }
+{ 38: }
+  ( sym: -16; act: 69 ),
+{ 39: }
+  ( sym: -16; act: 70 ),
+{ 40: }
+  ( sym: -18; act: 71 ),
+{ 41: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 73 ),
+  ( sym: -12; act: 74 ),
+  ( sym: -10; act: 75 ),
+{ 42: }
+{ 43: }
+{ 44: }
+{ 45: }
+{ 46: }
+{ 47: }
+{ 48: }
+{ 49: }
+{ 50: }
+  ( sym: -4; act: 85 ),
+{ 51: }
+  ( sym: -21; act: 15 ),
+  ( sym: -20; act: 86 ),
+  ( sym: -19; act: 16 ),
+  ( sym: -17; act: 87 ),
+  ( sym: -13; act: 17 ),
+  ( sym: -11; act: 88 ),
+  ( sym: -10; act: 19 ),
+{ 52: }
+{ 53: }
+{ 54: }
+  ( sym: -4; act: 90 ),
+{ 55: }
+  ( sym: -35; act: 91 ),
+  ( sym: -14; act: 92 ),
+  ( sym: -10; act: 93 ),
+{ 56: }
+{ 57: }
+{ 58: }
+{ 59: }
+{ 60: }
+{ 61: }
+{ 62: }
+{ 63: }
+{ 64: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 73 ),
+  ( sym: -12; act: 95 ),
+  ( sym: -10; act: 75 ),
+{ 65: }
+{ 66: }
+  ( sym: -35; act: 91 ),
+  ( sym: -14; act: 96 ),
+  ( sym: -10; act: 93 ),
+{ 67: }
+{ 68: }
+  ( sym: -32; act: 97 ),
+  ( sym: -15; act: 98 ),
+  ( sym: -10; act: 99 ),
+{ 69: }
+{ 70: }
+{ 71: }
+{ 72: }
+{ 73: }
+  ( sym: -29; act: 110 ),
+{ 74: }
+  ( sym: -9; act: 113 ),
+{ 75: }
+  ( sym: -28; act: 116 ),
+{ 76: }
+  ( sym: -4; act: 118 ),
+{ 77: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 119 ),
+  ( sym: -10; act: 75 ),
+{ 78: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 120 ),
+  ( sym: -10; act: 75 ),
+{ 79: }
+{ 80: }
+{ 81: }
+{ 82: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 121 ),
+  ( sym: -10; act: 75 ),
+{ 83: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 122 ),
+  ( sym: -10; act: 75 ),
+{ 84: }
+{ 85: }
+{ 86: }
+  ( sym: -21; act: 15 ),
+  ( sym: -20; act: 86 ),
+  ( sym: -19; act: 16 ),
+  ( sym: -17; act: 124 ),
+  ( sym: -13; act: 17 ),
+  ( sym: -11; act: 88 ),
+  ( sym: -10; act: 19 ),
+{ 87: }
+{ 88: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 73 ),
+  ( sym: -12; act: 126 ),
+  ( sym: -10; act: 75 ),
+{ 89: }
+{ 90: }
+{ 91: }
+{ 92: }
+{ 93: }
+{ 94: }
+{ 95: }
+{ 96: }
+{ 97: }
+{ 98: }
+{ 99: }
+{ 100: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 138 ),
+  ( sym: -27; act: 139 ),
+  ( sym: -21; act: 15 ),
+  ( sym: -19; act: 16 ),
+  ( sym: -13; act: 17 ),
+  ( sym: -11; act: 140 ),
+  ( sym: -10; act: 141 ),
+{ 101: }
+{ 102: }
+{ 103: }
+{ 104: }
+  ( sym: -32; act: 142 ),
+  ( sym: -10; act: 99 ),
+{ 105: }
+  ( sym: -32; act: 143 ),
+  ( sym: -10; act: 99 ),
+{ 106: }
+  ( sym: -32; act: 144 ),
+  ( sym: -10; act: 99 ),
+{ 107: }
+{ 108: }
+{ 109: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 145 ),
+  ( sym: -10; act: 75 ),
+{ 110: }
+{ 111: }
+  ( sym: -25; act: 146 ),
+  ( sym: -23; act: 147 ),
+  ( sym: -21; act: 15 ),
+  ( sym: -19; act: 16 ),
+  ( sym: -13; act: 17 ),
+  ( sym: -11; act: 148 ),
+  ( sym: -10; act: 19 ),
+{ 112: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 153 ),
+  ( sym: -10; act: 99 ),
+{ 113: }
+{ 114: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 155 ),
+  ( sym: -10; act: 75 ),
+{ 115: }
+{ 116: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 157 ),
+  ( sym: -10; act: 99 ),
+{ 117: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 158 ),
+  ( sym: -10; act: 99 ),
+{ 118: }
+{ 119: }
+  ( sym: -29; act: 110 ),
+{ 120: }
+  ( sym: -29; act: 110 ),
+{ 121: }
+  ( sym: -29; act: 110 ),
+{ 122: }
+  ( sym: -29; act: 110 ),
+{ 123: }
+{ 124: }
+{ 125: }
+{ 126: }
+{ 127: }
+{ 128: }
+  ( sym: -35; act: 91 ),
+  ( sym: -14; act: 162 ),
+  ( sym: -10; act: 93 ),
+{ 129: }
+{ 130: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 163 ),
+  ( sym: -10; act: 99 ),
+{ 131: }
+{ 132: }
+{ 133: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 165 ),
+  ( sym: -10; act: 99 ),
+{ 134: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 166 ),
+  ( sym: -10; act: 99 ),
+{ 135: }
+{ 136: }
+  ( sym: -36; act: 167 ),
+  ( sym: -34; act: 168 ),
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 169 ),
+  ( sym: -10; act: 99 ),
+{ 137: }
+{ 138: }
+{ 139: }
+{ 140: }
+  ( sym: -26; act: 187 ),
+{ 141: }
+{ 142: }
+{ 143: }
+{ 144: }
+{ 145: }
+  ( sym: -29; act: 110 ),
+{ 146: }
+{ 147: }
+{ 148: }
+  ( sym: -26; act: 193 ),
+  ( sym: -24; act: 194 ),
+  ( sym: -22; act: 195 ),
+  ( sym: -10; act: 75 ),
+{ 149: }
+{ 150: }
+{ 151: }
+{ 152: }
+{ 153: }
+{ 154: }
+{ 155: }
+  ( sym: -29; act: 110 ),
+{ 156: }
+  ( sym: -10; act: 201 ),
+{ 157: }
+{ 158: }
+{ 159: }
+  ( sym: -26; act: 72 ),
+  ( sym: -22; act: 73 ),
+  ( sym: -12; act: 202 ),
+  ( sym: -10; act: 75 ),
+{ 160: }
+{ 161: }
+{ 162: }
+{ 163: }
+{ 164: }
+  ( sym: -32; act: 97 ),
+  ( sym: -15; act: 203 ),
+  ( sym: -10; act: 99 ),
+{ 165: }
+{ 166: }
+{ 167: }
+{ 168: }
+{ 169: }
+{ 170: }
+{ 171: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 206 ),
+  ( sym: -10; act: 99 ),
+{ 172: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 207 ),
+  ( sym: -10; act: 99 ),
+{ 173: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 208 ),
+  ( sym: -10; act: 99 ),
+{ 174: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 209 ),
+  ( sym: -10; act: 99 ),
+{ 175: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 210 ),
+  ( sym: -10; act: 99 ),
+{ 176: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 211 ),
+  ( sym: -10; act: 99 ),
+{ 177: }
+  ( sym: -32; act: 137 ),
+  ( sym: -31; act: 212 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 213 ),
+  ( sym: -10; act: 99 ),
+{ 178: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 214 ),
+  ( sym: -10; act: 99 ),
+{ 179: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 215 ),
+  ( sym: -10; act: 99 ),
+{ 180: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 216 ),
+  ( sym: -10; act: 99 ),
+{ 181: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 217 ),
+  ( sym: -10; act: 99 ),
+{ 182: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 218 ),
+  ( sym: -10; act: 99 ),
+{ 183: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 219 ),
+  ( sym: -10; act: 99 ),
+{ 184: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 220 ),
+  ( sym: -10; act: 99 ),
+{ 185: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 221 ),
+  ( sym: -10; act: 99 ),
+{ 186: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 222 ),
+  ( sym: -10; act: 99 ),
+{ 187: }
+{ 188: }
+  ( sym: -32; act: 224 ),
+  ( sym: -10; act: 99 ),
+{ 189: }
+{ 190: }
+  ( sym: -33; act: 226 ),
+  ( sym: -32; act: 227 ),
+  ( sym: -10; act: 99 ),
+{ 191: }
+{ 192: }
+  ( sym: -25; act: 228 ),
+  ( sym: -23; act: 147 ),
+  ( sym: -21; act: 15 ),
+  ( sym: -19; act: 16 ),
+  ( sym: -13; act: 17 ),
+  ( sym: -11; act: 148 ),
+  ( sym: -10; act: 19 ),
+{ 193: }
+{ 194: }
+  ( sym: -29; act: 230 ),
+{ 195: }
+  ( sym: -29; act: 110 ),
+{ 196: }
+  ( sym: -26; act: 193 ),
+  ( sym: -24; act: 233 ),
+  ( sym: -22; act: 119 ),
+  ( sym: -10; act: 75 ),
+{ 197: }
+  ( sym: -26; act: 193 ),
+  ( sym: -24; act: 234 ),
+  ( sym: -22; act: 120 ),
+  ( sym: -10; act: 75 ),
+{ 198: }
+  ( sym: -26; act: 193 ),
+  ( sym: -24; act: 235 ),
+  ( sym: -22; act: 122 ),
+  ( sym: -10; act: 75 ),
+{ 199: }
+{ 200: }
+{ 201: }
+{ 202: }
+{ 203: }
+{ 204: }
+  ( sym: -36; act: 167 ),
+  ( sym: -34; act: 238 ),
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 169 ),
+  ( sym: -10; act: 99 ),
+{ 205: }
+{ 206: }
+{ 207: }
+{ 208: }
+{ 209: }
+{ 210: }
+{ 211: }
+{ 212: }
+{ 213: }
+{ 214: }
+{ 215: }
+{ 216: }
+{ 217: }
+{ 218: }
+{ 219: }
+{ 220: }
+{ 221: }
+{ 222: }
+{ 223: }
+{ 224: }
+{ 225: }
+  ( sym: -32; act: 241 ),
+  ( sym: -10; act: 99 ),
+{ 226: }
+{ 227: }
+{ 228: }
+{ 229: }
+  ( sym: -26; act: 193 ),
+  ( sym: -24; act: 242 ),
+  ( sym: -22; act: 145 ),
+  ( sym: -10; act: 75 ),
+{ 230: }
+{ 231: }
+  ( sym: -25; act: 243 ),
+  ( sym: -23; act: 147 ),
+  ( sym: -21; act: 15 ),
+  ( sym: -19; act: 16 ),
+  ( sym: -13; act: 17 ),
+  ( sym: -11; act: 148 ),
+  ( sym: -10; act: 19 ),
+{ 232: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 244 ),
+  ( sym: -10; act: 99 ),
+{ 233: }
+  ( sym: -29; act: 230 ),
+{ 234: }
+  ( sym: -29; act: 230 ),
+{ 235: }
+  ( sym: -29; act: 230 ),
+{ 236: }
+{ 237: }
+{ 238: }
+{ 239: }
+  ( sym: -32; act: 137 ),
+  ( sym: -30; act: 152 ),
+  ( sym: -27; act: 246 ),
+  ( sym: -10; act: 99 ),
+{ 240: }
+  ( sym: -32; act: 247 ),
+  ( sym: -10; act: 99 ),
+{ 241: }
+{ 242: }
+  ( sym: -29; act: 230 )
+{ 243: }
+{ 244: }
+{ 245: }
+{ 246: }
+{ 247: }
+{ 248: }
+{ 249: }
+);
+
+yyd : array [0..yynstates-1] of Integer = (
+{ 0: } 0,
+{ 1: } 0,
+{ 2: } 0,
+{ 3: } -6,
+{ 4: } -5,
+{ 5: } 0,
+{ 6: } 0,
+{ 7: } -2,
+{ 8: } 0,
+{ 9: } 0,
+{ 10: } 0,
+{ 11: } 0,
+{ 12: } 0,
+{ 13: } -7,
+{ 14: } -20,
+{ 15: } -66,
+{ 16: } -48,
+{ 17: } -47,
+{ 18: } 0,
+{ 19: } -67,
+{ 20: } 0,
+{ 21: } 0,
+{ 22: } 0,
+{ 23: } -52,
+{ 24: } -64,
+{ 25: } 0,
+{ 26: } 0,
+{ 27: } -53,
+{ 28: } -56,
+{ 29: } -65,
+{ 30: } -63,
+{ 31: } 0,
+{ 32: } -4,
+{ 33: } -3,
+{ 34: } 0,
+{ 35: } 0,
+{ 36: } 0,
+{ 37: } 0,
+{ 38: } 0,
+{ 39: } 0,
+{ 40: } 0,
+{ 41: } 0,
+{ 42: } -9,
+{ 43: } -10,
+{ 44: } -11,
+{ 45: } -12,
+{ 46: } -13,
+{ 47: } -14,
+{ 48: } -15,
+{ 49: } 0,
+{ 50: } -2,
+{ 51: } 0,
+{ 52: } 0,
+{ 53: } -46,
+{ 54: } -2,
+{ 55: } 0,
+{ 56: } -61,
+{ 57: } 0,
+{ 58: } -54,
+{ 59: } -62,
+{ 60: } -57,
+{ 61: } -41,
+{ 62: } -23,
+{ 63: } -28,
+{ 64: } 0,
+{ 65: } -22,
+{ 66: } 0,
+{ 67: } -26,
+{ 68: } 0,
+{ 69: } 0,
+{ 70: } 0,
+{ 71: } -39,
+{ 72: } 0,
+{ 73: } 0,
+{ 74: } 0,
+{ 75: } 0,
+{ 76: } -2,
+{ 77: } 0,
+{ 78: } 0,
+{ 79: } -77,
+{ 80: } -79,
+{ 81: } -78,
+{ 82: } 0,
+{ 83: } 0,
+{ 84: } -44,
+{ 85: } 0,
+{ 86: } 0,
+{ 87: } 0,
+{ 88: } 0,
+{ 89: } -42,
+{ 90: } 0,
+{ 91: } 0,
+{ 92: } 0,
+{ 93: } 0,
+{ 94: } -58,
+{ 95: } 0,
+{ 96: } 0,
+{ 97: } 0,
+{ 98: } 0,
+{ 99: } 0,
+{ 100: } 0,
+{ 101: } -124,
+{ 102: } -123,
+{ 103: } -25,
+{ 104: } 0,
+{ 105: } 0,
+{ 106: } 0,
+{ 107: } -33,
+{ 108: } -35,
+{ 109: } 0,
+{ 110: } -88,
+{ 111: } 0,
+{ 112: } 0,
+{ 113: } 0,
+{ 114: } 0,
+{ 115: } 0,
+{ 116: } 0,
+{ 117: } 0,
+{ 118: } 0,
+{ 119: } 0,
+{ 120: } 0,
+{ 121: } 0,
+{ 122: } 0,
+{ 123: } -30,
+{ 124: } -49,
+{ 125: } -29,
+{ 126: } 0,
+{ 127: } -32,
+{ 128: } 0,
+{ 129: } -31,
+{ 130: } 0,
+{ 131: } -21,
+{ 132: } 0,
+{ 133: } 0,
+{ 134: } 0,
+{ 135: } -27,
+{ 136: } 0,
+{ 137: } 0,
+{ 138: } 0,
+{ 139: } 0,
+{ 140: } 0,
+{ 141: } 0,
+{ 142: } 0,
+{ 143: } 0,
+{ 144: } 0,
+{ 145: } 0,
+{ 146: } 0,
+{ 147: } 0,
+{ 148: } 0,
+{ 149: } -91,
+{ 150: } 0,
+{ 151: } -76,
+{ 152: } -101,
+{ 153: } 0,
+{ 154: } -19,
+{ 155: } 0,
+{ 156: } 0,
+{ 157: } 0,
+{ 158: } 0,
+{ 159: } 0,
+{ 160: } -90,
+{ 161: } -51,
+{ 162: } -136,
+{ 163: } 0,
+{ 164: } 0,
+{ 165: } -125,
+{ 166: } -126,
+{ 167: } 0,
+{ 168: } 0,
+{ 169: } 0,
+{ 170: } -135,
+{ 171: } 0,
+{ 172: } 0,
+{ 173: } 0,
+{ 174: } 0,
+{ 175: } 0,
+{ 176: } 0,
+{ 177: } 0,
+{ 178: } 0,
+{ 179: } 0,
+{ 180: } 0,
+{ 181: } 0,
+{ 182: } 0,
+{ 183: } 0,
+{ 184: } 0,
+{ 185: } 0,
+{ 186: } 0,
+{ 187: } 0,
+{ 188: } 0,
+{ 189: } 0,
+{ 190: } 0,
+{ 191: } -87,
+{ 192: } 0,
+{ 193: } 0,
+{ 194: } 0,
+{ 195: } 0,
+{ 196: } 0,
+{ 197: } 0,
+{ 198: } 0,
+{ 199: } -92,
+{ 200: } -89,
+{ 201: } 0,
+{ 202: } -69,
+{ 203: } 0,
+{ 204: } 0,
+{ 205: } -134,
+{ 206: } 0,
+{ 207: } 0,
+{ 208: } 0,
+{ 209: } 0,
+{ 210: } 0,
+{ 211: } 0,
+{ 212: } -117,
+{ 213: } 0,
+{ 214: } 0,
+{ 215: } 0,
+{ 216: } 0,
+{ 217: } 0,
+{ 218: } 0,
+{ 219: } 0,
+{ 220: } 0,
+{ 221: } 0,
+{ 222: } 0,
+{ 223: } 0,
+{ 224: } 0,
+{ 225: } 0,
+{ 226: } -130,
+{ 227: } 0,
+{ 228: } -75,
+{ 229: } 0,
+{ 230: } -97,
+{ 231: } 0,
+{ 232: } 0,
+{ 233: } 0,
+{ 234: } 0,
+{ 235: } 0,
+{ 236: } -17,
+{ 237: } -24,
+{ 238: } -142,
+{ 239: } 0,
+{ 240: } 0,
+{ 241: } 0,
+{ 242: } 0,
+{ 243: } 0,
+{ 244: } 0,
+{ 245: } -99,
+{ 246: } 0,
+{ 247: } 0,
+{ 248: } -96,
+{ 249: } -98
+);
+
+yyal : array [0..yynstates-1] of Integer = (
+{ 0: } 1,
+{ 1: } 17,
+{ 2: } 18,
+{ 3: } 30,
+{ 4: } 30,
+{ 5: } 30,
+{ 6: } 47,
+{ 7: } 48,
+{ 8: } 48,
+{ 9: } 60,
+{ 10: } 61,
+{ 11: } 62,
+{ 12: } 63,
+{ 13: } 64,
+{ 14: } 64,
+{ 15: } 64,
+{ 16: } 64,
+{ 17: } 64,
+{ 18: } 64,
+{ 19: } 80,
+{ 20: } 80,
+{ 21: } 83,
+{ 22: } 86,
+{ 23: } 89,
+{ 24: } 89,
+{ 25: } 89,
+{ 26: } 112,
+{ 27: } 132,
+{ 28: } 132,
+{ 29: } 132,
+{ 30: } 132,
+{ 31: } 132,
+{ 32: } 144,
+{ 33: } 144,
+{ 34: } 144,
+{ 35: } 146,
+{ 36: } 162,
+{ 37: } 179,
+{ 38: } 182,
+{ 39: } 203,
+{ 40: } 224,
+{ 41: } 245,
+{ 42: } 254,
+{ 43: } 254,
+{ 44: } 254,
+{ 45: } 254,
+{ 46: } 254,
+{ 47: } 254,
+{ 48: } 254,
+{ 49: } 254,
+{ 50: } 274,
+{ 51: } 274,
+{ 52: } 286,
+{ 53: } 306,
+{ 54: } 306,
+{ 55: } 306,
+{ 56: } 308,
+{ 57: } 308,
+{ 58: } 328,
+{ 59: } 328,
+{ 60: } 328,
+{ 61: } 328,
+{ 62: } 328,
+{ 63: } 328,
+{ 64: } 328,
+{ 65: } 337,
+{ 66: } 337,
+{ 67: } 339,
+{ 68: } 339,
+{ 69: } 347,
+{ 70: } 368,
+{ 71: } 389,
+{ 72: } 389,
+{ 73: } 390,
+{ 74: } 395,
+{ 75: } 398,
+{ 76: } 405,
+{ 77: } 405,
+{ 78: } 413,
+{ 79: } 421,
+{ 80: } 421,
+{ 81: } 421,
+{ 82: } 421,
+{ 83: } 429,
+{ 84: } 437,
+{ 85: } 437,
+{ 86: } 438,
+{ 87: } 451,
+{ 88: } 452,
+{ 89: } 461,
+{ 90: } 461,
+{ 91: } 462,
+{ 92: } 465,
+{ 93: } 466,
+{ 94: } 470,
+{ 95: } 470,
+{ 96: } 472,
+{ 97: } 473,
+{ 98: } 476,
+{ 99: } 477,
+{ 100: } 505,
+{ 101: } 523,
+{ 102: } 523,
+{ 103: } 523,
+{ 104: } 523,
+{ 105: } 530,
+{ 106: } 537,
+{ 107: } 544,
+{ 108: } 544,
+{ 109: } 544,
+{ 110: } 552,
+{ 111: } 552,
+{ 112: } 566,
+{ 113: } 573,
+{ 114: } 574,
+{ 115: } 582,
+{ 116: } 583,
+{ 117: } 590,
+{ 118: } 597,
+{ 119: } 600,
+{ 120: } 603,
+{ 121: } 609,
+{ 122: } 615,
+{ 123: } 621,
+{ 124: } 621,
+{ 125: } 621,
+{ 126: } 621,
+{ 127: } 623,
+{ 128: } 623,
+{ 129: } 626,
+{ 130: } 626,
+{ 131: } 633,
+{ 132: } 633,
+{ 133: } 634,
+{ 134: } 641,
+{ 135: } 648,
+{ 136: } 648,
+{ 137: } 656,
+{ 138: } 684,
+{ 139: } 701,
+{ 140: } 717,
+{ 141: } 722,
+{ 142: } 745,
+{ 143: } 773,
+{ 144: } 801,
+{ 145: } 829,
+{ 146: } 835,
+{ 147: } 836,
+{ 148: } 838,
+{ 149: } 849,
+{ 150: } 849,
+{ 151: } 860,
+{ 152: } 860,
+{ 153: } 860,
+{ 154: } 877,
+{ 155: } 877,
+{ 156: } 882,
+{ 157: } 883,
+{ 158: } 905,
+{ 159: } 927,
+{ 160: } 936,
+{ 161: } 936,
+{ 162: } 936,
+{ 163: } 936,
+{ 164: } 955,
+{ 165: } 962,
+{ 166: } 962,
+{ 167: } 962,
+{ 168: } 964,
+{ 169: } 965,
+{ 170: } 983,
+{ 171: } 983,
+{ 172: } 990,
+{ 173: } 997,
+{ 174: } 1004,
+{ 175: } 1011,
+{ 176: } 1018,
+{ 177: } 1025,
+{ 178: } 1032,
+{ 179: } 1039,
+{ 180: } 1046,
+{ 181: } 1053,
+{ 182: } 1060,
+{ 183: } 1067,
+{ 184: } 1074,
+{ 185: } 1081,
+{ 186: } 1088,
+{ 187: } 1095,
+{ 188: } 1096,
+{ 189: } 1103,
+{ 190: } 1104,
+{ 191: } 1135,
+{ 192: } 1135,
+{ 193: } 1148,
+{ 194: } 1149,
+{ 195: } 1153,
+{ 196: } 1157,
+{ 197: } 1167,
+{ 198: } 1178,
+{ 199: } 1189,
+{ 200: } 1189,
+{ 201: } 1189,
+{ 202: } 1190,
+{ 203: } 1190,
+{ 204: } 1191,
+{ 205: } 1199,
+{ 206: } 1199,
+{ 207: } 1227,
+{ 208: } 1255,
+{ 209: } 1283,
+{ 210: } 1311,
+{ 211: } 1339,
+{ 212: } 1367,
+{ 213: } 1367,
+{ 214: } 1384,
+{ 215: } 1412,
+{ 216: } 1440,
+{ 217: } 1468,
+{ 218: } 1496,
+{ 219: } 1524,
+{ 220: } 1552,
+{ 221: } 1580,
+{ 222: } 1608,
+{ 223: } 1636,
+{ 224: } 1637,
+{ 225: } 1665,
+{ 226: } 1672,
+{ 227: } 1672,
+{ 228: } 1700,
+{ 229: } 1700,
+{ 230: } 1711,
+{ 231: } 1711,
+{ 232: } 1725,
+{ 233: } 1732,
+{ 234: } 1735,
+{ 235: } 1739,
+{ 236: } 1743,
+{ 237: } 1743,
+{ 238: } 1743,
+{ 239: } 1743,
+{ 240: } 1750,
+{ 241: } 1757,
+{ 242: } 1785,
+{ 243: } 1789,
+{ 244: } 1790,
+{ 245: } 1807,
+{ 246: } 1807,
+{ 247: } 1835,
+{ 248: } 1863,
+{ 249: } 1863
+);
+
+yyah : array [0..yynstates-1] of Integer = (
+{ 0: } 16,
+{ 1: } 17,
+{ 2: } 29,
+{ 3: } 29,
+{ 4: } 29,
+{ 5: } 46,
+{ 6: } 47,
+{ 7: } 47,
+{ 8: } 59,
+{ 9: } 60,
+{ 10: } 61,
+{ 11: } 62,
+{ 12: } 63,
+{ 13: } 63,
+{ 14: } 63,
+{ 15: } 63,
+{ 16: } 63,
+{ 17: } 63,
+{ 18: } 79,
+{ 19: } 79,
+{ 20: } 82,
+{ 21: } 85,
+{ 22: } 88,
+{ 23: } 88,
+{ 24: } 88,
+{ 25: } 111,
+{ 26: } 131,
+{ 27: } 131,
+{ 28: } 131,
+{ 29: } 131,
+{ 30: } 131,
+{ 31: } 143,
+{ 32: } 143,
+{ 33: } 143,
+{ 34: } 145,
+{ 35: } 161,
+{ 36: } 178,
+{ 37: } 181,
+{ 38: } 202,
+{ 39: } 223,
+{ 40: } 244,
+{ 41: } 253,
+{ 42: } 253,
+{ 43: } 253,
+{ 44: } 253,
+{ 45: } 253,
+{ 46: } 253,
+{ 47: } 253,
+{ 48: } 253,
+{ 49: } 273,
+{ 50: } 273,
+{ 51: } 285,
+{ 52: } 305,
+{ 53: } 305,
+{ 54: } 305,
+{ 55: } 307,
+{ 56: } 307,
+{ 57: } 327,
+{ 58: } 327,
+{ 59: } 327,
+{ 60: } 327,
+{ 61: } 327,
+{ 62: } 327,
+{ 63: } 327,
+{ 64: } 336,
+{ 65: } 336,
+{ 66: } 338,
+{ 67: } 338,
+{ 68: } 346,
+{ 69: } 367,
+{ 70: } 388,
+{ 71: } 388,
+{ 72: } 389,
+{ 73: } 394,
+{ 74: } 397,
+{ 75: } 404,
+{ 76: } 404,
+{ 77: } 412,
+{ 78: } 420,
+{ 79: } 420,
+{ 80: } 420,
+{ 81: } 420,
+{ 82: } 428,
+{ 83: } 436,
+{ 84: } 436,
+{ 85: } 437,
+{ 86: } 450,
+{ 87: } 451,
+{ 88: } 460,
+{ 89: } 460,
+{ 90: } 461,
+{ 91: } 464,
+{ 92: } 465,
+{ 93: } 469,
+{ 94: } 469,
+{ 95: } 471,
+{ 96: } 472,
+{ 97: } 475,
+{ 98: } 476,
+{ 99: } 504,
+{ 100: } 522,
+{ 101: } 522,
+{ 102: } 522,
+{ 103: } 522,
+{ 104: } 529,
+{ 105: } 536,
+{ 106: } 543,
+{ 107: } 543,
+{ 108: } 543,
+{ 109: } 551,
+{ 110: } 551,
+{ 111: } 565,
+{ 112: } 572,
+{ 113: } 573,
+{ 114: } 581,
+{ 115: } 582,
+{ 116: } 589,
+{ 117: } 596,
+{ 118: } 599,
+{ 119: } 602,
+{ 120: } 608,
+{ 121: } 614,
+{ 122: } 620,
+{ 123: } 620,
+{ 124: } 620,
+{ 125: } 620,
+{ 126: } 622,
+{ 127: } 622,
+{ 128: } 625,
+{ 129: } 625,
+{ 130: } 632,
+{ 131: } 632,
+{ 132: } 633,
+{ 133: } 640,
+{ 134: } 647,
+{ 135: } 647,
+{ 136: } 655,
+{ 137: } 683,
+{ 138: } 700,
+{ 139: } 716,
+{ 140: } 721,
+{ 141: } 744,
+{ 142: } 772,
+{ 143: } 800,
+{ 144: } 828,
+{ 145: } 834,
+{ 146: } 835,
+{ 147: } 837,
+{ 148: } 848,
+{ 149: } 848,
+{ 150: } 859,
+{ 151: } 859,
+{ 152: } 859,
+{ 153: } 876,
+{ 154: } 876,
+{ 155: } 881,
+{ 156: } 882,
+{ 157: } 904,
+{ 158: } 926,
+{ 159: } 935,
+{ 160: } 935,
+{ 161: } 935,
+{ 162: } 935,
+{ 163: } 954,
+{ 164: } 961,
+{ 165: } 961,
+{ 166: } 961,
+{ 167: } 963,
+{ 168: } 964,
+{ 169: } 982,
+{ 170: } 982,
+{ 171: } 989,
+{ 172: } 996,
+{ 173: } 1003,
+{ 174: } 1010,
+{ 175: } 1017,
+{ 176: } 1024,
+{ 177: } 1031,
+{ 178: } 1038,
+{ 179: } 1045,
+{ 180: } 1052,
+{ 181: } 1059,
+{ 182: } 1066,
+{ 183: } 1073,
+{ 184: } 1080,
+{ 185: } 1087,
+{ 186: } 1094,
+{ 187: } 1095,
+{ 188: } 1102,
+{ 189: } 1103,
+{ 190: } 1134,
+{ 191: } 1134,
+{ 192: } 1147,
+{ 193: } 1148,
+{ 194: } 1152,
+{ 195: } 1156,
+{ 196: } 1166,
+{ 197: } 1177,
+{ 198: } 1188,
+{ 199: } 1188,
+{ 200: } 1188,
+{ 201: } 1189,
+{ 202: } 1189,
+{ 203: } 1190,
+{ 204: } 1198,
+{ 205: } 1198,
+{ 206: } 1226,
+{ 207: } 1254,
+{ 208: } 1282,
+{ 209: } 1310,
+{ 210: } 1338,
+{ 211: } 1366,
+{ 212: } 1366,
+{ 213: } 1383,
+{ 214: } 1411,
+{ 215: } 1439,
+{ 216: } 1467,
+{ 217: } 1495,
+{ 218: } 1523,
+{ 219: } 1551,
+{ 220: } 1579,
+{ 221: } 1607,
+{ 222: } 1635,
+{ 223: } 1636,
+{ 224: } 1664,
+{ 225: } 1671,
+{ 226: } 1671,
+{ 227: } 1699,
+{ 228: } 1699,
+{ 229: } 1710,
+{ 230: } 1710,
+{ 231: } 1724,
+{ 232: } 1731,
+{ 233: } 1734,
+{ 234: } 1738,
+{ 235: } 1742,
+{ 236: } 1742,
+{ 237: } 1742,
+{ 238: } 1742,
+{ 239: } 1749,
+{ 240: } 1756,
+{ 241: } 1784,
+{ 242: } 1788,
+{ 243: } 1789,
+{ 244: } 1806,
+{ 245: } 1806,
+{ 246: } 1834,
+{ 247: } 1862,
+{ 248: } 1862,
+{ 249: } 1862
+);
+
+yygl : array [0..yynstates-1] of Integer = (
+{ 0: } 1,
+{ 1: } 7,
+{ 2: } 7,
+{ 3: } 12,
+{ 4: } 12,
+{ 5: } 12,
+{ 6: } 16,
+{ 7: } 16,
+{ 8: } 17,
+{ 9: } 22,
+{ 10: } 23,
+{ 11: } 24,
+{ 12: } 25,
+{ 13: } 26,
+{ 14: } 26,
+{ 15: } 26,
+{ 16: } 26,
+{ 17: } 26,
+{ 18: } 26,
+{ 19: } 27,
+{ 20: } 27,
+{ 21: } 29,
+{ 22: } 31,
+{ 23: } 33,
+{ 24: } 33,
+{ 25: } 33,
+{ 26: } 33,
+{ 27: } 33,
+{ 28: } 33,
+{ 29: } 33,
+{ 30: } 33,
+{ 31: } 33,
+{ 32: } 38,
+{ 33: } 38,
+{ 34: } 38,
+{ 35: } 38,
+{ 36: } 39,
+{ 37: } 39,
+{ 38: } 39,
+{ 39: } 40,
+{ 40: } 41,
+{ 41: } 42,
+{ 42: } 46,
+{ 43: } 46,
+{ 44: } 46,
+{ 45: } 46,
+{ 46: } 46,
+{ 47: } 46,
+{ 48: } 46,
+{ 49: } 46,
+{ 50: } 46,
+{ 51: } 47,
+{ 52: } 54,
+{ 53: } 54,
+{ 54: } 54,
+{ 55: } 55,
+{ 56: } 58,
+{ 57: } 58,
+{ 58: } 58,
+{ 59: } 58,
+{ 60: } 58,
+{ 61: } 58,
+{ 62: } 58,
+{ 63: } 58,
+{ 64: } 58,
+{ 65: } 62,
+{ 66: } 62,
+{ 67: } 65,
+{ 68: } 65,
+{ 69: } 68,
+{ 70: } 68,
+{ 71: } 68,
+{ 72: } 68,
+{ 73: } 68,
+{ 74: } 69,
+{ 75: } 70,
+{ 76: } 71,
+{ 77: } 72,
+{ 78: } 75,
+{ 79: } 78,
+{ 80: } 78,
+{ 81: } 78,
+{ 82: } 78,
+{ 83: } 81,
+{ 84: } 84,
+{ 85: } 84,
+{ 86: } 84,
+{ 87: } 91,
+{ 88: } 91,
+{ 89: } 95,
+{ 90: } 95,
+{ 91: } 95,
+{ 92: } 95,
+{ 93: } 95,
+{ 94: } 95,
+{ 95: } 95,
+{ 96: } 95,
+{ 97: } 95,
+{ 98: } 95,
+{ 99: } 95,
+{ 100: } 95,
+{ 101: } 103,
+{ 102: } 103,
+{ 103: } 103,
+{ 104: } 103,
+{ 105: } 105,
+{ 106: } 107,
+{ 107: } 109,
+{ 108: } 109,
+{ 109: } 109,
+{ 110: } 112,
+{ 111: } 112,
+{ 112: } 119,
+{ 113: } 123,
+{ 114: } 123,
+{ 115: } 126,
+{ 116: } 126,
+{ 117: } 130,
+{ 118: } 134,
+{ 119: } 134,
+{ 120: } 135,
+{ 121: } 136,
+{ 122: } 137,
+{ 123: } 138,
+{ 124: } 138,
+{ 125: } 138,
+{ 126: } 138,
+{ 127: } 138,
+{ 128: } 138,
+{ 129: } 141,
+{ 130: } 141,
+{ 131: } 145,
+{ 132: } 145,
+{ 133: } 145,
+{ 134: } 149,
+{ 135: } 153,
+{ 136: } 153,
+{ 137: } 159,
+{ 138: } 159,
+{ 139: } 159,
+{ 140: } 159,
+{ 141: } 160,
+{ 142: } 160,
+{ 143: } 160,
+{ 144: } 160,
+{ 145: } 160,
+{ 146: } 161,
+{ 147: } 161,
+{ 148: } 161,
+{ 149: } 165,
+{ 150: } 165,
+{ 151: } 165,
+{ 152: } 165,
+{ 153: } 165,
+{ 154: } 165,
+{ 155: } 165,
+{ 156: } 166,
+{ 157: } 167,
+{ 158: } 167,
+{ 159: } 167,
+{ 160: } 171,
+{ 161: } 171,
+{ 162: } 171,
+{ 163: } 171,
+{ 164: } 171,
+{ 165: } 174,
+{ 166: } 174,
+{ 167: } 174,
+{ 168: } 174,
+{ 169: } 174,
+{ 170: } 174,
+{ 171: } 174,
+{ 172: } 178,
+{ 173: } 182,
+{ 174: } 186,
+{ 175: } 190,
+{ 176: } 194,
+{ 177: } 198,
+{ 178: } 203,
+{ 179: } 207,
+{ 180: } 211,
+{ 181: } 215,
+{ 182: } 219,
+{ 183: } 223,
+{ 184: } 227,
+{ 185: } 231,
+{ 186: } 235,
+{ 187: } 239,
+{ 188: } 239,
+{ 189: } 241,
+{ 190: } 241,
+{ 191: } 244,
+{ 192: } 244,
+{ 193: } 251,
+{ 194: } 251,
+{ 195: } 252,
+{ 196: } 253,
+{ 197: } 257,
+{ 198: } 261,
+{ 199: } 265,
+{ 200: } 265,
+{ 201: } 265,
+{ 202: } 265,
+{ 203: } 265,
+{ 204: } 265,
+{ 205: } 271,
+{ 206: } 271,
+{ 207: } 271,
+{ 208: } 271,
+{ 209: } 271,
+{ 210: } 271,
+{ 211: } 271,
+{ 212: } 271,
+{ 213: } 271,
+{ 214: } 271,
+{ 215: } 271,
+{ 216: } 271,
+{ 217: } 271,
+{ 218: } 271,
+{ 219: } 271,
+{ 220: } 271,
+{ 221: } 271,
+{ 222: } 271,
+{ 223: } 271,
+{ 224: } 271,
+{ 225: } 271,
+{ 226: } 273,
+{ 227: } 273,
+{ 228: } 273,
+{ 229: } 273,
+{ 230: } 277,
+{ 231: } 277,
+{ 232: } 284,
+{ 233: } 288,
+{ 234: } 289,
+{ 235: } 290,
+{ 236: } 291,
+{ 237: } 291,
+{ 238: } 291,
+{ 239: } 291,
+{ 240: } 295,
+{ 241: } 297,
+{ 242: } 297,
+{ 243: } 298,
+{ 244: } 298,
+{ 245: } 298,
+{ 246: } 298,
+{ 247: } 298,
+{ 248: } 298,
+{ 249: } 298
+);
+
+yygh : array [0..yynstates-1] of Integer = (
+{ 0: } 6,
+{ 1: } 6,
+{ 2: } 11,
+{ 3: } 11,
+{ 4: } 11,
+{ 5: } 15,
+{ 6: } 15,
+{ 7: } 16,
+{ 8: } 21,
+{ 9: } 22,
+{ 10: } 23,
+{ 11: } 24,
+{ 12: } 25,
+{ 13: } 25,
+{ 14: } 25,
+{ 15: } 25,
+{ 16: } 25,
+{ 17: } 25,
+{ 18: } 26,
+{ 19: } 26,
+{ 20: } 28,
+{ 21: } 30,
+{ 22: } 32,
+{ 23: } 32,
+{ 24: } 32,
+{ 25: } 32,
+{ 26: } 32,
+{ 27: } 32,
+{ 28: } 32,
+{ 29: } 32,
+{ 30: } 32,
+{ 31: } 37,
+{ 32: } 37,
+{ 33: } 37,
+{ 34: } 37,
+{ 35: } 38,
+{ 36: } 38,
+{ 37: } 38,
+{ 38: } 39,
+{ 39: } 40,
+{ 40: } 41,
+{ 41: } 45,
+{ 42: } 45,
+{ 43: } 45,
+{ 44: } 45,
+{ 45: } 45,
+{ 46: } 45,
+{ 47: } 45,
+{ 48: } 45,
+{ 49: } 45,
+{ 50: } 46,
+{ 51: } 53,
+{ 52: } 53,
+{ 53: } 53,
+{ 54: } 54,
+{ 55: } 57,
+{ 56: } 57,
+{ 57: } 57,
+{ 58: } 57,
+{ 59: } 57,
+{ 60: } 57,
+{ 61: } 57,
+{ 62: } 57,
+{ 63: } 57,
+{ 64: } 61,
+{ 65: } 61,
+{ 66: } 64,
+{ 67: } 64,
+{ 68: } 67,
+{ 69: } 67,
+{ 70: } 67,
+{ 71: } 67,
+{ 72: } 67,
+{ 73: } 68,
+{ 74: } 69,
+{ 75: } 70,
+{ 76: } 71,
+{ 77: } 74,
+{ 78: } 77,
+{ 79: } 77,
+{ 80: } 77,
+{ 81: } 77,
+{ 82: } 80,
+{ 83: } 83,
+{ 84: } 83,
+{ 85: } 83,
+{ 86: } 90,
+{ 87: } 90,
+{ 88: } 94,
+{ 89: } 94,
+{ 90: } 94,
+{ 91: } 94,
+{ 92: } 94,
+{ 93: } 94,
+{ 94: } 94,
+{ 95: } 94,
+{ 96: } 94,
+{ 97: } 94,
+{ 98: } 94,
+{ 99: } 94,
+{ 100: } 102,
+{ 101: } 102,
+{ 102: } 102,
+{ 103: } 102,
+{ 104: } 104,
+{ 105: } 106,
+{ 106: } 108,
+{ 107: } 108,
+{ 108: } 108,
+{ 109: } 111,
+{ 110: } 111,
+{ 111: } 118,
+{ 112: } 122,
+{ 113: } 122,
+{ 114: } 125,
+{ 115: } 125,
+{ 116: } 129,
+{ 117: } 133,
+{ 118: } 133,
+{ 119: } 134,
+{ 120: } 135,
+{ 121: } 136,
+{ 122: } 137,
+{ 123: } 137,
+{ 124: } 137,
+{ 125: } 137,
+{ 126: } 137,
+{ 127: } 137,
+{ 128: } 140,
+{ 129: } 140,
+{ 130: } 144,
+{ 131: } 144,
+{ 132: } 144,
+{ 133: } 148,
+{ 134: } 152,
+{ 135: } 152,
+{ 136: } 158,
+{ 137: } 158,
+{ 138: } 158,
+{ 139: } 158,
+{ 140: } 159,
+{ 141: } 159,
+{ 142: } 159,
+{ 143: } 159,
+{ 144: } 159,
+{ 145: } 160,
+{ 146: } 160,
+{ 147: } 160,
+{ 148: } 164,
+{ 149: } 164,
+{ 150: } 164,
+{ 151: } 164,
+{ 152: } 164,
+{ 153: } 164,
+{ 154: } 164,
+{ 155: } 165,
+{ 156: } 166,
+{ 157: } 166,
+{ 158: } 166,
+{ 159: } 170,
+{ 160: } 170,
+{ 161: } 170,
+{ 162: } 170,
+{ 163: } 170,
+{ 164: } 173,
+{ 165: } 173,
+{ 166: } 173,
+{ 167: } 173,
+{ 168: } 173,
+{ 169: } 173,
+{ 170: } 173,
+{ 171: } 177,
+{ 172: } 181,
+{ 173: } 185,
+{ 174: } 189,
+{ 175: } 193,
+{ 176: } 197,
+{ 177: } 202,
+{ 178: } 206,
+{ 179: } 210,
+{ 180: } 214,
+{ 181: } 218,
+{ 182: } 222,
+{ 183: } 226,
+{ 184: } 230,
+{ 185: } 234,
+{ 186: } 238,
+{ 187: } 238,
+{ 188: } 240,
+{ 189: } 240,
+{ 190: } 243,
+{ 191: } 243,
+{ 192: } 250,
+{ 193: } 250,
+{ 194: } 251,
+{ 195: } 252,
+{ 196: } 256,
+{ 197: } 260,
+{ 198: } 264,
+{ 199: } 264,
+{ 200: } 264,
+{ 201: } 264,
+{ 202: } 264,
+{ 203: } 264,
+{ 204: } 270,
+{ 205: } 270,
+{ 206: } 270,
+{ 207: } 270,
+{ 208: } 270,
+{ 209: } 270,
+{ 210: } 270,
+{ 211: } 270,
+{ 212: } 270,
+{ 213: } 270,
+{ 214: } 270,
+{ 215: } 270,
+{ 216: } 270,
+{ 217: } 270,
+{ 218: } 270,
+{ 219: } 270,
+{ 220: } 270,
+{ 221: } 270,
+{ 222: } 270,
+{ 223: } 270,
+{ 224: } 270,
+{ 225: } 272,
+{ 226: } 272,
+{ 227: } 272,
+{ 228: } 272,
+{ 229: } 276,
+{ 230: } 276,
+{ 231: } 283,
+{ 232: } 287,
+{ 233: } 288,
+{ 234: } 289,
+{ 235: } 290,
+{ 236: } 290,
+{ 237: } 290,
+{ 238: } 290,
+{ 239: } 294,
+{ 240: } 296,
+{ 241: } 296,
+{ 242: } 297,
+{ 243: } 297,
+{ 244: } 297,
+{ 245: } 297,
+{ 246: } 297,
+{ 247: } 297,
+{ 248: } 297,
+{ 249: } 297
+);
+
+yyr : array [1..yynrules] of YYRRec = (
+{ 1: } ( len: 1; sym: -2 ),
+{ 2: } ( len: 0; sym: -4 ),
+{ 3: } ( len: 2; sym: -3 ),
+{ 4: } ( len: 2; sym: -3 ),
+{ 5: } ( len: 1; sym: -3 ),
+{ 6: } ( len: 1; sym: -3 ),
+{ 7: } ( len: 1; sym: -7 ),
+{ 8: } ( len: 0; sym: -7 ),
+{ 9: } ( len: 1; sym: -8 ),
+{ 10: } ( len: 1; sym: -8 ),
+{ 11: } ( len: 1; sym: -8 ),
+{ 12: } ( len: 1; sym: -8 ),
+{ 13: } ( len: 1; sym: -8 ),
+{ 14: } ( len: 1; sym: -8 ),
+{ 15: } ( len: 1; sym: -8 ),
+{ 16: } ( len: 0; sym: -8 ),
+{ 17: } ( len: 4; sym: -9 ),
+{ 18: } ( len: 0; sym: -9 ),
+{ 19: } ( len: 6; sym: -5 ),
+{ 20: } ( len: 2; sym: -5 ),
+{ 21: } ( len: 5; sym: -5 ),
+{ 22: } ( len: 3; sym: -5 ),
+{ 23: } ( len: 3; sym: -5 ),
+{ 24: } ( len: 8; sym: -6 ),
+{ 25: } ( len: 4; sym: -6 ),
+{ 26: } ( len: 3; sym: -6 ),
+{ 27: } ( len: 5; sym: -6 ),
+{ 28: } ( len: 3; sym: -6 ),
+{ 29: } ( len: 3; sym: -16 ),
+{ 30: } ( len: 3; sym: -16 ),
+{ 31: } ( len: 3; sym: -18 ),
+{ 32: } ( len: 3; sym: -18 ),
+{ 33: } ( len: 4; sym: -13 ),
+{ 34: } ( len: 3; sym: -13 ),
+{ 35: } ( len: 4; sym: -13 ),
+{ 36: } ( len: 3; sym: -13 ),
+{ 37: } ( len: 2; sym: -13 ),
+{ 38: } ( len: 2; sym: -13 ),
+{ 39: } ( len: 3; sym: -13 ),
+{ 40: } ( len: 2; sym: -13 ),
+{ 41: } ( len: 2; sym: -11 ),
+{ 42: } ( len: 3; sym: -11 ),
+{ 43: } ( len: 2; sym: -11 ),
+{ 44: } ( len: 3; sym: -11 ),
+{ 45: } ( len: 2; sym: -11 ),
+{ 46: } ( len: 2; sym: -11 ),
+{ 47: } ( len: 1; sym: -11 ),
+{ 48: } ( len: 1; sym: -11 ),
+{ 49: } ( len: 2; sym: -17 ),
+{ 50: } ( len: 1; sym: -17 ),
+{ 51: } ( len: 3; sym: -20 ),
+{ 52: } ( len: 1; sym: -10 ),
+{ 53: } ( len: 1; sym: -21 ),
+{ 54: } ( len: 2; sym: -21 ),
+{ 55: } ( len: 1; sym: -21 ),
+{ 56: } ( len: 1; sym: -21 ),
+{ 57: } ( len: 2; sym: -21 ),
+{ 58: } ( len: 3; sym: -21 ),
+{ 59: } ( len: 2; sym: -21 ),
+{ 60: } ( len: 1; sym: -21 ),
+{ 61: } ( len: 2; sym: -21 ),
+{ 62: } ( len: 2; sym: -21 ),
+{ 63: } ( len: 1; sym: -21 ),
+{ 64: } ( len: 1; sym: -21 ),
+{ 65: } ( len: 1; sym: -21 ),
+{ 66: } ( len: 1; sym: -19 ),
+{ 67: } ( len: 1; sym: -19 ),
+{ 68: } ( len: 3; sym: -12 ),
+{ 69: } ( len: 4; sym: -12 ),
+{ 70: } ( len: 2; sym: -12 ),
+{ 71: } ( len: 1; sym: -12 ),
+{ 72: } ( len: 2; sym: -23 ),
+{ 73: } ( len: 2; sym: -23 ),
+{ 74: } ( len: 1; sym: -25 ),
+{ 75: } ( len: 3; sym: -25 ),
+{ 76: } ( len: 1; sym: -25 ),
+{ 77: } ( len: 1; sym: -26 ),
+{ 78: } ( len: 1; sym: -26 ),
+{ 79: } ( len: 1; sym: -26 ),
+{ 80: } ( len: 2; sym: -22 ),
+{ 81: } ( len: 3; sym: -22 ),
+{ 82: } ( len: 2; sym: -22 ),
+{ 83: } ( len: 2; sym: -22 ),
+{ 84: } ( len: 3; sym: -22 ),
+{ 85: } ( len: 3; sym: -22 ),
+{ 86: } ( len: 1; sym: -22 ),
+{ 87: } ( len: 4; sym: -22 ),
+{ 88: } ( len: 2; sym: -22 ),
+{ 89: } ( len: 4; sym: -22 ),
+{ 90: } ( len: 3; sym: -22 ),
+{ 91: } ( len: 2; sym: -29 ),
+{ 92: } ( len: 3; sym: -29 ),
+{ 93: } ( len: 2; sym: -24 ),
+{ 94: } ( len: 3; sym: -24 ),
+{ 95: } ( len: 2; sym: -24 ),
+{ 96: } ( len: 4; sym: -24 ),
+{ 97: } ( len: 2; sym: -24 ),
+{ 98: } ( len: 4; sym: -24 ),
+{ 99: } ( len: 3; sym: -24 ),
+{ 100: } ( len: 0; sym: -24 ),
+{ 101: } ( len: 1; sym: -27 ),
+{ 102: } ( len: 3; sym: -30 ),
+{ 103: } ( len: 3; sym: -30 ),
+{ 104: } ( len: 3; sym: -30 ),
+{ 105: } ( len: 3; sym: -30 ),
+{ 106: } ( len: 3; sym: -30 ),
+{ 107: } ( len: 3; sym: -30 ),
+{ 108: } ( len: 3; sym: -30 ),
+{ 109: } ( len: 3; sym: -30 ),
+{ 110: } ( len: 3; sym: -30 ),
+{ 111: } ( len: 3; sym: -30 ),
+{ 112: } ( len: 3; sym: -30 ),
+{ 113: } ( len: 3; sym: -30 ),
+{ 114: } ( len: 3; sym: -30 ),
+{ 115: } ( len: 3; sym: -30 ),
+{ 116: } ( len: 3; sym: -30 ),
+{ 117: } ( len: 3; sym: -30 ),
+{ 118: } ( len: 1; sym: -30 ),
+{ 119: } ( len: 3; sym: -31 ),
+{ 120: } ( len: 1; sym: -33 ),
+{ 121: } ( len: 0; sym: -33 ),
+{ 122: } ( len: 1; sym: -32 ),
+{ 123: } ( len: 1; sym: -32 ),
+{ 124: } ( len: 1; sym: -32 ),
+{ 125: } ( len: 3; sym: -32 ),
+{ 126: } ( len: 3; sym: -32 ),
+{ 127: } ( len: 2; sym: -32 ),
+{ 128: } ( len: 2; sym: -32 ),
+{ 129: } ( len: 2; sym: -32 ),
+{ 130: } ( len: 4; sym: -32 ),
+{ 131: } ( len: 4; sym: -32 ),
+{ 132: } ( len: 5; sym: -32 ),
+{ 133: } ( len: 6; sym: -32 ),
+{ 134: } ( len: 4; sym: -32 ),
+{ 135: } ( len: 3; sym: -32 ),
+{ 136: } ( len: 3; sym: -14 ),
+{ 137: } ( len: 1; sym: -14 ),
+{ 138: } ( len: 0; sym: -14 ),
+{ 139: } ( len: 3; sym: -35 ),
+{ 140: } ( len: 1; sym: -35 ),
+{ 141: } ( len: 1; sym: -15 ),
+{ 142: } ( len: 3; sym: -34 ),
+{ 143: } ( len: 1; sym: -34 ),
+{ 144: } ( len: 0; sym: -34 ),
+{ 145: } ( len: 1; sym: -36 )
+);
+
+
+const _error = 256; (* error token *)
+
+function yyact(state, sym : Integer; var act : Integer) : Boolean;
+  (* search action table *)
+  var k : Integer;
+  begin
+    k := yyal[state];
+    while (k<=yyah[state]) and (yya[k].sym<>sym) do inc(k);
+    if k>yyah[state] then
+      yyact := false
+    else
+      begin
+        act := yya[k].act;
+        yyact := true;
+      end;
+  end(*yyact*);
+
+function yygoto(state, sym : Integer; var nstate : Integer) : Boolean;
+  (* search goto table *)
+  var k : Integer;
+  begin
+    k := yygl[state];
+    while (k<=yygh[state]) and (yyg[k].sym<>sym) do inc(k);
+    if k>yygh[state] then
+      yygoto := false
+    else
+      begin
+        nstate := yyg[k].act;
+        yygoto := true;
+      end;
+  end(*yygoto*);
+
+label parse, next, error, errlab, shift, reduce, accept, abort;
+
+begin(*yyparse*)
+
+  (* initialize: *)
+
+  yystate := 0; yychar := -1; yynerrs := 0; yyerrflag := 0; yysp := 0;
+
+{$ifdef yydebug}
+  yydebug := true;
+{$else}
+  yydebug := false;
+{$endif}
+
+parse:
+
+  (* push state and value: *)
+
+  inc(yysp);
+  if yysp>yymaxdepth then
+    begin
+      yyerror('yyparse stack overflow');
+      goto abort;
+    end;
+  yys[yysp] := yystate; yyv[yysp] := yyval;
+
+next:
+
+  if (yyd[yystate]=0) and (yychar=-1) then
+    (* get next symbol *)
+    begin
+      yychar := yylex; if yychar<0 then yychar := 0;
+    end;
+
+  if yydebug then writeln('state ', yystate, ', char ', yychar);
+
+  (* determine parse action: *)
+
+  yyn := yyd[yystate];
+  if yyn<>0 then goto reduce; (* simple state *)
+
+  (* no default action; search parse table *)
+
+  if not yyact(yystate, yychar, yyn) then goto error
+  else if yyn>0 then                      goto shift
+  else if yyn<0 then                      goto reduce
+  else                                    goto accept;
+
+error:
+
+  (* error; start error recovery: *)
+
+  if yyerrflag=0 then yyerror('syntax error');
+
+errlab:
+
+  if yyerrflag=0 then inc(yynerrs);     (* new error *)
+
+  if yyerrflag<=2 then                  (* incomplete recovery; try again *)
+    begin
+      yyerrflag := 3;
+      (* uncover a state with shift action on error token *)
+      while (yysp>0) and not ( yyact(yys[yysp], _error, yyn) and
+                               (yyn>0) ) do
+        begin
+          if yydebug then
+            if yysp>1 then
+              writeln('error recovery pops state ', yys[yysp], ', uncovers ',
+                      yys[yysp-1])
+            else
+              writeln('error recovery fails ... abort');
+          dec(yysp);
+        end;
+      if yysp=0 then goto abort; (* parser has fallen from stack; abort *)
+      yystate := yyn;            (* simulate shift on error *)
+      goto parse;
+    end
+  else                                  (* no shift yet; discard symbol *)
+    begin
+      if yydebug then writeln('error recovery discards char ', yychar);
+      if yychar=0 then goto abort; (* end of input; abort *)
+      yychar := -1; goto next;     (* clear lookahead char and try again *)
+    end;
+
+shift:
+
+  (* go to new state, clear lookahead character: *)
+
+  yystate := yyn; yychar := -1; yyval := yylval;
+  if yyerrflag>0 then dec(yyerrflag);
+
+  goto parse;
+
+reduce:
+
+  (* execute action, pop rule from stack, and go to next state: *)
+
+  if yydebug then writeln('reduce ', -yyn);
+
+  yyflag := yyfnone; yyaction(-yyn);
+  dec(yysp, yyr[-yyn].len);
+  if yygoto(yys[yysp], yyr[-yyn].sym, yyn) then yystate := yyn;
+
+  (* handle action calls to yyaccept, yyabort and yyerror: *)
+
+  case yyflag of
+    yyfaccept : goto accept;
+    yyfabort  : goto abort;
+    yyferror  : goto errlab;
+  end;
+
+  goto parse;
+
+accept:
+
+  yyparse := 0; exit;
+
+abort:
+
+  yyparse := 1; exit;
+
+end(*yyparse*);
+
+
+function yylex : Integer;
+ begin
+ yylex:=scan.yylex;
+ end;
+
+var r:integer; SS:string;
+
+begin
+   debug:=true;
+   yydebug:=true;
+   aktspace:='  ';
+   block_type:=bt_no;
+   IsExtern:=false;
+   Assign(extfile,'ext.tmp'); rewrite(extfile);
+   Assign(tempfile,'ext2.tmp'); rewrite(tempfile);
+   r:=yyparse;
+   if not(includefile) then
+     begin
+        writeln(outfile);
+        writeln(outfile,'  implementation');
+        writeln(outfile);
+        writeln(outfile,'const External_library=''',libfilename,'''; {Setup as you need!}');
+        writeln(outfile);
+     end;
+   reset(extfile);
+
+   { here we have a problem if a line is longer than 255 chars !! }
+   while not eof(extfile) do
+    begin
+    readln(extfile,SS);
+    writeln(outfile,SS);
+    end;
+
+   writeln(outfile);
+
+   if not(includefile) then
+     writeln(outfile,'end.');
+
+   close(extfile);
+   erase(extfile);
+   close(outfile);
+   close(tempfile);
+   erase(tempfile);
+   close(textinfile);
+end.
+
+(*
+
+ $Log$
+ Revision 1.1  1999-05-12 16:11:39  peter
+   * moved
+
+ Revision 1.22  1998/11/12 11:38:21  peter
+   + new cdecl support
+   + ... -> array of const
+
+ Revision 1.21  1998/09/10 13:52:42  peter
+   * removed warnings
+
+ Revision 1.20  1998/09/04 17:26:32  pierre
+   * better packed field handling
+
+ Revision 1.18  1998/08/05 15:50:09  florian
+   * small problems with // comments fixed (invalid line counting)
+   + SYS_TRAP support for PalmOS
+   + switch -x for PalmOS
+   + switch -i to generate include files instead of units
+
+ Revision 1.17  1998/07/27 11:03:48  florian
+   * probelm with funtions which resturns a pointer solved
+
+ Revision 1.16  1998/07/24 20:55:43  michael
+ * Fixed some minor bugs in Pierres stuff
+
+ Revision 1.15  1998/07/23 23:26:03  michael
+ + added -D option instead of -d, restored old -d
+
+ Revision 1.14  1998/06/12 16:53:52  pierre
+   + syntax of C var changed again !!
+     this reflect now the current state of the compiler
+   * improvements in & address operator handling
+
+ Revision 1.12  1998/06/08 08:13:44  pierre
+   + merged version of h2pas
+   + added -w for special win32 header directives
+
+   5.1998 : reworked by Pierre Muller
+
+     - added better parsing of defines
+     - handles type casting
+     - error recovery partially implemented
+     - WIN32 specific stuff
+
+     still missing
+     - tags not stored
+     - conditionnals inside typed definitions
+     - complicated defines not supported
+     ( sets .. use of ## ... )
+     - what should we do about
+      const specifier ? can we ignored this
+      FAR modifier ?
+
+ Revision 1.11  1998/04/30 11:22:20  florian
+   + support of direct struct declaration added
+
+ Revision 1.10  1998/04/27 12:06:40  michael
+ + Added GPL statement
+
+ Revision 1.9  1998/04/24 22:34:40  florian
+   + enumerations with assigments implemented
+
+ Revision 1.8  1998/04/24 18:23:46  florian
+   + parameter -v added (replaces pointer parameters by call by reference
+     parameters)
+     void p(int *i) =>   procedure p(var i : longint);
+
+ History:
+   25.9.1996:
+      first version
+
+   26.9.1996:
+      - structs are supported
+      - unsigned implemented
+      - procedure variables implemented
+      - void * becomes pointer
+      - unions implemented
+      - enumerations
+      - number post- and prefixes
+      - operatores unary-, << and >>
+      - problem with the priority of [], (), and * fixed
+      - procedures and functions
+
+   28.9.1996:
+      - formal paramters
+
+   22-26.5.1997  made by Mark Malakanov     [email protected]
+      - full ariphmetic and logic expressions in #define
+
+      - #define with params changes to function (first param
+        disappears by unknown reason!).
+        Adds func body into implementation section.
+
+      - real numbers
+
+      - handling
+       #ifdef ID  to {$ifdef ID}
+       #ifundef ID  to {$ifundef ID}
+       #else to {$else}
+       #define ID to {$define ID}
+       #endif to {$endif}
+
+      -"extern" fully handled . Adds proc/func + 'external _ExternalLibrary;'to
+        implementation section
+       you must assign _ExternalLibrary later.
+
+      -"const" skips in func/proc arguments.
+
+      changes in convert.y and scan.l
+      - "convert" renamed to "h2pas"
+      - Inserted the checking "IsAssigned(Pointer)" everywhere access to pointers
+       It preserv from Acces Violation Errors.
+      - A little remade for TP Lex and Yacc 4.01 -
+           changed function "input" to "get_char"
+      -!!! because of peculiarity TPLY4.01 you must create unit CONVERU.PAS by
+       your hand! Cut const definitions from CONVERT.PAS and paste into CONVERU.PAS
+
+ What need
+   * handle struct a {  }; in the right way
+   * all predefined C types
+   * misplaced comments
+   * handle functions without result
+*)

+ 2155 - 0
utils/h2pas/h2pas.y

@@ -0,0 +1,2155 @@
+%{
+program h2pas;
+
+(*
+    $Id$
+    Copyright (c) 1993-98 by Florian Klaempfl
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************)
+
+
+
+  uses
+   {$ifdef go32v2}
+   {$ifndef NOEXCP}
+   dpmiexcp,
+   {$endif NOEXCP}
+   {$endif}
+   {$IFDEF WIN32}
+   SysUtils,
+   {$else}
+   strings,
+   {$endif}
+   options,scan,converu,lexlib,yacclib;
+
+  type
+     YYSTYPE = presobject;
+
+  const
+     INT_STR = 'longint';
+     UINT_STR = 'cardinal';
+     SHORT_STR = 'integer';
+     USHORT_STR = 'word';
+     CHAR_STR = 'char';
+     { should we use byte or char for 'unsigned char' ?? }
+     UCHAR_STR = 'byte';
+     REAL_STR = 'real';
+
+  var
+     debug : boolean;
+     hp,ph : presobject;
+     extfile: text;  (* file for implementation headers extern procs *)
+     IsExtern:boolean;
+     must_write_packed_field : boolean;
+     tempfile : text;
+     No_pop:boolean;
+     s,TN,PN : String;
+
+(* $ define yydebug
+ compile with -dYYDEBUG to get debugging info *)
+
+  const
+     (* number of a?b:c construction in one define *)
+     if_nb : longint = 0;
+     is_packed : boolean = false;
+     is_procvar : boolean = false;
+
+  var space_array : array [0..255] of byte;
+      space_index : byte;
+
+        procedure shift(space_number : byte);
+          var
+             i : byte;
+          begin
+             space_array[space_index]:=space_number;
+             inc(space_index);
+             for i:=1 to space_number do
+               aktspace:=aktspace+' ';
+          end;
+
+        procedure popshift;
+          begin
+             dec(space_index);
+             if space_index<0 then
+               internalerror(20);
+             dec(byte(aktspace[0]),space_array[space_index]);
+          end;
+
+    function str(i : longint) : string;
+      var
+         s : string;
+      begin
+         system.str(i,s);
+         str:=s;
+      end;
+
+    function hexstr(i : cardinal) : string;
+
+    const
+      HexTbl : array[0..15] of char='0123456789ABCDEF';
+    var
+      str : string;
+    begin
+      str:='';
+      while i<>0 do
+        begin
+           str:=hextbl[i and $F]+str;
+           i:=i shr 4;
+        end;
+      if str='' then str:='0';
+      hexstr:='$'+str;
+    end;
+
+    function uppercase(s : string) : string;
+      var
+         i : byte;
+      begin
+         for i:=1 to length(s) do
+           s[i]:=UpCase(s[i]);
+         uppercase:=s;
+      end;
+
+    procedure write_type_specifier(var outfile:text; p : presobject);forward;
+    procedure write_p_a_def(var outfile:text; p,simple_type : presobject);forward;
+    procedure write_ifexpr(var outfile:text; p : presobject);forward;
+    procedure write_funexpr(var outfile:text; p : presobject);forward;
+
+    procedure yymsg(const msg : string);
+      begin
+         writeln('line ',line_no,': ',msg);
+      end;
+
+    procedure write_packed_fields_info(var outfile:text; p : presobject; ph : string);
+
+      var
+         hp1,hp2,hp3 : presobject;
+         is_sized : boolean;
+         line : string;
+         flag_index : longint;
+         name : pchar;
+         ps : byte;
+
+      begin
+         { write out the tempfile created }
+         close(tempfile);
+         reset(tempfile);
+         is_sized:=false;
+         flag_index:=0;
+         writeln(outfile,aktspace,'const');
+         shift(3);
+         while not eof(tempfile) do
+           begin
+              readln(tempfile,line);
+              ps:=pos('&',line);
+              if ps>0 then
+                line:=copy(line,1,ps-1)+ph+'_'+copy(line,ps+1,255);
+              writeln(outfile,aktspace,line);
+           end;
+         close(tempfile);
+         rewrite(tempfile);
+         popshift;
+         (* walk through all members *)
+         hp1 := p^.p1;
+         while assigned(hp1) do
+           begin
+              (* hp2 is t_memberdec *)
+              hp2:=hp1^.p1;
+              (*  hp3 is t_declist *)
+              hp3:=hp2^.p2;
+              while assigned(hp3) do
+                begin
+                   if assigned(hp3^.p1^.p3) and
+                      (hp3^.p1^.p3^.typ = t_size_specifier) then
+                     begin
+                        is_sized:=true;
+                        name:=hp3^.p1^.p2^.p;
+                        { get function in interface }
+                        write(outfile,aktspace,'function ',name);
+                        write(outfile,'(var a : ',ph,') : ');
+                        shift(2);
+                        write_p_a_def(outfile,hp3^.p1^.p1,hp2^.p1);
+                        writeln(outfile,';');
+                        popshift;
+                        { get function in implementation }
+                        write(extfile,aktspace,'function ',name);
+                        write(extfile,'(var a : ',ph,') : ');
+                        shift(2);
+                        write_p_a_def(extfile,hp3^.p1^.p1,hp2^.p1);
+                        writeln(extfile,';');
+                        writeln(extfile,aktspace,'begin');
+                        shift(3);
+                        write(extfile,aktspace,name,':=(a.flag',flag_index);
+                        writeln(extfile,' and bm_',ph,'_',name,') shr bp_',ph,'_',name,';');
+                        popshift;
+                        writeln(extfile,aktspace,'end;');
+                        popshift;
+                        writeln(extfile);
+                        { set function in interface }
+                        write(outfile,aktspace,'procedure set_',name);
+                        write(outfile,'(var a : ',ph,'; __',name,' : ');
+                        shift(2);
+                        write_p_a_def(outfile,hp3^.p1^.p1,hp2^.p1);
+                        writeln(outfile,');');
+                        popshift;
+                        { set function in implementation }
+                        write(extfile,aktspace,'procedure set_',name);
+                        write(extfile,'(var a : ',ph,'; __',name,' : ');
+                        shift(2);
+                        write_p_a_def(extfile,hp3^.p1^.p1,hp2^.p1);
+                        writeln(extfile,');');
+                        writeln(extfile,aktspace,'begin');
+                        shift(3);
+                        write(extfile,aktspace,'a.flag',flag_index,':=');
+                        write(extfile,'a.flag',flag_index,' or ');
+                        writeln(extfile,'((__',name,' shl bp_',ph,'_',name,') and bm_',ph,'_',name,');');
+                        popshift;
+                        writeln(extfile,aktspace,'end;');
+                        popshift;
+                        writeln(extfile);
+                     end
+                   else if is_sized then
+                     begin
+                        is_sized:=false;
+                        inc(flag_index);
+                     end;
+                   hp3:=hp3^.next;
+                end;
+              hp1:=hp1^.next;
+           end;
+         must_write_packed_field:=false;
+         block_type:=bt_no;
+      end;
+
+    procedure write_expr(var outfile:text; p : presobject);
+      begin
+      if assigned(p) then
+        begin
+         case p^.typ of
+            t_id,t_ifexpr : write(outfile,p^.p);
+            t_funexprlist : write_funexpr(outfile,p);
+            t_preop : begin
+                         write(outfile,p^.p,'(');
+                         write_expr(outfile,p^.p1);
+                         write(outfile,')');
+                         flush(outfile);
+                      end;
+            t_typespec : begin
+                         write_type_specifier(outfile,p^.p1);
+                         write(outfile,'(');
+                         write_expr(outfile,p^.p2);
+                         write(outfile,')');
+                         flush(outfile);
+                      end;
+            t_bop : begin
+                       if p^.p1^.typ<>t_id then
+                         write(outfile,'(');
+                       write_expr(outfile,p^.p1);
+                       if p^.p1^.typ<>t_id then
+                       write(outfile,')');
+                       write(outfile,p^.p);
+                       if p^.p2^.typ<>t_id then
+                         write(outfile,'(');
+                       write_expr(outfile,p^.p2);
+                       if p^.p2^.typ<>t_id then
+                         write(outfile,')');
+                    flush(outfile);
+                    end;
+            else internalerror(2);
+            end;
+         end;
+      end;
+
+    procedure write_ifexpr(var outfile:text; p : presobject);
+      begin
+         flush(outfile);
+         write(outfile,'if ');
+         write_expr(outfile,p^.p1);
+         writeln(outfile,' then');
+         write(outfile,aktspace,'  ');
+         write(outfile,p^.p);
+         write(outfile,':=');
+         write_expr(outfile,p^.p2);
+         writeln(outfile);
+         writeln(outfile,aktspace,'else');
+         write(outfile,aktspace,'  ');
+         write(outfile,p^.p);
+         write(outfile,':=');
+         write_expr(outfile,p^.p3);
+         writeln(outfile,';');
+         write(outfile,aktspace);
+         flush(outfile);
+      end;
+
+    procedure write_all_ifexpr(var outfile:text; p : presobject);
+      begin
+      if assigned(p) then
+        begin
+           case p^.typ of
+             t_id :;
+             t_preop :
+               write_all_ifexpr(outfile,p^.p1);
+             t_bop :
+               begin
+                  write_all_ifexpr(outfile,p^.p1);
+                  write_all_ifexpr(outfile,p^.p2);
+               end;
+             t_ifexpr :
+               begin
+                  write_all_ifexpr(outfile,p^.p1);
+                  write_all_ifexpr(outfile,p^.p2);
+                  write_all_ifexpr(outfile,p^.p3);
+                  write_ifexpr(outfile,p);
+               end;
+             t_typespec :
+                  write_all_ifexpr(outfile,p^.p2);
+             t_funexprlist,
+             t_exprlist :
+               begin
+                 if assigned(p^.p1) then
+                   write_all_ifexpr(outfile,p^.p1);
+                 if assigned(p^.next) then
+                   write_all_ifexpr(outfile,p^.next);
+               end
+             else
+               internalerror(6);
+           end;
+        end;
+      end;
+
+    procedure write_funexpr(var outfile:text; p : presobject);
+      var
+         i : longint;
+
+      begin
+      if assigned(p) then
+        begin
+           case p^.typ of
+             t_ifexpr :
+               write(outfile,p^.p);
+             t_exprlist :
+               begin
+                  write_expr(outfile,p^.p1);
+                  if assigned(p^.next) then
+                    begin
+                      write(outfile,',');
+                      write_funexpr(outfile,p^.next);
+                    end
+               end;
+             t_funcname :
+               begin
+                  shift(2);
+                  if if_nb>0 then
+                    begin
+                       writeln(outfile,aktspace,'var');
+                       write(outfile,aktspace,'   ');
+                       for i:=1 to if_nb do
+                         begin
+                            write(outfile,'if_local',i);
+                            if i<if_nb then
+                              write(outfile,', ')
+                            else
+                              writeln(outfile,' : longint;');
+                         end;
+                       writeln(outfile,aktspace,'(* result types are not known *)');
+                       if_nb:=0;
+                    end;
+                  writeln(outfile,aktspace,'begin');
+                  shift(3);
+                  write(outfile,aktspace);
+                  write_all_ifexpr(outfile,p^.p2);
+                  write_expr(outfile,p^.p1);
+                  write(outfile,':=');
+                  write_funexpr(outfile,p^.p2);
+                  writeln(outfile,';');
+                  popshift;
+                  writeln(outfile,aktspace,'end;');
+                  popshift;
+                  flush(outfile);
+               end;
+             t_funexprlist :
+               begin
+                  if assigned(p^.p3) then
+                    begin
+                       write_type_specifier(outfile,p^.p3);
+                       write(outfile,'(');
+                    end;
+                  if assigned(p^.p1) then
+                    write_funexpr(outfile,p^.p1);
+                  if assigned(p^.p2) then
+                    begin
+                      write(outfile,'(');
+                      write_funexpr(outfile,p^.p2);
+                      write(outfile,')');
+                    end;
+                  if assigned(p^.p3) then
+                    write(outfile,')');
+               end
+             else internalerror(5);
+           end;
+        end;
+      end;
+
+     function ellipsisarg : presobject;
+       begin
+          ellipsisarg:=new(presobject,init_two(t_arg,nil,nil));
+       end;
+
+    const
+       (* if in args *dname is replaced by pdname *)
+       in_args : boolean = false;
+       typedef_level : longint = 0;
+
+    (* writes an argument list, where p is t_arglist *)
+
+    procedure write_args(var outfile:text; p : presobject);
+      var
+         length,para : longint;
+         old_in_args : boolean;
+         varpara : boolean;
+
+      begin
+         para:=1;
+         length:=0;
+         old_in_args:=in_args;
+         in_args:=true;
+         write(outfile,'(');
+         shift(2);
+
+         (* walk through all arguments *)
+         (* p must be of type t_arglist *)
+         while assigned(p) do
+           begin
+              if p^.typ<>t_arglist then
+                internalerror(10);
+              (* is ellipsis ? *)
+              if not assigned(p^.p1^.p1) and
+                 not assigned(p^.p1^.next) then
+                begin
+                   { write(outfile,'...'); }
+                   write(outfile,'args:array of const');
+                   { if variable number of args we must allways pop }
+                   no_pop:=false;
+                end
+              (* we need to correct this in the pp file after *)
+              else
+                begin
+                   (* generate a call by reference parameter ?       *)
+                   varpara:=usevarparas and assigned(p^.p1^.p2^.p1) and
+                     ((p^.p1^.p2^.p1^.typ=t_pointerdef) or
+                     (p^.p1^.p2^.p1^.typ=t_addrdef));
+                   (* do not do it for char pointer !!               *)
+                   (* para : pchar; and var para : char; are         *)
+                   (* completely different in pascal                 *)
+                   (* here we exclude all typename containing char   *)
+                   (* is this a good method ??                       *)
+
+
+                   if varpara and
+                      (p^.p1^.p2^.p1^.typ=t_pointerdef) and
+                      (p^.p1^.p2^.p1^.p1^.typ=t_id) and
+                     (pos('CHAR',uppercase(p^.p1^.p2^.p1^.p1^.str))<>0) then
+                     varpara:=false;
+                   if varpara then
+                     begin
+                        write(outfile,'var ');
+                        length:=length+4;
+                     end;
+
+                   (* write new type name *)
+                   if assigned(p^.p1^.p2^.p2) then
+                     begin
+                        write(outfile,p^.p1^.p2^.p2^.p);
+                        length:=length+p^.p1^.p2^.p2^.strlength;
+                     end
+                   else
+                     begin
+                        write(outfile,'_para',para);
+                        { not exact but unimportant }
+                        length:=length+6;
+                     end;
+                   write(outfile,':');
+                   if varpara then
+                     write_p_a_def(outfile,p^.p1^.p2^.p1^.p1,p^.p1^.p1)
+                   else
+                     write_p_a_def(outfile,p^.p1^.p2^.p1,p^.p1^.p1);
+
+                end;
+              p:=p^.next;
+              if assigned(p) then
+                begin
+                   write(outfile,'; ');
+                   { if length>40 then : too complicated to compute }
+                   if (para mod 5) = 0 then
+                     begin
+                        writeln(outfile);
+                        write(outfile,aktspace);
+                     end;
+                end;
+              inc(para);
+           end;
+         write(outfile,')');
+         flush(outfile);
+         in_args:=old_in_args;
+         popshift;
+      end;
+
+    procedure write_p_a_def(var outfile:text; p,simple_type : presobject);
+      var
+         i : longint;
+         error : integer;
+         constant : boolean;
+
+      begin
+         if not(assigned(p)) then
+           begin
+              write_type_specifier(outfile,simple_type);
+              exit;
+           end;
+         case p^.typ of
+            t_pointerdef : begin
+                              (* procedure variable ? *)
+                              if assigned(p^.p1) and (p^.p1^.typ=t_procdef) then
+                                begin
+                                   is_procvar:=true;
+                                   (* distinguish between procedure and function *)
+                                   if (simple_type^.typ=t_void) and (p^.p1^.p1=nil) then
+                                     begin
+                                        write(outfile,'procedure ');
+
+                                        shift(10);
+                                        (* write arguments *)
+                                        if assigned(p^.p1^.p2) then
+                                          write_args(outfile,p^.p1^.p2);
+                                        flush(outfile);
+                                        popshift;
+                                     end
+                                   else
+                                     begin
+                                        write(outfile,'function ');
+                                        shift(9);
+                                        (* write arguments *)
+                                        if assigned(p^.p1^.p2) then
+                                          write_args(outfile,p^.p1^.p2);
+                                        write(outfile,':');
+                                        flush(outfile);
+                                        write_p_a_def(outfile,p^.p1^.p1,simple_type);
+                                        popshift;
+                                     end
+                                end
+                              else
+                                begin
+                                   (* generate "pointer" ? *)
+                                   if (simple_type^.typ=t_void) and (p^.p1=nil) then
+                                      begin
+                                       write(outfile,'pointer');
+                                       flush(outfile);
+                                      end
+                                   else
+                                     begin
+                                        if in_args then
+                                          write(outfile,'p')
+                                        else
+                                          write(outfile,'^');
+                                        flush(outfile);
+                                        write_p_a_def(outfile,p^.p1,simple_type);
+                                     end;
+                                end;
+                           end;
+            t_arraydef : begin
+                             constant:=false;
+                             if p^.p2^.typ=t_id then
+                               begin
+                                  val(p^.p2^.str,i,error);
+                                  if error=0 then
+                                    begin
+                                       dec(i);
+                                       constant:=true;
+                                    end;
+                               end;
+                             if not constant then
+                               begin
+                                  write(outfile,'array[0..(');
+                                  write_expr(outfile,p^.p2);
+                                  write(outfile,')-1] of ');
+                               end
+                             else
+                               begin
+                                  write(outfile,'array[0..',i,'] of ');
+                               end;
+                             flush(outfile);
+                             write_p_a_def(outfile,p^.p1,simple_type);
+                          end;
+            else internalerror(1);
+         end;
+      end;
+
+    procedure write_type_specifier(var outfile:text; p : presobject);
+      var
+         hp1,hp2,hp3,lastexpr : presobject;
+         i,l,w : longint;
+         error : integer;
+         mask : cardinal;
+         flag_index,current_power : longint;
+         current_level : byte;
+         is_sized : boolean;
+
+      begin
+         case p^.typ of
+            t_id :
+              write(outfile,p^.p);
+            { what can we do with void defs  ? }
+            t_void :
+              write(outfile,'void');
+            t_pointerdef :
+              begin
+                 write(outfile,'p');
+                 write_type_specifier(outfile,p^.p1);
+              end;
+            t_enumdef :
+              begin
+                 if (typedef_level>1) and (p^.p1=nil) and
+                    (p^.p2^.typ=t_id) then
+                   begin
+                      write(outfile,p^.p2^.p);
+                   end
+                 else
+                 if not EnumToConst then
+                   begin
+                      write(outfile,'(');
+                      hp1:=p^.p1;
+                      w:=length(aktspace);
+                      while assigned(hp1) do
+                        begin
+                           write(outfile,hp1^.p1^.p);
+                           if assigned(hp1^.p2) then
+                             begin
+                                write(outfile,' := ');
+                                write_expr(outfile,hp1^.p2);
+                                w:=w+6;(* strlen(hp1^.p); *)
+                             end;
+                           w:=w+length(hp1^.p1^.str);
+                           hp1:=hp1^.next;
+                           if assigned(hp1) then
+                             write(outfile,',');
+                           if w>40 then
+                             begin
+                                 writeln(outfile);
+                                 write(outfile,aktspace);
+                                 w:=length(aktspace);
+                             end;
+                           flush(outfile);
+                        end;
+                      write(outfile,')');
+                      flush(outfile);
+                   end
+                 else
+                   begin
+                      Writeln (outfile,' Longint;');
+                      hp1:=p^.p1;
+                      l:=0;
+                      lastexpr:=nil;
+                      Writeln (outfile,aktspace,'Const');
+                      while assigned(hp1) do
+                        begin
+                           write (outfile,aktspace,hp1^.p1^.p,' = ');
+                           if assigned(hp1^.p2) then
+                             begin
+                                write_expr(outfile,hp1^.p2);
+                                writeln(outfile,';');
+                                lastexpr:=hp1^.p2;
+                                if lastexpr^.typ=t_id then
+                                  begin
+                                     val(lastexpr^.str,l,error);
+                                     if error=0 then
+                                       begin
+                                          inc(l);
+                                          lastexpr:=nil;
+                                       end
+                                     else
+                                       l:=1;
+                                  end
+                                else
+                                  l:=1;
+                             end
+                           else
+                             begin
+                                if assigned(lastexpr) then
+                                  begin
+                                     write(outfile,'(');
+                                     write_expr(outfile,lastexpr);
+                                     writeln(outfile,')+',l,';');
+                                  end
+                                else
+                                  writeln (outfile,l,';');
+                                inc(l);
+                             end;
+                           hp1:=hp1^.next;
+                           flush(outfile);
+                        end;
+                      block_type:=bt_const;
+                  end;
+               end;
+            t_structdef :
+              begin
+                 inc(typedef_level);
+                 flag_index:=-1;
+                 is_sized:=false;
+                 current_level:=0;
+                 if (typedef_level>1) and (p^.p1=nil) and
+                    (p^.p2^.typ=t_id) then
+                   begin
+                      write(outfile,p^.p2^.p);
+                   end
+                 else
+                   begin
+                      writeln(outfile,'record');
+                      shift(3);
+                      hp1:=p^.p1;
+
+                      (* walk through all members *)
+                      while assigned(hp1) do
+                        begin
+                           (* hp2 is t_memberdec *)
+                           hp2:=hp1^.p1;
+                           (*  hp3 is t_declist *)
+                           hp3:=hp2^.p2;
+                           while assigned(hp3) do
+                             begin
+                                if not assigned(hp3^.p1^.p3) or
+                                   (hp3^.p1^.p3^.typ <> t_size_specifier) then
+                                  begin
+                                     if is_sized then
+                                       begin
+                                          if current_level <= 16 then
+                                            writeln(outfile,'word;')
+                                          else if current_level <= 32 then
+                                            writeln(outfile,'longint;')
+                                          else
+                                            internalerror(11);
+                                          is_sized:=false;
+                                       end;
+
+                                     write(outfile,aktspace,hp3^.p1^.p2^.p);
+                                     write(outfile,' : ');
+                                     shift(2);
+                                     write_p_a_def(outfile,hp3^.p1^.p1,hp2^.p1);
+                                     popshift;
+                                  end;
+                                { size specifier  or default value ? }
+                                if assigned(hp3^.p1^.p3) then
+                                  begin
+                                     { we could use mask to implement this }
+                                     { because we need to respect the positions }
+                                     if hp3^.p1^.p3^.typ = t_size_specifier then
+                                       begin
+                                          if not is_sized then
+                                            begin
+                                               current_power:=1;
+                                               current_level:=0;
+                                               inc(flag_index);
+                                               write(outfile,aktspace,'flag',flag_index,' : ');
+                                            end;
+                                          must_write_packed_field:=true;
+                                          is_sized:=true;
+                                          { can it be something else than a constant ? }
+                                          { it can be a macro !! }
+                                          if hp3^.p1^.p3^.p1^.typ=t_id then
+                                            begin
+                                              val(hp3^.p1^.p3^.p1^.str,l,error);
+                                              if error=0 then
+                                                begin
+                                                   mask:=0;
+                                                   for i:=1 to l do
+                                                     begin
+                                                        mask:=mask+current_power;
+                                                        current_power:=current_power*2;
+                                                     end;
+                                                   write(tempfile,'bm_&',hp3^.p1^.p2^.p);
+                                                   writeln(tempfile,' = ',hexstr(mask),';');
+                                                   write(tempfile,'bp_&',hp3^.p1^.p2^.p);
+                                                   writeln(tempfile,' = ',current_level,';');
+                                                   current_level:=current_level + l;
+                                                   { go to next flag if 31 }
+                                                   if current_level = 32 then
+                                                     begin
+                                                        write(outfile,'longint');
+                                                        is_sized:=false;
+                                                     end;
+                                                end;
+                                            end;
+
+                                       end
+                                     else if hp3^.p1^.p3^.typ = t_default_value then
+                                       begin
+                                          write(outfile,'{=');
+                                          write_expr(outfile,hp3^.p1^.p3^.p1);
+                                          write(outfile,' ignored}');
+                                       end;
+                                  end;
+                                if not is_sized then
+                                  begin
+                                     if is_procvar then
+                                       begin
+                                          if not no_pop then
+                                            begin
+                                               write(outfile,';cdecl');
+                                               no_pop:=true;
+                                            end;
+                                          is_procvar:=false;
+                                       end;
+                                     writeln(outfile,';');
+                                  end;
+                                hp3:=hp3^.next;
+                             end;
+                           hp1:=hp1^.next;
+                        end;
+                      if is_sized then
+                        begin
+                           if current_level <= 16 then
+                             writeln(outfile,'word;')
+                           else if current_level <= 32 then
+                             writeln(outfile,'longint;')
+                           else
+                             internalerror(11);
+                           is_sized:=false;
+                        end;
+                      popshift;
+                      write(outfile,aktspace,'end');
+                      flush(outfile);
+                   end;
+                 dec(typedef_level);
+              end;
+            t_uniondef :
+              begin
+                 if (typedef_level>1) and (p^.p1=nil) and
+                    (p^.p2^.typ=t_id) then
+                   begin
+                      write(outfile,p^.p2^.p);
+                   end
+                 else
+                   begin
+                      inc(typedef_level);
+                      writeln(outfile,'record');
+                      shift(2);
+                      writeln(outfile,aktspace,'case longint of');
+                      shift(3);
+                      l:=0;
+                      hp1:=p^.p1;
+
+                      (* walk through all members *)
+                      while assigned(hp1) do
+                        begin
+                           (* hp2 is t_memberdec *)
+                           hp2:=hp1^.p1;
+                           (* hp3 is t_declist *)
+                           hp3:=hp2^.p2;
+                           while assigned(hp3) do
+                             begin
+                                write(outfile,aktspace,l,' : ( ');
+                                write(outfile,hp3^.p1^.p2^.p,' : ');
+                                shift(2);
+                                write_p_a_def(outfile,hp3^.p1^.p1,hp2^.p1);
+                                popshift;
+                                writeln(outfile,' );');
+                                hp3:=hp3^.next;
+                                inc(l);
+                             end;
+                           hp1:=hp1^.next;
+                        end;
+                      popshift;
+                      write(outfile,aktspace,'end');
+                      popshift;
+                      flush(outfile);
+                      dec(typedef_level);
+                   end;
+              end;
+            else
+              internalerror(3);
+         end;
+      end;
+
+    procedure write_def_params(var outfile:text; p : presobject);
+      var
+         hp1 : presobject;
+      begin
+         case p^.typ of
+            t_enumdef : begin
+                           hp1:=p^.p1;
+                           while assigned(hp1) do
+                             begin
+                                write(outfile,hp1^.p1^.p);
+                                hp1:=hp1^.next;
+                                if assigned(hp1) then
+                                  write(outfile,',')
+                                else
+                                  write(outfile);
+                                flush(outfile);
+                             end;
+                           flush(outfile);
+                        end;
+         else internalerror(4);
+         end;
+      end;
+
+%}
+
+%token TYPEDEF DEFINE
+%token COLON SEMICOLON COMMA
+%token LKLAMMER RKLAMMER LECKKLAMMER RECKKLAMMER
+%token LGKLAMMER RGKLAMMER
+%token STRUCT UNION ENUM
+%token ID NUMBER CSTRING
+%token SHORT UNSIGNED LONG INT REAL _CHAR
+%token VOID _CONST
+%token _FAR _HUGE _NEAR
+%token _ASSIGN NEW_LINE SPACE_DEFINE
+%token EXTERN STDCALL CDECL CALLBACK PASCAL WINAPI APIENTRY WINGDIAPI SYS_TRAP
+%token _PACKED
+%token ELLIPSIS
+%right R_AND
+%left EQUAL UNEQUAL GT LT GTE LTE
+%left QUESTIONMARK COLON
+%left _OR
+%left _AND
+%left _PLUS MINUS
+%left _SHR _SHL
+%left STAR _SLASH
+%right _NOT
+%right LKLAMMER
+%right PSTAR
+%right P_AND
+%right LECKKLAMMER
+%left POINT DEREF
+%left COMMA
+%left STICK
+%%
+
+file : declaration_list
+     ;
+
+error_info : { writeln(outfile,'(* error ');
+               writeln(outfile,prev_line);
+               writeln(outfile,last_source_line);
+             };
+
+declaration_list : declaration_list  declaration
+     {  if yydebug then writeln('declaration reduced at line ',line_no);
+        if yydebug then writeln(outfile,'(* declaration reduced *)');
+     }
+     | declaration_list define_dec
+     {  if yydebug then writeln('define declaration reduced at line ',line_no);
+        if yydebug then writeln(outfile,'(* define declaration reduced *)');
+     }
+     | declaration
+     {  if yydebug then writeln('declaration reduced at line ',line_no);
+     }
+     | define_dec
+     {  if yydebug then writeln('define declaration reduced at line ',line_no);
+     }
+     ;
+
+dec_specifier :
+     EXTERN { $$:=new(presobject,init_id('extern')); }
+     |{ $$:=new(presobject,init_id('intern')); }
+     ;
+
+dec_modifier :
+     STDCALL { $$:=new(presobject,init_id('no_pop')); }
+     | CDECL { $$:=new(presobject,init_id('cdecl')); }
+     | CALLBACK { $$:=new(presobject,init_id('no_pop')); }
+     | PASCAL { $$:=new(presobject,init_id('no_pop')); }
+     | WINAPI { $$:=new(presobject,init_id('no_pop')); }
+     | APIENTRY { $$:=new(presobject,init_id('no_pop')); }
+     | WINGDIAPI { $$:=new(presobject,init_id('no_pop')); }
+     | { $$:=nil }
+     ;
+
+systrap_specifier:
+     SYS_TRAP LKLAMMER dname RKLAMMER { $$:=$3; }
+     | { $$:=nil; }
+     ;
+
+declaration :
+     dec_specifier type_specifier dec_modifier declarator_list systrap_specifier SEMICOLON
+     { IsExtern:=false;
+       (* by default we must pop the args pushed on stack *)
+       no_pop:=false;
+    (* writeln(outfile,'{ dec_specifier type_specifier declarator_list SEMICOLON}');
+
+     if assigned($3) then writeln(outfile,'{*$3}');
+     if assigned($3)and assigned($3.p1)
+         then writeln(outfile,'{*$3^.p1}');
+     if assigned($3)and assigned($3^.p1)and assigned($3^.p1^.p1)
+         then writeln(outfile,'{*$3^.p1^.p1}');
+    *)
+
+      if (assigned($4)and assigned($4^.p1)and assigned($4^.p1^.p1))
+        and ($4^.p1^.p1^.typ=t_procdef) then
+         begin
+            If UseLib then
+              IsExtern:=true
+            else
+              IsExtern:=assigned($1)and($1^.str='extern');
+            no_pop:=assigned($3) and ($3^.str='no_pop');
+            if block_type<>bt_func then
+              writeln(outfile);
+
+            block_type:=bt_func;
+            write(outfile,aktspace);
+            write(extfile,aktspace);
+            (* distinguish between procedure and function *)
+            if assigned($2) then
+            if ($2^.typ=t_void) and ($4^.p1^.p1^.p1=nil) then
+              begin
+               write(outfile,'procedure ',$4^.p1^.p2^.p);
+                 (* write arguments *)
+               shift(10);
+               if assigned($4^.p1^.p1^.p2) then
+                   write_args(outfile,$4^.p1^.p1^.p2);
+               write(extfile,'procedure ',$4^.p1^.p2^.p);
+               (* write arguments *)
+               if assigned($4^.p1^.p1^.p2) then
+                 write_args(extfile,$4^.p1^.p1^.p2);
+              end
+            else
+              begin
+                 write(outfile,'function ',$4^.p1^.p2^.p);
+                 write(extfile,'function ',$4^.p1^.p2^.p);
+
+                 shift(9);
+                 (* write arguments *)
+                 if assigned($4^.p1^.p1^.p2) then
+                   write_args(outfile,$4^.p1^.p1^.p2);
+                 if assigned($4^.p1^.p1^.p2) then
+                   write_args(extfile,$4^.p1^.p1^.p2);
+
+                 write(outfile,':');
+                 write(extfile,':');
+                 write_p_a_def(outfile,$4^.p1^.p1^.p1,$2);
+                 write_p_a_def(extfile,$4^.p1^.p1^.p1,$2);
+              end;
+
+            if assigned($5) then
+              write(outfile,';systrap ',$5^.p);
+
+            (* No CDECL in interface for Uselib *)
+            if IsExtern and (not no_pop) then
+             begin
+               write(outfile,';cdecl');
+               write(extfile,';cdecl');
+             end;
+            popshift;
+            if UseLib then
+              begin
+                if IsExtern then
+                  begin
+                    write (extfile,';external');
+                    If UseName then
+                     Write(extfile,' External_library name ''',$4^.p1^.p2^.p,'''');
+                  end;
+                writeln(extfile,';');
+                writeln(outfile,';');
+              end
+            else
+              begin
+                writeln(extfile,';');
+                writeln(outfile,';');
+                if not IsExtern then
+                 begin
+                   writeln(extfile,aktspace,'  begin');
+                   writeln(extfile,aktspace,'     { You must implemented this function }');
+                   writeln(extfile,aktspace,'  end;');
+                 end;
+              end;
+            IsExtern:=false;
+            writeln(outfile);
+            if Uselib then
+              writeln(extfile);
+         end
+       else (* $4^.p1^.p1^.typ=t_procdef *)
+       if assigned($4)and assigned($4^.p1) then
+         begin
+            shift(2);
+            if block_type<>bt_var then
+              begin
+                 writeln(outfile);
+                 writeln(outfile,aktspace,'var');
+              end;
+            block_type:=bt_var;
+
+            shift(3);
+
+            IsExtern:=assigned($1)and($1^.str='extern');
+            (* walk through all declarations *)
+            hp:=$4;
+            while assigned(hp) and assigned(hp^.p1) do
+              begin
+                 (* write new var name *)
+                 if assigned(hp^.p1^.p2)and assigned(hp^.p1^.p2^.p)then
+                   write(outfile,aktspace,hp^.p1^.p2^.p);
+                 write(outfile,' : ');
+                 shift(2);
+                 (* write its type *)
+                 write_p_a_def(outfile,hp^.p1^.p1,$2);
+                 if assigned(hp^.p1^.p2)and assigned(hp^.p1^.p2^.p)then
+                   begin
+                      if isExtern then
+                        write(outfile,';cvar;external')
+                      else
+                        write(outfile,';cvar;export');
+                      write(outfile,hp^.p1^.p2^.p);
+                   end;
+                 writeln(outfile,''';');
+                 popshift;
+                 hp:=hp^.p2;
+              end;
+            popshift;
+            popshift;
+         end;
+       if assigned($1)then  dispose($1,done);
+       if assigned($2)then  dispose($2,done);
+       if assigned($4)then  dispose($4,done);
+     } |
+     special_type_specifier SEMICOLON
+     {
+       if block_type<>bt_type then
+         begin
+            writeln(outfile);
+            writeln(outfile,aktspace,'type');
+         end;
+       block_type:=bt_type;
+       shift(3);
+       (* write new type name *)
+       TN:=strpas($1^.p2^.p);
+       if ($1^.typ=t_structdef) or ($1^.typ=t_uniondef) then
+         begin
+            PN:='P'+strpas($1^.p2^.p);
+            if PrependTypes then
+              TN:='T'+TN;
+            if UsePPointers then
+              Writeln (outfile,aktspace,PN,' = ^',TN,';');
+         end;
+       write(outfile,aktspace,TN,' = ');
+       shift(2);
+       hp:=$1;
+       write_type_specifier(outfile,hp);
+       popshift;
+       (* enum_to_const can make a switch to const *)
+       if block_type=bt_type then writeln(outfile,';');
+       writeln(outfile);
+       flush(outfile);
+       popshift;
+       if must_write_packed_field then
+         write_packed_fields_info(outfile,hp,TN);
+       if assigned(hp) then
+         dispose(hp,done);
+     } |
+     TYPEDEF type_specifier dec_modifier declarator_list SEMICOLON
+     {
+       if block_type<>bt_type then
+         begin
+            writeln(outfile);
+            writeln(outfile,aktspace,'type');
+         end;
+       block_type:=bt_type;
+
+       no_pop:=assigned($3) and ($3^.str='no_pop');
+       shift(3);
+       (* walk through all declarations *)
+       hp:=$4;
+       ph:=nil;
+       is_procvar:=false;
+       while assigned(hp) do
+         begin
+            writeln(outfile);
+            (* write new type name *)
+            write(outfile,aktspace,hp^.p1^.p2^.p);
+            write(outfile,' = ');
+            shift(2);
+            if assigned(ph) then
+              write_p_a_def(outfile,hp^.p1^.p1,ph)
+            else
+              write_p_a_def(outfile,hp^.p1^.p1,$2);
+            (* simple def ?
+               keep the name for the other defs *)
+            if (ph=nil) and (hp^.p1^.p1=nil) then
+              ph:=hp^.p1^.p2;
+            popshift;
+            (* if no_pop it is normal fpc calling convention *)
+            if is_procvar and
+               (not no_pop) then
+              write(outfile,';cdecl');
+            writeln(outfile,';');
+            flush(outfile);
+            hp:=hp^.next;
+         end;
+       (* write tag name *)
+       if assigned(ph) and
+         (($2^.typ=t_structdef) or
+         ($2^.typ=t_enumdef) or
+         ($2^.typ=t_uniondef)) and
+         assigned($2^.p2) then
+           begin
+              writeln(outfile);
+              write(outfile,aktspace,$2^.p2^.p,' = ');
+              if assigned(ph) then
+                writeln(outfile,ph^.p,';')
+              else
+                begin
+                   write_p_a_def(outfile,hp^.p1^.p1,$2);
+                   writeln(outfile,';');
+                end;
+           end;
+       popshift;
+       if must_write_packed_field then
+         if assigned(ph) then
+           write_packed_fields_info(outfile,$2,ph^.str)
+         else if assigned($2^.p2) then
+           write_packed_fields_info(outfile,$2,$2^.p2^.str);
+       if assigned($2)then
+       dispose($2,done);
+       if assigned($3)then
+       dispose($3,done);
+       if assigned($4)then
+       dispose($4,done);
+     } |
+     TYPEDEF dname SEMICOLON
+     {
+       if block_type<>bt_type then
+         begin
+            writeln(outfile);
+            writeln(outfile,aktspace,'type');
+         end;
+       block_type:=bt_type;
+
+       shift(3);
+       (* write as pointer *)
+       writeln(outfile);
+       writeln(outfile,'(* generic typedef  *)');
+       writeln(outfile,aktspace,$2^.p,' = pointer;');
+       flush(outfile);
+       popshift;
+       if assigned($2)then
+       dispose($2,done);
+     }
+     | error  error_info SEMICOLON
+      { writeln(outfile,'in declaration at line ',line_no,' *)');
+        aktspace:='';
+        in_space_define:=0;
+        in_define:=false;
+        arglevel:=0;
+        if_nb:=0;
+        aktspace:='    ';
+        space_index:=1;
+        yyerrok;}
+     ;
+
+define_dec :
+     DEFINE dname LKLAMMER enum_list RKLAMMER SPACE_DEFINE def_expr NEW_LINE
+     {
+       writeln (outfile,aktspace,'{ was #define dname(params) def_expr }');
+       writeln (extfile,aktspace,'{ was #define dname(params) def_expr }');
+       if assigned($4) then
+         begin
+            writeln (outfile,aktspace,'{ argument types are unknown }');
+            writeln (extfile,aktspace,'{ argument types are unknown }');
+         end;
+       if not assigned($7^.p3) then
+         begin
+            writeln(outfile,aktspace,'{ return type might be wrong }   ');
+            writeln(extfile,aktspace,'{ return type might be wrong }   ');
+         end;
+       block_type:=bt_func;
+       write(outfile,aktspace,'function ',$2^.p);
+       write(extfile,aktspace,'function ',$2^.p);
+
+       if assigned($4) then
+         begin
+            write(outfile,'(');
+            write(extfile,'(');
+            ph:=new(presobject,init_one(t_enumdef,$4));
+            write_def_params(outfile,ph);
+            write_def_params(extfile,ph);
+            if assigned(ph) then dispose(ph,done);
+            ph:=nil;
+            (* types are unknown *)
+            write(outfile,' : longint)');
+            write(extfile,' : longint)');
+         end;
+       if not assigned($7^.p3) then
+         begin
+            writeln(outfile,' : longint;');
+            writeln(outfile,aktspace,'  { return type might be wrong }   ');
+            flush(outfile);
+            writeln(extfile,' : longint;');
+            writeln(extfile,aktspace,'  { return type might be wrong }   ');
+         end
+       else
+         begin
+            write(outfile,' : ');
+            write_type_specifier(outfile,$7^.p3);
+            writeln(outfile,';');
+            flush(outfile);
+            write(extfile,' : ');
+            write_type_specifier(extfile,$7^.p3);
+            writeln(extfile,';');
+         end;
+       writeln(outfile);
+       flush(outfile);
+       hp:=new(presobject,init_two(t_funcname,$2,$7));
+       write_funexpr(extfile,hp);
+       writeln(extfile);
+       flush(extfile);
+       if assigned(hp)then dispose(hp,done);
+     }|
+     DEFINE dname SPACE_DEFINE NEW_LINE
+     {
+       writeln(outfile,'{$define ',$2^.p,'}');
+       flush(outfile);
+       if assigned($2)then
+        dispose($2,done);
+     }|
+     DEFINE dname NEW_LINE
+     {
+       writeln(outfile,'{$define ',$2^.p,'}');
+       flush(outfile);
+       if assigned($2)then
+        dispose($2,done);
+     } |
+     DEFINE dname SPACE_DEFINE def_expr NEW_LINE
+     {
+       if ($4^.typ=t_exprlist) and
+          $4^.p1^.is_const and
+          not assigned($4^.next) then
+         begin
+            if block_type<>bt_const then
+              begin
+                 writeln(outfile);
+                 writeln(outfile,aktspace,'const');
+              end;
+            block_type:=bt_const;
+
+            aktspace:=aktspace+'   ';
+            write(outfile,aktspace,$2^.p);
+            write(outfile,' = ');
+            flush(outfile);
+            write_expr(outfile,$4^.p1);
+            writeln(outfile,';');
+            dec(byte(aktspace[0]),3);
+            if assigned($2) then
+            dispose($2,done);
+            if assigned($4) then
+            dispose($4,done);
+         end
+       else
+         begin
+            aktspace:=aktspace+'  ';
+            writeln (outfile,aktspace,'{ was #define dname def_expr }');
+            writeln (extfile,aktspace,'{ was #define dname def_expr }');
+            block_type:=bt_func;
+            write(outfile,aktspace,'function ',$2^.p);
+            write(extfile,aktspace,'function ',$2^.p);
+            if not assigned($4^.p3) then
+              begin
+                 writeln(outfile,' : longint;');
+                 writeln(outfile,aktspace,'  { return type might be wrong }');
+                 flush(outfile);
+                 writeln(extfile,' : longint;');
+                 writeln(extfile,aktspace,'  { return type might be wrong }');
+              end
+            else
+              begin
+                 write(outfile,' : ');
+                 write_type_specifier(outfile,$4^.p3);
+                 writeln(outfile,';');
+                 flush(outfile);
+                 write(extfile,' : ');
+                 write_type_specifier(extfile,$4^.p3);
+                 writeln(extfile,';');
+              end;
+            writeln(outfile);
+            flush(outfile);
+            hp:=new(presobject,init_two(t_funcname,$2,$4));
+            write_funexpr(extfile,hp);
+            dec(byte(aktspace[0]),2);
+            dispose(hp,done);
+            writeln(extfile);
+            flush(extfile);
+         end;
+     }
+     | error error_info NEW_LINE
+      { writeln(outfile,'in define line ',line_no,' *)');
+        aktspace:='';
+        in_space_define:=0;
+        in_define:=false;
+        arglevel:=0;
+        if_nb:=0;
+        aktspace:='    ';
+        space_index:=1;
+
+        yyerrok;}
+     ;
+
+closed_list : LGKLAMMER member_list RGKLAMMER
+            {$$:=$2;} |
+            error  error_info RGKLAMMER
+            { writeln(outfile,' in member_list *)');
+            yyerrok;
+            $$:=nil;
+            }
+            ;
+
+closed_enum_list : LGKLAMMER enum_list RGKLAMMER
+            {$$:=$2;} |
+            error  error_info  RGKLAMMER
+            { writeln(outfile,' in enum_list *)');
+            yyerrok;
+            $$:=nil;
+            }
+            ;
+
+special_type_specifier :
+     STRUCT dname closed_list _PACKED
+     {
+       if not is_packed then
+         writeln(outfile,'{$PACKRECORDS 1}');
+       is_packed:=true;
+       $$:=new(presobject,init_two(t_structdef,$3,$2));
+     } |
+     STRUCT dname closed_list
+     {
+       if is_packed then
+         writeln(outfile,'{$PACKRECORDS 4}');
+       is_packed:=false;
+       $$:=new(presobject,init_two(t_structdef,$3,$2));
+     } |
+     UNION dname closed_list _PACKED
+     {
+       if not is_packed then
+         writeln(outfile,'{$PACKRECORDS 1}');
+       is_packed:=true;
+       $$:=new(presobject,init_two(t_uniondef,$3,$2));
+     } |
+     UNION dname closed_list
+     {
+       $$:=new(presobject,init_two(t_uniondef,$3,$2));
+     } |
+     UNION dname
+     {
+       $$:=new(presobject,init_two(t_uniondef,nil,$2));
+     } |
+     STRUCT dname
+     {
+       $$:=new(presobject,init_two(t_structdef,nil,$2));
+     } |
+     ENUM dname closed_enum_list
+     {
+       $$:=new(presobject,init_two(t_enumdef,$3,$2));
+     } |
+     ENUM dname
+     {
+       $$:=new(presobject,init_two(t_enumdef,nil,$2));
+     };
+
+type_specifier :
+      _CONST type_specifier
+      {
+        writeln(outfile,'(* Const before type ignored *)');
+        $$:=$2;
+        } |
+     UNION closed_list  _PACKED
+     {
+       if not is_packed then
+         writeln(outfile,'{$PACKRECORDS 1}');
+       is_packed:=true;
+       $$:=new(presobject,init_one(t_uniondef,$2));
+     } |
+     UNION closed_list
+     {
+       $$:=new(presobject,init_one(t_uniondef,$2));
+     } |
+     STRUCT closed_list _PACKED
+     {
+       if not is_packed then
+         writeln(outfile,'{$PACKRECORDS 1}');
+       is_packed:=true;
+       $$:=new(presobject,init_one(t_structdef,$2));
+     } |
+     STRUCT closed_list
+     {
+       if is_packed then
+         writeln(outfile,'{$PACKRECORDS 4}');
+       is_packed:=false;
+       $$:=new(presobject,init_one(t_structdef,$2));
+     } |
+     ENUM closed_enum_list
+     {
+       $$:=new(presobject,init_one(t_enumdef,$2));
+     } |
+     special_type_specifier
+     {
+       $$:=$1;
+     } |
+     simple_type_name { $$:=$1; }
+     ;
+
+member_list : member_declaration member_list
+     {
+       $$:=new(presobject,init_one(t_memberdeclist,$1));
+       $$^.next:=$2;
+     } |
+     member_declaration
+     {
+       $$:=new(presobject,init_one(t_memberdeclist,$1));
+     }
+     ;
+
+member_declaration :
+     type_specifier declarator_list SEMICOLON
+     {
+       $$:=new(presobject,init_two(t_memberdec,$1,$2));
+     }
+     ;
+
+dname : ID { (*dname*)
+           $$:=new(presobject,init_id(act_token));
+           }
+     ;
+
+special_type_name : INT
+     {
+       $$:=new(presobject,init_id(INT_STR));
+     } |
+     UNSIGNED INT
+     {
+       $$:=new(presobject,init_id(UINT_STR));
+     } |
+     LONG
+     {
+       $$:=new(presobject,init_id(INT_STR));
+     } |
+     REAL
+     {
+       $$:=new(presobject,init_id(REAL_STR));
+     } |
+     LONG INT
+     {
+       $$:=new(presobject,init_id(INT_STR));
+     } |
+     UNSIGNED LONG INT
+     {
+       $$:=new(presobject,init_id(UINT_STR));
+     } |
+     UNSIGNED LONG
+     {
+       $$:=new(presobject,init_id(UINT_STR));
+     } |
+     UNSIGNED
+     {
+       $$:=new(presobject,init_id(UINT_STR));
+     } |
+     UNSIGNED SHORT
+     {
+       $$:=new(presobject,init_id(USHORT_STR));
+     } |
+     UNSIGNED _CHAR
+     {
+       $$:=new(presobject,init_id(UCHAR_STR));
+     } |
+     VOID
+     {
+       $$:=new(presobject,init_no(t_void));
+     } |
+     SHORT
+     {
+       $$:=new(presobject,init_id(SHORT_STR));
+     } |
+     _CHAR
+     {
+       $$:=new(presobject,init_id(CHAR_STR));
+     }
+     ;
+
+simple_type_name :
+     special_type_name
+     {
+     $$:=$1;
+     }
+     |
+     dname
+     {
+     $$:=$1;
+     }
+     ;
+
+declarator_list :
+     declarator_list COMMA declarator
+     {
+     $$:=$1;
+     hp:=$1;
+     while assigned(hp^.next) do
+       hp:=hp^.next;
+     hp^.next:=new(presobject,init_one(t_declist,$3));
+     }|
+     error error_info COMMA declarator_list
+     {
+     writeln(outfile,' in declarator_list *)');
+     $$:=$4;
+     yyerrok;
+     }|
+     error error_info
+     {
+     writeln(outfile,' in declarator_list *)');
+     yyerrok;
+     }|
+     declarator
+     {
+     $$:=new(presobject,init_one(t_declist,$1));
+     }
+     ;
+
+argument_declaration : type_specifier declarator
+     {
+       $$:=new(presobject,init_two(t_arg,$1,$2));
+     } |
+     type_specifier abstract_declarator
+     {
+       $$:=new(presobject,init_two(t_arg,$1,$2));
+     }
+     ;
+
+argument_declaration_list : argument_declaration
+     {
+       $$:=new(presobject,init_two(t_arglist,$1,nil));
+     } |
+     argument_declaration COMMA argument_declaration_list
+     {
+       $$:=new(presobject,init_two(t_arglist,$1,nil));
+       $$^.next:=$3;
+     } |
+     ELLIPSIS
+     {
+       $$:=new(presobject,init_two(t_arglist,ellipsisarg,nil));
+       (*** ELLIPSIS PROBLEM ***)
+     }
+     ;
+
+size_overrider :
+       _FAR
+       { $$:=new(presobject,init_id('far'));}
+       | _NEAR
+       { $$:=new(presobject,init_id('near'));}
+       | _HUGE
+       { $$:=new(presobject,init_id('huge'));}
+       ;
+
+declarator :
+      _CONST declarator
+      {
+        writeln(outfile,'(* Const before declarator ignored *)');
+        $$:=$2;
+        } |
+     size_overrider STAR declarator
+     {
+       writeln(outfile,aktspace,'(* ',$1^.p,' ignored *)');
+       dispose($1,done);
+       hp:=$3;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_one(t_pointerdef,nil));
+     } |
+     STAR declarator
+     {
+       (* %prec PSTAR     this was wrong!! *)
+       hp:=$2;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_one(t_pointerdef,nil));
+     } |
+     _AND declarator %prec P_AND
+     {
+       hp:=$2;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_one(t_addrdef,nil));
+     } |
+     dname COLON expr
+       {
+         (*  size specifier supported *)
+         hp:=new(presobject,init_one(t_size_specifier,$3));
+         $$:=new(presobject,init_three(t_dec,nil,$1,hp));
+        }|
+     dname ASSIGN expr
+       {
+         writeln(outfile,'(* Warning : default value for ',$1^.p,' ignored *)');
+         hp:=new(presobject,init_one(t_default_value,$3));
+         $$:=new(presobject,init_three(t_dec,nil,$1,hp));
+        }|
+     dname
+       {
+         $$:=new(presobject,init_two(t_dec,nil,$1));
+        }|
+     declarator LKLAMMER argument_declaration_list RKLAMMER
+     {
+       hp:=$1;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_two(t_procdef,nil,$3));
+     } |
+     declarator no_arg
+     {
+       hp:=$1;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_two(t_procdef,nil,nil));
+     } |
+     declarator LECKKLAMMER expr RECKKLAMMER
+     {
+       hp:=$1;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_two(t_arraydef,nil,$3));
+     } |
+     LKLAMMER declarator RKLAMMER { $$:=$2; }
+     ;
+
+no_arg : LKLAMMER RKLAMMER |
+        LKLAMMER VOID RKLAMMER;
+
+abstract_declarator :
+      _CONST abstract_declarator
+      {
+        writeln(outfile,'(* Const before abstract_declarator ignored *)');
+        $$:=$2;
+        } |
+     size_overrider STAR abstract_declarator
+     {
+       writeln(outfile,aktspace,'(* ',$1^.p,' ignored *)');
+       dispose($1,done);
+       hp:=$3;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_one(t_pointerdef,nil));
+     } |
+     STAR abstract_declarator %prec PSTAR
+     {
+       hp:=$2;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_one(t_pointerdef,nil));
+     } |
+     abstract_declarator LKLAMMER argument_declaration_list RKLAMMER
+     {
+       hp:=$1;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_two(t_procdef,nil,$3));
+     } |
+     abstract_declarator no_arg
+     {
+       hp:=$1;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_two(t_procdef,nil,nil));
+     } |
+     abstract_declarator LECKKLAMMER expr RECKKLAMMER
+     {
+       hp:=$1;
+       $$:=hp;
+       while assigned(hp^.p1) do
+         hp:=hp^.p1;
+       hp^.p1:=new(presobject,init_two(t_arraydef,nil,$3));
+     } |
+     LKLAMMER abstract_declarator RKLAMMER
+     { $$:=$2; } |
+     {
+       $$:=new(presobject,init_two(t_dec,nil,nil));
+     }
+     ;
+
+expr    :
+          shift_expr
+          {$$:=$1;}
+          ;
+
+shift_expr :
+          expr EQUAL expr
+          { $$:=new(presobject,init_bop(' = ',$1,$3));}
+          | expr UNEQUAL expr
+          { $$:=new(presobject,init_bop(' <> ',$1,$3));}
+          | expr GT expr
+          { $$:=new(presobject,init_bop(' > ',$1,$3));}
+          | expr GTE expr
+          { $$:=new(presobject,init_bop(' >= ',$1,$3));}
+          | expr LT expr
+          { $$:=new(presobject,init_bop(' < ',$1,$3));}
+          | expr LTE expr
+          { $$:=new(presobject,init_bop(' <= ',$1,$3));}
+          | expr _PLUS expr
+          { $$:=new(presobject,init_bop(' + ',$1,$3));}
+               | expr MINUS expr
+          { $$:=new(presobject,init_bop(' - ',$1,$3));}
+               | expr STAR expr
+          { $$:=new(presobject,init_bop(' * ',$1,$3));}
+               | expr _SLASH expr
+          { $$:=new(presobject,init_bop(' / ',$1,$3));}
+               | expr _OR expr
+          { $$:=new(presobject,init_bop(' or ',$1,$3));}
+               | expr _AND expr
+          { $$:=new(presobject,init_bop(' and ',$1,$3));}
+               | expr _NOT expr
+          { $$:=new(presobject,init_bop(' not ',$1,$3));}
+               | expr _SHL expr
+          { $$:=new(presobject,init_bop(' shl ',$1,$3));}
+               | expr _SHR expr
+          { $$:=new(presobject,init_bop(' shr ',$1,$3));}
+          | expr QUESTIONMARK colon_expr
+          { $3^.p1:=$1;
+          $$:=$3;
+          inc(if_nb);
+          $$^.p:=strpnew('if_local'+str(if_nb));
+          } |
+          unary_expr {$$:=$1;}
+          ;
+
+colon_expr : expr COLON expr
+       { (* if A then B else C *)
+       $$:=new(presobject,init_three(t_ifexpr,nil,$1,$3));}
+       ;
+
+maybe_empty_unary_expr :
+                  unary_expr
+                  { $$:=$1; }
+                  |
+                  { $$:=nil;}
+                  ;
+
+unary_expr:
+     dname
+     {
+     $$:=$1;
+     } |
+     CSTRING
+     {
+     (* remove L prefix for widestrings *)
+     s:=act_token;
+     if Win32headers and (s[1]='L') then
+       delete(s,1,1);
+     $$:=new(presobject,init_id(''''+copy(s,2,length(s)-2)+''''));
+     } |
+     NUMBER
+     {
+     $$:=new(presobject,init_id(act_token));
+     } |
+     unary_expr POINT expr
+     {
+     $$:=new(presobject,init_bop('.',$1,$3));
+     } |
+     unary_expr DEREF expr
+     {
+     $$:=new(presobject,init_bop('^.',$1,$3));
+     } |
+     MINUS unary_expr
+     {
+     $$:=new(presobject,init_preop('-',$2));
+     }|
+     _AND unary_expr %prec R_AND
+     {
+     $$:=new(presobject,init_preop('@',$2));
+     }|
+     _NOT unary_expr
+     {
+     $$:=new(presobject,init_preop(' not ',$2));
+     } |
+     LKLAMMER dname RKLAMMER maybe_empty_unary_expr
+     {
+     if assigned($4) then
+       $$:=new(presobject,init_two(t_typespec,$2,$4))
+     else
+       $$:=$2;
+     } |
+     LKLAMMER type_specifier RKLAMMER unary_expr
+     {
+     $$:=new(presobject,init_two(t_typespec,$2,$4));
+     } |
+     LKLAMMER type_specifier STAR RKLAMMER unary_expr
+     {
+     hp:=new(presobject,init_one(t_pointerdef,$2));
+     $$:=new(presobject,init_two(t_typespec,hp,$5));
+     } |
+     LKLAMMER type_specifier size_overrider STAR RKLAMMER unary_expr
+     {
+     writeln(outfile,aktspace,'(* ',$3^.p,' ignored *)');
+     dispose($3,done);
+     write_type_specifier(outfile,$2);
+     writeln(outfile,' ignored *)');
+     hp:=new(presobject,init_one(t_pointerdef,$2));
+     $$:=new(presobject,init_two(t_typespec,hp,$6));
+     } |
+     dname LKLAMMER exprlist RKLAMMER
+     {
+     hp:=new(presobject,init_one(t_exprlist,$1));
+     $$:=new(presobject,init_three(t_funexprlist,hp,$3,nil));
+     } |
+     LKLAMMER shift_expr RKLAMMER
+     {
+     $$:=$2;
+     }
+     ;
+
+enum_list :
+     enum_element COMMA enum_list
+     { (*enum_element COMMA enum_list *)
+       $$:=$1;
+       $$^.next:=$3;
+      } |
+      enum_element {
+       $$:=$1;
+      } |
+      {(* empty enum list *)
+       $$:=nil;};
+
+enum_element :
+     dname _ASSIGN expr
+     { begin (*enum_element: dname _ASSIGN expr *)
+        $$:=new(presobject,init_two(t_enumlist,$1,$3));
+       end;
+     } |
+     dname
+     {
+       begin (*enum_element: dname*)
+       $$:=new(presobject,init_two(t_enumlist,$1,nil));
+       end;
+     };
+
+
+def_expr : unary_expr
+         {
+         if $1^.typ=t_funexprlist then
+           $$:=$1
+         else
+           $$:=new(presobject,init_two(t_exprlist,$1,nil));
+         (* if here is a type specifier
+            we know the return type *)
+         if ($1^.typ=t_typespec) then
+           $$^.p3:=$1^.p1^.get_copy;
+         }
+         ;
+
+exprlist : exprelem COMMA exprlist
+    { (*exprlist COMMA expr*)
+       $$:=$1;
+       $1^.next:=$3;
+     } |
+     exprelem
+     {
+       $$:=$1;
+     } |
+     { (* empty expression list *)
+       $$:=nil; };
+
+exprelem :
+           expr
+           {
+             $$:=new(presobject,init_one(t_exprlist,$1));
+           };
+
+%%
+
+function yylex : Integer;
+ begin
+ yylex:=scan.yylex;
+ end;
+
+var r:integer; SS:string;
+
+begin
+   debug:=true;
+   yydebug:=true;
+   aktspace:='  ';
+   block_type:=bt_no;
+   IsExtern:=false;
+   Assign(extfile,'ext.tmp'); rewrite(extfile);
+   Assign(tempfile,'ext2.tmp'); rewrite(tempfile);
+   r:=yyparse;
+   if not(includefile) then
+     begin
+        writeln(outfile);
+        writeln(outfile,'  implementation');
+        writeln(outfile);
+        writeln(outfile,'const External_library=''',libfilename,'''; {Setup as you need!}');
+        writeln(outfile);
+     end;
+   reset(extfile);
+
+   { here we have a problem if a line is longer than 255 chars !! }
+   while not eof(extfile) do
+    begin
+    readln(extfile,SS);
+    writeln(outfile,SS);
+    end;
+
+   writeln(outfile);
+
+   if not(includefile) then
+     writeln(outfile,'end.');
+
+   close(extfile);
+   erase(extfile);
+   close(outfile);
+   close(tempfile);
+   erase(tempfile);
+   close(textinfile);
+end.
+
+(*
+
+ $Log$
+ Revision 1.1  1999-05-12 16:11:39  peter
+   * moved
+
+ Revision 1.22  1998/11/12 11:38:21  peter
+   + new cdecl support
+   + ... -> array of const
+
+ Revision 1.21  1998/09/10 13:52:42  peter
+   * removed warnings
+
+ Revision 1.20  1998/09/04 17:26:32  pierre
+   * better packed field handling
+
+ Revision 1.18  1998/08/05 15:50:09  florian
+   * small problems with // comments fixed (invalid line counting)
+   + SYS_TRAP support for PalmOS
+   + switch -x for PalmOS
+   + switch -i to generate include files instead of units
+
+ Revision 1.17  1998/07/27 11:03:48  florian
+   * probelm with funtions which resturns a pointer solved
+
+ Revision 1.16  1998/07/24 20:55:43  michael
+ * Fixed some minor bugs in Pierres stuff
+
+ Revision 1.15  1998/07/23 23:26:03  michael
+ + added -D option instead of -d, restored old -d
+
+ Revision 1.14  1998/06/12 16:53:52  pierre
+   + syntax of C var changed again !!
+     this reflect now the current state of the compiler
+   * improvements in & address operator handling
+
+ Revision 1.12  1998/06/08 08:13:44  pierre
+   + merged version of h2pas
+   + added -w for special win32 header directives
+
+   5.1998 : reworked by Pierre Muller
+
+     - added better parsing of defines
+     - handles type casting
+     - error recovery partially implemented
+     - WIN32 specific stuff
+
+     still missing
+     - tags not stored
+     - conditionnals inside typed definitions
+     - complicated defines not supported
+     ( sets .. use of ## ... )
+     - what should we do about
+      const specifier ? can we ignored this
+      FAR modifier ?
+
+ Revision 1.11  1998/04/30 11:22:20  florian
+   + support of direct struct declaration added
+
+ Revision 1.10  1998/04/27 12:06:40  michael
+ + Added GPL statement
+
+ Revision 1.9  1998/04/24 22:34:40  florian
+   + enumerations with assigments implemented
+
+ Revision 1.8  1998/04/24 18:23:46  florian
+   + parameter -v added (replaces pointer parameters by call by reference
+     parameters)
+     void p(int *i) =>   procedure p(var i : longint);
+
+ History:
+   25.9.1996:
+      first version
+
+   26.9.1996:
+      - structs are supported
+      - unsigned implemented
+      - procedure variables implemented
+      - void * becomes pointer
+      - unions implemented
+      - enumerations
+      - number post- and prefixes
+      - operatores unary-, << and >>
+      - problem with the priority of [], (), and * fixed
+      - procedures and functions
+
+   28.9.1996:
+      - formal paramters
+
+   22-26.5.1997  made by Mark Malakanov     [email protected]
+      - full ariphmetic and logic expressions in #define
+
+      - #define with params changes to function (first param
+        disappears by unknown reason!).
+        Adds func body into implementation section.
+
+      - real numbers
+
+      - handling
+       #ifdef ID  to {$ifdef ID}
+       #ifundef ID  to {$ifundef ID}
+       #else to {$else}
+       #define ID to {$define ID}
+       #endif to {$endif}
+
+      -"extern" fully handled . Adds proc/func + 'external _ExternalLibrary;'to
+        implementation section
+       you must assign _ExternalLibrary later.
+
+      -"const" skips in func/proc arguments.
+
+      changes in convert.y and scan.l
+      - "convert" renamed to "h2pas"
+      - Inserted the checking "IsAssigned(Pointer)" everywhere access to pointers
+       It preserv from Acces Violation Errors.
+      - A little remade for TP Lex and Yacc 4.01 -
+           changed function "input" to "get_char"
+      -!!! because of peculiarity TPLY4.01 you must create unit CONVERU.PAS by
+       your hand! Cut const definitions from CONVERT.PAS and paste into CONVERU.PAS
+
+ What need
+   * handle struct a {  }; in the right way
+   * all predefined C types
+   * misplaced comments
+   * handle functions without result
+*)
+

+ 407 - 0
utils/h2pas/lexlib.pas

@@ -0,0 +1,407 @@
+
+unit LexLib;
+
+(* Standard Lex library unit for TP Lex Version 3.0.
+   2-11-91 AG *)
+
+interface
+
+(* The Lex library unit supplies a collection of variables and routines
+   needed by the lexical analyzer routine yylex and application programs
+   using Lex-generated lexical analyzers. It also provides access to the
+   input/output streams used by the lexical analyzer and the text of the
+   matched string, and provides some utility functions which may be used
+   in actions.
+
+   This `standard' version of the LexLib unit is used to implement lexical
+   analyzers which read from and write to MS-DOS files (using standard input
+   and output, by default). It is suitable for many standard applications
+   for lexical analyzers, such as text conversion tools or compilers.
+
+   However, you may create your own version of the LexLib unit, tailored to
+   your target applications. In particular, you may wish to provide another
+   set of I/O functions, e.g., if you want to read from or write to memory
+   instead to files, or want to use different file types. *)
+
+(* Variables:
+
+   The variable yytext contains the current match, yyleng 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
+   meaningful if there is no rescanning across line ends).
+
+   The variables yyinput and yyoutput are the text files which are used
+   by the lexical analyzer. By default, they are assigned to standard
+   input and output, but you may change these assignments to fit your
+   target application (use the Turbo Pascal standard routines assign,
+   reset, and rewrite for this purpose). *)
+
+var
+
+yyinput, yyoutput : Text;        (* input and output file *)
+yyline            : String;      (* current 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:
+
+   The following routines get_char, unget_char and put_char are used to
+   implement access to the input and output files. Since \n (newline) for
+   Lex means line end, the I/O routines have to translate MS-DOS line ends
+   (carriage-return/line-feed) into newline characters and vice versa. Input
+   is buffered to allow rescanning text (via unput_char).
+
+   The input buffer holds the text of the line to be scanned. When the input
+   buffer empties, a new line is obtained from the input stream. Characters
+   can be returned to the input buffer by calls to unget_char. At end-of-
+   file a null character is returned.
+
+   The input routines also keep track of the input position and set the
+   yyline, yylineno, yycolno variables accordingly.
+
+   Since the rest of the Lex library only depends on these three routines
+   (there are no direct references to the yyinput and yyoutput files or
+   to the input buffer), you can easily replace get_char, unget_char and
+   put_char by another suitable set of routines, e.g. if you want to read
+   from/write to memory, etc. *)
+
+function get_char : Char;
+  (* obtain one character from the input file (null character at end-of-
+     file) *)
+
+procedure unget_char ( c : Char );
+  (* return one character to the input file to be reread in subsequent calls
+     to get_char *)
+
+procedure put_char ( c : Char );
+  (* write one character to the output file *)
+
+(* Utility routines: *)
+
+procedure echo;
+  (* echoes the current match to the output stream *)
+
+procedure yymore;
+  (* append the next match to the current one *)
+
+procedure yyless ( n : Integer );
+  (* truncate yytext to size n and return the remaining characters to the
+     input stream *)
+
+procedure reject;
+  (* reject the current match and execute the next one *)
+
+  (* reject does not actually cause the input to be rescanned; instead,
+     internal state information is used to find the next match. Hence
+     you should not try to modify the input stream or the yytext variable
+     when rejecting a match. *)
+
+procedure return ( n : Integer );
+procedure returnc ( c : Char );
+  (* sets the return value of yylex *)
+
+procedure start ( state : Integer );
+  (* puts the lexical analyzer in the given start state; state=0 denotes
+     the default start state, other values are user-defined *)
+
+(* yywrap:
+
+   The yywrap function is called by yylex at end-of-file (unless you have
+   specified a rule matching end-of-file). You may redefine this routine
+   in your Lex program to do application-dependent processing at end of
+   file. In particular, yywrap may arrange for more input and return false
+   in which case the yylex routine resumes lexical analysis. *)
+
+function yywrap : Boolean;
+  (* The default yywrap routine supplied here closes input and output files
+     and returns true (causing yylex to terminate). *)
+
+(* The following are the internal data structures and routines used by the
+   lexical analyzer routine yylex; they should not be used directly. *)
+
+var
+
+yystate    : Integer; (* current state of lexical analyzer *)
+yyactchar  : Char;    (* current character *)
+yylastchar : Char;    (* last matched character (#0 if none) *)
+yyrule     : Integer; (* matched rule *)
+yyreject   : Boolean; (* current match rejected? *)
+yydone     : Boolean; (* yylex return value set? *)
+yyretval   : Integer; (* yylex return value *)
+
+procedure yynew;
+  (* starts next match; initializes state information of the lexical
+     analyzer *)
+
+procedure yyscan;
+  (* gets next character from the input stream and updates yytext and
+     yyactchar accordingly *)
+
+procedure yymark ( n : Integer );
+  (* marks position for rule no. n *)
+
+procedure yymatch ( n : Integer );
+  (* declares a match for rule number n *)
+
+function yyfind ( var n : Integer ) : Boolean;
+  (* finds the last match and the corresponding marked position and adjusts
+     the matched string accordingly; returns:
+     - true if a rule has been matched, false otherwise
+     - n: the number of the matched rule *)
+
+function yydefault : Boolean;
+  (* executes the default action (copy character); returns true unless
+     at end-of-file *)
+
+procedure yyclear;
+  (* reinitializes state information after lexical analysis has been
+     finished *)
+
+implementation
+
+procedure fatal ( msg : String );
+  (* writes a fatal error message and halts program *)
+  begin
+    writeln('LexLib: ', msg);
+    halt(1);
+  end(*fatal*);
+
+(* I/O routines: *)
+
+const nl = #10;  (* newline character *)
+
+const max_chars = 2048;
+
+var
+
+bufptr : Integer;
+buf    : array [1..max_chars] of Char;
+
+function get_char : Char;
+  var i : Integer;
+  begin
+    if (bufptr=0) and not eof(yyinput) then
+      begin
+        readln(yyinput, yyline);
+        inc(yylineno); yycolno := 1;
+        buf[1] := nl;
+        for i := 1 to length(yyline) do
+          buf[i+1] := yyline[length(yyline)-i+1];
+        inc(bufptr, length(yyline)+1);
+      end;
+    if bufptr>0 then
+      begin
+        get_char := buf[bufptr];
+        dec(bufptr);
+        inc(yycolno);
+      end
+    else
+      get_char := #0;
+  end(*get_char*);
+
+procedure unget_char ( c : Char );
+  begin
+    if bufptr=max_chars then fatal('input buffer overflow');
+    inc(bufptr);
+    dec(yycolno);
+    buf[bufptr] := c;
+  end(*unget_char*);
+
+procedure put_char ( c : Char );
+  begin
+    if c=#0 then
+      { ignore }
+    else if c=nl then
+      writeln(yyoutput)
+    else
+      write(yyoutput, c)
+  end(*put_char*);
+
+(* Variables:
+
+   Some state information is maintained to keep track with calls to yymore,
+   yyless, reject, start and yymatch/yymark, and to initialize state
+   information used by the lexical analyzer.
+   - yystext: contains the initial contents of the yytext variable; this
+     will be the empty string, unless yymore is called which sets yystext
+     to the current yytext
+   - yysstate: start state of lexical analyzer (set to 0 during
+     initialization, and modified in calls to the start routine)
+   - yylstate: line state information (1 if at beginning of line, 0
+     otherwise)
+   - yystack: stack containing matched rules; yymatches contains the number of
+     matches
+   - yypos: for each rule the last marked position (yymark); zeroed when rule
+     has already been considered
+   - yysleng: copy of the original yyleng used to restore state information
+     when reject is used *)
+
+const
+
+max_matches = 1024;
+max_rules   = 256;
+
+var
+
+yystext            : String;
+yysstate, yylstate : Integer;
+yymatches          : Integer;
+yystack            : array [1..max_matches] of Integer;
+yypos              : array [1..max_rules] of Integer;
+yysleng            : Byte;
+
+(* Utilities: *)
+
+procedure echo;
+  var i : Integer;
+  begin
+    for i := 1 to yyleng do
+      put_char(yytext[i])
+  end(*echo*);
+
+procedure yymore;
+  begin
+    yystext := yytext;
+  end(*yymore*);
+
+procedure yyless ( n : Integer );
+  var i : Integer;
+  begin
+    for i := yyleng downto n+1 do
+      unget_char(yytext[i]);
+    yyleng := n;
+  end(*yyless*);
+
+procedure reject;
+  var i : Integer;
+  begin
+    yyreject := true;
+    for i := yyleng+1 to yysleng do
+      yytext := yytext+get_char;
+    dec(yymatches);
+  end(*reject*);
+
+procedure return ( n : Integer );
+  begin
+    yyretval := n;
+    yydone := true;
+  end(*return*);
+
+procedure returnc ( c : Char );
+  begin
+    yyretval := ord(c);
+    yydone := true;
+  end(*returnc*);
+
+procedure start ( state : Integer );
+  begin
+    yysstate := state;
+  end(*start*);
+
+(* yywrap: *)
+
+function yywrap : Boolean;
+  begin
+    close(yyinput); close(yyoutput);
+    yywrap := true;
+  end(*yywrap*);
+
+(* Internal routines: *)
+
+procedure yynew;
+  begin
+    if yylastchar<>#0 then
+      if yylastchar=nl then
+        yylstate := 1
+      else
+        yylstate := 0;
+    yystate := yysstate+yylstate;
+    yytext  := yystext;
+    yystext := '';
+    yymatches := 0;
+    yydone := false;
+  end(*yynew*);
+
+procedure yyscan;
+  begin
+    if yyleng=255 then fatal('yytext overflow');
+    yyactchar := get_char;
+    inc(yyleng);
+    yytext[yyleng] := yyactchar;
+  end(*yyscan*);
+
+procedure yymark ( n : Integer );
+  begin
+    if n>max_rules then fatal('too many rules');
+    yypos[n] := yyleng;
+  end(*yymark*);
+
+procedure yymatch ( n : Integer );
+  begin
+    inc(yymatches);
+    if yymatches>max_matches then fatal('match stack overflow');
+    yystack[yymatches] := n;
+  end(*yymatch*);
+
+function yyfind ( var n : Integer ) : Boolean;
+  begin
+    yyreject := false;
+    while (yymatches>0) and (yypos[yystack[yymatches]]=0) do
+      dec(yymatches);
+    if yymatches>0 then
+      begin
+        yysleng := yyleng;
+        n       := yystack[yymatches];
+        yyless(yypos[n]);
+        yypos[n] := 0;
+        if yyleng>0 then
+          yylastchar := yytext[yyleng]
+        else
+          yylastchar := #0;
+        yyfind := true;
+      end
+    else
+      begin
+        yyless(0);
+        yylastchar := #0;
+        yyfind := false;
+      end
+  end(*yyfind*);
+
+function yydefault : Boolean;
+  begin
+    yyreject := false;
+    yyactchar := get_char;
+    if yyactchar<>#0 then
+      begin
+        put_char(yyactchar);
+        yydefault := true;
+      end
+    else
+      begin
+        yylstate := 1;
+        yydefault := false;
+      end;
+    yylastchar := yyactchar;
+  end(*yydefault*);
+
+procedure yyclear;
+  begin
+    bufptr := 0;
+    yysstate := 0;
+    yylstate := 1;
+    yylastchar := #0;
+    yytext := '';
+    yystext := '';
+  end(*yyclear*);
+
+begin
+  assign(yyinput, '');
+  assign(yyoutput, '');
+  reset(yyinput); rewrite(yyoutput);
+  yylineno := 0;
+  yyclear;
+end(*LexLib*).

+ 210 - 0
utils/h2pas/options.pas

@@ -0,0 +1,210 @@
+{
+    $Id$
+    Copyright (c) 1993-98 by Florian Klaempfl
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************}
+
+
+unit options;
+
+interface
+
+var
+   inputfilename, outputfilename : string; { Filenames }
+   LibFileName, unitname         : string; { external library name }
+   UseLib,                    { Append external to implementation ?  }
+   UseName,                   { Append 'libname name 'funcname ' }
+   UsePPOinters,              { Use P instead of ^ for pointers    }
+   EnumToConst,               { Write enumeration types as constants }
+   Win32headers,              { allows dec_specifier }
+   stripcomment,              { strip comments from inputfile }
+   PrependTypes : Boolean;    { Print T in front of type names ?   }
+   usevarparas : boolean;     { generate var parameters, when a pointer }
+                              { is passed                               }
+   includefile : boolean;     { creates an include file instead of a unit }
+   palmpilot : boolean;       { handling of PalmOS SYS_CALLs }
+
+Procedure ProcessOptions;
+
+Implementation
+
+Procedure Usage;
+
+begin
+  writeln ('Usage : ',paramstr(0),' [options]  filename');
+  writeln ('        Where [options] is one or more of:');
+  writeln ('        -o outputfilename  Specify the outputfilename');
+  writeln ('        -l libname         Specify the library name for external.');
+  writeln ('        -u unitname        Specify the name of the unit.');
+  writeln ('        -t                 Prepend typedef type names with T');
+  writeln ('        -p                 Use "P" instead of "^" for pointers.');
+  writeln ('        -d                 Use external;');
+  writeln ('        -D                 use external libname name ''func_name'';');
+  writeln ('        -e                 change enum type to list of constants.');
+  writeln ('        -s                 strip comments from inputfile.');
+  writeln ('        -v                 replace pointer parameters by call by');
+  writeln ('                           reference parameters');
+  writeln ('        -w                 special for win32 headers');
+  writeln ('        -i                 create include files (no unit header)');
+  writeln ('        -x                 handle SYS_TRAP of PalmOS header files');
+  halt (0); 
+end;
+
+Function ForceExtension(Const HStr,ext:String):String;
+{
+  Return a filename which certainly has the extension ext
+  (no dot in ext !!)
+}
+var
+  j : longint;
+begin
+  j:=length(Hstr);
+  while (j>0) and (Hstr[j]<>'.') do
+   dec(j);
+  if j=0 then
+   j:=255;
+  ForceExtension:=Copy(Hstr,1,j-1)+'.'+Ext;
+end;
+
+Procedure ProcessOptions;
+
+Var cp : string;
+    I : longint;
+
+Function GetNextParam (const Opt,Name : String) : string;
+
+begin
+ if i=paramcount then
+   begin
+   writeln ('Error : -',Opt,' : ',name,' expected');
+   halt(1);
+   end
+ else
+   begin
+   GetNextParam:=paramstr(i+1);
+   inc(i);
+   end;
+end;
+    
+begin
+  if paramcount=0 then
+    Usage;
+  inputfilename:='';
+  outputfilename:='';
+  LibFileName:='';
+  UnitName:='';
+  UseLib:=False;
+  UseName:=FAlse;
+  StripComment:=False;
+  UsePPointers:=False;
+  EnumToCOnst:=False;
+  usevarparas:=false;
+  palmpilot:=false;
+  includefile:=false;
+  i:=1;
+  while i<=paramcount do
+    begin
+    cp:=paramstr(i);
+    if cp[1]='-' then
+      case cp[2] of
+      'o' : outputfilename:=GetNextParam('o','outputfilename');
+      't' : PrependTypes := True;
+      'p' : UsePPointers := True;
+      'e' : EnumToConst  := True;
+      'd' : UseLib       := True;
+      'D' : begin
+            UseLib       := True;
+            usename      := True;
+            end;
+      's' : stripcomment:=true;
+      'l' : LibFileName:=GetNextParam ('l','libname');
+      'u' : UnitName:=GetNextParam ('u','unitname');
+      'v' : usevarparas:=true;
+      'i' : includefile:=true;
+      'w' : begin
+               Win32headers:=true;
+               UseLib:=true;
+               usename:=true;
+               usevarparas:=true;
+               LibFileName:='kernel32';
+            end;
+      'x' : palmpilot:=true;            
+      else
+        Writeln ('Illegal option : ',cp);
+      end
+    else
+      begin { filename }
+      if inputfilename<>'' then
+        begin
+        writeln ('Error : only one filename supported. Found also :',cp);
+        halt(1);
+        end;
+      inputfilename:=cp;
+      if outputfilename='' then
+        outputfilename:=ForceExtension (inputfilename,'pp');
+      end;
+    inc(i);
+    end;  
+  If inputfilename='' then Usage;
+  if UnitName='' then
+    begin
+    i:=pos('.',outputfilename)-1;
+    if i<=0 then
+      UnitName:=outputfilename
+    else
+      UnitName:=Copy(OutputFileName,1,i);
+    end;
+end;
+
+end.
+
+{
+   $Log$
+   Revision 1.1  1999-05-12 16:11:39  peter
+     * moved
+
+   Revision 1.10  1999/04/08 20:47:02  florian
+     * misplaced line in the help screen fixed
+
+   Revision 1.9  1998/09/04 17:26:33  pierre
+     * better packed field handling
+
+   Revision 1.8  1998/08/05 15:50:10  florian
+     * small problems with // comments fixed (invalid line counting)
+     + SYS_TRAP support for PalmOS
+     + switch -x for PalmOS
+     + switch -i to generate include files instead of units
+
+   Revision 1.7  1998/07/24 20:55:44  michael
+   * Fixed some minor bugs in Pierres stuff
+
+   Revision 1.6  1998/07/23 23:26:04  michael
+   + added -D option instead of -d, restored old -d
+
+   Revision 1.5  1998/06/08 08:13:47  pierre
+     + merged version of h2pas
+     + added -w for special win32 header directives
+
+   Revision 1.4  1998/04/27 12:06:40  michael
+   + Added GPL statement
+
+   Revision 1.3  1998/04/24 18:23:46  florian
+     + parameter -v added (replaces pointer parameters by call by reference
+       parameters)
+       void p(int *i) =>   procedure p(var i : longint);
+
+}

+ 707 - 0
utils/h2pas/scan.l

@@ -0,0 +1,707 @@
+%{
+{
+    $Id$
+    Copyright (c) 1993-98 by Florian Klaempfl
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************}
+
+
+unit scan;
+
+  interface
+
+  uses
+   strings,
+   lexlib,yacclib;
+
+    type
+       Char=system.char;
+       ttyp = (
+          t_id,
+          { p contains the string }
+          t_arraydef,
+          { }
+          t_pointerdef,
+          { p1 contains the definition
+            if in type overrider
+            or nothing for args
+          }
+          t_addrdef,
+
+          t_void,
+          { no field }
+          t_dec,
+          { }
+          t_declist,
+          { p1 is t_dec
+            next if exists }
+          t_memberdec,
+          { p1 is type specifier
+            p2 is declarator_list }
+          t_structdef,
+          { }
+          t_memberdeclist,
+          { p1 is memberdec
+            next is next if it exist }
+          t_procdef,
+          { }
+          t_uniondef,
+          { }
+          t_enumdef,
+          { }
+          t_enumlist,
+          { }
+          t_preop,
+          { p contains the operator string
+            p1 contains the right expr }
+          t_bop,
+          { p contains the operator string
+            p1 contains the left expr
+            p2 contains the right expr }
+          t_arg,
+          {
+            p1 contain the typedef
+            p2 the declarator (t_dec)
+          }
+          t_arglist,
+          { }
+          t_funexprlist,
+          { }
+          t_exprlist,
+          { p1 contains the expr
+            next contains the next if it exists }
+          t_ifexpr,
+          { p1 contains the condition expr
+            p2 contains the if branch
+            p3 contains the else branch }
+          t_funcname,
+          { p1 contains the function dname
+            p2 contains the funexprlist
+            p3 possibly contains the return type }
+          t_typespec,
+          { p1 is the type itself
+            p2 the typecast expr }
+          t_size_specifier,
+          { p1 expr for size }
+          t_default_value
+          { p1 expr for value }
+          );
+
+       {tdtyp = (dt_id,dt_one,dt_two,dt_three,dt_no,dt_uop,dt_bop);
+        obsolete removed }
+
+       presobject = ^tresobject;
+
+       tresobject = object
+          typ : ttyp;
+          p : pchar;
+          next : presobject;
+          p1,p2,p3 : presobject;
+          { dtyp : tdtyp; }
+          constructor init_no(t : ttyp);
+          constructor init_one(t : ttyp;_p1 : presobject);
+          constructor init_two(t : ttyp;_p1,_p2 : presobject);
+          constructor init_three(t : ttyp;_p1,_p2,_p3 : presobject);
+          constructor init_id(const s : string);
+          constructor init_bop(const s : string;_p1,_p2 : presobject);
+          constructor init_preop(const s : string;_p1 : presobject);
+          function str : string;
+          function strlength : byte;
+          function get_copy : presobject;
+          { can this ve considered as a constant ? }
+          function is_const : boolean;
+          destructor done;
+       end;
+
+     tblocktype = (bt_type,bt_const,bt_var,bt_func,bt_no);
+
+
+    var
+       infile : string;
+       textinfile,outfile : text;
+       c : char;
+       aktspace : string;
+       block_type : tblocktype;
+
+    const
+       in_define : boolean = false;
+       { 1 after define; 2 after the ID to print the first
+       separating space }
+       in_space_define : byte = 0;
+       arglevel : longint = 0;
+       prev_line : string = '';
+       last_source_line : string = 'Line number 0';
+
+    function yylex : integer;
+    function act_token : string;
+    procedure internalerror(i : integer);
+
+    procedure next_line;
+
+    function strpnew(const s : string) : pchar;
+
+  implementation
+    uses options,converu;
+
+    procedure internalerror(i : integer);
+      begin
+         writeln('Internal error ',i,' in line ',line_no);
+         halt(1);
+      end;
+
+    { keep the last source line }
+    procedure next_line;
+
+      begin
+         inc(line_no);
+         prev_line:=last_source_line;
+         readln(textinfile,last_source_line);
+      end;
+
+    procedure commenteof;
+      begin
+         writeln('unexpected EOF inside comment at line ',line_no);
+      end;
+
+    var         p : pchar;
+    function strpnew(const s : string) : pchar;
+      begin
+         getmem(p,length(s)+1);
+         strpcopy(p,s);
+         strpnew:=p;
+      end;
+
+    const
+       newline = #10;
+
+    constructor tresobject.init_preop(const s : string;_p1 : presobject);
+      begin
+         typ:=t_preop;
+         p:=strpnew(s);
+         p1:=_p1;
+         p2:=nil;
+         p3:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_bop(const s : string;_p1,_p2 : presobject);
+      begin
+         typ:=t_bop;
+         p:=strpnew(s);
+         p1:=_p1;
+         p2:=_p2;
+         p3:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_id(const s : string);
+      begin
+         typ:=t_id;
+         p:=strpnew(s);
+         p1:=nil;
+         p2:=nil;
+         p3:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_two(t : ttyp;_p1,_p2 : presobject);
+      begin
+         typ:=t;
+         p1:=_p1;
+         p2:=_p2;
+         p3:=nil;
+         p:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_three(t : ttyp;_p1,_p2,_p3 : presobject);
+      begin
+         typ:=t;
+         p1:=_p1;
+         p2:=_p2;
+         p3:=_p3;
+         p:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_one(t : ttyp;_p1 : presobject);
+      begin
+         typ:=t;
+         p1:=_p1;
+         p2:=nil;
+         p3:=nil;
+         next:=nil;
+         p:=nil;
+      end;
+
+    constructor tresobject.init_no(t : ttyp);
+      begin
+         typ:=t;
+         p:=nil;
+         p1:=nil;
+         p2:=nil;
+         p3:=nil;
+         next:=nil;
+      end;
+
+    function tresobject.str : string;
+
+      begin
+         str:=strpas(p);
+      end;
+
+    function tresobject.strlength : byte;
+
+      begin
+         if assigned(p) then
+           strlength:=strlen(p)
+         else
+           strlength:=0;
+      end;
+
+          { can this ve considered as a constant ? }
+    function tresobject.is_const : boolean;
+
+      begin
+         case typ of
+           t_id,t_void :
+             is_const:=true;
+           t_preop  :
+             is_const:= ((str='-') or (str=' not ')) and p1^.is_const;
+           t_bop  :
+             is_const:= p2^.is_const and p1^.is_const;
+         else
+           is_const:=false;
+         end;
+      end;
+
+    function tresobject.get_copy : presobject;
+      var
+         newres : presobject;
+      begin
+         newres:=new(presobject,init_no(typ));
+         if assigned(p) then
+           newres^.p:=strnew(p);
+         if assigned(p1) then
+           newres^.p1:=p1^.get_copy;
+         if assigned(p2) then
+           newres^.p2:=p2^.get_copy;
+         if assigned(p3) then
+           newres^.p3:=p3^.get_copy;
+         if assigned(next) then
+           newres^.next:=next^.get_copy;
+         get_copy:=newres;
+      end;
+
+    destructor tresobject.done;
+      begin
+         (* writeln('disposing ',byte(typ)); *)
+         if assigned(p)then strdispose(p);
+         if assigned(p1) then
+           dispose(p1,done);
+         if assigned(p2) then
+           dispose(p2,done);
+         if assigned(p3) then
+           dispose(p3,done);
+         if assigned(next) then
+           dispose(next,done);
+      end;
+%}
+
+D [0-9]
+%%
+
+"/*"                   begin
+                          if not stripcomment then
+                            write(outfile,aktspace,'{');
+                          repeat
+                            c:=get_char;
+                            case c of
+                               '*' : begin
+                                         c:=get_char;
+                                         if c='/' then
+                                           begin
+                                              if not stripcomment then
+                                                writeln(outfile,' }');
+                                              flush(outfile);
+                                              exit;
+                                           end
+                                         else
+                                           begin
+                                              if not stripcomment then
+                                                write(outfile,' ');
+                                              unget_char(c)
+                                           end;
+                                      end;
+                               newline : begin
+                                            next_line;
+                                            if not stripcomment then
+                                               begin
+                                               writeln(outfile);
+                                               write(outfile,aktspace);
+                                               end;
+                                         end;
+                               #0 : commenteof;
+                               else if not stripcomment then
+                                    write(outfile,c);
+                            end;
+                          until false;
+                          flush(outfile);
+                        end;
+
+"//"                   begin
+                          If not stripcomment then
+                             write(outfile,aktspace,'{');
+                          repeat
+                            c:=get_char;
+                            case c of
+                              newline : begin
+                                        unget_char(c);
+                                        if not stripcomment then
+                                          writeln(outfile,' }');
+                                        flush(outfile);
+                                        exit;
+                                        end;
+                               #0 : commenteof;
+                               else if not stripcomment then
+                                    write(outfile,c);
+                            flush(outfile);
+                            end;
+                          until false;
+                          flush(outfile);
+                        end;
+\"[^\"]*\"              return(CSTRING);
+\'[^\']*\'              return(CSTRING);
+"L"\"[^\"]*\"           if win32headers then
+                          return(CSTRING)
+                        else
+                          return(256);
+"L"\'[^\']*\'           if win32headers then
+                          return(CSTRING)
+                        else
+                          return(256);
+{D}*[U]?[L]?              begin
+                           if yytext[length(yytext)]='L' then
+                             dec(byte(yytext[0]));
+                           if yytext[length(yytext)]='U' then
+                             dec(byte(yytext[0]));
+                           return(NUMBER);
+                        end;
+"0x"[0-9A-Fa-f]*[U]?[L]?    begin
+                           (* handle pre- and postfixes *)
+                           if copy(yytext,1,2)='0x' then
+                             begin
+                                delete(yytext,1,2);
+                                yytext:='$'+yytext;
+                             end;
+                           if yytext[length(yytext)]='L' then
+                             dec(byte(yytext[0]));
+                           if yytext[length(yytext)]='U' then
+                             dec(byte(yytext[0]));
+                           return(NUMBER);
+                        end;
+
+{D}+(\.{D}+)?([Ee][+-]?{D}+)?
+                       begin
+                       return(NUMBER);
+                       end;
+
+"->"                    if in_define then
+                          return(DEREF)
+                        else
+                          return(256);
+"-"                     return(MINUS);
+"=="                    return(EQUAL);
+"!="                    return(UNEQUAL);
+">="                    return(GTE);
+"<="                    return(LTE);
+">>"                    return(_SHR);
+"##"                    return(STICK);
+"<<"                    return(_SHL);
+">"                     return(GT);
+"<"                     return(LT);
+"|"                     return(_OR);
+"&"                     return(_AND);
+"!"                     return(_NOT);
+"/"                     return(_SLASH);
+"+"                     return(_PLUS);
+"?"                     return(QUESTIONMARK);
+":"                     return(COLON);
+","                     return(COMMA);
+"["                     return(LECKKLAMMER);
+"]"                     return(RECKKLAMMER);
+"("                     begin
+                           inc(arglevel);
+                           return(LKLAMMER);
+                        end;
+")"                     begin
+                           dec(arglevel);
+                           return(RKLAMMER);
+                        end;
+"*"                     return(STAR);
+"..."                   return(ELLIPSIS);
+"."                     if in_define then
+                          return(POINT)
+                        else
+                          return(256);
+"="                     return(_ASSIGN);
+"extern"                return(EXTERN);
+"STDCALL"               if Win32headers then
+                          return(STDCALL)
+                        else
+                          return(ID);
+"CDECL"                 if not Win32headers then
+                          return(ID)
+                        else
+                          return(CDECL);
+"PASCAL"                            if not Win32headers then
+                          return(ID)
+                        else
+                          return(PASCAL);
+"PACKED"                            if not Win32headers then
+                          return(ID)
+                        else
+                          return(_PACKED);
+"WINAPI"                if not Win32headers then
+                          return(ID)
+                        else
+                          return(WINAPI);
+"SYS_TRAP"              if not palmpilot then
+                          return(ID)
+                        else
+                          return(SYS_TRAP);
+"WINGDIAPI"             if not Win32headers then
+                          return(ID)
+                        else
+                          return(WINGDIAPI);
+"CALLBACK"                       if not Win32headers then
+                          return(ID)
+                        else
+                          return(CALLBACK);
+"EXPENTRY"                       if not Win32headers then
+                          return(ID)
+                        else
+                          return(CALLBACK);
+
+"void"                  return(VOID);
+"VOID"                  return(VOID);
+"#ifdef __cplusplus"[ \t]*\n"extern \"C\" {"\n"#endif"
+                        writeln(outfile,'{ C++ extern C conditionnal removed }');
+"#ifdef __cplusplus"[ \t]*\n"}"\n"#endif"
+                        writeln(outfile,'{ C++ end of extern C conditionnal removed }');
+
+"#else"                 begin
+                           writeln(outfile,'{$else}');
+                           block_type:=bt_no;
+                           flush(outfile);
+                        end;
+"#endif"                begin
+                           writeln(outfile,'{$endif}');
+                           block_type:=bt_no;
+                           flush(outfile);
+                        end;
+"#elif"                begin
+                           write(outfile,'(*** was #elif ****)');
+                           write(outfile,'{$else');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'}');
+                           block_type:=bt_no;
+                           flush(outfile);
+                           next_line;
+                        end;
+"#undef"                begin
+                           write(outfile,'{$undef');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'}');
+                           flush(outfile);
+                           next_line;
+                        end;
+"#error"                begin
+                           write(outfile,'{$error');
+                           c:=get_char;
+                           while c<>newline do
+                             begin
+                                write(outfile,c);
+                                c:=get_char;
+                             end;
+                           writeln(outfile,'}');
+                           flush(outfile);
+                           next_line;
+                        end;
+
+"#include"              begin
+                           write(outfile,'{$include');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'}');
+                           flush(outfile);
+                           block_type:=bt_no;
+                           next_line;
+                        end;
+"#if"                   begin
+                           write(outfile,'{$if');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'}');
+                           flush(outfile);
+                           block_type:=bt_no;
+                           next_line;
+                        end;
+"#pragma"               begin
+                           write(outfile,'(** unsupported pragma');
+                           write(outfile,'#pragma');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'*)');
+                           flush(outfile);
+                           block_type:=bt_no;
+                           next_line;
+                        end;
+"#define"               begin
+                           in_define:=true;
+                           in_space_define:=1;
+                           return(DEFINE);
+                        end;
+"char"                  return(_CHAR);
+"union"                 return(UNION);
+"enum"                  return(ENUM);
+"struct"                return(STRUCT);
+"{"                     return(LGKLAMMER);
+"}"                     return(RGKLAMMER);
+"typedef"               return(TYPEDEF);
+"int"                   return(INT);
+"short"                 return(SHORT);
+"long"                  return(LONG);
+"unsigned"              return(UNSIGNED);
+"float"                 return(REAL);
+"const"                 return(_CONST);
+"CONST"                 return(_CONST);
+"FAR"                   return(_FAR);
+"far"                   return(_FAR);
+"NEAR"                   return(_NEAR);
+"near"                   return(_NEAR);
+"HUGE"                   return(_HUGE);
+"huge"                   return(_HUGE);
+[A-Za-z_][A-Za-z0-9_]*  begin
+                           if in_space_define=1 then
+                             in_space_define:=2;
+                           return(ID);
+                        end;
+";"                     return(SEMICOLON);
+[ \f\t]                 if arglevel=0 then
+                          if in_space_define=2 then
+                            begin
+                               in_space_define:=0;
+                               return(SPACE_DEFINE);
+                            end;
+\\\n                    begin
+                           next_line;
+                           if arglevel=0 then
+                             if in_space_define=2 then
+                               begin
+                                  in_space_define:=0;
+                                  return(SPACE_DEFINE);
+                               end;
+                        end;
+\n                      begin
+                           next_line;
+                           if in_define then
+                             begin
+                                 in_define:=false;
+                                 in_space_define:=0;
+                                 return(NEW_LINE);
+                             end;
+                        end;
+.                       begin
+                           writeln('Illegal character in line ',line_no);
+                           writeln(last_source_line);
+                           return(256 { error });
+                        end;
+%%
+
+    function act_token : string;
+      begin
+         act_token:=yytext;
+      end;
+
+Function ForceExtension(Const HStr,ext:String):String;
+{
+  Return a filename which certainly has the extension ext
+  (no dot in ext !!)
+}
+var
+  j : longint;
+begin
+  j:=length(Hstr);
+  while (j>0) and (Hstr[j]<>'.') do
+   dec(j);
+  if j=0 then
+   j:=255;
+  ForceExtension:=Copy(Hstr,1,j-1)+'.'+Ext;
+end;
+
+  begin
+     ProcessOptions;
+     line_no := 1;
+     assign(yyinput, inputfilename);
+     reset(yyinput);
+     assign(textinfile, inputfilename);
+     reset(textinfile);
+     readln(textinfile,last_source_line);
+     assign(outfile, outputfilename);
+     rewrite(outfile);
+     if not(includefile) then
+       begin
+          writeln(outfile,'unit ',unitname,';');
+          writeln(outfile);
+          writeln(outfile,'{  Automatically converted by H2PAS.EXE from '+inputfilename);
+          writeln(outfile,'   Utility made by Florian Klaempfl 25th-28th september 96');
+          writeln(outfile,'   Improvements made by Mark A. Malakanov 22nd-25th may 97 ');
+          writeln(outfile,'   Further improvements by Michael Van Canneyt, April 1998 ');
+          writeln(outfile,'   define handling and error recovery by Pierre Muller, June 1998 }');
+          writeln(outfile);
+          writeln(outfile);
+          writeln(outfile,'  interface');
+          writeln(outfile);
+          writeln(outfile,'  { C default packing is dword }');
+          writeln(outfile);
+          writeln(outfile,'{$PACKRECORDS 4}');
+       end;
+     if UsePPointers then
+       begin
+       { Define some pointers to basic pascal types }
+       writeln(outfile);
+       Writeln(outfile,' { Pointers to basic pascal types, inserted by h2pas conversion program.}');
+       Writeln(outfile,'  Type');
+       Writeln(outfile,'     PLongint  = ^Longint;');
+       Writeln(outfile,'     PByte     = ^Byte;');
+       Writeln(outfile,'     PWord     = ^Word;');
+       Writeln(outfile,'     PInteger  = ^Integer;');
+       Writeln(outfile,'     PCardinal = ^Cardinal;');
+       Writeln(outfile,'     PReal     = ^Real;');
+       Writeln(outfile,'     PDouble   = ^Double;');
+       Writeln(outfile);
+       end;
+  end.
+

+ 4705 - 0
utils/h2pas/scan.pas

@@ -0,0 +1,4705 @@
+
+(* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
+
+(* global definitions: *)
+{
+    $Id$
+    Copyright (c) 1993-98 by Florian Klaempfl
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************}
+
+
+unit scan;
+
+  interface
+
+  uses
+   strings,
+   lexlib,yacclib;
+
+    type
+       Char=system.char;
+       ttyp = (
+          t_id,
+          { p contains the string }
+          t_arraydef,
+          { }
+          t_pointerdef,
+          { p1 contains the definition
+            if in type overrider
+            or nothing for args
+          }
+          t_addrdef,
+          
+          t_void,
+          { no field }
+          t_dec,
+          { }
+          t_declist,
+          { p1 is t_dec
+            next if exists }
+          t_memberdec,
+          { p1 is type specifier
+            p2 is declarator_list }
+          t_structdef,
+          { }
+          t_memberdeclist,
+          { p1 is memberdec
+            next is next if it exist }
+          t_procdef,
+          { }
+          t_uniondef,
+          { }
+          t_enumdef,
+          { }
+          t_enumlist,
+          { }
+          t_preop,
+          { p contains the operator string
+            p1 contains the right expr }
+          t_bop,
+          { p contains the operator string
+            p1 contains the left expr
+            p2 contains the right expr }
+          t_arg,
+          {
+            p1 contain the typedef
+            p2 the declarator (t_dec)
+          }
+          t_arglist,
+          { }
+          t_funexprlist,
+          { }
+          t_exprlist,
+          { p1 contains the expr
+            next contains the next if it exists }
+          t_ifexpr,
+          { p1 contains the condition expr
+            p2 contains the if branch
+            p3 contains the else branch }
+          t_funcname,
+          { p1 contains the function dname
+            p2 contains the funexprlist
+            p3 possibly contains the return type }
+          t_typespec,
+          { p1 is the type itself
+            p2 the typecast expr }
+          t_size_specifier,
+          { p1 expr for size }
+          t_default_value
+          { p1 expr for value }
+          );
+
+       {tdtyp = (dt_id,dt_one,dt_two,dt_three,dt_no,dt_uop,dt_bop);
+        obsolete removed }
+        
+       presobject = ^tresobject;
+
+       tresobject = object
+          typ : ttyp;
+          p : pchar;
+          next : presobject;
+          p1,p2,p3 : presobject;
+          { dtyp : tdtyp; }
+          constructor init_no(t : ttyp);
+          constructor init_one(t : ttyp;_p1 : presobject);
+          constructor init_two(t : ttyp;_p1,_p2 : presobject);
+          constructor init_three(t : ttyp;_p1,_p2,_p3 : presobject);
+          constructor init_id(const s : string);
+          constructor init_bop(const s : string;_p1,_p2 : presobject);
+          constructor init_preop(const s : string;_p1 : presobject);
+          function str : string;
+          function strlength : byte;
+          function get_copy : presobject;
+          { can this ve considered as a constant ? }
+          function is_const : boolean;
+          destructor done;
+       end;
+       
+     tblocktype = (bt_type,bt_const,bt_var,bt_func,bt_no);
+
+
+    var
+       infile : string;
+       textinfile,outfile : text;
+       c : char;
+       aktspace : string;
+       block_type : tblocktype;
+
+    const
+       in_define : boolean = false;
+       { 1 after define; 2 after the ID to print the first
+       separating space }
+       in_space_define : byte = 0;
+       arglevel : longint = 0;
+       prev_line : string = '';
+       last_source_line : string = 'Line number 0';
+
+    function yylex : integer;
+    function act_token : string;
+    procedure internalerror(i : integer);
+
+    procedure next_line;
+    
+    function strpnew(const s : string) : pchar;
+
+  implementation
+    uses options,converu;
+
+    procedure internalerror(i : integer);
+      begin
+         writeln('Internal error ',i,' in line ',line_no);
+         halt(1);
+      end;
+
+    { keep the last source line }
+    procedure next_line;
+
+      begin
+         inc(line_no);
+         prev_line:=last_source_line;
+         readln(textinfile,last_source_line);
+      end;
+      
+    procedure commenteof;
+      begin
+         writeln('unexpected EOF inside comment at line ',line_no);
+      end;
+
+    var         p : pchar;
+    function strpnew(const s : string) : pchar;
+      begin
+         getmem(p,length(s)+1);
+         strpcopy(p,s);
+         strpnew:=p;
+      end;
+
+    const
+       newline = #10;
+
+    constructor tresobject.init_preop(const s : string;_p1 : presobject);
+      begin
+         typ:=t_preop;
+         p:=strpnew(s);
+         p1:=_p1;
+         p2:=nil;
+         p3:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_bop(const s : string;_p1,_p2 : presobject);
+      begin
+         typ:=t_bop;
+         p:=strpnew(s);
+         p1:=_p1;
+         p2:=_p2;
+         p3:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_id(const s : string);
+      begin
+         typ:=t_id;
+         p:=strpnew(s);
+         p1:=nil;
+         p2:=nil;
+         p3:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_two(t : ttyp;_p1,_p2 : presobject);
+      begin
+         typ:=t;
+         p1:=_p1;
+         p2:=_p2;
+         p3:=nil;
+         p:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_three(t : ttyp;_p1,_p2,_p3 : presobject);
+      begin
+         typ:=t;
+         p1:=_p1;
+         p2:=_p2;
+         p3:=_p3;
+         p:=nil;
+         next:=nil;
+      end;
+
+    constructor tresobject.init_one(t : ttyp;_p1 : presobject);
+      begin
+         typ:=t;
+         p1:=_p1;
+         p2:=nil;
+         p3:=nil;
+         next:=nil;
+         p:=nil;
+      end;
+
+    constructor tresobject.init_no(t : ttyp);
+      begin
+         typ:=t;
+         p:=nil;
+         p1:=nil;
+         p2:=nil;
+         p3:=nil;
+         next:=nil;
+      end;
+ 
+    function tresobject.str : string;
+
+      begin
+         str:=strpas(p);
+      end;
+
+    function tresobject.strlength : byte;
+
+      begin
+         if assigned(p) then
+           strlength:=strlen(p)
+         else
+           strlength:=0;
+      end;
+
+          { can this ve considered as a constant ? }
+    function tresobject.is_const : boolean;
+
+      begin
+         case typ of
+           t_id,t_void :
+             is_const:=true;
+           t_preop  :
+             is_const:= ((str='-') or (str=' not ')) and p1^.is_const;
+           t_bop  :
+             is_const:= p2^.is_const and p1^.is_const;
+         else
+           is_const:=false;
+         end;
+      end;
+      
+    function tresobject.get_copy : presobject;
+      var
+         newres : presobject;
+      begin
+         newres:=new(presobject,init_no(typ));
+         if assigned(p) then
+           newres^.p:=strnew(p);
+         if assigned(p1) then
+           newres^.p1:=p1^.get_copy;
+         if assigned(p2) then
+           newres^.p2:=p2^.get_copy;
+         if assigned(p3) then
+           newres^.p3:=p3^.get_copy;
+         if assigned(next) then
+           newres^.next:=next^.get_copy;
+         get_copy:=newres;
+      end;
+      
+    destructor tresobject.done;
+      begin
+         (* writeln('disposing ',byte(typ)); *)
+         if assigned(p)then strdispose(p);
+         if assigned(p1) then
+           dispose(p1,done);
+         if assigned(p2) then
+           dispose(p2,done);
+         if assigned(p3) then
+           dispose(p3,done);
+         if assigned(next) then
+           dispose(next,done);
+      end;
+
+
+function yylex : Integer;
+
+procedure yyaction ( yyruleno : Integer );
+  (* local definitions: *)
+
+begin
+  (* actions: *)
+  case yyruleno of
+  1:
+                       begin
+                          if not stripcomment then 
+                            write(outfile,aktspace,'{');
+                          repeat
+                            c:=get_char;
+                            case c of
+                               '*' : begin
+                                         c:=get_char;
+                                         if c='/' then
+                                           begin
+                                              if not stripcomment then
+                                                writeln(outfile,' }');
+                                              flush(outfile);
+                                              exit;
+                                           end
+                                         else
+                                           begin
+                                              if not stripcomment then
+                                                write(outfile,' ');
+                                              unget_char(c)
+                                           end;
+                                      end;
+                               newline : begin
+                                            next_line;
+                                            if not stripcomment then
+                                               begin
+                                               writeln(outfile);
+                                               write(outfile,aktspace);
+                                               end;
+                                         end;
+                               #0 : commenteof;
+                               else if not stripcomment then
+                                    write(outfile,c);
+                            end;
+                          until false;
+                          flush(outfile);
+                        end;
+
+  2:
+                       begin
+                          If not stripcomment then
+                             write(outfile,aktspace,'{');
+                          repeat
+                            c:=get_char; 
+                            case c of
+                              newline : begin
+                                        unget_char(c);
+                                        if not stripcomment then
+                                          writeln(outfile,' }');
+                                        flush(outfile);
+                                        exit;
+                                        end;
+                               #0 : commenteof;
+                               else if not stripcomment then
+                                    write(outfile,c);
+                            flush(outfile);
+                            end;
+                          until false;
+                          flush(outfile);
+                        end;
+  3:
+                        return(CSTRING);
+  4:
+                        return(CSTRING);
+  5:
+                        if win32headers then
+                          return(CSTRING)
+                        else
+                          return(256);
+  6:
+                        if win32headers then
+                          return(CSTRING)
+                        else
+                          return(256);
+  7:
+                          begin
+                           if yytext[length(yytext)]='L' then
+                             dec(byte(yytext[0]));
+                           if yytext[length(yytext)]='U' then
+                             dec(byte(yytext[0]));
+                           return(NUMBER);
+                        end;
+  8:
+                            begin
+                           (* handle pre- and postfixes *)
+                           if copy(yytext,1,2)='0x' then
+                             begin
+                                delete(yytext,1,2);
+                                yytext:='$'+yytext;
+                             end;
+                           if yytext[length(yytext)]='L' then
+                             dec(byte(yytext[0]));
+                           if yytext[length(yytext)]='U' then
+                             dec(byte(yytext[0]));
+                           return(NUMBER);
+                        end;
+
+  9:
+                              
+                       begin
+                       return(NUMBER);
+                       end; 
+
+  10:
+                        if in_define then
+                          return(DEREF)
+                        else
+                          return(256);
+  11:
+                        return(MINUS);
+  12:
+                        return(EQUAL);
+  13:
+                        return(UNEQUAL);
+  14:
+                        return(GTE);
+  15:
+                        return(LTE);
+  16:
+                        return(_SHR);
+  17:
+                        return(STICK);
+  18:
+                        return(_SHL);
+  19:
+                        return(GT);
+  20:
+                        return(LT);
+  21:
+                        return(_OR);
+  22:
+                        return(_AND);
+  23:
+                        return(_NOT);
+  24:
+                        return(_SLASH);
+  25:
+                        return(_PLUS);
+  26:
+                        return(QUESTIONMARK);
+  27:
+                        return(COLON);
+  28:
+                        return(COMMA);
+  29:
+                        return(LECKKLAMMER);
+  30:
+                        return(RECKKLAMMER);
+  31:
+                        begin
+                           inc(arglevel);
+                           return(LKLAMMER);
+                        end;
+  32:
+                        begin
+                           dec(arglevel);
+                           return(RKLAMMER);
+                        end;
+  33:
+                        return(STAR);
+  34:
+                        return(ELLIPSIS);
+  35:
+                        if in_define then
+                          return(POINT)
+                        else
+                          return(256);
+  36:
+                        return(_ASSIGN);
+  37:
+                        return(EXTERN);
+  38:
+                        if Win32headers then
+                          return(STDCALL)
+                        else
+                          return(ID);
+  39:
+                        if not Win32headers then
+                          return(ID)
+                        else
+                          return(CDECL);
+  40:
+                                    if not Win32headers then
+                          return(ID)
+                        else
+                          return(PASCAL);
+  41:
+                                    if not Win32headers then
+                          return(ID)
+                        else
+                          return(_PACKED);
+  42:
+                        if not Win32headers then
+                          return(ID)
+                        else
+                          return(WINAPI);
+  43:
+                        if not palmpilot then
+                          return(ID)
+                        else
+                          return(SYS_TRAP);
+  44:
+                        if not Win32headers then
+                          return(ID)
+                        else
+                          return(WINGDIAPI);
+  45:
+                                 if not Win32headers then
+                          return(ID)
+                        else
+                          return(CALLBACK);
+  46:
+                                 if not Win32headers then
+                          return(ID)
+                        else
+                          return(CALLBACK);
+
+  47:
+                        return(VOID);
+  48:
+                        return(VOID);
+  49:
+                                                      
+                        writeln(outfile,'{ C++ extern C conditionnal removed }');
+  50:
+                                         
+                        writeln(outfile,'{ C++ end of extern C conditionnal removed }');
+                        
+  51:
+                        begin
+                           writeln(outfile,'{$else}');
+                           block_type:=bt_no;
+                           flush(outfile);
+                        end;
+  52:
+                        begin
+                           writeln(outfile,'{$endif}');
+                           block_type:=bt_no;
+                           flush(outfile);
+                        end;
+  53:
+                       begin
+                           write(outfile,'(*** was #elif ****)');
+                           write(outfile,'{$else');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'}');
+                           block_type:=bt_no;
+                           flush(outfile);
+                           next_line;
+                        end;
+  54:
+                        begin
+                           write(outfile,'{$undef');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'}');
+                           flush(outfile);
+                           next_line;
+                        end;
+  55:
+                        begin
+                           write(outfile,'{$error');
+                           c:=get_char;
+                           while c<>newline do
+                             begin
+                                write(outfile,c);
+                                c:=get_char;
+                             end;
+                           writeln(outfile,'}');
+                           flush(outfile);
+                           next_line;
+                        end;
+                        
+  56:
+                        begin
+                           write(outfile,'{$include');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'}');
+                           flush(outfile);
+                           block_type:=bt_no;
+                           next_line;
+                        end;
+  57:
+                        begin
+                           write(outfile,'{$if');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'}');
+                           flush(outfile);
+                           block_type:=bt_no;
+                           next_line;
+                        end;
+  58:
+                        begin
+                           write(outfile,'(** unsupported pragma');
+                           write(outfile,'#pragma');
+                                          c:=get_char;
+                           while c<>newline do
+                             begin write(outfile,c);c:=get_char;end;
+                           writeln(outfile,'*)');
+                           flush(outfile);
+                           block_type:=bt_no;
+                           next_line;
+                        end;
+  59:
+                        begin
+                           in_define:=true;
+                           in_space_define:=1;
+                           return(DEFINE);
+                        end;
+  60:
+                        return(_CHAR);
+  61:
+                        return(UNION);
+  62:
+                        return(ENUM);
+  63:
+                        return(STRUCT);
+  64:
+                        return(LGKLAMMER);
+  65:
+                        return(RGKLAMMER);
+  66:
+                        return(TYPEDEF);
+  67:
+                        return(INT);
+  68:
+                        return(SHORT);
+  69:
+                        return(LONG);
+  70:
+                        return(UNSIGNED);
+  71:
+                        return(REAL);
+  72:
+                        return(_CONST);
+  73:
+                        return(_CONST);
+  74:
+                        return(_FAR);
+  75:
+                        return(_FAR);
+  76:
+                         return(_NEAR);
+  77:
+                         return(_NEAR);
+  78:
+                         return(_HUGE);
+  79:
+                         return(_HUGE);
+  80:
+                        begin
+                           if in_space_define=1 then
+                             in_space_define:=2;
+                           return(ID);
+                        end;
+  81:
+                        return(SEMICOLON);
+  82:
+                        if arglevel=0 then
+                          if in_space_define=2 then
+                            begin
+                               in_space_define:=0;
+                               return(SPACE_DEFINE);
+                            end;
+  83:
+                        begin
+                           next_line;
+                           if arglevel=0 then
+                             if in_space_define=2 then
+                               begin
+                                  in_space_define:=0;
+                                  return(SPACE_DEFINE);
+                               end;
+                        end;
+  84:
+                        begin
+                           next_line;
+                           if in_define then
+                             begin
+                                 in_define:=false;
+                                 in_space_define:=0;
+                                 return(NEW_LINE);
+                             end;
+                        end;
+  85:
+                        begin
+                           writeln('Illegal character in line ',line_no);
+                           writeln(last_source_line);
+                           return(256 { error });
+                        end;
+  end;
+end(*yyaction*);
+
+(* DFA table: *)
+
+type YYTRec = record
+                cc : set of Char;
+                s  : Integer;
+              end;
+
+const
+
+yynmarks   = 301;
+yynmatches = 301;
+yyntrans   = 522;
+yynstates  = 297;
+
+yyk : array [1..yynmarks] of Integer = (
+  { 0: }
+  7,
+  { 1: }
+  7,
+  { 2: }
+  24,
+  85,
+  { 3: }
+  85,
+  { 4: }
+  85,
+  { 5: }
+  7,
+  80,
+  85,
+  { 6: }
+  7,
+  9,
+  85,
+  { 7: }
+  7,
+  80,
+  85,
+  { 8: }
+  7,
+  9,
+  85,
+  { 9: }
+  11,
+  85,
+  { 10: }
+  36,
+  85,
+  { 11: }
+  23,
+  85,
+  { 12: }
+  19,
+  85,
+  { 13: }
+  20,
+  85,
+  { 14: }
+  85,
+  { 15: }
+  21,
+  85,
+  { 16: }
+  22,
+  85,
+  { 17: }
+  25,
+  85,
+  { 18: }
+  26,
+  85,
+  { 19: }
+  27,
+  85,
+  { 20: }
+  28,
+  85,
+  { 21: }
+  29,
+  85,
+  { 22: }
+  30,
+  85,
+  { 23: }
+  31,
+  85,
+  { 24: }
+  32,
+  85,
+  { 25: }
+  33,
+  85,
+  { 26: }
+  35,
+  85,
+  { 27: }
+  80,
+  85,
+  { 28: }
+  80,
+  85,
+  { 29: }
+  80,
+  85,
+  { 30: }
+  80,
+  85,
+  { 31: }
+  80,
+  85,
+  { 32: }
+  80,
+  85,
+  { 33: }
+  80,
+  85,
+  { 34: }
+  80,
+  85,
+  { 35: }
+  80,
+  85,
+  { 36: }
+  80,
+  85,
+  { 37: }
+  80,
+  85,
+  { 38: }
+  64,
+  85,
+  { 39: }
+  65,
+  85,
+  { 40: }
+  80,
+  85,
+  { 41: }
+  80,
+  85,
+  { 42: }
+  80,
+  85,
+  { 43: }
+  80,
+  85,
+  { 44: }
+  80,
+  85,
+  { 45: }
+  80,
+  85,
+  { 46: }
+  80,
+  85,
+  { 47: }
+  80,
+  85,
+  { 48: }
+  80,
+  85,
+  { 49: }
+  80,
+  85,
+  { 50: }
+  81,
+  85,
+  { 51: }
+  82,
+  85,
+  { 52: }
+  85,
+  { 53: }
+  84,
+  { 54: }
+  85,
+  { 55: }
+  1,
+  { 56: }
+  2,
+  { 57: }
+  { 58: }
+  3,
+  { 59: }
+  { 60: }
+  4,
+  { 61: }
+  { 62: }
+  { 63: }
+  80,
+  { 64: }
+  7,
+  9,
+  { 65: }
+  7,
+  { 66: }
+  7,
+  { 67: }
+  { 68: }
+  { 69: }
+  7,
+  80,
+  { 70: }
+  8,
+  { 71: }
+  10,
+  { 72: }
+  12,
+  { 73: }
+  13,
+  { 74: }
+  14,
+  { 75: }
+  16,
+  { 76: }
+  15,
+  { 77: }
+  18,
+  { 78: }
+  17,
+  { 79: }
+  { 80: }
+  { 81: }
+  { 82: }
+  { 83: }
+  { 84: }
+  { 85: }
+  80,
+  { 86: }
+  80,
+  { 87: }
+  80,
+  { 88: }
+  80,
+  { 89: }
+  80,
+  { 90: }
+  80,
+  { 91: }
+  80,
+  { 92: }
+  80,
+  { 93: }
+  80,
+  { 94: }
+  80,
+  { 95: }
+  80,
+  { 96: }
+  80,
+  { 97: }
+  80,
+  { 98: }
+  80,
+  { 99: }
+  80,
+  { 100: }
+  80,
+  { 101: }
+  80,
+  { 102: }
+  80,
+  { 103: }
+  80,
+  { 104: }
+  80,
+  { 105: }
+  80,
+  { 106: }
+  80,
+  { 107: }
+  80,
+  { 108: }
+  80,
+  { 109: }
+  80,
+  { 110: }
+  80,
+  { 111: }
+  80,
+  { 112: }
+  83,
+  { 113: }
+  5,
+  { 114: }
+  6,
+  { 115: }
+  9,
+  { 116: }
+  { 117: }
+  9,
+  { 118: }
+  8,
+  { 119: }
+  8,
+  { 120: }
+  57,
+  { 121: }
+  { 122: }
+  { 123: }
+  { 124: }
+  { 125: }
+  { 126: }
+  { 127: }
+  { 128: }
+  34,
+  { 129: }
+  80,
+  { 130: }
+  80,
+  { 131: }
+  80,
+  { 132: }
+  80,
+  { 133: }
+  80,
+  { 134: }
+  80,
+  { 135: }
+  80,
+  { 136: }
+  80,
+  { 137: }
+  80,
+  { 138: }
+  80,
+  { 139: }
+  80,
+  { 140: }
+  80,
+  { 141: }
+  80,
+  { 142: }
+  80,
+  { 143: }
+  80,
+  { 144: }
+  80,
+  { 145: }
+  80,
+  { 146: }
+  80,
+  { 147: }
+  80,
+  { 148: }
+  80,
+  { 149: }
+  67,
+  80,
+  { 150: }
+  80,
+  { 151: }
+  80,
+  { 152: }
+  75,
+  80,
+  { 153: }
+  74,
+  80,
+  { 154: }
+  80,
+  { 155: }
+  80,
+  { 156: }
+  80,
+  { 157: }
+  80,
+  { 158: }
+  { 159: }
+  { 160: }
+  { 161: }
+  { 162: }
+  { 163: }
+  { 164: }
+  { 165: }
+  { 166: }
+  { 167: }
+  80,
+  { 168: }
+  62,
+  80,
+  { 169: }
+  80,
+  { 170: }
+  80,
+  { 171: }
+  80,
+  { 172: }
+  80,
+  { 173: }
+  80,
+  { 174: }
+  80,
+  { 175: }
+  80,
+  { 176: }
+  80,
+  { 177: }
+  80,
+  { 178: }
+  80,
+  { 179: }
+  47,
+  80,
+  { 180: }
+  48,
+  80,
+  { 181: }
+  60,
+  80,
+  { 182: }
+  80,
+  { 183: }
+  80,
+  { 184: }
+  80,
+  { 185: }
+  80,
+  { 186: }
+  80,
+  { 187: }
+  80,
+  { 188: }
+  69,
+  80,
+  { 189: }
+  80,
+  { 190: }
+  76,
+  80,
+  { 191: }
+  77,
+  80,
+  { 192: }
+  78,
+  80,
+  { 193: }
+  79,
+  80,
+  { 194: }
+  { 195: }
+  { 196: }
+  51,
+  { 197: }
+  53,
+  { 198: }
+  { 199: }
+  { 200: }
+  { 201: }
+  { 202: }
+  { 203: }
+  80,
+  { 204: }
+  80,
+  { 205: }
+  80,
+  { 206: }
+  39,
+  80,
+  { 207: }
+  80,
+  { 208: }
+  73,
+  80,
+  { 209: }
+  80,
+  { 210: }
+  80,
+  { 211: }
+  80,
+  { 212: }
+  80,
+  { 213: }
+  80,
+  { 214: }
+  72,
+  80,
+  { 215: }
+  61,
+  80,
+  { 216: }
+  80,
+  { 217: }
+  80,
+  { 218: }
+  68,
+  80,
+  { 219: }
+  80,
+  { 220: }
+  71,
+  80,
+  { 221: }
+  { 222: }
+  { 223: }
+  52,
+  { 224: }
+  55,
+  { 225: }
+  54,
+  { 226: }
+  { 227: }
+  { 228: }
+  37,
+  80,
+  { 229: }
+  80,
+  { 230: }
+  80,
+  { 231: }
+  80,
+  { 232: }
+  40,
+  80,
+  { 233: }
+  41,
+  80,
+  { 234: }
+  42,
+  80,
+  { 235: }
+  80,
+  { 236: }
+  80,
+  { 237: }
+  80,
+  { 238: }
+  63,
+  80,
+  { 239: }
+  80,
+  { 240: }
+  { 241: }
+  { 242: }
+  58,
+  { 243: }
+  59,
+  { 244: }
+  38,
+  80,
+  { 245: }
+  80,
+  { 246: }
+  80,
+  { 247: }
+  80,
+  { 248: }
+  80,
+  { 249: }
+  80,
+  { 250: }
+  66,
+  80,
+  { 251: }
+  { 252: }
+  56,
+  { 253: }
+  43,
+  80,
+  { 254: }
+  45,
+  80,
+  { 255: }
+  80,
+  { 256: }
+  46,
+  80,
+  { 257: }
+  70,
+  80,
+  { 258: }
+  { 259: }
+  44,
+  80,
+  { 260: }
+  { 261: }
+  { 262: }
+  { 263: }
+  { 264: }
+  { 265: }
+  { 266: }
+  { 267: }
+  { 268: }
+  { 269: }
+  { 270: }
+  { 271: }
+  { 272: }
+  { 273: }
+  { 274: }
+  { 275: }
+  { 276: }
+  { 277: }
+  { 278: }
+  { 279: }
+  { 280: }
+  { 281: }
+  { 282: }
+  { 283: }
+  { 284: }
+  { 285: }
+  50,
+  { 286: }
+  { 287: }
+  { 288: }
+  { 289: }
+  { 290: }
+  { 291: }
+  { 292: }
+  { 293: }
+  { 294: }
+  { 295: }
+  { 296: }
+  49
+);
+
+yym : array [1..yynmatches] of Integer = (
+{ 0: }
+  7,
+{ 1: }
+  7,
+{ 2: }
+  24,
+  85,
+{ 3: }
+  85,
+{ 4: }
+  85,
+{ 5: }
+  7,
+  80,
+  85,
+{ 6: }
+  7,
+  9,
+  85,
+{ 7: }
+  7,
+  80,
+  85,
+{ 8: }
+  7,
+  9,
+  85,
+{ 9: }
+  11,
+  85,
+{ 10: }
+  36,
+  85,
+{ 11: }
+  23,
+  85,
+{ 12: }
+  19,
+  85,
+{ 13: }
+  20,
+  85,
+{ 14: }
+  85,
+{ 15: }
+  21,
+  85,
+{ 16: }
+  22,
+  85,
+{ 17: }
+  25,
+  85,
+{ 18: }
+  26,
+  85,
+{ 19: }
+  27,
+  85,
+{ 20: }
+  28,
+  85,
+{ 21: }
+  29,
+  85,
+{ 22: }
+  30,
+  85,
+{ 23: }
+  31,
+  85,
+{ 24: }
+  32,
+  85,
+{ 25: }
+  33,
+  85,
+{ 26: }
+  35,
+  85,
+{ 27: }
+  80,
+  85,
+{ 28: }
+  80,
+  85,
+{ 29: }
+  80,
+  85,
+{ 30: }
+  80,
+  85,
+{ 31: }
+  80,
+  85,
+{ 32: }
+  80,
+  85,
+{ 33: }
+  80,
+  85,
+{ 34: }
+  80,
+  85,
+{ 35: }
+  80,
+  85,
+{ 36: }
+  80,
+  85,
+{ 37: }
+  80,
+  85,
+{ 38: }
+  64,
+  85,
+{ 39: }
+  65,
+  85,
+{ 40: }
+  80,
+  85,
+{ 41: }
+  80,
+  85,
+{ 42: }
+  80,
+  85,
+{ 43: }
+  80,
+  85,
+{ 44: }
+  80,
+  85,
+{ 45: }
+  80,
+  85,
+{ 46: }
+  80,
+  85,
+{ 47: }
+  80,
+  85,
+{ 48: }
+  80,
+  85,
+{ 49: }
+  80,
+  85,
+{ 50: }
+  81,
+  85,
+{ 51: }
+  82,
+  85,
+{ 52: }
+  85,
+{ 53: }
+  84,
+{ 54: }
+  85,
+{ 55: }
+  1,
+{ 56: }
+  2,
+{ 57: }
+{ 58: }
+  3,
+{ 59: }
+{ 60: }
+  4,
+{ 61: }
+{ 62: }
+{ 63: }
+  80,
+{ 64: }
+  7,
+  9,
+{ 65: }
+  7,
+{ 66: }
+  7,
+{ 67: }
+{ 68: }
+{ 69: }
+  7,
+  80,
+{ 70: }
+  8,
+{ 71: }
+  10,
+{ 72: }
+  12,
+{ 73: }
+  13,
+{ 74: }
+  14,
+{ 75: }
+  16,
+{ 76: }
+  15,
+{ 77: }
+  18,
+{ 78: }
+  17,
+{ 79: }
+{ 80: }
+{ 81: }
+{ 82: }
+{ 83: }
+{ 84: }
+{ 85: }
+  80,
+{ 86: }
+  80,
+{ 87: }
+  80,
+{ 88: }
+  80,
+{ 89: }
+  80,
+{ 90: }
+  80,
+{ 91: }
+  80,
+{ 92: }
+  80,
+{ 93: }
+  80,
+{ 94: }
+  80,
+{ 95: }
+  80,
+{ 96: }
+  80,
+{ 97: }
+  80,
+{ 98: }
+  80,
+{ 99: }
+  80,
+{ 100: }
+  80,
+{ 101: }
+  80,
+{ 102: }
+  80,
+{ 103: }
+  80,
+{ 104: }
+  80,
+{ 105: }
+  80,
+{ 106: }
+  80,
+{ 107: }
+  80,
+{ 108: }
+  80,
+{ 109: }
+  80,
+{ 110: }
+  80,
+{ 111: }
+  80,
+{ 112: }
+  83,
+{ 113: }
+  5,
+{ 114: }
+  6,
+{ 115: }
+  9,
+{ 116: }
+{ 117: }
+  9,
+{ 118: }
+  8,
+{ 119: }
+  8,
+{ 120: }
+  57,
+{ 121: }
+{ 122: }
+{ 123: }
+{ 124: }
+{ 125: }
+{ 126: }
+{ 127: }
+{ 128: }
+  34,
+{ 129: }
+  80,
+{ 130: }
+  80,
+{ 131: }
+  80,
+{ 132: }
+  80,
+{ 133: }
+  80,
+{ 134: }
+  80,
+{ 135: }
+  80,
+{ 136: }
+  80,
+{ 137: }
+  80,
+{ 138: }
+  80,
+{ 139: }
+  80,
+{ 140: }
+  80,
+{ 141: }
+  80,
+{ 142: }
+  80,
+{ 143: }
+  80,
+{ 144: }
+  80,
+{ 145: }
+  80,
+{ 146: }
+  80,
+{ 147: }
+  80,
+{ 148: }
+  80,
+{ 149: }
+  67,
+  80,
+{ 150: }
+  80,
+{ 151: }
+  80,
+{ 152: }
+  75,
+  80,
+{ 153: }
+  74,
+  80,
+{ 154: }
+  80,
+{ 155: }
+  80,
+{ 156: }
+  80,
+{ 157: }
+  80,
+{ 158: }
+{ 159: }
+{ 160: }
+{ 161: }
+{ 162: }
+{ 163: }
+{ 164: }
+{ 165: }
+{ 166: }
+{ 167: }
+  80,
+{ 168: }
+  62,
+  80,
+{ 169: }
+  80,
+{ 170: }
+  80,
+{ 171: }
+  80,
+{ 172: }
+  80,
+{ 173: }
+  80,
+{ 174: }
+  80,
+{ 175: }
+  80,
+{ 176: }
+  80,
+{ 177: }
+  80,
+{ 178: }
+  80,
+{ 179: }
+  47,
+  80,
+{ 180: }
+  48,
+  80,
+{ 181: }
+  60,
+  80,
+{ 182: }
+  80,
+{ 183: }
+  80,
+{ 184: }
+  80,
+{ 185: }
+  80,
+{ 186: }
+  80,
+{ 187: }
+  80,
+{ 188: }
+  69,
+  80,
+{ 189: }
+  80,
+{ 190: }
+  76,
+  80,
+{ 191: }
+  77,
+  80,
+{ 192: }
+  78,
+  80,
+{ 193: }
+  79,
+  80,
+{ 194: }
+{ 195: }
+{ 196: }
+  51,
+{ 197: }
+  53,
+{ 198: }
+{ 199: }
+{ 200: }
+{ 201: }
+{ 202: }
+{ 203: }
+  80,
+{ 204: }
+  80,
+{ 205: }
+  80,
+{ 206: }
+  39,
+  80,
+{ 207: }
+  80,
+{ 208: }
+  73,
+  80,
+{ 209: }
+  80,
+{ 210: }
+  80,
+{ 211: }
+  80,
+{ 212: }
+  80,
+{ 213: }
+  80,
+{ 214: }
+  72,
+  80,
+{ 215: }
+  61,
+  80,
+{ 216: }
+  80,
+{ 217: }
+  80,
+{ 218: }
+  68,
+  80,
+{ 219: }
+  80,
+{ 220: }
+  71,
+  80,
+{ 221: }
+{ 222: }
+{ 223: }
+  52,
+{ 224: }
+  55,
+{ 225: }
+  54,
+{ 226: }
+{ 227: }
+{ 228: }
+  37,
+  80,
+{ 229: }
+  80,
+{ 230: }
+  80,
+{ 231: }
+  80,
+{ 232: }
+  40,
+  80,
+{ 233: }
+  41,
+  80,
+{ 234: }
+  42,
+  80,
+{ 235: }
+  80,
+{ 236: }
+  80,
+{ 237: }
+  80,
+{ 238: }
+  63,
+  80,
+{ 239: }
+  80,
+{ 240: }
+{ 241: }
+{ 242: }
+  58,
+{ 243: }
+  59,
+{ 244: }
+  38,
+  80,
+{ 245: }
+  80,
+{ 246: }
+  80,
+{ 247: }
+  80,
+{ 248: }
+  80,
+{ 249: }
+  80,
+{ 250: }
+  66,
+  80,
+{ 251: }
+{ 252: }
+  56,
+{ 253: }
+  43,
+  80,
+{ 254: }
+  45,
+  80,
+{ 255: }
+  80,
+{ 256: }
+  46,
+  80,
+{ 257: }
+  70,
+  80,
+{ 258: }
+{ 259: }
+  44,
+  80,
+{ 260: }
+{ 261: }
+{ 262: }
+{ 263: }
+{ 264: }
+{ 265: }
+{ 266: }
+{ 267: }
+{ 268: }
+{ 269: }
+{ 270: }
+{ 271: }
+{ 272: }
+{ 273: }
+{ 274: }
+{ 275: }
+{ 276: }
+{ 277: }
+{ 278: }
+{ 279: }
+{ 280: }
+{ 281: }
+{ 282: }
+{ 283: }
+{ 284: }
+{ 285: }
+  50,
+{ 286: }
+{ 287: }
+{ 288: }
+{ 289: }
+{ 290: }
+{ 291: }
+{ 292: }
+{ 293: }
+{ 294: }
+{ 295: }
+{ 296: }
+  49
+);
+
+yyt : array [1..yyntrans] of YYTrec = (
+{ 0: }
+  ( cc: [ #1..#8,#11,#13..#31,'$','%','@','^','`','~'..#255 ]; s: 54),
+  ( cc: [ #9,#12,' ' ]; s: 51),
+  ( cc: [ #10 ]; s: 53),
+  ( cc: [ '!' ]; s: 11),
+  ( cc: [ '"' ]; s: 3),
+  ( cc: [ '#' ]; s: 14),
+  ( cc: [ '&' ]; s: 16),
+  ( cc: [ '''' ]; s: 4),
+  ( cc: [ '(' ]; s: 23),
+  ( cc: [ ')' ]; s: 24),
+  ( cc: [ '*' ]; s: 25),
+  ( cc: [ '+' ]; s: 17),
+  ( cc: [ ',' ]; s: 20),
+  ( cc: [ '-' ]; s: 9),
+  ( cc: [ '.' ]; s: 26),
+  ( cc: [ '/' ]; s: 2),
+  ( cc: [ '0' ]; s: 8),
+  ( cc: [ '1'..'9' ]; s: 6),
+  ( cc: [ ':' ]; s: 19),
+  ( cc: [ ';' ]; s: 50),
+  ( cc: [ '<' ]; s: 13),
+  ( cc: [ '=' ]; s: 10),
+  ( cc: [ '>' ]; s: 12),
+  ( cc: [ '?' ]; s: 18),
+  ( cc: [ 'A','B','D','G','I'..'K','M','O','Q','R',
+            'T','X'..'Z','_','a','b','d','g','j','k',
+            'm','o'..'r','w'..'z' ]; s: 49),
+  ( cc: [ 'C' ]; s: 29),
+  ( cc: [ 'E' ]; s: 32),
+  ( cc: [ 'F' ]; s: 44),
+  ( cc: [ 'H' ]; s: 47),
+  ( cc: [ 'L' ]; s: 5),
+  ( cc: [ 'N' ]; s: 45),
+  ( cc: [ 'P' ]; s: 30),
+  ( cc: [ 'S' ]; s: 28),
+  ( cc: [ 'U' ]; s: 7),
+  ( cc: [ 'V' ]; s: 34),
+  ( cc: [ 'W' ]; s: 31),
+  ( cc: [ '[' ]; s: 21),
+  ( cc: [ '\' ]; s: 52),
+  ( cc: [ ']' ]; s: 22),
+  ( cc: [ 'c' ]; s: 35),
+  ( cc: [ 'e' ]; s: 27),
+  ( cc: [ 'f' ]; s: 43),
+  ( cc: [ 'h' ]; s: 48),
+  ( cc: [ 'i' ]; s: 41),
+  ( cc: [ 'l' ]; s: 42),
+  ( cc: [ 'n' ]; s: 46),
+  ( cc: [ 's' ]; s: 37),
+  ( cc: [ 't' ]; s: 40),
+  ( cc: [ 'u' ]; s: 36),
+  ( cc: [ 'v' ]; s: 33),
+  ( cc: [ '{' ]; s: 38),
+  ( cc: [ '|' ]; s: 15),
+  ( cc: [ '}' ]; s: 39),
+{ 1: }
+  ( cc: [ #1..#8,#11,#13..#31,'$','%','@','^','`','~'..#255 ]; s: 54),
+  ( cc: [ #9,#12,' ' ]; s: 51),
+  ( cc: [ #10 ]; s: 53),
+  ( cc: [ '!' ]; s: 11),
+  ( cc: [ '"' ]; s: 3),
+  ( cc: [ '#' ]; s: 14),
+  ( cc: [ '&' ]; s: 16),
+  ( cc: [ '''' ]; s: 4),
+  ( cc: [ '(' ]; s: 23),
+  ( cc: [ ')' ]; s: 24),
+  ( cc: [ '*' ]; s: 25),
+  ( cc: [ '+' ]; s: 17),
+  ( cc: [ ',' ]; s: 20),
+  ( cc: [ '-' ]; s: 9),
+  ( cc: [ '.' ]; s: 26),
+  ( cc: [ '/' ]; s: 2),
+  ( cc: [ '0' ]; s: 8),
+  ( cc: [ '1'..'9' ]; s: 6),
+  ( cc: [ ':' ]; s: 19),
+  ( cc: [ ';' ]; s: 50),
+  ( cc: [ '<' ]; s: 13),
+  ( cc: [ '=' ]; s: 10),
+  ( cc: [ '>' ]; s: 12),
+  ( cc: [ '?' ]; s: 18),
+  ( cc: [ 'A','B','D','G','I'..'K','M','O','Q','R',
+            'T','X'..'Z','_','a','b','d','g','j','k',
+            'm','o'..'r','w'..'z' ]; s: 49),
+  ( cc: [ 'C' ]; s: 29),
+  ( cc: [ 'E' ]; s: 32),
+  ( cc: [ 'F' ]; s: 44),
+  ( cc: [ 'H' ]; s: 47),
+  ( cc: [ 'L' ]; s: 5),
+  ( cc: [ 'N' ]; s: 45),
+  ( cc: [ 'P' ]; s: 30),
+  ( cc: [ 'S' ]; s: 28),
+  ( cc: [ 'U' ]; s: 7),
+  ( cc: [ 'V' ]; s: 34),
+  ( cc: [ 'W' ]; s: 31),
+  ( cc: [ '[' ]; s: 21),
+  ( cc: [ '\' ]; s: 52),
+  ( cc: [ ']' ]; s: 22),
+  ( cc: [ 'c' ]; s: 35),
+  ( cc: [ 'e' ]; s: 27),
+  ( cc: [ 'f' ]; s: 43),
+  ( cc: [ 'h' ]; s: 48),
+  ( cc: [ 'i' ]; s: 41),
+  ( cc: [ 'l' ]; s: 42),
+  ( cc: [ 'n' ]; s: 46),
+  ( cc: [ 's' ]; s: 37),
+  ( cc: [ 't' ]; s: 40),
+  ( cc: [ 'u' ]; s: 36),
+  ( cc: [ 'v' ]; s: 33),
+  ( cc: [ '{' ]; s: 38),
+  ( cc: [ '|' ]; s: 15),
+  ( cc: [ '}' ]; s: 39),
+{ 2: }
+  ( cc: [ '*' ]; s: 55),
+  ( cc: [ '/' ]; s: 56),
+{ 3: }
+  ( cc: [ #1..'!','#'..#255 ]; s: 57),
+  ( cc: [ '"' ]; s: 58),
+{ 4: }
+  ( cc: [ #1..'&','('..#255 ]; s: 59),
+  ( cc: [ '''' ]; s: 60),
+{ 5: }
+  ( cc: [ '"' ]; s: 61),
+  ( cc: [ '''' ]; s: 62),
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 6: }
+  ( cc: [ '.' ]; s: 67),
+  ( cc: [ '0'..'9' ]; s: 64),
+  ( cc: [ 'E','e' ]; s: 68),
+  ( cc: [ 'L' ]; s: 66),
+  ( cc: [ 'U' ]; s: 65),
+{ 7: }
+  ( cc: [ '0'..'9','A'..'K','M'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'L' ]; s: 69),
+{ 8: }
+  ( cc: [ '.' ]; s: 67),
+  ( cc: [ '0'..'9' ]; s: 64),
+  ( cc: [ 'E','e' ]; s: 68),
+  ( cc: [ 'L' ]; s: 66),
+  ( cc: [ 'U' ]; s: 65),
+  ( cc: [ 'x' ]; s: 70),
+{ 9: }
+  ( cc: [ '>' ]; s: 71),
+{ 10: }
+  ( cc: [ '=' ]; s: 72),
+{ 11: }
+  ( cc: [ '=' ]; s: 73),
+{ 12: }
+  ( cc: [ '=' ]; s: 74),
+  ( cc: [ '>' ]; s: 75),
+{ 13: }
+  ( cc: [ '<' ]; s: 77),
+  ( cc: [ '=' ]; s: 76),
+{ 14: }
+  ( cc: [ '#' ]; s: 78),
+  ( cc: [ 'd' ]; s: 83),
+  ( cc: [ 'e' ]; s: 80),
+  ( cc: [ 'i' ]; s: 79),
+  ( cc: [ 'p' ]; s: 82),
+  ( cc: [ 'u' ]; s: 81),
+{ 15: }
+{ 16: }
+{ 17: }
+{ 18: }
+{ 19: }
+{ 20: }
+{ 21: }
+{ 22: }
+{ 23: }
+{ 24: }
+{ 25: }
+{ 26: }
+  ( cc: [ '.' ]; s: 84),
+{ 27: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'m','o'..'w','y','z' ]; s: 63),
+  ( cc: [ 'n' ]; s: 86),
+  ( cc: [ 'x' ]; s: 85),
+{ 28: }
+  ( cc: [ '0'..'9','A'..'S','U'..'X','Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'T' ]; s: 87),
+  ( cc: [ 'Y' ]; s: 88),
+{ 29: }
+  ( cc: [ '0'..'9','B','C','E'..'N','P'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 90),
+  ( cc: [ 'D' ]; s: 89),
+  ( cc: [ 'O' ]; s: 91),
+{ 30: }
+  ( cc: [ '0'..'9','B'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 92),
+{ 31: }
+  ( cc: [ '0'..'9','A'..'H','J'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'I' ]; s: 93),
+{ 32: }
+  ( cc: [ '0'..'9','A'..'W','Y','Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'X' ]; s: 94),
+{ 33: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'n','p'..'z' ]; s: 63),
+  ( cc: [ 'o' ]; s: 95),
+{ 34: }
+  ( cc: [ '0'..'9','A'..'N','P'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'O' ]; s: 96),
+{ 35: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'g','i'..'n','p'..'z' ]; s: 63),
+  ( cc: [ 'h' ]; s: 97),
+  ( cc: [ 'o' ]; s: 98),
+{ 36: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'m','o'..'z' ]; s: 63),
+  ( cc: [ 'n' ]; s: 99),
+{ 37: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'g','i'..'s','u'..'z' ]; s: 63),
+  ( cc: [ 'h' ]; s: 101),
+  ( cc: [ 't' ]; s: 100),
+{ 38: }
+{ 39: }
+{ 40: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'x','z' ]; s: 63),
+  ( cc: [ 'y' ]; s: 102),
+{ 41: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'m','o'..'z' ]; s: 63),
+  ( cc: [ 'n' ]; s: 103),
+{ 42: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'n','p'..'z' ]; s: 63),
+  ( cc: [ 'o' ]; s: 104),
+{ 43: }
+  ( cc: [ '0'..'9','A'..'Z','_','b'..'k','m'..'z' ]; s: 63),
+  ( cc: [ 'a' ]; s: 106),
+  ( cc: [ 'l' ]; s: 105),
+{ 44: }
+  ( cc: [ '0'..'9','B'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 107),
+{ 45: }
+  ( cc: [ '0'..'9','A'..'D','F'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'E' ]; s: 108),
+{ 46: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'d','f'..'z' ]; s: 63),
+  ( cc: [ 'e' ]; s: 109),
+{ 47: }
+  ( cc: [ '0'..'9','A'..'T','V'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'U' ]; s: 110),
+{ 48: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'t','v'..'z' ]; s: 63),
+  ( cc: [ 'u' ]; s: 111),
+{ 49: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 50: }
+{ 51: }
+{ 52: }
+  ( cc: [ #10 ]; s: 112),
+{ 53: }
+{ 54: }
+{ 55: }
+{ 56: }
+{ 57: }
+  ( cc: [ #1..'!','#'..#255 ]; s: 57),
+  ( cc: [ '"' ]; s: 58),
+{ 58: }
+{ 59: }
+  ( cc: [ #1..'&','('..#255 ]; s: 59),
+  ( cc: [ '''' ]; s: 60),
+{ 60: }
+{ 61: }
+  ( cc: [ #1..'!','#'..#255 ]; s: 61),
+  ( cc: [ '"' ]; s: 113),
+{ 62: }
+  ( cc: [ #1..'&','('..#255 ]; s: 62),
+  ( cc: [ '''' ]; s: 114),
+{ 63: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 64: }
+  ( cc: [ '.' ]; s: 67),
+  ( cc: [ '0'..'9' ]; s: 64),
+  ( cc: [ 'E','e' ]; s: 68),
+  ( cc: [ 'L' ]; s: 66),
+  ( cc: [ 'U' ]; s: 65),
+{ 65: }
+  ( cc: [ 'L' ]; s: 66),
+{ 66: }
+{ 67: }
+  ( cc: [ '0'..'9' ]; s: 115),
+{ 68: }
+  ( cc: [ '+','-' ]; s: 116),
+  ( cc: [ '0'..'9' ]; s: 117),
+{ 69: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 70: }
+  ( cc: [ '0'..'9','A'..'F','a'..'f' ]; s: 70),
+  ( cc: [ 'L' ]; s: 119),
+  ( cc: [ 'U' ]; s: 118),
+{ 71: }
+{ 72: }
+{ 73: }
+{ 74: }
+{ 75: }
+{ 76: }
+{ 77: }
+{ 78: }
+{ 79: }
+  ( cc: [ 'f' ]; s: 120),
+  ( cc: [ 'n' ]; s: 121),
+{ 80: }
+  ( cc: [ 'l' ]; s: 122),
+  ( cc: [ 'n' ]; s: 123),
+  ( cc: [ 'r' ]; s: 124),
+{ 81: }
+  ( cc: [ 'n' ]; s: 125),
+{ 82: }
+  ( cc: [ 'r' ]; s: 126),
+{ 83: }
+  ( cc: [ 'e' ]; s: 127),
+{ 84: }
+  ( cc: [ '.' ]; s: 128),
+{ 85: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'s','u'..'z' ]; s: 63),
+  ( cc: [ 't' ]; s: 129),
+{ 86: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'t','v'..'z' ]; s: 63),
+  ( cc: [ 'u' ]; s: 130),
+{ 87: }
+  ( cc: [ '0'..'9','A'..'C','E'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'D' ]; s: 131),
+{ 88: }
+  ( cc: [ '0'..'9','A'..'R','T'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'S' ]; s: 132),
+{ 89: }
+  ( cc: [ '0'..'9','A'..'D','F'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'E' ]; s: 133),
+{ 90: }
+  ( cc: [ '0'..'9','A'..'K','M'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'L' ]; s: 134),
+{ 91: }
+  ( cc: [ '0'..'9','A'..'M','O'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'N' ]; s: 135),
+{ 92: }
+  ( cc: [ '0'..'9','A','B','D'..'R','T'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'C' ]; s: 137),
+  ( cc: [ 'S' ]; s: 136),
+{ 93: }
+  ( cc: [ '0'..'9','A'..'M','O'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'N' ]; s: 138),
+{ 94: }
+  ( cc: [ '0'..'9','A'..'O','Q'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'P' ]; s: 139),
+{ 95: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'h','j'..'z' ]; s: 63),
+  ( cc: [ 'i' ]; s: 140),
+{ 96: }
+  ( cc: [ '0'..'9','A'..'H','J'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'I' ]; s: 141),
+{ 97: }
+  ( cc: [ '0'..'9','A'..'Z','_','b'..'z' ]; s: 63),
+  ( cc: [ 'a' ]; s: 142),
+{ 98: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'m','o'..'z' ]; s: 63),
+  ( cc: [ 'n' ]; s: 143),
+{ 99: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'h','j'..'r','t'..'z' ]; s: 63),
+  ( cc: [ 'i' ]; s: 144),
+  ( cc: [ 's' ]; s: 145),
+{ 100: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'q','s'..'z' ]; s: 63),
+  ( cc: [ 'r' ]; s: 146),
+{ 101: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'n','p'..'z' ]; s: 63),
+  ( cc: [ 'o' ]; s: 147),
+{ 102: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'o','q'..'z' ]; s: 63),
+  ( cc: [ 'p' ]; s: 148),
+{ 103: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'s','u'..'z' ]; s: 63),
+  ( cc: [ 't' ]; s: 149),
+{ 104: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'m','o'..'z' ]; s: 63),
+  ( cc: [ 'n' ]; s: 150),
+{ 105: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'n','p'..'z' ]; s: 63),
+  ( cc: [ 'o' ]; s: 151),
+{ 106: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'q','s'..'z' ]; s: 63),
+  ( cc: [ 'r' ]; s: 152),
+{ 107: }
+  ( cc: [ '0'..'9','A'..'Q','S'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'R' ]; s: 153),
+{ 108: }
+  ( cc: [ '0'..'9','B'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 154),
+{ 109: }
+  ( cc: [ '0'..'9','A'..'Z','_','b'..'z' ]; s: 63),
+  ( cc: [ 'a' ]; s: 155),
+{ 110: }
+  ( cc: [ '0'..'9','A'..'F','H'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'G' ]; s: 156),
+{ 111: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'f','h'..'z' ]; s: 63),
+  ( cc: [ 'g' ]; s: 157),
+{ 112: }
+{ 113: }
+{ 114: }
+{ 115: }
+  ( cc: [ '0'..'9' ]; s: 115),
+  ( cc: [ 'E','e' ]; s: 68),
+{ 116: }
+  ( cc: [ '0'..'9' ]; s: 117),
+{ 117: }
+  ( cc: [ '0'..'9' ]; s: 117),
+{ 118: }
+  ( cc: [ 'L' ]; s: 119),
+{ 119: }
+{ 120: }
+  ( cc: [ 'd' ]; s: 158),
+{ 121: }
+  ( cc: [ 'c' ]; s: 159),
+{ 122: }
+  ( cc: [ 'i' ]; s: 161),
+  ( cc: [ 's' ]; s: 160),
+{ 123: }
+  ( cc: [ 'd' ]; s: 162),
+{ 124: }
+  ( cc: [ 'r' ]; s: 163),
+{ 125: }
+  ( cc: [ 'd' ]; s: 164),
+{ 126: }
+  ( cc: [ 'a' ]; s: 165),
+{ 127: }
+  ( cc: [ 'f' ]; s: 166),
+{ 128: }
+{ 129: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'d','f'..'z' ]; s: 63),
+  ( cc: [ 'e' ]; s: 167),
+{ 130: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'l','n'..'z' ]; s: 63),
+  ( cc: [ 'm' ]; s: 168),
+{ 131: }
+  ( cc: [ '0'..'9','A','B','D'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'C' ]; s: 169),
+{ 132: }
+  ( cc: [ '0'..'9','A'..'Z','a'..'z' ]; s: 63),
+  ( cc: [ '_' ]; s: 170),
+{ 133: }
+  ( cc: [ '0'..'9','A','B','D'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'C' ]; s: 171),
+{ 134: }
+  ( cc: [ '0'..'9','A'..'K','M'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'L' ]; s: 172),
+{ 135: }
+  ( cc: [ '0'..'9','A'..'R','T'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'S' ]; s: 173),
+{ 136: }
+  ( cc: [ '0'..'9','A','B','D'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'C' ]; s: 174),
+{ 137: }
+  ( cc: [ '0'..'9','A'..'J','L'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'K' ]; s: 175),
+{ 138: }
+  ( cc: [ '0'..'9','B'..'F','H'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 176),
+  ( cc: [ 'G' ]; s: 177),
+{ 139: }
+  ( cc: [ '0'..'9','A'..'D','F'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'E' ]; s: 178),
+{ 140: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'c','e'..'z' ]; s: 63),
+  ( cc: [ 'd' ]; s: 179),
+{ 141: }
+  ( cc: [ '0'..'9','A'..'C','E'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'D' ]; s: 180),
+{ 142: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'q','s'..'z' ]; s: 63),
+  ( cc: [ 'r' ]; s: 181),
+{ 143: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'r','t'..'z' ]; s: 63),
+  ( cc: [ 's' ]; s: 182),
+{ 144: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'n','p'..'z' ]; s: 63),
+  ( cc: [ 'o' ]; s: 183),
+{ 145: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'h','j'..'z' ]; s: 63),
+  ( cc: [ 'i' ]; s: 184),
+{ 146: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'t','v'..'z' ]; s: 63),
+  ( cc: [ 'u' ]; s: 185),
+{ 147: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'q','s'..'z' ]; s: 63),
+  ( cc: [ 'r' ]; s: 186),
+{ 148: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'d','f'..'z' ]; s: 63),
+  ( cc: [ 'e' ]; s: 187),
+{ 149: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 150: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'f','h'..'z' ]; s: 63),
+  ( cc: [ 'g' ]; s: 188),
+{ 151: }
+  ( cc: [ '0'..'9','A'..'Z','_','b'..'z' ]; s: 63),
+  ( cc: [ 'a' ]; s: 189),
+{ 152: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 153: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 154: }
+  ( cc: [ '0'..'9','A'..'Q','S'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'R' ]; s: 190),
+{ 155: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'q','s'..'z' ]; s: 63),
+  ( cc: [ 'r' ]; s: 191),
+{ 156: }
+  ( cc: [ '0'..'9','A'..'D','F'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'E' ]; s: 192),
+{ 157: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'d','f'..'z' ]; s: 63),
+  ( cc: [ 'e' ]; s: 193),
+{ 158: }
+  ( cc: [ 'e' ]; s: 194),
+{ 159: }
+  ( cc: [ 'l' ]; s: 195),
+{ 160: }
+  ( cc: [ 'e' ]; s: 196),
+{ 161: }
+  ( cc: [ 'f' ]; s: 197),
+{ 162: }
+  ( cc: [ 'i' ]; s: 198),
+{ 163: }
+  ( cc: [ 'o' ]; s: 199),
+{ 164: }
+  ( cc: [ 'e' ]; s: 200),
+{ 165: }
+  ( cc: [ 'g' ]; s: 201),
+{ 166: }
+  ( cc: [ 'i' ]; s: 202),
+{ 167: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'q','s'..'z' ]; s: 63),
+  ( cc: [ 'r' ]; s: 203),
+{ 168: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 169: }
+  ( cc: [ '0'..'9','B'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 204),
+{ 170: }
+  ( cc: [ '0'..'9','A'..'S','U'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'T' ]; s: 205),
+{ 171: }
+  ( cc: [ '0'..'9','A'..'K','M'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'L' ]; s: 206),
+{ 172: }
+  ( cc: [ '0'..'9','A','C'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'B' ]; s: 207),
+{ 173: }
+  ( cc: [ '0'..'9','A'..'S','U'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'T' ]; s: 208),
+{ 174: }
+  ( cc: [ '0'..'9','B'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 209),
+{ 175: }
+  ( cc: [ '0'..'9','A'..'D','F'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'E' ]; s: 210),
+{ 176: }
+  ( cc: [ '0'..'9','A'..'O','Q'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'P' ]; s: 211),
+{ 177: }
+  ( cc: [ '0'..'9','A'..'C','E'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'D' ]; s: 212),
+{ 178: }
+  ( cc: [ '0'..'9','A'..'M','O'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'N' ]; s: 213),
+{ 179: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 180: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 181: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 182: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'s','u'..'z' ]; s: 63),
+  ( cc: [ 't' ]; s: 214),
+{ 183: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'m','o'..'z' ]; s: 63),
+  ( cc: [ 'n' ]; s: 215),
+{ 184: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'f','h'..'z' ]; s: 63),
+  ( cc: [ 'g' ]; s: 216),
+{ 185: }
+  ( cc: [ '0'..'9','A'..'Z','_','a','b','d'..'z' ]; s: 63),
+  ( cc: [ 'c' ]; s: 217),
+{ 186: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'s','u'..'z' ]; s: 63),
+  ( cc: [ 't' ]; s: 218),
+{ 187: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'c','e'..'z' ]; s: 63),
+  ( cc: [ 'd' ]; s: 219),
+{ 188: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 189: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'s','u'..'z' ]; s: 63),
+  ( cc: [ 't' ]; s: 220),
+{ 190: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 191: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 192: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 193: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 194: }
+  ( cc: [ 'f' ]; s: 221),
+{ 195: }
+  ( cc: [ 'u' ]; s: 222),
+{ 196: }
+{ 197: }
+{ 198: }
+  ( cc: [ 'f' ]; s: 223),
+{ 199: }
+  ( cc: [ 'r' ]; s: 224),
+{ 200: }
+  ( cc: [ 'f' ]; s: 225),
+{ 201: }
+  ( cc: [ 'm' ]; s: 226),
+{ 202: }
+  ( cc: [ 'n' ]; s: 227),
+{ 203: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'m','o'..'z' ]; s: 63),
+  ( cc: [ 'n' ]; s: 228),
+{ 204: }
+  ( cc: [ '0'..'9','A'..'K','M'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'L' ]; s: 229),
+{ 205: }
+  ( cc: [ '0'..'9','A'..'Q','S'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'R' ]; s: 230),
+{ 206: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 207: }
+  ( cc: [ '0'..'9','B'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 231),
+{ 208: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 209: }
+  ( cc: [ '0'..'9','A'..'K','M'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'L' ]; s: 232),
+{ 210: }
+  ( cc: [ '0'..'9','A'..'C','E'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'D' ]; s: 233),
+{ 211: }
+  ( cc: [ '0'..'9','A'..'H','J'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'I' ]; s: 234),
+{ 212: }
+  ( cc: [ '0'..'9','A'..'H','J'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'I' ]; s: 235),
+{ 213: }
+  ( cc: [ '0'..'9','A'..'S','U'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'T' ]; s: 236),
+{ 214: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 215: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 216: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'m','o'..'z' ]; s: 63),
+  ( cc: [ 'n' ]; s: 237),
+{ 217: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'s','u'..'z' ]; s: 63),
+  ( cc: [ 't' ]; s: 238),
+{ 218: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 219: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'d','f'..'z' ]; s: 63),
+  ( cc: [ 'e' ]; s: 239),
+{ 220: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 221: }
+  ( cc: [ ' ' ]; s: 240),
+{ 222: }
+  ( cc: [ 'd' ]; s: 241),
+{ 223: }
+{ 224: }
+{ 225: }
+{ 226: }
+  ( cc: [ 'a' ]; s: 242),
+{ 227: }
+  ( cc: [ 'e' ]; s: 243),
+{ 228: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 229: }
+  ( cc: [ '0'..'9','A'..'K','M'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'L' ]; s: 244),
+{ 230: }
+  ( cc: [ '0'..'9','B'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 245),
+{ 231: }
+  ( cc: [ '0'..'9','A','B','D'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'C' ]; s: 246),
+{ 232: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 233: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 234: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 235: }
+  ( cc: [ '0'..'9','B'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'A' ]; s: 247),
+{ 236: }
+  ( cc: [ '0'..'9','A'..'Q','S'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'R' ]; s: 248),
+{ 237: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'d','f'..'z' ]; s: 63),
+  ( cc: [ 'e' ]; s: 249),
+{ 238: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 239: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'e','g'..'z' ]; s: 63),
+  ( cc: [ 'f' ]; s: 250),
+{ 240: }
+  ( cc: [ '_' ]; s: 251),
+{ 241: }
+  ( cc: [ 'e' ]; s: 252),
+{ 242: }
+{ 243: }
+{ 244: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 245: }
+  ( cc: [ '0'..'9','A'..'O','Q'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'P' ]; s: 253),
+{ 246: }
+  ( cc: [ '0'..'9','A'..'J','L'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'K' ]; s: 254),
+{ 247: }
+  ( cc: [ '0'..'9','A'..'O','Q'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'P' ]; s: 255),
+{ 248: }
+  ( cc: [ '0'..'9','A'..'X','Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'Y' ]; s: 256),
+{ 249: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'c','e'..'z' ]; s: 63),
+  ( cc: [ 'd' ]; s: 257),
+{ 250: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 251: }
+  ( cc: [ '_' ]; s: 258),
+{ 252: }
+{ 253: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 254: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 255: }
+  ( cc: [ '0'..'9','A'..'H','J'..'Z','_','a'..'z' ]; s: 63),
+  ( cc: [ 'I' ]; s: 259),
+{ 256: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 257: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 258: }
+  ( cc: [ 'c' ]; s: 260),
+{ 259: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 63),
+{ 260: }
+  ( cc: [ 'p' ]; s: 261),
+{ 261: }
+  ( cc: [ 'l' ]; s: 262),
+{ 262: }
+  ( cc: [ 'u' ]; s: 263),
+{ 263: }
+  ( cc: [ 's' ]; s: 264),
+{ 264: }
+  ( cc: [ 'p' ]; s: 265),
+{ 265: }
+  ( cc: [ 'l' ]; s: 266),
+{ 266: }
+  ( cc: [ 'u' ]; s: 267),
+{ 267: }
+  ( cc: [ 's' ]; s: 268),
+{ 268: }
+  ( cc: [ #9,' ' ]; s: 268),
+  ( cc: [ #10 ]; s: 269),
+{ 269: }
+  ( cc: [ 'e' ]; s: 270),
+  ( cc: [ '}' ]; s: 271),
+{ 270: }
+  ( cc: [ 'x' ]; s: 272),
+{ 271: }
+  ( cc: [ #10 ]; s: 273),
+{ 272: }
+  ( cc: [ 't' ]; s: 274),
+{ 273: }
+  ( cc: [ '#' ]; s: 275),
+{ 274: }
+  ( cc: [ 'e' ]; s: 276),
+{ 275: }
+  ( cc: [ 'e' ]; s: 277),
+{ 276: }
+  ( cc: [ 'r' ]; s: 278),
+{ 277: }
+  ( cc: [ 'n' ]; s: 279),
+{ 278: }
+  ( cc: [ 'n' ]; s: 280),
+{ 279: }
+  ( cc: [ 'd' ]; s: 281),
+{ 280: }
+  ( cc: [ ' ' ]; s: 282),
+{ 281: }
+  ( cc: [ 'i' ]; s: 283),
+{ 282: }
+  ( cc: [ '"' ]; s: 284),
+{ 283: }
+  ( cc: [ 'f' ]; s: 285),
+{ 284: }
+  ( cc: [ 'C' ]; s: 286),
+{ 285: }
+{ 286: }
+  ( cc: [ '"' ]; s: 287),
+{ 287: }
+  ( cc: [ ' ' ]; s: 288),
+{ 288: }
+  ( cc: [ '{' ]; s: 289),
+{ 289: }
+  ( cc: [ #10 ]; s: 290),
+{ 290: }
+  ( cc: [ '#' ]; s: 291),
+{ 291: }
+  ( cc: [ 'e' ]; s: 292),
+{ 292: }
+  ( cc: [ 'n' ]; s: 293),
+{ 293: }
+  ( cc: [ 'd' ]; s: 294),
+{ 294: }
+  ( cc: [ 'i' ]; s: 295),
+{ 295: }
+  ( cc: [ 'f' ]; s: 296)
+{ 296: }
+);
+
+yykl : array [0..yynstates-1] of Integer = (
+{ 0: } 1,
+{ 1: } 2,
+{ 2: } 3,
+{ 3: } 5,
+{ 4: } 6,
+{ 5: } 7,
+{ 6: } 10,
+{ 7: } 13,
+{ 8: } 16,
+{ 9: } 19,
+{ 10: } 21,
+{ 11: } 23,
+{ 12: } 25,
+{ 13: } 27,
+{ 14: } 29,
+{ 15: } 30,
+{ 16: } 32,
+{ 17: } 34,
+{ 18: } 36,
+{ 19: } 38,
+{ 20: } 40,
+{ 21: } 42,
+{ 22: } 44,
+{ 23: } 46,
+{ 24: } 48,
+{ 25: } 50,
+{ 26: } 52,
+{ 27: } 54,
+{ 28: } 56,
+{ 29: } 58,
+{ 30: } 60,
+{ 31: } 62,
+{ 32: } 64,
+{ 33: } 66,
+{ 34: } 68,
+{ 35: } 70,
+{ 36: } 72,
+{ 37: } 74,
+{ 38: } 76,
+{ 39: } 78,
+{ 40: } 80,
+{ 41: } 82,
+{ 42: } 84,
+{ 43: } 86,
+{ 44: } 88,
+{ 45: } 90,
+{ 46: } 92,
+{ 47: } 94,
+{ 48: } 96,
+{ 49: } 98,
+{ 50: } 100,
+{ 51: } 102,
+{ 52: } 104,
+{ 53: } 105,
+{ 54: } 106,
+{ 55: } 107,
+{ 56: } 108,
+{ 57: } 109,
+{ 58: } 109,
+{ 59: } 110,
+{ 60: } 110,
+{ 61: } 111,
+{ 62: } 111,
+{ 63: } 111,
+{ 64: } 112,
+{ 65: } 114,
+{ 66: } 115,
+{ 67: } 116,
+{ 68: } 116,
+{ 69: } 116,
+{ 70: } 118,
+{ 71: } 119,
+{ 72: } 120,
+{ 73: } 121,
+{ 74: } 122,
+{ 75: } 123,
+{ 76: } 124,
+{ 77: } 125,
+{ 78: } 126,
+{ 79: } 127,
+{ 80: } 127,
+{ 81: } 127,
+{ 82: } 127,
+{ 83: } 127,
+{ 84: } 127,
+{ 85: } 127,
+{ 86: } 128,
+{ 87: } 129,
+{ 88: } 130,
+{ 89: } 131,
+{ 90: } 132,
+{ 91: } 133,
+{ 92: } 134,
+{ 93: } 135,
+{ 94: } 136,
+{ 95: } 137,
+{ 96: } 138,
+{ 97: } 139,
+{ 98: } 140,
+{ 99: } 141,
+{ 100: } 142,
+{ 101: } 143,
+{ 102: } 144,
+{ 103: } 145,
+{ 104: } 146,
+{ 105: } 147,
+{ 106: } 148,
+{ 107: } 149,
+{ 108: } 150,
+{ 109: } 151,
+{ 110: } 152,
+{ 111: } 153,
+{ 112: } 154,
+{ 113: } 155,
+{ 114: } 156,
+{ 115: } 157,
+{ 116: } 158,
+{ 117: } 158,
+{ 118: } 159,
+{ 119: } 160,
+{ 120: } 161,
+{ 121: } 162,
+{ 122: } 162,
+{ 123: } 162,
+{ 124: } 162,
+{ 125: } 162,
+{ 126: } 162,
+{ 127: } 162,
+{ 128: } 162,
+{ 129: } 163,
+{ 130: } 164,
+{ 131: } 165,
+{ 132: } 166,
+{ 133: } 167,
+{ 134: } 168,
+{ 135: } 169,
+{ 136: } 170,
+{ 137: } 171,
+{ 138: } 172,
+{ 139: } 173,
+{ 140: } 174,
+{ 141: } 175,
+{ 142: } 176,
+{ 143: } 177,
+{ 144: } 178,
+{ 145: } 179,
+{ 146: } 180,
+{ 147: } 181,
+{ 148: } 182,
+{ 149: } 183,
+{ 150: } 185,
+{ 151: } 186,
+{ 152: } 187,
+{ 153: } 189,
+{ 154: } 191,
+{ 155: } 192,
+{ 156: } 193,
+{ 157: } 194,
+{ 158: } 195,
+{ 159: } 195,
+{ 160: } 195,
+{ 161: } 195,
+{ 162: } 195,
+{ 163: } 195,
+{ 164: } 195,
+{ 165: } 195,
+{ 166: } 195,
+{ 167: } 195,
+{ 168: } 196,
+{ 169: } 198,
+{ 170: } 199,
+{ 171: } 200,
+{ 172: } 201,
+{ 173: } 202,
+{ 174: } 203,
+{ 175: } 204,
+{ 176: } 205,
+{ 177: } 206,
+{ 178: } 207,
+{ 179: } 208,
+{ 180: } 210,
+{ 181: } 212,
+{ 182: } 214,
+{ 183: } 215,
+{ 184: } 216,
+{ 185: } 217,
+{ 186: } 218,
+{ 187: } 219,
+{ 188: } 220,
+{ 189: } 222,
+{ 190: } 223,
+{ 191: } 225,
+{ 192: } 227,
+{ 193: } 229,
+{ 194: } 231,
+{ 195: } 231,
+{ 196: } 231,
+{ 197: } 232,
+{ 198: } 233,
+{ 199: } 233,
+{ 200: } 233,
+{ 201: } 233,
+{ 202: } 233,
+{ 203: } 233,
+{ 204: } 234,
+{ 205: } 235,
+{ 206: } 236,
+{ 207: } 238,
+{ 208: } 239,
+{ 209: } 241,
+{ 210: } 242,
+{ 211: } 243,
+{ 212: } 244,
+{ 213: } 245,
+{ 214: } 246,
+{ 215: } 248,
+{ 216: } 250,
+{ 217: } 251,
+{ 218: } 252,
+{ 219: } 254,
+{ 220: } 255,
+{ 221: } 257,
+{ 222: } 257,
+{ 223: } 257,
+{ 224: } 258,
+{ 225: } 259,
+{ 226: } 260,
+{ 227: } 260,
+{ 228: } 260,
+{ 229: } 262,
+{ 230: } 263,
+{ 231: } 264,
+{ 232: } 265,
+{ 233: } 267,
+{ 234: } 269,
+{ 235: } 271,
+{ 236: } 272,
+{ 237: } 273,
+{ 238: } 274,
+{ 239: } 276,
+{ 240: } 277,
+{ 241: } 277,
+{ 242: } 277,
+{ 243: } 278,
+{ 244: } 279,
+{ 245: } 281,
+{ 246: } 282,
+{ 247: } 283,
+{ 248: } 284,
+{ 249: } 285,
+{ 250: } 286,
+{ 251: } 288,
+{ 252: } 288,
+{ 253: } 289,
+{ 254: } 291,
+{ 255: } 293,
+{ 256: } 294,
+{ 257: } 296,
+{ 258: } 298,
+{ 259: } 298,
+{ 260: } 300,
+{ 261: } 300,
+{ 262: } 300,
+{ 263: } 300,
+{ 264: } 300,
+{ 265: } 300,
+{ 266: } 300,
+{ 267: } 300,
+{ 268: } 300,
+{ 269: } 300,
+{ 270: } 300,
+{ 271: } 300,
+{ 272: } 300,
+{ 273: } 300,
+{ 274: } 300,
+{ 275: } 300,
+{ 276: } 300,
+{ 277: } 300,
+{ 278: } 300,
+{ 279: } 300,
+{ 280: } 300,
+{ 281: } 300,
+{ 282: } 300,
+{ 283: } 300,
+{ 284: } 300,
+{ 285: } 300,
+{ 286: } 301,
+{ 287: } 301,
+{ 288: } 301,
+{ 289: } 301,
+{ 290: } 301,
+{ 291: } 301,
+{ 292: } 301,
+{ 293: } 301,
+{ 294: } 301,
+{ 295: } 301,
+{ 296: } 301
+);
+
+yykh : array [0..yynstates-1] of Integer = (
+{ 0: } 1,
+{ 1: } 2,
+{ 2: } 4,
+{ 3: } 5,
+{ 4: } 6,
+{ 5: } 9,
+{ 6: } 12,
+{ 7: } 15,
+{ 8: } 18,
+{ 9: } 20,
+{ 10: } 22,
+{ 11: } 24,
+{ 12: } 26,
+{ 13: } 28,
+{ 14: } 29,
+{ 15: } 31,
+{ 16: } 33,
+{ 17: } 35,
+{ 18: } 37,
+{ 19: } 39,
+{ 20: } 41,
+{ 21: } 43,
+{ 22: } 45,
+{ 23: } 47,
+{ 24: } 49,
+{ 25: } 51,
+{ 26: } 53,
+{ 27: } 55,
+{ 28: } 57,
+{ 29: } 59,
+{ 30: } 61,
+{ 31: } 63,
+{ 32: } 65,
+{ 33: } 67,
+{ 34: } 69,
+{ 35: } 71,
+{ 36: } 73,
+{ 37: } 75,
+{ 38: } 77,
+{ 39: } 79,
+{ 40: } 81,
+{ 41: } 83,
+{ 42: } 85,
+{ 43: } 87,
+{ 44: } 89,
+{ 45: } 91,
+{ 46: } 93,
+{ 47: } 95,
+{ 48: } 97,
+{ 49: } 99,
+{ 50: } 101,
+{ 51: } 103,
+{ 52: } 104,
+{ 53: } 105,
+{ 54: } 106,
+{ 55: } 107,
+{ 56: } 108,
+{ 57: } 108,
+{ 58: } 109,
+{ 59: } 109,
+{ 60: } 110,
+{ 61: } 110,
+{ 62: } 110,
+{ 63: } 111,
+{ 64: } 113,
+{ 65: } 114,
+{ 66: } 115,
+{ 67: } 115,
+{ 68: } 115,
+{ 69: } 117,
+{ 70: } 118,
+{ 71: } 119,
+{ 72: } 120,
+{ 73: } 121,
+{ 74: } 122,
+{ 75: } 123,
+{ 76: } 124,
+{ 77: } 125,
+{ 78: } 126,
+{ 79: } 126,
+{ 80: } 126,
+{ 81: } 126,
+{ 82: } 126,
+{ 83: } 126,
+{ 84: } 126,
+{ 85: } 127,
+{ 86: } 128,
+{ 87: } 129,
+{ 88: } 130,
+{ 89: } 131,
+{ 90: } 132,
+{ 91: } 133,
+{ 92: } 134,
+{ 93: } 135,
+{ 94: } 136,
+{ 95: } 137,
+{ 96: } 138,
+{ 97: } 139,
+{ 98: } 140,
+{ 99: } 141,
+{ 100: } 142,
+{ 101: } 143,
+{ 102: } 144,
+{ 103: } 145,
+{ 104: } 146,
+{ 105: } 147,
+{ 106: } 148,
+{ 107: } 149,
+{ 108: } 150,
+{ 109: } 151,
+{ 110: } 152,
+{ 111: } 153,
+{ 112: } 154,
+{ 113: } 155,
+{ 114: } 156,
+{ 115: } 157,
+{ 116: } 157,
+{ 117: } 158,
+{ 118: } 159,
+{ 119: } 160,
+{ 120: } 161,
+{ 121: } 161,
+{ 122: } 161,
+{ 123: } 161,
+{ 124: } 161,
+{ 125: } 161,
+{ 126: } 161,
+{ 127: } 161,
+{ 128: } 162,
+{ 129: } 163,
+{ 130: } 164,
+{ 131: } 165,
+{ 132: } 166,
+{ 133: } 167,
+{ 134: } 168,
+{ 135: } 169,
+{ 136: } 170,
+{ 137: } 171,
+{ 138: } 172,
+{ 139: } 173,
+{ 140: } 174,
+{ 141: } 175,
+{ 142: } 176,
+{ 143: } 177,
+{ 144: } 178,
+{ 145: } 179,
+{ 146: } 180,
+{ 147: } 181,
+{ 148: } 182,
+{ 149: } 184,
+{ 150: } 185,
+{ 151: } 186,
+{ 152: } 188,
+{ 153: } 190,
+{ 154: } 191,
+{ 155: } 192,
+{ 156: } 193,
+{ 157: } 194,
+{ 158: } 194,
+{ 159: } 194,
+{ 160: } 194,
+{ 161: } 194,
+{ 162: } 194,
+{ 163: } 194,
+{ 164: } 194,
+{ 165: } 194,
+{ 166: } 194,
+{ 167: } 195,
+{ 168: } 197,
+{ 169: } 198,
+{ 170: } 199,
+{ 171: } 200,
+{ 172: } 201,
+{ 173: } 202,
+{ 174: } 203,
+{ 175: } 204,
+{ 176: } 205,
+{ 177: } 206,
+{ 178: } 207,
+{ 179: } 209,
+{ 180: } 211,
+{ 181: } 213,
+{ 182: } 214,
+{ 183: } 215,
+{ 184: } 216,
+{ 185: } 217,
+{ 186: } 218,
+{ 187: } 219,
+{ 188: } 221,
+{ 189: } 222,
+{ 190: } 224,
+{ 191: } 226,
+{ 192: } 228,
+{ 193: } 230,
+{ 194: } 230,
+{ 195: } 230,
+{ 196: } 231,
+{ 197: } 232,
+{ 198: } 232,
+{ 199: } 232,
+{ 200: } 232,
+{ 201: } 232,
+{ 202: } 232,
+{ 203: } 233,
+{ 204: } 234,
+{ 205: } 235,
+{ 206: } 237,
+{ 207: } 238,
+{ 208: } 240,
+{ 209: } 241,
+{ 210: } 242,
+{ 211: } 243,
+{ 212: } 244,
+{ 213: } 245,
+{ 214: } 247,
+{ 215: } 249,
+{ 216: } 250,
+{ 217: } 251,
+{ 218: } 253,
+{ 219: } 254,
+{ 220: } 256,
+{ 221: } 256,
+{ 222: } 256,
+{ 223: } 257,
+{ 224: } 258,
+{ 225: } 259,
+{ 226: } 259,
+{ 227: } 259,
+{ 228: } 261,
+{ 229: } 262,
+{ 230: } 263,
+{ 231: } 264,
+{ 232: } 266,
+{ 233: } 268,
+{ 234: } 270,
+{ 235: } 271,
+{ 236: } 272,
+{ 237: } 273,
+{ 238: } 275,
+{ 239: } 276,
+{ 240: } 276,
+{ 241: } 276,
+{ 242: } 277,
+{ 243: } 278,
+{ 244: } 280,
+{ 245: } 281,
+{ 246: } 282,
+{ 247: } 283,
+{ 248: } 284,
+{ 249: } 285,
+{ 250: } 287,
+{ 251: } 287,
+{ 252: } 288,
+{ 253: } 290,
+{ 254: } 292,
+{ 255: } 293,
+{ 256: } 295,
+{ 257: } 297,
+{ 258: } 297,
+{ 259: } 299,
+{ 260: } 299,
+{ 261: } 299,
+{ 262: } 299,
+{ 263: } 299,
+{ 264: } 299,
+{ 265: } 299,
+{ 266: } 299,
+{ 267: } 299,
+{ 268: } 299,
+{ 269: } 299,
+{ 270: } 299,
+{ 271: } 299,
+{ 272: } 299,
+{ 273: } 299,
+{ 274: } 299,
+{ 275: } 299,
+{ 276: } 299,
+{ 277: } 299,
+{ 278: } 299,
+{ 279: } 299,
+{ 280: } 299,
+{ 281: } 299,
+{ 282: } 299,
+{ 283: } 299,
+{ 284: } 299,
+{ 285: } 300,
+{ 286: } 300,
+{ 287: } 300,
+{ 288: } 300,
+{ 289: } 300,
+{ 290: } 300,
+{ 291: } 300,
+{ 292: } 300,
+{ 293: } 300,
+{ 294: } 300,
+{ 295: } 300,
+{ 296: } 301
+);
+
+yyml : array [0..yynstates-1] of Integer = (
+{ 0: } 1,
+{ 1: } 2,
+{ 2: } 3,
+{ 3: } 5,
+{ 4: } 6,
+{ 5: } 7,
+{ 6: } 10,
+{ 7: } 13,
+{ 8: } 16,
+{ 9: } 19,
+{ 10: } 21,
+{ 11: } 23,
+{ 12: } 25,
+{ 13: } 27,
+{ 14: } 29,
+{ 15: } 30,
+{ 16: } 32,
+{ 17: } 34,
+{ 18: } 36,
+{ 19: } 38,
+{ 20: } 40,
+{ 21: } 42,
+{ 22: } 44,
+{ 23: } 46,
+{ 24: } 48,
+{ 25: } 50,
+{ 26: } 52,
+{ 27: } 54,
+{ 28: } 56,
+{ 29: } 58,
+{ 30: } 60,
+{ 31: } 62,
+{ 32: } 64,
+{ 33: } 66,
+{ 34: } 68,
+{ 35: } 70,
+{ 36: } 72,
+{ 37: } 74,
+{ 38: } 76,
+{ 39: } 78,
+{ 40: } 80,
+{ 41: } 82,
+{ 42: } 84,
+{ 43: } 86,
+{ 44: } 88,
+{ 45: } 90,
+{ 46: } 92,
+{ 47: } 94,
+{ 48: } 96,
+{ 49: } 98,
+{ 50: } 100,
+{ 51: } 102,
+{ 52: } 104,
+{ 53: } 105,
+{ 54: } 106,
+{ 55: } 107,
+{ 56: } 108,
+{ 57: } 109,
+{ 58: } 109,
+{ 59: } 110,
+{ 60: } 110,
+{ 61: } 111,
+{ 62: } 111,
+{ 63: } 111,
+{ 64: } 112,
+{ 65: } 114,
+{ 66: } 115,
+{ 67: } 116,
+{ 68: } 116,
+{ 69: } 116,
+{ 70: } 118,
+{ 71: } 119,
+{ 72: } 120,
+{ 73: } 121,
+{ 74: } 122,
+{ 75: } 123,
+{ 76: } 124,
+{ 77: } 125,
+{ 78: } 126,
+{ 79: } 127,
+{ 80: } 127,
+{ 81: } 127,
+{ 82: } 127,
+{ 83: } 127,
+{ 84: } 127,
+{ 85: } 127,
+{ 86: } 128,
+{ 87: } 129,
+{ 88: } 130,
+{ 89: } 131,
+{ 90: } 132,
+{ 91: } 133,
+{ 92: } 134,
+{ 93: } 135,
+{ 94: } 136,
+{ 95: } 137,
+{ 96: } 138,
+{ 97: } 139,
+{ 98: } 140,
+{ 99: } 141,
+{ 100: } 142,
+{ 101: } 143,
+{ 102: } 144,
+{ 103: } 145,
+{ 104: } 146,
+{ 105: } 147,
+{ 106: } 148,
+{ 107: } 149,
+{ 108: } 150,
+{ 109: } 151,
+{ 110: } 152,
+{ 111: } 153,
+{ 112: } 154,
+{ 113: } 155,
+{ 114: } 156,
+{ 115: } 157,
+{ 116: } 158,
+{ 117: } 158,
+{ 118: } 159,
+{ 119: } 160,
+{ 120: } 161,
+{ 121: } 162,
+{ 122: } 162,
+{ 123: } 162,
+{ 124: } 162,
+{ 125: } 162,
+{ 126: } 162,
+{ 127: } 162,
+{ 128: } 162,
+{ 129: } 163,
+{ 130: } 164,
+{ 131: } 165,
+{ 132: } 166,
+{ 133: } 167,
+{ 134: } 168,
+{ 135: } 169,
+{ 136: } 170,
+{ 137: } 171,
+{ 138: } 172,
+{ 139: } 173,
+{ 140: } 174,
+{ 141: } 175,
+{ 142: } 176,
+{ 143: } 177,
+{ 144: } 178,
+{ 145: } 179,
+{ 146: } 180,
+{ 147: } 181,
+{ 148: } 182,
+{ 149: } 183,
+{ 150: } 185,
+{ 151: } 186,
+{ 152: } 187,
+{ 153: } 189,
+{ 154: } 191,
+{ 155: } 192,
+{ 156: } 193,
+{ 157: } 194,
+{ 158: } 195,
+{ 159: } 195,
+{ 160: } 195,
+{ 161: } 195,
+{ 162: } 195,
+{ 163: } 195,
+{ 164: } 195,
+{ 165: } 195,
+{ 166: } 195,
+{ 167: } 195,
+{ 168: } 196,
+{ 169: } 198,
+{ 170: } 199,
+{ 171: } 200,
+{ 172: } 201,
+{ 173: } 202,
+{ 174: } 203,
+{ 175: } 204,
+{ 176: } 205,
+{ 177: } 206,
+{ 178: } 207,
+{ 179: } 208,
+{ 180: } 210,
+{ 181: } 212,
+{ 182: } 214,
+{ 183: } 215,
+{ 184: } 216,
+{ 185: } 217,
+{ 186: } 218,
+{ 187: } 219,
+{ 188: } 220,
+{ 189: } 222,
+{ 190: } 223,
+{ 191: } 225,
+{ 192: } 227,
+{ 193: } 229,
+{ 194: } 231,
+{ 195: } 231,
+{ 196: } 231,
+{ 197: } 232,
+{ 198: } 233,
+{ 199: } 233,
+{ 200: } 233,
+{ 201: } 233,
+{ 202: } 233,
+{ 203: } 233,
+{ 204: } 234,
+{ 205: } 235,
+{ 206: } 236,
+{ 207: } 238,
+{ 208: } 239,
+{ 209: } 241,
+{ 210: } 242,
+{ 211: } 243,
+{ 212: } 244,
+{ 213: } 245,
+{ 214: } 246,
+{ 215: } 248,
+{ 216: } 250,
+{ 217: } 251,
+{ 218: } 252,
+{ 219: } 254,
+{ 220: } 255,
+{ 221: } 257,
+{ 222: } 257,
+{ 223: } 257,
+{ 224: } 258,
+{ 225: } 259,
+{ 226: } 260,
+{ 227: } 260,
+{ 228: } 260,
+{ 229: } 262,
+{ 230: } 263,
+{ 231: } 264,
+{ 232: } 265,
+{ 233: } 267,
+{ 234: } 269,
+{ 235: } 271,
+{ 236: } 272,
+{ 237: } 273,
+{ 238: } 274,
+{ 239: } 276,
+{ 240: } 277,
+{ 241: } 277,
+{ 242: } 277,
+{ 243: } 278,
+{ 244: } 279,
+{ 245: } 281,
+{ 246: } 282,
+{ 247: } 283,
+{ 248: } 284,
+{ 249: } 285,
+{ 250: } 286,
+{ 251: } 288,
+{ 252: } 288,
+{ 253: } 289,
+{ 254: } 291,
+{ 255: } 293,
+{ 256: } 294,
+{ 257: } 296,
+{ 258: } 298,
+{ 259: } 298,
+{ 260: } 300,
+{ 261: } 300,
+{ 262: } 300,
+{ 263: } 300,
+{ 264: } 300,
+{ 265: } 300,
+{ 266: } 300,
+{ 267: } 300,
+{ 268: } 300,
+{ 269: } 300,
+{ 270: } 300,
+{ 271: } 300,
+{ 272: } 300,
+{ 273: } 300,
+{ 274: } 300,
+{ 275: } 300,
+{ 276: } 300,
+{ 277: } 300,
+{ 278: } 300,
+{ 279: } 300,
+{ 280: } 300,
+{ 281: } 300,
+{ 282: } 300,
+{ 283: } 300,
+{ 284: } 300,
+{ 285: } 300,
+{ 286: } 301,
+{ 287: } 301,
+{ 288: } 301,
+{ 289: } 301,
+{ 290: } 301,
+{ 291: } 301,
+{ 292: } 301,
+{ 293: } 301,
+{ 294: } 301,
+{ 295: } 301,
+{ 296: } 301
+);
+
+yymh : array [0..yynstates-1] of Integer = (
+{ 0: } 1,
+{ 1: } 2,
+{ 2: } 4,
+{ 3: } 5,
+{ 4: } 6,
+{ 5: } 9,
+{ 6: } 12,
+{ 7: } 15,
+{ 8: } 18,
+{ 9: } 20,
+{ 10: } 22,
+{ 11: } 24,
+{ 12: } 26,
+{ 13: } 28,
+{ 14: } 29,
+{ 15: } 31,
+{ 16: } 33,
+{ 17: } 35,
+{ 18: } 37,
+{ 19: } 39,
+{ 20: } 41,
+{ 21: } 43,
+{ 22: } 45,
+{ 23: } 47,
+{ 24: } 49,
+{ 25: } 51,
+{ 26: } 53,
+{ 27: } 55,
+{ 28: } 57,
+{ 29: } 59,
+{ 30: } 61,
+{ 31: } 63,
+{ 32: } 65,
+{ 33: } 67,
+{ 34: } 69,
+{ 35: } 71,
+{ 36: } 73,
+{ 37: } 75,
+{ 38: } 77,
+{ 39: } 79,
+{ 40: } 81,
+{ 41: } 83,
+{ 42: } 85,
+{ 43: } 87,
+{ 44: } 89,
+{ 45: } 91,
+{ 46: } 93,
+{ 47: } 95,
+{ 48: } 97,
+{ 49: } 99,
+{ 50: } 101,
+{ 51: } 103,
+{ 52: } 104,
+{ 53: } 105,
+{ 54: } 106,
+{ 55: } 107,
+{ 56: } 108,
+{ 57: } 108,
+{ 58: } 109,
+{ 59: } 109,
+{ 60: } 110,
+{ 61: } 110,
+{ 62: } 110,
+{ 63: } 111,
+{ 64: } 113,
+{ 65: } 114,
+{ 66: } 115,
+{ 67: } 115,
+{ 68: } 115,
+{ 69: } 117,
+{ 70: } 118,
+{ 71: } 119,
+{ 72: } 120,
+{ 73: } 121,
+{ 74: } 122,
+{ 75: } 123,
+{ 76: } 124,
+{ 77: } 125,
+{ 78: } 126,
+{ 79: } 126,
+{ 80: } 126,
+{ 81: } 126,
+{ 82: } 126,
+{ 83: } 126,
+{ 84: } 126,
+{ 85: } 127,
+{ 86: } 128,
+{ 87: } 129,
+{ 88: } 130,
+{ 89: } 131,
+{ 90: } 132,
+{ 91: } 133,
+{ 92: } 134,
+{ 93: } 135,
+{ 94: } 136,
+{ 95: } 137,
+{ 96: } 138,
+{ 97: } 139,
+{ 98: } 140,
+{ 99: } 141,
+{ 100: } 142,
+{ 101: } 143,
+{ 102: } 144,
+{ 103: } 145,
+{ 104: } 146,
+{ 105: } 147,
+{ 106: } 148,
+{ 107: } 149,
+{ 108: } 150,
+{ 109: } 151,
+{ 110: } 152,
+{ 111: } 153,
+{ 112: } 154,
+{ 113: } 155,
+{ 114: } 156,
+{ 115: } 157,
+{ 116: } 157,
+{ 117: } 158,
+{ 118: } 159,
+{ 119: } 160,
+{ 120: } 161,
+{ 121: } 161,
+{ 122: } 161,
+{ 123: } 161,
+{ 124: } 161,
+{ 125: } 161,
+{ 126: } 161,
+{ 127: } 161,
+{ 128: } 162,
+{ 129: } 163,
+{ 130: } 164,
+{ 131: } 165,
+{ 132: } 166,
+{ 133: } 167,
+{ 134: } 168,
+{ 135: } 169,
+{ 136: } 170,
+{ 137: } 171,
+{ 138: } 172,
+{ 139: } 173,
+{ 140: } 174,
+{ 141: } 175,
+{ 142: } 176,
+{ 143: } 177,
+{ 144: } 178,
+{ 145: } 179,
+{ 146: } 180,
+{ 147: } 181,
+{ 148: } 182,
+{ 149: } 184,
+{ 150: } 185,
+{ 151: } 186,
+{ 152: } 188,
+{ 153: } 190,
+{ 154: } 191,
+{ 155: } 192,
+{ 156: } 193,
+{ 157: } 194,
+{ 158: } 194,
+{ 159: } 194,
+{ 160: } 194,
+{ 161: } 194,
+{ 162: } 194,
+{ 163: } 194,
+{ 164: } 194,
+{ 165: } 194,
+{ 166: } 194,
+{ 167: } 195,
+{ 168: } 197,
+{ 169: } 198,
+{ 170: } 199,
+{ 171: } 200,
+{ 172: } 201,
+{ 173: } 202,
+{ 174: } 203,
+{ 175: } 204,
+{ 176: } 205,
+{ 177: } 206,
+{ 178: } 207,
+{ 179: } 209,
+{ 180: } 211,
+{ 181: } 213,
+{ 182: } 214,
+{ 183: } 215,
+{ 184: } 216,
+{ 185: } 217,
+{ 186: } 218,
+{ 187: } 219,
+{ 188: } 221,
+{ 189: } 222,
+{ 190: } 224,
+{ 191: } 226,
+{ 192: } 228,
+{ 193: } 230,
+{ 194: } 230,
+{ 195: } 230,
+{ 196: } 231,
+{ 197: } 232,
+{ 198: } 232,
+{ 199: } 232,
+{ 200: } 232,
+{ 201: } 232,
+{ 202: } 232,
+{ 203: } 233,
+{ 204: } 234,
+{ 205: } 235,
+{ 206: } 237,
+{ 207: } 238,
+{ 208: } 240,
+{ 209: } 241,
+{ 210: } 242,
+{ 211: } 243,
+{ 212: } 244,
+{ 213: } 245,
+{ 214: } 247,
+{ 215: } 249,
+{ 216: } 250,
+{ 217: } 251,
+{ 218: } 253,
+{ 219: } 254,
+{ 220: } 256,
+{ 221: } 256,
+{ 222: } 256,
+{ 223: } 257,
+{ 224: } 258,
+{ 225: } 259,
+{ 226: } 259,
+{ 227: } 259,
+{ 228: } 261,
+{ 229: } 262,
+{ 230: } 263,
+{ 231: } 264,
+{ 232: } 266,
+{ 233: } 268,
+{ 234: } 270,
+{ 235: } 271,
+{ 236: } 272,
+{ 237: } 273,
+{ 238: } 275,
+{ 239: } 276,
+{ 240: } 276,
+{ 241: } 276,
+{ 242: } 277,
+{ 243: } 278,
+{ 244: } 280,
+{ 245: } 281,
+{ 246: } 282,
+{ 247: } 283,
+{ 248: } 284,
+{ 249: } 285,
+{ 250: } 287,
+{ 251: } 287,
+{ 252: } 288,
+{ 253: } 290,
+{ 254: } 292,
+{ 255: } 293,
+{ 256: } 295,
+{ 257: } 297,
+{ 258: } 297,
+{ 259: } 299,
+{ 260: } 299,
+{ 261: } 299,
+{ 262: } 299,
+{ 263: } 299,
+{ 264: } 299,
+{ 265: } 299,
+{ 266: } 299,
+{ 267: } 299,
+{ 268: } 299,
+{ 269: } 299,
+{ 270: } 299,
+{ 271: } 299,
+{ 272: } 299,
+{ 273: } 299,
+{ 274: } 299,
+{ 275: } 299,
+{ 276: } 299,
+{ 277: } 299,
+{ 278: } 299,
+{ 279: } 299,
+{ 280: } 299,
+{ 281: } 299,
+{ 282: } 299,
+{ 283: } 299,
+{ 284: } 299,
+{ 285: } 300,
+{ 286: } 300,
+{ 287: } 300,
+{ 288: } 300,
+{ 289: } 300,
+{ 290: } 300,
+{ 291: } 300,
+{ 292: } 300,
+{ 293: } 300,
+{ 294: } 300,
+{ 295: } 300,
+{ 296: } 301
+);
+
+yytl : array [0..yynstates-1] of Integer = (
+{ 0: } 1,
+{ 1: } 54,
+{ 2: } 107,
+{ 3: } 109,
+{ 4: } 111,
+{ 5: } 113,
+{ 6: } 116,
+{ 7: } 121,
+{ 8: } 123,
+{ 9: } 129,
+{ 10: } 130,
+{ 11: } 131,
+{ 12: } 132,
+{ 13: } 134,
+{ 14: } 136,
+{ 15: } 142,
+{ 16: } 142,
+{ 17: } 142,
+{ 18: } 142,
+{ 19: } 142,
+{ 20: } 142,
+{ 21: } 142,
+{ 22: } 142,
+{ 23: } 142,
+{ 24: } 142,
+{ 25: } 142,
+{ 26: } 142,
+{ 27: } 143,
+{ 28: } 146,
+{ 29: } 149,
+{ 30: } 153,
+{ 31: } 155,
+{ 32: } 157,
+{ 33: } 159,
+{ 34: } 161,
+{ 35: } 163,
+{ 36: } 166,
+{ 37: } 168,
+{ 38: } 171,
+{ 39: } 171,
+{ 40: } 171,
+{ 41: } 173,
+{ 42: } 175,
+{ 43: } 177,
+{ 44: } 180,
+{ 45: } 182,
+{ 46: } 184,
+{ 47: } 186,
+{ 48: } 188,
+{ 49: } 190,
+{ 50: } 191,
+{ 51: } 191,
+{ 52: } 191,
+{ 53: } 192,
+{ 54: } 192,
+{ 55: } 192,
+{ 56: } 192,
+{ 57: } 192,
+{ 58: } 194,
+{ 59: } 194,
+{ 60: } 196,
+{ 61: } 196,
+{ 62: } 198,
+{ 63: } 200,
+{ 64: } 201,
+{ 65: } 206,
+{ 66: } 207,
+{ 67: } 207,
+{ 68: } 208,
+{ 69: } 210,
+{ 70: } 211,
+{ 71: } 214,
+{ 72: } 214,
+{ 73: } 214,
+{ 74: } 214,
+{ 75: } 214,
+{ 76: } 214,
+{ 77: } 214,
+{ 78: } 214,
+{ 79: } 214,
+{ 80: } 216,
+{ 81: } 219,
+{ 82: } 220,
+{ 83: } 221,
+{ 84: } 222,
+{ 85: } 223,
+{ 86: } 225,
+{ 87: } 227,
+{ 88: } 229,
+{ 89: } 231,
+{ 90: } 233,
+{ 91: } 235,
+{ 92: } 237,
+{ 93: } 240,
+{ 94: } 242,
+{ 95: } 244,
+{ 96: } 246,
+{ 97: } 248,
+{ 98: } 250,
+{ 99: } 252,
+{ 100: } 255,
+{ 101: } 257,
+{ 102: } 259,
+{ 103: } 261,
+{ 104: } 263,
+{ 105: } 265,
+{ 106: } 267,
+{ 107: } 269,
+{ 108: } 271,
+{ 109: } 273,
+{ 110: } 275,
+{ 111: } 277,
+{ 112: } 279,
+{ 113: } 279,
+{ 114: } 279,
+{ 115: } 279,
+{ 116: } 281,
+{ 117: } 282,
+{ 118: } 283,
+{ 119: } 284,
+{ 120: } 284,
+{ 121: } 285,
+{ 122: } 286,
+{ 123: } 288,
+{ 124: } 289,
+{ 125: } 290,
+{ 126: } 291,
+{ 127: } 292,
+{ 128: } 293,
+{ 129: } 293,
+{ 130: } 295,
+{ 131: } 297,
+{ 132: } 299,
+{ 133: } 301,
+{ 134: } 303,
+{ 135: } 305,
+{ 136: } 307,
+{ 137: } 309,
+{ 138: } 311,
+{ 139: } 314,
+{ 140: } 316,
+{ 141: } 318,
+{ 142: } 320,
+{ 143: } 322,
+{ 144: } 324,
+{ 145: } 326,
+{ 146: } 328,
+{ 147: } 330,
+{ 148: } 332,
+{ 149: } 334,
+{ 150: } 335,
+{ 151: } 337,
+{ 152: } 339,
+{ 153: } 340,
+{ 154: } 341,
+{ 155: } 343,
+{ 156: } 345,
+{ 157: } 347,
+{ 158: } 349,
+{ 159: } 350,
+{ 160: } 351,
+{ 161: } 352,
+{ 162: } 353,
+{ 163: } 354,
+{ 164: } 355,
+{ 165: } 356,
+{ 166: } 357,
+{ 167: } 358,
+{ 168: } 360,
+{ 169: } 361,
+{ 170: } 363,
+{ 171: } 365,
+{ 172: } 367,
+{ 173: } 369,
+{ 174: } 371,
+{ 175: } 373,
+{ 176: } 375,
+{ 177: } 377,
+{ 178: } 379,
+{ 179: } 381,
+{ 180: } 382,
+{ 181: } 383,
+{ 182: } 384,
+{ 183: } 386,
+{ 184: } 388,
+{ 185: } 390,
+{ 186: } 392,
+{ 187: } 394,
+{ 188: } 396,
+{ 189: } 397,
+{ 190: } 399,
+{ 191: } 400,
+{ 192: } 401,
+{ 193: } 402,
+{ 194: } 403,
+{ 195: } 404,
+{ 196: } 405,
+{ 197: } 405,
+{ 198: } 405,
+{ 199: } 406,
+{ 200: } 407,
+{ 201: } 408,
+{ 202: } 409,
+{ 203: } 410,
+{ 204: } 412,
+{ 205: } 414,
+{ 206: } 416,
+{ 207: } 417,
+{ 208: } 419,
+{ 209: } 420,
+{ 210: } 422,
+{ 211: } 424,
+{ 212: } 426,
+{ 213: } 428,
+{ 214: } 430,
+{ 215: } 431,
+{ 216: } 432,
+{ 217: } 434,
+{ 218: } 436,
+{ 219: } 437,
+{ 220: } 439,
+{ 221: } 440,
+{ 222: } 441,
+{ 223: } 442,
+{ 224: } 442,
+{ 225: } 442,
+{ 226: } 442,
+{ 227: } 443,
+{ 228: } 444,
+{ 229: } 445,
+{ 230: } 447,
+{ 231: } 449,
+{ 232: } 451,
+{ 233: } 452,
+{ 234: } 453,
+{ 235: } 454,
+{ 236: } 456,
+{ 237: } 458,
+{ 238: } 460,
+{ 239: } 461,
+{ 240: } 463,
+{ 241: } 464,
+{ 242: } 465,
+{ 243: } 465,
+{ 244: } 465,
+{ 245: } 466,
+{ 246: } 468,
+{ 247: } 470,
+{ 248: } 472,
+{ 249: } 474,
+{ 250: } 476,
+{ 251: } 477,
+{ 252: } 478,
+{ 253: } 478,
+{ 254: } 479,
+{ 255: } 480,
+{ 256: } 482,
+{ 257: } 483,
+{ 258: } 484,
+{ 259: } 485,
+{ 260: } 486,
+{ 261: } 487,
+{ 262: } 488,
+{ 263: } 489,
+{ 264: } 490,
+{ 265: } 491,
+{ 266: } 492,
+{ 267: } 493,
+{ 268: } 494,
+{ 269: } 496,
+{ 270: } 498,
+{ 271: } 499,
+{ 272: } 500,
+{ 273: } 501,
+{ 274: } 502,
+{ 275: } 503,
+{ 276: } 504,
+{ 277: } 505,
+{ 278: } 506,
+{ 279: } 507,
+{ 280: } 508,
+{ 281: } 509,
+{ 282: } 510,
+{ 283: } 511,
+{ 284: } 512,
+{ 285: } 513,
+{ 286: } 513,
+{ 287: } 514,
+{ 288: } 515,
+{ 289: } 516,
+{ 290: } 517,
+{ 291: } 518,
+{ 292: } 519,
+{ 293: } 520,
+{ 294: } 521,
+{ 295: } 522,
+{ 296: } 523
+);
+
+yyth : array [0..yynstates-1] of Integer = (
+{ 0: } 53,
+{ 1: } 106,
+{ 2: } 108,
+{ 3: } 110,
+{ 4: } 112,
+{ 5: } 115,
+{ 6: } 120,
+{ 7: } 122,
+{ 8: } 128,
+{ 9: } 129,
+{ 10: } 130,
+{ 11: } 131,
+{ 12: } 133,
+{ 13: } 135,
+{ 14: } 141,
+{ 15: } 141,
+{ 16: } 141,
+{ 17: } 141,
+{ 18: } 141,
+{ 19: } 141,
+{ 20: } 141,
+{ 21: } 141,
+{ 22: } 141,
+{ 23: } 141,
+{ 24: } 141,
+{ 25: } 141,
+{ 26: } 142,
+{ 27: } 145,
+{ 28: } 148,
+{ 29: } 152,
+{ 30: } 154,
+{ 31: } 156,
+{ 32: } 158,
+{ 33: } 160,
+{ 34: } 162,
+{ 35: } 165,
+{ 36: } 167,
+{ 37: } 170,
+{ 38: } 170,
+{ 39: } 170,
+{ 40: } 172,
+{ 41: } 174,
+{ 42: } 176,
+{ 43: } 179,
+{ 44: } 181,
+{ 45: } 183,
+{ 46: } 185,
+{ 47: } 187,
+{ 48: } 189,
+{ 49: } 190,
+{ 50: } 190,
+{ 51: } 190,
+{ 52: } 191,
+{ 53: } 191,
+{ 54: } 191,
+{ 55: } 191,
+{ 56: } 191,
+{ 57: } 193,
+{ 58: } 193,
+{ 59: } 195,
+{ 60: } 195,
+{ 61: } 197,
+{ 62: } 199,
+{ 63: } 200,
+{ 64: } 205,
+{ 65: } 206,
+{ 66: } 206,
+{ 67: } 207,
+{ 68: } 209,
+{ 69: } 210,
+{ 70: } 213,
+{ 71: } 213,
+{ 72: } 213,
+{ 73: } 213,
+{ 74: } 213,
+{ 75: } 213,
+{ 76: } 213,
+{ 77: } 213,
+{ 78: } 213,
+{ 79: } 215,
+{ 80: } 218,
+{ 81: } 219,
+{ 82: } 220,
+{ 83: } 221,
+{ 84: } 222,
+{ 85: } 224,
+{ 86: } 226,
+{ 87: } 228,
+{ 88: } 230,
+{ 89: } 232,
+{ 90: } 234,
+{ 91: } 236,
+{ 92: } 239,
+{ 93: } 241,
+{ 94: } 243,
+{ 95: } 245,
+{ 96: } 247,
+{ 97: } 249,
+{ 98: } 251,
+{ 99: } 254,
+{ 100: } 256,
+{ 101: } 258,
+{ 102: } 260,
+{ 103: } 262,
+{ 104: } 264,
+{ 105: } 266,
+{ 106: } 268,
+{ 107: } 270,
+{ 108: } 272,
+{ 109: } 274,
+{ 110: } 276,
+{ 111: } 278,
+{ 112: } 278,
+{ 113: } 278,
+{ 114: } 278,
+{ 115: } 280,
+{ 116: } 281,
+{ 117: } 282,
+{ 118: } 283,
+{ 119: } 283,
+{ 120: } 284,
+{ 121: } 285,
+{ 122: } 287,
+{ 123: } 288,
+{ 124: } 289,
+{ 125: } 290,
+{ 126: } 291,
+{ 127: } 292,
+{ 128: } 292,
+{ 129: } 294,
+{ 130: } 296,
+{ 131: } 298,
+{ 132: } 300,
+{ 133: } 302,
+{ 134: } 304,
+{ 135: } 306,
+{ 136: } 308,
+{ 137: } 310,
+{ 138: } 313,
+{ 139: } 315,
+{ 140: } 317,
+{ 141: } 319,
+{ 142: } 321,
+{ 143: } 323,
+{ 144: } 325,
+{ 145: } 327,
+{ 146: } 329,
+{ 147: } 331,
+{ 148: } 333,
+{ 149: } 334,
+{ 150: } 336,
+{ 151: } 338,
+{ 152: } 339,
+{ 153: } 340,
+{ 154: } 342,
+{ 155: } 344,
+{ 156: } 346,
+{ 157: } 348,
+{ 158: } 349,
+{ 159: } 350,
+{ 160: } 351,
+{ 161: } 352,
+{ 162: } 353,
+{ 163: } 354,
+{ 164: } 355,
+{ 165: } 356,
+{ 166: } 357,
+{ 167: } 359,
+{ 168: } 360,
+{ 169: } 362,
+{ 170: } 364,
+{ 171: } 366,
+{ 172: } 368,
+{ 173: } 370,
+{ 174: } 372,
+{ 175: } 374,
+{ 176: } 376,
+{ 177: } 378,
+{ 178: } 380,
+{ 179: } 381,
+{ 180: } 382,
+{ 181: } 383,
+{ 182: } 385,
+{ 183: } 387,
+{ 184: } 389,
+{ 185: } 391,
+{ 186: } 393,
+{ 187: } 395,
+{ 188: } 396,
+{ 189: } 398,
+{ 190: } 399,
+{ 191: } 400,
+{ 192: } 401,
+{ 193: } 402,
+{ 194: } 403,
+{ 195: } 404,
+{ 196: } 404,
+{ 197: } 404,
+{ 198: } 405,
+{ 199: } 406,
+{ 200: } 407,
+{ 201: } 408,
+{ 202: } 409,
+{ 203: } 411,
+{ 204: } 413,
+{ 205: } 415,
+{ 206: } 416,
+{ 207: } 418,
+{ 208: } 419,
+{ 209: } 421,
+{ 210: } 423,
+{ 211: } 425,
+{ 212: } 427,
+{ 213: } 429,
+{ 214: } 430,
+{ 215: } 431,
+{ 216: } 433,
+{ 217: } 435,
+{ 218: } 436,
+{ 219: } 438,
+{ 220: } 439,
+{ 221: } 440,
+{ 222: } 441,
+{ 223: } 441,
+{ 224: } 441,
+{ 225: } 441,
+{ 226: } 442,
+{ 227: } 443,
+{ 228: } 444,
+{ 229: } 446,
+{ 230: } 448,
+{ 231: } 450,
+{ 232: } 451,
+{ 233: } 452,
+{ 234: } 453,
+{ 235: } 455,
+{ 236: } 457,
+{ 237: } 459,
+{ 238: } 460,
+{ 239: } 462,
+{ 240: } 463,
+{ 241: } 464,
+{ 242: } 464,
+{ 243: } 464,
+{ 244: } 465,
+{ 245: } 467,
+{ 246: } 469,
+{ 247: } 471,
+{ 248: } 473,
+{ 249: } 475,
+{ 250: } 476,
+{ 251: } 477,
+{ 252: } 477,
+{ 253: } 478,
+{ 254: } 479,
+{ 255: } 481,
+{ 256: } 482,
+{ 257: } 483,
+{ 258: } 484,
+{ 259: } 485,
+{ 260: } 486,
+{ 261: } 487,
+{ 262: } 488,
+{ 263: } 489,
+{ 264: } 490,
+{ 265: } 491,
+{ 266: } 492,
+{ 267: } 493,
+{ 268: } 495,
+{ 269: } 497,
+{ 270: } 498,
+{ 271: } 499,
+{ 272: } 500,
+{ 273: } 501,
+{ 274: } 502,
+{ 275: } 503,
+{ 276: } 504,
+{ 277: } 505,
+{ 278: } 506,
+{ 279: } 507,
+{ 280: } 508,
+{ 281: } 509,
+{ 282: } 510,
+{ 283: } 511,
+{ 284: } 512,
+{ 285: } 512,
+{ 286: } 513,
+{ 287: } 514,
+{ 288: } 515,
+{ 289: } 516,
+{ 290: } 517,
+{ 291: } 518,
+{ 292: } 519,
+{ 293: } 520,
+{ 294: } 521,
+{ 295: } 522,
+{ 296: } 522
+);
+
+
+var yyn : Integer;
+
+label start, scan, action;
+
+begin
+
+start:
+
+  (* initialize: *)
+
+  yynew;
+
+scan:
+
+  (* mark positions and matches: *)
+
+  for yyn := yykl[yystate] to     yykh[yystate] do yymark(yyk[yyn]);
+  for yyn := yymh[yystate] downto yyml[yystate] do yymatch(yym[yyn]);
+
+  if yytl[yystate]>yyth[yystate] then goto action; (* dead state *)
+
+  (* get next character: *)
+
+  yyscan;
+
+  (* determine action: *)
+
+  yyn := yytl[yystate];
+  while (yyn<=yyth[yystate]) and not (yyactchar in yyt[yyn].cc) do inc(yyn);
+  if yyn>yyth[yystate] then goto action;
+    (* no transition on yyactchar in this state *)
+
+  (* switch to new state: *)
+
+  yystate := yyt[yyn].s;
+
+  goto scan;
+
+action:
+
+  (* execute action: *)
+
+  if yyfind(yyrule) then
+    begin
+      yyaction(yyrule);
+      if yyreject then goto action;
+    end
+  else if not yydefault and yywrap then
+    begin
+      yyclear;
+      return(0);
+    end;
+
+  if not yydone then goto start;
+
+  yylex := yyretval;
+
+end(*yylex*);
+
+
+
+    function act_token : string;
+      begin
+         act_token:=yytext;
+      end;
+
+Function ForceExtension(Const HStr,ext:String):String;
+{
+  Return a filename which certainly has the extension ext
+  (no dot in ext !!)
+}
+var
+  j : longint;
+begin
+  j:=length(Hstr);
+  while (j>0) and (Hstr[j]<>'.') do
+   dec(j);
+  if j=0 then
+   j:=255;
+  ForceExtension:=Copy(Hstr,1,j-1)+'.'+Ext;
+end;
+
+  begin
+     ProcessOptions;
+     line_no := 1;
+     assign(yyinput, inputfilename);
+     reset(yyinput);
+     assign(textinfile, inputfilename);
+     reset(textinfile);
+     readln(textinfile,last_source_line);
+     assign(outfile, outputfilename);
+     rewrite(outfile);
+     if not(includefile) then
+       begin
+          writeln(outfile,'unit ',unitname,';');
+          writeln(outfile);
+          writeln(outfile,'{  Automatically converted by H2PAS.EXE from '+inputfilename);
+          writeln(outfile,'   Utility made by Florian Klaempfl 25th-28th september 96');
+          writeln(outfile,'   Improvements made by Mark A. Malakanov 22nd-25th may 97 ');
+          writeln(outfile,'   Further improvements by Michael Van Canneyt, April 1998 ');
+          writeln(outfile,'   define handling and error recovery by Pierre Muller, June 1998 }');
+          writeln(outfile);
+          writeln(outfile);
+          writeln(outfile,'  interface');
+          writeln(outfile);
+          writeln(outfile,'  { C default packing is dword }');
+          writeln(outfile);
+          writeln(outfile,'{$PACKRECORDS 4}');
+       end;
+     if UsePPointers then
+       begin
+       { Define some pointers to basic pascal types }
+       writeln(outfile);
+       Writeln(outfile,' { Pointers to basic pascal types, inserted by h2pas conversion program.}');
+       Writeln(outfile,'  Type');
+       Writeln(outfile,'     PLongint  = ^Longint;');
+       Writeln(outfile,'     PByte     = ^Byte;');
+       Writeln(outfile,'     PWord     = ^Word;');
+       Writeln(outfile,'     PInteger  = ^Integer;');
+       Writeln(outfile,'     PCardinal = ^Cardinal;');
+       Writeln(outfile,'     PReal     = ^Real;');
+       Writeln(outfile,'     PDouble   = ^Double;');
+       Writeln(outfile);
+       end;
+  end.
+

+ 38 - 0
utils/h2pas/testit.h

@@ -0,0 +1,38 @@
+/*
+   Test header file to test conversion program.
+*/
+
+typedef struct {
+  int x;
+  int y;
+  } a;
+
+typedef union fpk {
+  int X;
+  int y;
+  int z;
+} b;
+
+typedef _test test;
+
+struct _test
+{
+  int x;
+  int y;
+};
+
+void proc(int *,int);
+void proc(int *p,int i);
+
+typedef enum { First, second, third } C;
+
+typedef enum { DFirst = 1, DSecond = 2, DThird = 3 } D;
+
+typedef enum { EFirst = 100, ESecond, EThird } D;
+
+void someproc(char *Firstarg,...);
+
+mytype* somefunc (char *firstarg);
+
+#define test 0x012345UL
+

+ 120 - 0
utils/h2pas/yacclib.pas

@@ -0,0 +1,120 @@
+{
+  Yacc Library Unit for TP Yacc
+
+
+  Copyright (c) 1990-92  Albert Graef <[email protected]>
+  Copyright (C) 1996     Berend de Boer <[email protected]>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+$Revision$
+$Modtime: 96-08-01 14:04 $
+
+$History: YACCLIB.PAS $
+ * 
+ * *****************  Version 2  *****************
+ * User: Berend       Date: 96-10-10   Time: 21:16
+ * Updated in $/Lex and Yacc/tply
+ * Updated for protected mode, windows and Delphi 1.X and 2.X.
+
+}
+
+
+{$I-}
+
+unit YaccLib;
+
+(* Yacc Library Unit for TP Yacc Version 3.0, 6-17-91 AG *)
+
+interface
+
+const yymaxdepth = 10000;
+  (* default stack size of parser *)
+
+type YYSType = Integer;
+  (* default value type, may be redefined in Yacc output file *)
+
+var
+
+yychar   : Integer; (* current lookahead character *)
+yynerrs  : Integer; (* current number of syntax errors reported by the
+                       parser *)
+yydebug  : Boolean; (* set to true to enable debugging output of parser *)
+
+line_no : longint;
+
+procedure yyerror ( msg : String );
+  (* error message printing routine used by the parser *)
+
+procedure yyclearin;
+  (* delete the current lookahead token *)
+
+procedure yyaccept;
+  (* trigger accept action of the parser; yyparse accepts returning 0, as if
+     it reached end of input *)
+
+procedure yyabort;
+  (* like yyaccept, but causes parser to return with value 1, as if an
+     unrecoverable syntax error had been encountered *)
+
+procedure yyerrlab;
+  (* causes error recovery to be started, as if a syntax error had been
+     encountered *)
+
+procedure yyerrok;
+  (* when in error mode, resets the parser to its normal mode of
+     operation *)
+
+(* Flags used internally by the parser routine: *)
+
+var
+
+yyflag    : ( yyfnone, yyfaccept, yyfabort, yyferror );
+yyerrflag : Integer;
+
+implementation
+
+procedure yyerror ( msg : String );
+  begin
+    writeln('at line ',line_no,' error : ',msg);
+  end(*yyerrmsg*);
+
+procedure yyclearin;
+  begin
+    yychar := -1;
+  end(*yyclearin*);
+
+procedure yyaccept;
+  begin
+    yyflag := yyfaccept;
+  end(*yyaccept*);
+
+procedure yyabort;
+  begin
+    yyflag := yyfabort;
+  end(*yyabort*);
+
+procedure yyerrlab;
+  begin
+    yyflag := yyferror;
+  end(*yyerrlab*);
+
+procedure yyerrok;
+  begin
+    yyerrflag := 0;
+  end(*yyerrork*);
+
+end(*YaccLib*).

+ 80 - 0
utils/h2pas/yylex.cod

@@ -0,0 +1,80 @@
+
+(* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
+
+(* global definitions: *)
+%%
+
+function yylex : Integer;
+
+procedure yyaction ( yyruleno : Integer );
+  (* local definitions: *)
+%%
+begin
+  (* actions: *)
+  case yyruleno of
+%%
+  end;
+end(*yyaction*);
+
+(* DFA table: *)
+%%
+
+var yyn : Integer;
+
+label start, scan, action;
+
+begin
+
+start:
+
+  (* initialize: *)
+
+  yynew;
+
+scan:
+
+  (* mark positions and matches: *)
+
+  for yyn := yykl[yystate] to     yykh[yystate] do yymark(yyk[yyn]);
+  for yyn := yymh[yystate] downto yyml[yystate] do yymatch(yym[yyn]);
+
+  if yytl[yystate]>yyth[yystate] then goto action; (* dead state *)
+
+  (* get next character: *)
+
+  yyscan;
+
+  (* determine action: *)
+
+  yyn := yytl[yystate];
+  while (yyn<=yyth[yystate]) and not (yyactchar in yyt[yyn].cc) do inc(yyn);
+  if yyn>yyth[yystate] then goto action;
+    (* no transition on yyactchar in this state *)
+
+  (* switch to new state: *)
+
+  yystate := yyt[yyn].s;
+
+  goto scan;
+
+action:
+
+  (* execute action: *)
+
+  if yyfind(yyrule) then
+    begin
+      yyaction(yyrule);
+      if yyreject then goto action;
+    end
+  else if not yydefault and yywrap then
+    begin
+      yyclear;
+      return(0);
+    end;
+
+  if not yydone then goto start;
+
+  yylex := yyretval;
+
+end(*yylex*);
+

+ 184 - 0
utils/h2pas/yyparse.cod

@@ -0,0 +1,184 @@
+
+(* Yacc parser template (TP Yacc V3.0), V1.2 6-17-91 AG *)
+
+(* global definitions: *)
+%%
+
+var yylval : YYSType;
+
+function yylex : Integer; forward;
+
+function yyparse : Integer;
+
+var yystate, yysp, yyn : Integer;
+    yys : array [1..yymaxdepth] of Integer;
+    yyv : array [1..yymaxdepth] of YYSType;
+    yyval : YYSType;
+
+procedure yyaction ( yyruleno : Integer );
+  (* local definitions: *)
+%%
+begin
+  (* actions: *)
+  case yyruleno of
+%%
+  end;
+end(*yyaction*);
+
+(* parse table: *)
+%%
+
+const _error = 256; (* error token *)
+
+function yyact(state, sym : Integer; var act : Integer) : Boolean;
+  (* search action table *)
+  var k : Integer;
+  begin
+    k := yyal[state];
+    while (k<=yyah[state]) and (yya[k].sym<>sym) do inc(k);
+    if k>yyah[state] then
+      yyact := false
+    else
+      begin
+        act := yya[k].act;
+        yyact := true;
+      end;
+  end(*yyact*);
+
+function yygoto(state, sym : Integer; var nstate : Integer) : Boolean;
+  (* search goto table *)
+  var k : Integer;
+  begin
+    k := yygl[state];
+    while (k<=yygh[state]) and (yyg[k].sym<>sym) do inc(k);
+    if k>yygh[state] then
+      yygoto := false
+    else
+      begin
+        nstate := yyg[k].act;
+        yygoto := true;
+      end;
+  end(*yygoto*);
+
+label parse, next, error, errlab, shift, reduce, accept, abort;
+
+begin(*yyparse*)
+
+  (* initialize: *)
+
+  yystate := 0; yychar := -1; yynerrs := 0; yyerrflag := 0; yysp := 0;
+
+{$ifdef yydebug}
+  yydebug := true;
+{$else}
+  yydebug := false;
+{$endif}
+
+parse:
+
+  (* push state and value: *)
+
+  inc(yysp);
+  if yysp>yymaxdepth then
+    begin
+      yyerror('yyparse stack overflow');
+      goto abort;
+    end;
+  yys[yysp] := yystate; yyv[yysp] := yyval;
+
+next:
+
+  if (yyd[yystate]=0) and (yychar=-1) then
+    (* get next symbol *)
+    begin
+      yychar := yylex; if yychar<0 then yychar := 0;
+    end;
+
+  if yydebug then writeln('state ', yystate, ', char ', yychar);
+
+  (* determine parse action: *)
+
+  yyn := yyd[yystate];
+  if yyn<>0 then goto reduce; (* simple state *)
+
+  (* no default action; search parse table *)
+
+  if not yyact(yystate, yychar, yyn) then goto error
+  else if yyn>0 then                      goto shift
+  else if yyn<0 then                      goto reduce
+  else                                    goto accept;
+
+error:
+
+  (* error; start error recovery: *)
+
+  if yyerrflag=0 then yyerror('syntax error');
+
+errlab:
+
+  if yyerrflag=0 then inc(yynerrs);     (* new error *)
+
+  if yyerrflag<=2 then                  (* incomplete recovery; try again *)
+    begin
+      yyerrflag := 3;
+      (* uncover a state with shift action on error token *)
+      while (yysp>0) and not ( yyact(yys[yysp], _error, yyn) and
+                               (yyn>0) ) do
+        begin
+          if yydebug then
+            if yysp>1 then
+              writeln('error recovery pops state ', yys[yysp], ', uncovers ',
+                      yys[yysp-1])
+            else
+              writeln('error recovery fails ... abort');
+          dec(yysp);
+        end;
+      if yysp=0 then goto abort; (* parser has fallen from stack; abort *)
+      yystate := yyn;            (* simulate shift on error *)
+      goto parse;
+    end
+  else                                  (* no shift yet; discard symbol *)
+    begin
+      if yydebug then writeln('error recovery discards char ', yychar);
+      if yychar=0 then goto abort; (* end of input; abort *)
+      yychar := -1; goto next;     (* clear lookahead char and try again *)
+    end;
+
+shift:
+
+  (* go to new state, clear lookahead character: *)
+
+  yystate := yyn; yychar := -1; yyval := yylval;
+  if yyerrflag>0 then dec(yyerrflag);
+
+  goto parse;
+
+reduce:
+
+  (* execute action, pop rule from stack, and go to next state: *)
+
+  if yydebug then writeln('reduce ', -yyn);
+
+  yyflag := yyfnone; yyaction(-yyn);
+  dec(yysp, yyr[-yyn].len);
+  if yygoto(yys[yysp], yyr[-yyn].sym, yyn) then yystate := yyn;
+
+  (* handle action calls to yyaccept, yyabort and yyerror: *)
+
+  case yyflag of
+    yyfaccept : goto accept;
+    yyfabort  : goto abort;
+    yyferror  : goto errlab;
+  end;
+
+  goto parse;
+
+accept:
+
+  yyparse := 0; exit;
+
+abort:
+
+  yyparse := 1; exit;
+
+end(*yyparse*);

+ 629 - 0
utils/ppdep.pp

@@ -0,0 +1,629 @@
+{
+    $Id$
+    This program is part of the Free Pascal run time library.
+    Copyright (c) 1997 by Peter Vreman
+    member of the Free Pascal development team
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ Program to create a depend makefile for a program with multiple units }
+
+program ppdep;
+uses Dos;
+
+{.$define debug}
+
+const
+{$ifdef linux}
+  exeext='';
+{$else}
+  exeext='.EXE';
+{$endif}
+
+type
+  PUses=^TUses;
+  TUses=record
+    Name : string[32];
+    Next : PUses;
+  end;
+  PUnit=^TUnit;
+  TUnit=record
+    UsesList : PUses;
+    PasFn,
+    Name     : string[32];
+    IsUnit   : boolean;
+    Next     : PUnit;
+  end;
+  PDefine=^TDefine;
+  TDefine = Record
+    Name : String[32];
+    Next : PDefine;
+    end;
+
+
+var
+  UnitList         : PUnit;
+  Define           : PDefine;
+  ParaFile         : string;
+  Verbose          : boolean;
+  AddCall          : byte;
+  CallLine,
+  OutFile          : String;
+  UnitExt          : String;
+
+{****************************************************************************
+                           Handy Routines
+****************************************************************************}
+
+function UCase(Const Hstr:string):string;
+var
+  i : longint;
+begin
+  for i:=1to Length(Hstr) do
+   UCase[i]:=Upcase(Hstr[i]);
+  UCase[0]:=chr(Length(Hstr));
+end;
+
+
+function FixFn(const s:string):string;
+var
+  i      : longint;
+  NoPath : boolean;
+begin
+  NoPath:=true;
+  for i:=length(s) downto 1 do
+   begin
+     case s[i] of
+ {$ifdef Linux}
+  '/','\' : begin
+              FixFn[i]:='/';
+              NoPath:=false; {Skip lowercasing path: 'X11'<>'x11' }
+            end;
+ 'A'..'Z' : if NoPath then
+             FixFn[i]:=char(byte(s[i])+32)
+            else
+             FixFn[i]:=s[i];
+ {$else}
+      '/' : FixFn[i]:='\';
+ 'A'..'Z' : FixFn[i]:=char(byte(s[i])+32); { everything lowercase }
+ {$endif}
+     else
+      FixFn[i]:=s[i];
+     end;
+   end;
+  FixFn[0]:=Chr(Length(s));
+end;
+
+
+{****************************************************************************
+                             Main Program
+****************************************************************************}
+
+Function SearchPas(const fn:string):string;
+var
+  Dir : SearchRec;
+begin
+  FindFirst(FixFn(fn+'.PP'),$20,Dir);
+  if Doserror=0 then
+   SearchPas:=FixFn(fn+'.PP')
+  else
+   SearchPas:=FixFn(fn+'.PAS')
+end;
+
+
+Function UnitDone(const fn:string):boolean;
+var
+  hp : PUnit;
+begin
+  hp:=UnitList;
+  while not (hp=nil) do
+   begin
+     if hp^.Name=fn then
+      begin
+        UnitDone:=true;
+        exit;
+      end;
+     hp:=hp^.Next;
+   end;
+  UnitDone:=false;
+end;
+
+
+Function CheckDefine(const s:string):boolean;
+var
+  ss : string[32];
+  P : PDefine;
+begin
+  ss:=ucase(s);
+  P:=Define;
+  while (p<>Nil) do
+   begin
+     if ss=p^.name then
+      begin
+        CheckDefine:=true;
+        exit;
+      end;
+     P:=P^.Next;
+   end;
+  CheckDefine:=false;
+end;
+
+Procedure AddDefine(Const S : String);
+Var
+  P : PDefine;
+begin
+  New(P);
+  P^.Name:=Ucase(S);
+  P^.Next:=Define;
+  Define:=P;
+end;
+
+
+procedure RemoveSep(var fn:string);
+var
+  i : longint;
+begin
+  i:=0;
+  while (i<length(fn)) and (fn[i+1] in [',',' ',#9]) do
+   inc(i);
+  Delete(fn,1,i);
+end;
+
+
+function GetName(var fn:string):string;
+var
+  i : longint;
+begin
+  i:=0;
+  while (i<length(fn)) and (fn[i+1] in ['A'..'Z','0'..'9','_','-']) do
+   inc(i);
+  GetName:=Copy(fn,1,i);
+  Delete(fn,1,i);
+end;
+
+
+procedure ListDepend(const fn:string);
+
+{$ifndef FPC}
+  procedure readln(var t:text;var s:string);
+  var
+    c : char;
+    i : longint;
+  begin
+    c:=#0;
+    i:=0;
+    while (not eof(t)) and (c<>#10) do
+     begin
+       read(t,c);
+       if c<>#10 then
+        begin
+          inc(i);
+          s[i]:=c;
+        end;
+     end;
+    if (i>0) and (s[i]=#13) then
+     dec(i);
+    s[0]:=chr(i);
+  end;
+{$endif}
+
+const
+  MaxLevel=200;
+var
+  f  : text;
+  hs : ^string;
+  curruses,lastuses : PUses;
+  currunit,lastunit : PUnit;
+  i,j : longint;
+  UsesDone,
+  OldComment,
+  Done,Comment,
+  InImplementation : boolean;
+  Skip : array[0..MaxLevel] of boolean;
+  Level : byte;
+begin
+  if UnitDone(fn) then
+   exit;
+  new(hs);
+  new(currunit);
+  currunit^.next:=nil;
+  currunit^.Name:=fn;
+  currunit^.IsUnit:=true;
+  currunit^.PasFn:=SearchPas(fn);
+  currunit^.useslist:=nil;
+  assign(f,currunit^.PasFn);
+  {$I-}
+   reset(f);
+  {$I+}
+  if ioresult=0 then
+   begin
+     if verbose then
+      Writeln('Processing ',currunit^.PasFn);
+   {Add to Linked List}
+     if unitlist=nil then
+      unitlist:=currunit
+     else
+      begin
+        lastunit:=UnitList;
+        while not (lastunit^.Next=nil) do
+         lastunit:=lastunit^.next;
+        lastunit^.next:=currunit;
+      end;
+   {Parse file}
+     InImplementation:=false;
+     done:=false;
+     usesdone:=true;
+     Comment:=false;
+     OldComment:=false;
+     FillChar(skip,sizeof(Skip),0);
+     hs^:='';
+     Level:=0;
+     while (not done) and (not Eof(f)) do
+      begin
+        repeat
+          if hs^='' then
+           begin
+             ReadLn(f,hs^);
+             hs^:=UCase(hs^);
+           end;
+          RemoveSep(hs^);
+        until (hs^<>'') or Eof(f);
+        if Comment then
+         begin
+           i:=pos('}',hs^);
+           if (i>0) then
+            begin
+              j:=pos('{',hs^);
+              if (j>0) and (j<i) then
+               begin
+                 Comment:=true;
+                 Delete(hs^,1,j-1);
+               end
+              else
+               begin
+                 Comment:=false;
+                 Delete(hs^,1,i-1);
+               end;
+            end
+           else
+            hs^:='';
+         end;
+        if (pos('(*',hs^)>0) or OldComment then
+         begin
+           i:=pos('*)',hs^);
+           if (i>0) then
+            begin
+              OldComment:=false;
+              Delete(hs^,1,i+1);
+            end
+           else
+            begin
+              OldComment:=true;
+              hs^:='';
+            end;
+         end;
+        if (hs^<>'') then
+         begin
+           case hs^[1] of
+            '}' : begin
+                    Comment:=false;
+                    hs^:='';
+                  end;
+            '{' : begin
+                    if (Copy(hs^,2,6)='$IFDEF') then
+                     begin
+                       Delete(hs^,1,7);
+                       RemoveSep(hs^);
+                       inc(Level);
+                       if Level>=MaxLevel then
+                        begin
+                          Writeln('Too many IF(N)DEFs');
+                          Halt(1);
+                        end;
+                       skip[level]:=skip[level-1] or (not CheckDefine(GetName(hs^)));
+                       hs^:='';
+                     end
+                    else
+                     if (Copy(hs^,2,7)='$IFNDEF') then
+                      begin
+                        Delete(hs^,1,7);
+                        RemoveSep(hs^);
+                        inc(Level);
+                        if Level>=MaxLevel then
+                         begin
+                           Writeln('Too many IF(N)DEFs');
+                           Halt(1);
+                         end;
+                        skip[level]:=skip[level-1] or (CheckDefine(GetName(hs^)));
+                        hs^:='';
+                      end
+                    else
+                     if (Copy(hs^,2,6)='$ELSE') then
+                      begin
+                        skip[level]:=skip[level-1] or (not skip[level]);
+                        hs^:='';
+                      end
+                    else
+                     if (Copy(hs^,2,6)='$ENDIF') then
+                      begin
+                        skip[level]:=false;
+                        if Level=0 then
+                         begin
+                           Writeln('Too many ENDIFs');
+                           Halt(1);
+                         end;
+                        dec(level);
+                        hs^:='';
+                      end
+                    else
+                     if (Copy(hs^,2,6)='$IFOPT') then
+                      begin
+                        inc(Level);
+                        if Level>=MaxLevel then
+                         begin
+                           Writeln('Too many IF(N)DEFs');
+                           Halt(1);
+                         end;
+                        skip[level]:=true;
+                        hs^:='';
+                      end
+                    else
+                     begin
+                       i:=pos('}',hs^);
+                       if i>0 then
+                        begin
+                          Delete(hs^,1,i);
+                          Comment:=false;
+                        end
+                       else
+                        Comment:=true;
+                     end;
+                  end;
+            ';' : begin
+                    UsesDone:=true;
+                    Done:=(UsesDone and InImplementation);
+                    hs^:='';
+                  end;
+           else
+            begin
+              if skip[level] then
+               hs^:=''
+              else
+               begin
+                 if (not UsesDone) then
+                  begin
+                    new(curruses);
+                    curruses^.Name:=GetName(hs^);
+                    curruses^.next:=nil;
+                    if currunit^.useslist=nil then
+                     currunit^.useslist:=curruses
+                    else
+                     begin
+                       lastuses:=currunit^.useslist;
+                       while not (lastuses^.Next=nil) do
+                        lastuses:=lastuses^.next;
+                       lastuses^.next:=curruses;
+                     end;
+   {$ifndef debug}
+                    ListDepend(curruses^.Name);
+   {$endif}
+                    RemoveSep(hs^);
+                  end
+                 else
+                  begin
+                    if (Copy(hs^,1,4)='USES') and ((length(hs^)=4) or (hs^[5] in [' ',#9])) then
+                     begin
+                       Delete(hs^,1,4);
+                       UsesDone:=false;
+                     end
+                    else
+                     begin
+                       if (hs^='IMPLEMENTATION') then
+                        InImplementation:=true
+                       else
+                        if (Copy(hs^,1,7)='PROGRAM') then
+                         begin
+                           currunit^.IsUnit:=false;
+                           InImplementation:=true; {there can be only 1 uses}
+                         end
+                       else
+                         if InImplementation and ((copy(hs^,1,5)='CONST') or
+                            (copy(hs^,1,3)='VAR') or (copy(hs^,1,5)='BEGIN')) then
+                          done:=true;
+                       hs^:='';
+                     end;
+                  end;
+               end;
+            end;
+           end;
+         end;
+      end;
+     Close(f);
+   end
+  else
+   dispose(currunit);
+  dispose(hs);
+end;
+
+
+procedure ShowDepend;
+var
+  currunit : PUnit;
+  curruses : PUses;
+  t        : text;
+  P        : PDefine;
+  First    : boolean;
+begin
+  if CallLine='' then
+   begin
+     CallLine:='ppc386 ';
+     P:=Define;
+     While P<>Nil do
+      begin
+        CallLine:=CallLine+' -d'+P^.Name;
+        P:=P^.Next;
+      end;
+   end;
+  assign(t,OutFile);
+  rewrite(t);
+  currunit:=UnitList;
+  First:=true;
+  while not (currunit=nil) do
+   begin
+     if currunit^.IsUnit then
+      Write(t,FixFn(currunit^.Name+'.'+unitext)+': '+currunit^.PasFn)
+     else
+      Write(t,FixFn(currunit^.Name+exeext)+': '+currunit^.PasFn);
+     curruses:=currunit^.useslist;
+     while not (curruses=nil) do
+      begin
+{$ifndef debug}
+        if UnitDone(curruses^.name) then
+{$endif}
+         begin
+           writeln(t,' \');
+           write(t,#9+FixFn(curruses^.name+'.'+unitext));
+         end;
+        curruses:=curruses^.next;
+      end;
+     writeln(t,'');
+     If (AddCall=2) or (First and (AddCall=1)) then
+      writeln(t,#9,CallLine,' ',currunit^.PasFn);
+     writeln(t,'');
+     currunit:=currunit^.next;
+     First:=false;
+   end;
+  close(t);
+end;
+
+
+procedure getpara;
+var
+  ch   : char;
+  para : string[128];
+  i    : word;
+
+  procedure helpscreen;
+  begin
+    writeln('ppdep [Options] <File>');
+    Writeln;
+    Writeln('Options can be: -D<define>   Define a symbol');
+    Writeln('                -oFile       Write output to file');
+    WRiteln('                             (default stdout)');
+    Writeln('                -eext        Set unit extension to ext');
+    Writeln('                             (default ppu)');
+    Writeln('                -V           Be more verbose');
+    Writeln('          -? or -H           This HelpScreen');
+    Writeln('                -A[call]     Add compiler calls to makefile');
+    halt(1);
+  end;
+
+begin
+  Define:=Nil;
+  Outfile:='';
+  AddCall:=0;
+  Verbose:=False;
+{$IFDEF LINUX}
+  UnitExt:='ppu';
+{$ELSE}
+  UnitExt:='PPU';
+{$endif}
+  for i:=1 to paramcount do
+   begin
+     para:=Paramstr(i);
+     if (para[1]='-') then
+      begin
+        ch:=Upcase(para[2]);
+        delete(para,1,2);
+        case ch of
+         'A' : begin
+                 AddCall:=2;
+                 CallLine:=Para;
+               end;
+         'F' : begin
+                 AddCall:=1;
+                 CallLine:=Para;
+               end;
+         'D' : AddDefine(para);
+         'O' : OutFile:=Para;
+         'E' : UnitExt:=Para;
+         'V' : verbose:=true;
+     '?','H' : helpscreen;
+        end;
+     end
+    else
+     begin
+       ParaFile:=Para;
+       if Pos('.',ParaFile)>0 then
+        Delete(Parafile,Pos('.',ParaFile),255);
+     end;
+    end;
+  if (ParaFile='') then
+   HelpScreen;
+end;
+
+
+begin
+  GetPara;
+  ListDepend(ParaFile);
+  ShowDepend;
+end.
+
+{
+  $Log$
+  Revision 1.1  1999-05-12 16:11:39  peter
+    * moved
+
+  Revision 1.1  1999/05/03 18:03:15  peter
+    * renamed mkdep -> ppdep
+    * removed obsolete units
+    * add .cod files
+
+  Revision 1.7  1998/11/18 11:15:14  michael
+  + Added support for different unit extensions
+
+  Revision 1.6  1998/10/22 23:51:35  peter
+    * better comment support
+
+  Revision 1.5  1998/08/10 09:55:21  peter
+    * fix for uses in rejected part
+
+  Revision 1.4  1998/06/24 14:02:17  peter
+    + (* *) support
+
+  Revision 1.3  1998/06/23 14:01:18  peter
+    + -F to add a line to only the first file
+
+  Revision 1.2  1998/03/27 18:39:20  peter
+    * fixed the preprocessor
+    + -A<call> to add the <call> to all the entries
+
+  Revision 1.1.1.1  1998/03/25 11:18:48  root
+  * Restored version
+
+  Revision 1.5  1998/03/15 15:39:23  peter
+    * fixed $ELSE
+
+  Revision 1.4  1998/03/10 12:53:24  peter
+    * much better preprocessor
+    + IFOPT skipping
+
+  Revision 1.3  1998/03/02 13:45:34  peter
+    * works better and exefile name is written when a program is parsed
+
+  Revision 1.2  1998/02/24 13:55:07  michael
+  + Added option to write to file. Default is to stdout
+  + Added option to write/not write a compiler call
+  + Nr of defines is now unlimited.
+  * Fixed bug with uppercase filenames under linux.
+
+  Revision 1.1  1998/02/23 23:16:48  peter
+    + Initial implementation
+}

+ 1013 - 0
utils/ppu.pas

@@ -0,0 +1,1013 @@
+{
+    $Id$
+    Copyright (c) 1993-98 by Florian Klaempfl
+
+    Routines to read/write ppu files
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+{$ifdef TP}
+  {$N+,E+}
+{$endif}
+unit ppu;
+interface
+
+{$ifdef Test_Double_checksum}
+var
+  CRCFile : text;
+const
+  CRC_array_Size = 20000;
+type
+  tcrc_array = array[0..crc_array_size] of longint;
+  pcrc_array = ^tcrc_array;
+{$endif Test_Double_checksum}
+
+const
+{$ifdef OLDPPU}
+  CurrentPPUVersion=15;
+{$else}
+  CurrentPPUVersion=16;
+{$endif}
+
+{ buffer sizes }
+  maxentrysize = 1024;
+{$ifdef TP}
+  ppubufsize   = 1024;
+{$else}
+  ppubufsize   = 16384;
+{$endif}
+
+{ppu entries}
+  mainentryid         = 1;
+  subentryid          = 2;
+  {special}
+  iberror             = 0;
+  ibstartdefs         = 248;
+  ibenddefs           = 249;
+  ibstartsyms         = 250;
+  ibendsyms           = 251;
+  ibendinterface      = 252;
+  ibendimplementation = 253;
+  ibendbrowser        = 254;
+  ibend               = 255;
+  {general}
+  ibmodulename     = 1;
+  ibsourcefiles    = 2;
+  ibloadunit       = 3;
+  ibinitunit       = 5;
+  iblinkofiles     = 6;
+  iblinksharedlibs = 7;
+  iblinkstaticlibs = 8;
+  ibdbxcount       = 9;
+  ibsymref         = 10;
+  ibdefref         = 11;
+  ibendsymtablebrowser   = 12;
+  ibbeginsymtablebrowser = 13;
+  iblinkunitfiles  = 14;
+  {syms}
+  ibtypesym       = 20;
+  ibprocsym       = 21;
+  ibvarsym        = 22;
+  ibconstsym      = 23;
+  ibenumsym       = 24;
+  ibtypedconstsym = 25;
+  ibabsolutesym   = 26;
+  ibpropertysym   = 27;
+  ibvarsym_C      = 28;
+  ibunitsym       = 29;  { needed for browser }
+  iblabelsym      = 30;
+  ibfuncretsym    = 31;
+  ibsyssym        = 32;
+  {definitions}
+  iborddef         = 40;
+  ibpointerdef     = 41;
+  ibarraydef       = 42;
+  ibprocdef        = 43;
+  ibshortstringdef = 44;
+  ibrecorddef      = 45;
+  ibfiledef        = 46;
+  ibformaldef      = 47;
+  ibobjectdef      = 48;
+  ibenumdef        = 49;
+  ibsetdef         = 50;
+  ibprocvardef     = 51;
+  ibfloatdef       = 52;
+  ibclassrefdef    = 53;
+  iblongstringdef  = 54;
+  ibansistringdef  = 55;
+  ibwidestringdef  = 56;
+
+{ unit flags }
+  uf_init          = $1;
+  uf_finalize      = $2;
+  uf_big_endian    = $4;
+  uf_has_dbx       = $8;
+  uf_has_browser   = $10;
+  uf_smartlink     = $20;  { the ppu is smartlinked }
+  uf_in_library    = $40;  { is the file in another file than <ppufile>.* ? }
+  uf_static_linked = $80;  { the ppu is linked in a static library }
+  uf_shared_linked = $100; { the ppu is linked in a shared library }
+  uf_local_browser = $200;
+  uf_obj_linked    = $400; { the ppu is linked in a object file }
+
+type
+{$ifdef m68k}
+  ppureal=single;
+{$else}
+  ppureal=extended;
+{$endif}
+
+  tppuerror=(ppuentrytoobig,ppuentryerror);
+
+  tppuheader=packed record { 40 bytes }
+    id       : array[1..3] of char; { = 'PPU' }
+    ver      : array[1..3] of char;
+    compiler : word;
+    cpu      : word;
+    target   : word;
+    flags    : longint;
+    size     : longint; { size of the ppufile without header }
+    checksum : longint; { checksum for this ppufile }
+{$ifndef OLDPPU}
+    interface_checksum : longint;
+    future   : array[0..2] of longint;
+{$endif}
+  end;
+
+  tppuentry=packed record
+    id   : byte;
+    nr   : byte;
+    size : longint;
+  end;
+
+  pppufile=^tppufile;
+  tppufile=object
+    f        : file;
+    mode     : byte; {0 - Closed, 1 - Reading, 2 - Writing}
+    error    : boolean;
+    fname    : string;
+    fsize    : longint;
+
+    header   : tppuheader;
+    size,crc : longint;
+{$ifdef Test_Double_checksum}
+    crcindex : longint;
+    crc_index : longint;
+    crc_test : pcrc_array;
+{$endif def Test_Double_checksum}
+    interface_crc : longint;
+    do_interface_crc : boolean;
+    crc_only : boolean;    { used to calculate interface_crc before implementation }
+    do_crc,
+    change_endian : boolean;
+
+    buf      : pchar;
+    bufstart,
+    bufsize,
+    bufidx   : longint;
+    entrybufstart,
+    entrystart,
+    entryidx : longint;
+    entry    : tppuentry;
+    entrytyp : byte;
+
+    constructor init(fn:string);
+    destructor  done;
+    procedure flush;
+    procedure close;
+    function  CheckPPUId:boolean;
+    function  GetPPUVersion:longint;
+    procedure NewHeader;
+    procedure NewEntry;
+  {read}
+    function  open:boolean;
+    procedure reloadbuf;
+    procedure readdata(var b;len:longint);
+    procedure skipdata(len:longint);
+    function  readentry:byte;
+    function  EndOfEntry:boolean;
+    procedure getdatabuf(var b;len:longint;var result:longint);
+    procedure getdata(var b;len:longint);
+    function  getbyte:byte;
+    function  getword:word;
+    function  getlongint:longint;
+    function  getreal:ppureal;
+    function  getstring:string;
+    function  skipuntilentry(untilb:byte):boolean;
+  {write}
+    function  create:boolean;
+    procedure writeheader;
+    procedure writebuf;
+    procedure writedata(var b;len:longint);
+    procedure writeentry(ibnr:byte);
+    procedure putdata(var b;len:longint);
+    procedure putbyte(b:byte);
+    procedure putword(w:word);
+    procedure putlongint(l:longint);
+    procedure putreal(d:ppureal);
+    procedure putstring(s:string);
+  end;
+
+implementation
+
+{$ifdef Test_Double_checksum}
+  uses
+    comphook;
+{$endif def Test_Double_checksum}
+
+
+{*****************************************************************************
+                                   Crc 32
+*****************************************************************************}
+
+var
+  Crc32Tbl : array[0..255] of longint;
+
+procedure MakeCRC32Tbl;
+var
+  crc : longint;
+  i,n : byte;
+begin
+  for i:=0 to 255 do
+   begin
+     crc:=i;
+     for n:=1 to 8 do
+      if odd(crc) then
+       crc:=(crc shr 1) xor $edb88320
+      else
+       crc:=crc shr 1;
+     Crc32Tbl[i]:=crc;
+   end;
+end;
+
+
+{$ifopt R+}
+{$define Range_check_on}
+{$endif opt R+}
+
+{$R- needed here }
+{CRC 32}
+Function Crc32(Const HStr:String):longint;
+var
+  i,InitCrc : longint;
+begin
+  if Crc32Tbl[1]=0 then
+   MakeCrc32Tbl;
+  InitCrc:=$ffffffff;
+  for i:=1to Length(Hstr) do
+   InitCrc:=Crc32Tbl[byte(InitCrc) xor ord(Hstr[i])] xor (InitCrc shr 8);
+  Crc32:=InitCrc;
+end;
+
+
+
+Function UpdateCrc32(InitCrc:longint;var InBuf;InLen:Longint):longint;
+var
+  i : word;
+  p : pchar;
+begin
+  if Crc32Tbl[1]=0 then
+   MakeCrc32Tbl;
+  p:=@InBuf;
+  for i:=1to InLen do
+   begin
+     InitCrc:=Crc32Tbl[byte(InitCrc) xor byte(p^)] xor (InitCrc shr 8);
+     inc(longint(p));
+   end;
+  UpdateCrc32:=InitCrc;
+end;
+
+
+
+Function UpdCrc32(InitCrc:longint;b:byte):longint;
+begin
+  if Crc32Tbl[1]=0 then
+   MakeCrc32Tbl;
+  UpdCrc32:=Crc32Tbl[byte(InitCrc) xor b] xor (InitCrc shr 8);
+end;
+
+{$ifdef Range_check_on}
+{$R+}
+{$undef Range_check_on}
+{$endif Range_check_on}
+
+{*****************************************************************************
+                                  TPPUFile
+*****************************************************************************}
+
+constructor tppufile.init(fn:string);
+begin
+  fname:=fn;
+  change_endian:=false;
+  crc_only:=false;
+  Mode:=0;
+  NewHeader;
+  Error:=false;
+  getmem(buf,ppubufsize);
+end;
+
+
+destructor tppufile.done;
+begin
+  close;
+  freemem(buf,ppubufsize);
+end;
+
+
+procedure tppufile.flush;
+begin
+  if Mode=2 then
+   writebuf;
+end;
+
+
+procedure tppufile.close;
+var
+  i : word;
+begin
+  if Mode<>0 then
+   begin
+     Flush;
+     {$I-}
+      system.close(f);
+     {$I+}
+     i:=ioresult;
+     Mode:=0;
+   end;
+end;
+
+
+function tppufile.CheckPPUId:boolean;
+begin
+  CheckPPUId:=((Header.Id[1]='P') and (Header.Id[2]='P') and (Header.Id[3]='U'));
+end;
+
+
+function tppufile.GetPPUVersion:longint;
+var
+  l    : longint;
+  code : word;
+begin
+  Val(header.ver[1]+header.ver[2]+header.ver[3],l,code);
+  if code=0 then
+   GetPPUVersion:=l
+  else
+   GetPPUVersion:=0;
+end;
+
+
+procedure tppufile.NewHeader;
+begin
+  fillchar(header,sizeof(tppuheader),0);
+  with header do
+   begin
+     Id[1]:='P';
+     Id[2]:='P';
+     Id[3]:='U';
+     Ver[1]:='0';
+     Ver[2]:='1';
+{$ifdef OLDPPU}
+     Ver[3]:='5';
+{$else}
+     Ver[3]:='6';
+{$endif}
+   end;
+end;
+
+
+{*****************************************************************************
+                                TPPUFile Reading
+*****************************************************************************}
+
+function tppufile.open:boolean;
+var
+  ofmode : byte;
+  i      : word;
+begin
+  open:=false;
+  assign(f,fname);
+  ofmode:=filemode;
+  filemode:=$0;
+  {$I-}
+   reset(f,1);
+  {$I+}
+  filemode:=ofmode;
+  if ioresult<>0 then
+   exit;
+{read ppuheader}
+  fsize:=filesize(f);
+  if fsize<sizeof(tppuheader) then
+   exit;
+  blockread(f,header,sizeof(tppuheader),i);
+{reset buffer}
+  bufstart:=i;
+  bufsize:=0;
+  bufidx:=0;
+  Mode:=1;
+  FillChar(entry,sizeof(tppuentry),0);
+  entryidx:=0;
+  entrystart:=0;
+  entrybufstart:=0;
+  Error:=false;
+  open:=true;
+end;
+
+
+procedure tppufile.reloadbuf;
+{$ifdef TP}
+var
+  i : word;
+{$endif}
+begin
+  inc(bufstart,bufsize);
+{$ifdef TP}
+  blockread(f,buf^,ppubufsize,i);
+  bufsize:=i;
+{$else}
+  blockread(f,buf^,ppubufsize,bufsize);
+{$endif}
+  bufidx:=0;
+end;
+
+
+procedure tppufile.readdata(var b;len:longint);
+var
+  p   : pchar;
+  left,
+  idx : longint;
+begin
+  p:=pchar(@b);
+  idx:=0;
+  while len>0 do
+   begin
+     left:=bufsize-bufidx;
+     if len>left then
+      begin
+        move(buf[bufidx],p[idx],left);
+        dec(len,left);
+        inc(idx,left);
+        reloadbuf;
+        if bufsize=0 then
+         exit;
+      end
+     else
+      begin
+        move(buf[bufidx],p[idx],len);
+        inc(bufidx,len);
+        exit;
+      end;
+   end;
+end;
+
+
+procedure tppufile.skipdata(len:longint);
+var
+  left : longint;
+begin
+  while len>0 do
+   begin
+     left:=bufsize-bufidx;
+     if len>left then
+      begin
+        dec(len,left);
+        reloadbuf;
+        if bufsize=0 then
+         exit;
+      end
+     else
+      begin
+        inc(bufidx,len);
+        exit;
+      end;
+   end;
+end;
+
+
+function tppufile.readentry:byte;
+begin
+  if entryidx<entry.size then
+   skipdata(entry.size-entryidx);
+  readdata(entry,sizeof(tppuentry));
+  entrystart:=bufstart+bufidx;
+  entryidx:=0;
+  if not(entry.id in [mainentryid,subentryid]) then
+   begin
+     readentry:=iberror;
+     error:=true;
+     exit;
+   end;
+  readentry:=entry.nr;
+end;
+
+
+function tppufile.endofentry:boolean;
+begin
+  endofentry:=(entryidx>=entry.size);
+end;
+
+
+procedure tppufile.getdatabuf(var b;len:longint;var result:longint);
+begin
+  if entryidx+len>entry.size then
+   result:=entry.size-entryidx
+  else
+   result:=len;
+  readdata(b,result);
+  inc(entryidx,result);
+end;
+
+
+procedure tppufile.getdata(var b;len:longint);
+begin
+  if entryidx+len>entry.size then
+   begin
+     error:=true;
+     exit;
+   end;
+  readdata(b,len);
+  inc(entryidx,len);
+end;
+
+
+function tppufile.getbyte:byte;
+var
+  b : byte;
+begin
+  if entryidx+1>entry.size then
+   begin
+     error:=true;
+     getbyte:=0;
+     exit;
+   end;
+  readdata(b,1);
+  getbyte:=b;
+  inc(entryidx);
+end;
+
+
+function tppufile.getword:word;
+type
+  pword = ^word;
+var
+  w : word;
+begin
+  if entryidx+2>entry.size then
+   begin
+     error:=true;
+     getword:=0;
+     exit;
+   end;
+  readdata(w,2);
+  if change_endian then
+   getword:=swap(w)
+  else
+   getword:=w;
+  inc(entryidx,2);
+end;
+
+
+function tppufile.getlongint:longint;
+type
+  plongint = ^longint;
+var
+  l : longint;
+begin
+  if entryidx+4>entry.size then
+   begin
+     error:=true;
+     getlongint:=0;
+     exit;
+   end;
+  readdata(l,4);
+  if change_endian then
+  { someone added swap(l : longint) in system unit
+   this broke the following code !! }
+   getlongint:=swap(word(l shr 16)) or (longint(swap(word(l and $ffff))) shl 16)
+  else
+   getlongint:=l;
+  inc(entryidx,4);
+end;
+
+
+function tppufile.getreal:ppureal;
+type
+  pppureal = ^ppureal;
+var
+  d : ppureal;
+begin
+  if entryidx+sizeof(ppureal)>entry.size then
+   begin
+     error:=true;
+     getreal:=0;
+     exit;
+   end;
+  readdata(d,sizeof(ppureal));
+  getreal:=d;
+  inc(entryidx,sizeof(ppureal));
+end;
+
+
+function tppufile.getstring:string;
+var
+  s : string;
+begin
+  {$ifndef TP}
+    {$ifopt H+}
+      setlength(s,getbyte);
+    {$else}
+      s[0]:=chr(getbyte);
+    {$endif}
+  {$else}
+    s[0]:=chr(getbyte);
+  {$endif}
+  if entryidx+length(s)>entry.size then
+   begin
+     error:=true;
+     exit;
+   end;
+  ReadData(s[1],length(s));
+  getstring:=s;
+  inc(entryidx,length(s));
+end;
+
+
+function tppufile.skipuntilentry(untilb:byte):boolean;
+var
+  b : byte;
+begin
+  repeat
+    b:=readentry;
+  until (b in [ibend,iberror]) or ((b=untilb) and (entry.id=mainentryid));
+  skipuntilentry:=(b=untilb);
+end;
+
+
+{*****************************************************************************
+                                TPPUFile Writing
+*****************************************************************************}
+
+function tppufile.create:boolean;
+begin
+  create:=false;
+  assign(f,fname);
+  {$I-}
+   rewrite(f,1);
+  {$I+}
+  if ioresult<>0 then
+   exit;
+  Mode:=2;
+{write header for sure}
+  blockwrite(f,header,sizeof(tppuheader));
+  bufsize:=ppubufsize;
+  bufstart:=sizeof(tppuheader);
+  bufidx:=0;
+{reset}
+  crc:=$ffffffff;
+  interface_crc:=$ffffffff;
+  do_interface_crc:=true;
+  Error:=false;
+  do_crc:=true;
+  size:=0;
+  entrytyp:=mainentryid;
+{start}
+  NewEntry;
+  create:=true;
+end;
+
+
+procedure tppufile.writeheader;
+var
+  opos : longint;
+begin
+{ flush buffer }
+  writebuf;
+{ update size (w/o header!) in the header }
+  header.size:=bufstart-sizeof(tppuheader);
+{ write header and restore filepos after it }
+  opos:=filepos(f);
+  seek(f,0);
+  blockwrite(f,header,sizeof(tppuheader));
+  seek(f,opos);
+end;
+
+
+procedure tppufile.writebuf;
+begin
+  blockwrite(f,buf^,bufidx);
+  inc(bufstart,bufidx);
+  bufidx:=0;
+end;
+
+
+procedure tppufile.writedata(var b;len:longint);
+var
+  p   : pchar;
+  left,
+  idx : longint;
+begin
+  p:=pchar(@b);
+  idx:=0;
+  while len>0 do
+   begin
+     left:=bufsize-bufidx;
+     if len>left then
+      begin
+        move(p[idx],buf[bufidx],left);
+        dec(len,left);
+        inc(idx,left);
+        inc(bufidx,left);
+        writebuf;
+      end
+     else
+      begin
+        move(p[idx],buf[bufidx],len);
+        inc(bufidx,len);
+        exit;
+      end;
+   end;
+end;
+
+
+procedure tppufile.NewEntry;
+begin
+  with entry do
+   begin
+     id:=entrytyp;
+     nr:=ibend;
+     size:=0;
+   end;
+{Reset Entry State}
+  entryidx:=0;
+  entrybufstart:=bufstart;
+  entrystart:=bufstart+bufidx;
+{Alloc in buffer}
+  writedata(entry,sizeof(tppuentry));
+end;
+
+
+procedure tppufile.writeentry(ibnr:byte);
+var
+  opos : longint;
+begin
+{create entry}
+  entry.id:=entrytyp;
+  entry.nr:=ibnr;
+  entry.size:=entryidx;
+{it's already been sent to disk ?}
+  if entrybufstart<>bufstart then
+   begin
+   {flush to be sure}
+     WriteBuf;
+   {write entry}
+     opos:=filepos(f);
+     seek(f,entrystart);
+     blockwrite(f,entry,sizeof(tppuentry));
+     seek(f,opos);
+     entrybufstart:=bufstart;
+   end
+  else
+   move(entry,buf[entrystart-bufstart],sizeof(entry));
+{Add New Entry, which is ibend by default}
+  entrystart:=bufstart+bufidx; {next entry position}
+  NewEntry;
+end;
+
+
+procedure tppufile.putdata(var b;len:longint);
+begin
+  if do_crc then
+   begin
+     crc:=UpdateCrc32(crc,b,len);
+{$ifndef OLDPPU}
+     if do_interface_crc then
+       begin
+         interface_crc:=UpdateCrc32(interface_crc,b,len);
+{$ifdef Test_Double_checksum}
+        if crc_only then
+          begin
+            crc_test^[crc_index]:=interface_crc;
+{$ifdef Test_Double_checksum_write}
+            Writeln(CRCFile,interface_crc);
+{$endif Test_Double_checksum_write}
+            if crc_index<crc_array_size then
+             inc(crc_index);
+          end
+        else
+          begin
+            if (crcindex<crc_array_size) and (crcindex<crc_index) and
+               (crc_test^[crcindex]<>interface_crc) then
+              Def_comment(V_Warning,'CRC changed');
+{$ifdef Test_Double_checksum_write}
+            Writeln(CRCFile,interface_crc);
+{$endif Test_Double_checksum_write}
+            inc(crcindex);
+          end;
+{$endif def Test_Double_checksum}
+       end;
+    end;
+  if not crc_only then
+{$else}
+    end;
+{$endif OLDPPU}
+    writedata(b,len);
+  inc(entryidx,len);
+end;
+
+
+procedure tppufile.putbyte(b:byte);
+begin
+  writedata(b,1);
+  inc(entryidx);
+end;
+
+
+procedure tppufile.putword(w:word);
+begin
+  if change_endian then
+   w:=swap(w);
+  putdata(w,2);
+end;
+
+
+procedure tppufile.putlongint(l:longint);
+begin
+  if change_endian then
+  { someone added swap(l : longint) in system unit
+   this broke the following code !! }
+   l:=swap(word(l shr 16)) or (longint(swap(word(l and $ffff))) shl 16);
+  putdata(l,4);
+end;
+
+
+procedure tppufile.putreal(d:ppureal);
+begin
+  putdata(d,sizeof(ppureal));
+end;
+
+
+procedure tppufile.putstring(s:string);
+begin
+  putdata(s,length(s)+1);
+end;
+
+
+end.
+{
+  $Log$
+  Revision 1.1  1999-05-12 16:11:39  peter
+    * moved
+
+  Revision 1.7  1999/04/26 18:27:38  peter
+    * more updates
+
+  Revision 1.29  1999/04/26 13:31:41  peter
+    * release storenumber,double_checksum
+
+  Revision 1.28  1999/04/26 09:33:07  peter
+    * header extended to 40 bytes so there is room for future
+
+  Revision 1.27  1999/04/17 13:16:20  peter
+    * fixes for storenumber
+
+  Revision 1.26  1999/04/07 15:39:31  pierre
+    + double_checksum code added
+
+  Revision 1.25  1999/03/02 13:49:18  peter
+    * renamed loadunit_int -> loadunit
+
+  Revision 1.24  1999/02/22 13:07:00  pierre
+    + -b and -bl options work !
+    + cs_local_browser ($L+) is disabled if cs_browser ($Y+)
+      is not enabled when quitting global section
+    * local vars and procedures are not yet stored into PPU
+
+  Revision 1.23  1999/02/16 00:48:24  peter
+    * save in the ppu if linked with obj file instead of using the
+      library flag, so the .inc files are also checked
+
+  Revision 1.22  1999/02/05 08:54:29  pierre
+    + linkofiles splitted inot linkofiles and linkunitfiles
+      because linkofiles must be stored with directory
+      to enabled linking of different objects with same name
+      in a different directory
+
+  Revision 1.21  1998/12/30 22:15:50  peter
+    + farpointer type
+    * absolutesym now also stores if its far
+
+  Revision 1.20  1998/11/30 16:34:45  pierre
+    * corrected problems with rangecheck
+    + added needed code for no rangecheck  in CRC32 functions in ppu unit
+    * enumdef lso need its rangenr reset to zero
+      when calling reset_global_defs
+
+  Revision 1.19  1998/11/16 15:41:42  peter
+    * tp7 didn't like my ifopt H+ :(
+
+  Revision 1.18  1998/11/16 12:18:03  peter
+    * H+ fixes
+
+  Revision 1.17  1998/10/14 10:45:08  pierre
+    * ppu problems for m68k fixed (at least in cross compiling)
+    * one last memory leak for sysamiga fixed
+    * the amiga RTL compiles now completely !!
+
+  Revision 1.16  1998/09/24 23:49:14  peter
+    + aktmodeswitches
+
+  Revision 1.15  1998/09/23 15:39:10  pierre
+    * browser bugfixes
+      was adding a reference when looking for the symbol
+      if -bSYM_NAME was used
+
+  Revision 1.14  1998/09/21 10:00:07  peter
+    * store number of defs in ppu file
+
+  Revision 1.13  1998/09/21 08:45:18  pierre
+    + added vmt_offset in tobjectdef.write for fututre use
+      (first steps to have objects without vmt if no virtual !!)
+    + added fpu_used field for tabstractprocdef  :
+      sets this level to 2 if the functions return with value in FPU
+      (is then set to correct value at parsing of implementation)
+      THIS MIGHT refuse some code with FPU expression too complex
+      that were accepted before and even in some cases
+      that don't overflow in fact
+      ( like if f : float; is a forward that finally in implementation
+       only uses one fpu register !!)
+      Nevertheless I think that it will improve security on
+      FPU operations !!
+    * most other changes only for UseBrowser code
+      (added symtable references for record and objects)
+      local switch for refs to args and local of each function
+      (static symtable still missing)
+      UseBrowser still not stable and probably broken by
+      the definition hash array !!
+
+  Revision 1.12  1998/09/18 08:01:37  pierre
+    + improvement on the usebrowser part
+      (does not work correctly for now)
+
+  Revision 1.11  1998/09/11 15:16:47  peter
+    * merge fixes
+
+  Revision 1.10.2.1  1998/09/11 15:15:04  peter
+    * fixed not in [] bug
+
+  Revision 1.10  1998/08/31 12:26:30  peter
+    * m68k and palmos updates from surebugfixes
+
+  Revision 1.9  1998/08/17 09:17:51  peter
+    * static/shared linking updates
+
+  Revision 1.8  1998/08/11 15:31:40  peter
+    * write extended to ppu file
+    * new version 0.99.7
+
+  Revision 1.7  1998/06/25 10:51:01  pierre
+    * removed a remaining ifndef NEWPPU
+      replaced by ifdef OLDPPU
+    * added uf_finalize to ppu unit
+
+  Revision 1.6  1998/06/16 08:56:26  peter
+    + targetcpu
+    * cleaner pmodules for newppu
+
+  Revision 1.5  1998/06/13 00:10:12  peter
+    * working browser and newppu
+    * some small fixes against crashes which occured in bp7 (but not in
+      fpc?!)
+
+  Revision 1.4  1998/06/09 16:01:48  pierre
+    + added procedure directive parsing for procvars
+      (accepted are popstack cdecl and pascal)
+    + added C vars with the following syntax
+      var C calias 'true_c_name';(can be followed by external)
+      reason is that you must add the Cprefix
+
+      which is target dependent
+
+  Revision 1.3  1998/05/28 14:40:26  peter
+    * fixes for newppu, remake3 works now with it
+
+  Revision 1.2  1998/05/27 19:45:08  peter
+    * symtable.pas splitted into includefiles
+    * symtable adapted for $ifdef NEWPPU
+
+  Revision 1.1  1998/05/12 10:56:07  peter
+    + the ppufile object unit
+
+}

+ 1275 - 0
utils/ppudump.pp

@@ -0,0 +1,1275 @@
+{
+    $Id$
+    Copyright (c) 1995-98 by the FPC Development Team
+
+    Dumps the contents of a FPC unit file (PPU File)
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************}
+{$ifdef TP}
+  {$N+,E+}
+{$endif}
+program pppdump;
+uses ppu;
+
+const
+  Version   = 'Version 0.99.11';
+  Title     = 'PPU-Analyser';
+  Copyright = 'Copyright (c) 1995-99 by the Free Pascal Development Team';
+
+{ verbosity }
+  v_none           = $0;
+  v_header         = $1;
+  v_defs           = $2;
+  v_syms           = $4;
+  v_interface      = $8;
+  v_implementation = $10;
+  v_browser        = $20;
+  v_all            = $ff;
+
+var
+  ppufile     : pppufile;
+  space       : string;
+  symcnt,
+  defcnt      : longint;
+  read_member : boolean;
+  verbose     : longint;
+
+{****************************************************************************
+                          Helper Routines
+****************************************************************************}
+
+const has_errors : boolean = false;
+Procedure Error(const S : string);
+Begin
+   Writeln(S);
+   has_errors:=true;
+End;
+
+Function Target2Str(w:longint):string;
+type
+  ttarget = (target_none
+     ,target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
+      target_i386_OS2,target_i386_Win32
+     ,target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac,
+      target_m68k_linux,target_m68k_PalmOS
+  );
+const
+  Targets : array[ttarget] of string[10]=('none',
+     'GO32V1','GO32V2','Linux-i386','OS/2','Win32',
+     'Amiga','Mac68k','Atari','Linux-m68k','PalmOs');
+begin
+  if w<=ord(high(ttarget)) then
+    Target2Str:=Targets[ttarget(w)]
+  else
+    Target2Str:='<Unknown>';
+end;
+
+
+Function Cpu2Str(w:longint):string;
+type
+  ttargetcpu=(no_cpu
+       ,i386,m68k,alpha
+  );
+const
+  CpuTxt : array[ttargetcpu] of string[5]=
+    ('none','i386','m68k','alpha');
+begin
+  if w<=ord(high(ttargetcpu)) then
+    Cpu2Str:=CpuTxt[ttargetcpu(w)]
+  else
+    Cpu2Str:='<Unknown>';
+end;
+
+
+const
+  HexTbl : array[0..15] of char='0123456789ABCDEF';
+function HexB(b:byte):string;
+begin
+  HexB[0]:=#2;
+  HexB[1]:=HexTbl[b shr 4];
+  HexB[2]:=HexTbl[b and $f];
+end;
+
+
+{****************************************************************************
+                             Read Routines
+****************************************************************************}
+
+Procedure ReadContainer(const prefix:string);
+{
+  Read a serie of strings and write to the screen starting every line
+  with prefix
+}
+begin
+  while not ppufile^.endofentry do
+   WriteLn(prefix,ppufile^.getstring);
+end;
+
+
+Procedure ReadRef;
+begin
+  if (verbose and v_browser)=0 then
+   exit;
+  while (not ppufile^.endofentry) and (not ppufile^.error) do
+   Writeln(space,'        - Refered : ',ppufile^.getword,', (',ppufile^.getlongint,',',ppufile^.getword,')');
+end;
+
+
+procedure readdefref;
+var
+  w : word;
+begin
+  w:=ppufile^.getword;
+  if w=$ffff then
+    begin
+       w:=ppufile^.getword;
+       if w=$ffff then
+        writeln('nil')
+       else
+        writeln('Local Definition Nr. ',w);
+    end
+  else if w=$fffe then
+    begin
+       w:=ppufile^.getword;
+       writeln('Static Definition Nr. ',w);
+    end
+  else if w>$8000 then
+    writeln('Local symtable ',w,'  Definition Nr. ',ppufile^.getword)
+  else
+    writeln('Unit ',w,'  Definition Nr. ',ppufile^.getword)
+end;
+
+
+procedure readsymref;
+var
+  w : word;
+begin
+  w:=ppufile^.getword;
+  if w=$ffff then
+    begin
+       w:=ppufile^.getword;
+       if w=$ffff then
+        writeln('nil')
+       else
+        writeln('Local Symbol Nr. ',w)
+    end
+  else if w=$fffe then
+    begin
+       w:=ppufile^.getword;
+       writeln('Static Symbol Nr. ',w);
+    end
+  else if w>$8000 then
+    writeln('Local symtable ',w,'  Symbol Nr. ',ppufile^.getword)
+  else
+    writeln('Unit ',w,'  Symbol Nr. ',ppufile^.getword)
+end;
+
+
+procedure read_abstract_proc_def;
+type
+  tprocopt=record
+    mask : longint;
+    str  : string[30];
+  end;
+const
+  procopts=24;
+  procopt : array[1..procopts] of tprocopt=(
+     (mask:1;        str:'Exception handler'),
+     (mask:2;        str:'Virtual Method'),
+     (mask:4;        str:'Stack is not cleared'),
+     (mask:8;        str:'Constructor'),
+     (mask:$10;      str:'Destructor'),
+     (mask:$20;      str:'Internal Procedure'),
+     (mask:$40;      str:'Exported Procedure'),
+     (mask:$80;      str:'I/O-Checking'),
+     (mask:$100;     str:'Abstract method'),
+     (mask:$200;     str:'Interrupt Handler'),
+     (mask:$400;     str:'Inline Procedure'),
+     (mask:$800;     str:'Assembler Procedure'),
+     (mask:$1000;    str:'Overloaded Operator'),
+     (mask:$2000;    str:'External Procedure'),
+     (mask:$4000;    str:'Parameters from left to right'),
+     (mask:$8000;    str:'Main Program'),
+     (mask:$10000;   str:'Static Method'),
+     (mask:$20000;   str:'Method with Override Directive'),
+     (mask:$40000;   str:'Class Method'),
+     (mask:$80000;   str:'Unit Initialisation'),
+     (mask:$100000;  str:'Method Pointer'),
+     (mask:$200000;  str:'C Declaration'),
+     (mask:$400000;  str:'PalmOS Syscall'),
+     (mask:$800000;  str:'Has internal Constant Function')
+  );
+  tvarspez : array[0..2] of string[5]=('Value','Const','Var  ');
+var
+  procoptions,
+  i,params : longint;
+  first  : boolean;
+begin
+  write(space,'      Return type : ');
+  readdefref;
+  writeln(space,'         Fpu used : ',ppufile^.getbyte);
+  procoptions:=ppufile^.getlongint;
+  if procoptions<>0 then
+   begin
+     write(space,'          Options : ');
+     first:=true;
+     for i:=1to procopts do
+      if (procoptions and procopt[i].mask)<>0 then
+       begin
+         if first then
+           first:=false
+         else
+           write(', ');
+         write(procopt[i].str);
+       end;
+     writeln;
+   end;
+  params:=ppufile^.getword;
+  writeln(space,' Nr of parameters : ',params);
+  if params>0 then
+   begin
+     repeat
+       write(space,'       - ',tvarspez[ppufile^.getbyte],' ');
+       readdefref;
+       dec(params);
+     until params=0;
+   end;
+end;
+
+
+procedure readcommonsym(const s:string);
+type
+  tsymopt=record
+    mask : longint;
+    str  : string[30];
+  end;
+const
+  symopts=6;
+  symopt : array[1..symopts] of tsymopt=(
+     (mask:1;        str:'Public'),
+     (mask:2;        str:'Private'),
+     (mask:4;        str:'Published'),
+     (mask:8;        str:'Protected'),
+     (mask:$10;      str:'ForwardDef'),
+     (mask:$20;      str:'Static')
+  );
+var
+  symoptions,
+  i      : longint;
+  first  : boolean;
+begin
+  writeln(space,'** Symbol Nr. ',ppufile^.getword,' **');
+  writeln(space,s,ppufile^.getstring);
+  symoptions:=ppufile^.getbyte;
+  if symoptions<>0 then
+   begin
+     write(space,'     Options: ');
+     first:=true;
+     for i:=1to symopts do
+      if (symoptions and symopt[i].mask)<>0 then
+       begin
+         if first then
+           first:=false
+         else
+           write(', ');
+         write(symopt[i].str);
+       end;
+     writeln;
+   end;
+end;
+
+
+procedure readcommondef(const s:string);
+begin
+  writeln(space,'** Definition Nr. ',ppufile^.getword,' **');
+  writeln(space,s);
+  write  (space,'      Type symbol : ');
+  readsymref;
+end;
+
+
+{****************************************************************************
+                             Read Symbols Part
+****************************************************************************}
+
+procedure readsymbols;
+Const
+  vo_is_C_var = 2;
+Type
+  absolutetyp = (tovar,toasm,toaddr);
+  tconsttype  = (constord,conststring,constreal,constbool,constint,constchar,constseta);
+var
+  b      : byte;
+  totalsyms,
+  symcnt,
+  i,j    : longint;
+begin
+  symcnt:=1;
+  with ppufile^ do
+   begin
+     if space<>'' then
+      Writeln(space,'-----------------------------');
+     if readentry=ibstartsyms then
+      begin
+        totalsyms:=getlongint;
+        Writeln(space,'Number of symbols: ',totalsyms);
+        Writeln(space,'Symtable datasize: ',getlongint);
+      end
+     else
+      begin
+        totalsyms:=-1;
+        Writeln('!! ibstartsym not found');
+      end;
+     repeat
+       b:=readentry;
+       if not (b in [iberror,ibendsyms]) then
+        inc(symcnt);
+       case b of
+
+         ibunitsym :
+           readcommonsym('Unit symbol ');
+
+         iblabelsym :
+           readcommonsym('Label symbol ');
+
+         ibtypesym :
+           begin
+             readcommonsym('Type symbol ');
+             write(space,'  Definition: ');
+             readdefref;
+           end;
+
+         ibprocsym :
+           begin
+             readcommonsym('Procedure symbol ');
+             write(space,'  Definition: ');
+             readdefref;
+           end;
+
+         ibconstsym :
+           begin
+             readcommonsym('Constant symbol ');
+             b:=getbyte;
+             case tconsttype(b) of
+               constord :
+                 begin
+                   write (space,'  Definition : ');
+                   readdefref;
+                   writeln (space,'  Value : ',getlongint)
+                 end;
+               conststring :
+                 writeln(space,'  Value : "'+getstring+'"');
+               constreal :
+                 writeln(space,'  Value : ',getreal);
+               constbool :
+                 if getlongint<>0 then
+                   writeln (space,'  Value : True')
+                 else
+                   writeln (space,'  Value : False');
+               constint :
+                 writeln(space,'  Value : ',getlongint);
+               constchar :
+                 writeln(space,'  Value : "'+chr(getlongint)+'"');
+               constseta :
+                 begin
+                   write (space,'  Definition : ');
+                   readdefref;
+                   for i:=1to 4 do
+                    begin
+                      write (space,'  Value : ');
+                      for j:=1to 8 do
+                       begin
+                         if j>1 then
+                          write(',');
+                         write(hexb(getbyte));
+                       end;
+                      writeln;
+                    end;
+                 end;
+               else
+                 Writeln ('!! Invalid unit format : Invalid const type encountered: ',b);
+             end;
+           end;
+
+         ibvarsym :
+           begin
+             readcommonsym('Variable symbol ');
+             writeln(space,'        Type: ',getbyte);
+             if read_member then
+               writeln(space,'     Address: ',getlongint);
+             write  (space,'  Definition: ');
+             readdefref;
+             i:=getbyte;
+             writeln(space,'     Options: ',i);
+             if (i and vo_is_C_var)<>0 then
+              writeln(space,' Mangledname: ',getstring);
+           end;
+
+         ibenumsym :
+           begin
+             readcommonsym('Enumeration symbol ');
+             write  (space,'  Definition: ');
+             readdefref;
+             writeln(space,'       Value: ',getlongint);
+           end;
+
+         ibsyssym :
+           begin
+             readcommonsym('Internal system symbol ');
+             writeln(space,' Internal Nr: ',getlongint);
+           end;
+
+         ibtypedconstsym :
+           begin
+             readcommonsym('Typed constant ');
+             write  (space,'  Definition: ');
+             readdefref;
+             writeln(space,'       Label: ',getstring);
+           end;
+
+         ibabsolutesym :
+           begin
+             readcommonsym('Absolute variable symbol ');
+             writeln(space,'        Type: ',getbyte);
+             if read_member then
+               writeln(space,'     Address: ',getlongint);
+             write  (space,'  Definition: ');
+             readdefref;
+             writeln(space,'     Options: ',getbyte);
+             Write (space,'  Relocated to ');
+             b:=getbyte;
+             case absolutetyp(b) of
+               tovar :
+                 Writeln('Name : ',getstring);
+               toasm :
+                 Writeln('Assembler name : ',getstring);
+               toaddr :
+                 begin
+                   Write('Address : ',getlongint);
+                   write(' (Far: ',getbyte<>0,')');
+                 end;
+               else
+                 Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
+             end;
+           end;
+
+         ibpropertysym :
+           begin
+             readcommonsym('Property ');
+             write  (space,'  Definition: ');
+             readdefref;
+             writeln(space,'     Options: ',getlongint);
+             writeln(space,'       Index: ',getlongint);
+             writeln(space,'     Default: ',getlongint);
+             writeln(space,'   Read Name: ',getstring);
+             writeln(space,'  Write Name: ',getstring);
+             writeln(space,' Stored Name: ',getstring);
+             write(space,'  Read Definition: ');
+             readdefref;
+             write(space,' Write Definition: ');
+             readdefref;
+             write(space,'Stored Definition: ');
+             readdefref;
+           end;
+
+         ibfuncretsym :
+           begin
+             readcommonsym('Func return value ');
+             write  (space,'  Definition: ');
+             readdefref;
+             writeln(space,'  Address: ',getlongint);
+           end;
+
+         iberror :
+           begin
+             Writeln('!! Error in PPU');
+             exit;
+           end;
+
+         ibendsyms :
+           break;
+
+         else
+           WriteLn('!! Skipping unsupported PPU Entry in Symbols: ',b);
+       end;
+       if not EndOfEntry then
+        Writeln('!! Entry has more information stored');
+     until false;
+     if (totalsyms<>-1) and (symcnt-1<>totalsyms) then
+       Writeln('!! Only read ',symcnt-1,' of ',totalsyms,' symbols');
+   end;
+end;
+
+
+{****************************************************************************
+                         Read defintions Part
+****************************************************************************}
+
+procedure readdefinitions(start_read : boolean);
+type
+  tsettype  = (normset,smallset,varset);
+  tbasetype = (uauto,uvoid,uchar,
+               u8bit,u16bit,u32bit,
+               s8bit,s16bit,s32bit,
+               bool8bit,bool16bit,bool32bit);
+var
+  b : byte;
+  oldread_member : boolean;
+  totaldefs,
+  defcnt : longint;
+begin
+  defcnt:=0;
+  with ppufile^ do
+   begin
+     if space<>'' then
+      Writeln(space,'-----------------------------');
+     if not start_read then
+       if readentry=ibstartdefs then
+         begin
+           totaldefs:=getlongint;
+           Writeln(space,'Number of definitions: ',totaldefs);
+         end
+       else
+         begin
+           totaldefs:=-1;
+           Writeln('!! ibstartdef not found');
+         end;
+     repeat
+       b:=readentry;
+       if not (b in [iberror,ibenddefs]) then
+        inc(defcnt);
+       case b of
+
+         ibpointerdef :
+           begin
+             readcommondef('Pointer definition');
+             write  (space,'    To Definition : ');
+             readdefref;
+             writeln(space,'           Is Far : ',(getbyte<>0));
+           end;
+
+         iborddef :
+           begin
+             readcommondef('Ordinal definition');
+             write  (space,'        Base type : ');
+             b:=getbyte;
+             case tbasetype(b) of
+               uauto     : writeln('uauto');
+               uvoid     : writeln('uvoid');
+               uchar     : writeln('uchar');
+               u8bit     : writeln('u8bit');
+               u16bit    : writeln('u16bit');
+               u32bit    : writeln('s32bit');
+               s8bit     : writeln('s8bit');
+               s16bit    : writeln('s16bit');
+               s32bit    : writeln('s32bit');
+               bool8bit  : writeln('bool8bit');
+               bool16bit : writeln('bool16bit');
+               bool32bit : writeln('bool32bit');
+               else        writeln('!! Warning: Invalid base type ',b);
+             end;
+             writeln(space,'            Range : ',getlongint,' to ',getlongint);
+           end;
+
+         ibfloatdef :
+           begin
+             readcommondef('Float definition');
+             writeln(space,'       Float type : ',getbyte);
+           end;
+
+         ibarraydef :
+           begin
+             readcommondef('Array definition');
+             write  (space,'     Element type : ');
+             readdefref;
+             write  (space,'       Range Type : ');
+             readdefref;
+             writeln(space,'            Range : ',getlongint,' to ',getlongint);
+             writeln(space,'   Is Constructor : ',(getbyte<>0));
+           end;
+
+         ibprocdef :
+           begin
+             readcommondef('Procedure definition');
+             read_abstract_proc_def;
+             writeln(space,'    Used Register : ',getbyte);
+             writeln(space,'     Mangled name : ',getstring);
+             writeln(space,'           Number : ',getlongint);
+             write  (space,'             Next : ');
+             readdefref;
+             getlongint;
+           end;
+
+         ibprocvardef :
+           begin
+             readcommondef('Procedural type (ProcVar) definition');
+             read_abstract_proc_def;
+           end;
+
+         ibshortstringdef :
+           begin
+             readcommondef('ShortString definition');
+             writeln(space,'           Length : ',getbyte);
+           end;
+
+         ibwidestringdef :
+           begin
+             readcommondef('WideString definition');
+             writeln(space,'           Length : ',getlongint);
+           end;
+
+         ibansistringdef :
+           begin
+             readcommondef('AnsiString definition');
+             writeln(space,'           Length : ',getlongint);
+           end;
+
+         iblongstringdef :
+           begin
+             readcommondef('Longstring definition');
+             writeln(space,'           Length : ',getlongint);
+           end;
+
+         ibrecorddef :
+           begin
+             readcommondef('Record definition');
+             writeln(space,'             Size : ',getlongint);
+             {read the record definitions and symbols}
+             space:='    '+space;
+             oldread_member:=read_member;
+             read_member:=true;
+             readdefinitions(false);
+             readsymbols;
+             read_member:=oldread_member;
+             Delete(space,1,4);
+           end;
+
+         ibobjectdef :
+           begin
+             readcommondef('Object/Class definition');
+             writeln(space,'             Size : ',getlongint);
+             writeln(space,'       Vmt offset : ',getlongint);
+             writeln(space,'    Name of Class : ',getstring);
+             write(space,  '   Ancestor Class : ');
+             readdefref;
+             writeln(space,'          Options : ',getlongint);
+           {read the record definitions and symbols}
+             space:='    '+space;
+             oldread_member:=read_member;
+             read_member:=true;
+             readdefinitions(false);
+             readsymbols;
+             read_member:=oldread_member;
+             Delete(space,1,4);
+           end;
+
+         ibfiledef :
+           begin
+             ReadCommonDef('File definition');
+             write  (space,'             Type : ');
+             case getbyte of
+              0 : writeln('Text');
+              1 : begin
+                    write('Typed with definition ');
+                    readdefref;
+                  end;
+              2 : writeln('Untyped');
+             end;
+           end;
+
+         ibformaldef :
+           readcommondef('Generic Definition (void-typ)');
+
+         ibenumdef :
+           begin
+             readcommondef('Enumeration type definition');
+             write(space,'Base enumeration type : ');
+             readdefref;
+             writeln(space,' Smallest element : ',getlongint);
+             writeln(space,'  Largest element : ',getlongint);
+             writeln(space,'             Size : ',getlongint);
+           end;
+
+         ibclassrefdef :
+           begin
+             readcommondef('Class reference definition');
+             writeln(space,'    To definition : ');
+             readdefref;
+           end;
+
+         ibsetdef :
+           begin
+             writeln(space,'Set definition');
+             write  (space,'     Element type : ');
+             readdefref;
+             b:=getbyte;
+             case tsettype(b) of
+               smallset : writeln(space,'  Set with 32 Elements');
+               normset  : writeln(space,'  Set with 256 Elements');
+               varset   : writeln(space,'  Set with ',getlongint,' Elements');
+               else       writeln('!! Warning: Invalid set type ',b);
+             end;
+           end;
+
+         iberror :
+           begin
+             Writeln('!! Error in PPU');
+             exit;
+           end;
+
+         ibenddefs :
+           break;
+
+         else
+           WriteLn('!! Skipping unsupported PPU Entry in definitions: ',b);
+       end;
+       if not EndOfEntry then
+        Writeln('!! Entry has more information stored');
+     until false;
+     if (totaldefs<>-1) and (defcnt<>totaldefs) then
+      Writeln('!! Only read ',defcnt,' of ',totaldefs,' definitions');
+   end;
+end;
+
+
+{****************************************************************************
+                           Read General Part
+****************************************************************************}
+
+procedure readinterface;
+var
+  b : byte;
+  unitnumber : word;
+  ucrc,uintfcrc : longint;
+begin
+  with ppufile^ do
+   begin
+     repeat
+       b:=readentry;
+       case b of
+
+         ibmodulename :
+           Writeln('Module Name: ',getstring);
+
+         ibsourcefiles :
+           begin
+             while not EndOfEntry do
+              Writeln('Source file: ',getstring);
+           end;
+
+         ibloadunit :
+           begin
+             unitnumber:=1;
+             while not EndOfEntry do
+              begin
+                write('Uses unit: ',getstring,' (Number: ',unitnumber,')');
+                ucrc:=getlongint;
+                uintfcrc:=getlongint;
+                write(' (Crc: ',ucrc,', IntfcCrc: ',uintfcrc,')');
+                if getbyte<>0 then
+                 writeln(' (interface)')
+                else
+                 writeln(' (implementation)');
+                inc(unitnumber);
+              end;
+           end;
+
+         iblinkofiles :
+           ReadContainer('Link object file: ');
+
+         iblinkstaticlibs :
+           ReadContainer('Link static lib: ');
+
+         iblinksharedlibs :
+           ReadContainer('Link shared lib: ');
+
+         iblinkunitfiles :
+           ReadContainer('Link unit file: ');
+
+         iberror :
+           begin
+             Writeln('Error in PPU');
+             exit;
+           end;
+
+         ibendinterface :
+           break;
+
+         else
+           WriteLn('!! Skipping unsupported PPU Entry in General Part: ',b);
+       end;
+     until false;
+   end;
+end;
+
+
+
+{****************************************************************************
+                        Read Implementation Part
+****************************************************************************}
+
+procedure readimplementation;
+var
+  b : byte;
+begin
+  with ppufile^ do
+   begin
+     repeat
+       b:=readentry;
+       case b of
+         iberror :
+           begin
+             Writeln('Error in PPU');
+             exit;
+           end;
+         ibendimplementation :
+           break;
+         else
+           WriteLn('!! Skipping unsupported PPU Entry in Implementation: ',b);
+       end;
+     until false;
+   end;
+end;
+
+
+{****************************************************************************
+                            Read Browser Part
+****************************************************************************}
+
+procedure readbrowser;
+var
+  b : byte;
+const indent : string = '';
+begin
+  Writeln(indent,'Start of symtable browser');
+  indent:=indent+'**';
+  with ppufile^ do
+   begin
+     repeat
+       b:=readentry;
+       case b of
+        ibbeginsymtablebrowser :
+                         { here we must read object and record symtables !! }
+                    begin
+                      indent:=indent+'  ';
+                      Writeln(indent,'Record/Object symtable');
+                      readbrowser;
+                      Indent:=Copy(Indent,1,Length(Indent)-2);
+                    end;
+            ibsymref : begin
+                         readsymref;
+                         readref;
+                       end;
+            ibdefref : begin
+                         readdefref;
+                         readref;
+                         if (ppufile^.header.flags and uf_local_browser)<>0 then
+                           begin
+                             { parast and localst }
+                             indent:=indent+'  ';
+                             Writeln(indent,'Parasymtable for function');
+                             readdefinitions(false);
+                             readsymbols;
+                             b:=ppufile^.readentry;
+                             if b=ibbeginsymtablebrowser then
+                               readbrowser;
+                             Writeln(indent,'Localsymtable for function');
+                             readdefinitions(false);
+                             readsymbols;
+                             b:=ppufile^.readentry;
+                             if b=ibbeginsymtablebrowser then
+                               readbrowser;
+                             Indent:=Copy(Indent,1,Length(Indent)-2);
+                           end;
+                       end;
+             iberror : begin
+                         Writeln('Error in PPU');
+                         exit;
+                       end;
+        ibendsymtablebrowser : break;
+       else
+        begin
+        WriteLn('!! Skipping unsupported PPU Entry in Browser: ',b);
+        Halt;
+        end;
+       end;
+     until false;
+   end;
+  Indent:=Copy(Indent,1,Length(Indent)-2);
+  Writeln(Indent,'End of symtable browser');
+end;
+
+
+
+
+procedure dofile (filename : string);
+var
+  b,unitindex : byte;
+begin
+{ reset }
+  space:='';
+  defcnt:=0;
+  symcnt:=0;
+{ fix filename }
+  if pos('.',filename)=0 then
+   filename:=filename+'.ppu';
+  ppufile:=new(pppufile,Init(filename));
+  if not ppufile^.open then
+   begin
+     writeln ('IO-Error when opening : ',filename,', Skipping');
+     exit;
+   end;
+{ PPU File is open, check for PPU Id }
+  if not ppufile^.CheckPPUID then
+   begin
+     writeln(Filename,' : Not a valid PPU file, Skipping');
+     exit;
+   end;
+{ Check PPU Version }
+  Writeln('Analyzing ',filename,' (v',ppufile^.GetPPUVersion,')');
+  if ppufile^.GetPPUVersion<16 then
+   begin
+     writeln(Filename,' : Old PPU Formats (<v16) are not supported, Skipping');
+     exit;
+   end;
+{ Write PPU Header Information }
+  if (verbose and v_header)<>0 then
+   begin
+     Writeln;
+     Writeln('Header');
+     Writeln('-------');
+     with ppufile^.header do
+      begin
+        Writeln('Compiler version        : ',hi(ppufile^.header.compiler and $ff),'.',lo(ppufile^.header.compiler));
+        WriteLn('Target processor        : ',Cpu2Str(cpu));
+        WriteLn('Target operating system : ',Target2Str(target));
+        Write  ('Unit flags              : ',flags,', ');
+          if (flags and uf_init)<>0 then
+           write('init ');
+          if (flags and uf_big_endian)<>0 then
+           write('big_endian ');
+          if (flags and uf_finalize)<>0 then
+           write('finalize ');
+          if (flags and uf_has_dbx)<>0 then
+           write('has_dbx ');
+          if (flags and uf_has_browser)<>0 then
+           write('has_browser ');
+          if (flags and uf_smartlink)<>0 then
+           write('smartlink ');
+          if (flags and uf_in_library)<>0 then
+           write('in_library ');
+          if (flags and uf_shared_linked)<>0 then
+           write('shared_linked ');
+          if (flags and uf_static_linked)<>0 then
+           write('static_linked ');
+          if (flags and uf_local_browser)<>0 then
+           write('local_browser ');
+          if (flags and uf_obj_linked)<>0 then
+           write('obj_linked ');
+          if (flags=0) then
+           write('(none)');
+          writeln;
+        Writeln('FileSize (w/o header)   : ',size);
+        Writeln('Checksum                : ',checksum);
+        Writeln('Interface Checksum      : ',interface_checksum);
+      end;
+   end;
+{read the general stuff}
+  if (verbose and v_interface)<>0 then
+   begin
+     Writeln;
+     Writeln('Interface section');
+     Writeln('------------------');
+     readinterface;
+   end
+  else
+   ppufile^.skipuntilentry(ibendinterface);
+{read the definitions}
+  if (verbose and v_defs)<>0 then
+   begin
+     Writeln;
+     Writeln('Interface definitions');
+     Writeln('----------------------');
+     readdefinitions(false);
+   end
+  else
+   ppufile^.skipuntilentry(ibenddefs);
+{read the symbols}
+  if (verbose and v_syms)<>0 then
+   begin
+     Writeln;
+     Writeln('Interface Symbols');
+     Writeln('------------------');
+     readsymbols;
+   end
+  else
+   ppufile^.skipuntilentry(ibendsyms);
+{read the implementation stuff}
+{ Not used at the moment (PFV)
+  if (verbose and v_implementation)<>0 then
+   begin
+     Writeln;
+     Writeln('Implementation section');
+     Writeln('-----------------------');
+     readimplementation;
+   end
+  else}
+   ppufile^.skipuntilentry(ibendimplementation);
+{read the static browser units stuff}
+  if (ppufile^.header.flags and uf_local_browser)<>0 then
+   begin
+     if (verbose and v_defs)<>0 then
+      begin
+        Writeln;
+        Writeln('Static definitions');
+        Writeln('----------------------');
+        readdefinitions(false);
+      end
+     else
+      ppufile^.skipuntilentry(ibenddefs);
+   {read the symbols}
+     if (verbose and v_syms)<>0 then
+      begin
+        Writeln;
+        Writeln('Static Symbols');
+        Writeln('------------------');
+        readsymbols;
+      end;
+   end;
+{read the browser units stuff}
+  if (ppufile^.header.flags and uf_has_browser)<>0 then
+   begin
+     if (verbose and v_browser)<>0 then
+      begin
+        Writeln;
+        Writeln('Browser section');
+        Writeln('---------------');
+        UnitIndex:=0;
+        repeat
+          b:=ppufile^.readentry;
+          if b = ibendbrowser then break;
+          if b=ibbeginsymtablebrowser then
+            begin
+               Writeln('Unit ',UnitIndex);
+               readbrowser;
+               Inc(UnitIndex);
+            end
+          else
+            Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
+        until false;
+      end;
+   end;
+{read the static browser units stuff}
+  if (ppufile^.header.flags and uf_local_browser)<>0 then
+   begin
+     if (verbose and v_browser)<>0 then
+      begin
+        Writeln;
+        Writeln('Static browser section');
+        Writeln('---------------');
+        b:=ppufile^.readentry;
+        if b=ibbeginsymtablebrowser then
+          begin
+             Writeln('Unit ',UnitIndex);
+             readbrowser;
+             Inc(UnitIndex);
+          end
+        else
+          Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
+      end;
+   end;
+{shutdown ppufile}
+  ppufile^.close;
+  dispose(ppufile,done);
+  Writeln;
+end;
+
+
+
+procedure help;
+begin
+  writeln('usage: dumpppu [options] <filename1> <filename2>...');
+  writeln;
+  writeln('[options] can be:');
+  writeln('    -V<verbose>  Set verbosity to <verbose>');
+  writeln('                   H - Show header info');
+  writeln('                   I - Show interface');
+  writeln('                   M - Show implementation');
+  writeln('                   S - Show interface symbols');
+  writeln('                   D - Show interface definitions');
+  writeln('                   B - Show browser info');
+  writeln('                   A - Show all');
+  writeln('    -?           This helpscreen');
+  halt;
+end;
+
+var
+  startpara,
+  nrfile,i  : longint;
+  para      : string;
+begin
+  writeln(Title+' '+Version);
+  writeln(Copyright);
+  writeln;
+  if paramcount<1 then
+   begin
+     writeln('usage: dumpppu [options] <filename1> <filename2>...');
+     halt(1);
+   end;
+{ turn verbose on by default }
+  verbose:=v_all;
+{ read options }
+  startpara:=1;
+  while copy(paramstr(startpara),1,1)='-' do
+   begin
+     para:=paramstr(startpara);
+     case upcase(para[2]) of
+      'V' : begin
+              verbose:=0;
+              for i:=3to length(para) do
+               case upcase(para[i]) of
+                'H' : verbose:=verbose or v_header;
+                'I' : verbose:=verbose or v_interface;
+                'M' : verbose:=verbose or v_implementation;
+                'D' : verbose:=verbose or v_defs;
+                'S' : verbose:=verbose or v_syms;
+                'B' : verbose:=verbose or v_browser;
+                'A' : verbose:=verbose or v_all;
+               end;
+            end;
+      '?' : help;
+     end;
+     inc(startpara);
+   end;
+{ process files }
+  for nrfile:=startpara to paramcount do
+   dofile (paramstr(nrfile));
+  if has_errors then
+    Halt(1);
+end.
+{
+  $Log$
+  Revision 1.1  1999-05-12 16:11:39  peter
+    * moved
+
+  Revision 1.31  1999/04/29 17:22:34  peter
+    * fixed property sym
+
+  Revision 1.30  1999/04/26 18:27:39  peter
+    * more updates
+
+  Revision 1.29  1999/04/26 13:30:44  peter
+    * support new unit format
+
+  Revision 1.28  1999/04/26 09:35:04  peter
+    * support for v16
+
+  Revision 1.27  1999/03/16 21:00:03  peter
+    * fixed varsym
+
+  Revision 1.26  1999/03/02 22:54:54  peter
+    * merged some of my code back which was changed after pierres commit
+
+  Revision 1.25  1999/03/02 14:21:44  pierre
+   * adapted to symtable changes mainly local browser
+
+  Revision 1.24  1999/03/02 13:48:16  peter
+    * better procoptions display and easy maintainance
+    * removed implementation section printing, becuase it's not used
+    * linkunitfiles support
+
+  Revision 1.23  1999/02/22 13:22:00  pierre
+   + static browser reading
+
+  Revision 1.22  1999/02/16 00:48:42  peter
+    * updated for new flags
+
+  Revision 1.21  1998/11/28 16:21:02  peter
+    + support for dll variables
+
+  Revision 1.20  1998/11/12 11:36:43  peter
+    * fixed target name
+
+  Revision 1.19  1998/11/04 10:17:42  peter
+    + const,var,value is written for parameters
+
+  Revision 1.18  1998/10/13 13:06:14  peter
+    * updated for new target enum
+
+  Revision 1.17  1998/09/25 09:51:53  peter
+    + symtable size and # of symbols
+
+  Revision 1.16  1998/09/24 23:24:11  peter
+    * small update to support ibstartdef
+
+  Revision 1.12  1998/09/21 08:45:28  pierre
+    + added vmt_offset in tobjectdef.write for fututre use
+      (first steps to have objects without vmt if no virtual !!)
+    + added fpu_used field for tabstractprocdef  :
+      sets this level to 2 if the functions return with value in FPU
+      (is then set to correct value at parsing of implementation)
+      THIS MIGHT refuse some code with FPU expression too complex
+      that were accepted before and even in some cases
+      that don't overflow in fact
+      ( like if f : float; is a forward that finally in implementation
+       only uses one fpu register !!)
+      Nevertheless I think that it will improve security on
+      FPU operations !!
+    * most other changes only for UseBrowser code
+      (added symtable references for record and objects)
+      local switch for refs to args and local of each function
+      (static symtable still missing)
+      UseBrowser still not stable and probably broken by
+      the definition hash array !!
+
+  Revision 1.11  1998/09/18 08:01:42  pierre
+    + improvement on the usebrowser part
+      (does not work correctly for now)
+
+  Revision 1.10  1998/09/01 17:35:33  peter
+    * update for new po's
+
+  Revision 1.9  1998/09/01 12:46:52  peter
+    + enum savesize
+
+  Revision 1.8  1998/08/26 10:01:18  peter
+    + set support
+
+  Revision 1.7  1998/08/20 13:01:41  peter
+    + object_options, new enumdef
+
+  Revision 1.6  1998/08/17 10:26:28  peter
+    * updated for new shared/static style
+
+  Revision 1.5  1998/08/13 10:56:28  peter
+    * check if a whole entry is read
+    + support for constset
+
+  Revision 1.4  1998/08/11 15:31:44  peter
+    * write extended to ppu file
+    * new version 0.99.7
+
+  Revision 1.3  1998/07/10 10:59:17  peter
+    + m68k target support
+
+  Revision 1.2  1998/06/17 13:58:28  peter
+    + symbol/def nrs are now listed
+
+  Revision 1.1  1998/06/13 00:05:01  peter
+    + new util to dump v15+ ppu
+
+}

+ 570 - 0
utils/ppumove.pp

@@ -0,0 +1,570 @@
+{
+    $Id$
+    Copyright (c) 1998 by the FPC Development Team
+
+    Add multiple FPC units into a static/shared library
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************}
+{$ifdef TP}
+  {$N+,E+}
+{$endif}
+Program ppumove;
+uses
+{$ifdef linux}
+  linux,
+{$else linux}
+  dos,
+{$endif linux}
+  ppu,
+  getopts;
+
+const
+  Version   = 'Version 0.99.7';
+  Title     = 'PPU-Mover';
+  Copyright = 'Copyright (c) 1998 by the Free Pascal Development Team';
+
+  ShortOpts = 'o:e:d:qhsvbw';
+  BufSize = 4096;
+  PPUExt = 'ppu';
+  ObjExt = 'o';
+  StaticLibExt ='a';
+{$ifdef Linux}
+  SharedLibExt ='so';
+  BatchExt     ='.sh';
+{$else}
+  SharedLibExt ='dll';
+  BatchExt     ='.bat';
+{$endif Linux}
+
+
+Type
+  PLinkOEnt = ^TLinkOEnt;
+  TLinkOEnt = record
+    Name : string;
+    Next : PLinkOEnt;
+  end;
+
+Var
+  ArBin,LDBin,
+  OutputFile,
+  DestPath,
+  PPLExt,
+  LibExt      : string;
+  Batch,
+  Quiet,
+  MakeStatic  : boolean;
+  Buffer      : Pointer;
+  ObjFiles    : PLinkOEnt;
+  BatchFile   : Text;
+
+{*****************************************************************************
+                                 Helpers
+*****************************************************************************}
+
+Procedure Error(const s:string;stop:boolean);
+{
+  Write an error message to stderr
+}
+begin
+{$ifdef FPC}
+  writeln(stderr,s);
+  flush(stderr);
+{$else}
+  writeln(s);
+{$endif}
+  if stop then
+   halt(1);
+end;
+
+
+function Shell(const s:string):longint;
+{
+  Run a shell commnad and return the exitcode
+}
+begin
+  if Batch then
+   begin
+     Writeln(BatchFile,s);
+     Shell:=0;
+     exit;
+   end;
+{$ifdef Linux}
+  Shell:=Linux.shell(s);
+{$else}
+  exec(getenv('COMSPEC'),'/C '+s);
+  Shell:=DosExitCode;
+{$endif}
+end;
+
+
+Function FileExists (Const F : String) : Boolean;
+{
+  Returns True if the file exists, False if not.
+}
+Var
+{$ifdef linux}
+  info : Stat;
+{$else}
+  info : searchrec;
+{$endif}
+begin
+{$ifdef linux}
+  FileExists:=FStat (F,Info);
+{$else}
+  FindFirst (F,anyfile,Info);
+  FileExists:=DosError=0;
+{$endif}
+end;
+
+
+Function AddExtension(Const HStr,ext:String):String;
+{
+  Return a filename which will have extension ext added if no
+  extension is found
+}
+var
+  j : longint;
+begin
+  j:=length(Hstr);
+  while (j>0) and (Hstr[j]<>'.') do
+   dec(j);
+  if j=0 then
+   AddExtension:=Hstr+'.'+Ext
+  else
+   AddExtension:=HStr;
+end;
+
+
+Function ForceExtension(Const HStr,ext:String):String;
+{
+  Return a filename which certainly has the extension ext
+}
+var
+  j : longint;
+begin
+  j:=length(Hstr);
+  while (j>0) and (Hstr[j]<>'.') do
+   dec(j);
+  if j=0 then
+   j:=255;
+  ForceExtension:=Copy(Hstr,1,j-1)+'.'+Ext;
+end;
+
+
+Procedure AddToLinkFiles(const S : String);
+{
+  Adds a filename to a list of object files to link to.
+  No duplicates allowed.
+}
+Var
+  P : PLinKOEnt;
+begin
+  P:=ObjFiles;
+  { Don't add files twice }
+  While (P<>nil) and (p^.name<>s) do
+    p:=p^.next;
+  if p=nil then
+   begin
+     new(p);
+     p^.next:=ObjFiles;
+     p^.name:=s;
+     ObjFiles:=P;
+   end;
+end;
+
+
+Function ExtractLib(const libfn:string):string;
+{
+  Extract a static library libfn and return the files with a
+  wildcard
+}
+var
+  n,d,e : string;
+  i     : word;
+begin
+{ create the temp dir first }
+  fsplit(libfn,d,n,e);
+  {$I-}
+   mkdir(n+'.sl');
+  {$I+}
+  i:=ioresult;
+{ Extract }
+  if Shell(arbin+' x '+libfn)<>0 then
+   Error('Fatal: Error running '+arbin,true);
+{ Remove the lib file, it's extracted so it can be created with ease }
+  if PPLExt=PPUExt then
+   Shell('rm '+libfn);
+{$ifdef linux}
+  ExtractLib:=n+'.sl/*';
+{$else}
+  ExtractLib:=n+'.sl\*';
+{$endif}
+end;
+
+
+Function DoPPU(const PPUFn,PPLFn:String):Boolean;
+{
+  Convert one file (in Filename) to library format.
+  Return true if successful, false otherwise.
+}
+Var
+  inppu,
+  outppu : pppufile;
+  b,
+  untilb : byte;
+  l      : longint;
+  i      : word;
+  f      : file;
+  isstaticlinked : boolean;
+begin
+  DoPPU:=false;
+  If Not Quiet then
+   Write ('Processing ',PPUFn,'...');
+  inppu:=new(pppufile,init(PPUFn));
+  if not inppu^.open then
+   begin
+     dispose(inppu,done);
+     Error('Error: Could not open : '+PPUFn,false);
+     Exit;
+   end;
+{ Check the ppufile }
+  if not inppu^.CheckPPUId then
+   begin
+     dispose(inppu,done);
+     Error('Error: Not a PPU File : '+PPUFn,false);
+     Exit;
+   end;
+  if inppu^.GetPPUVersion<15 then
+   begin
+     dispose(inppu,done);
+     Error('Error: Wrong PPU Version : '+PPUFn,false);
+     Exit;
+   end;
+{ Already a lib? }
+  if (inppu^.header.flags and uf_in_library)<>0 then
+   begin
+     dispose(inppu,done);
+     Error('Error: PPU is already in a library : '+PPUFn,false);
+     Exit;
+   end;
+{ Create the new ppu }
+  if PPUFn=PPLFn then
+   outppu:=new(pppufile,init('ppumove.$$$'))
+  else
+   outppu:=new(pppufile,init(PPLFn));
+  outppu^.create;
+{ Create new header, with the new flags }
+  outppu^.header:=inppu^.header;
+  outppu^.header.flags:=outppu^.header.flags or uf_in_library;
+  if MakeStatic then
+   outppu^.header.flags:=outppu^.header.flags or uf_static_linked
+  else 
+   outppu^.header.flags:=outppu^.header.flags or uf_shared_linked;
+{ Is the until smartlinked ? }
+  IsStaticLinked:=(inppu^.header.flags and uf_static_linked)<>0;
+{ read until the object files are found }
+  if IsStaticLinked then
+   untilb:=iblinkstaticlibs
+  else
+   untilb:=iblinkofiles;
+  repeat
+    b:=inppu^.readentry;
+    if b in [ibendinterface,ibend] then
+     begin
+       dispose(inppu,done);
+       dispose(outppu,done);
+       Error('Error: No files to be linked found : '+PPUFn,false);
+       Exit;
+     end;
+    if b<>untilb then
+     begin
+       repeat
+         inppu^.getdatabuf(buffer^,bufsize,l);
+         outppu^.putdata(buffer^,l);
+       until l<bufsize;
+       outppu^.writeentry(b);
+     end;
+  until (b=untilb);
+{ we have now reached the section for the files which need to be added,
+  now add them to the list }
+  case b of
+       iblinkofiles : begin
+                        while not inppu^.endofentry do
+                         AddToLinkFiles(inppu^.getstring);
+                      end;
+   iblinkstaticlibs : begin
+                        AddToLinkFiles(ExtractLib(inppu^.getstring));
+                        if not inppu^.endofentry then
+                         begin
+                           repeat
+                             inppu^.getdatabuf(buffer^,bufsize,l);
+                             outppu^.putdata(buffer^,l);
+                           until l<bufsize;
+                           outppu^.writeentry(b);
+                         end;
+                      end;
+  end;
+{ just add a new entry with the new lib }
+  outppu^.putstring(outputfile);
+  if MakeStatic then
+   outppu^.writeentry(iblinkstaticlibs)
+  else
+   outppu^.writeentry(iblinksharedlibs);
+{ read all entries until the end and write them also to the new ppu }
+  repeat
+    b:=inppu^.readentry;
+  { don't write ibend, that's written automaticly }
+    if b<>ibend then
+     begin
+       repeat
+         inppu^.getdatabuf(buffer^,bufsize,l);
+         outppu^.putdata(buffer^,l);
+       until l<bufsize;
+       outppu^.writeentry(b);
+     end;
+  until b=ibend;
+{ write the last stuff and close }
+  outppu^.flush;
+  outppu^.writeheader;
+  dispose(outppu,done);
+  dispose(inppu,done);
+{ rename }
+  if PPUFn=PPLFn then
+   begin
+     {$I-}
+      assign(f,PPUFn);
+      erase(f);
+      assign(f,'ppumove.$$$');
+      rename(f,PPUFn);
+     {$I+}
+     i:=ioresult;
+   end;
+{ the end }
+  If Not Quiet then
+   Writeln (' Done.');
+  DoPPU:=True;
+end;
+
+
+Function DoFile(const FileName:String):Boolean;
+{
+  Process a file, mainly here for wildcard support under Dos
+}
+{$ifndef linux}
+var
+  dir : searchrec;
+{$endif}
+begin
+{$ifdef linux}
+  DoFile:=DoPPU(FileName,ForceExtension(FileName,PPLExt));
+{$else}
+  DoFile:=false;
+  findfirst(filename,$20,dir);
+  while doserror=0 do
+   begin
+     if not DoPPU(Dir.Name,ForceExtension(Dir.Name,PPLExt)) then
+      exit;
+     findnext(dir);
+   end;
+  DoFile:=true;
+{$endif}
+end;
+
+
+Procedure DoLink;
+{
+  Link the object files together to form a (shared) library, the only
+  problem here is the 255 char limit of Names
+}
+Var
+  Names : String;
+  f     : file;
+  Err   : boolean;
+  P     : PLinkOEnt;
+begin
+  if not Quiet then
+   Write ('Linking ');
+  P:=ObjFiles;
+  names:='';
+  While p<>nil do
+   begin
+     if Names<>'' then
+      Names:=Names+' '+P^.name
+     else
+      Names:=p^.Name;
+     p:=p^.next;
+   end;
+  if Names='' then
+   begin
+     If not Quiet then
+      Writeln('Error: no files found to be linked');
+     exit;
+   end;
+  If not Quiet then
+   WriteLn(names);
+{ Run ar or ld to create the lib }
+  If MakeStatic then
+   Err:=Shell(arbin+' rs '+outputfile+' '+names)<>0
+  else
+   Err:=Shell(ldbin+' -shared -o '+OutputFile+' '+names)<>0;
+  If Err then
+   Error('Fatal: Library building stage failed.',true);
+{ Remove the .o files }
+  if PPLExt=PPUExt then
+   begin
+     while pos('*',names)>0 do
+      Delete(names,pos('*',names),1);
+     Shell('rm -rf '+names);
+   end;
+{ Rename to the destpath }
+  if DestPath<>'' then
+   begin
+     Assign(F, OutputFile);
+     Rename(F,DestPath+'/'+OutputFile);
+   end;
+end;
+
+
+Procedure usage;
+{
+  Print usage and exit.
+}
+begin
+  Writeln(paramstr(0),': [-qhwvbs] [-e ext] [-o name] [-d path] file [file ...]');
+  Halt(0);
+end;
+
+
+
+Procedure processopts;
+{
+  Process command line opions, and checks if command line options OK.
+}
+var
+  C : char;
+begin
+  if paramcount=0 then
+   usage;
+{ Reset }
+  ObjFiles:=Nil;
+  Quiet:=False;
+  Batch:=False;
+  OutputFile:='';
+  PPLExt:='ppu';
+  ArBin:='ar';
+  LdBin:='ld';
+  repeat
+    c:=Getopt (ShortOpts);
+    Case C of
+ EndOfOptions : break;
+      's' : MakeStatic:=True;
+      'o' : OutputFile:=OptArg;
+      'd' : DestPath:=OptArg;
+      'e' : PPLext:=OptArg;
+      'q' : Quiet:=True;
+      'w' : begin
+              ArBin:='arw';
+              LdBin:='ldw';
+            end;
+      'b' : Batch:=true;
+      '?' : Usage;
+      'h' : Usage;
+    end;
+  until false;
+{ Test filenames on the commandline }
+  if (OptInd>Paramcount) then
+   Error('Error: no input files',true);
+  if (OptInd<ParamCount) and (OutputFile='') then
+   Error('Error: when moving multiple units, specify an output name.',true);
+{ alloc a buffer }
+  GetMem (Buffer,Bufsize);
+  If Buffer=Nil then
+   Error('Error: could not allocate memory for buffer.',true);
+{ fix filename }   
+{$ifdef linux}
+  if Copy(OutputFile,1,3)<>'lib' then
+   OutputFile:='lib'+OutputFile;
+{$endif}
+end;
+
+
+
+
+var
+  i : longint;
+begin
+  ProcessOpts;
+{ Write Header }
+  if not Quiet then
+   begin
+     Writeln(Title+' '+Version);
+     Writeln(Copyright);
+     Writeln;
+   end;
+{ Check if shared is allowed }
+{$ifndef linux}
+  if arbin<>'arw' then
+   begin
+     Writeln('Warning: shared library not supported for Go32, switching to static library');
+     MakeStatic:=true;
+   end;
+{$endif}
+{ fix the libext and outputfilename }
+  if Makestatic then
+   LibExt:=StaticLibExt
+  else
+   LibExt:=SharedLibExt;
+  if OutputFile='' then
+   OutPutFile:=Paramstr(OptInd);
+  OutputFile:=ForceExtension(OutputFile,LibExt);
+{ Open BatchFile }
+  if Batch then
+   begin
+     Assign(BatchFile,'pmove'+BatchExt);
+     Rewrite(BatchFile);
+   end;
+{ Process Files }
+  i:=OptInd;
+  While (i<=ParamCount) and Dofile(AddExtension(Paramstr(i),PPUExt)) do
+   Inc(i);
+{ Do Linking stage }
+  DoLink;
+{ Close BatchFile }
+  if Batch then
+   begin
+     if Not Quiet then
+      Writeln('Writing pmove'+BatchExt);
+     Close(BatchFile);
+{$ifdef Linux}
+     ChMod('pmove'+BatchExt,493);
+{$endif}
+   end;
+{ The End }
+  if Not Quiet then
+   Writeln('Done.');
+end.
+{
+  $Log$
+  Revision 1.1  1999-05-12 16:11:39  peter
+    * moved
+
+  Revision 1.3  1998/08/17 10:26:30  peter
+    * updated for new shared/static style
+
+  Revision 1.2  1998/06/18 10:47:55  peter
+    * new for v15
+}

+ 161 - 0
utils/ptop.pp

@@ -0,0 +1,161 @@
+
+Program PtoP;
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999 by Michael Van Canneyt, member of 
+    the Free Pascal development team
+
+    Pascal pretty print program
+    
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+Uses PtoPu,Objects,getopts;
+
+Var 
+  Infilename,OutFileName,ConfigFile : String;
+  BeVerbose : Boolean;
+  TheIndent,TheBufSize : Integer;
+  
+Function StrToInt(Const S : String) : Integer;
+
+Var Code : integer;
+
+begin
+  Val(S,StrToInt,Code);
+  If Code<>0 then StrToInt:=0;
+end;
+  
+Procedure Usage;
+
+begin
+  Writeln ('ptop : Usage : ');
+  Writeln ('ptop [-v] [-i indent] [-b bufsize ][-c optsfile] infile outfile');
+  Writeln ('     converts infile to outfile.');
+  Writeln ('     -c : read options from optsfile');
+  Writeln ('     -i : Set number of indent spaces.');
+  Writeln ('     -b : Use buffers of size bufsize');
+  Writeln ('     -v : be verbose');
+  writeln ('ptop -g ofile');
+  writeln ('     generate default options file');
+  Writeln ('ptop -h : This help');
+  halt(0);
+end;
+
+Procedure Genopts;
+
+Var S : PBufStream;
+
+begin
+  S:=New(PBufStream,Init(ConfigFile,stCreate,255));
+  GeneratecfgFile(S);
+  S^.Close;
+  S^.Done;
+end;
+
+Procedure ProcessOpts;
+
+Var c : char;
+
+begin
+  { Set defaults }
+  Infilename:='';
+  OutFileName:='';
+  ConfigFile:=''; 
+  TheIndent:=2;
+  TheBufSize:=255;
+  BeVerbose:=False;
+  Repeat
+    c:=getopt('i:c:g:b:hv');
+    case c of 
+      'i' : begin
+            TheIndent:=StrToInt(OptArg);
+            If TheIndent=0 then TheIndent:=2;
+            end;
+      'b' : begin
+            TheBufSize:=StrToInt(OptArg);
+            If TheBufSize=0 then TheBufSize:=255;
+            end;
+      'c' : ConfigFile:=OptArg;
+      'g' : begin
+            ConfigFIle:=OptArg;
+            GenOpts;
+            halt(0);
+            end;
+      'h' : usage;
+      'v' : BeVerbose:=True;
+    else
+    end;
+  until c=endofoptions;
+  If optind<=paramcount then
+    begin
+    InFileName:=paramstr(OptInd);
+    Inc(optind);
+    If OptInd<=paramcount then
+      OutFilename:=Paramstr(OptInd);
+    end;
+end; { Of ProcessOpts }
+
+Var DiagS : PMemoryStream;
+    InS,OutS,cfgS : PBufSTream;
+    PPrinter : TPrettyPrinter;
+    P : Pchar;
+    i : longint;
+    
+begin
+  ProcessOpts;
+  If (Length(InfileName)=0) or (Length(OutFileName)=0) Then
+    Usage;
+  Ins:=New(PBufStream,Init(InFileName,StopenRead,TheBufSize));
+  OutS:=New(PBufStream,Init(OutFileName,StCreate,TheBufSize));
+  If BeVerbose then
+    diagS:=New(PMemoryStream,Init(1000,255))
+  else
+    DiagS:=Nil;
+  If ConfigFile<>'' then
+    CfgS:=New(PBufStream,Init(ConfigFile,StOpenRead,TheBufSize))
+  else 
+    CfgS:=Nil;
+  PPrinter.Create;
+  PPrinter.Indent:=TheIndent;
+  PPrinter.Ins:=Ins;
+  PPrinter.outS:=OutS;
+  PPrinter.cfgS:=CfgS;
+  PPrinter.DiagS:=DiagS;
+  PPrinter.PrettyPrint;
+  If Assigned(DiagS) then
+    begin
+    I:=DiagS^.GetSize;
+    DiagS^.Seek(0);
+    getmem (P,I+1);
+    DiagS^.Read(P[0],I);
+    P[I]:=#0;
+    Writeln (stderr,P);
+    Flush(stderr);
+    DiagS^.Done;
+    end;
+  If Assigned(CfgS) then 
+    CfgS^.Done;
+  Ins^.Done;
+  OutS^.Done;
+end.
+
+{
+  $Log$
+  Revision 1.1  1999-05-12 16:11:39  peter
+    * moved
+
+  Revision 1.3  1999/03/25 16:52:29  michael
+  + Implemented Delphi keywords and delphi comments
+
+  Revision 1.2  1999/03/23 13:47:47  michael
+  Added GPL and log
+
+}

+ 1204 - 0
utils/ptopu.pp

@@ -0,0 +1,1204 @@
+Unit PtoPu;
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999 by Michael Van Canneyt, member of
+    the Free Pascal development team
+
+    Pascal Pretty-Printer object implementation
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{
+ This unit is based heavily on the code by
+
+ Author:  Peter Grogono
+   This program is based on a Pascal pretty-printer written by Ledgard,
+   Hueras, and Singer.  See SIGPLAN Notices, Vol. 12, No. 7, July 1977,
+   pages 101-105, and PP.DOC/HLP.
+   This version of PP developed under Pascal/Z V4.0 or later.
+   Very minor modifications for Turbo Pascal made by Willett Kempton
+   March 1984 and Oct 84.  Runs under 8-bit Turbo or 16-bit Turbo.
+   Toad Hall tweak, rewrite for TP 5, 28 Nov 89
+
+The following was changed :
+ - Object oriented
+ - Uses streams
+ - Run-time customizable.
+}
+
+Interface
+
+Uses objects;
+
+Const
+
+  MAXSYMBOLSIZE = 80;
+  MAXSTACKSIZE = 100;
+  MAXKEYLENGTH = 15;     { The longest keyword is PROCEDURE }
+  MAXLINESIZE = 90;     { Maximum length of output line }
+
+TYPE
+
+  Token    = String[MAXSYMBOLSIZE];
+  String0  = STRING[1]; {Pascal/z had 0}
+  FileName = STRING;
+
+
+  { Keysymbols }
+  { If you add keysyms, adjust the definition of lastkey }
+  keysymbol =  { keywords }
+              (endsym,beginsym,ifsym,thensym,elsesym,procsym,varsym,ofsym,
+               whilesym,dosym,casesym,withsym,forsym,repeatsym,untilsym,
+               funcsym,labelsym,constsym,typesym,recordsym,stringsym,progsym,
+               { TP and Delphi keywords}
+               asmsym, trysym, finallysym,exceptsym,raisesym,classsym,objectsym,
+               constructorsym,destructorsym,inheritedsym,propertysym,
+               privatesym,publicsym,protectedsym,publishedsym,
+               initializationsym,finalizationsym,
+               inlinesym,librarysym,interfacesym,implementationsym,
+               readsym,writesym,unitsym,
+               { Not used for formatting }
+               andsym,arrsym,divsym,downsym,filesym,gotosym,insym,modsym,
+               notsym,nilsym,orsym,setsym,tosym,
+               casevarsym,
+               { other symbols }
+               becomes,delphicomment,opencomment,closecomment,semicolon,colon,equals,
+               openparen,closeparen,period,endoffile,othersym);
+
+  { Formatting options }
+  { If you add options, adjust the definition of lastopt }
+  options = (crsupp,crbefore,blinbefore,
+             dindonkey,dindent,spbef,
+             spaft,gobsym,inbytab,crafter,upper,lower,capital);
+
+  optionset = SET OF options;
+  keysymset = SET OF keysymbol;
+
+  tableentry = RECORD
+                 selected : optionset;
+                 dindsym : keysymset;
+                 terminators : keysymset
+               END;
+
+  { Character identification }
+
+  charname = (letter,digit,space,quote,endofline,
+              filemark,otherchar);
+
+  charinfo = RECORD
+               name : charname;
+               Value : CHAR
+             END;
+
+  symbol = RECORD
+             name : keysymbol;
+             Value : Token;
+             IsKeyWord : BOOLEAN;
+             length, spacesbefore, crsbefore : INTEGER;
+           END;
+
+  symbolinfo = ^ symbol;
+
+  stackentry = RECORD
+                 indentsymbol : keysymbol;
+                 prevmargin : INTEGER
+               END;
+
+  symbolstack = ARRAY [1..MAXSTACKSIZE] OF stackentry;
+
+Const FirstOpt = crsupp;
+      LastOpt = capital; { Adjust this if you add options }
+      FirstKey = endsym;
+      LastKey = othersym; { Adjust this if you add options }
+      LastFormatsym = tosym;
+
+Type
+  tableptr = ^tableentry;
+  optiontable = ARRAY [keysymbol] OF tableptr;
+  OEntriesTable = Array [keysymbol] OF String[15];
+  ONamesTable = Array [Options] of String[15];
+  KeywordTable = ARRAY [endsym..lastFormatsym] OF String[MAXKEYLENGTH];
+  SpecialChar = ARRAY [1..2] OF CHAR;
+  dblcharset = SET OF endsym..othersym;
+  DblCharTable = ARRAY [becomes..opencomment] OF SpecialChar;
+  SglCharTable = ARRAY [opencomment..period] OF CHAR;
+
+  TPrettyPrinter=Object(TObject)
+    Private
+      RecordSeen,
+      ConfigFileRead,
+      CRPending : BOOLEAN;
+      currchar,nextchar : charinfo;
+      currsym,nextsym : symbolinfo;
+      inlines,outlines : INTEGER;
+      stack   : symbolstack;
+      top,startpos,currlinepos,currmargin : Integer;
+      option : OptionTable;
+      Procedure Verbose (Const Msg : String);
+      Procedure GetChar;
+      Procedure StoreNextChar(VAR lngth: INTEGER;
+                              VAR Value: Token);
+      Procedure SkipBlanks(VAR spacesbefore, crsbefore: INTEGER);
+      Procedure GetComment(sym: symbolinfo);
+      Procedure GetDelphiComment(sym: symbolinfo);
+      Procedure GetNumber(sym: symbolinfo);
+      Procedure GetCharLiteral(sym: symbolinfo);
+      Function  char_Type: keysymbol;
+      Procedure GetSpecialChar(sym: symbolinfo);
+      Procedure GetNextSymbol(sym: symbolinfo);
+      Procedure GetIdentifier(sym: symbolinfo);
+      Procedure GetSymbol;
+      Procedure PopStack(VAR indentsymbol: keysymbol;
+                         VAR prevmargin: INTEGER);
+      Procedure PushStack(indentsymbol: keysymbol;
+                          prevmargin: INTEGER );
+      Procedure WriteCRs(numberofcrs: INTEGER);
+      Procedure InsertCR;
+      Procedure InsertBlankLine;
+      Procedure LShiftOn(dindsym: keysymset);
+      Procedure LShift;
+      Procedure InsertSpace(VAR symbol: symbolinfo);
+      Procedure MoveLinePos(newlinepos: INTEGER);
+      Procedure PrintSymbol;
+      Procedure PPSymbol;
+      Procedure Gobble(terminators: keysymset);
+      Procedure RShift(currmsym: keysymbol);
+      Function ReadConfigFile: Boolean;
+    Public
+      Indent : Integer;    { How many characters to indent ? }
+      InS,
+      OutS,
+      DiagS,cfgS : PStream;
+      Constructor Create;
+      Function PrettyPrint : Boolean;
+    end;
+
+Procedure GenerateCfgFile(S: PStream);
+
+Implementation
+
+CONST
+  version = '28 November 1989';  {was '11 October 1984'; ..ancient stuff!}
+
+  NUL = 0;      { ASCII null character }
+  TAB = 9;      { ASCII tab character }
+  FF = 12;      { ASCII formfeed character }
+  CR = 13;      { ASCII carriage return }
+  ESC = 27;     { ASCII escape character }
+  Blank = ' ';
+  MAXBYTE = 255;{ Largest value of 1 byte variable }
+
+Type
+
+  hashentry = RECORD
+                Keyword : String[MAXKEYLENGTH];
+                symtype : keysymbol
+              END;
+
+VAR
+  sets : tableptr;
+  dblch   : dblcharset;
+  hashtable : ARRAY [Byte] OF hashentry;
+
+CONST
+  Keyword : KeywordTable =
+     ('END', 'BEGIN', 'IF', 'THEN',
+      'ELSE', 'PROCEDURE', 'VAR', 'OF',
+      'WHILE', 'DO', 'CASE', 'WITH',
+      'FOR', 'REPEAT', 'UNTIL', 'FUNCTION',
+      'LABEL', 'CONST', 'TYPE', 'RECORD',
+      'STRING', 'PROGRAM',
+      'ASM','TRY','FINALLY','EXCEPT','RAISE','CLASS','OBJECT',
+      'CONSTRUCTOR','DESCTRUCTOR','INHERITED','PROPERTY',
+      'PRIVATE','PUBLIC','PROTECTED','PUBLISHED',
+      'INITIALIZATION','FINALIZATION',
+      'INLINE','LIBRARY','INTERFACE','IMPLEMENTATION',
+      'READ','WRITE','UNIT',
+      {keywords not used for formatting }
+      'AND', 'ARRAY', 'DIV', 'DOWNTO',
+      'FILE', 'GOTO', 'IN', 'MOD',
+      'NOT', 'NIL', 'OR', 'SET','TO'
+     );
+
+
+  EntryNames : OEntriesTable =
+              ('end','begin','if','then','else','proc','var',
+               'of','while','do','case','with','for','repeat','until',
+               'func','label','const','type','record','string',
+               'prog',
+               'asm','try','finally','except','raise','class','object',
+               'constructor','destructor','inherited','property',
+               'private','public','protected','published',
+               'initialization','finalization',
+               'inline','library','interface','implementation',
+               'read','write','unit',
+
+               'and','arr','div','down','file','goto',
+               'in','mod','not','nil','or','set','to',
+               'casevar',
+               'becomes','delphicomment','opencomment','closecomment','semicolon',
+               'colon','equals',
+               'openparen','closeparen','period','endoffile','other');
+
+  OptionNames : ONamesTable =
+       ('crsupp','crbefore','blinbefore',
+        'dindonkey','dindent','spbef','spaft',
+        'gobsym','inbytab','crafter','upper',
+        'lower','capital');
+
+
+  DblChar : DblCharTable =
+     ( ':=', '//','(*' );
+
+  SglChar : SglCharTable =
+    ('{', '}', ';', ':', '=', '(', ')', '.' );
+
+{ ---------------------------------------------------------------------
+    General functions, not part of the object.
+  ---------------------------------------------------------------------}
+
+Function IntToStr(I : LongInt) : String;
+
+begin
+  str(I,IntToStr);
+end;
+
+Function StrToInt(Const S : String) : Integer;
+
+Var Code : integer;
+
+begin
+  Val(S,StrToInt,Code);
+  If Code<>0 then StrToInt:=0;
+end;
+
+Procedure Strip (Var S : String);
+
+Const WhiteSpace =  [#32,#9,#10,#13];
+
+Var I,J : Longint;
+
+begin
+  If length(s)=0 then exit;
+  I:=1;
+  While (S[I] in whitespace) and (I<Length(S)) do inc(i);
+  J:=length(S);
+  While (S[J] in whitespace) and (J>1) do dec(j);
+  If I<=J then
+    S:=Copy(S,i,j-i+1)
+  else
+    S:='';
+end;
+
+{ ---------------------------------------------------------------------
+    Hash table related functions
+  ---------------------------------------------------------------------}
+
+
+Function hash(Symbol: String): Byte;
+  { Hashing function for identifiers.  The formula gives a unique value
+    in the range 0..255 for each Pascal/Z keyword.  Note that range and
+    overflow checking must be turned off for this function even if they
+    are enabled for the rest of the program.  }
+  BEGIN
+    hash := (ORD(Symbol[1]) * 5 + ORD(Symbol[length(Symbol)])) * 5 + length(Symbol)
+  END; { of hash }
+
+Procedure CreateHash;
+
+Var psn : Byte;
+    sym : keysymbol;
+
+begin
+  FOR psn := 0 TO MAXBYTE DO BEGIN
+    hashtable[psn].Keyword := '         ';
+    hashtable[psn].symtype := othersym
+  END;
+  FOR sym := endsym TO lastformatsym DO BEGIN
+    psn := hash(Keyword[sym]);
+    hashtable[psn].Keyword := Keyword[sym];
+    hashtable[psn].symtype := sym
+  END; { for }
+end;
+
+
+Procedure ClassID(Value: Token;
+                  lngth: INTEGER;
+                  VAR idtype: keysymbol;
+                  VAR IsKeyWord: BOOLEAN);
+  { Classify an identifier.  We are only interested
+    in it if it is a keyword, so we use the hash table. }
+  VAR
+    Keyvalue: String[MAXKEYLENGTH];
+    tabent: INTEGER;
+  BEGIN
+    IF lngth > MAXKEYLENGTH THEN BEGIN
+      idtype := othersym;
+      IsKeyWord := FALSE
+    END
+    ELSE BEGIN
+      KeyValue:=upCase(Value);
+      tabent := hash(Keyvalue);
+      IF Keyvalue = hashtable[tabent].Keyword THEN BEGIN
+        idtype := hashtable[tabent].symtype;
+        IsKeyWord := TRUE;
+      END
+      ELSE BEGIN
+        idtype := othersym;
+        IsKeyWord := FALSE;
+      END
+    END
+  END; { of ClassID }
+
+{ ---------------------------------------------------------------------
+    Functions to create options and set defaults.
+  ---------------------------------------------------------------------}
+
+Procedure CreateOptions (Var Option : OptionTable);
+
+Var Sym : KeySymbol;
+
+begin
+  FOR sym := endsym TO othersym DO BEGIN
+    NEW(option[sym]);
+    option[sym]^.selected := [];
+    option[sym]^.dindsym := [];
+    option[sym]^.terminators := []
+  END;
+end;
+
+Procedure SetTerminators(Var Option : OptionTable);
+
+begin
+  option[casesym]^.terminators    := [ofsym];
+  option[casevarsym]^.terminators := [ofsym];
+  option[forsym]^.terminators     := [dosym];
+  option[whilesym]^.terminators   := [dosym];
+  option[withsym]^.terminators    := [dosym];
+  option[ifsym]^.terminators      := [thensym];
+  option[untilsym]^.terminators   := [endsym, untilsym, elsesym, semicolon];
+  option[becomes]^.terminators    := [endsym, untilsym, elsesym, semicolon];
+  option[openparen]^.terminators  := [closeparen];
+end;
+
+Procedure SetDefaultIndents (Var Option : OptionTable);
+
+begin
+  option[recordsym]^.dindsym    := [endsym];
+  option[funcsym]^.dindsym      := [labelsym, constsym, typesym, varsym];
+  option[procsym]^.dindsym      := [labelsym, constsym, typesym, varsym];
+  option[constsym]^.dindsym     := [labelsym, constsym, typesym, varsym];
+  option[typesym]^.dindsym      := [labelsym, constsym, typesym, varsym];
+  option[varsym]^.dindsym       := [labelsym, constsym, typesym, varsym];
+  option[beginsym]^.dindsym     := [labelsym, constsym, typesym, varsym];
+  option[publicsym]^.dindsym    := [protectedsym,privatesym,publicsym,publishedsym];
+  option[privatesym]^.dindsym   := [protectedsym,privatesym,publicsym,publishedsym];
+  option[protectedsym]^.dindsym := [protectedsym,privatesym,publicsym,publishedsym];
+  option[publishedsym]^.dindsym := [protectedsym,privatesym,publicsym,publishedsym];
+  option[finallysym]^.dindsym   := [trysym];
+  option[exceptsym]^.dindsym   := [trysym];
+  option[elsesym]^.dindsym      := [ifsym, thensym, elsesym];
+  option[untilsym]^.dindsym     := [ifsym, thensym, elsesym, forsym, whilesym,
+                                    withsym, colon, equals];
+  option[endsym]^.dindsym       := [ifsym, thensym, elsesym, forsym, whilesym,
+                                    withsym, casevarsym, colon, equals, recordsym,
+                                    classsym,objectsym];
+  option[semicolon]^.dindsym    := [ifsym, thensym, elsesym, forsym,
+                                    whilesym, withsym, colon, equals];
+end;
+
+Procedure SetDefaults (Var Option : OptionTable);
+
+{ Sets default values for the formatting rules. }
+
+begin
+  option[progsym]^.selected         := [capital,blinbefore, spaft];
+  option[unitsym]^.selected         := [capital,blinbefore, spaft];
+  option[librarysym]^.selected      := [capital,blinbefore, spaft];
+  option[funcsym]^.selected         := [capital,blinbefore, dindonkey, spaft];
+  option[procsym]^.selected         := [capital,blinbefore, dindonkey, spaft];
+  option[labelsym]^.selected        := [capital,blinbefore, spaft, inbytab];
+  option[constsym]^.selected        := [capital,blinbefore, dindonkey, spaft, inbytab];
+  option[typesym]^.selected         := [capital,blinbefore, dindonkey, spaft, inbytab];
+  option[varsym]^.selected          := [capital,blinbefore, dindonkey, spaft, inbytab];
+  option[beginsym]^.selected        := [capital,dindonkey, crbefore, crafter, inbytab];
+  option[repeatsym]^.selected       := [capital,inbytab, crafter];
+  option[recordsym]^.selected       := [capital,inbytab, crafter];
+  option[objectsym]^.selected       := [capital,inbytab, crafter];
+  option[classsym]^.selected        := [capital,inbytab, crafter];
+  option[publicsym]^.selected       := [capital,crbefore, dindonkey, spaft, inbytab];
+  option[publishedsym]^.selected    := [capital,crbefore, dindonkey, spaft, inbytab];
+  option[protectedsym]^.selected    := [capital,crbefore, dindonkey, spaft, inbytab];
+  option[privatesym]^.selected      := [capital,crbefore, dindonkey, spaft, inbytab];
+  option[trysym]^.Selected          := [capital,crbefore,crafter,inbytab];
+  option[finallysym]^.selected      := [capital,crbefore,dindonkey,crafter,inbytab];
+  option[exceptsym]^.selected       := [capital,crbefore,dindonkey,crafter,inbytab];
+  option[casesym]^.selected         := [capital,spaft, inbytab, gobsym, crafter];
+  option[casevarsym]^.selected      := [capital,spaft, inbytab, gobsym, crafter];
+  option[ofsym]^.selected           := [capital,crsupp, spbef];
+  option[forsym]^.selected          := [capital,spaft, inbytab, gobsym, crafter];
+  option[whilesym]^.selected        := [capital,spaft, inbytab, gobsym, crafter];
+  option[withsym]^.selected         := [capital,spaft, inbytab, gobsym, crafter];
+  option[dosym]^.selected           := [capital,crsupp, spbef];
+  option[ifsym]^.selected           :=  [capital,spaft, inbytab, gobsym];
+  option[thensym]^.selected         := [capital];
+  option[elsesym]^.selected         := [capital,crbefore, dindonkey, inbytab];
+  option[endsym]^.selected          := [capital,crbefore, crafter,dindonkey,dindent];
+  option[untilsym]^.selected        := [capital,crbefore, dindonkey, dindent, spaft,
+                                        gobsym, crafter];
+  option[becomes]^.selected         := [capital,spbef, spaft, gobsym];
+  option[Delphicomment]^.Selected   := [crafter];
+  option[opencomment]^.selected     := [capital,crsupp];
+  option[closecomment]^.selected    := [capital,crsupp];
+  option[semicolon]^.selected       := [capital,crsupp, dindonkey, crafter];
+  option[colon]^.selected           := [capital,inbytab];
+  option[equals]^.selected          := [capital,spbef, spaft, inbytab];
+  option[openparen]^.selected       := [capital,gobsym];
+  option[period]^.selected          := [capital,crsupp];
+end;
+
+{ ---------------------------------------------------------------------
+    Stream handling routines
+  ---------------------------------------------------------------------}
+
+Function ReadChar (S : PStream) : Char;
+
+Var C : Char;
+
+begin
+  S^.Read(C,1);
+  If S^.Status=stReadError then
+    ReadChar:=#0
+  else
+    ReadChar:=C;
+end;
+
+Function EoSLn (S : PStream) : Char;
+
+Const WhiteSpace = [' ', #9, #13 ];
+
+Var C : Char;
+
+begin
+  Repeat
+    S^.Read(C,1);
+  Until (Not (C in WhiteSpace)) or ((C=#10) or (S^.Status=stReadError));
+  If S^.Status=stReadError then
+    EoSln:=#0
+  else
+    EoSln:=C;
+end;
+
+Function ReadString (S: PStream): String;
+
+Var Buffer : ShortString;
+    I : Byte;
+
+begin
+  Buffer:='';
+  I:=0;
+  Repeat
+    S^.Read(Buffer[I+1],1);
+    Inc(I);
+  until (I=255) or (Buffer[I]=#10) Or (S^.Status=StReadError);
+  If S^.Status=stReadError then Dec(I);
+  If Buffer[i]=#10 Then Dec(I);
+  If Buffer[I]=#13 then Dec(I);
+  SetLength(Buffer,I);
+  ReadString:=Buffer;
+end;
+
+Procedure WriteString (S : PStream; Const ST : String);
+
+begin
+  S^.Write(St[1],length(St));
+end;
+
+
+Procedure WriteCR (S: PStream);
+
+Const
+{$ifdef linux}
+  Newline = #10;
+{$else}
+  NewLine = #13#10;
+{$endif}
+
+begin
+  WriteString(S,Newline);
+end;
+
+
+Procedure WriteLnString (S : PStream; ST : String);
+
+begin
+  WriteString(S,ST);
+  WriteCR(S);
+end;
+
+
+{ ---------------------------------------------------------------------
+    TPrettyPrinter object
+  ---------------------------------------------------------------------}
+
+Procedure TPrettyPrinter.Verbose (Const Msg : String);
+
+begin
+  If Assigned (DiagS) then
+    WriteLnString (DiagS,Msg);
+end;
+
+Procedure TPrettyPrinter.GetChar;
+{ Read the next character and classify it }
+  VAR  Ch: CHAR;
+  BEGIN
+    currchar := nextchar;
+    WITH nextchar DO
+      begin
+      Ch:=ReadCHar(Ins);
+      If Ch=#0 then
+        BEGIN
+        name := filemark;
+        Value := Blank
+        END
+      ELSE If (Ch=#10) THEN
+        BEGIN
+        name := endofline;
+        Value := Blank;
+        Inc(inlines);
+        END
+      ELSE
+        BEGIN
+        Value := Ch;
+        IF Ch IN ['a'..'z', 'A'..'Z', '_'] THEN name := letter
+        ELSE IF Ch IN ['0'..'9'] THEN name := digit
+        ELSE IF Ch = '''' THEN name := quote
+        ELSE IF Ch in [#13,' ',#9] THEN name := space
+        ELSE name := otherchar
+        END
+      end;
+  END; { of GetChar }
+
+
+Procedure TPrettyPrinter.StoreNextChar(VAR lngth: INTEGER;
+                        VAR Value: Token);
+  { Store a character in the current symbol }
+  BEGIN
+    GetChar;
+    IF lngth < maxsymbolsize THEN BEGIN
+      Inc(lngth);
+      Value[lngth] := currchar.Value;
+      Setlength(Value,lngth);
+    END;
+  END; { of StoreNextChar }
+
+
+Procedure TPrettyPrinter.SkipBlanks(VAR spacesbefore, crsbefore: INTEGER);
+  { Count the spaces between symbols }
+  BEGIN
+    spacesbefore := 0;
+    crsbefore := 0;
+    WHILE nextchar.name IN [space, endofline] DO BEGIN
+      GetChar;
+      CASE currchar.name OF
+        space:      Inc(spacesbefore);
+        endofline:  BEGIN
+                      Inc(crsbefore);
+                      spacesbefore := 0;
+                    END;
+      END;  {case}
+    END;
+  END; { of SkipBlanks }
+
+
+Procedure TPrettyPrinter.GetComment(sym: symbolinfo);
+  { Process comments using either brace or parenthesis notation }
+  BEGIN
+    sym^.name := opencomment;
+    WHILE NOT (((currchar.Value = '*') AND (nextchar.Value = ')'))
+    OR (currchar.Value = '}') OR (nextchar.name = endofline)
+    OR (nextchar.name = filemark)) DO
+      StoreNextChar(sym^.length, sym^.Value);
+    IF (currchar.Value = '*') AND (nextchar.Value = ')') THEN BEGIN
+      StoreNextChar(sym^.LENGTH, sym^.Value);
+      sym^.name := closecomment;
+    END;
+    IF currchar.Value = '}' THEN sym^.name := closecomment;
+  END; { of GetCommment }
+
+Procedure TPrettyPrinter.GetDelphiComment(sym: symbolinfo);
+  { Process comments using either brace or parenthesis notation }
+  BEGIN
+    sym^.name := Delphicomment;
+    WHILE NOT ((nextchar.name = endofline) OR (nextchar.name = filemark)) DO
+      StoreNextChar(sym^.length, sym^.Value);
+
+  END; { of GetDelphiCommment }
+
+
+
+Procedure TPrettyPrinter.GetIdentifier(sym: symbolinfo);
+  { Read an identifier and classify it }
+  BEGIN
+    WHILE nextchar.name IN [letter, digit] DO
+      StoreNextChar(sym^.length, sym^.Value);
+    ClassID(sym^.Value, sym^.length, sym^.name, sym^.IsKeyWord);
+    IF sym^.name IN [recordsym, casesym, endsym] THEN
+      CASE sym^.name OF
+        recordsym : RecordSeen := TRUE;
+        casesym   : IF RecordSeen THEN sym^.name := casevarsym;
+        endsym    : RecordSeen := FALSE;
+      END;  {case}
+  END; { of GetIdentifier }
+
+
+{ Read a number and store it as a string }
+Procedure TPrettyPrinter.GetNumber(sym: symbolinfo);
+  BEGIN
+    WHILE nextchar.name = digit DO StoreNextChar(sym^.length, sym^.Value);
+    sym^.name := othersym;
+  END; { of GetNumber }
+
+
+PROCEDURE TPrettyPrinter.GetCharLiteral(sym: symbolinfo);
+  { Read a quoted string }
+  BEGIN
+    WHILE nextchar.name = quote DO BEGIN
+      StoreNextChar(sym^.length, sym^.Value);
+      WHILE NOT (nextchar.name IN [quote, endofline, filemark]) DO
+        StoreNextChar(sym^.length, sym^.Value);
+      IF nextchar.name = quote THEN StoreNextChar(sym^.length, sym^.Value);
+    END;
+    sym^.name := othersym;
+  END; { of GetCharLiteral }
+
+
+FUNCTION TPrettyPrinter.char_Type: keysymbol;
+
+  { Classify a character pair }
+
+  VAR
+    NextTwoChars: SpecialChar;
+    Hit: BOOLEAN;
+    thischar: keysymbol;
+  BEGIN
+    NextTwoChars[1] := currchar.Value;
+    NextTwoChars[2] := nextchar.Value;
+    thischar := becomes;
+    Hit := FALSE;
+    WHILE NOT (Hit OR (thischar = closecomment)) DO BEGIN
+      IF NextTwoChars = DblChar[thischar] THEN Hit := TRUE
+      ELSE Inc(thischar);
+    END;
+    IF NOT Hit THEN BEGIN
+      thischar := opencomment;
+      WHILE NOT (Hit OR (PRED(thischar) = period)) DO BEGIN
+        IF currchar.Value = SglChar[thischar] THEN Hit := TRUE
+        ELSE Inc(thischar);
+      END;
+    END;
+    IF Hit THEN char_Type := thischar
+    ELSE char_Type := othersym;
+  END; { of char_Type }
+
+
+Procedure TPrettyPrinter.GetSpecialChar(sym: symbolinfo);
+   { Read special characters }
+  BEGIN
+    StoreNextChar(sym^.length, sym^.Value);
+    sym^.name := char_Type;
+    IF sym^.name IN dblch THEN StoreNextChar(sym^.length, sym^.Value)
+  END; { of GetSpecialChar }
+
+
+Procedure TPrettyPrinter.GetNextSymbol(sym: symbolinfo);
+  { Read a symbol using the appropriate procedure }
+  BEGIN
+    CASE nextchar.name OF
+      letter:     GetIdentifier(sym);
+      digit:      GetNumber(sym);
+      quote:      GetCharLiteral(sym);
+      otherchar:  BEGIN
+                    GetSpecialChar(sym);
+                    IF sym^.name = opencomment THEN GetComment(sym)
+                    else IF sym^.name= DelphiComment then GetDelphiComment(Sym)
+                  END;
+      filemark:   sym^.name := endoffile;
+      ELSE {:} {Turbo}
+        WRITELN('Unknown character type: ', ORD(nextchar.name));
+    END;  {case}
+  END; { of GetNextSymbol }
+
+
+Procedure TprettyPrinter.GetSymbol;
+{ Store the next symbol in NEXTSYM }
+  VAR
+    dummy: symbolinfo;
+  BEGIN
+    dummy := currsym;
+    currsym := nextsym;
+    nextsym := dummy;
+    SkipBlanks(nextsym^.spacesbefore, nextsym^.crsbefore);
+    nextsym^.length := 0;
+    nextsym^.IsKeyWord := FALSE;
+    IF currsym^.name = opencomment THEN GetComment(nextsym)
+    ELSE GetNextSymbol(nextsym);
+  END;  {of GetSymbol}
+
+
+Procedure TprettyPrinter.PopStack(VAR indentsymbol: keysymbol;
+                                  VAR prevmargin: INTEGER);
+  { Manage stack of indentation symbols and margins }
+  BEGIN
+    IF top > 0 THEN BEGIN
+      indentsymbol := stack[top].indentsymbol;
+      prevmargin := stack[top].prevmargin;
+      Dec(top);
+    END
+    ELSE BEGIN
+      indentsymbol := othersym;
+      prevmargin := 0;
+    END;
+  END; { of PopStack }
+
+
+Procedure TPrettyPrinter.PushStack(indentsymbol: keysymbol;
+                                   prevmargin: INTEGER );
+  BEGIN
+    Inc(top);
+    stack[top].indentsymbol := indentsymbol;
+    stack[top].prevmargin := prevmargin;
+  END; { of PushStack }
+
+
+Procedure TPrettyPrinter.WriteCRs(numberofcrs: INTEGER);
+  VAR
+    i: INTEGER;
+  BEGIN
+    IF numberofcrs > 0 THEN BEGIN
+      FOR i := 1 TO numberofcrs DO
+        WriteCr(OutS);
+      Inc(outlines,numberofcrs);
+      currlinepos := 0;
+    END;
+  END; { of WriteCRs }
+
+
+Procedure TPrettyPrinter.InsertCR;
+  BEGIN
+    IF currsym^.crsbefore = 0 THEN BEGIN
+      WriteCRs(1);
+      currsym^.spacesbefore := 0;
+    END;
+  END; { of InsertCR }
+
+
+Procedure TPrettyPrinter.InsertBlankLine;
+  BEGIN
+    IF currsym^.crsbefore = 0 THEN BEGIN
+      IF currlinepos = 0 THEN WriteCRs(1)
+      ELSE WriteCRs(2);
+      currsym^.spacesbefore := 0;
+    END
+    ELSE IF currsym^.crsbefore = 1 THEN
+      IF currlinepos > 0 THEN WriteCRs(1);
+  END; { of InsertBlankLine }
+
+
+Procedure TPrettyPrinter.LShiftOn(dindsym: keysymset);
+  { Move margin left according to stack configuration and current symbol }
+  VAR
+    indentsymbol: keysymbol;
+    prevmargin: INTEGER;
+  BEGIN
+    IF top > 0 THEN BEGIN
+      REPEAT
+        PopStack(indentsymbol, prevmargin);
+        IF indentsymbol IN dindsym THEN currmargin := prevmargin;
+      UNTIL NOT (indentsymbol IN dindsym) OR (top = 0);
+      IF NOT (indentsymbol IN dindsym) THEN
+        PushStack(indentsymbol, prevmargin);
+    END;
+  END; { of LShiftOn }
+
+
+Procedure TprettyPrinter.LShift;
+{ Move margin left according to stack top }
+  VAR
+    indentsymbol: keysymbol;
+    prevmargin: INTEGER;
+  BEGIN
+    IF top > 0 THEN BEGIN
+      PopStack(indentsymbol, prevmargin);
+      currmargin := prevmargin;
+(* maybe PopStack(indentsymbol,currmargin); *)
+    END;
+  END; { of LShift }
+
+
+Procedure TPrettyPrinter.InsertSpace(VAR symbol: symbolinfo);
+  { Insert space if room on line }
+  BEGIN
+    IF currlinepos < MAXLINESIZE THEN BEGIN
+      WriteString(OutS, Blank);
+      Inc(currlinepos);
+      IF (symbol^.crsbefore = 0) AND (symbol^.spacesbefore > 0)
+      THEN Dec(symbol^.spacesbefore);
+    END;
+  END; { of InsertSpace }
+
+
+Procedure TPrettyPrinter.MoveLinePos(newlinepos: INTEGER);
+  { Insert spaces until correct line position reached }
+  VAR  i: INTEGER;
+  BEGIN
+    FOR i := SUCC(currlinepos) TO newlinepos DO
+      WriteString(OutS, Blank);
+    currlinepos := newlinepos;
+  END; { of MoveLinePos }
+
+
+Procedure TPrettyPrinter.PrintSymbol;
+
+  BEGIN
+    IF (currsym^.IsKeyWord) then
+      begin
+      If upper in sets^.selected Then
+        WriteString (OutS,Upcase(currsym^.value))
+      else if lower in sets^.selected then
+        WriteString (OutS,Lowercase(currsym^.value))
+      else if capital in sets^.selected then
+        begin
+        WriteString(OutS,UpCase(CurrSym^.Value[1]));
+        WriteString(OutS,LowerCase(Copy(CurrSym^.Value,2,255)));
+        end
+      else
+        WriteString(OutS,Currsym^.Value);
+      end
+    ELSE
+      WriteString(OutS, currsym^.Value);
+    startpos := currlinepos;
+    Inc(currlinepos,currsym^.length);
+  END; { of PrintSymbol }
+
+
+Procedure TPrettyPrinter.PPSymbol;
+{ Find position for symbol and then print it }
+  VAR  newlinepos: INTEGER;
+  BEGIN
+    WriteCRs(currsym^.crsbefore);
+    IF (currlinepos + currsym^.spacesbefore > currmargin)
+    OR (currsym^.name IN [opencomment, closecomment])
+    THEN newlinepos := currlinepos + currsym^.spacesbefore
+    ELSE newlinepos := currmargin;
+
+    IF newlinepos + currsym^.length > MAXLINESIZE THEN BEGIN
+      WriteCRs(1);
+      IF currmargin + currsym^.length <= MAXLINESIZE
+      THEN newlinepos := currmargin
+      ELSE IF currsym^.length < MAXLINESIZE
+      THEN newlinepos := MAXLINESIZE - currsym^.length
+      ELSE newlinepos := 0;
+    END;
+    MoveLinePos(newlinepos);
+    PrintSymbol;
+  END; { of PPSymbol }
+
+
+Procedure TPrettyPrinter.Gobble(terminators: keysymset);
+  { Print symbols which follow a formatting symbol but which do not
+    affect layout }
+  BEGIN
+    IF top < MAXSTACKSIZE THEN PushStack(currsym^.name, currmargin);
+    currmargin := currlinepos;
+    WHILE NOT ((nextsym^.name IN terminators)
+    OR (nextsym^.name = endoffile)) DO BEGIN
+      GetSymbol;
+      PPSymbol;
+    END;
+    LShift;
+  END; { of Gobble }
+
+
+Procedure TprettyPrinter.RShift(currmsym: keysymbol);
+  { Move right, stacking margin positions }
+  BEGIN
+    IF top < MAXSTACKSIZE THEN PushStack(currmsym, currmargin);
+    IF startpos > currmargin THEN currmargin := startpos;
+    Inc(currmargin,INDENT);
+  END; { of RShift }
+
+
+Function TPrettyPrinter.ReadConfigFile : Boolean;
+
+Var I,J : Longint;
+
+  Procedure SetOption(TheKey : KeySymbol;Var OptionList : String);
+
+  Var TheOpt  : Options;
+      Found : Boolean;
+      K : longint;
+      opt : string;
+
+  begin
+    Repeat
+      K:=pos(',',optionlist);
+      If k>0 then
+        begin
+        opt:=Copy(OptionList,1,k-1);
+        strip(opt);
+        Delete(OptionList,1,k);
+        end
+      else
+        opt:=OptionList;
+      If Length(Opt)>0 then
+        begin
+        Found:=False;
+        for TheOpt :=firstopt to lastopt do
+          begin
+          found:=opt=OptionNames[Theopt];
+          If found then break;
+          end;
+        If not found then
+          Verbose ('Unknown option on line '+inttostr(i)+': '+Opt)
+        else
+          Option[TheKey]^.Selected:=Option[TheKey]^.Selected+[TheOpt];
+        end;
+    until k=0;
+  end;
+
+  Procedure SetIndent(TheKey : KeySymbol; Var OptionList : String);
+
+  Var
+      TheIndent : Keysymbol;
+      Found : Boolean;
+      K : longint;
+      opt : string;
+
+  begin
+    Repeat
+      K:=pos(',',optionlist);
+      If k>0 then
+        begin
+        opt:=Copy(OptionList,1,k-1);
+        strip(opt);
+        Delete(OptionList,1,k);
+        end
+      else
+        opt:=OptionList;
+      If Length(Opt)>0 then
+        begin
+        Found:=False;
+        for TheIndent :=firstKey to lastKey do
+          begin
+          found:=opt=EntryNames[Theindent];
+          If found then break;
+          end;
+        If not found then
+          begin
+          Verbose ('Unknown indent keysym on line '+inttostr(i)+': '+Opt);
+          exit;
+          end;
+        Option[TheKey]^.dindsym:=Option[TheKey]^.dindsym+[Theindent];
+        end;
+    until k=0;
+  end;
+
+Var TheKey : KeySymbol;
+    Found,DoIndent : Boolean;
+    Line, Name : String;
+
+begin
+  ReadConfigFile:=false;
+  I:=0;
+  while not (CfgS^.Status=stReadError) do
+    begin
+    inc(i);
+    Line:='';
+    Line:=ReadString(cfgS);
+    { Strip comment }
+    If pos('#',Line)<>0 then
+      Line:=Copy(Line,1,Pos('#',Line)-1);
+    If length(Line)<>0 then
+      begin
+      J:=Pos('=',Line);
+      If J>0 then
+        begin
+        Line:=LowerCase(Line);
+        Name:=Copy(Line,1,j-1);
+        Delete(Line,1,J);
+        { indents or options ? }
+        If (Name[1]='[') and
+           (Name[Length(Name)]=']') then
+           begin
+           Name:=Copy(Name,2,Length(Name)-2);
+           Doindent:=True;
+           end
+        else
+           DoIndent:=False;
+        Strip(Name);
+        found:=false;
+        for thekey:=firstkey to lastkey do
+          begin
+          found:=Name=EntryNames[thekey];
+          If Found then break;
+          end;
+        If not found then
+          Verbose ('Unknown keyword on line '+inttostr(i)+': '+Name)
+        else
+          If DoIndent then
+            SetIndent(TheKey,Line)
+          else
+            SetOption(TheKey,Line)
+        end
+      else
+        verbose ('Error in config file on line '+IntToStr(i));
+      end;
+    end;
+  Verbose ('Processed configfile: read '+IntToStr(I)+' lines');
+  ReadConfigFile:=true;
+end;
+
+Procedure GenerateCfgFile(S : PStream);
+
+Var TheKey,TheIndent : KeySymbol;
+    TheOpt : Options;
+    Written : Boolean;
+    Option : OptionTable;
+
+begin
+  CreateOptions(option);
+  SetDefaults(option);
+  SetDefaultIndents(option);
+  For TheKey:=Firstkey to lastkey do
+    begin
+    { Write options }
+    WriteString (S,EntryNames[TheKey]+'=');
+    Written:=False;
+    for TheOpt:=FirstOpt to LastOpt do
+      If TheOpt in Option[TheKey]^.Selected then
+        begin
+        if written then
+           WriteString (S,',')
+        else
+           Written:=True;
+        writeString (S,OptionNames[TheOpt]);
+        end;
+    WriteCr (S);
+    { Write de-indent keysyms, if any }
+    If Option[TheKey]^.dindsym<>[] then
+      begin
+      WriteString (S,'['+EntryNames[TheKey]+']=');
+      Written:=False;
+      For TheIndent:=FirstKey to lastkey do
+      If TheIndent in Option[TheKey]^.dindsym then
+        begin
+        if written then
+           WriteString (S,',')
+        else
+           Written:=True;
+        WriteString (S,EntryNames[Theindent]);
+        end;
+      WriteCr (S);
+      end;
+    end;
+end;
+
+
+Function TPrettyPrinter.PrettyPrint : Boolean;
+
+Begin
+  PrettyPrint:=False;
+  If Not Assigned(Ins) or Not Assigned(OutS) then
+    exit;
+  If Not Assigned(CfgS) then
+    begin
+    SetDefaults(Option);
+    SetDefaultIndents(Option);
+    end
+  else
+    ReadConfigFile;
+  { Initialize variables }
+  top := 0;
+  currlinepos := 0;
+  currmargin := 0;
+  inlines := 0;
+  outlines := 0;
+  CrPending := FALSE;
+  RecordSeen := FALSE;
+  GetChar;
+  NEW(currsym);
+  NEW(nextsym);
+  GetSymbol;
+  WHILE nextsym^.name <> endoffile DO BEGIN
+    GetSymbol;
+    sets := option[currsym^.name];
+    IF (CrPending AND NOT (crsupp IN sets^.selected))
+    OR (crbefore IN sets^.selected) THEN BEGIN
+      InsertCR;
+      CrPending := FALSE
+    END;
+    IF blinbefore IN sets^.selected THEN BEGIN
+      InsertBlankLine;
+      CrPending := FALSE
+    END;
+    IF dindonkey IN sets^.selected THEN LShiftOn(sets^.dindsym);
+    IF dindent IN sets^.selected THEN LShift;
+    IF spbef IN sets^.selected THEN InsertSpace(currsym);
+    PPSymbol;
+    IF spaft IN sets^.selected THEN InsertSpace(nextsym);
+    IF inbytab IN sets^.selected THEN RShift(currsym^.name);
+    IF gobsym IN sets^.selected THEN Gobble(sets^.terminators);
+    IF crafter IN sets^.selected THEN CrPending := TRUE
+  END;
+  IF CrPending THEN WriteCRs(1);
+  Verbose(IntToStr(inlines)+' lines read, '+IntToStr(outlines)+' lines written.');
+  PrettyPrint:=True;
+end;
+
+Constructor TPrettyPrinter.Create;
+
+Begin
+  CreateOptions (Option);
+  SetTerminators(Option);
+  DiagS:=Nil;
+  InS:=Nil;
+  OutS:=Nil;
+  CfgS:=Nil;
+End;
+
+{ ---------------------------------------------------------------------
+    Unit initialization
+  ---------------------------------------------------------------------}
+
+
+Begin
+  CreateHash;
+  dblch := [becomes, opencomment];
+end.
+
+{
+  $Log$
+  Revision 1.1  1999-05-12 16:11:39  peter
+    * moved
+
+  Revision 1.4  1999/05/03 18:03:15  peter
+    * renamed mkdep -> ppdep
+    * removed obsolete units
+    * add .cod files
+
+  Revision 1.3  1999/03/25 16:52:30  michael
+  + Implemented Delphi keywords and delphi comments
+
+  Revision 1.2  1999/03/23 14:19:02  michael
+  Added GPL and log
+
+}