* make compiler compilable with 2.4.4 rtl

git-svn-id: trunk@19269 -
This commit is contained in:
florian 2011-09-28 18:54:32 +00:00
parent 39d8ee1136
commit a6d01c09aa
12 changed files with 61 additions and 46 deletions

View File

@ -13,9 +13,6 @@
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}
unit ccharset;
@ -41,8 +38,8 @@ unit ccharset;
punicodemap = ^tunicodemap;
tunicodemap = record
cpname : string[20];
cp : word;
cpname : string[20];
cp : word;
map : punicodecharmapping;
lastchar : longint;
next : punicodemap;
@ -52,11 +49,15 @@ unit ccharset;
tcp2unicode = class(tcsconvert)
end;
const
DefaultSystemCodePage = 437;
function loadunicodemapping(const cpname,f : string; cp :word) : 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(cp :word) : boolean;
function getunicode(c : char;p : punicodemap) : tunicodechar;
function getascii(c : tunicodechar;p : punicodemap) : string;
@ -84,9 +85,9 @@ unit ccharset;
datasize:=256;
getmem(data,sizeof(tunicodecharmapping)*datasize);
assign(t,f);
{$push}{$I-}
{$I-}
reset(t);
{$pop}
{$I+}
if ioresult<>0 then
begin
freemem(data,sizeof(tunicodecharmapping)*datasize);
@ -202,7 +203,7 @@ unit ccharset;
hp:=hp^.next;
end;
getmap:=nil;
end;
end;////////
function getmap(cp : word) : punicodemap;
@ -232,7 +233,7 @@ unit ccharset;
hp:=hp^.next;
end;
getmap:=nil;
end;
end;
function mappingavailable(const s : string) : boolean;
@ -240,6 +241,12 @@ unit ccharset;
mappingavailable:=getmap(s)<>nil;
end;
function mappingavailable(cp : word) : boolean;
begin
mappingavailable:=getmap(cp)<>nil;
end;
function getunicode(c : char;p : punicodemap) : tunicodechar;
begin
@ -255,8 +262,8 @@ unit ccharset;
i : longint;
begin
{ at least map to space }
getascii:=#32;
{ at least map to '?' }
getascii:=#63;
for i:=0 to p^.lastchar do
if p^.map[i].unicode=c then
begin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,11 @@ uses
symconst,symtype,symdef,symsym,
verbose,fmodule,ppu,
aasmbase,aasmtai,aasmdata,
aasmcpu,asmutils;
aasmcpu,
{$if FPC_FULLVERSION<20700}
ccharset,
{$endif }
asmutils;
Type
{ 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 }
{ relocated before all other data, so make this data relocatable, }
{ 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));
end;

View File

@ -78,7 +78,7 @@ implementation
uses
widestr,
{$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2},
{$ifdef VER2_4}ccharset{$else VER2_4}charset{$endif VER2_4},
SysUtils,
version,
cutils,cmsgs,
@ -904,7 +904,7 @@ begin
'm' :
begin
s:=ExtractFileDir(more);
if TryStrToInt(ExtractFileName(more),j) then
if TryStrToInt(ExtractFileName(more),j) then
begin
unicodemapping:=loadunicodemapping(More,More+'.txt',j);
if assigned(unicodemapping) then
@ -2313,7 +2313,7 @@ begin
if (paratargetdbg in [dbg_dwarf2,dbg_dwarf3]) and
not(target_info.system in systems_darwin) then
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 }
if (cs_create_smart in init_settings.moduleswitches) and
not (af_outputbinary in target_asm.flags) then

View File

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

View File

@ -28,7 +28,7 @@ unit widestr;
interface
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
@ -59,7 +59,7 @@ unit widestr;
function cpavailable(const s : string) : boolean;
function cpavailable(cp : word) : boolean;
procedure changecodepage(
s : pchar; l : SizeInt; scp : tstringencoding;
s : pchar; l : SizeInt; scp : tstringencoding;
d : pchar; dcp : tstringencoding
);
function codepagebyname(const s : string) : tstringencoding;
@ -284,15 +284,15 @@ unit widestr;
function cpavailable(const s : string) : boolean;
begin
cpavailable:=mappingavailable(lower(s));
end;
end;
function cpavailable(cp : word) : boolean;
begin
cpavailable:=mappingavailable(cp);
end;
end;
procedure changecodepage(
s : pchar; l : SizeInt; scp : tstringencoding;
s : pchar; l : SizeInt; scp : tstringencoding;
d : pchar; dcp : tstringencoding
);
var
@ -311,7 +311,7 @@ unit widestr;
inc(dest);
inc(source);
end;
end;
end;
function codepagebyname(const s : string) : tstringencoding;
var
@ -320,7 +320,7 @@ unit widestr;
Result:=0;
p:=getmap(s);
if (p<>nil) then
Result:=p^.cp;
Result:=p^.cp;
end;
end.