Преглед на файлове

* make compiler compilable with 2.4.4 rtl

git-svn-id: trunk@19269 -
florian преди 14 години
родител
ревизия
a6d01c09aa
променени са 12 файла, в които са добавени 61 реда и са изтрити 46 реда
  1. 20 13
      compiler/ccharset.pas
  2. 3 3
      compiler/cp1251.pas
  3. 1 1
      compiler/cp1252.pp
  4. 2 2
      compiler/cp437.pas
  5. 3 3
      compiler/cp850.pas
  6. 3 3
      compiler/cp866.pas
  7. 4 4
      compiler/cp8859_1.pas
  8. 3 3
      compiler/cp8859_5.pas
  9. 6 2
      compiler/cresstr.pas
  10. 3 3
      compiler/options.pas
  11. 5 1
      compiler/scanner.pas
  12. 8 8
      compiler/widestr.pas

+ 20 - 13
compiler/ccharset.pas

@@ -13,9 +13,6 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
-
-{ this unit is included temporarily for 2.2 bootstrapping and can be
-  removed after the next release after 2.2.2 }
 {$mode objfpc}
 {$mode objfpc}
 unit ccharset;
 unit ccharset;
 
 
@@ -41,8 +38,8 @@ unit ccharset;
 
 
        punicodemap = ^tunicodemap;
        punicodemap = ^tunicodemap;
        tunicodemap = record
        tunicodemap = record
-          cpname : string[20];   
-          cp : word;           
+          cpname : string[20];
+          cp : word;
           map : punicodecharmapping;
           map : punicodecharmapping;
           lastchar : longint;
           lastchar : longint;
           next : punicodemap;
           next : punicodemap;
@@ -52,11 +49,15 @@ unit ccharset;
        tcp2unicode = class(tcsconvert)
        tcp2unicode = class(tcsconvert)
        end;
        end;
 
 
+    const
+       DefaultSystemCodePage = 437;
+
     function loadunicodemapping(const cpname,f : string; cp :word) : punicodemap;
     function loadunicodemapping(const cpname,f : string; cp :word) : punicodemap;
     procedure registermapping(p : punicodemap);
     procedure registermapping(p : punicodemap);
-    function getmap(const s : string) : punicodemap; 
-    function getmap(cp : word) : punicodemap;     
+    function getmap(const s : string) : punicodemap;
+    function getmap(cp : word) : punicodemap;
     function mappingavailable(const s : string) : boolean;
     function mappingavailable(const s : string) : boolean;
+    function mappingavailable(cp :word) : boolean;
     function getunicode(c : char;p : punicodemap) : tunicodechar;
     function getunicode(c : char;p : punicodemap) : tunicodechar;
     function getascii(c : tunicodechar;p : punicodemap) : string;
     function getascii(c : tunicodechar;p : punicodemap) : string;
 
 
@@ -84,9 +85,9 @@ unit ccharset;
          datasize:=256;
          datasize:=256;
          getmem(data,sizeof(tunicodecharmapping)*datasize);
          getmem(data,sizeof(tunicodecharmapping)*datasize);
          assign(t,f);
          assign(t,f);
-         {$push}{$I-}
+         {$I-}
          reset(t);
          reset(t);
-         {$pop}
+         {$I+}
          if ioresult<>0 then
          if ioresult<>0 then
            begin
            begin
               freemem(data,sizeof(tunicodecharmapping)*datasize);
               freemem(data,sizeof(tunicodecharmapping)*datasize);
@@ -202,7 +203,7 @@ unit ccharset;
               hp:=hp^.next;
               hp:=hp^.next;
            end;
            end;
          getmap:=nil;
          getmap:=nil;
-      end;    
+      end;////////
 
 
     function getmap(cp : word) : punicodemap;
     function getmap(cp : word) : punicodemap;
 
 
@@ -232,7 +233,7 @@ unit ccharset;
               hp:=hp^.next;
               hp:=hp^.next;
            end;
            end;
          getmap:=nil;
          getmap:=nil;
-      end;   
+      end;
 
 
     function mappingavailable(const s : string) : boolean;
     function mappingavailable(const s : string) : boolean;
 
 
@@ -240,6 +241,12 @@ unit ccharset;
          mappingavailable:=getmap(s)<>nil;
          mappingavailable:=getmap(s)<>nil;
       end;
       end;
 
 
+    function mappingavailable(cp : word) : boolean;
+
+      begin
+         mappingavailable:=getmap(cp)<>nil;
+      end;
+
     function getunicode(c : char;p : punicodemap) : tunicodechar;
     function getunicode(c : char;p : punicodemap) : tunicodechar;
 
 
       begin
       begin
