Explorar o código

+ ansi string constants fixed
+ switch $H partial implemented

florian %!s(int64=27) %!d(string=hai) anos
pai
achega
ce8b39ae1f
Modificáronse 5 ficheiros con 72 adicións e 25 borrados
  1. 29 17
      compiler/cg386con.pas
  2. 9 2
      compiler/pass_1.pas
  3. 14 1
      compiler/pdecl.pas
  4. 14 3
      compiler/pp.pas
  5. 6 2
      compiler/switches.pas

+ 29 - 17
compiler/cg386con.pas

@@ -37,7 +37,7 @@ interface
 implementation
 implementation
 
 
     uses
     uses
-      cobjects,verbose,
+      cobjects,verbose,globals,
       symtable,aasm,i386,
       symtable,aasm,i386,
       hcodegen,cgai386,temp_gen,tgeni386,cgi386;
       hcodegen,cgai386,temp_gen,tgeni386,cgi386;
 
 
@@ -190,24 +190,32 @@ implementation
                    getmem(pc,length(p^.values^)+3);
                    getmem(pc,length(p^.values^)+3);
                    move(p^.values^,pc^,length(p^.values^)+1);
                    move(p^.values^,pc^,length(p^.values^)+1);
                    pc[length(p^.values^)+1]:=#0;
                    pc[length(p^.values^)+1]:=#0;
-{$else UseAnsiString}
-                   pc:=getpcharcopy(p);
-{$endif UseAnsiString}
-
                    concat_constlabel(lastlabel,conststring);
                    concat_constlabel(lastlabel,conststring);
