Ver Fonte

* support for enum enumtype enumvar; fixed
same for unions done

florian há 23 anos atrás
pai
commit
f86c568373
3 ficheiros alterados com 36 adições e 12 exclusões
  1. 9 7
      utils/h2pas/h2pas.pas
  2. 11 5
      utils/h2pas/h2pas.y
  3. 16 0
      utils/h2pas/testit.h

+ 9 - 7
utils/h2pas/h2pas.pas

@@ -1015,6 +1015,7 @@ program h2pas;
               end;
             t_uniondef :
               begin
+                 inc(typedef_level);
                  if (typedef_level>1) and (p^.p1=nil) and
                     (p^.p2^.typ=t_id) then
                    begin
@@ -1056,6 +1057,7 @@ program h2pas;
                       flush(outfile);
                       dec(typedef_level);
                    end;
+                 dec(typedef_level);
               end;
             else
               internalerror(3);
@@ -1789,12 +1791,12 @@ begin
        end;
   41 : begin
          
-         yyval:=new(presobject,init_two(t_uniondef,nil,yyv[yysp-0]));
+         yyval:=yyv[yysp-0];
          
        end;
   42 : begin
          
-         yyval:=new(presobject,init_two(t_structdef,nil,yyv[yysp-0]));
+         yyval:=yyv[yysp-0];
          
        end;
   43 : begin
@@ -1804,7 +1806,7 @@ begin
        end;
   44 : begin
          
-         yyval:=new(presobject,init_two(t_enumdef,nil,yyv[yysp-0]));
+         yyval:=yyv[yysp-0];
          
        end;
   45 : begin
@@ -7857,9 +7859,9 @@ end.
 
 {
   $Log$
-  Revision 1.4  2001-08-17 22:47:30  florian
-    * C contant size specifiers can be lower cased as well:
-      0x12341234u is allowed
+  Revision 1.5  2001-12-17 23:34:58  florian
+    * support for enum enumtype enumvar; fixed
+      same for unions done
 
   Revision 1.3  2001/04/10 21:22:38  peter
     * more fixes that were still laying around
@@ -7870,5 +7872,5 @@ end.
       (you need to run h2paspp manual)
 
   Revision 1.1  2000/07/13 10:16:23  michael
-  + Initial import
+    + Initial import
 }

+ 11 - 5
utils/h2pas/h2pas.y

@@ -1011,6 +1011,7 @@ program h2pas;
               end;
             t_uniondef :
               begin
+                 inc(typedef_level);
                  if (typedef_level>1) and (p^.p1=nil) and
                     (p^.p2^.typ=t_id) then
                    begin
@@ -1052,6 +1053,7 @@ program h2pas;
                       flush(outfile);
                       dec(typedef_level);
                    end;
+                 dec(typedef_level);
               end;
             else
               internalerror(3);
@@ -1710,11 +1712,11 @@ special_type_specifier :
      } |
      UNION dname
      {
-       $$:=new(presobject,init_two(t_uniondef,nil,$2));
+       $$:=$2;
      } |
      STRUCT dname
      {
-       $$:=new(presobject,init_two(t_structdef,nil,$2));
+       $$:=$2;
      } |
      ENUM dname closed_enum_list
      {
@@ -1722,7 +1724,7 @@ special_type_specifier :
      } |
      ENUM dname
      {
-       $$:=new(presobject,init_two(t_enumdef,nil,$2));
+       $$:=$2;
      };
 
 type_specifier :
@@ -2441,7 +2443,11 @@ end.
 
 {
   $Log$
-  Revision 1.3  2001-04-10 21:22:38  peter
+  Revision 1.4  2001-12-17 23:34:59  florian
+    * support for enum enumtype enumvar; fixed
+      same for unions done
+
+  Revision 1.3  2001/04/10 21:22:38  peter
     * more fixes that were still laying around
 
   Revision 1.2  2000/12/27 21:59:59  peter
@@ -2450,5 +2456,5 @@ end.
       (you need to run h2paspp manual)
 
   Revision 1.1  2000/07/13 10:16:23  michael
-  + Initial import
+    + Initial import
 }

+ 16 - 0
utils/h2pas/testit.h

@@ -21,6 +21,22 @@ struct _test
   int y;
 };
 
+struct XML_cp {
+  enum XML_Content_Type         type;
+  enum XML_Content_Quant        quant;
+  struct _test                  test;
+  union _test2                  test2;
+  XML_Char *                    name;
+  unsigned int                  numchildren;
+  XML_Content *                 children;
+};
+
+typedef void (*XML_AttlistDeclHandler) (void           *userData,
+                                        const XML_Char *elname,
+                                        const XML_Char *attname,
+                                        const XML_Char *att_type,
+                                        const XML_Char *dflt,
+                                        int             isrequired);
 void proc(int *,int);
 void proc(int *p,int i);