瀏覽代碼

* unused units removed from uses clause
* some changes for widestrings

florian 25 年之前
父節點
當前提交
b9796f6a7f
共有 79 個文件被更改,包括 1007 次插入1340 次删除
  1. 9 1
      compiler/aasm.pas
  2. 15 3
      compiler/compiler.pas
  3. 7 3
      compiler/export.pas
  4. 5 3
      compiler/gdb.pas
  5. 14 1
      compiler/globtype.pas
  6. 7 3
      compiler/hcgdata.pas
  7. 7 3
      compiler/htypechk.pas
  8. 6 7
      compiler/i386/ag386int.pas
  9. 5 6
      compiler/i386/ag386nsm.pas
  10. 6 2
      compiler/i386/cgai386.pas
  11. 7 3
      compiler/i386/csopt386.pas
  12. 8 4
      compiler/i386/daopt386.pas
  13. 8 4
      compiler/i386/n386add.pas
  14. 7 3
      compiler/i386/n386bas.pas
  15. 7 3
      compiler/i386/n386cal.pas
  16. 8 4
      compiler/i386/n386cnv.pas
  17. 100 66
      compiler/i386/n386con.pas
  18. 8 4
      compiler/i386/n386flw.pas
  19. 12 11
      compiler/i386/n386ic.pas
  20. 9 5
      compiler/i386/n386inl.pas
  21. 8 4
      compiler/i386/n386ld.pas
  22. 9 5
      compiler/i386/n386mat.pas
  23. 8 4
      compiler/i386/n386mem.pas
  24. 9 5
      compiler/i386/n386set.pas
  25. 7 3
      compiler/i386/n386util.pas
  26. 6 2
      compiler/i386/popt386.pas
  27. 6 2
      compiler/i386/ra386.pas
  28. 7 3
      compiler/i386/ra386att.pas
  29. 10 6
      compiler/i386/ra386dir.pas
  30. 7 3
      compiler/i386/ra386int.pas
  31. 6 2
      compiler/i386/rropt386.pas
  32. 7 4
      compiler/i386/tgcpu.pas
  33. 5 2
      compiler/link.pas
  34. 6 2
      compiler/messages.pas
  35. 10 6
      compiler/nadd.pas
  36. 8 15
      compiler/nbas.pas
  37. 9 13
      compiler/ncal.pas
  38. 8 4
      compiler/ncnv.pas
  39. 35 7
      compiler/ncon.pas
  40. 10 472
      compiler/new/cgbase.pas
  41. 8 12
      compiler/nflw.pas
  42. 8 11
      compiler/ninl.pas
  43. 9 11
      compiler/nld.pas
  44. 8 6
      compiler/nmat.pas
  45. 8 4
      compiler/nmem.pas
  46. 8 3
      compiler/node.inc
  47. 7 4
      compiler/node.pas
  48. 9 14
      compiler/nset.pas
  49. 6 3
      compiler/options.pas
  50. 8 12
      compiler/parser.pas
  51. 9 15
      compiler/pass_1.pas
  52. 9 15
      compiler/pass_2.pas
  53. 10 16
      compiler/pdecl.pas
  54. 7 3
      compiler/pdecobj.pas
  55. 7 6
      compiler/pdecsub.pas
  56. 10 18
      compiler/pdecvar.pas
  57. 11 9
      compiler/pexports.pas
  58. 18 9
      compiler/pexpr.pas
  59. 8 4
      compiler/pmodules.pas
  60. 25 10
      compiler/pp.pas
  61. 13 16
      compiler/pstatmnt.pas
  62. 13 10
      compiler/psub.pas
  63. 7 3
      compiler/psystem.pas
  64. 10 8
      compiler/ptconst.pas
  65. 9 18
      compiler/ptype.pas
  66. 7 3
      compiler/rautils.pas
  67. 8 11
      compiler/regvars.pas
  68. 55 12
      compiler/scanner.pas
  69. 8 1
      compiler/symdef.pas
  70. 7 5
      compiler/symppu.pas
  71. 5 3
      compiler/symtable.pas
  72. 8 4
      compiler/symtype.pas
  73. 7 3
      compiler/t_nwm.pas
  74. 7 11
      compiler/temp_gen.pas
  75. 0 339
      compiler/tgen68k.pas
  76. 9 1
      compiler/tokens.pas
  77. 7 3
      compiler/verbose.pas
  78. 11 1
      compiler/version.pas
  79. 187 0
      compiler/widestr.pas

+ 9 - 1
compiler/aasm.pas

@@ -69,6 +69,10 @@ interface
 {$ifdef m68k}
           ait_labeled_instruction,
 {$endif m68k}
+{$ifdef ia64}
+          ait_bundle,
+          ait_stop,
+{$endif ia64}
           { never used, makes insertation of new ait_ easier to type }
           { lazy guy !!!! ;-) (FK) }
           ait_dummy);
@@ -1180,7 +1184,11 @@ uses
 end.
 {
   $Log$
-  Revision 1.13  2000-09-24 15:06:10  peter
+  Revision 1.14  2000-11-29 00:30:30  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.13  2000/09/24 15:06:10  peter
     * use defines.inc
 
   Revision 1.12  2000/08/27 20:19:38  peter

+ 15 - 3
compiler/compiler.pas

@@ -57,8 +57,16 @@ unit compiler;
    {$endif}
    {$endif}
 
+   {$ifdef ia64}
    {$ifndef CPUOK}
-   {$fatal One of the switches I386, Alpha, PowerPC or M68K must be defined}
+   {$DEFINE CPUOK}
+   {$else}
+     {$fatal cannot define two CPU switches}
+   {$endif}
+   {$endif}
+
+   {$ifndef CPUOK}
+   {$fatal One of the switches I386, iA64, Alpha, PowerPC or M68K must be defined}
    {$endif}
 
    {$ifdef support_mmx}
@@ -310,7 +318,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.10  2000-10-31 22:02:46  peter
+  Revision 1.11  2000-11-29 00:30:30  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.10  2000/10/31 22:02:46  peter
     * symtable splitted, no real code changes
 
   Revision 1.9  2000/10/15 09:39:36  peter
@@ -340,4 +352,4 @@ end.
 
   Revision 1.2  2000/07/13 11:32:38  michael
   + removed logs
-}
+}

+ 7 - 3
compiler/export.pas

@@ -71,7 +71,7 @@ procedure DoneExport;
 implementation
 
 uses
-  systems,verbose,globals,fmodule
+  systems,verbose,globals
 {$ifdef i386}
   {$ifndef NOTARGETLINUX}
     ,t_linux
@@ -226,7 +226,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.7  2000-10-31 22:02:46  peter
+  Revision 1.8  2000-11-29 00:30:30  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.7  2000/10/31 22:02:46  peter
     * symtable splitted, no real code changes
 
   Revision 1.6  2000/09/24 15:06:16  peter
@@ -246,4 +250,4 @@ end.
   Revision 1.2  2000/07/13 11:32:41  michael
   + removed logs
 
-}
+}

+ 5 - 3
compiler/gdb.pas

@@ -107,8 +107,6 @@ Const
 
   implementation
 
-  uses
-    verbose;
 { to use N_EXCL we have to count the character in the stabs for
 N_BINCL to N_EINCL
   Code comes from stabs.c for ld
@@ -258,7 +256,11 @@ end.
 
 {
   $Log$
-  Revision 1.3  2000-09-24 15:06:16  peter
+  Revision 1.4  2000-11-29 00:30:30  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.3  2000/09/24 15:06:16  peter
     * use defines.inc
 
   Revision 1.2  2000/07/13 11:32:41  michael

+ 14 - 1
compiler/globtype.pas

@@ -58,6 +58,15 @@ interface
        ts80real = extended;
        ts64comp = comp;
 {$endif powerpc}
+{$ifdef ia64}
+       bestreal = extended;
+       ts32real = single;
+       ts64real = double;
+       ts80real = extended;
+       { on the ia64 comp will be mapped to int64 }
+       ts64comp = comp;
+{$endif}
+
        pbestreal=^bestreal;
 
        { Switches which can be changed locally }
@@ -210,7 +219,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.9  2000-11-12 22:20:37  peter
+  Revision 1.10  2000-11-29 00:30:30  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.9  2000/11/12 22:20:37  peter
     * create generic toutputsection for binary writers
 
   Revision 1.8  2000/11/04 14:25:19  florian

+ 7 - 3
compiler/hcgdata.pas

@@ -58,7 +58,7 @@ implementation
        cutils,cobjects,
        globtype,globals,verbose,
        symtable,symconst,symtype,symsym,types,
-       hcodegen, systems,fmodule
+       systems
 {$ifdef i386}
        ,n386ic
 {$endif}
@@ -1071,7 +1071,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.15  2000-11-19 16:23:35  florian
+  Revision 1.16  2000-11-29 00:30:30  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.15  2000/11/19 16:23:35  florian
   *** empty log message ***
 
   Revision 1.14  2000/11/12 23:24:10  florian
@@ -1115,4 +1119,4 @@ end.
   Revision 1.2  2000/07/13 11:32:41  michael
   + removed logs
 
-}
+}

+ 7 - 3
compiler/htypechk.pas

@@ -123,7 +123,7 @@ implementation
 
     uses
        globtype,systems,
-       cutils,cobjects,verbose,globals,
+       cutils,verbose,globals,
        symconst,symsym,symtable,
        types,pass_1,cpubase,
        ncnv,nld,
@@ -900,7 +900,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  2000-11-28 17:14:33  jonas
+  Revision 1.19  2000-11-29 00:30:31  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.18  2000/11/28 17:14:33  jonas
     * fixed crash when trying to use an overloaded operator which is nowhere
       defined
 
@@ -957,4 +961,4 @@ end.
 
   Revision 1.2  2000/07/13 11:32:41  michael
   + removed logs
-}
+}

+ 6 - 7
compiler/i386/ag386int.pas

@@ -41,14 +41,9 @@ interface
     uses
 {$ifdef delphi}
       sysutils,
-{$else}
-      strings,
 {$endif}
       cutils,globtype,globals,systems,cobjects,
-      fmodule,finput,verbose,cpubase,cpuasm
-{$ifdef GDB}
-      ,gdb
-{$endif GDB}
+      verbose,cpubase,cpuasm
       ;
 
     const
@@ -642,7 +637,11 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.1  2000-10-15 09:47:42  peter
+  Revision 1.2  2000-11-29 00:30:43  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.1  2000/10/15 09:47:42  peter
     * moved to i386/
 
   Revision 1.6  2000/09/24 15:06:10  peter

+ 5 - 6
compiler/i386/ag386nsm.pas

@@ -42,14 +42,9 @@ interface
     uses
 {$ifdef delphi}
       sysutils,
-{$else}
-      strings,
 {$endif}
       cutils,globtype,globals,systems,cobjects,
       fmodule,finput,verbose,cpubase,cpuasm
-{$ifdef GDB}
-      ,gdb
-{$endif GDB}
       ;
 
     const
@@ -772,7 +767,11 @@ interface
 end.
 {
   $Log$
-  Revision 1.1  2000-10-15 09:47:42  peter
+  Revision 1.2  2000-11-29 00:30:43  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.1  2000/10/15 09:47:42  peter
     * moved to i386/
 
   Revision 1.6  2000/09/24 15:06:11  peter

+ 6 - 2
compiler/i386/cgai386.pas

@@ -163,7 +163,7 @@ implementation
        globtype,systems,globals,verbose,
        fmodule,
        symbase,symsym,symtable,types,
-       tgeni386,temp_gen,hcodegen,regvars
+       tgcpu,temp_gen,hcodegen,regvars
 {$ifdef GDB}
        ,gdb
 {$endif}
@@ -2949,7 +2949,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.13  2000-11-28 00:28:07  pierre
+  Revision 1.14  2000-11-29 00:30:43  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.13  2000/11/28 00:28:07  pierre
    * stabs fixing
 
   Revision 1.12  2000/11/22 15:12:06  jonas

+ 7 - 3
compiler/i386/csopt386.pas

@@ -41,7 +41,7 @@ Implementation
 
 Uses
   {$ifdef replaceregdebug}cutils,{$endif}
-  globtype, verbose, hcodegen, globals, daopt386, tgeni386, rropt386;
+  globtype, verbose, hcodegen, globals, daopt386, tgcpu, rropt386;
 
 {
 Function PaiInSequence(P: Pai; Const Seq: TContent): Boolean;
@@ -337,7 +337,7 @@ var
 Var hp2, hp3{, EndMod},highPrev, orgPrev: Pai;
     {Cnt,} OldNrOfMods: Longint;
     startRegInfo, OrgRegInfo, HighRegInfo: TRegInfo;
-    regModified: array[R_NO..R_EDI] of boolean; 
+    regModified: array[R_NO..R_EDI] of boolean;
     HighFound, OrgRegFound: Byte;
     RegCounter, regCounter2, tmpreg, base, index: TRegister;
     OrgRegResult: Boolean;
@@ -1701,7 +1701,11 @@ End.
 
 {
   $Log$
-  Revision 1.7  2000-11-28 16:32:11  jonas
+  Revision 1.8  2000-11-29 00:30:43  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.7  2000/11/28 16:32:11  jonas
     + support for optimizing simple sequences with div/idiv/mul opcodes
 
   Revision 1.6  2000/11/14 12:17:34  jonas

+ 8 - 4
compiler/i386/daopt386.pas

@@ -220,7 +220,7 @@ Var
 Implementation
 
 Uses
-  globals, systems, verbose, hcodegen, symconst, tgeni386;
+  globals, systems, verbose, hcodegen, symconst, tgcpu;
 
 Type
   TRefCompare = function(const r1, r2: TReference): Boolean;
@@ -1181,7 +1181,7 @@ Begin
     begin
       hp := new(paiRegalloc,alloc(reg));
       insertLLItem(asmL,start^.previous,start,hp);
-    end;     
+    end;
 End;
 
 function FindRegDealloc(reg: tregister; p: pai): boolean;
@@ -2447,7 +2447,11 @@ End.
 
 {
   $Log$
-  Revision 1.10  2000-11-28 16:32:11  jonas
+  Revision 1.11  2000-11-29 00:30:44  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.10  2000/11/28 16:32:11  jonas
     + support for optimizing simple sequences with div/idiv/mul opcodes
 
   Revision 1.9  2000/11/23 14:20:18  jonas
@@ -2561,4 +2565,4 @@ End.
   Revision 1.2  2000/07/13 11:32:40  michael
   + removed logs
 
-}
+}

+ 8 - 4
compiler/i386/n386add.pas

@@ -43,11 +43,11 @@ interface
     uses
       globtype,systems,
       cutils,cobjects,verbose,globals,
-      symconst,symdef,symtable,aasm,types,
+      symconst,symdef,aasm,types,
       hcodegen,temp_gen,pass_2,
       cpuasm,
       node,ncon,nset,
-      cgai386,n386util,tgeni386;
+      cgai386,n386util,tgcpu;
 
     function ti386addnode.getresflags(unsigned : boolean) : tresflags;
 
@@ -2288,7 +2288,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  2000-11-13 11:30:56  florian
+  Revision 1.5  2000-11-29 00:30:45  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.4  2000/11/13 11:30:56  florian
     * some bugs with interfaces and NIL fixed
 
   Revision 1.3  2000/11/04 14:25:23  florian
@@ -2320,4 +2324,4 @@ end.
 
   Revision 1.1  2000/09/20 21:23:32  florian
     * initial revision
-}
+}