-{$ifdef UseAnsiString}
-{$ifdef debug}
-                   consts^.concat(new(pai_asm_comment,init('Header of ansistring')));
-{$endif debug}
-                   consts^.concat(new(pai_const,init_32bit(p^.length)));
-                   consts^.concat(new(pai_const,init_32bit(p^.length)));
-                   consts^.concat(new(pai_const,init_32bit(-1)));
-                   { to overcome this problem we set the length explicitly }
-                   { with the ending null char }
-                   consts^.concat(new(pai_string,init_length_pchar(pc,p^.length+1)));
-{$else UseAnsiString}
                    { we still will have a problem if there is a #0 inside the pchar }
                    { we still will have a problem if there is a #0 inside the pchar }
                    consts^.concat(new(pai_string,init_length_pchar(pc,length(p^.values^)+2)));
                    consts^.concat(new(pai_string,init_length_pchar(pc,length(p^.values^)+2)));
+{$else UseAnsiString}
+                   if cs_ansistrings in aktswitches then
+                     begin
+                        concat_constlabel(lastlabel,conststring);
+                        consts^.concat(new(pai_const,init_32bit(p^.length)));
+                        consts^.concat(new(pai_const,init_32bit(p^.length)));
+                        consts^.concat(new(pai_const,init_32bit(-1)));
+                        getmem(pc,p^.length+1);
+                        move(p^.values^,pc^,p^.length+1);
+                        { to overcome this problem we set the length explicitly }
+                        { with the ending null char }
+                        consts^.concat(new(pai_string,init_length_pchar(pc,p^.length+1)));
+                     end
+                   else
+                     begin
+                        getmem(pc,p^.length+3);
+                        move(p^.values^,pc[1],p^.length+1);
+                        pc[0]:=chr(p^.length);
+                        concat_constlabel(lastlabel,conststring);
+                        { to overcome this problem we set the length explicitly }
+                        { with the ending null char }
+                        consts^.concat(new(pai_string,init_length_pchar(pc,p^.length+2)));
+                     end;
 {$endif UseAnsiString}
 {$endif UseAnsiString}
                 end;
                 end;
            end;
            end;
@@ -328,7 +336,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.5  1998-06-25 08:48:07  florian
+  Revision 1.6  1998-07-18 17:11:07  florian
+    + ansi string constants fixed
+    + switch $H partial implemented
+
+  Revision 1.5  1998/06/25 08:48:07  florian
     * first version of rtti support
     * first version of rtti support
 
 
   Revision 1.4  1998/06/08 13:13:31  pierre
   Revision 1.4  1998/06/08 13:13:31  pierre

+ 9 - 2
compiler/pass_1.pas

@@ -1498,7 +1498,10 @@ unit pass_1;
          {why this !!! lost of dummy type definitions
          {why this !!! lost of dummy type definitions
          one per const string !!!
          one per const string !!!
          p^.resulttype:=new(pstringdef,init(length(p^.values^)));}
          p^.resulttype:=new(pstringdef,init(length(p^.values^)));}
-         p^.resulttype:=cstringdef;
+         if cs_ansistrings in aktswitches then
+           p^.resulttype:=cansistringdef
+         else
+           p^.resulttype:=cstringdef;
          p^.location.loc:=LOC_MEM;
          p^.location.loc:=LOC_MEM;
       end;
       end;
 
 
@@ -5040,7 +5043,11 @@ unit pass_1;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.39  1998-07-14 21:46:47  peter
+  Revision 1.40  1998-07-18 17:11:09  florian
+    + ansi string constants fixed
+    + switch $H partial implemented
+
+  Revision 1.39  1998/07/14 21:46:47  peter
     * updated messages file
     * updated messages file
 
 
   Revision 1.38  1998/07/14 14:46:50  peter
   Revision 1.38  1998/07/14 14:46:50  peter

+ 14 - 1
compiler/pdecl.pas

@@ -82,6 +82,7 @@ unit pdecl;
          sym : psym;
          sym : psym;
          ps : pconstset;
          ps : pconstset;
          pd : pdouble;
          pd : pdouble;
+         sp : pstring;
 
 
       begin
       begin
          consume(_CONST);
          consume(_CONST);
@@ -109,7 +110,15 @@ unit pdecl;
                         end;
                         end;
                       stringconstn:
                       stringconstn:
                         {values is disposed with p so I need a copy !}
                         {values is disposed with p so I need a copy !}
+{$ifdef USEANSISTRING}  begin
+                           getmem(sp,p^.length+1);
+                           move(p^.values^,sp^[1],p^.length);
+                           sp^[0]:=chr(p^.length);
+                           symtablestack^.insert(new(pconstsym,init(name,conststring,longint(sp),nil)));
+                        end;
+{$else USEANSISTRING}
                         symtablestack^.insert(new(pconstsym,init(name,conststring,longint(stringdup(p^.values^)),nil)));
                         symtablestack^.insert(new(pconstsym,init(name,conststring,longint(stringdup(p^.values^)),nil)));
+{$endif USEANSISTRING}
                       realconstn : begin
                       realconstn : begin
                                       new(pd);
                                       new(pd);
                                       pd^:=p^.valued;
                                       pd^:=p^.valued;
@@ -1864,7 +1873,11 @@ unit pdecl;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.32  1998-07-14 21:46:50  peter
+  Revision 1.33  1998-07-18 17:11:11  florian
+    + ansi string constants fixed
+    + switch $H partial implemented
+
+  Revision 1.32  1998/07/14 21:46:50  peter
     * updated messages file
     * updated messages file
 
 
   Revision 1.31  1998/07/14 14:46:53  peter
   Revision 1.31  1998/07/14 14:46:53  peter

+ 14 - 3
compiler/pp.pas

@@ -36,6 +36,8 @@
                       MMX instructions
                       MMX instructions
   EXTERN_MSG          Don't compile the msgfiles in the compiler, always
   EXTERN_MSG          Don't compile the msgfiles in the compiler, always
                       use external messagefiles
                       use external messagefiles
+  NOAG386INT          no Intel Assembler output
+  NOAG386NSM          no NASM output
   -----------------------------------------------------------------
   -----------------------------------------------------------------
 
 
   Required switches for a i386 compiler be compiled by Free Pascal Compiler:
   Required switches for a i386 compiler be compiled by Free Pascal Compiler:
@@ -106,8 +108,7 @@ uses
   {$ifopt o+}
   {$ifopt o+}
     Overlay,ppovin,
     Overlay,ppovin,
   {$else}
   {$else}
-  { warn when not $O+ is used }
-    - You must compile with the $O+ switch
+  {$error You must compile with the $O+ switch}
   {$endif}
   {$endif}
 {$endif useoverlay}
 {$endif useoverlay}
 {$ifdef lock}
 {$ifdef lock}
@@ -192,16 +193,22 @@ uses
         {$O cg386ld}
         {$O cg386ld}
         {$O cg386mat}
         {$O cg386mat}
         {$O cg386set}
         {$O cg386set}
+{$ifndef NOOPT}
         {$O aopt386}
         {$O aopt386}
+{$endif NOOPT}
         {$O cgai386}
         {$O cgai386}
         {$O i386}
         {$O i386}
         {$O ra386dir}
         {$O ra386dir}
         {$O ra386int}
         {$O ra386int}
         {$O ra386att}
         {$O ra386att}
         {$O tgeni386}
         {$O tgeni386}
+{$ifndef NoAg386Int}
         {$O ag386int}
         {$O ag386int}
+{$endif NoAg386Int}
         {$O ag386att}
         {$O ag386att}
+{$ifndef NoAg386Nsm}
         {$O ag386nsm}
         {$O ag386nsm}
+{$endif}
   {$endif}
   {$endif}
   {$ifdef m68k}
   {$ifdef m68k}
         {$O opts68k}
         {$O opts68k}
@@ -392,7 +399,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.20  1998-07-14 14:46:55  peter
+  Revision 1.21  1998-07-18 17:11:12  florian
+    + ansi string constants fixed
+    + switch $H partial implemented
+
+  Revision 1.20  1998/07/14 14:46:55  peter
     * released NEWINPUT
     * released NEWINPUT
 
 
   Revision 1.19  1998/07/07 11:20:04  peter
   Revision 1.19  1998/07/07 11:20:04  peter

+ 6 - 2
compiler/switches.pas

@@ -71,7 +71,7 @@ const
    {E} (typesw:programglobal; setsw:cs_fp_emulation; proc:nil),
    {E} (typesw:programglobal; setsw:cs_fp_emulation; proc:nil),
    {F} (typesw:unsupported; setsw:cs_none; proc:nil),
    {F} (typesw:unsupported; setsw:cs_none; proc:nil),
    {G} (typesw:unsupported; setsw:cs_none; proc:nil),
    {G} (typesw:unsupported; setsw:cs_none; proc:nil),
-   {H} (typesw:unsupported; setsw:cs_none; proc:nil),
+   {H} (typesw:local; setsw:cs_ansistrings; proc:nil),
    {I} (typesw:local; setsw:cs_iocheck; proc:nil),
    {I} (typesw:local; setsw:cs_iocheck; proc:nil),
    {J} (typesw:illegal; setsw:cs_none; proc:nil),
    {J} (typesw:illegal; setsw:cs_none; proc:nil),
    {K} (typesw:unsupported; setsw:cs_none; proc:nil),
    {K} (typesw:unsupported; setsw:cs_none; proc:nil),
@@ -161,7 +161,11 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.5  1998-06-04 23:52:00  peter
+  Revision 1.6  1998-07-18 17:11:13  florian
+    + ansi string constants fixed
+    + switch $H partial implemented
+
+  Revision 1.5  1998/06/04 23:52:00  peter
     * m68k compiles
     * m68k compiles
     + .def file creation moved to gendef.pas so it could also be used
     + .def file creation moved to gendef.pas so it could also be used
       for win32
       for win32