Browse Source

* Char -> AnsiChar

Michael VAN CANNEYT 2 years ago
parent
commit
4e9c267af9

+ 12 - 12
rtl/java/jastrings.inc

@@ -51,7 +51,7 @@ begin
     end;
     end;
   setlength(fdata,length+1);
   setlength(fdata,length+1);
   JLSystem.ArrayCopy(JLObject(@arr),0,JLObject(fdata),0,length);
   JLSystem.ArrayCopy(JLObject(@arr),0,JLObject(fdata),0,length);
-  // last char is already #0 because of setlength
+  // last AnsiChar is already #0 because of setlength
 end;
 end;
 
 
 
 
@@ -69,7 +69,7 @@ begin
     end;
     end;
   widestringmanager.Unicode2AnsiMoveProc(punicodechar(@arr),temp,cp,system.length(arr));
   widestringmanager.Unicode2AnsiMoveProc(punicodechar(@arr),temp,cp,system.length(arr));
   fdata:=AnsistringClass(temp).fdata;
   fdata:=AnsistringClass(temp).fdata;
-  // last char is already #0 because of Unicode2AnsiMoveProc()
+  // last AnsiChar is already #0 because of Unicode2AnsiMoveProc()
 end;
 end;
 
 
 
 
@@ -87,7 +87,7 @@ begin
     end;
     end;
   widestringmanager.Unicode2AnsiMoveProc(punicodechar(JLString(u).toCharArray),temp,cp,system.length(u));
   widestringmanager.Unicode2AnsiMoveProc(punicodechar(JLString(u).toCharArray),temp,cp,system.length(u));
   fdata:=AnsistringClass(temp).fdata;
   fdata:=AnsistringClass(temp).fdata;
-  // last char is already #0 because of Unicode2AnsiMoveProc()
+  // last AnsiChar is already #0 because of Unicode2AnsiMoveProc()
 end;
 end;
 
 
 
 
@@ -118,7 +118,7 @@ begin
   fCodePage:=cp;
   fCodePage:=cp;
   setlength(fdata,2);
   setlength(fdata,2);
   fdata[0]:=ch;
   fdata[0]:=ch;
-  // last char is already #0 because of setlength
+  // last AnsiChar is already #0 because of setlength
 end;
 end;
 
 
 
 
@@ -158,7 +158,7 @@ end;
 
 
 function AnsistringClass.toUnicodeString: unicodestring;
 function AnsistringClass.toUnicodeString: unicodestring;
 begin
 begin
-  widestringmanager.Ansi2UnicodeMoveProc(pchar(fdata),TranslatePlaceholderCP(fCodePage),result,system.length(fdata)-1);
+  widestringmanager.Ansi2UnicodeMoveProc(PAnsiChar(fdata),TranslatePlaceholderCP(fCodePage),result,system.length(fdata)-1);
 end;
 end;
 
 
 
 
@@ -235,7 +235,7 @@ begin
   if a<>'' then
   if a<>'' then
     result:=AnsistringClass(a).fdata
     result:=AnsistringClass(a).fdata
   else
   else
