Explorar o código

* only return int64's from functions if it int64funcresok is defined
+ added int64funcresok define to options.pas

Jonas Maebe %!s(int64=25) %!d(string=hai) anos
pai
achega
0a70f9b06e
Modificáronse 3 ficheiros con 35 adicións e 7 borrados
  1. 13 1
      compiler/ncon.pas
  2. 6 1
      compiler/options.pas
  3. 16 5
      compiler/pexpr.pas

+ 13 - 1
compiler/ncon.pas

@@ -116,7 +116,11 @@ interface
 
     { some helper routines }
 
+{$ifdef INT64FUNCRESOK}
     function get_ordinal_value(p : tnode) : TConstExprInt;
+{$else INT64FUNCRESOK}
+    function get_ordinal_value(p : tnode) : longint;
+{$endif INT64FUNCRESOK}
     function is_constnode(p : tnode) : boolean;
     function is_constintnode(p : tnode) : boolean;
     function is_constcharnode(p : tnode) : boolean;
@@ -201,7 +205,11 @@ implementation
          genpcharconstnode:=cstringconstnode.createpchar(s,length);
       end;
 
+{$ifdef INT64FUNCRESOK}
     function get_ordinal_value(p : tnode) : TConstExprInt;
+{$else INT64FUNCRESOK}
+    function get_ordinal_value(p : tnode) : longint;
+{$endif INT64FUNCRESOK}
       begin
          if p.nodetype=ordconstn then
            get_ordinal_value:=tordconstnode(p).value
@@ -650,7 +658,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.12  2000-12-07 17:19:42  jonas
+  Revision 1.13  2000-12-15 13:26:01  jonas
+    * only return int64's from functions if it int64funcresok is defined
+    + added int64funcresok define to options.pas
+
+  Revision 1.12  2000/12/07 17:19:42  jonas
     * new constant handling: from now on, hex constants >$7fffffff are
       parsed as unsigned constants (otherwise, $80000000 got sign extended
       and became $ffffffff80000000), all constants in the longint range

+ 6 - 1
compiler/options.pas

@@ -1230,6 +1230,7 @@ begin
   def_symbol('HASOUT');
   def_symbol('HASINTF');
   def_symbol('INTERNSETLENGTH');
+  def_symbol('INT64FUNCRESOK');
 
 {$ifdef SUPPORT_FIXED}
   def_symbol('HASFIXED');
@@ -1509,7 +1510,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.19  2000-11-30 22:48:23  florian
+  Revision 1.20  2000-12-15 13:26:01  jonas
+    * only return int64's from functions if it int64funcresok is defined
+    + added int64funcresok define to options.pas
+
+  Revision 1.19  2000/11/30 22:48:23  florian
   * opts386 renamed
 
   Revision 1.18  2000/11/29 00:30:34  florian

+ 16 - 5
compiler/pexpr.pas

@@ -46,7 +46,11 @@ interface
     procedure do_member_read(getaddr : boolean;const sym : psym;var p1 : tnode;
       var pd : pdef;var again : boolean);
 
+{$ifdef int64funcresok}
     function get_intconst:TConstExprInt;
+{$else int64funcresok}
+    function get_intconst:longint;
+{$endif int64funcresok}
 
     function get_stringconst:string;
 
@@ -2367,8 +2371,11 @@ _LECKKLAMMER : begin
          expr:=p1;
       end;
 
-
+{$ifdef int64funcresok}
     function get_intconst:TConstExprInt;
+{$else int64funcresok}
+    function get_intconst:longint;
+{$endif int64funcresok}
     {Reads an expression, tries to evalute it and check if it is an integer
      constant. Then the constant is returned.}
     var
@@ -2378,9 +2385,9 @@ _LECKKLAMMER : begin
       do_firstpass(p);
       if not codegenerror then
        begin
-         if (p.nodetype<>ordconstn) and
-            (p.resulttype^.deftype=orddef) and
-           not(Porddef(p.resulttype)^.typ in [uvoid,uchar,bool8bit,bool16bit,bool32bit]) then
+         if (p.nodetype<>ordconstn) or
+            (p.resulttype^.deftype<>orddef) or
+            (Porddef(p.resulttype)^.typ in [uvoid,uchar,bool8bit,bool16bit,bool32bit]) then
           Message(cg_e_illegal_expression)
          else
           get_intconst:=tordconstnode(p).value;
@@ -2413,7 +2420,11 @@ _LECKKLAMMER : begin
 end.
 {
   $Log$
-  Revision 1.20  2000-12-15 12:13:52  michael
+  Revision 1.21  2000-12-15 13:26:01  jonas
+    * only return int64's from functions if it int64funcresok is defined
+    + added int64funcresok define to options.pas
+
+  Revision 1.20  2000/12/15 12:13:52  michael
   + Fix from Peter
 
   Revision 1.19  2000/12/07 17:19:42  jonas