+ 7 - 3
compiler/i386/n386bas.pas

@@ -48,7 +48,7 @@ unit n386bas;
        globals,
        aasm,cpubase,cpuasm,
        symconst,symsym,
-       pass_2,tgeni386,
+       pass_2,tgcpu,
        cgai386;
 
     procedure ti386asmnode.pass_2;
@@ -204,7 +204,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.3  2000-11-04 14:25:23  florian
+  Revision 1.4  2000-11-29 00:30:46  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.3  2000/11/04 14:25:23  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.2  2000/10/31 22:02:56  peter
@@ -216,4 +220,4 @@ end.
   Revision 1.1  2000/10/14 10:14:48  peter
     * moehrendorf oct 2000 rewrite
 
-}
+}

+ 7 - 3
compiler/i386/n386cal.pas

@@ -63,7 +63,7 @@ implementation
       hcodegen,temp_gen,pass_2,
       cpubase,cpuasm,
       nmem,nld,
-      cgai386,tgeni386,n386ld,n386util;
+      cgai386,tgcpu,n386ld,n386util;
 
 {*****************************************************************************
                              TI386CALLPARANODE
@@ -1589,7 +1589,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.10  2000-11-23 13:26:34  jonas
+  Revision 1.11  2000-11-29 00:30:46  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.10  2000/11/23 13:26:34  jonas
     * fix for webbug 1066/1126
 
   Revision 1.9  2000/11/22 15:12:06  jonas
@@ -1625,4 +1629,4 @@ end.
   Revision 1.1  2000/10/10 17:31:56  florian
     * initial revision
 
-}
+}

+ 8 - 4
compiler/i386/n386cnv.pas

@@ -68,12 +68,12 @@ interface
 implementation
 
    uses
-      cobjects,verbose,globtype,globals,systems,
+      verbose,globals,systems,
       symconst,symdef,aasm,
-      hcodegen,temp_gen,pass_2,pass_1,
+      hcodegen,temp_gen,pass_2,
       ncon,ncal,
       cpubase,cpuasm,
-      cgai386,tgeni386,n386util;
+      cgai386,tgcpu,n386util;
 
 
 {*****************************************************************************
@@ -1483,7 +1483,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.7  2000-11-16 15:27:48  jonas
+  Revision 1.8  2000-11-29 00:30:46  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.7  2000/11/16 15:27:48  jonas
     * fixed web bug 1242
 
   Revision 1.6  2000/11/13 11:30:56  florian

+ 100 - 66
compiler/i386/n386con.pas

@@ -62,12 +62,12 @@ interface
 implementation
 
     uses
-      globtype,systems,
-      cobjects,verbose,globals,
+      globtype,widestr,systems,
+      verbose,globals,
       symconst,symdef,aasm,types,
-      hcodegen,temp_gen,pass_2,
-      cpubase,cpuasm,
-      cgai386,tgeni386;
+      temp_gen,
+      cpubase,
+      cgai386,tgcpu;
 
 {*****************************************************************************
                            TI386REALCONSTNODE
@@ -242,69 +242,73 @@ implementation
          if not assigned(lab_str) then
            begin
               if is_shortstring(resulttype) then
-               mylength:=len+2
+                mylength:=len+2
               else
-               mylength:=len+1;
-              { tries to found an old entry }
-              hp1:=pai(consts^.first);
-              while assigned(hp1) do
+                mylength:=len+1;
+              { widestrings can't be reused yet }
+              if not(is_widestring(resulttype)) then
                 begin
-                   if hp1^.typ=ait_label then
-                     lastlabel:=pai_label(hp1)^.l
-                   else
-                     begin
-                        { when changing that code, be careful that }
-                        { you don't use typed consts, which are    }
-                        { are also written to consts           }
-                        { currently, this is no problem, because   }
-                        { typed consts have no leading length or   }
-                        { they have no trailing zero           }
-                        if (hp1^.typ=ait_string) and (lastlabel<>nil) and
-                           (pai_string(hp1)^.len=mylength) then
-                          begin
-                             same_string:=true;
-                             { if shortstring then check the length byte first and
-                               set the start index to 1 }
-                             if is_shortstring(resulttype) then
-                              begin
-                                if len<>ord(pai_string(hp1)^.str[0]) then
-                                 same_string:=false;
-                                j:=1;
-                              end
-                             else
-                              j:=0;
-                             { don't check if the length byte was already wrong }
-                             if same_string then
-                              begin
-                                for i:=0 to len do
-                                 begin
-                                   if pai_string(hp1)^.str[j]<>value_str[i] then
-                                    begin
-                                      same_string:=false;
-                                      break;
-                                    end;
-                                   inc(j);
-                                 end;
-                              end;
-                             { found ? }
-                             if same_string then
+                  { tries to found an old entry }
+                  hp1:=pai(consts^.first);
+                  while assigned(hp1) do
+                    begin
+                       if hp1^.typ=ait_label then
+                         lastlabel:=pai_label(hp1)^.l
+                       else
+                         begin
+                            { when changing that code, be careful that }
+                            { you don't use typed consts, which are    }
+                            { are also written to consts           }
+                            { currently, this is no problem, because   }
+                            { typed consts have no leading length or   }
+                            { they have no trailing zero           }
+                            if (hp1^.typ=ait_string) and (lastlabel<>nil) and
+                               (pai_string(hp1)^.len=mylength) then
                               begin
-                                lab_str:=lastlabel;
-                                { create a new entry for ansistrings, but reuse the data }
-                                if (stringtype in [st_ansistring,st_widestring]) then
-                                 begin
-                                   getdatalabel(l2);
-                                   consts^.concat(new(pai_label,init(l2)));
-                                   consts^.concat(new(pai_const_symbol,init(lab_str)));
-                                   { return the offset of the real string }
-                                   lab_str:=l2;
-                                 end;
-                                break;
+                                 same_string:=true;
+                                 { if shortstring then check the length byte first and
+                                   set the start index to 1 }
+                                 if is_shortstring(resulttype) then
+                                  begin
+                                    if len<>ord(pai_string(hp1)^.str[0]) then
+                                     same_string:=false;
+                                    j:=1;
+                                  end
+                                 else
+                                  j:=0;
+                                 { don't check if the length byte was already wrong }
+                                 if same_string then
+                                  begin
+                                    for i:=0 to len do
+                                     begin
+                                       if pai_string(hp1)^.str[j]<>value_str[i] then
+                                        begin
+                                          same_string:=false;
+                                          break;
+                                        end;
+                                       inc(j);
+                                     end;
+                                  end;
+                                 { found ? }
+                                 if same_string then
+                                  begin
+                                    lab_str:=lastlabel;
+                                    { create a new entry for ansistrings, but reuse the data }
+                                    if (stringtype in [st_ansistring,st_widestring]) then
+                                     begin
+                                       getdatalabel(l2);
+                                       consts^.concat(new(pai_label,init(l2)));
+                                       consts^.concat(new(pai_const_symbol,init(lab_str)));
+                                       { return the offset of the real string }
+                                       lab_str:=l2;
+                                     end;
+                                    break;
+                                  end;
                               end;
-                          end;
-                        lastlabel:=nil;
-                     end;
-                   hp1:=pai(hp1^.next);
+                            lastlabel:=nil;
+                         end;
+                       hp1:=pai(hp1^.next);
+                    end;
                 end;
               { :-(, we must generate a new entry }
               if not assigned(lab_str) then
@@ -341,6 +345,32 @@ implementation
                                 lab_str:=l2;
                              end;
                         end;
+                      st_widestring:
+                        begin
+                           { an empty wide string is nil! }
+                           if len=0 then
+                             consts^.concat(new(pai_const,init_32bit(0)))
+                           else
+                             begin
+                                getdatalabel(l1);
+                                getdatalabel(l2);
+                                consts^.concat(new(pai_label,init(l2)));
+                                consts^.concat(new(pai_const_symbol,init(l1)));
+
+                                { we use always UTF-16 coding for constants }
+                                { at least for now                          }
+                                consts^.concat(new(pai_const,init_8bit(2)));
+                                consts^.concat(new(pai_const,init_32bit(len)));
+                                consts^.concat(new(pai_const,init_32bit(len)));
+                                consts^.concat(new(pai_const,init_32bit(-1)));
+                                consts^.concat(new(pai_label,init(l1)));
+                                for i:=0 to len-1 do
+                                  consts^.concat(new(pai_const,init_16bit(
+                                    pcompilerwidestring(value_str)^.data[i])));
+                                { return the offset of the real string }
+                                lab_str:=l2;
+                             end;
+                        end;
                       st_shortstring:
                         begin
                           { truncate strings larger than 255 chars }
@@ -488,7 +518,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  2000-11-20 15:31:38  jonas
+  Revision 1.5  2000-11-29 00:30:47  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.4  2000/11/20 15:31:38  jonas
   *  longint typecast to assignment of constant to offset field
 
   Revision 1.3  2000/11/13 14:44:36  jonas
@@ -505,4 +539,4 @@ end.
 
   Revision 1.1  2000/09/28 20:48:52  florian
   *** empty log message ***
-}
+}

+ 8 - 4
compiler/i386/n386flw.pas

@@ -85,12 +85,12 @@ interface
 implementation
 
     uses
-      cobjects,verbose,globtype,globals,systems,
+      verbose,globtype,globals,systems,
       symconst,symdef,symsym,aasm,types,
       hcodegen,temp_gen,pass_2,
       cpubase,cpuasm,
       pass_1,nld,ncon,
-      cgai386,tgeni386,n386util;
+      cgai386,tgcpu,n386util;
 
 {*****************************************************************************
                          Second_While_RepeatN
@@ -1284,7 +1284,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.2  2000-10-31 22:02:56  peter
+  Revision 1.3  2000-11-29 00:30:47  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.2  2000/10/31 22:02:56  peter
     * symtable splitted, no real code changes
 
   Revision 1.1  2000/10/15 09:33:31  peter
@@ -1293,4 +1297,4 @@ end.
   Revision 1.1  2000/10/14 10:14:48  peter
     * moehrendorf oct 2000 rewrite
 
-}
+}

+ 12 - 11
compiler/i386/n386ic.pas

@@ -33,15 +33,12 @@ procedure cgintfwrapper(asmlist: paasmoutput; procdef: pprocdef; const labelname
 implementation
 
 uses
-  globtype, systems,
-  cobjects, verbose, globals,
-  symconst, types,
-{$ifdef GDB}
-  strings, gdb,
-{$endif GDB}
-  hcodegen, temp_gen,
-  cpubase, cpuasm,
-  cgai386, tgeni386;
+  systems,
+  verbose, globals,
+  symconst,
+  temp_gen,
+  cpubase,
+  cgai386, tgcpu;
 
 {
 possible calling conventions:
@@ -205,7 +202,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.2  2000-11-12 23:24:15  florian
+  Revision 1.3  2000-11-29 00:30:47  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.2  2000/11/12 23:24:15  florian
     * interfaces are basically running
 
   Revision 1.1  2000/11/04 14:25:23  florian
@@ -216,4 +217,4 @@ end.
 
   Revision 1.1.2.1  2000/06/15 06:26:34  kaz
     * Initial version
-}
+}

+ 9 - 5
compiler/i386/n386inl.pas

@@ -38,12 +38,12 @@ implementation
 
     uses
       globtype,systems,
-      cutils,cobjects,verbose,globals,fmodule,
+      cutils,verbose,globals,fmodule,
       symconst,symbase,symtype,symdef,symsym,aasm,types,
       hcodegen,temp_gen,pass_1,pass_2,
-      cpubase,cpuasm,
+      cpubase,
       nbas,ncon,ncal,ncnv,nld,
-      cgai386,tgeni386,n386util;
+      cgai386,tgcpu,n386util;
 
 
 {*****************************************************************************
@@ -1429,7 +1429,7 @@ implementation
                     end
                   else secondpass(tcallparanode(hp).left);
                   if is_dynamic_array(def) then
-                    begin                       
+                    begin
                        emitpushreferenceaddr(hr2);
                        push_int(l);
                        reset_reference(hr2);
@@ -1665,7 +1665,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.6  2000-11-12 23:24:15  florian
+  Revision 1.7  2000-11-29 00:30:47  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.6  2000/11/12 23:24:15  florian
     * interfaces are basically running
 
   Revision 1.5  2000/11/09 17:46:56  florian

+ 8 - 4
compiler/i386/n386ld.pas

@@ -49,13 +49,13 @@ interface
 implementation
 
     uses
-      globtype,systems,
-      cobjects,verbose,globals,fmodule,
+      systems,
+      verbose,globals,
       symconst,symtype,symdef,symsym,symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
       nmem,ncon,ncnv,
       cpubase,cpuasm,
-      cgai386,tgeni386,n386cnv,n386util,cresstr;
+      cgai386,tgcpu,n386cnv,n386util;
 
 {*****************************************************************************
                              SecondLoad
@@ -1050,7 +1050,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  2000-11-13 14:44:36  jonas
+  Revision 1.9  2000-11-29 00:30:48  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.8  2000/11/13 14:44:36  jonas
     * fixes so no more range errors with improved range checking code
 
   Revision 1.7  2000/11/12 23:24:15  florian

+ 9 - 5
compiler/i386/n386mat.pas

@@ -50,12 +50,12 @@ implementation
 
     uses
       globtype,systems,
-      cutils,cobjects,verbose,globals,
+      cutils,verbose,globals,
       symconst,symdef,aasm,types,
       hcodegen,temp_gen,pass_2,
       ncon,
-      cpubase,cpuasm,
-      cgai386,tgeni386,n386util;
+      cpubase,
+      cgai386,tgcpu,n386util;
 
 {*****************************************************************************
                              TI386MODDIVNODE
@@ -995,7 +995,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.6  2000-11-20 14:05:50  jonas
+  Revision 1.7  2000-11-29 00:30:48  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.6  2000/11/20 14:05:50  jonas
     * fixed bug in my changes to fix the regalloc info for div/mod ("merged")
 
   Revision 1.5  2000/10/31 22:02:56  peter
@@ -1023,4 +1027,4 @@ end.
   Revision 1.1  2000/09/22 22:24:37  florian
     * initial revision
 
-}
+}

+ 8 - 4
compiler/i386/n386mem.pas

@@ -90,12 +90,12 @@ implementation
       gdb,
 {$endif GDB}
       globtype,systems,
-      cutils,cobjects,verbose,globals,
+      cutils,verbose,globals,
       symconst,symbase,symdef,symsym,symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
       pass_1,nld,ncon,nadd,
       cpubase,cpuasm,
-      cgai386,tgeni386,n386util;
+      cgai386,tgcpu,n386util;
 
 {*****************************************************************************
                             TI386LOADNODE
@@ -1053,7 +1053,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.5  2000-11-04 14:25:24  florian
+  Revision 1.6  2000-11-29 00:30:48  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.5  2000/11/04 14:25:24  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.4  2000/10/31 22:02:57  peter
@@ -1079,4 +1083,4 @@ end.
   Revision 1.1  2000/10/14 10:14:49  peter
     * moehrendorf oct 2000 rewrite
 
-}
+}

+ 9 - 5
compiler/i386/n386set.pas

@@ -45,12 +45,12 @@ implementation
 
     uses
       globtype,systems,cpuinfo,
-      cobjects,verbose,globals,
+      verbose,globals,
       symconst,symdef,aasm,types,
       hcodegen,temp_gen,pass_2,
       ncon,
-      cpubase,cpuasm,
-      cgai386,tgeni386,n386util;
+      cpubase,
+      cgai386,tgcpu,n386util;
 
      const
        bytes2Sxx:array[1..8] of Topsize=(S_B,S_W,S_NO,S_L,S_NO,S_NO,S_NO,S_Q);
@@ -1067,7 +1067,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.5  2000-11-17 14:09:00  jonas
+  Revision 1.6  2000-11-29 00:30:49  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.5  2000/11/17 14:09:00  jonas
     * fixed webbug 1222 ("merged")
 
   Revision 1.4  2000/11/13 14:44:36  jonas
@@ -1095,4 +1099,4 @@ end.
   Revision 1.1  2000/09/24 19:38:39  florian
     * initial implementation
 
-}
+}

+ 7 - 3
compiler/i386/n386util.pas

@@ -63,7 +63,7 @@ implementation
        types,
        ncon,nld,
        pass_1,pass_2,
-       hcodegen,tgeni386,temp_gen,
+       hcodegen,tgcpu,temp_gen,
        cgai386;
 
 
@@ -1472,7 +1472,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.4  2000-11-13 14:47:46  jonas
+  Revision 1.5  2000-11-29 00:30:49  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.4  2000/11/13 14:47:46  jonas
     * support for range checking when converting from 64bit to something
       smaller (32bit, 16bit, 8bit)
     * fixed range checking between longint/cardinal and for array indexing
@@ -1496,4 +1500,4 @@ end.
   Revision 1.1  2000/10/01 19:58:40  peter
     * new file
 
-}
+}

+ 6 - 2
compiler/i386/popt386.pas

@@ -41,7 +41,7 @@ Uses
 {$ifdef finaldestdebug}
   cobjects,
 {$endif finaldestdebug}
-  cpubase,cpuasm,DAOpt386,tgeni386;
+  cpubase,cpuasm,DAOpt386,tgcpu;
 
 Function RegUsedAfterInstruction(Reg: TRegister; p: Pai; Var UsedRegs: TRegSet): Boolean;
 Begin
@@ -2000,7 +2000,11 @@ End.
 
 {
   $Log$
-  Revision 1.3  2000-11-14 09:53:18  jonas
+  Revision 1.4  2000-11-29 00:30:49  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.3  2000/11/14 09:53:18  jonas
     * added missing allocregbetween() (merged)
 
   Revision 1.2  2000/10/24 10:40:54  jonas

+ 6 - 2
compiler/i386/ra386.pas

@@ -63,7 +63,7 @@ uses
 {$else}
   hcodegen,
 {$endif}
-  globtype,symconst,symdef,symtable,systems,types,globals,verbose,cpuasm;
+  globtype,symconst,symdef,systems,types,globals,verbose,cpuasm;
 
 
 {*****************************************************************************
@@ -514,7 +514,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.2  2000-10-31 22:30:14  peter
+  Revision 1.3  2000-11-29 00:30:50  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.2  2000/10/31 22:30:14  peter
     * merged asm result patch part 2
 
   Revision 1.1  2000/10/15 09:47:43  peter

+ 7 - 3
compiler/i386/ra386att.pas

@@ -39,7 +39,7 @@ Implementation
        cutils,cobjects,
        { global }
        globtype,globals,verbose,
-       systems,cpuinfo,
+       systems,
        { aasm }
        cpubase,aasm,
        { symtable }
@@ -2114,7 +2114,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.2  2000-10-31 22:02:57  peter
+  Revision 1.3  2000-11-29 00:30:50  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.2  2000/10/31 22:02:57  peter
     * symtable splitted, no real code changes
 
   Revision 1.1  2000/10/15 09:47:43  peter
@@ -2136,4 +2140,4 @@ end.
   Revision 1.2  2000/07/13 11:32:48  michael
   + removed logs
 
-}
+}

+ 10 - 6
compiler/i386/ra386dir.pas

@@ -35,10 +35,10 @@ interface
 
     uses
        { common }
-       cutils,cobjects,
+       cutils,
        { global }
-       globtype,globals,verbose,
-       systems,cpuinfo,
+       globals,verbose,
+       systems,
        { aasm }
        cpubase,aasm,
        { symtable }
@@ -47,7 +47,7 @@ interface
        nbas,
        { parser }
        scanner,
-       ra386,rautils,
+       ra386,
        { codegen }
 {$ifdef newcg}
        cgbase
@@ -288,7 +288,11 @@ interface
 end.
 {
   $Log$
-  Revision 1.2  2000-10-31 22:02:57  peter
+  Revision 1.3  2000-11-29 00:30:50  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.2  2000/10/31 22:02:57  peter
     * symtable splitted, no real code changes
 
   Revision 1.1  2000/10/15 09:47:43  peter
@@ -307,4 +311,4 @@ end.
   Revision 1.2  2000/07/13 11:32:48  michael
   + removed logs
 
-}
+}