-    { empty pchar: array with one element that is #0 }
+    { empty PAnsiChar: array with one element that is #0 }
     setlength(result,1);
     setlength(result,1);
 end;
 end;
 
 
@@ -246,7 +246,7 @@ end;
 
 
 {$ifndef FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
 {$ifndef FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_ANSISTR_INTERN_CHARMOVE}
-procedure fpc_pchar_ansistr_intern_charmove(const src: pchar; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
+procedure fpc_pchar_ansistr_intern_charmove(const src: PAnsiChar; const srcindex: sizeint; var dst: rawbytestring; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   JLSystem.arraycopy(JLObject(src),srcindex,JLObject(AnsistringClass(dst).fdata),dstindex,len);
   JLSystem.arraycopy(JLObject(src),srcindex,JLObject(AnsistringClass(dst).fdata),dstindex,len);
 end;
 end;
@@ -255,7 +255,7 @@ end;
 
 
 {$ifndef FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
 {$ifndef FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
 {$define FPC_HAS_PCHAR_PCHAR_INTERN_CHARMOVE}
-procedure fpc_pchar_pchar_intern_charmove(const src: pchar; const srcindex: sizeint; const dst: pchar; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
+procedure fpc_pchar_pchar_intern_charmove(const src: PAnsiChar; const srcindex: sizeint; const dst: PAnsiChar; const dstindex, len: sizeint); {$ifdef FPC_HAS_CPSTRING}rtlproc;{$endif} {$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   JLSystem.arraycopy(JLObject(src),srcindex,JLObject(dst),dstindex,len);
   JLSystem.arraycopy(JLObject(src),srcindex,JLObject(dst),dstindex,len);
 end;
 end;
@@ -440,7 +440,7 @@ begin
       if assigned(p) then
       if assigned(p) then
         begin
         begin
           Size:=length(ansistring(p));
           Size:=length(ansistring(p));
-          fpc_pchar_pchar_intern_charmove(pchar(ansistring(p)),0,pchar(DestS),NewLen,Size+1);
+          fpc_pchar_pchar_intern_charmove(PAnsiChar(ansistring(p)),0,PAnsiChar(DestS),NewLen,Size+1);
           inc(NewLen,size);
           inc(NewLen,size);
         end;
         end;
     end;
     end;
@@ -767,9 +767,9 @@ end;
 
 
 
 
 {$define FPC_HAS_POS_ANSICHAR_ANSISTR}
 {$define FPC_HAS_POS_ANSICHAR_ANSISTR}
-{ Faster version for a char alone. Must be implemented because   }
-{ pos(c: char; const s: shortstring) also exists, so otherwise   }
-{ using pos(char,pchar) will always call the shortstring version }
+{ Faster version for a AnsiChar alone. Must be implemented because   }
+{ pos(c: AnsiChar; const s: shortstring) also exists, so otherwise   }
+{ using pos(AnsiChar,PAnsiChar) will always call the shortstring version }
 { (exact match for first argument), also with $h+ (JM)           }
 { (exact match for first argument), also with $h+ (JM)           }
 Function Pos(c : AnsiChar; Const s : RawByteString; Offset : Sizeint = 1) : SizeInt;var
 Function Pos(c : AnsiChar; Const s : RawByteString; Offset : Sizeint = 1) : SizeInt;var
   i: SizeInt;
   i: SizeInt;

+ 22 - 22
rtl/java/jcompproc.inc

@@ -53,9 +53,9 @@ procedure fpc_shortstr_append_shortstr(var s1:shortstring;const s2:shortstring);
 function fpc_shortstr_compare(const left,right:shortstring) : longint; compilerproc;
 function fpc_shortstr_compare(const left,right:shortstring) : longint; compilerproc;
 function fpc_shortstr_compare_equal(const left,right:shortstring) : longint; compilerproc;
 function fpc_shortstr_compare_equal(const left,right:shortstring) : longint; compilerproc;
 
 
-procedure fpc_pchar_to_shortstr(out res : shortstring;p:pchar); compilerproc;
+procedure fpc_pchar_to_shortstr(out res : shortstring;p:PAnsiChar); compilerproc;
 
 
-function fpc_pchar_length(p:pchar):sizeint; compilerproc;
+function fpc_pchar_length(p:PAnsiChar):sizeint; compilerproc;
 function fpc_pwidechar_length(p:pwidechar):sizeint; compilerproc;
 function fpc_pwidechar_length(p:pwidechar):sizeint; compilerproc;
 
 
 procedure fpc_chararray_to_shortstr(out res : shortstring;const arr: array of AnsiChar; zerobased: boolean = true); compilerproc;
 procedure fpc_chararray_to_shortstr(out res : shortstring;const arr: array of AnsiChar; zerobased: boolean = true); compilerproc;
@@ -66,7 +66,7 @@ function  fpc_char_copy(c:AnsiChar;index : SizeInt;count : SizeInt): shortstring
 {$ifndef VER3_0}
 {$ifndef VER3_0}
 Procedure fpc_shortstr_delete(var s:shortstring;index:SizeInt;count:SizeInt); compilerproc:fpc_in_delete_x_y_z;
 Procedure fpc_shortstr_delete(var s:shortstring;index:SizeInt;count:SizeInt); compilerproc:fpc_in_delete_x_y_z;
 Procedure fpc_shortstr_insert(const source:shortstring;var s:shortstring;index:SizeInt); compilerproc:fpc_in_insert_x_y_z;
 Procedure fpc_shortstr_insert(const source:shortstring;var s:shortstring;index:SizeInt); compilerproc:fpc_in_insert_x_y_z;
-Procedure fpc_shortstr_insert_char(source:Char;var s:shortstring;index:SizeInt); compilerproc:fpc_in_insert_x_y_z;
+Procedure fpc_shortstr_insert_char(source:AnsiChar;var s:shortstring;index:SizeInt); compilerproc:fpc_in_insert_x_y_z;
 {$endif VER3_0}
 {$endif VER3_0}
 
 
 (*
 (*
@@ -141,8 +141,8 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
 {$if defined(CPU16) or defined(CPU8)}
 {$if defined(CPU16) or defined(CPU8)}
   procedure fpc_shortstr_longword(v : longword;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_longword(v : longword;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_longint(v : longint;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_longint(v : longint;len : SizeInt;out s : shortstring); compilerproc;
-  procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of char); compilerproc;
-  procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of char); compilerproc;
+  procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of AnsiChar); compilerproc;
+  procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   procedure fpc_ansistr_longword(v : longword;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
   procedure fpc_ansistr_longword(v : longword;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
   procedure fpc_ansistr_longint(v : longint;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
   procedure fpc_ansistr_longint(v : longint;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
@@ -159,8 +159,8 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
 
 
   procedure fpc_shortstr_word(v : word;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_word(v : word;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_smallint(v : smallint;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_smallint(v : smallint;len : SizeInt;out s : shortstring); compilerproc;
-  procedure fpc_chararray_word(v : word;len : SizeInt;out a : array of char); compilerproc;
-  procedure fpc_chararray_smallint(v : smallint;len : SizeInt;out a : array of char); compilerproc;
+  procedure fpc_chararray_word(v : word;len : SizeInt;out a : array of AnsiChar); compilerproc;
+  procedure fpc_chararray_smallint(v : smallint;len : SizeInt;out a : array of AnsiChar); compilerproc;
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   procedure fpc_ansistr_word(v : word;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
   procedure fpc_ansistr_word(v : word;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
   procedure fpc_ansistr_smallint(v : smallint;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
   procedure fpc_ansistr_smallint(v : smallint;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
@@ -355,10 +355,10 @@ Function fpc_AnsiStr_To_WideStr (Const S2 : RawByteString): WideString; compiler
 Procedure fpc_WideStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
 Procedure fpc_WideStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
 Procedure fpc_WideStr_Concat (Var DestS : Widestring;const S1,S2 : WideString); compilerproc;
 Procedure fpc_WideStr_Concat (Var DestS : Widestring;const S1,S2 : WideString); compilerproc;
 Procedure fpc_WideStr_Concat_multi (Var DestS : Widestring;const sarr:array of Widestring); compilerproc;
 Procedure fpc_WideStr_Concat_multi (Var DestS : Widestring;const sarr:array of Widestring); compilerproc;
-Function fpc_Char_To_WideStr(const c : Char): WideString; compilerproc;
-Function fpc_PChar_To_WideStr(const p : pchar): WideString; compilerproc;
-Function fpc_CharArray_To_WideStr(const arr: array of char; zerobased: boolean = true): WideString; compilerproc;
-procedure fpc_widestr_to_chararray(out res: array of char; const src: WideString); compilerproc;
+Function fpc_Char_To_WideStr(const c : AnsiChar): WideString; compilerproc;
+Function fpc_PChar_To_WideStr(const p : PAnsiChar): WideString; compilerproc;
+Function fpc_CharArray_To_WideStr(const arr: array of AnsiChar; zerobased: boolean = true): WideString; compilerproc;
+procedure fpc_widestr_to_chararray(out res: array of AnsiChar; const src: WideString); compilerproc;
 procedure fpc_widestr_to_widechararray(out res: array of widechar; const src: WideString); compilerproc;
 procedure fpc_widestr_to_widechararray(out res: array of widechar; const src: WideString); compilerproc;
 Function fpc_WideStr_Compare(const S1,S2 : WideString): SizeInt; compilerproc;
 Function fpc_WideStr_Compare(const S1,S2 : WideString): SizeInt; compilerproc;
 Function fpc_WideStr_Compare_equal(const S1,S2 : WideString): SizeInt; compilerproc;
 Function fpc_WideStr_Compare_equal(const S1,S2 : WideString): SizeInt; compilerproc;
@@ -398,7 +398,7 @@ Procedure fpc_UnicodeStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
 Procedure fpc_UnicodeStr_Concat (Var DestS : Unicodestring;const S1,S2 : UnicodeString); compilerproc;
 Procedure fpc_UnicodeStr_Concat (Var DestS : Unicodestring;const S1,S2 : UnicodeString); compilerproc;
 Procedure fpc_UnicodeStr_Concat_multi (Var DestS : Unicodestring;const sarr:array of Unicodestring); compilerproc;
 Procedure fpc_UnicodeStr_Concat_multi (Var DestS : Unicodestring;const sarr:array of Unicodestring); compilerproc;
 Function fpc_Char_To_UnicodeStr(const c : AnsiChar): UnicodeString; compilerproc;
 Function fpc_Char_To_UnicodeStr(const c : AnsiChar): UnicodeString; compilerproc;
-Function fpc_PChar_To_UnicodeStr(const p : pchar): UnicodeString; compilerproc;
+Function fpc_PChar_To_UnicodeStr(const p : PAnsiChar): UnicodeString; compilerproc;
 Function fpc_CharArray_To_UnicodeStr(const arr: array of AnsiChar; zerobased: boolean = true): UnicodeString; compilerproc;
 Function fpc_CharArray_To_UnicodeStr(const arr: array of AnsiChar; zerobased: boolean = true): UnicodeString; compilerproc;
 
 
 procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: UnicodeString); compilerproc;
 procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: UnicodeString); compilerproc;
@@ -449,9 +449,9 @@ Procedure fpc_Write_End(var f:Text); compilerproc;
 Procedure fpc_Writeln_End(var f:Text); compilerproc;
 Procedure fpc_Writeln_End(var f:Text); compilerproc;
 Procedure fpc_Write_Text_ShortStr(Len : Longint;var f : Text;const s : String); compilerproc;
 Procedure fpc_Write_Text_ShortStr(Len : Longint;var f : Text;const s : String); compilerproc;
 Procedure fpc_Write_Text_ShortStr_Iso(Len : Longint;var f : Text;const s : String); compilerproc;
 Procedure fpc_Write_Text_ShortStr_Iso(Len : Longint;var f : Text;const s : String); compilerproc;
-Procedure fpc_Write_Text_Pchar_as_Array(Len : Longint;var f : Text;const s : array of char; zerobased: boolean = true); compilerproc;
-Procedure fpc_Write_Text_Pchar_as_Array_Iso(Len : Longint;var f : Text;const s : array of char; zerobased: boolean = true); compilerproc;
-Procedure fpc_Write_Text_PChar_As_Pointer(Len : Longint;var f : Text;p : PChar); compilerproc;
+Procedure fpc_Write_Text_Pchar_as_Array(Len : Longint;var f : Text;const s : array of AnsiChar; zerobased: boolean = true); compilerproc;
+Procedure fpc_Write_Text_Pchar_as_Array_Iso(Len : Longint;var f : Text;const s : array of AnsiChar; zerobased: boolean = true); compilerproc;
+Procedure fpc_Write_Text_PChar_As_Pointer(Len : Longint;var f : Text;p : PAnsiChar); compilerproc;
 Procedure fpc_Write_Text_AnsiStr (Len : Longint; Var f : Text; const S : RawByteString); compilerproc;
 Procedure fpc_Write_Text_AnsiStr (Len : Longint; Var f : Text; const S : RawByteString); compilerproc;
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 Procedure fpc_Write_Text_WideStr (Len : Longint; Var f : Text; const S : WideString); compilerproc;
 Procedure fpc_Write_Text_WideStr (Len : Longint; Var f : Text; const S : WideString); compilerproc;
@@ -488,8 +488,8 @@ procedure fpc_write_text_enum(typinfo,ord2strindex:pointer;len:sizeint;var t:tex
 Procedure fpc_Write_Text_Currency(fixkomma,Len : Longint;var t : Text;c : Currency); compilerproc;
 Procedure fpc_Write_Text_Currency(fixkomma,Len : Longint;var t : Text;c : Currency); compilerproc;
 Procedure fpc_Write_Text_Boolean(Len : Longint;var t : Text;b : Boolean); compilerproc;
 Procedure fpc_Write_Text_Boolean(Len : Longint;var t : Text;b : Boolean); compilerproc;
 Procedure fpc_Write_Text_Boolean_Iso(Len : Longint;var t : Text;b : Boolean); compilerproc;
 Procedure fpc_Write_Text_Boolean_Iso(Len : Longint;var t : Text;b : Boolean); compilerproc;
-Procedure fpc_Write_Text_Char(Len : Longint;var t : Text;c : Char); compilerproc;
-Procedure fpc_Write_Text_Char_Iso(Len : Longint;var t : Text;c : Char); compilerproc;
+Procedure fpc_Write_Text_Char(Len : Longint;var t : Text;c : AnsiChar); compilerproc;
+Procedure fpc_Write_Text_Char_Iso(Len : Longint;var t : Text;c : AnsiChar); compilerproc;
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 Procedure fpc_Write_Text_WideChar(Len : Longint;var t : Text;c : WideChar); compilerproc;
 Procedure fpc_Write_Text_WideChar(Len : Longint;var t : Text;c : WideChar); compilerproc;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
@@ -546,8 +546,8 @@ Procedure fpc_Read_End(var f:Text); compilerproc;
 Procedure fpc_ReadLn_End(var f : Text); compilerproc;
 Procedure fpc_ReadLn_End(var f : Text); compilerproc;
 Procedure fpc_ReadLn_End_Iso(var f : Text); compilerproc;
 Procedure fpc_ReadLn_End_Iso(var f : Text); compilerproc;
 Procedure fpc_Read_Text_ShortStr(var f : Text;out s : String); compilerproc;
 Procedure fpc_Read_Text_ShortStr(var f : Text;out s : String); compilerproc;
-Procedure fpc_Read_Text_PChar_As_Pointer(var f : Text; const s : PChar); compilerproc;
-Procedure fpc_Read_Text_PChar_As_Array(var f : Text;out s : array of char; zerobased: boolean = false); compilerproc;
+Procedure fpc_Read_Text_PChar_As_Pointer(var f : Text; const s : PAnsiChar); compilerproc;
+Procedure fpc_Read_Text_PChar_As_Array(var f : Text;out s : array of AnsiChar; zerobased: boolean = false); compilerproc;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 Procedure fpc_Read_Text_AnsiStr(var f : Text;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
 Procedure fpc_Read_Text_AnsiStr(var f : Text;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
@@ -557,11 +557,11 @@ Procedure fpc_Read_Text_UnicodeStr(var f : Text;out us : UnicodeString); compile
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 Procedure fpc_Read_Text_WideStr(var f : Text;out ws : WideString); compilerproc;
 Procedure fpc_Read_Text_WideStr(var f : Text;out ws : WideString); compilerproc;
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
-Procedure fpc_Read_Text_Char(var f : Text; out c : char); compilerproc;
+Procedure fpc_Read_Text_Char(var f : Text; out c : AnsiChar); compilerproc;
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 procedure fpc_Read_Text_WideChar(var f : Text; out wc: widechar); compilerproc;
 procedure fpc_Read_Text_WideChar(var f : Text; out wc: widechar); compilerproc;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
-Procedure fpc_Read_Text_Char_Iso(var f : Text; out c : char); compilerproc;
+Procedure fpc_Read_Text_Char_Iso(var f : Text; out c : AnsiChar); compilerproc;
 Procedure fpc_Read_Text_SInt(var f : Text; out l :ValSInt); compilerproc;
 Procedure fpc_Read_Text_SInt(var f : Text; out l :ValSInt); compilerproc;
 Procedure fpc_Read_Text_SInt_Iso(var f : Text; out l : ValSInt); compilerproc;
 Procedure fpc_Read_Text_SInt_Iso(var f : Text; out l : ValSInt); compilerproc;
 Procedure fpc_Read_Text_UInt(var f : Text; out u :ValUInt); compilerproc;
 Procedure fpc_Read_Text_UInt(var f : Text; out u :ValUInt); compilerproc;
@@ -583,7 +583,7 @@ procedure fpc_Read_Text_Int64_Iso(var f : text; out i : int64); compilerproc;
 Procedure fpc_Read_Text_LongWord(var f : text; out q : longword); compilerproc;
 Procedure fpc_Read_Text_LongWord(var f : text; out q : longword); compilerproc;
 Procedure fpc_Read_Text_LongInt(var f : text; out i : longint); compilerproc;
 Procedure fpc_Read_Text_LongInt(var f : text; out i : longint); compilerproc;
 {$endif CPU16 or CPU8}
 {$endif CPU16 or CPU8}
-function fpc_GetBuf_Text(var f : Text) : pchar; compilerproc;
+function fpc_GetBuf_Text(var f : Text) : PAnsiChar; compilerproc;
 function fpc_GetBuf_TypedFile(var f : TypedFile) : pointer; compilerproc;
 function fpc_GetBuf_TypedFile(var f : TypedFile) : pointer; compilerproc;
 {$endif FPC_HAS_FEATURE_TEXTIO}
 {$endif FPC_HAS_FEATURE_TEXTIO}
 
 

+ 1 - 1
rtl/java/jsstringh.inc

@@ -36,7 +36,7 @@ type
     class function CreateFromLiteralStringBytes(const u: unicodestring): shortstring; static;
     class function CreateFromLiteralStringBytes(const u: unicodestring): shortstring; static;
     procedure FpcDeepCopy(dest: ShortstringClass);
     procedure FpcDeepCopy(dest: ShortstringClass);
     procedure copyFromAnsiCharArray(const arr: array of ansichar; maxlen: byte);
     procedure copyFromAnsiCharArray(const arr: array of ansichar; maxlen: byte);
-    procedure setChar(index: jint; char: ansichar);
+    procedure setChar(index: jint; AnsiChar: ansichar);
     function charAt(index: jint): ansichar;
     function charAt(index: jint): ansichar;
     function toUnicodeString: unicodestring;
     function toUnicodeString: unicodestring;
     function toAnsistring: ansistring;
     function toAnsistring: ansistring;

+ 10 - 10
rtl/java/jsstrings.inc

@@ -135,15 +135,15 @@ begin
 end;
 end;
 
 
 
 
-procedure ShortstringClass.setChar(index: jint; char: ansichar);
+procedure ShortstringClass.setChar(index: jint; AnsiChar: ansichar);
 begin
 begin
   { index is 1-based here }
   { index is 1-based here }
 
 
   { support accessing the length byte }
   { support accessing the length byte }
   if index=0 then
   if index=0 then
-    curlen:=ord(char)
+    curlen:=ord(AnsiChar)
   else
   else
-    fdata[index-1]:=char;
+    fdata[index-1]:=AnsiChar;
 end;
 end;
 
 
 
 
@@ -212,7 +212,7 @@ begin
 end;
 end;
 
 
 {$define FPC_HAS_SHORTSTR_CHARARRAY_INTERN_CHARMOVE}
 {$define FPC_HAS_SHORTSTR_CHARARRAY_INTERN_CHARMOVE}
-procedure fpc_shortstr_chararray_intern_charmove(const src: shortstring; out dst: array of char; const len: sizeint); {$ifdef SYSTEMINLINE}inline;{$endif}
+procedure fpc_shortstr_chararray_intern_charmove(const src: shortstring; out dst: array of AnsiChar; const len: sizeint); {$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   JLSystem.arraycopy(JLObject(ShortstringClass(@src).fdata),0,JLObject(@dst),0,len);
   JLSystem.arraycopy(JLObject(ShortstringClass(@src).fdata),0,JLObject(@dst),0,len);
 end;
 end;
@@ -264,8 +264,8 @@ end;
 
 
 
 
 {$define FPC_HAS_SHORTSTR_POS_CHAR}
 {$define FPC_HAS_SHORTSTR_POS_CHAR}
-{Faster when looking for a single char...}
-function pos(c:char;const s:shortstring; Offset: Sizeint = 1):SizeInt;
+{Faster when looking for a single AnsiChar...}
+function pos(c:AnsiChar;const s:shortstring; Offset: Sizeint = 1):SizeInt;
 var
 var
   i : SizeInt;
   i : SizeInt;
 begin
 begin
@@ -292,7 +292,7 @@ end;
 
 
 
 
 {$define FPC_UPCASE_CHAR}
 {$define FPC_UPCASE_CHAR}
-Function  upCase(c:Char):Char;
+Function  upCase(c:AnsiChar):AnsiChar;
 var
 var
   u : unicodestring;
   u : unicodestring;
   s: ansistring;
   s: ansistring;
@@ -314,7 +314,7 @@ end;
 
 
 
 
 {$define FPC_LOWERCASE_CHAR}
 {$define FPC_LOWERCASE_CHAR}
-Function  lowerCase(c:Char):Char; overload;
+Function  lowerCase(c:AnsiChar):AnsiChar; overload;
 var
 var
   u : unicodestring;
   u : unicodestring;
   s: ansistring;
   s: ansistring;
@@ -363,7 +363,7 @@ Function int_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; out Code
 
 
 
 
 {$define FPC_HAS_SETSTRING_SHORTSTR}
 {$define FPC_HAS_SETSTRING_SHORTSTR}
-Procedure fpc_setstring_shortstr(Out S : Shortstring; Buf : PChar; Len : SizeInt); compilerproc;
+Procedure fpc_setstring_shortstr(Out S : Shortstring; Buf : PAnsiChar; Len : SizeInt); compilerproc;
 begin
 begin
   If Len > High(S) then
   If Len > High(S) then
     Len := High(S);
     Len := High(S);
@@ -381,7 +381,7 @@ var
   c1, c2: Byte;
   c1, c2: Byte;
   i: Integer;
   i: Integer;
   L1, L2, Count: SizeInt;
   L1, L2, Count: SizeInt;
-  P1, P2: PChar;
+  P1, P2: PAnsiChar;
 begin
 begin
   L1 := Length(S1);
   L1 := Length(S1);
   L2 := Length(S2);
   L2 := Length(S2);

+ 18 - 18
rtl/java/jsystem.inc

@@ -245,7 +245,7 @@ begin
 end;
 end;
 
 
 
 
-procedure fillchar(var x;count : SizeInt;value : char);
+procedure fillchar(var x;count : SizeInt;value : AnsiChar);
 begin
 begin
   fillchar(x,count,byte(value));
   fillchar(x,count,byte(value));
 end;
 end;
@@ -257,7 +257,7 @@ begin
 end;
 end;
 
 
 
 
-function IndexChar(Const buf;len:SizeInt;b:char):SizeInt;
+function IndexChar(Const buf;len:SizeInt;b:AnsiChar):SizeInt;
 begin
 begin
   IndexChar:=IndexByte(Buf,Len,byte(B));
   IndexChar:=IndexByte(Buf,Len,byte(B));
 end;
 end;
@@ -1292,16 +1292,16 @@ End;
 
 
 
 
 {$ifdef FPC_HAS_FEATURE_HEAP}
 {$ifdef FPC_HAS_FEATURE_HEAP}
-function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint):ppchar; // const ?
-// Extra allocate reserveentries pchar's at the beginning (default param=0 after 1.0.x ?)
+function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint):PPAnsiChar; // const ?
+// Extra allocate reserveentries PAnsiChar's at the beginning (default param=0 after 1.0.x ?)
 // Note: for internal use by skilled programmers only
 // Note: for internal use by skilled programmers only
 // if "s" goes out of scope in the parent procedure, the pointer is dangling.
 // if "s" goes out of scope in the parent procedure, the pointer is dangling.
 
 
-var p   : ppchar;
+var p   : PPAnsiChar;
     i   : LongInt;
     i   : LongInt;
 begin
 begin
   if High(s)<Low(s) Then Exit(NIL);
   if High(s)<Low(s) Then Exit(NIL);
-  Getmem(p,sizeof(pchar)*(high(s)-low(s)+ReserveEntries+2));  // one more for NIL, one more
+  Getmem(p,sizeof(PAnsiChar)*(high(s)-low(s)+ReserveEntries+2));  // one more for NIL, one more
                                               // for cmd
                                               // for cmd
   if p=nil then
   if p=nil then
     begin
     begin
@@ -1311,29 +1311,29 @@ begin
       exit(NIL);
       exit(NIL);
     end;
     end;
   for i:=low(s) to high(s) do
   for i:=low(s) to high(s) do
-     p[i+Reserveentries]:=pchar(s[i]);
+     p[i+Reserveentries]:=PAnsiChar(s[i]);
   p[high(s)+1+Reserveentries]:=nil;
   p[high(s)+1+Reserveentries]:=nil;
   ArrayStringToPPchar:=p;
   ArrayStringToPPchar:=p;
 end;
 end;
 
 
 
 
-Function StringToPPChar(Var S:AnsiString;ReserveEntries:integer):ppchar;
+Function StringToPPChar(Var S:AnsiString;ReserveEntries:integer):PPAnsiChar;
 {
 {
-  Create a PPChar to structure of pchars which are the arguments specified
+  Create a PPAnsiChar to structure of pchars which are the arguments specified
   in the string S. Especially useful for creating an ArgV for Exec-calls
   in the string S. Especially useful for creating an ArgV for Exec-calls
 }
 }
 
 
 begin
 begin
-  StringToPPChar:=StringToPPChar(PChar(S),ReserveEntries);
+  StringToPPChar:=StringToPPChar(PAnsiChar(S),ReserveEntries);
 end;
 end;
 
 
 
 
-Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
+Function StringToPPChar(S: PAnsiChar;ReserveEntries:integer):PPAnsiChar;
 
 
 var
 var
   i,nr  : longint;
   i,nr  : longint;
-  Buf : ^char;
-  p   : ppchar;
+  Buf : ^AnsiChar;
+  p   : PPAnsiChar;
 
 
 begin
 begin
   buf:=s;
   buf:=s;
@@ -1357,7 +1357,7 @@ begin
            inc(buf);
            inc(buf);
        end;
        end;
    end;
    end;
-  getmem(p,(ReserveEntries+nr)*sizeof(pchar));
+  getmem(p,(ReserveEntries+nr)*sizeof(PAnsiChar));
   StringToPPChar:=p;
   StringToPPChar:=p;
   if p=nil then
   if p=nil then
    begin
    begin
@@ -1494,11 +1494,11 @@ end;
 
 
 {$ifdef FPC_HAS_FEATURE_FILEIO}
 {$ifdef FPC_HAS_FEATURE_FILEIO}
 { Allow slash and backslash as separators }
 { Allow slash and backslash as separators }
-procedure DoDirSeparators(var p: pchar; inplace: boolean = true);
+procedure DoDirSeparators(var p: PAnsiChar; inplace: boolean = true);
 var
 var
   i : longint;
   i : longint;
   len : sizeint;
   len : sizeint;
-  newp : pchar;
+  newp : PAnsiChar;
 begin
 begin
   len:=length(p);
   len:=length(p);
   newp:=nil;
   newp:=nil;
@@ -1553,7 +1553,7 @@ end;
 procedure DoDirSeparators(var ps:RawByteString);
 procedure DoDirSeparators(var ps:RawByteString);
 var
 var
   i : longint;
   i : longint;
-  p : pchar;
+  p : PAnsiChar;
   unique : boolean;
   unique : boolean;
 begin
 begin
   unique:=false;
   unique:=false;
@@ -1563,7 +1563,7 @@ begin
         if not unique then
         if not unique then
           begin
           begin
             uniquestring(ps);
             uniquestring(ps);
-            p:=pchar(ps);
+            p:=PAnsiChar(ps);
             unique:=true;
             unique:=true;
           end;
           end;
         p[i-1]:=DirectorySeparator;
         p[i-1]:=DirectorySeparator;

+ 17 - 17
rtl/java/jsystemh.inc

@@ -30,12 +30,12 @@
 Procedure Move(const source;var dest;count:SizeInt);
 Procedure Move(const source;var dest;count:SizeInt);
 Procedure FillChar(var x;count:SizeInt;Value:Byte);
 Procedure FillChar(var x;count:SizeInt;Value:Byte);
 Procedure FillChar(var x;count:SizeInt;Value:Boolean);
 Procedure FillChar(var x;count:SizeInt;Value:Boolean);
-Procedure FillChar(var x;count:SizeInt;Value:Char);
+Procedure FillChar(var x;count:SizeInt;Value:AnsiChar);
 procedure FillByte(var x;count:SizeInt;value:byte);
 procedure FillByte(var x;count:SizeInt;value:byte);
 Procedure FillWord(var x;count:SizeInt;Value:Word);
 Procedure FillWord(var x;count:SizeInt;Value:Word);
 procedure FillDWord(var x;count:SizeInt;value:DWord);
 procedure FillDWord(var x;count:SizeInt;value:DWord);
 procedure FillQWord(var x;count:SizeInt;value:QWord);
 procedure FillQWord(var x;count:SizeInt;value:QWord);
-function  IndexChar(const buf;len:SizeInt;b:char):SizeInt;
+function  IndexChar(const buf;len:SizeInt;b:AnsiChar):SizeInt;
 function  IndexByte(const buf;len:SizeInt;b:byte):SizeInt;
 function  IndexByte(const buf;len:SizeInt;b:byte):SizeInt;
 function  Indexword(const buf;len:SizeInt;b:word):SizeInt;
 function  Indexword(const buf;len:SizeInt;b:word):SizeInt;
 function  IndexDWord(const buf;len:SizeInt;b:DWord):SizeInt;
 function  IndexDWord(const buf;len:SizeInt;b:DWord):SizeInt;
@@ -45,7 +45,7 @@ function  CompareByte(const buf1,buf2;len:SizeInt):SizeInt;
 function  CompareWord(const buf1,buf2;len:SizeInt):SizeInt;
 function  CompareWord(const buf1,buf2;len:SizeInt):SizeInt;
 function  CompareDWord(const buf1,buf2;len:SizeInt):SizeInt;
 function  CompareDWord(const buf1,buf2;len:SizeInt):SizeInt;
 procedure MoveChar0(const buf1;var buf2;len:SizeInt);
 procedure MoveChar0(const buf1;var buf2;len:SizeInt);
-function  IndexChar0(const buf;len:SizeInt;b:char):SizeInt;
+function  IndexChar0(const buf;len:SizeInt;b:AnsiChar):SizeInt;
 function  CompareChar0(const buf1,buf2;len:SizeInt):SizeInt;
 function  CompareChar0(const buf1,buf2;len:SizeInt):SizeInt;
 procedure prefetch(const mem);[internproc:fpc_in_prefetch_var];
 procedure prefetch(const mem);[internproc:fpc_in_prefetch_var];
 procedure ReadBarrier;
 procedure ReadBarrier;
@@ -471,11 +471,11 @@ Function  Sseg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
 *)
 *)
 
 
 {****************************************************************************
 {****************************************************************************
-                      PChar and String Handling
+                      PAnsiChar and String Handling
 ****************************************************************************}
 ****************************************************************************}
 (*
 (*
-function strpas(p:pchar):shortstring;{$ifdef SYSTEMINLINE}inline;{$endif}
-function strlen(p:pchar):sizeint;external name 'FPC_PCHAR_LENGTH';
+function strpas(p:PAnsiChar):shortstring;{$ifdef SYSTEMINLINE}inline;{$endif}
+function strlen(p:PAnsiChar):sizeint;external name 'FPC_PCHAR_LENGTH';
 *)
 *)
 
 
 { result:
 { result:
@@ -497,10 +497,10 @@ var
 {$ifdef VER3_0}
 {$ifdef VER3_0}
 Procedure Delete(var s:shortstring;index:SizeInt;count:SizeInt);
 Procedure Delete(var s:shortstring;index:SizeInt;count:SizeInt);
 Procedure Insert(const source:shortstring;var s:shortstring;index:SizeInt);
 Procedure Insert(const source:shortstring;var s:shortstring;index:SizeInt);
-Procedure Insert(source:Char;var s:shortstring;index:SizeInt);
+Procedure Insert(source:AnsiChar;var s:shortstring;index:SizeInt);
 {$endif VER3_0}
 {$endif VER3_0}
 Function  Pos(const substr:shortstring;const s:shortstring; Offset: Sizeint = 1):SizeInt;
 Function  Pos(const substr:shortstring;const s:shortstring; Offset: Sizeint = 1):SizeInt;
-Function  Pos(C:Char;const s:shortstring; Offset: Sizeint = 1):SizeInt;
+Function  Pos(C:AnsiChar;const s:shortstring; Offset: Sizeint = 1):SizeInt;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 Function  Pos(const Substr : ShortString; const Source : RawByteString; Offset: Sizeint = 1) : SizeInt;
 Function  Pos(const Substr : ShortString; const Source : RawByteString; Offset: Sizeint = 1) : SizeInt;
 
 
@@ -512,7 +512,7 @@ Procedure SetString(out S : AnsiString; Buf : PAnsiChar; Len : SizeInt);
 Procedure SetString(out S : AnsiString; Buf : PWideChar; Len : SizeInt);
 Procedure SetString(out S : AnsiString; Buf : PWideChar; Len : SizeInt);
 {$endif}
 {$endif}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_shortstr{$else}SetString{$endif}(out S : Shortstring; Buf : PChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_shortstr{$else}SetString{$endif}(out S : Shortstring; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
 function  ShortCompareText(const S1, S2: shortstring): SizeInt;
 function  ShortCompareText(const S1, S2: shortstring): SizeInt;
 Function  upCase(const s:shortstring):shortstring;
 Function  upCase(const s:shortstring):shortstring;
 Function  lowerCase(const s:shortstring):shortstring; overload;
 Function  lowerCase(const s:shortstring):shortstring; overload;
@@ -534,13 +534,13 @@ Function  hexStr(Val:HugePointer):shortstring;{$ifdef SYSTEMINLINE}inline;{$endi
 Function  hexStr(Val:Pointer):shortstring;
 Function  hexStr(Val:Pointer):shortstring;
 {$endif CPUI8086}
 {$endif CPUI8086}
 
 
-{ Char functions }
+{ AnsiChar functions }
 {$if defined(VER3_2) or defined(VER3_0)}
 {$if defined(VER3_2) or defined(VER3_0)}
-Function Chr(b : byte) : Char;      [INTERNPROC: fpc_in_chr_byte];
+Function Chr(b : byte) : AnsiChar;      [INTERNPROC: fpc_in_chr_byte];
 {$endif defined(VER3_2) or defined(VER3_0)}
 {$endif defined(VER3_2) or defined(VER3_0)}
-Function  upCase(c:Char):Char;
-Function  lowerCase(c:Char):Char; overload;
-function  pos(const substr : shortstring;c:char; Offset : Sizeint=1): SizeInt;
+Function  upCase(c:AnsiChar):AnsiChar;
+Function  lowerCase(c:AnsiChar):AnsiChar; overload;
+function  pos(const substr : shortstring;c:AnsiChar; Offset : Sizeint=1): SizeInt;
 
 
 
 
 {****************************************************************************
 {****************************************************************************
@@ -858,10 +858,10 @@ Procedure SysInitFPU;
 
 
 {$ifdef FPC_HAS_FEATURE_HEAP}
 {$ifdef FPC_HAS_FEATURE_HEAP}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint):ppchar; // const ?
-Function StringToPPChar(var S:AnsiString;ReserveEntries:integer):ppchar;
+function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint):PPAnsiChar; // const ?
+Function StringToPPChar(var S:AnsiString;ReserveEntries:integer):PPAnsiChar;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
-Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
+Function StringToPPChar(S: PAnsiChar;ReserveEntries:integer):PPAnsiChar;
 {$endif FPC_HAS_FEATURE_HEAP}
 {$endif FPC_HAS_FEATURE_HEAP}
 
 
 
 

+ 20 - 8
rtl/java/jsystemh_types.inc

@@ -384,17 +384,29 @@ Type
   UInt32  = Cardinal;
   UInt32  = Cardinal;
   UIntPtr = PtrUInt;
   UIntPtr = PtrUInt;
 
 
+{$IFDEF FPC_HAS_ANSICHAR_CHAR}
+// Compiler defines AnsiChar and WideChar, not AnsiChar
+{$IFDEF UNICODERTL}
+  Char = WideChar;
+{$ElSE}
+  Char = AnsiChar;
+{$ENDIF}
+
+{$ELSE}
+  // Compiler defines Char, we make AnsiChar an alias
+  AnsiChar = char;
+{$ENDIF}
+
 { Zero - terminated strings }
 { Zero - terminated strings }
   PChar               = ^Char;
   PChar               = ^Char;
   PPChar              = ^PChar;
   PPChar              = ^PChar;
   PPPChar             = ^PPChar;
   PPPChar             = ^PPChar;
 
 
-  { AnsiChar is equivalent of Char, so we need
+  { AnsiChar is equivalent of AnsiChar, so we need
     to use type renamings }
     to use type renamings }
-  TAnsiChar           = Char;
-  AnsiChar            = Char;
-  PAnsiChar           = PChar;
-  PPAnsiChar          = PPChar;
+  TAnsiChar           = AnsiChar;
+  PAnsiChar           = ^AnsiChar;
+  PPAnsiChar          = ^PAnsiChar;
 
 
   UCS4Char            = type 0..$10ffff;
   UCS4Char            = type 0..$10ffff;
   PUCS4Char           = ^UCS4Char;
   PUCS4Char           = ^UCS4Char;
@@ -583,9 +595,9 @@ type
   TBoundArray = array of SizeInt;
   TBoundArray = array of SizeInt;
 (*
 (*
 {$ifdef CPU16}
 {$ifdef CPU16}
-  TPCharArray = packed array[0..(MaxSmallint div SizeOf(PChar))-1] of PChar;
+  TPCharArray = packed array[0..(MaxSmallint div SizeOf(PAnsiChar))-1] of PAnsiChar;
 {$else CPU16}
 {$else CPU16}
-  TPCharArray = packed array[0..(MaxLongint div SizeOf(PChar))-1] of PChar;
+  TPCharArray = packed array[0..(MaxLongint div SizeOf(PAnsiChar))-1] of PAnsiChar;
 {$endif CPU16}
 {$endif CPU16}
   PPCharArray = ^TPCharArray;
   PPCharArray = ^TPCharArray;
 *)
 *)
@@ -690,7 +702,7 @@ var
 (*
 (*
 {$ifndef HAS_CMDLINE}
 {$ifndef HAS_CMDLINE}
 {Value should be changed during system initialization as appropriate.}
 {Value should be changed during system initialization as appropriate.}
-var cmdline:Pchar=nil;
+var cmdline:PAnsiChar=nil;
 {$endif}
 {$endif}
 *)
 *)
 
 

+ 10 - 10
rtl/java/justringh.inc

@@ -47,7 +47,7 @@ Type
     class constructor ClassCreate;
     class constructor ClassCreate;
 
 
     procedure Wide2AnsiMoveProc(source:pwidechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt); virtual;
     procedure Wide2AnsiMoveProc(source:pwidechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt); virtual;
-    procedure Ansi2WideMoveProc(source:pchar;cp : TSystemCodePage;var dest:widestring;len:SizeInt); virtual;
+    procedure Ansi2WideMoveProc(source:PAnsiChar;cp : TSystemCodePage;var dest:widestring;len:SizeInt); virtual;
 
 
     function UpperWideStringProc(const S: WideString): WideString; virtual;
     function UpperWideStringProc(const S: WideString): WideString; virtual;
     function LowerWideStringProc(const S: WideString): WideString; virtual;
     function LowerWideStringProc(const S: WideString): WideString; virtual;
@@ -61,7 +61,7 @@ Type
       Note: different signature compared to version in native targets: extra
       Note: different signature compared to version in native targets: extra
         "Index" parameter, since you cannot increment pchars to point to the
         "Index" parameter, since you cannot increment pchars to point to the
         next character here }
         next character here }
-    function CharLengthPCharProc(const Str: PChar; Index: PtrInt): PtrInt; virtual;
+    function CharLengthPCharProc(const Str: PAnsiChar; Index: PtrInt): PtrInt; virtual;
     { return value:
     { return value:
       -1 if incomplete or invalid code point
       -1 if incomplete or invalid code point
       0 if NULL character,
       0 if NULL character,
@@ -70,18 +70,18 @@ Type
       Note: different signature compared to version in native targets: extra
       Note: different signature compared to version in native targets: extra
         "Index" parameter, since you cannot increment pchars to point to the
         "Index" parameter, since you cannot increment pchars to point to the
         next character here }
         next character here }
-    function CodePointLengthProc(const Str: PChar; Index, MaxLookAhead: PtrInt): Ptrint; virtual;
+    function CodePointLengthProc(const Str: PAnsiChar; Index, MaxLookAhead: PtrInt): Ptrint; virtual;
 
 
     function UpperAnsiStringProc(const s : ansistring) : ansistring; virtual;
     function UpperAnsiStringProc(const s : ansistring) : ansistring; virtual;
     function LowerAnsiStringProc(const s : ansistring) : ansistring; virtual;
     function LowerAnsiStringProc(const s : ansistring) : ansistring; virtual;
     function CompareStrAnsiStringProc(const S1, S2: ansistring): PtrInt; virtual;
     function CompareStrAnsiStringProc(const S1, S2: ansistring): PtrInt; virtual;
     function CompareTextAnsiStringProc(const S1, S2: ansistring): PtrInt; virtual;
     function CompareTextAnsiStringProc(const S1, S2: ansistring): PtrInt; virtual;
-    function StrCompAnsiStringProc(S1, S2: PChar): PtrInt; virtual;
-    function StrICompAnsiStringProc(S1, S2: PChar): PtrInt; virtual;
-    function StrLCompAnsiStringProc(S1, S2: PChar; MaxLen: PtrUInt): PtrInt; virtual;
-    function StrLICompAnsiStringProc(S1, S2: PChar; MaxLen: PtrUInt): PtrInt; virtual;
-    function StrLowerAnsiStringProc(Str: PChar): PChar; virtual;
-    function StrUpperAnsiStringProc(Str: PChar): PChar; virtual;
+    function StrCompAnsiStringProc(S1, S2: PAnsiChar): PtrInt; virtual;
+    function StrICompAnsiStringProc(S1, S2: PAnsiChar): PtrInt; virtual;
+    function StrLCompAnsiStringProc(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt; virtual;
+    function StrLICompAnsiStringProc(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt; virtual;
+    function StrLowerAnsiStringProc(Str: PAnsiChar): PAnsiChar; virtual;
+    function StrUpperAnsiStringProc(Str: PAnsiChar): PAnsiChar; virtual;
 
 
     // not possible to automatically run code when new thread is started in the
     // not possible to automatically run code when new thread is started in the
     // JVM -- and not needed either, because threadvars can do so when first
     // JVM -- and not needed either, because threadvars can do so when first
@@ -91,7 +91,7 @@ Type
 
 
     { this is only different on windows }
     { this is only different on windows }
     procedure Unicode2AnsiMoveProc(source:punicodechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt); virtual;
     procedure Unicode2AnsiMoveProc(source:punicodechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt); virtual;
-    procedure Ansi2UnicodeMoveProc(source:pchar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt); virtual;
+    procedure Ansi2UnicodeMoveProc(source:PAnsiChar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt); virtual;
     function UpperUnicodeStringProc(const S: UnicodeString): UnicodeString; virtual;
     function UpperUnicodeStringProc(const S: UnicodeString): UnicodeString; virtual;
     function LowerUnicodeStringProc(const S: UnicodeString): UnicodeString; virtual;
     function LowerUnicodeStringProc(const S: UnicodeString): UnicodeString; virtual;
     function CompareUnicodeStringProc(const s1, s2 : UnicodeString) : PtrInt; virtual;
     function CompareUnicodeStringProc(const s1, s2 : UnicodeString) : PtrInt; virtual;

+ 24 - 24
rtl/java/justrings.inc

@@ -45,7 +45,7 @@ end;
 
 
 
 
 {$define FPC_HAS_DEFAULT_ANSI_2_UNICODE}
 {$define FPC_HAS_DEFAULT_ANSI_2_UNICODE}
-procedure DefaultAnsi2UnicodeMove(source:pchar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);
+procedure DefaultAnsi2UnicodeMove(source:PAnsiChar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);
 var
 var
   localdecoder: JNCCharsetDecoder;
   localdecoder: JNCCharsetDecoder;
   inbuf: JNByteBuffer;
   inbuf: JNByteBuffer;
@@ -114,7 +114,7 @@ begin
   result:='';
   result:='';
   Size:=Length(S2);
   Size:=Length(S2);
   if Size>0 then
   if Size>0 then
-    widestringmanager.Ansi2UnicodeMoveProc(PChar(ShortstringClass(@S2).fdata),DefaultSystemCodePage,result,Size);
+    widestringmanager.Ansi2UnicodeMoveProc(PAnsiChar(ShortstringClass(@S2).fdata),DefaultSystemCodePage,result,Size);
 end;
 end;
 
 
 
 
@@ -292,9 +292,9 @@ end;
 
 
 
 
 {$define FPC_HAS_UCHAR_TO_CHAR}
 {$define FPC_HAS_UCHAR_TO_CHAR}
-Function fpc_UChar_To_Char(const c : UnicodeChar): Char; compilerproc;
+Function fpc_UChar_To_Char(const c : UnicodeChar): AnsiChar; compilerproc;
 {
 {
-  Converts a UnicodeChar to a Char;
+  Converts a UnicodeChar to a AnsiChar;
 }
 }
 var
 var
   u: unicodestring;
   u: unicodestring;
@@ -375,7 +375,7 @@ end;
 
 
 
 
 {$define FPC_HAS_PCHAR_TO_UNICODESTR}
 {$define FPC_HAS_PCHAR_TO_UNICODESTR}
-Function fpc_PChar_To_UnicodeStr(const p : pchar): UnicodeString; compilerproc;
+Function fpc_PChar_To_UnicodeStr(const p : PAnsiChar): UnicodeString; compilerproc;
 var
 var
   i, len: longint;
   i, len: longint;
   arr: TAnsiCharArray;
   arr: TAnsiCharArray;
@@ -694,9 +694,9 @@ begin
 end;
 end;
 
 
 
 
-{ Faster version for a char alone. Must be implemented because   }
-{ pos(c: char; const s: shortstring) also exists, so otherwise   }
-{ using pos(char,pchar) will always call the shortstring version }
+{ Faster version for a AnsiChar alone. Must be implemented because   }
+{ pos(c: AnsiChar; const s: shortstring) also exists, so otherwise   }
+{ using pos(AnsiChar,PAnsiChar) will always call the shortstring version }
 { (exact match for first argument), also with $h+ (JM)           }
 { (exact match for first argument), also with $h+ (JM)           }
 {$define FPC_HAS_POS_CHAR_UNICODESTR}
 {$define FPC_HAS_POS_CHAR_UNICODESTR}
 Function Pos (c : AnsiChar; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
 Function Pos (c : AnsiChar; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
@@ -805,7 +805,7 @@ function UTF8Encode(const s : UnicodeString) : RawByteString;
       exit;
       exit;
     SetLength(hs,length(s)*3);
     SetLength(hs,length(s)*3);
     chars:=JLString(s).toCharArray;
     chars:=JLString(s).toCharArray;
-    i:=UnicodeToUtf8(pchar(hs),length(hs)+1,pwidechar(chars),length(s));
+    i:=UnicodeToUtf8(PAnsiChar(hs),length(hs)+1,pwidechar(chars),length(s));
     if i>0 then
     if i>0 then
       begin
       begin
         SetLength(hs,i-1);
         SetLength(hs,i-1);
@@ -824,7 +824,7 @@ function UTF8Decode(const s : RawByteString): UnicodeString;
     if s='' then
     if s='' then
       exit;
       exit;
     SetLength(chars,length(s)+1);
     SetLength(chars,length(s)+1);
-    i:=Utf8ToUnicode(pwidechar(chars),length(s)+1,pchar(s),length(s));
+    i:=Utf8ToUnicode(pwidechar(chars),length(s)+1,PAnsiChar(s),length(s));
     if i>0 then
     if i>0 then
       result:=JLString.Create(chars,0,i-1);
       result:=JLString.Create(chars,0,i-1);
   end;
   end;
@@ -832,7 +832,7 @@ function UTF8Decode(const s : RawByteString): UnicodeString;
 
 
 {$define FPC_HAS_UCS4STRING_TO_UNICODESTR}
 {$define FPC_HAS_UCS4STRING_TO_UNICODESTR}
 
 
-{ concatenates an utf-32 char to a unicodestring. S *must* be unique when entering. }
+{ concatenates an utf-32 AnsiChar to a unicodestring. S *must* be unique when entering. }
 procedure ConcatUTF32ToUnicodeStr(const nc: UCS4Char; var S: JLStringBuilder; var index: SizeInt);
 procedure ConcatUTF32ToUnicodeStr(const nc: UCS4Char; var S: JLStringBuilder; var index: SizeInt);
 begin
 begin
   { if nc > $ffff, we need two places }
   { if nc > $ffff, we need two places }
@@ -1046,7 +1046,7 @@ procedure TUnicodeStringManager.Wide2AnsiMoveProc(source:pwidechar;var dest:RawB
   end;
   end;
 
 
 
 
-procedure TUnicodeStringManager.Ansi2WideMoveProc(source:pchar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
+procedure TUnicodeStringManager.Ansi2WideMoveProc(source:PAnsiChar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
   begin
   begin
     DefaultAnsi2UnicodeMove(source,cp,dest,len);
     DefaultAnsi2UnicodeMove(source,cp,dest,len);
   end;
   end;
@@ -1084,7 +1084,7 @@ function TUnicodeStringManager.CompareTextWideStringProc(const s1, s2 : WideStri
   end;
   end;
 
 
 
 
-function TUnicodeStringManager.CharLengthPCharProc(const Str: PChar; Index: PtrInt): PtrInt;
+function TUnicodeStringManager.CharLengthPCharProc(const Str: PAnsiChar; Index: PtrInt): PtrInt;
   var
   var
     localdecoder: JNCCharsetDecoder;
     localdecoder: JNCCharsetDecoder;
   begin
   begin
@@ -1096,7 +1096,7 @@ function TUnicodeStringManager.CharLengthPCharProc(const Str: PChar; Index: PtrI
   end;
   end;
 
 
 
 
-function TUnicodeStringManager.CodePointLengthProc(const Str: PChar; Index, MaxLookAhead: PtrInt): Ptrint;
+function TUnicodeStringManager.CodePointLengthProc(const Str: PAnsiChar; Index, MaxLookAhead: PtrInt): Ptrint;
   var
   var
     localdecoder: JNCCharsetDecoder;
     localdecoder: JNCCharsetDecoder;
     inbuf: JNByteBuffer;
     inbuf: JNByteBuffer;
@@ -1111,7 +1111,7 @@ function TUnicodeStringManager.CodePointLengthProc(const Str: PChar; Index, MaxL
     localdecoder.reset;
     localdecoder.reset;
     limit:=0;
     limit:=0;
     maxlimit:=min(length(Str)-Index,MaxLookAhead);
     maxlimit:=min(length(Str)-Index,MaxLookAhead);
-    { end of pchar? }
+    { end of PAnsiChar? }
     if maxlimit=0 then
     if maxlimit=0 then
       begin
       begin
         result:=0;
         result:=0;
@@ -1160,7 +1160,7 @@ function TUnicodeStringManager.CompareTextAnsiStringProc(const S1, S2: ansistrin
   end;
   end;
 
 
 
 
-function TUnicodeStringManager.StrCompAnsiStringProc(S1, S2: PChar): PtrInt;
+function TUnicodeStringManager.StrCompAnsiStringProc(S1, S2: PAnsiChar): PtrInt;
   var
   var
     str1,str2: unicodestring;
     str1,str2: unicodestring;
   begin
   begin
@@ -1170,7 +1170,7 @@ function TUnicodeStringManager.StrCompAnsiStringProc(S1, S2: PChar): PtrInt;
   end;
   end;
 
 
 
 
-function TUnicodeStringManager.StrICompAnsiStringProc(S1, S2: PChar): PtrInt;
+function TUnicodeStringManager.StrICompAnsiStringProc(S1, S2: PAnsiChar): PtrInt;
   var
   var
     str1,str2: unicodestring;
     str1,str2: unicodestring;
   begin
   begin
@@ -1180,7 +1180,7 @@ function TUnicodeStringManager.StrICompAnsiStringProc(S1, S2: PChar): PtrInt;
   end;
   end;
 
 
 
 
-function TUnicodeStringManager.StrLCompAnsiStringProc(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+function TUnicodeStringManager.StrLCompAnsiStringProc(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
   var
   var
     str1,str2: unicodestring;
     str1,str2: unicodestring;
   begin
   begin
@@ -1190,7 +1190,7 @@ function TUnicodeStringManager.StrLCompAnsiStringProc(S1, S2: PChar; MaxLen: Ptr
   end;
   end;
 
 
 
 
-function TUnicodeStringManager.StrLICompAnsiStringProc(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+function TUnicodeStringManager.StrLICompAnsiStringProc(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
   var
   var
     str1,str2: unicodestring;
     str1,str2: unicodestring;
   begin
   begin
@@ -1200,21 +1200,21 @@ function TUnicodeStringManager.StrLICompAnsiStringProc(S1, S2: PChar; MaxLen: Pt
   end;
   end;
 
 
 
 
-function TUnicodeStringManager.StrLowerAnsiStringProc(Str: PChar): PChar;
+function TUnicodeStringManager.StrLowerAnsiStringProc(Str: PAnsiChar): PAnsiChar;
   var
   var
     ustr: unicodestring;
     ustr: unicodestring;
   begin
   begin
     ustr:=JLString.Create(TJCharArray(Str),0,length(Str));
     ustr:=JLString.Create(TJCharArray(Str),0,length(Str));
-    result:=PChar(AnsiStringClass(ansistring(LowerWideStringProc(ustr))).fdata);
+    result:=PAnsiChar(AnsiStringClass(ansistring(LowerWideStringProc(ustr))).fdata);
   end;
   end;
 
 
 
 
-function TUnicodeStringManager.StrUpperAnsiStringProc(Str: PChar): PChar;
+function TUnicodeStringManager.StrUpperAnsiStringProc(Str: PAnsiChar): PAnsiChar;
   var
   var
     ustr: unicodestring;
     ustr: unicodestring;
   begin
   begin
     ustr:=JLString.Create(TJCharArray(Str),0,length(Str));
     ustr:=JLString.Create(TJCharArray(Str),0,length(Str));
-    result:=PChar(AnsiStringClass(ansistring(UpperWideStringProc(ustr))).fdata);
+    result:=PAnsiChar(AnsiStringClass(ansistring(UpperWideStringProc(ustr))).fdata);
   end;
   end;
 
 
 
 
@@ -1224,7 +1224,7 @@ procedure TUnicodeStringManager.Unicode2AnsiMoveProc(source:punicodechar;var des
   end;
   end;
 
 
 
 
-procedure TUnicodeStringManager.Ansi2UnicodeMoveProc(source:pchar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);
+procedure TUnicodeStringManager.Ansi2UnicodeMoveProc(source:PAnsiChar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);
   begin
   begin
     DefaultAnsi2UnicodeMove(source,cp,dest,len);
     DefaultAnsi2UnicodeMove(source,cp,dest,len);
   end;
   end;

+ 4 - 4
rtl/java/objpas.inc

@@ -93,7 +93,7 @@
     end;
     end;
 
 
 
 
-  procedure tvarrec.init(p: pchar);
+  procedure tvarrec.init(p: PAnsiChar);
     begin
     begin
       VType:=vtPChar;
       VType:=vtPChar;
       Value:=JLObject(p);
       Value:=JLObject(p);
@@ -180,7 +180,7 @@
 
 
   function tvarrec.VChar: ansichar;
   function tvarrec.VChar: ansichar;
     begin
     begin
-      result:=char(JLByte(Value).byteValue);
+      result:=AnsiChar(JLByte(Value).byteValue);
     end;
     end;
 
 
 
 
@@ -214,9 +214,9 @@
     end;
     end;
 
 
 
 
-  function tvarrec.VPChar: PChar;
+  function tvarrec.VPChar: PAnsiChar;
     begin
     begin
-      result:=PChar(Value);
+      result:=PAnsiChar(Value);
     end;
     end;
 
 
 
 

+ 2 - 2
rtl/java/objpash.inc

@@ -64,7 +64,7 @@ type
        procedure init(const s: shortstring);
        procedure init(const s: shortstring);
        // pointer = object -> use constref to get different signature
        // pointer = object -> use constref to get different signature
        procedure init(constref p: pointer);
        procedure init(constref p: pointer);
-       procedure init(p: pchar);
+       procedure init(p: PAnsiChar);
        procedure init(p: JLObject);
        procedure init(p: JLObject);
        procedure init(c: TJClass);
        procedure init(c: TJClass);
        procedure init(p: pwidechar);
        procedure init(p: pwidechar);
@@ -88,7 +88,7 @@ type
        function VDouble: double;
        function VDouble: double;
        function VString: PShortString;
        function VString: PShortString;
        function VPointer: pointer;
        function VPointer: pointer;
-       function VPChar: PChar;
+       function VPChar: PAnsiChar;
        function VObject: JLObject;
        function VObject: JLObject;
        function VClass: TJClass;
        function VClass: TJClass;
        function VPWideChar: PWideChar;
        function VPWideChar: PWideChar;