Browse Source

* some fixes for ansi strings
* $log$ to $Log$ changed

florian 27 years ago
parent
commit
76ee202b37
8 changed files with 77 additions and 31 deletions
  1. 5 1
      compiler/aopt386.pas
  2. 28 14
      compiler/cg386cnv.pas
  3. 12 7
      compiler/cg386flw.pas
  4. 5 1
      compiler/csopt386.pas
  5. 5 1
      compiler/daopt386.pas
  6. 5 1
      compiler/popt386.pas
  7. 6 2
      compiler/pp.pas
  8. 11 4
      compiler/types.pas

+ 5 - 1
compiler/aopt386.pas

@@ -49,5 +49,9 @@ End;
 End.
 
 {
- $log $
+ $Log$
+ Revision 1.20  1998-08-05 16:00:08  florian
+   * some fixes for ansi strings
+   * $log$ to $Log$ changed
+
 }

+ 28 - 14
compiler/cg386cnv.pas

@@ -390,10 +390,13 @@ implementation
 
     procedure second_string_string(p,hp : ptree;convtyp : tconverttype);
 
+      var
+         pushed : tpushed;
+
       begin
 {$ifdef UseAnsiString}
          { does anybody know a better solution than this big case statement ? }
-         { ok, a proc table woudl do the job                                  }
+         { ok, a proc table would do the job                                  }
          case pstringdef(p)^.string_typ of
 
             st_shortstring:
@@ -430,11 +433,6 @@ implementation
                       {!!!!!!!}
                       internalerror(8888);
                    end;
-                 st_longstring:
-                   begin
-                      {!!!!!!!}
-                      internalerror(8888);
-                   end;
                  st_ansistring:
                    begin
                       {!!!!!!!}
@@ -451,19 +449,31 @@ implementation
               case pstringdef(p^.left)^.string_typ of
                  st_shortstring:
                    begin
-                      {!!!!!!!}
-                      internalerror(8888);
+                      pushusedregisters(pushed,$ff);
+                      push_int(p^.resulttype^.size-1);
+                      gettempofsizereference(p^.resulttype^.size,p^.location.reference);
+                      emitpushreferenceaddr(exprasmlist,p^.location.reference);
+                      case p^.right^.location.loc of
+                         LOC_REGISTER,LOC_CREGISTER:
+                           begin
+                              exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,p^.right^.location.register)));
+                              ungetregister32(p^.left^.location.register);
+                           end;
+                         LOC_REFERENCE,LOC_MEM:
+                           begin
+                              emit_push_mem(p^.left^.location.reference);
+                              del_reference(p^.left^.location.reference);
+                           end;
+                      end;
+                      emitcall('FPC_ANSI_TO_SHORTSTRING',true);
+                      maybe_loadesi;
+                      popusedregisters(pushed);
                    end;
                  st_longstring:
                    begin
                       {!!!!!!!}
                       internalerror(8888);
                    end;
-                 st_ansistring:
-                   begin
-                      {!!!!!!!}
-                      internalerror(8888);
-                   end;
                  st_widestring:
                    begin
                       {!!!!!!!}
@@ -1170,7 +1180,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.8  1998-07-18 22:54:24  florian
+  Revision 1.9  1998-08-05 16:00:09  florian
+    * some fixes for ansi strings
+    * $log$ to $Log$ changed
+
+  Revision 1.8  1998/07/18 22:54:24  florian
     * some ansi/wide/longstring support fixed:
        o parameter passing
        o returning as result from functions

+ 12 - 7
compiler/cg386flw.pas

@@ -605,11 +605,12 @@ do_jmp:
          { default handling }
          if assigned(p^.t1) then
            begin