+ 7 - 3
compiler/i386/ra386int.pas

@@ -39,7 +39,7 @@ Implementation
        cutils,cobjects,
        { global }
        globtype,globals,verbose,
-       systems,cpuinfo,
+       systems,
        { aasm }
        cpubase,aasm,
        { symtable }
@@ -1916,7 +1916,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.2  2000-10-31 22:02:57  peter
+  Revision 1.3  2000-11-29 00:30:51  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.2  2000/10/31 22:02:57  peter
     * symtable splitted, no real code changes
 
   Revision 1.1  2000/10/15 09:47:43  peter
@@ -1944,4 +1948,4 @@ end.
   Revision 1.2  2000/07/13 11:32:48  michael
   + removed logs
 
-}
+}

+ 6 - 2
compiler/i386/rropt386.pas

@@ -35,7 +35,7 @@ Implementation
 
 Uses
   {$ifdef replaceregdebug}cutils,{$endif}
-  verbose,globals,cpubase,cpuasm,daopt386,csopt386,tgeni386;
+  verbose,globals,cpubase,cpuasm,daopt386,csopt386,tgcpu;
 
 function canBeFirstSwitch(p: paicpu; reg: tregister): boolean;
 { checks whether an operation on reg can be switched to another reg without an }
@@ -334,7 +334,11 @@ End.
 
 {
   $Log$
-  Revision 1.2  2000-11-22 16:30:04  jonas
+  Revision 1.3  2000-11-29 00:30:51  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.2  2000/11/22 16:30:04  jonas
     * fixed bug where "imul mem32,reg,reg" could be generated
 
   Revision 1.1  2000/10/24 10:40:54  jonas

+ 7 - 4
compiler/tgeni386.pas → compiler/i386/tgcpu.pas

@@ -20,7 +20,7 @@
 
  ****************************************************************************
 }
-unit tgeni386;
+unit tgcpu;
 
 {$i defines.inc}
 
@@ -653,7 +653,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.9  2000-10-31 22:30:13  peter
+  Revision 1.1  2000-11-29 00:30:51  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.9  2000/10/31 22:30:13  peter
     * merged asm result patch part 2
 
   Revision 1.8  2000/10/14 10:14:56  peter
@@ -677,5 +681,4 @@ end.
 
   Revision 1.2  2000/07/13 11:32:52  michael
   + removed logs
-
-}
+}

+ 5 - 2
compiler/link.pas

@@ -123,7 +123,6 @@ uses
     ,t_linux
   {$endif}
 {$endif}
-  ,gendef
   ;
 
 {*****************************************************************************
@@ -541,7 +540,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.9  2000-09-24 21:33:46  peter
+  Revision 1.10  2000-11-29 00:30:31  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.9  2000/09/24 21:33:46  peter
     * message updates merges
 
   Revision 1.8  2000/09/24 15:06:18  peter

+ 6 - 2
compiler/messages.pas

@@ -66,7 +66,7 @@ function GetMsgLine(var p:pchar):string;
 implementation
 
 uses
-  globals,crc,
+  globals,
 {$ifdef DELPHI}
   sysutils;
 {$else DELPHI}
@@ -448,7 +448,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.4  2000-09-24 21:33:46  peter
+  Revision 1.5  2000-11-29 00:30:31  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.4  2000/09/24 21:33:46  peter
     * message updates merges
 
   Revision 1.3  2000/09/24 15:06:18  peter

+ 10 - 6
compiler/nadd.pas

@@ -45,9 +45,9 @@ interface
 implementation
 
     uses
-      globtype,systems,tokens,
-      cobjects,cutils,verbose,globals,
-      symconst,symtype,symdef,symtable,aasm,types,
+      globtype,systems,
+      cutils,verbose,globals,
+      symconst,symtype,symdef,types,
       cpuinfo,
 {$ifdef newcg}
       cgbase,
@@ -55,7 +55,7 @@ implementation
       hcodegen,
 {$endif newcg}
       htypechk,pass_1,
-      ncal,nmat,ncnv,nld,ncon,nset,
+      nmat,ncnv,nld,ncon,nset,
       cpubase;
 
 
@@ -1237,7 +1237,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.17  2000-11-20 15:30:42  jonas
+  Revision 1.18  2000-11-29 00:30:31  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.17  2000/11/20 15:30:42  jonas
     * changed types of values used for constant expression evaluation to
       tconstexprint
 
@@ -1290,4 +1294,4 @@ end.
 
   Revision 1.1  2000/08/26 12:24:20  florian
     * initial release
-}
+}

+ 8 - 15
compiler/nbas.pas

@@ -73,23 +73,12 @@ implementation
 
     uses
       globtype,systems,
-      cutils,cobjects,verbose,globals,
+      cutils,verbose,globals,
       symtype,symdef,types,
-      htypechk,
-      cpubase,cpuasm,
       pass_1,
-      nflw
+      nflw,tgcpu,hcodegen
 {$ifdef newcg}
       ,cgbase
-      ,tgcpu
-{$else newcg}
-      ,hcodegen
-  {$ifdef i386}
-      ,tgeni386
-  {$endif}
-  {$ifdef m68k}
-      ,tgen68k
-  {$endif}
 {$endif}
       ;
 
@@ -349,7 +338,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  2000-10-31 22:02:47  peter
+  Revision 1.5  2000-11-29 00:30:31  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.4  2000/10/31 22:02:47  peter
     * symtable splitted, no real code changes
 
   Revision 1.3  2000/10/27 14:57:16  jonas
@@ -361,4 +354,4 @@ end.
   Revision 1.1  2000/10/14 10:14:50  peter
     * moehrendorf oct 2000 rewrite
 
-}
+}

+ 9 - 13
compiler/ncal.pas

@@ -101,21 +101,13 @@ interface
 
     uses
       cutils,globtype,systems,
-      cobjects,verbose,globals,
-      symconst,symtype,aasm,types,
+      verbose,globals,
+      symconst,symtype,types,
       htypechk,pass_1,cpubase,
-      ncnv,nld,ninl,nadd,ncon
+      ncnv,nld,ninl,nadd,ncon,hcodegen,
+      tgcpu
 {$ifdef newcg}
       ,cgbase
-      ,tgobj
-{$else newcg}
-      ,hcodegen
-{$ifdef i386}
-      ,tgeni386
-{$endif}
-{$ifdef m68k}
-      ,tgen68k
-{$endif m68k}
 {$endif newcg}
       ;
 
@@ -1542,7 +1534,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.17  2000-11-22 15:12:06  jonas
+  Revision 1.18  2000-11-29 00:30:32  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.17  2000/11/22 15:12:06  jonas
     * fixed inline-related problems (partially "merges")
 
   Revision 1.16  2000/11/11 16:14:52  peter

+ 8 - 4
compiler/ncnv.pas

@@ -87,8 +87,8 @@ implementation
 
    uses
       globtype,systems,tokens,
-      cutils,cobjects,verbose,globals,
-      symconst,symdef,symsym,symtable,aasm,
+      cutils,verbose,globals,
+      symconst,symdef,symsym,symtable,
       ncon,ncal,nset,nadd,
 {$ifdef newcg}
       cgbase,
@@ -1186,7 +1186,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.12  2000-11-20 16:06:04  jonas
+  Revision 1.13  2000-11-29 00:30:32  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.12  2000/11/20 16:06:04  jonas
     + allow evaluation of 64bit constant expressions at compile time
     * disable range checking for explicit typecasts of constant expressions
 
@@ -1222,4 +1226,4 @@ end.
 
   Revision 1.1  2000/09/25 15:37:14  florian
     * more fixes
-}
+}

+ 35 - 7
compiler/ncon.pas

@@ -27,7 +27,7 @@ unit ncon;
 interface
 
     uses