@@ -255,8 +262,8 @@ unit ccharset;
          i : longint;
          i : longint;
 
 
       begin
       begin
-         { at least map to space }
-         getascii:=#32;
+         { at least map to '?' }
+         getascii:=#63;
          for i:=0 to p^.lastchar do
          for i:=0 to p^.lastchar do
            if p^.map[i].unicode=c then
            if p^.map[i].unicode=c then
              begin
              begin

+ 3 - 3
compiler/cp1251.pas

@@ -6,7 +6,7 @@ unit cp1251;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -269,8 +269,8 @@ unit cp1251;
      );
      );
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
-       cpname : 'cp1251'; 
-       cp : 1251;     
+       cpname : 'cp1251';
+       cp : 1251;
        map : @map;
        map : @map;
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 1 - 1
compiler/cp1252.pp

@@ -6,7 +6,7 @@ unit CP1252;
   implementation
   implementation
 
 
   uses
   uses
-     charset;
+     {$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (

+ 2 - 2
compiler/cp437.pas

@@ -6,7 +6,7 @@ unit cp437;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -270,7 +270,7 @@ unit cp437;
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
        cpname : 'cp437';
        cpname : 'cp437';
-       cp : 437;     
+       cp : 437;
        map : @map[0];
        map : @map[0];
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 3 - 3
compiler/cp850.pas

@@ -6,7 +6,7 @@ unit cp850;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -269,8 +269,8 @@ unit cp850;
      );
      );
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
-       cpname : 'cp850'; 
-       cp : 850;     
+       cpname : 'cp850';
+       cp : 850;
        map : @map[0];
        map : @map[0];
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 3 - 3
compiler/cp866.pas

@@ -6,7 +6,7 @@ unit cp866;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -269,8 +269,8 @@ unit cp866;
      );
      );
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
-       cpname : 'cp866'; 
-       cp : 866;     
+       cpname : 'cp866';
+       cp : 866;
        map : @map;
        map : @map;
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 4 - 4
compiler/cp8859_1.pas

@@ -6,7 +6,7 @@ unit cp8859_1;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -269,9 +269,9 @@ unit cp8859_1;
      );
      );
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
-       cpname : '8859-1'; 
-       cp : 28591;     
-       map : @map[0]; 
+       cpname : '8859-1';
+       cp : 28591;
+       map : @map[0];
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;
        internalmap : true
        internalmap : true

+ 3 - 3
compiler/cp8859_5.pas

@@ -6,7 +6,7 @@ unit cp8859_5;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -269,8 +269,8 @@ unit cp8859_5;
      );
      );
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
-       cpname : '8859-5'; 
-       cp : 28595;     
+       cpname : '8859-5';
+       cp : 28595;
        map : @map;
        map : @map;
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 6 - 2
compiler/cresstr.pas

@@ -37,7 +37,11 @@ uses
    symconst,symtype,symdef,symsym,
    symconst,symtype,symdef,symsym,
    verbose,fmodule,ppu,
    verbose,fmodule,ppu,
    aasmbase,aasmtai,aasmdata,
    aasmbase,aasmtai,aasmdata,
-   aasmcpu,asmutils;
+   aasmcpu,
+{$if FPC_FULLVERSION<20700}
+   ccharset,
+{$endif }
+   asmutils;
 
 
     Type
     Type
       { These are used to form a singly-linked list, ordered by hash value }
       { These are used to form a singly-linked list, ordered by hash value }
