From 714901ce45b6d2e618b9e6c5d7ccdc079ef749bb Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 4 Oct 2014 18:12:09 +0000 Subject: [PATCH] * fixes feature defines after recent changes git-svn-id: trunk@28743 - --- rtl/inc/file.inc | 8 ++++++-- rtl/inc/system.inc | 17 +++++++++++++++++ rtl/inc/systemh.inc | 3 ++- rtl/inc/text.inc | 39 +++++++++++++++++++++++++++++---------- 4 files changed, 54 insertions(+), 13 deletions(-) diff --git a/rtl/inc/file.inc b/rtl/inc/file.inc index 8b986df03f..464fcd7f36 100644 --- a/rtl/inc/file.inc +++ b/rtl/inc/file.inc @@ -441,6 +441,7 @@ Begin End; +{$ifdef FPC_HAS_FEATURE_WIDESTRINGS} Procedure Rename(var f : File; const S : UnicodeString);[IOCheck]; {$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API} var @@ -471,8 +472,10 @@ Begin {$endif FPC_ANSI_TEXTFILEREC} {$endif FPCRTL_FILESYSTEM_SINGLE_BYTE_API} End; +{$endif FPC_HAS_FEATURE_WIDESTRINGS} +{$ifdef FPC_HAS_FEATURE_ANSISTRINGS} Procedure Rename(var f : File;const s : RawByteString);[IOCheck]; var {$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API} @@ -517,6 +520,7 @@ Begin FileRec(f).Name:=fs {$endif FPC_ANSI_TEXTFILEREC and not FPCRTL_FILESYSTEM_SINGLE_BYTE_API} End; +{$endif FPC_HAS_FEATURE_ANSISTRINGS} Procedure Rename(var f : File;const s : ShortString);[IOCheck]; @@ -542,7 +546,7 @@ Begin End; {$else FPC_HAS_FEATURE_ANSISTRINGS} var - len: SizeInt + len: SizeInt; Begin if InOutRes<>0 then exit; @@ -551,7 +555,7 @@ Begin InOutRes:=102; exit; end; - Do_Rename(PFileTextRecChar(@FileRec(f).Name),p,false); + Do_Rename(PFileTextRecChar(@FileRec(f).Name),p,false,false); { check error code of do_rename } if InOutRes=0 then begin diff --git a/rtl/inc/system.inc b/rtl/inc/system.inc index 79682369d3..ea7a80d7c0 100644 --- a/rtl/inc/system.inc +++ b/rtl/inc/system.inc @@ -1519,6 +1519,7 @@ begin end; +{$ifdef FPC_HAS_FEATURE_ANSISTRINGS} procedure DoDirSeparators(var ps:RawByteString); var i : longint; @@ -1538,7 +1539,10 @@ begin p[i-1]:=DirectorySeparator; end; end; +{$endif FPC_HAS_FEATURE_ANSISTRINGS} + +{$ifdef FPC_HAS_FEATURE_UNICODESTRINGS} procedure DoDirSeparators(var ps:UnicodeString); var i : longint; @@ -1558,6 +1562,7 @@ begin p[i-1]:=DirectorySeparator; end; end; +{$endif FPC_HAS_FEATURE_UNICODESTRINGS} {$endif FPC_HAS_FEATURE_FILEIO} @@ -1642,8 +1647,20 @@ end; {$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 v10 then @@ -266,6 +271,7 @@ Begin End; +{$ifdef FPC_HAS_FEATURE_WIDESTRINGS} Procedure Rename(var t : Text;const s : unicodestring);[IOCheck]; {$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API} var @@ -296,8 +302,11 @@ Begin {$endif FPC_ANSI_TEXTFILEREC} {$endif FPCRTL_FILESYSTEM_SINGLE_BYTE_API} End; +{$endif FPC_HAS_FEATURE_WIDESTRINGS} + +{$ifdef FPC_HAS_FEATURE_ANSISTRINGS} Procedure Rename(var t : Text;const s : rawbytestring);[IOCheck]; var {$ifdef FPCRTL_FILESYSTEM_SINGLE_BYTE_API} @@ -342,6 +351,7 @@ Begin TextRec(t).Name:=fs {$endif FPC_ANSI_TEXTTextRec and not FPCRTL_FILESYSTEM_SINGLE_BYTE_API} End; +{$endif FPC_HAS_FEATURE_ANSISTRINGS} Procedure Rename(var t : Text;const s : ShortString);[IOCheck]; @@ -366,16 +376,16 @@ Begin End; {$else FPC_HAS_FEATURE_ANSISTRINGS} var - len: SizeInt + len: SizeInt; Begin if InOutRes<>0 then exit; - if TextRec(f).mode<>fmClosed then + if TextRec(t).mode<>fmClosed then begin InOutRes:=102; exit; end; - Do_Rename(PFileTextRecChar(@TextRec(t).Name),p,false); + Do_Rename(PFileTextRecChar(@TextRec(t).Name),p,false,false); { check error code of do_rename } if InOutRes=0 then begin @@ -602,16 +612,17 @@ End; function GetTextCodePage(var T: Text): TSystemCodePage; begin -{$ifdef FPC_HAS_CPSTRING} +{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)} GetTextCodePage:=TextRec(T).CodePage; {$else} GetTextCodePage:=0; {$endif} end; + procedure SetTextCodePage(var T: Text; CodePage: TSystemCodePage); begin -{$ifdef FPC_HAS_CPSTRING} +{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)} TextRec(T).CodePage:=TranslatePlaceholderCP(CodePage); {$endif} end; @@ -631,7 +642,15 @@ end; Procedure fpc_textinit_iso(var t : Text;nr : DWord);compilerproc; begin +{$ifdef FPC_HAS_FEATURE_COMMANDARGS} 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); end; @@ -2450,9 +2469,9 @@ begin t.mode:=fmOutput; t.OpenFunc:=nil; t.CloseFunc:=nil; - {$ifdef FPC_HAS_CPSTRING} +{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)} t.CodePage:=TranslatePlaceholderCP(cp); - {$endif} +{$endif} end; @@ -2561,7 +2580,7 @@ begin t.mode:=fmInput; t.OpenFunc:=nil; t.CloseFunc:=nil; - {$ifdef FPC_HAS_CPSTRING} +{$if defined(FPC_HAS_CPSTRING) and defined(FPC_HAS_FEATURE_ANSISTRINGS)} t.CodePage:=TranslatePlaceholderCP(cp); {$endif} PSizeInt(@t.userdata[BytesReadIndex])^:=0;