-      globtype,
+      globtype,widestr,
       node,
       aasm,cpuinfo,
       symconst,symtype,symdef,symsym;
@@ -69,6 +69,7 @@ interface
           stringtype : tstringtype;
           constructor createstr(const s : string;st:tstringtype);virtual;
           constructor createpchar(s : pchar;l : longint);virtual;
+          constructor createwstr(const w : tcompilerwidestring);virtual;
           destructor destroy;override;
           function getcopy : tnode;override;
           function pass_1 : tnode;override;
@@ -110,7 +111,7 @@ interface
     function genstringconstnode(const s : string;st:tstringtype) : tstringconstnode;
     { length is required for ansistrings }
     function genpcharconstnode(s : pchar;length : longint) : tstringconstnode;
-
+    function genwstringconstnode(const w : tcompilerwidestring) : tnode;
     function gensetconstnode(s : pconstset;settype : psetdef) : tsetconstnode;
 
     { some helper routines }
@@ -129,8 +130,8 @@ interface
 implementation
 
     uses
-      cutils,cobjects,verbose,globals,systems,
-      types,hcodegen,pass_1,cpubase,nld;
+      cutils,verbose,globals,systems,
+      types,cpubase,nld;
 
     function genordinalconstnode(v : tconstexprint;def : pdef) : tordconstnode;
       begin
@@ -188,6 +189,12 @@ implementation
          genstringconstnode:=cstringconstnode.createstr(s,st);
       end;
 
+    function genwstringconstnode(const w : tcompilerwidestring) : tnode;
+
+      begin
+         genwstringconstnode:=cstringconstnode.createwstr(w);
+      end;
+
 
     function genpcharconstnode(s : pchar;length : longint) : tstringconstnode;
       begin
@@ -480,6 +487,19 @@ implementation
          end;
       end;
 
+    constructor tstringconstnode.createwstr(const w : tcompilerwidestring);
+
+      begin
+         inherited create(stringconstn);
+         len:=getlengthwidestring(w);
+         new(pcompilerwidestring(value_str));
+         initwidestring(pcompilerwidestring(value_str)^);
+         copywidestring(w,pcompilerwidestring(value_str)^);
+         lab_str:=nil;
+         stringtype:=st_widestring;
+         resulttype:=cwidestringdef;
+      end;
+
     constructor tstringconstnode.createpchar(s : pchar;l : longint);
 
       begin
@@ -515,8 +535,12 @@ implementation
          n:=tstringconstnode(inherited getcopy);
          n.stringtype:=stringtype;
          n.len:=len;
-         n.value_str:=getpcharcopy;
          n.lab_str:=lab_str;
+         if stringtype=st_widestring then
+           copywidestring(pcompilerwidestring(value_str)^,
+             pcompilerwidestring(n.value_str)^)
+         else
+           n.value_str:=getpcharcopy;
          getcopy:=n;
       end;
 
@@ -626,7 +650,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.10  2000-10-31 22:02:48  peter
+  Revision 1.11  2000-11-29 00:30:32  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.10  2000/10/31 22:02:48  peter
     * symtable splitted, no real code changes
 
   Revision 1.9  2000/10/14 21:52:55  peter
@@ -656,4 +684,4 @@ end.
   Revision 1.1  2000/09/22 21:44:48  florian
     + initial revision
 
-}
+}

+ 10 - 472
compiler/new/cgbase.pas

@@ -24,26 +24,6 @@ unit cgbase;
 
   interface
 
-    uses
-       globtype,cobjects,aasm,symconst,symtable,verbose,tree,
-       cpuasm,cpubase
-       {$IFDEF NEWST}
-       ,defs,symbols
-       {$ENDIF NEWST};
-
-    const
-       pi_uses_asm  = $1;       { set, if the procedure uses asm }
-       pi_is_global = $2;       { set, if the procedure is exported by an unit }
-       pi_do_call   = $4;       { set, if the procedure does a call }
-       pi_operator  = $8;       { set, if the procedure is an operator   }
-       pi_C_import  = $10;      { set, if the procedure is an external C function }
-       pi_uses_exceptions = $20;{ set, if the procedure has a try statement => }
-                                { no register variables                        }
-       pi_is_assembler = $40;   { set if the procedure is declared as ASSEMBLER
-                                  => don't optimize}
-       pi_needs_implicit_finally = $80; { set, if the procedure contains data which }
-                                        { needs to be finalized              }
-
     type
        TOpCg = (OP_ADD,OP_AND,OP_DIV,OP_IDIV,OP_IMUL,OP_MUL,OP_NEG,OP_NOT,
                    OP_OR,OP_SAR,OP_SHL,OP_SHR,OP_SUB,OP_XOR);
@@ -53,76 +33,6 @@ unit cgbase;
 
        TCgSize = (OS_NO,OS_8,OS_16,OS_32,OS_64);
 
-       pprocinfo = ^tprocinfo;
-       tprocinfo = object
-          { pointer to parent in nested procedures }
-          parent : pprocinfo;
-          { current class, if we are in a method }
-          _class : pobjectdef;
-          { return type }
-       {$IFDEF NEWST}
-          retdef:Pdef;
-       {$ELSE}
-          returntype : ttype;
-       {$ENDIF NEWST}
-          { symbol of the function, and the sym for result variable }
-          resultfuncretsym,
-          funcretsym : pfuncretsym;
-          funcret_state : tvarstate;
-          { the definition of the proc itself }
-          def : pprocdef;
-          sym : pprocsym;
-
-          { frame pointer offset }
-          framepointer_offset : longint;
-          { self pointer offset }
-          selfpointer_offset : longint;
-          { result value offset }
-          return_offset : longint;
-          { firsttemp position }
-          firsttemp_offset : longint;
-          { parameter offset }
-          para_offset : longint;
-
-          { every register which must be saved by the entry code }
-          { (and restored by the exit code) must be in that set  }
-          registerstosave : tregisterset;
-
-          { some collected informations about the procedure }
-          { see pi_xxxx above                               }
-          flags : longint;
-
-          { register used as frame pointer }
-          framepointer : tregister;
-
-          { true, if the procedure is exported by an unit }
-          globalsymbol : boolean;
-
-          { true, if the procedure should be exported (only OS/2) }
-          exported : boolean;
-
-          { true, if we can not use fast exit code }
-          no_fast_exit : boolean;
-
-          { code for the current procedure }
-          aktproccode,aktentrycode,
-          aktexitcode,aktlocaldata : paasmoutput;
-          { local data is used for smartlink }
-
-          constructor init;
-          destructor done;
-       end;
-
-       { some kind of temp. types needs to be destructed }
-       { for example ansistring, this is done using this }
-       { list                                            }
-       ptemptodestroy = ^ttemptodestroy;
-       ttemptodestroy = object(tlinkedlist_item)
-          typ : pdef;
-          address : treference;
-          constructor init(const a : treference;p : pdef);
-       end;
-
     const
        { defines the default address size for a processor }
        { and defines the natural int size for a processor }
@@ -138,394 +48,22 @@ unit cgbase;
        OS_ADDR = OS_32;
        OS_INT = OS_32;
 {$endif powercc}
-
-    var
-       { info about the current sub routine }
-       procinfo : pprocinfo;
-
-       { labels for BREAK and CONTINUE }
-       aktbreaklabel,aktcontinuelabel : pasmlabel;
-
-       { label when the result is true or false }
-       truelabel,falselabel : pasmlabel;
-
-       { label to leave the sub routine }
-       aktexitlabel : pasmlabel;
-
-       { also an exit label, only used we need to clear only the stack }
-       aktexit2label : pasmlabel;
-
-       { only used in constructor for fail or if getmem fails }
-       faillabel,quickexitlabel : pasmlabel;
-
-       { Boolean, wenn eine loadn kein Assembler erzeugt hat }
-       simple_loadn : boolean;
-
-       { tries to hold the amount of times which the current tree is processed  }
-       t_times : longint;
-
-       { true, if an error while code generation occurs }
-       codegenerror : boolean;
-
-       { this is for open arrays and strings        }
-       { but be careful, this data is in the        }
-       { generated code destroyed quick, and also   }
-       { the next call of secondload destroys this  }
-       { data                                       }
-       { So be careful using the informations       }
-       { provided by this variables                 }
-       highframepointer : tregister;
-       highoffset : longint;
-
-       make_const_global : boolean;
-       temptoremove : plinkedlist;
-
-    { message calls with codegenerror support }
-    procedure cgmessage(const t : tmsgconst);
-    procedure cgmessage1(const t : tmsgconst;const s : string);
-    procedure cgmessage2(const t : tmsgconst;const s1,s2 : string);
-    procedure cgmessage3(const t : tmsgconst;const s1,s2,s3 : string);
-
-    procedure CGMessagePos(const pos:tfileposinfo;t:tmsgconst);
-    procedure CGMessagePos1(const pos:tfileposinfo;t:tmsgconst;const s1:string);
-    procedure CGMessagePos2(const pos:tfileposinfo;t:tmsgconst;const s1,s2:string);
-    procedure CGMessagePos3(const pos:tfileposinfo;t:tmsgconst;const s1,s2,s3:string);
-
-    { initialize respectively terminates the code generator }
-    { for a new module or procedure                         }
-    procedure codegen_doneprocedure;
-    procedure codegen_donemodule;
-    procedure codegen_newmodule;
-    procedure codegen_newprocedure;
-
-    { counts the labels }
-    function case_count_labels(root : pcaserecord) : longint;
-    { searches the highest label }
-    function case_get_max(root : pcaserecord) : longint;
-    { searches the lowest label }
-    function case_get_min(root : pcaserecord) : longint;
-
-    { clears a location record }
-    procedure clear_location(var loc : tlocation);
-    { copies a location, takes care of the symbol }
-    procedure set_location(var destloc,sourceloc : tlocation);
-    { swaps two locations }
-    procedure swap_location(var destloc,sourceloc : tlocation);
+{$ifdef ia64}
+       OS_ADDR = OS_64;
+       OS_INT = OS_64;
+{$endif ia64}
 
   implementation
 
-     uses
-        comphook;
-
-{*****************************************************************************
-            override the message calls to set codegenerror
-*****************************************************************************}
-
-    procedure cgmessage(const t : tmsgconst);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=status.errorcount;
-              verbose.Message(t);
-              codegenerror:=olderrorcount<>status.errorcount;
-           end;
-      end;
-
-    procedure cgmessage1(const t : tmsgconst;const s : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=status.errorcount;
-              verbose.Message1(t,s);
-              codegenerror:=olderrorcount<>status.errorcount;
-           end;
-      end;
-
-    procedure cgmessage2(const t : tmsgconst;const s1,s2 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=status.errorcount;
-              verbose.Message2(t,s1,s2);
-              codegenerror:=olderrorcount<>status.errorcount;
-           end;
-      end;
-
-    procedure cgmessage3(const t : tmsgconst;const s1,s2,s3 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=status.errorcount;
-              verbose.Message3(t,s1,s2,s3);
-              codegenerror:=olderrorcount<>status.errorcount;
-           end;
-      end;
-
-
-    procedure cgmessagepos(const pos:tfileposinfo;t : tmsgconst);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.MessagePos(pos,t);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-    procedure cgmessagepos1(const pos:tfileposinfo;t : tmsgconst;const s1 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.MessagePos1(pos,t,s1);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-    procedure cgmessagepos2(const pos:tfileposinfo;t : tmsgconst;const s1,s2 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.MessagePos2(pos,t,s1,s2);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-    procedure cgmessagepos3(const pos:tfileposinfo;t : tmsgconst;const s1,s2,s3 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.MessagePos3(pos,t,s1,s2,s3);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-
-{****************************************************************************
-                                 TProcInfo
-****************************************************************************}
-
-    constructor tprocinfo.init;
-      begin
-        parent:=nil;
-        _class:=nil;
-        {$IFNDEF NEWST}
-        returntype.reset;
-        {$ENDIF NEWST}
-        resultfuncretsym:=nil;
-        funcretsym:=nil;
-        funcret_state:=vs_none;
-        def:=nil;
-        sym:=nil;
-        framepointer_offset:=0;
-        selfpointer_offset:=0;
-        return_offset:=0;
-        firsttemp_offset:=0;
-        para_offset:=0;
-        registerstosave:=[];
-        flags:=0;
-        framepointer:=R_NO;
-        globalsymbol:=false;
-        exported:=false;
-        aktentrycode:=new(paasmoutput,init);
-        aktexitcode:=new(paasmoutput,init);
-        aktproccode:=new(paasmoutput,init);
-        aktlocaldata:=new(paasmoutput,init);
-      end;
-
-
-    destructor tprocinfo.done;
-      begin
-         dispose(aktentrycode,done);
-         dispose(aktexitcode,done);
-         dispose(aktproccode,done);
-         dispose(aktlocaldata,done);
-      end;
-
-
-
-{*****************************************************************************
-         initialize/terminate the codegen for procedure and modules
-*****************************************************************************}
-
-    procedure codegen_newprocedure;
-      begin
-         aktbreaklabel:=nil;
-         aktcontinuelabel:=nil;
-         new(procinfo,init);
-         { aktexitlabel:=0; is store in oldaktexitlabel
-           so it must not be reset to zero before this storage !}
-      end;
-
-
-
-    procedure codegen_doneprocedure;
-      begin
-         dispose(procinfo,done);
-         procinfo:=nil;
-      end;
-
-
-
-    procedure codegen_newmodule;
-      begin
-         exprasmlist:=new(paasmoutput,init);
-         datasegment:=new(paasmoutput,init);
-         codesegment:=new(paasmoutput,init);
-         bsssegment:=new(paasmoutput,init);
-         debuglist:=new(paasmoutput,init);
-         consts:=new(paasmoutput,init);
-         rttilist:=new(paasmoutput,init);
-         importssection:=nil;
-         exportssection:=nil;
-         resourcesection:=nil;
-         asmsymbollist:=new(pasmsymbollist,init);
-         asmsymbollist^.usehash;
-      end;
-
-
-    procedure codegen_donemodule;
-      begin
-         dispose(exprasmlist,done);
-         dispose(codesegment,done);
-         dispose(bsssegment,done);
-         dispose(datasegment,done);
-         dispose(debuglist,done);
-         dispose(consts,done);
-         dispose(rttilist,done);
-         if assigned(importssection) then
-          dispose(importssection,done);
-         if assigned(exportssection) then
-          dispose(exportssection,done);
-         if assigned(resourcesection) then
-          dispose(resourcesection,done);
-         if assigned(resourcestringlist) then
-          dispose(resourcestringlist,done);
-         dispose(asmsymbollist,done);
-      end;
-
-
-{*****************************************************************************
-                              Case Helpers
-*****************************************************************************}
-
-    function case_count_labels(root : pcaserecord) : longint;
-      var
-         _l : longint;
-
-      procedure count(p : pcaserecord);
-        begin
-           inc(_l);
-           if assigned(p^.less) then
-             count(p^.less);
-           if assigned(p^.greater) then
-             count(p^.greater);
-        end;
-
-      begin
-         _l:=0;
-         count(root);
-         case_count_labels:=_l;
-      end;
-
-
-    function case_get_max(root : pcaserecord) : longint;
-      var
-         hp : pcaserecord;
-      begin
-         hp:=root;
-         while assigned(hp^.greater) do
-           hp:=hp^.greater;
-         case_get_max:=hp^._high;
-      end;
-
-
-    function case_get_min(root : pcaserecord) : longint;
-      var
-         hp : pcaserecord;
-      begin
-         hp:=root;
-         while assigned(hp^.less) do
-           hp:=hp^.less;
-         case_get_min:=hp^._low;
-      end;
-
-
-{*****************************************************************************
-                              TTempToDestroy
-*****************************************************************************}
-
-    constructor ttemptodestroy.init(const a : treference;p : pdef);
-      begin
-         inherited init;
-         address:=a;
-         typ:=p;
-      end;
-
-{*****************************************************************************
-            some helper routines to handle locations
-*****************************************************************************}
-
-    procedure clear_location(var loc : tlocation);
-
-      begin
-        if ((loc.loc=LOC_MEM) or (loc.loc=LOC_REFERENCE)) and
-           assigned(loc.reference.symbol) then
-          dispose(loc.reference.symbol,done);
-        loc.loc:=LOC_INVALID;
-      end;
-
-    procedure set_location(var destloc,sourceloc : tlocation);
-
-      begin
-         { this is needed if you want to be able to delete }
-         { the string with the nodes                       }
-         if assigned(destloc.reference.symbol) then
-           dispose(destloc.reference.symbol,done);
-         destloc:= sourceloc;
-         if sourceloc.loc in [LOC_MEM,LOC_REFERENCE] then
-           begin
-              if assigned(sourceloc.reference.symbol) then
-                destloc.reference.symbol:=
-                  sourceloc.reference.symbol;
-           end
-         else
-           destloc.reference.symbol:=nil;
-      end;
-
-    procedure swap_location(var destloc,sourceloc : tlocation);
-
-      var
-         swapl : tlocation;
-
-      begin
-         swapl:=destloc;
-         destloc:=sourceloc;
-         sourceloc:=swapl;
-      end;
 
 end.
 {
   $Log$
-  Revision 1.1  2000-07-13 06:30:07  michael
+  Revision 1.2  2000-11-29 00:30:51  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.1  2000/07/13 06:30:07  michael
   + Initial import
 
   Revision 1.19  2000/03/11 21:11:24  daniel
@@ -594,4 +132,4 @@ end.
 
   Revision 1.1  1998/12/15 22:18:55  florian
     * some code added
-}
+}

+ 8 - 12
compiler/nflw.pas

@@ -143,22 +143,14 @@ implementation
 
     uses
       globtype,systems,
-      cutils,cobjects,verbose,globals,
+      cutils,verbose,globals,
       symconst,symtable,types,htypechk,pass_1,
-      ncon,nmem,nld,ncnv,nbas
+      ncon,nmem,nld,ncnv,nbas,tgcpu,hcodegen
 {$ifdef newcg}
       ,tgobj
-      ,tgcpu
       ,cgbase
 {$else newcg}
-      ,hcodegen
       ,temp_gen
-{$ifdef i386}
-      ,tgeni386
-{$endif}
-{$ifdef m68k}
-      ,tgen68k
-{$endif m68k}
 {$endif newcg}
       ;
 
@@ -992,7 +984,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.10  2000-11-04 14:25:20  florian
+  Revision 1.11  2000-11-29 00:30:33  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.10  2000/11/04 14:25:20  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.9  2000/10/31 22:02:48  peter
@@ -1026,4 +1022,4 @@ end.
   Revision 1.1  2000/09/22 22:46:03  florian
     + initial revision
 
-}
+}

+ 8 - 11
compiler/ninl.pas

@@ -47,21 +47,14 @@ interface
 implementation
 
     uses
-      cobjects,verbose,globals,systems,
+      verbose,globals,systems,
       globtype,
-      symconst,symtype,symdef,symsym,symtable,aasm,types,
+      symconst,symtype,symdef,symsym,symtable,types,
       pass_1,
       ncal,ncon,ncnv,nadd,nld,nbas,
-      cpubase
+      cpubase,hcodegen,tgcpu
 {$ifdef newcg}
       ,cgbase
-      ,tgobj
-      ,tgcpu
-{$else newcg}
-      ,hcodegen
-{$ifdef i386}
-      ,tgeni386
-{$endif}
 {$endif newcg}
       ;
 
@@ -1498,7 +1491,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.18  2000-11-12 15:27:22  jonas
+  Revision 1.19  2000-11-29 00:30:33  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.18  2000/11/12 15:27:22  jonas
     * also don't do conversion for chars/booleans (hopefully final change :/)
 
   Revision 1.17  2000/11/11 21:08:13  jonas

+ 9 - 11
compiler/nld.pas

@@ -94,19 +94,13 @@ interface
 implementation
 
     uses
-      cutils,cobjects,verbose,globtype,globals,systems,
-      symconst,symdef,symtable,aasm,types,
+      cutils,verbose,globtype,globals,systems,
+      symconst,symdef,symtable,types,
       htypechk,pass_1,
-      ncnv,nmem,cpubase
+      ncnv,nmem,cpubase,tgcpu,hcodegen
 {$ifdef newcg}
       ,cgbase
       ,tgobj
-      ,tgcpu
-{$else newcg}
-      ,hcodegen
-{$ifdef i386}
-      ,tgeni386
-{$endif}
 {$endif newcg}
       ;
 
@@ -743,7 +737,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  2000-11-04 14:25:20  florian
+  Revision 1.9  2000-11-29 00:30:33  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.8  2000/11/04 14:25:20  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.7  2000/10/31 22:02:49  peter
@@ -766,4 +764,4 @@ end.
 
   Revision 1.1  2000/09/25 14:55:05  florian
     * initial revision
-}
+}

+ 8 - 6
compiler/nmat.pas

@@ -59,16 +59,14 @@ implementation
 
     uses
       globtype,systems,tokens,
-      cobjects,verbose,globals,
-      symconst,symtype,symtable,symdef,aasm,types,
+      verbose,globals,
+      symconst,symtype,symtable,symdef,types,
       htypechk,pass_1,cpubase,cpuinfo,
 {$ifdef newcg}
       cgbase,
 {$else newcg}
       hcodegen,
 {$endif newcg}
-      { for isbinaryoverloaded function }
-      nadd,
       ncon,ncnv,ncal;
 
 {****************************************************************************
@@ -529,7 +527,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  2000-10-31 22:02:49  peter
+  Revision 1.9  2000-11-29 00:30:34  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.8  2000/10/31 22:02:49  peter
     * symtable splitted, no real code changes
 
   Revision 1.7  2000/10/01 19:48:24  peter
@@ -552,4 +554,4 @@ end.
 
   Revision 1.1  2000/09/20 21:35:12  florian
     * initial revision
-}
+}

+ 8 - 4
compiler/nmem.pas

@@ -121,8 +121,8 @@ implementation
 
     uses
       globtype,systems,
-      cutils,cobjects,verbose,globals,
-      symconst,symbase,aasm,types,
+      cutils,verbose,globals,
+      symconst,symbase,types,
       htypechk,pass_1,ncal,nld,ncon,ncnv
 {$ifdef newcg}
       ,cgbase
@@ -869,7 +869,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.10  2000-11-04 14:25:20  florian
+  Revision 1.11  2000-11-29 00:30:34  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.10  2000/11/04 14:25:20  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.9  2000/10/31 22:02:49  peter
@@ -902,4 +906,4 @@ end.
 
   Revision 1.1  2000/09/25 09:58:22  florian
     * first revision for testing purpose
-}
+}

