mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 08:19:22 +02:00
* fixes feature defines after recent changes
git-svn-id: trunk@28743 -
This commit is contained in:
parent
ed11244632
commit
714901ce45
@ -441,6 +441,7 @@ Begin
|
|||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
|
{$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
|
||||||
Procedure Rename(var f : File; const S : UnicodeString);[IOCheck];
|
Procedure Rename(var f : File; const S : UnicodeString);[IOCheck];
|
||||||
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
||||||
var
|
var
|
||||||
@ -471,8 +472,10 @@ Begin
|
|||||||
{$endif FPC_ANSI_TEXTFILEREC}
|
{$endif FPC_ANSI_TEXTFILEREC}
|
||||||
{$endif FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
{$endif FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
||||||
End;
|
End;
|
||||||
|
{$endif FPC_HAS_FEATURE_WIDESTRINGS}
|
||||||
|
|
||||||
|
|
||||||
|
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
Procedure Rename(var f : File;const s : RawByteString);[IOCheck];
|
Procedure Rename(var f : File;const s : RawByteString);[IOCheck];
|
||||||
var
|
var
|
||||||
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
||||||
@ -517,6 +520,7 @@ Begin
|
|||||||
FileRec(f).Name:=fs
|
FileRec(f).Name:=fs
|
||||||
{$endif FPC_ANSI_TEXTFILEREC and not FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
{$endif FPC_ANSI_TEXTFILEREC and not FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
||||||
End;
|
End;
|
||||||
|
{$endif FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
|
|
||||||
|
|
||||||
Procedure Rename(var f : File;const s : ShortString);[IOCheck];
|
Procedure Rename(var f : File;const s : ShortString);[IOCheck];
|
||||||
@ -542,7 +546,7 @@ Begin
|
|||||||
End;
|
End;
|
||||||
{$else FPC_HAS_FEATURE_ANSISTRINGS}
|
{$else FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
var
|
var
|
||||||
len: SizeInt
|
len: SizeInt;
|
||||||
Begin
|
Begin
|
||||||
if InOutRes<>0 then
|
if InOutRes<>0 then
|
||||||
exit;
|
exit;
|
||||||
@ -551,7 +555,7 @@ Begin
|
|||||||
InOutRes:=102;
|
InOutRes:=102;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
Do_Rename(PFileTextRecChar(@FileRec(f).Name),p,false);
|
Do_Rename(PFileTextRecChar(@FileRec(f).Name),p,false,false);
|
||||||
{ check error code of do_rename }
|
{ check error code of do_rename }
|
||||||
if InOutRes=0 then
|
if InOutRes=0 then
|
||||||
begin
|
begin
|
||||||
|
@ -1519,6 +1519,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
procedure DoDirSeparators(var ps:RawByteString);
|
procedure DoDirSeparators(var ps:RawByteString);
|
||||||
var
|
var
|
||||||
i : longint;
|
i : longint;
|
||||||
@ -1538,7 +1539,10 @@ begin
|
|||||||
p[i-1]:=DirectorySeparator;
|
p[i-1]:=DirectorySeparator;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$endif FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
|
|
||||||
|
|
||||||
|
{$ifdef FPC_HAS_FEATURE_UNICODESTRINGS}
|
||||||
procedure DoDirSeparators(var ps:UnicodeString);
|
procedure DoDirSeparators(var ps:UnicodeString);
|
||||||
var
|
var
|
||||||
i : longint;
|
i : longint;
|
||||||
@ -1558,6 +1562,7 @@ begin
|
|||||||
p[i-1]:=DirectorySeparator;
|
p[i-1]:=DirectorySeparator;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$endif FPC_HAS_FEATURE_UNICODESTRINGS}
|
||||||
|
|
||||||
{$endif FPC_HAS_FEATURE_FILEIO}
|
{$endif FPC_HAS_FEATURE_FILEIO}
|
||||||
|
|
||||||
@ -1642,8 +1647,20 @@ end;
|
|||||||
|
|
||||||
{$endif FPC_HAS_FEATURE_FILEIO}
|
{$endif FPC_HAS_FEATURE_FILEIO}
|
||||||
|
|
||||||
|
{ helper for targets supporting no ansistrings, it is used
|
||||||
|
by non-ansistring code }
|
||||||
|
function min(v1,v2 : SizeInt) : SizeInt;
|
||||||
|
begin
|
||||||
|
if v1<v2 then
|
||||||
|
result:=v1
|
||||||
|
else
|
||||||
|
result:=v2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$ifdef FPC_HAS_FEATURE_TEXTIO}
|
||||||
{ Text file }
|
{ Text file }
|
||||||
{$i text.inc}
|
{$i text.inc}
|
||||||
|
{$endif FPC_HAS_FEATURE_TEXTIO}
|
||||||
|
|
||||||
{$ifdef FPC_HAS_FEATURE_FILEIO}
|
{$ifdef FPC_HAS_FEATURE_FILEIO}
|
||||||
{ Untyped file }
|
{ Untyped file }
|
||||||
|
@ -524,7 +524,8 @@ Type
|
|||||||
{ the size of textrec/filerec is hardcoded in the 2.6 compiler binary }
|
{ the size of textrec/filerec is hardcoded in the 2.6 compiler binary }
|
||||||
{$define FPC_ANSI_TEXTFILEREC}
|
{$define FPC_ANSI_TEXTFILEREC}
|
||||||
{$endif}
|
{$endif}
|
||||||
TFileTextRecChar = {$ifdef FPC_ANSI_TEXTFILEREC}AnsiChar{$else}UnicodeChar{$endif};
|
|
||||||
|
TFileTextRecChar = {$if defined(FPC_ANSI_TEXTFILEREC) or not(defined(FPC_HAS_FEATURE_WIDESTRINGS))}AnsiChar{$else}UnicodeChar{$endif};
|
||||||
PFileTextRecChar = ^TFileTextRecChar;
|
PFileTextRecChar = ^TFileTextRecChar;
|
||||||
|
|
||||||
TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
|
TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
|
||||||
|
@ -200,10 +200,15 @@ Begin
|
|||||||
TextRec(t).mode:=mode;
|
TextRec(t).mode:=mode;
|
||||||
TextRec(t).bufpos:=0;
|
TextRec(t).bufpos:=0;
|
||||||
TextRec(t).bufend:=0;
|
TextRec(t).bufend:=0;
|
||||||
{$ifdef FPC_HAS_CPSTRING}
|
|
||||||
|
{$ifdef FPC_HAS_CPSTRING}
|
||||||
|
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
{ if no codepage is yet assigned then assign default ansi codepage }
|
{ if no codepage is yet assigned then assign default ansi codepage }
|
||||||
TextRec(t).CodePage:=TranslatePlaceholderCP(TextRec(t).CodePage);
|
TextRec(t).CodePage:=TranslatePlaceholderCP(TextRec(t).CodePage);
|
||||||
{$endif}
|
{$else FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
|
TextRec(t).CodePage:=0;
|
||||||
|
{$endif FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
|
{$endif FPC_HAS_CPSTRING}
|
||||||
FileFunc(TextRec(t).OpenFunc)(TextRec(t));
|
FileFunc(TextRec(t).OpenFunc)(TextRec(t));
|
||||||
{ reset the mode to closed when an error has occured }
|
{ reset the mode to closed when an error has occured }
|
||||||
if InOutRes<>0 then
|
if InOutRes<>0 then
|
||||||
@ -266,6 +271,7 @@ Begin
|
|||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
|
{$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
|
||||||
Procedure Rename(var t : Text;const s : unicodestring);[IOCheck];
|
Procedure Rename(var t : Text;const s : unicodestring);[IOCheck];
|
||||||
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
||||||
var
|
var
|
||||||
@ -296,8 +302,11 @@ Begin
|
|||||||
{$endif FPC_ANSI_TEXTFILEREC}
|
{$endif FPC_ANSI_TEXTFILEREC}
|
||||||
{$endif FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
{$endif FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
||||||
End;
|
End;
|
||||||
|
{$endif FPC_HAS_FEATURE_WIDESTRINGS}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
Procedure Rename(var t : Text;const s : rawbytestring);[IOCheck];
|
Procedure Rename(var t : Text;const s : rawbytestring);[IOCheck];
|
||||||
var
|
var
|
||||||
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
{$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
||||||
@ -342,6 +351,7 @@ Begin
|
|||||||
TextRec(t).Name:=fs
|
TextRec(t).Name:=fs
|
||||||
{$endif FPC_ANSI_TEXTTextRec and not FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
{$endif FPC_ANSI_TEXTTextRec and not FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
|
||||||
End;
|
End;
|
||||||
|
{$endif FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
|
|
||||||
|
|
||||||
Procedure Rename(var t : Text;const s : ShortString);[IOCheck];
|
Procedure Rename(var t : Text;const s : ShortString);[IOCheck];
|
||||||
@ -366,16 +376,16 @@ Begin
|
|||||||
End;
|
End;
|
||||||
{$else FPC_HAS_FEATURE_ANSISTRINGS}
|
{$else FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
var
|
var
|
||||||
len: SizeInt
|
len: SizeInt;
|
||||||
Begin
|
Begin
|
||||||
if InOutRes<>0 then
|
if InOutRes<>0 then
|
||||||
exit;
|
exit;
|
||||||
if TextRec(f).mode<>fmClosed then
|
if TextRec(t).mode<>fmClosed then
|
||||||
begin
|
begin
|
||||||
InOutRes:=102;
|
InOutRes:=102;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
Do_Rename(PFileTextRecChar(@TextRec(t).Name),p,false);
|
Do_Rename(PFileTextRecChar(@TextRec(t).Name),p,false,false);
|
||||||
{ check error code of do_rename }
|
{ check error code of do_rename }
|
||||||
if InOutRes=0 then
|
if InOutRes=0 then
|
||||||
begin
|
begin
|
||||||
@ -602,16 +612,17 @@ End;
|
|||||||
|
|
||||||
function GetTextCodePage(var T: Text): TSystemCodePage;
|
function GetTextCodePage(var T: Text): TSystemCodePage;
|
||||||
begin
|
begin
|
||||||
{$ifdef FPC_HAS_CPSTRING}
|
{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
|
||||||
GetTextCodePage:=TextRec(T).CodePage;
|
GetTextCodePage:=TextRec(T).CodePage;
|
||||||
{$else}
|
{$else}
|
||||||
GetTextCodePage:=0;
|
GetTextCodePage:=0;
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure SetTextCodePage(var T: Text; CodePage: TSystemCodePage);
|
procedure SetTextCodePage(var T: Text; CodePage: TSystemCodePage);
|
||||||
begin
|
begin
|
||||||
{$ifdef FPC_HAS_CPSTRING}
|
{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
|
||||||
TextRec(T).CodePage:=TranslatePlaceholderCP(CodePage);
|
TextRec(T).CodePage:=TranslatePlaceholderCP(CodePage);
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
@ -631,7 +642,15 @@ end;
|
|||||||
|
|
||||||
Procedure fpc_textinit_iso(var t : Text;nr : DWord);compilerproc;
|
Procedure fpc_textinit_iso(var t : Text;nr : DWord);compilerproc;
|
||||||
begin
|
begin
|
||||||
|
{$ifdef FPC_HAS_FEATURE_COMMANDARGS}
|
||||||
assign(t,paramstr(nr));
|
assign(t,paramstr(nr));
|
||||||
|
{$else FPC_HAS_FEATURE_COMMANDARGS}
|
||||||
|
{ primitive workaround for targets supporting no command line arguments,
|
||||||
|
invent some file name, this will be fixed later on anways because
|
||||||
|
the current way of handling iso program parameters is apparently
|
||||||
|
wrong }
|
||||||
|
assign(t,chr((nr mod 16)+65));
|
||||||
|
{$endif FPC_HAS_FEATURE_COMMANDARGS}
|
||||||
reset(t);
|
reset(t);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2450,9 +2469,9 @@ begin
|
|||||||
t.mode:=fmOutput;
|
t.mode:=fmOutput;
|
||||||
t.OpenFunc:=nil;
|
t.OpenFunc:=nil;
|
||||||
t.CloseFunc:=nil;
|
t.CloseFunc:=nil;
|
||||||
{$ifdef FPC_HAS_CPSTRING}
|
{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
|
||||||
t.CodePage:=TranslatePlaceholderCP(cp);
|
t.CodePage:=TranslatePlaceholderCP(cp);
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -2561,7 +2580,7 @@ begin
|
|||||||
t.mode:=fmInput;
|
t.mode:=fmInput;
|
||||||
t.OpenFunc:=nil;
|
t.OpenFunc:=nil;
|
||||||
t.CloseFunc:=nil;
|
t.CloseFunc:=nil;
|
||||||
{$ifdef FPC_HAS_CPSTRING}
|
{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
|
||||||
t.CodePage:=TranslatePlaceholderCP(cp);
|
t.CodePage:=TranslatePlaceholderCP(cp);
|
||||||
{$endif}
|
{$endif}
|
||||||
PSizeInt(@t.userdata[BytesReadIndex])^:=0;
|
PSizeInt(@t.userdata[BytesReadIndex])^:=0;
|
||||||
|
Loading…
Reference in New Issue
Block a user