-{           // FPC_CATCHES must be called with
-           // 'default handler' flag (=-1)}
-           push_int (-1);
-           emitcall('FPC_CATCHES',true);
-           secondpass(p^.t1);
+              { FPC_CATCHES must be called with
+                'default handler' flag (=-1)
+              }
+              push_int (-1);
+              emitcall('FPC_CATCHES',true);
+              secondpass(p^.t1);
            end
          else
            emitcall('FPC_RERAISE',true);
@@ -736,8 +737,12 @@ do_jmp:
 end.
 {
   $Log$
-  Revision 1.10  1998-08-04 16:26:26  jonas
-  * converted // comment to {} comment
+  Revision 1.11  1998-08-05 16:00:10  florian
+    * some fixes for ansi strings
+    * $log$ to $Log$ changed
+
+  Revision 1.10  1998/08/04 16:26:26  jonas
+    * converted // comment to TP comment
 
   Revision 1.9  1998/07/31 11:36:34  michael
   Default exception handler also needs to call FPC_CATCHES

+ 5 - 1
compiler/csopt386.pas

@@ -393,5 +393,9 @@ End;
 End.
 
 {
- $log $
+ $Log$
+ Revision 1.3  1998-08-05 16:00:12  florian
+   * some fixes for ansi strings
+   * $log$ to $Log$ changed
+
 }

+ 5 - 1
compiler/daopt386.pas

@@ -1442,5 +1442,9 @@ End;
 End.
 
 {
- $log $
+ $Log$
+ Revision 1.3  1998-08-05 16:00:14  florian
+   * some fixes for ansi strings
+   * $log$ to $Log$ changed
+
 }

+ 5 - 1
compiler/popt386.pas

@@ -1362,5 +1362,9 @@ End;
 End.
 
 {
- $log $
+ $Log$
+ Revision 1.3  1998-08-05 16:00:15  florian
+   * some fixes for ansi strings
+   * $log$ to $Log$ changed
+
 }

+ 6 - 2
compiler/pp.pas

@@ -405,7 +405,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.22  1998-08-04 16:28:40  jonas
+  Revision 1.23  1998-08-05 16:00:16  florian
+    * some fixes for ansi strings
+    * $log$ to $Log$ changed
+
+  Revision 1.22  1998/08/04 16:28:40  jonas
   * added support for NoRa386* in the {$O ...} section
 
   Revision 1.21  1998/07/18 17:11:12  florian
@@ -422,7 +426,7 @@ end.
     * fixed the name changes
 
   Revision 1.17  1998/06/23 08:59:22  daniel
-  * Recommitted.
+    * Recommitted.
 
   Revision 1.16  1998/06/17 14:10:17  peter
     * small os2 fixes

+ 11 - 4
compiler/types.pas

@@ -237,7 +237,7 @@ unit types;
 
       begin
          dont_copy_const_param:=(def^.deftype in [arraydef,objectdef,formaldef,recorddef]) or
-           ((def^.deftype=stringdef) and (pstringdef(def)^.string_typ in [st_ansistring,st_shortstring,st_longstring])) or
+           ((def^.deftype=stringdef) and (pstringdef(def)^.string_typ in [st_shortstring,st_longstring])) or
            ((def^.deftype=procvardef) and ((pprocvardef(def)^.options and pomethodpointer)<>0)) or
            ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset));
       end;
@@ -455,8 +455,11 @@ unit types;
          else
             { strings with the same length are equal }
             if (def1^.deftype=stringdef) and (def2^.deftype=stringdef) and
-               (pstringdef(def1)^.len=pstringdef(def2)^.len) then
-            b:=true
+               (pstringdef(def1)^.string_typ=pstringdef(def2)^.string_typ) then
+               begin
+                  b:=not(is_shortstring(def1)) or
+                    (pstringdef(def1)^.len=pstringdef(def2)^.len);
+               end
     { STRING[N] ist equivalent zu ARRAY[0..N] OF CHAR (N<256) }
 {
          else if ((def1^.deftype=stringdef) and (def2^.deftype=arraydef)) and
@@ -858,7 +861,11 @@ unit types;
 end.
 {
   $Log$
-  Revision 1.16  1998-07-20 23:35:50  michael
+  Revision 1.17  1998-08-05 16:00:17  florian
+    * some fixes for ansi strings
+    * $log$ to $Log$ changed
+
+  Revision 1.16  1998/07/20 23:35:50  michael
   Const ansistrings are not copied.
 
   Revision 1.15  1998/07/18 22:54:32  florian