+ 8 - 3
compiler/node.inc

@@ -87,7 +87,8 @@
 
       begin
 {$ifdef newcg}
-         l^.concat(self);
+         //!!!!!!! l^.concat(self);
+         {$warning fixme}
 {$endif newcg}
       end;
 
@@ -511,7 +512,11 @@
 
 {
   $Log$
-  Revision 1.12  2000-11-04 13:10:15  jonas
+  Revision 1.13  2000-11-29 00:30:34  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.12  2000/11/04 13:10:15  jonas
     - removed check for self = nil in getcopy
 
   Revision 1.11  2000/10/21 18:16:11  florian
@@ -551,4 +556,4 @@
   Revision 1.1  2000/08/26 12:27:17  florian
     * createial release
 
-}
+}

+ 7 - 4
compiler/node.pas

@@ -39,15 +39,18 @@ implementation
 
     uses
        cutils,
-       globals,
-       symconst;
+       globals;
 
     {$I node.inc}
 
 end.
 {
   $Log$
-  Revision 1.9  2000-10-31 22:02:49  peter
+  Revision 1.10  2000-11-29 00:30:34  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.9  2000/10/31 22:02:49  peter
     * symtable splitted, no real code changes
 
   Revision 1.8  2000/10/01 19:48:24  peter
@@ -73,4 +76,4 @@ end.
 
   Revision 1.1  2000/08/26 12:27:35  florian
     * initial release
-}
+}

+ 9 - 14
compiler/nset.pas

@@ -93,21 +93,12 @@ implementation
 
     uses
       globtype,systems,
-      cobjects,verbose,globals,
-      symconst,symdef,symsym,symtable,types,
+      verbose,globals,
+      symconst,symdef,symsym,types,
       htypechk,pass_1,
-      ncnv,ncon,cpubase,nld
+      ncnv,ncon,cpubase,nld,hcodegen,tgcpu
 {$ifdef newcg}
       ,cgbase
-      ,tgcpu
-{$else newcg}
-      ,hcodegen
-{$ifdef i386}
-      ,tgeni386
-{$endif}
-{$ifdef m68k}
-      ,tgen68k
-{$endif}
 {$endif newcg}
       ;
 
@@ -525,7 +516,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  2000-11-04 14:25:20  florian
+  Revision 1.9  2000-11-29 00:30:34  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.8  2000/11/04 14:25:20  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.7  2000/10/31 22:02:49  peter
@@ -553,4 +548,4 @@ end.
   Revision 1.1  2000/09/24 19:38:39  florian
     * initial implementation
 
-}
+}

+ 6 - 3
compiler/options.pas

@@ -68,8 +68,7 @@ uses
   dos,
 {$endif Delphi}
   version,systems,
-  cutils,cobjects,
-  symtable,scanner,link,messages
+  cutils,cobjects,messages
 {$ifdef BrowserLog}
   ,browlog
 {$endif BrowserLog}
@@ -1515,7 +1514,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.17  2000-11-13 15:26:12  marco
+  Revision 1.18  2000-11-29 00:30:34  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.17  2000/11/13 15:26:12  marco
    * Renamefest
 
   Revision 1.16  2000/11/12 22:20:37  peter

+ 8 - 12
compiler/parser.pas

@@ -37,26 +37,18 @@ implementation
       globtype,version,tokens,systems,
       cutils,cobjects,globals,verbose,
       symbase,symtable,symsym,fmodule,aasm,
-{$ifndef newcg}
       hcodegen,
-{$endif newcg}
-      assemble,link,script,gendef,
+      script,gendef,
 {$ifdef BrowserLog}
       browlog,
 {$endif BrowserLog}
 {$ifdef UseExcept}
-      tpexcept,compiler,
+      tpexcept,
 {$endif UseExcept}
-{$ifdef newcg}
-      cgobj,
-      cgcpu,
-      { cgbase must be after hcodegen to use the correct procinfo !!! }
-      cgbase,
-{$endif newcg}
 {$ifdef GDB}
       gdb,
 {$endif GDB}
-      comphook,scanner,pbase,ptype,psystem,pmodules,cresstr;
+      comphook,scanner,pbase,ptype,pmodules,cresstr;
 
 
     procedure initparser;
@@ -593,7 +585,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.10  2000-11-12 22:17:46  peter
+  Revision 1.11  2000-11-29 00:30:34  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.10  2000/11/12 22:17:46  peter
     * some realname updates for messages
 
   Revision 1.9  2000/11/04 14:25:20  florian

+ 9 - 15
compiler/pass_1.pas

@@ -40,21 +40,11 @@ implementation
 
     uses
       globtype,systems,
-      cutils,cobjects,verbose,globals,
-      aasm,symtable,types,
-      htypechk,
-      cpubase,cpuasm
+      cutils,cobjects,globals,
+      hcodegen,
+      tgcpu
 {$ifdef newcg}
       ,cgbase
-      ,tgcpu
-{$else newcg}
-      ,hcodegen
-  {$ifdef i386}
-      ,tgeni386
-  {$endif}
-  {$ifdef m68k}
-      ,tgen68k
-  {$endif}
 {$endif}
       ;
 
@@ -154,7 +144,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.9  2000-10-14 10:14:51  peter
+  Revision 1.10  2000-11-29 00:30:35  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.9  2000/10/14 10:14:51  peter
     * moehrendorf oct 2000 rewrite
 
   Revision 1.8  2000/10/01 19:48:25  peter
@@ -178,4 +172,4 @@ end.
   Revision 1.2  2000/07/13 11:32:44  michael
   + removed logs
 
-}
+}

+ 9 - 15
compiler/pass_2.pas

@@ -48,19 +48,9 @@ implementation
 
    uses
      globtype,systems,
-     cobjects,comphook,verbose,globals,fmodule,
-     symconst,symbase,symtype,symsym,symtable,types,aasm,scanner,
-     pass_1,hcodegen,temp_gen,cpubase,cpuasm,regvars,nflw
-{$ifdef GDB}
-     ,gdb
-{$endif}
-{$ifdef i386}
-     ,tgeni386,cgai386
-{$endif}
-{$ifdef m68k}
-     ,tgen68k,cga68k
-{$endif}
-     ;
+     cobjects,globals,
+     symconst,symbase,symtype,symsym,aasm,
+     pass_1,hcodegen,temp_gen,regvars,nflw,tgcpu;
 
 {*****************************************************************************
                               SecondPass
@@ -311,7 +301,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.10  2000-10-31 22:02:49  peter
+  Revision 1.11  2000-11-29 00:30:35  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.10  2000/10/31 22:02:49  peter
     * symtable splitted, no real code changes
 
   Revision 1.9  2000/10/14 10:14:51  peter
@@ -347,4 +341,4 @@ end.
   Revision 1.2  2000/07/13 11:32:44  michael
   + removed logs
 
-}
+}