@@ -203,7 +207,7 @@ uses
         { Update: the Mac OS X 10.6 linker orders data that needs to be    }
         { Update: the Mac OS X 10.6 linker orders data that needs to be    }
         { relocated before all other data, so make this data relocatable,  }
         { relocated before all other data, so make this data relocatable,  }
         { otherwise the end label won't be moved with the rest             }
         { otherwise the end label won't be moved with the rest             }
-        if (target_info.system in systems_darwin) then   
+        if (target_info.system in systems_darwin) then
           current_asmdata.asmlists[al_resourcestrings].concat(Tai_const.create_sym(endsymlab));
           current_asmdata.asmlists[al_resourcestrings].concat(Tai_const.create_sym(endsymlab));
       end;
       end;
 
 

+ 3 - 3
compiler/options.pas

@@ -78,7 +78,7 @@ implementation
 
 
 uses
 uses
   widestr,
   widestr,
-  {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2},
+  {$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4},
   SysUtils,
   SysUtils,
   version,
   version,
   cutils,cmsgs,
   cutils,cmsgs,
@@ -904,7 +904,7 @@ begin
                  'm' :
                  'm' :
                    begin
                    begin
                      s:=ExtractFileDir(more);
                      s:=ExtractFileDir(more);
-                     if TryStrToInt(ExtractFileName(more),j) then 
+                     if TryStrToInt(ExtractFileName(more),j) then
                        begin
                        begin
                          unicodemapping:=loadunicodemapping(More,More+'.txt',j);
                          unicodemapping:=loadunicodemapping(More,More+'.txt',j);
                          if assigned(unicodemapping) then
                          if assigned(unicodemapping) then
@@ -2313,7 +2313,7 @@ begin
   if (paratargetdbg in [dbg_dwarf2,dbg_dwarf3]) and
   if (paratargetdbg in [dbg_dwarf2,dbg_dwarf3]) and
      not(target_info.system in systems_darwin) then
      not(target_info.system in systems_darwin) then
     begin
     begin
-      { smartlink creation does not yet work with DWARF 
+      { smartlink creation does not yet work with DWARF
         debug info on most targets, but it works in internal assembler }
         debug info on most targets, but it works in internal assembler }
       if (cs_create_smart in init_settings.moduleswitches) and
       if (cs_create_smart in init_settings.moduleswitches) and
          not (af_outputbinary in target_asm.flags) then
          not (af_outputbinary in target_asm.flags) then

+ 5 - 1
compiler/scanner.pas

@@ -268,7 +268,11 @@ implementation
       symbase,symtable,symtype,symsym,symconst,symdef,defutil,
       symbase,symtable,symtype,symsym,symconst,symdef,defutil,
       { This is needed for tcputype }
       { This is needed for tcputype }
       cpuinfo,
       cpuinfo,
-      fmodule;
+      fmodule
+{$ifdef FPC_FULLVERSION<20700}
+      ,ccharset
+{$endif}
+      ;
 
 
     var
     var
       { dictionaries with the supported directives }
       { dictionaries with the supported directives }

+ 8 - 8
compiler/widestr.pas

@@ -28,7 +28,7 @@ unit widestr;
   interface
   interface
 
 
     uses
     uses
-       {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2},globtype;
+       {$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4},globtype;
 
 
 
 
     type
     type
@@ -59,7 +59,7 @@ unit widestr;
     function cpavailable(const s : string) : boolean;
     function cpavailable(const s : string) : boolean;
     function cpavailable(cp : word) : boolean;
     function cpavailable(cp : word) : boolean;
     procedure changecodepage(
     procedure changecodepage(
-      s : pchar; l : SizeInt; scp : tstringencoding; 
+      s : pchar; l : SizeInt; scp : tstringencoding;
       d : pchar; dcp : tstringencoding
       d : pchar; dcp : tstringencoding
     );
     );
     function codepagebyname(const s : string) : tstringencoding;
     function codepagebyname(const s : string) : tstringencoding;
@@ -284,15 +284,15 @@ unit widestr;
     function cpavailable(const s : string) : boolean;
     function cpavailable(const s : string) : boolean;
       begin
       begin
           cpavailable:=mappingavailable(lower(s));
           cpavailable:=mappingavailable(lower(s));
-      end;  
-    
+      end;
+
     function cpavailable(cp : word) : boolean;
     function cpavailable(cp : word) : boolean;
       begin
       begin
           cpavailable:=mappingavailable(cp);
           cpavailable:=mappingavailable(cp);
-      end;     
+      end;
 
 
     procedure changecodepage(
     procedure changecodepage(
-      s : pchar; l : SizeInt; scp : tstringencoding; 
+      s : pchar; l : SizeInt; scp : tstringencoding;
       d : pchar; dcp : tstringencoding
       d : pchar; dcp : tstringencoding
     );
     );
       var
       var
@@ -311,7 +311,7 @@ unit widestr;
            inc(dest);
            inc(dest);
            inc(source);
            inc(source);
          end;
          end;
-      end;  
+      end;
 
 
     function codepagebyname(const s : string) : tstringencoding;
     function codepagebyname(const s : string) : tstringencoding;
       var
       var
@@ -320,7 +320,7 @@ unit widestr;
         Result:=0;
         Result:=0;
         p:=getmap(s);
         p:=getmap(s);
         if (p<>nil) then
         if (p<>nil) then
-          Result:=p^.cp; 
+          Result:=p^.cp;
       end;
       end;
 
 
 end.
 end.