+ 10 - 16
compiler/pdecl.pas

@@ -44,27 +44,17 @@ implementation
        cutils,
        { global }
        globtype,globals,tokens,verbose,
-       systems,cpuinfo,
+       systems,
        { aasm }
        aasm,
        { symtable }
-       symconst,symbase,symtype,symdef,symtable,types,
-{$ifdef GDB}
-       gdb,
-{$endif}
+       symconst,symbase,symtype,symdef,symtable,
        { pass 1 }
-       pass_1,htypechk,
-       nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,
+       pass_1,
+       nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,
        { parser }
        scanner,
-       pbase,pexpr,ptype,ptconst,pdecsub,pdecvar,pdecobj,
-       { codegen }
-{$ifdef newcg}
-       cgbase
-{$else}
-       hcodegen
-{$endif}
-       ;
+       pbase,pexpr,ptype,ptconst,pdecsub,pdecvar,pdecobj;
 
 
     function readconstant(const name:string;const filepos:tfileposinfo):pconstsym;
@@ -545,7 +535,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.21  2000-11-12 22:17:46  peter
+  Revision 1.22  2000-11-29 00:30:35  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.21  2000/11/12 22:17:46  peter
     * some realname updates for messages
 
   Revision 1.20  2000/11/11 16:19:11  peter

+ 7 - 3
compiler/pdecobj.pas

@@ -44,7 +44,7 @@ implementation
       hcodegen,hcgdata,
       node,nld,ncon,ncnv,pass_1,
       scanner,
-      pbase,pexpr,pdecl,psub,pdecsub,pdecvar,ptype;
+      pbase,pexpr,pdecsub,pdecvar,ptype;
 
     function object_dec(const n : stringid;fd : pobjectdef) : pdef;
     { this function parses an object or class declaration }
@@ -1170,7 +1170,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.13  2000-11-17 17:32:58  florian
+  Revision 1.14  2000-11-29 00:30:35  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.13  2000/11/17 17:32:58  florian
     * properties can now be used in interfaces
 
   Revision 1.12  2000/11/17 08:21:07  florian
@@ -1213,4 +1217,4 @@ end.
   Revision 1.1  2000/10/14 10:14:51  peter
     * moehrendorf oct 2000 rewrite
 
-}
+}

+ 7 - 6
compiler/pdecsub.pas

@@ -64,17 +64,14 @@ implementation
        cutils,
        { global }
        globtype,globals,verbose,
-       systems,cpuinfo,
+       systems,
        { aasm }
        aasm,
        { symtable }
        symbase,symtable,types,
-{$ifdef GDB}
-       gdb,
-{$endif}
        { pass 1 }
        node,pass_1,htypechk,
-       nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,
+       nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,
        { parser }
        fmodule,scanner,
        pbase,pexpr,ptype,pdecl,
@@ -1870,7 +1867,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.8  2000-11-26 23:45:34  florian
+  Revision 1.9  2000-11-29 00:30:35  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.8  2000/11/26 23:45:34  florian
     * pascal modifier in interfaces of units works now
 
   Revision 1.7  2000/11/06 20:30:55  peter

+ 10 - 18
compiler/pdecvar.pas

@@ -39,29 +39,17 @@ implementation
        cutils,cobjects,
        { global }
        globtype,globals,tokens,verbose,
-       systems,cpuinfo,
-       { aasm }
-       aasm,
+       systems,
        { symtable }
        symconst,symbase,symtype,symdef,symsym,symtable,types,fmodule,
-{$ifdef GDB}
-       gdb,
-{$endif}
        { pass 1 }
-       node,pass_1,htypechk,
-       nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,
+       node,pass_1,
+       nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,
        { parser }
        scanner,
        pbase,pexpr,ptype,ptconst,pdecsub,
        { link }
-       import,
-       { codegen }
-{$ifdef newcg}
-       cgbase
-{$else}
-       hcodegen
-{$endif}
-       ;
+       import;
 
     const
        variantrecordlevel : longint = 0;
@@ -527,7 +515,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.3  2000-11-04 14:25:20  florian
+  Revision 1.4  2000-11-29 00:30:36  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.3  2000/11/04 14:25:20  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.2  2000/10/31 22:02:49  peter
@@ -536,4 +528,4 @@ end.
   Revision 1.1  2000/10/14 10:14:51  peter
     * moehrendorf oct 2000 rewrite
 
-}
+}

+ 11 - 9
compiler/pexports.pas

@@ -34,20 +34,18 @@ implementation
 
     uses
        { common }
-       cutils,cobjects,
+       cutils,
        { global }
-       globtype,globals,tokens,verbose,
-       systems,cpuinfo,
-       { aasm }
-       aasm,
+       globals,tokens,verbose,
+       systems,
        { symtable }
-       symconst,symdef,symsym,symtable,types,
+       symconst,symdef,symsym,symtable,
        { pass 1 }
        node,pass_1,
        ncon,
        { parser }
        scanner,
-       pbase,pexpr,pdecl,pdecsub,pdecvar,
+       pbase,pexpr,
        { link }
        gendef,export
        ;
@@ -169,7 +167,11 @@ end.
 
 {
   $Log$
-  Revision 1.7  2000-10-31 22:02:49  peter
+  Revision 1.8  2000-11-29 00:30:36  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.7  2000/10/31 22:02:49  peter
     * symtable splitted, no real code changes
 
   Revision 1.6  2000/10/14 10:14:51  peter
@@ -188,4 +190,4 @@ end.
   Revision 1.2  2000/07/13 11:32:44  michael
   + removed logs
 
-}
+}

+ 18 - 9
compiler/pexpr.pas

@@ -56,14 +56,9 @@ implementation
        cutils,cobjects,
        { global }
        globtype,globals,tokens,verbose,
-       systems,cpuinfo,
-       { aasm }
-       aasm,
+       systems,cpuinfo,widestr,
        { symtable }
        symconst,symbase,symdef,symsym,symtable,types,
-{$ifdef GDB}
-       gdb,
-{$endif}
        { pass 1 }
        pass_1,htypechk,
        nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,nbas,
@@ -2072,7 +2067,17 @@ implementation
                  p1:=genordinalconstnode(ord(pattern[1]),cchardef);
                  consume(_CCHAR);
                end;
-_KLAMMERAFFE : begin
+           _CWSTRING:
+             begin
+                p1:=genwstringconstnode(patternw);
+                consume(_CWSTRING);
+             end;
+           _CWCHAR:
+             begin
+                p1:=genordinalconstnode(ord(getcharwidestring(patternw,0)),cwidechardef);
+                consume(_CWCHAR);
+             end;
+      _KLAMMERAFFE : begin
                  consume(_KLAMMERAFFE);
                  got_addrn:=true;
                  { support both @<x> and @(<x>) }
@@ -2390,7 +2395,11 @@ _LECKKLAMMER : begin
 end.
 {
   $Log$
-  Revision 1.17  2000-11-09 17:46:55  florian
+  Revision 1.18  2000-11-29 00:30:36  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.17  2000/11/09 17:46:55  florian
     * System.TypeInfo fixed
     + System.Finalize implemented
     + some new keywords for interface support added
@@ -2446,4 +2455,4 @@ end.
 
   Revision 1.2  2000/07/13 11:32:44  michael
   + removed logs
-}
+}

+ 8 - 4
compiler/pmodules.pas

@@ -45,7 +45,7 @@ implementation
 
     uses
        globtype,version,systems,tokens,
-       cutils,cobjects,comphook,compiler,
+       cutils,cobjects,comphook,
        globals,verbose,fmodule,finput,
        symconst,symbase,symppu,symdef,symsym,symtable,aasm,types,
 {$ifdef newcg}
@@ -61,7 +61,7 @@ implementation
 {$ifdef GDB}
        gdb,
 {$endif GDB}
-       scanner,pbase,psystem,pdecl,psub,parser;
+       scanner,pbase,psystem,psub,parser;
 
     procedure create_objectfile;
       begin
@@ -1697,7 +1697,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  2000-11-01 23:04:37  peter
+  Revision 1.19  2000-11-29 00:30:36  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.18  2000/11/01 23:04:37  peter
     * tprocdef.fullprocname added for better casesensitve writing of
       procedures
 
@@ -1752,4 +1756,4 @@ end.
 
   Revision 1.2  2000/07/13 11:32:45  michael
   + removed logs
-}
+}

+ 25 - 10
compiler/pp.pas

@@ -66,16 +66,27 @@ program pp;
    {$endif GDB}
    { but I386 or M68K must be defined }
    { and only one of the two }
-   {$ifndef I386}
-      {$ifndef M68K}
-        {$fatal One of the switches I386 or M68K must be defined}
-      {$endif M68K}
-   {$endif I386}
    {$ifdef I386}
-      {$ifdef M68K}
-        {$fatal ONLY one of the switches I386 or M68K must be defined}
-      {$endif M68K}
+     {$ifdef CPUDEFINED}
+        {$fatal ONLY one of the switches for the CPU type must be defined}
+     {$endif CPUDEFINED}
+     {$define CPUDEFINED}
    {$endif I386}
+   {$ifdef M68K}
+     {$ifdef CPUDEFINED}
+        {$fatal ONLY one of the switches for the CPU type must be defined}
+     {$endif CPUDEFINED}
+     {$define CPUDEFINED}
+   {$endif M68K}
+   {$ifdef iA64}
+     {$ifdef CPUDEFINED}
+        {$fatal ONLY one of the switches for the CPU type must be defined}
+     {$endif CPUDEFINED}
+     {$define CPUDEFINED}
+   {$endif iA64}
+   {$ifndef CPUDEFINED}
+     {$fatal A CPU type switch must be defined}
+   {$endif CPUDEFINED}
    {$ifdef support_mmx}
      {$ifndef i386}
        {$fatal I386 switch must be on for MMX support}
@@ -149,7 +160,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.5  2000-11-13 15:26:12  marco
+  Revision 1.6  2000-11-29 00:30:37  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.5  2000/11/13 15:26:12  marco
    * Renamefest
 
   Revision 1.4  2000/10/01 21:15:55  pierre
@@ -161,4 +176,4 @@ end.
   Revision 1.2  2000/07/13 11:32:45  michael
   + removed logs
 
-}
+}

+ 13 - 16
compiler/pstatmnt.pas

@@ -47,40 +47,33 @@ implementation
        cpubase,aasm,
        { symtable }
        symconst,symbase,symtype,symdef,symsym,symtable,types,
-       ppu,fmodule,
        { pass 1 }
        pass_1,htypechk,
        nbas,nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,
        { parser }
        scanner,
        pbase,pexpr,
+       { codegen }
+       tgcpu,hcodegen
 {$ifdef i386}
   {$ifndef NoRa386Int}
-       ra386int,
+       ,ra386int
   {$endif NoRa386Int}
   {$ifndef NoRa386Att}
-       ra386att,
+       ,ra386att
   {$endif NoRa386Att}
   {$ifndef NoRa386Dir}
-       ra386dir,
+       ,ra386dir
   {$endif NoRa386Dir}
 {$endif i386}
 {$ifdef m68k}
   {$ifndef NoRa68kMot}
-       ra68kmot,
+       ,ra68kmot
   {$endif NoRa68kMot}
 {$endif m68k}
        { codegen }
 {$ifdef newcg}
-       cgbase
-{$else newcg}
-       hcodegen
-  {$ifdef i386}
-       ,tgeni386
-  {$endif i386}
-  {$ifdef m68k}
-       ,tgen68k
-  {$endif m68k}
+       ,cgbase
 {$endif newcg}
        ;
 
@@ -1266,7 +1259,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.15  2000-11-27 15:47:19  jonas
+  Revision 1.16  2000-11-29 00:30:37  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.15  2000/11/27 15:47:19  jonas
     * fix for web bug 1251 (example 1)
 
   Revision 1.14  2000/11/22 22:43:34  peter
@@ -1309,4 +1306,4 @@ end.
   Revision 1.2  2000/07/13 11:32:45  michael
   + removed logs
 
-}
+}

+ 13 - 10
compiler/psub.pas

@@ -46,14 +46,14 @@ implementation
        cutils,
        { global }
        globtype,globals,tokens,verbose,
-       systems,cpuinfo,
+       systems,
        { aasm }
        cpubase,aasm,
        { symtable }
        symconst,symbase,symtype,symdef,symsym,symtable,types,
        ppu,fmodule,
        { pass 1 }
-       node,pass_1,
+       node,
        nbas,
        { pass 2 }
 {$ifndef NOPASS2}
@@ -61,19 +61,18 @@ implementation
 {$endif}
        { parser }
        scanner,
-       pbase,pexpr,pstatmnt,pdecl,pdecsub,pexports,
+       pbase,pstatmnt,pdecl,pdecsub,pexports,
        { codegen }
+       tgcpu,hcodegen
 {$ifdef newcg}
-       cgbase,
-       tgcpu,cgobj,
+       ,cgbase
+       ,cgobj
        {$ifndef NOOPT}
         ,aopt
        {$endif}
 {$else}
-       hcodegen,
-       temp_gen
+       ,temp_gen
        {$ifdef i386}
-         ,tgeni386
          ,cgai386
          {$ifndef NOOPT}
            ,aopt386
@@ -836,7 +835,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.22  2000-11-08 16:38:24  jonas
+  Revision 1.23  2000-11-29 00:30:37  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.22  2000/11/08 16:38:24  jonas
     * if a procedure uses exceptions (be it implicit or explicit), the
       usedregisters are set to all (because FPC_POPADDRSTACK doesn't save
       any registers) ("merged", fixes make cycle woth -Or)
@@ -912,4 +915,4 @@ end.
 
   Revision 1.2  2000/07/13 11:32:46  michael
   + removed logs
-}
+}

+ 7 - 3
compiler/psystem.pas

@@ -38,7 +38,7 @@ procedure createconstdefs;
 implementation
 
 uses
-  globtype,globals,
+  globals,
   symconst,symsym,symdef,symtable,
   ninl;
 
@@ -259,7 +259,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.9  2000-11-09 17:46:56  florian
+  Revision 1.10  2000-11-29 00:30:38  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.9  2000/11/09 17:46:56  florian
     * System.TypeInfo fixed
     + System.Finalize implemented
     + some new keywords for interface support added
@@ -290,4 +294,4 @@ end.
   Revision 1.2  2000/07/13 11:32:47  michael
   + removed logs
 
-}
+}

+ 10 - 8
compiler/ptconst.pas

@@ -42,7 +42,7 @@ implementation
        strings,
 {$endif Delphi}
        globtype,systems,tokens,cpuinfo,
-       cutils,cobjects,globals,scanner,
+       cutils,globals,scanner,
        symconst,symbase,symdef,symtable,aasm,types,verbose,
        { pass 1 }
        node,pass_1,
@@ -50,13 +50,11 @@ implementation
        { parser specific stuff }
        pbase,pexpr,
        { codegen }
+       hcodegen
 {$ifdef newcg}
-       cgbase,
-{$else}
-       hcodegen,
+       ,cgbase
 {$endif}
-       hcgdata;
-
+       ;
 
 {$ifdef fpc}
   {$maxfpuregisters 0}
@@ -838,7 +836,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.12  2000-11-06 15:54:15  florian
+  Revision 1.13  2000-11-29 00:30:38  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.12  2000/11/06 15:54:15  florian
     * fixed two bugs to get make cycle work, but it's not enough
 
   Revision 1.11  2000/11/04 14:25:21  florian
@@ -872,4 +874,4 @@ end.
   Revision 1.2  2000/07/13 11:32:47  michael
   + removed logs
 
-}
+}

+ 9 - 18
compiler/ptype.pas

@@ -58,28 +58,15 @@ implementation
        cutils,cobjects,
        { global }
        globals,tokens,verbose,
-       systems,cpuinfo,
-       { aasm }
-       aasm,
+       systems,
        { symtable }
        symconst,symbase,symdef,symsym,symtable,types,
-{$ifdef GDB}
-       gdb,
-{$endif}
        { pass 1 }
        node,pass_1,
-       nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,
+       nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,
        { parser }
        scanner,
-       pbase,pexpr,pdecl,pdecsub,pdecvar,pdecobj,
-       { codegen }
-{$ifdef newcg}
-       cgbase,
-{$else}
-       hcodegen,
-{$endif}
-       hcgdata
-       ;
+       pbase,pexpr,pdecsub,pdecvar,pdecobj;
 
 
     procedure id_type(var tt : ttype;var s : string;isforwarddef:boolean);
@@ -590,7 +577,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.15  2000-11-14 23:43:38  florian
+  Revision 1.16  2000-11-29 00:30:38  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.15  2000/11/14 23:43:38  florian
     * fixed 1238
 
   Revision 1.14  2000/11/04 14:25:21  florian
@@ -640,4 +631,4 @@ end.
   Revision 1.2  2000/07/13 11:32:47  michael
   + removed logs
 
-}
+}

+ 7 - 3
compiler/rautils.pas

@@ -211,7 +211,7 @@ uses
 {$else}
   strings,
 {$endif}
-  types,systems,verbose,globals,fmodule,
+  types,systems,verbose,globals,
   symbase,symtype,symsym,symtable,cpuasm
 {$ifdef NEWCG}
   ,cgbase;
@@ -1554,7 +1554,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.11  2000-11-06 22:30:30  peter
+  Revision 1.12  2000-11-29 00:30:38  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.11  2000/11/06 22:30:30  peter
     * more fixes
 
   Revision 1.10  2000/11/04 14:25:21  florian
@@ -1585,4 +1589,4 @@ end.
   Revision 1.2  2000/07/13 11:32:48  michael
   + removed logs
 
-}
+}

+ 8 - 11
compiler/regvars.pas

@@ -40,15 +40,8 @@ implementation
     uses
       globtype,systems,comphook,
       cutils,cobjects,verbose,globals,
-      symconst,symbase,symtype,symdef,symsym,symtable,types,
-      hcodegen,temp_gen,cpubase,cpuasm
-{$ifdef i386}
-     ,tgeni386,cgai386
-{$endif}
-{$ifdef m68k}
-     ,tgen68k,cga68k
-{$endif}
-     ;
+      symconst,symbase,symtype,symdef,symsym,types,
+      hcodegen,cpubase,cpuasm,tgcpu;
 
 
     var
@@ -464,7 +457,11 @@ end.
 
 {
   $Log$
-  Revision 1.12  2000-11-04 14:25:21  florian
+  Revision 1.13  2000-11-29 00:30:39  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.12  2000/11/04 14:25:21  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.11  2000/10/31 22:02:51  peter
@@ -512,4 +509,4 @@ end.
         * deallocate the regvars of the caller in secondprocinline before
           inlining the called procedure and reallocate them afterwards
 
-}
+}

+ 55 - 12
compiler/scanner.pas

@@ -30,7 +30,8 @@ interface
        cobjects,
        globtype,globals,version,tokens,
        verbose,comphook,
-       finput;
+       finput,
+       widestr;
 
     const
        maxmacrolen=16*1024;
@@ -151,6 +152,8 @@ interface
         c              : char;
         orgpattern,
         pattern        : string;
+        patternw : tcompilerwidestring;
+
         { token }
         token,                        { current token being parsed }
         idtoken    : ttoken;          { holds the token if the pattern is a known word }
@@ -1225,6 +1228,7 @@ implementation
         m       : longint;
         mac     : pmacro;
         asciinr : string[6];
+        iswidestring : boolean;
       label
          exit_label;
       begin
@@ -1594,6 +1598,7 @@ implementation
 
              '''','#','^' :
                begin
+                 iswidestring:=false;
                  if c='^' then
                   begin
                     readchar;
@@ -1641,10 +1646,24 @@ implementation
                                end;
                            end;
                          valint(asciinr,m,code);
-                         if (asciinr='') or (code<>0) or
-                            (m<0) or (m>255) then
-                          Message(scan_e_illegal_char_const);
-                         pattern:=pattern+chr(m);
+                         if (asciinr='') or (code<>0) then
+                           Message(scan_e_illegal_char_const)
+                         else if (m<0) or (m>255) then
+                           begin
+                              if (m>=0) and (m<=65535) then
+                                begin
+                                   ascii2unicode(pattern,patternw);
+                                   concatwidestringchar(patternw,
+                                     tcompilerwidechar(m));
+                                   iswidestring:=true;
+                                end
+                              else
+                                Message(scan_e_illegal_char_const)
+                           end
+                         else if iswidestring then
+                           concatwidestringchar(patternw,asciichar2unicode(char(m)))
+                         else
+                           pattern:=pattern+chr(m);
                        end;
                      '''' :
                        begin
@@ -1662,7 +1681,11 @@ implementation
                                   break;
                                end;
                            end;
-                           pattern:=pattern+c;
+                           if iswidestring then
+                             concatwidestringchar(patternw,
+                               asciichar2unicode(c))
+                           else
+                             pattern:=pattern+c;
                          until false;
                        end;
                      '^' :
@@ -1673,18 +1696,34 @@ implementation
                           c:=chr(ord(c)+64)
                          else
                           c:=chr(ord(c)-64);
-                         pattern:=pattern+c;
+
+                         if iswidestring then
+                           concatwidestringchar(patternw,
+                             asciichar2unicode(c))
+                         else
+                           pattern:=pattern+c;
+
                          readchar;
                        end;
                      else
                       break;
                    end;
                  until false;
-               { strings with length 1 become const chars }
-                 if length(pattern)=1 then
-                  token:=_CCHAR
+                 { strings with length 1 become const chars }
+                 if iswidestring then
+                   begin
+                      if length(pattern)=1 then
+                       token:=_CWCHAR
+                      else
+                       token:=_CWSTRING;
+                   end
                  else
-                  token:=_CSTRING;
+                   begin
+                      if length(pattern)=1 then
+                       token:=_CCHAR
+                      else
+                       token:=_CSTRING;
+                   end;
                  goto exit_label;
                end;
 
@@ -1886,7 +1925,11 @@ exit_label:
 end.
 {
   $Log$
-  Revision 1.7  2000-10-31 22:02:51  peter
+  Revision 1.8  2000-11-29 00:30:40  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.7  2000/10/31 22:02:51  peter
     * symtable splitted, no real code changes
 
   Revision 1.6  2000/09/24 15:06:28  peter

+ 8 - 1
compiler/symdef.pas

@@ -670,6 +670,9 @@ interface
 {$ifdef powerpc}
        bestrealdef : ^pfloatdef = @s64floatdef;
 {$endif}
+{$ifdef ia64}
+       bestrealdef : ^pfloatdef = @s64floatdef;
+{$endif}
 
 {$ifdef GDB}
     { GDB Helpers }
@@ -5544,7 +5547,11 @@ Const local_symtable_index : longint = $8001;
 end.
 {
   $Log$
-  Revision 1.14  2000-11-28 00:28:06  pierre
+  Revision 1.15  2000-11-29 00:30:40  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.14  2000/11/28 00:28:06  pierre
    * stabs fixing
 
   Revision 1.13  2000/11/26 18:09:40  florian

+ 7 - 5
compiler/symppu.pas

@@ -61,9 +61,7 @@ implementation
     uses
        globals,
        symconst,
-       verbose,
-       finput,scanner,
-       fmodule;
+       verbose;
 
 {*****************************************************************************
                                  PPU Writing
@@ -337,10 +335,14 @@ implementation
 end.
 {
   $Log$
-  Revision 1.2  2000-11-04 14:25:22  florian
+  Revision 1.3  2000-11-29 00:30:41  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.2  2000/11/04 14:25:22  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.1  2000/10/31 22:02:52  peter
     * symtable splitted, no real code changes
 
-}
+}

+ 5 - 3
compiler/symtable.pas

@@ -215,8 +215,6 @@ implementation
 {$ifdef GDB}
       gdb,
 {$endif GDB}
-      { type helpers }
-      types,
       { scanner }
       scanner,
       { codegen }
@@ -2366,7 +2364,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.17  2000-11-28 00:28:07  pierre
+  Revision 1.18  2000-11-29 00:30:42  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.17  2000/11/28 00:28:07  pierre
    * stabs fixing
 
   Revision 1.1.2.8  2000/11/17 11:14:37  pierre

+ 8 - 4
compiler/symtype.pas

@@ -148,8 +148,8 @@ implementation
 
     uses
        verbose,
-       ppu,symppu,
-       finput,fmodule;
+       symppu,
+       fmodule;
 
 {****************************************************************************
                                 Tdef
@@ -567,10 +567,14 @@ implementation
 end.
 {
   $Log$
-  Revision 1.2  2000-11-07 20:48:33  peter
+  Revision 1.3  2000-11-29 00:30:42  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.2  2000/11/07 20:48:33  peter
     * removed ref_count from pinputfile it's not used
 
   Revision 1.1  2000/10/31 22:02:53  peter
     * symtable splitted, no real code changes
 
-}
+}

+ 7 - 3
compiler/t_nwm.pas

@@ -117,7 +117,7 @@ interface
 implementation
 
   uses
-    cutils,verbose,cobjects,systems,globtype,globals,
+    cutils,verbose,systems,globtype,globals,
     symconst,script,
     fmodule,aasm,cpuasm,cpubase,symsym;
 
@@ -424,7 +424,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.3  2000-10-31 22:02:55  peter
+  Revision 1.4  2000-11-29 00:30:42  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.3  2000/10/31 22:02:55  peter
     * symtable splitted, no real code changes
 
   Revision 1.2  2000/09/24 15:06:31  peter
@@ -434,4 +438,4 @@ end.
     + first implementation of Netware Module support, thanks to
       Armin Diehl ([email protected]) for providing the patches
 
-}
+}

+ 7 - 11
compiler/temp_gen.pas

@@ -84,15 +84,7 @@ interface
   implementation
 
     uses
-       cutils,scanner,systems
-{$ifdef i386}
-       ,cgai386
-{$endif i386}
-{$ifdef m68k}
-       ,cga68k
-{$endif m68k}
-       ;
-
+       cutils,systems;
 
     procedure resettempgen;
       var
@@ -557,7 +549,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.6  2000-11-04 14:25:22  florian
+  Revision 1.7  2000-11-29 00:30:42  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.6  2000/11/04 14:25:22  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.5  2000/09/30 16:08:45  peter
@@ -573,4 +569,4 @@ end.
   Revision 1.2  2000/07/13 11:32:52  michael
   + removed logs
 
-}
+}

+ 0 - 339
compiler/tgen68k.pas

@@ -1,339 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2000 by Florian Klaempfl, Carl Eric Codere
-
-    This unit handles the temporary variables stuff for m68k
-
-    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 tgen68k;
-
-{$i defines.inc}
-
-interface
-
-    uses
-       cobjects,globals,tree,hcodegen,verbose,files,aasm,cpubase;
-
-    type
-       tregisterset = set of tregister;
-       tpushed = array[R_D0..R_A6] of boolean;
-
-    const
-       { D2 to D5 usable as scratch registers }
-       usablereg32 : byte = 4;
-       { A2 to A4 usable as address registers }
-       usableaddress: byte = 3;
-       { FP2 to FP7 usable as FPU registers   }
-       usablefloatreg : byte = 6;
-
-    function getregister32 : tregister;
-    procedure ungetregister32(r : tregister);
-    { return a free 32-bit address register }
-    function getaddressreg: tregister;
-
-    procedure ungetregister(r : tregister);
-
-    procedure cleartempgen;
-
-    function getfloatreg: tregister;
-    { returns a free floating point register }
-    { used in real, fpu mode, otherwise we   }
-    { must use standard register allocation  }
-
-    procedure del_reference(const ref : treference);
-    procedure del_locref(const location : tlocation);
-
-
-    { pushs and restores registers }
-    procedure pushusedregisters(var pushed : tpushed;b : word);
-    procedure popusedregisters(const pushed : tpushed);
-
-    procedure clearregistercount;
-    procedure resetusableregisters;
-
-    var
-       unused,usableregs : tregisterset;
-       c_usableregs : longint;
-
-       usedinproc : word;
-
-       { count, how much a register must be pushed if it is used as register }
-       { variable                                                            }
-       reg_pushes : array[R_D0..R_A6] of longint;
-       is_reg_var : array[R_D0..R_A6] of boolean;
-
-  implementation
-
-
-    function getusableaddr: byte;
-    { Since address registers are different then data registers }
-    { we check the unused register list to determine the number }
-    { of address registers which are available.                 }
-    var
-      i: byte;
-    Begin
-      i:=0;
-      if R_A2 in unused then
-        Inc(i);
-      if R_A3 in unused then
-        Inc(i);
-      if R_A4 in unused then
-         Inc(i);
-      getusableaddr:=i;
-    end;
-
-    procedure pushusedregisters(var pushed : tpushed;b : word);
-
-      var
-         r : tregister;
-
-      begin
-         { the following registers can be pushed }
-         { D0, D1, D2, D3, D4, D5, D6, D7, A0    }
-         { A1, A2, A3, A4                        }
-         for r:=R_D2 to R_A4 do
-           begin
-              pushed[r]:=false;
-              { if the register is used by the calling subroutine    }
-              if ((b and ($800 shr word(r)))<>0) then
-                begin
-                   { and is present in use }
-                   if not(r in unused) then
-                     begin
-                        { then save it }
-                        { then save it on the stack }
-                        exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,r,R_SPPUSH)));
-                        { here was a big problem  !!!!!}
-                        { you cannot do that for a register that is
-                        globally assigned to a var
-                        this also means that you must push it much more
-                        often, but there must be a better way
-                        maybe by putting the value back to the stack !! }
-                        if not(is_reg_var[r]) then
-                          unused:=unused+[r];
-                        pushed[r]:=true;
-                     end;
-                end;
-           end;
-      end;
-
-    procedure popusedregisters(const pushed : tpushed);
-
-      var
-         r : tregister;
-
-      begin
-         for r:=R_A4 downto R_D2 do
-           if pushed[r] then
-             begin
-                exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_SPPULL,r)));
-                unused:=unused-[r];
-             end;
-      end;
-
-    procedure ungetregister(r : tregister);
-
-      begin
-           ungetregister32(r)
-      end;
-
-
-    procedure del_reference(const ref : treference);
-
-      begin
-         if ref.isintvalue then
-           exit;
-         ungetregister(ref.base);
-         ungetregister32(ref.index);
-      end;
-
-    procedure del_locref(const location : tlocation);
-
-      begin
-         if (location.loc<>loc_mem) and (location.loc<>loc_reference) then
-           exit;
-         if location.reference.isintvalue then
-           exit;
-         ungetregister(location.reference.base);
-         ungetregister32(location.reference.index);
-      end;
-
-    procedure ungetregister32(r : tregister);
-
-      begin
-         if r in [R_D2,R_D3,R_D4,R_D5,R_D7] then
-          begin
-             unused:=unused+[r];
-             inc(usablereg32);
-          end
-         else
-         if r in [R_FP2,R_FP3,R_FP4,R_FP5,R_FP6,R_FP7] then
-         begin
-              unused:=unused+[r];
-              inc(usablefloatreg);
-         end
-         else
-         if r in [R_A2,R_A3,R_A4] then
-           begin
-              unused:=unused+[r];
-              inc(usableaddress);
-           end;
-        { other registers are RESERVED and should not be freed }
-      end;
-
-
-    function getfloatreg: tregister;
-    { returns a free floating point register }
-    { used in real, fpu mode, otherwise we   }
-    { must use standard register allocation  }
-    var
-     i:tregister;
-    begin
-      dec(usablefloatreg);
-      if usablefloatreg = 0 then
-       Message(cg_f_internal_error_in_getfloatreg);
-      for i:=R_FP2 to R_FP7 do
-      begin
-         if i in unused then
-         begin
-           unused := unused-[i];
-           getfloatreg := i;
-           exit;
-         end;
-      end;
-      { if we are here, then there was an allocation failure }
-      Message(cg_f_internal_error_in_getfloatreg);
-    end;
-
-
-    function getaddressreg: tregister;
-
-     begin
-         dec(usableaddress);
-         if R_A2 in unused then
-           begin
-              unused:=unused-[R_A2];
-              usedinproc:=usedinproc or ($800 shr word(R_A2));
-              getaddressreg:=R_A2;
-           end
-         else
-         if R_A3 in unused then
-           begin
-              unused:=unused-[R_A3];
-              usedinproc:=usedinproc or ($800 shr word(R_A3));
-              getaddressreg:=R_A3;
-           end
-         else
-         if R_A4 in unused then
-           begin
-              unused:=unused-[R_A4];
-              usedinproc:=usedinproc or ($800 shr word(R_A4));
-              getaddressreg:=R_A4;
-           end
-         else
-         begin
-           internalerror(10);
-         end;
-
-     end;
-
-    function getregister32 : tregister;
-      begin
-         dec(usablereg32);
-         if R_D2 in unused then
-           begin
-              unused:=unused-[R_D2];
-              usedinproc:=usedinproc or ($800 shr word(R_D2));
-              getregister32:=R_D2;
-           end
-         else if R_D3 in unused then
-           begin
-              unused:=unused-[R_D3];
-              usedinproc:=usedinproc or ($800 shr word(R_D3));
-              getregister32:=R_D3;
-           end
-         else if R_D4 in unused then
-           begin
-              unused:=unused-[R_D4];
-              usedinproc:=usedinproc or ($800 shr word(R_D4));
-              getregister32:=R_D4;
-           end
-         else if R_D5 in unused then
-           begin
-             unused:=unused-[R_D5];
-             usedinproc:=usedinproc or ($800 shr word(R_D5));
-             getregister32:=R_D5;
-           end
-         else if R_D7 in unused then
-           begin
-             unused:=unused-[R_D7];
-             usedinproc:=usedinproc or ($800 shr word(R_D7));
-             getregister32:=R_D7;
-           end
-         else
-         begin
-          internalerror(10);
-         end;
-      end;
-
-    procedure cleartempgen;
-
-      begin
-         unused:=usableregs;
-         usablereg32:=c_usableregs;
-         usableaddress:=getusableaddr;
-      end;
-
-
-   procedure clearregistercount;
-     var
-       regi : tregister;
-     begin
-       for regi:=R_D0 to R_A6 do
-         begin
-           reg_pushes[regi]:=0;
-           is_reg_var[regi]:=false;
-         end;
-     end;
-
-
-
-   procedure resetusableregisters;
-     begin
-       usableregs:=[R_D0,R_D1,R_D2,R_D3,R_D4,R_D5,R_D6,R_D7,R_A0,R_A1,R_A2,R_A3,R_A4,
-             R_FP0,R_FP1,R_FP2,R_FP3,R_FP4,R_FP5,R_FP6,R_FP7];
-       c_usableregs:=4;
-       usableaddress:=3;
-       usablefloatreg:=6;
-     end;
-
-
-
-
-begin
-  resetusableregisters;
-end.
-{
-  $Log$
-  Revision 1.3  2000-09-24 15:06:31  peter
-    * use defines.inc
-
-  Revision 1.2  2000/07/13 11:32:52  michael
-  + removed logs
-
-}

+ 9 - 1
compiler/tokens.pas

@@ -78,6 +78,8 @@ type
     _INTCONST,
     _CSTRING,
     _CCHAR,
+    _CWSTRING,
+    _CWCHAR,
     { C like operators }
     _PLUSASN,
     _MINUSASN,
@@ -286,6 +288,8 @@ const
       (str:'ordinal const' ;special:true ;keyword:m_none;op:NOTOKEN),
       (str:'const string'  ;special:true ;keyword:m_none;op:NOTOKEN),
       (str:'const char'    ;special:true ;keyword:m_none;op:NOTOKEN),
+      (str:'const wstring' ;special:true ;keyword:m_none;op:NOTOKEN),
+      (str:'const wchar'   ;special:true ;keyword:m_none;op:NOTOKEN),
     { C like operators }
       (str:'+='            ;special:true ;keyword:m_none;op:NOTOKEN),
       (str:'-='            ;special:true ;keyword:m_none;op:NOTOKEN),
@@ -474,7 +478,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.6  2000-11-09 17:46:56  florian
+  Revision 1.7  2000-11-29 00:30:42  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.6  2000/11/09 17:46:56  florian
     * System.TypeInfo fixed
     + System.Finalize implemented
     + some new keywords for interface support added

+ 7 - 3
compiler/verbose.pas

@@ -97,7 +97,7 @@ procedure DoneVerbose;
 implementation
 uses
   comphook,
-  version,globals;
+  globals;
 
 var
   redirexitsave  : pointer;
@@ -626,7 +626,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.7  2000-10-31 22:02:55  peter
+  Revision 1.8  2000-11-29 00:30:43  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.7  2000/10/31 22:02:55  peter
     * symtable splitted, no real code changes
 
   Revision 1.6  2000/09/24 21:33:48  peter
@@ -648,4 +652,4 @@ end.
   Revision 1.2  2000/07/13 11:32:54  michael
   + removed logs
 
-}
+}

+ 11 - 1
compiler/version.pas

@@ -60,6 +60,9 @@ interface
 {$ifdef powerpc}
        target_cpu_string = 'powerpc';
 {$endif}
+{$ifdef ia64}
+       target_cpu_string = 'ia64';
+{$endif}
 
        { source cpu string }
 {$ifdef cpu86}
@@ -68,6 +71,9 @@ interface
 {$ifdef cpu68}
         source_cpu_string = 'm68k';
 {$endif}
+{$ifdef cpuia64}
+       target_cpu_string = 'ia64';
+{$endif}
 
 function version_string:string;
 function full_version_string:string;
@@ -95,7 +101,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.6  2000-09-24 15:06:33  peter
+  Revision 1.7  2000-11-29 00:30:43  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+  Revision 1.6  2000/09/24 15:06:33  peter
     * use defines.inc
 
   Revision 1.5  2000/07/14 05:14:10  michael

+ 187 - 0
compiler/widestr.pas

@@ -0,0 +1,187 @@
+{
+    $Id$
+    Copyright (c) 2000 by Florian Klaempfl
+
+    This unit contains basic functions for unicode support in the
+    compiler, this unit is mainly necessary to bootstrap widestring
+    support ...
+
+    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 widestr;
+
+  interface
+
+{    uses
+       charset;
+}
+
+    type
+       tcompilerwidechar = word;
+       pcompilerwidechar = ^tcompilerwidechar;
+
+       pcompilerwidestring = ^tcompilerwidestring;
+       tcompilerwidestring = record
+          data : pcompilerwidechar;
+          maxlen,len : longint;
+       end;
+
+    procedure initwidestring(var r : tcompilerwidestring);
+    procedure donewidestring(var r : tcompilerwidestring);
+    procedure setlengthwidestring(var r : tcompilerwidestring;l : longint);
+    function getlengthwidestring(const r : tcompilerwidestring) : longint;
+    procedure concatwidestringchar(var r : tcompilerwidestring;c : tcompilerwidechar);
+    procedure concatwidestringwidestring(const s1,s2 : tcompilerwidestring;
+      var r : tcompilerwidestring);
+    procedure copywidestring(const s : tcompilerwidestring;var d : tcompilerwidestring);
+    function asciichar2unicode(c : char) : tcompilerwidechar;
+    procedure ascii2unicode(const s : string;var r : tcompilerwidestring);
+    function getcharwidestring(const r : tcompilerwidestring;l : longint) : tcompilerwidechar;
+    function cpavailable(const s : string) : boolean;
+
+  implementation
+
+{    uses
+       i8869_1,cp850,cp437; }
+
+    uses
+       globals;
+
+    procedure initwidestring(var r : tcompilerwidestring);
+
+      begin
+         r.data:=nil;
+         r.len:=0;
+         r.maxlen:=0;
+      end;
+
+    procedure donewidestring(var r : tcompilerwidestring);
+
+      begin
+         if assigned(r.data) then
+           freemem(r.data);
+         r.data:=nil;
+         r.maxlen:=0;
+         r.len:=0;
+      end;
+
+    function getcharwidestring(const r : tcompilerwidestring;l : longint) : tcompilerwidechar;
+
+      begin
+         getcharwidestring:=r.data[l];
+      end;
+
+    function getlengthwidestring(const r : tcompilerwidestring) : longint;
+
+      begin
+         getlengthwidestring:=r.len;
+      end;
+
+    procedure setlengthwidestring(var r : tcompilerwidestring;l : longint);
+
+      begin
+         if r.maxlen>=l then
+           exit;
+         if assigned(r.data) then
+           reallocmem(r.data,sizeof(tcompilerwidechar)*l)
+         else
+           getmem(r.data,sizeof(tcompilerwidechar)*l);
+      end;
+
+    procedure concatwidestringchar(var r : tcompilerwidestring;c : tcompilerwidechar);
+
+      begin
+         if r.len>=r.maxlen then
+           setlengthwidestring(r,r.len+16);
+         r.data[r.len]:=c;
+         inc(r.len);
+      end;
+
+    procedure concatwidestringwidestring(const s1,s2 : tcompilerwidestring;
+      var r : tcompilerwidestring);
+
+      begin
+         setlengthwidestring(r,s1.len+s2.len);
+         r.len:=s1.len+s2.len;
+         move(s1.data^,r.data^,s1.len);
+         move(s2.data^,r.data[s1.len],s2.len);
+      end;
+
+    function comparewidestringwidestring(const s1,s2 : tcompilerwidestring) : longint;
+
+      begin
+         { !!!! }
+      end;
+
+    procedure copywidestring(const s : tcompilerwidestring;var d : tcompilerwidestring);
+
+      begin
+         setlengthwidestring(d,s.len);
+         d.len:=s.len;
+         move(s.data^,d.data^,s.len);
+      end;
+
+    function asciichar2unicode(c : char) : tcompilerwidechar;
+{!!!!!!!!
+      var
+         m : punicodemap;
+
+      begin
+         m:=getmap(aktsourcecodepage);
+         asciichar2unicode:=getunicode(c,m);
+      end;
+}
+      begin
+      end;
+
+    procedure ascii2unicode(const s : string;var r : tcompilerwidestring);
+{!!!!!!
+      var
+         m : punicodemap;
+         i : longint;
+
+      begin
+         m:=getmap(aktsourcecodepage);
+         { should be a very good estimation :) }
+         setlengthwidestring(r,length(s));
+         // !!!! MBCS
+         for i:=1 to length(s) do
+           begin
+           end;
+      end;
+}
+      begin
+      end;
+
+    function cpavailable(const s : string) : boolean;
+{!!!!!!
+      begin
+          cpavailable:=mappingavailable(s);
+      end;
+}
+
+      begin
+      end;
+
+end.
+{
+  $Log$
+  Revision 1.1  2000-11-29 00:30:43  florian
+    * unused units removed from uses clause
+    * some changes for widestrings
+
+}