Browse Source

* Char -> AnsiChar

Michael VAN CANNEYT 2 years ago
parent
commit
d2d3fe6bc3

+ 14 - 14
rtl/inc/astrings.inc

@@ -23,15 +23,15 @@
 {
 {
   This file contains the implementation of the AnsiString type,
   This file contains the implementation of the AnsiString type,
   and all things that are needed for it.
   and all things that are needed for it.
-  AnsiString is defined as a 'silent' pchar :
-  a pchar that points to (S= SizeOf(SizeInt), R= (if CPU64 then SizeOf(Longint) else SizeOf(SizeInt))):
+  AnsiString is defined as a 'silent' pansichar :
+  a pansichar that points to (S= SizeOf(SizeInt), R= (if CPU64 then SizeOf(Longint) else SizeOf(SizeInt))):
 
 
   @-S-R-4 : Code page indicator.
   @-S-R-4 : Code page indicator.
   @-S-R-2 : Character size (2 bytes)
   @-S-R-2 : Character size (2 bytes)
   @-S-R   : Reference count (R bytes)
   @-S-R   : Reference count (R bytes)
   @-S  : SizeInt for size;
   @-S  : SizeInt for size;
   @    : String + Terminating #0;
   @    : String + Terminating #0;
-  Pchar(Ansistring) is a valid typecast.
+  PAnsiChar(Ansistring) is a valid typecast.
   So AS[i] is converted to the address @AS+i-1.
   So AS[i] is converted to the address @AS+i-1.
 
 
   Constants should be assigned a reference count of -1
   Constants should be assigned a reference count of -1
@@ -83,7 +83,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
   move(src[srcindex],pbyte(pointer(dst))[dstindex],len);
   move(src[srcindex],pbyte(pointer(dst))[dstindex],len);
 end;
 end;
@@ -92,7 +92,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
   move(src[srcindex],dst[dstindex],len);
   move(src[srcindex],dst[dstindex],len);
 end;
 end;
@@ -120,7 +120,7 @@ Var
   P : Pointer;
   P : Pointer;
 begin
 begin
   { request a multiple of 16 because the heap manager alloctes anyways chunks of 16 bytes }
   { request a multiple of 16 because the heap manager alloctes anyways chunks of 16 bytes }
-  GetMem(P,Len+(AnsiFirstOff+sizeof(char)));
+  GetMem(P,Len+(AnsiFirstOff+sizeof(AnsiChar)));
   If P<>Nil then
   If P<>Nil then
    begin
    begin
      PAnsiRec(P)^.Ref:=1;         { Set reference count }
      PAnsiRec(P)^.Ref:=1;         { Set reference count }
@@ -533,7 +533,7 @@ end;
 {$define FPC_HAS_CHAR_TO_ANSISTR}
 {$define FPC_HAS_CHAR_TO_ANSISTR}
 Function fpc_Char_To_AnsiStr(const c : AnsiChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
 Function fpc_Char_To_AnsiStr(const c : AnsiChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): RawByteString; compilerproc;
 {
 {
-  Converts a Char to a AnsiString;
+  Converts a AnsiChar to a AnsiString;
 }
 }
 {$ifndef FPC_HAS_CPSTRING}
 {$ifndef FPC_HAS_CPSTRING}
 var
 var
@@ -1001,9 +1001,9 @@ end;
 
 
 {$ifndef FPC_HAS_POS_ANSICHAR_ANSISTR}
 {$ifndef FPC_HAS_POS_ANSICHAR_ANSISTR}
 {$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;
 Function Pos(c : AnsiChar; Const s : RawByteString; Offset : Sizeint = 1) : SizeInt;
 var
 var
@@ -1383,7 +1383,7 @@ begin
   If (Size<=LS-Index) then
   If (Size<=LS-Index) then
     begin
     begin
       Dec(Index);
       Dec(Index);
-      fpc_pchar_ansistr_intern_charmove(pchar(S),Index+Size,S,Index,LS-Index-Size+1);
+      fpc_pchar_ansistr_intern_charmove(PAnsiChar(S),Index+Size,S,Index,LS-Index-Size+1);
     end;
     end;
   Setlength(S,LS-Size);
   Setlength(S,LS-Size);
 end;
 end;
@@ -1410,10 +1410,10 @@ begin
     cp:=TranslatePlaceholderCP(StringCodePage(Source));
     cp:=TranslatePlaceholderCP(StringCodePage(Source));
   SetCodePage(Temp,cp,false);
   SetCodePage(Temp,cp,false);
   If Index>0 then
   If Index>0 then
-    fpc_pchar_ansistr_intern_charmove(pchar(S),0,Temp,0,Index);
-  fpc_pchar_ansistr_intern_charmove(pchar(Source),0,Temp,Index,Length(Source));
+    fpc_pchar_ansistr_intern_charmove(PAnsiChar(S),0,Temp,0,Index);
+  fpc_pchar_ansistr_intern_charmove(PAnsiChar(Source),0,Temp,Index,Length(Source));
   If (LS-Index)>0 then
   If (LS-Index)>0 then
-    fpc_pchar_ansistr_intern_charmove(pchar(S),Index,Temp,Length(Source)+Index,LS-Index);
+    fpc_pchar_ansistr_intern_charmove(PAnsiChar(S),Index,Temp,Length(Source)+Index,LS-Index);
   S:=Temp;
   S:=Temp;
 end;
 end;
 
 

+ 2 - 2
rtl/inc/blockrtl.pp

@@ -86,7 +86,7 @@ interface
       { signatures are only for the "ABI.2010.3.16" version, but that's all we support
       { signatures are only for the "ABI.2010.3.16" version, but that's all we support
         because otherwise the callback has to be a C-style variadic function, which
         because otherwise the callback has to be a C-style variadic function, which
         we cannot (yet?) generate on the callee side}
         we cannot (yet?) generate on the callee side}
-      signature: pchar;
+      signature: pAnsichar;
     end;
     end;
 
 
     { descriptor for a simple block (no copy/release) }
     { descriptor for a simple block (no copy/release) }
@@ -98,7 +98,7 @@ interface
       { signatures are only for the "ABI.2010.3.16" version, but that's all we support
       { signatures are only for the "ABI.2010.3.16" version, but that's all we support
         because otherwise the callback has to be a C-style variadic function, which
         because otherwise the callback has to be a C-style variadic function, which
         we cannot (yet?) generate on the callee side}
         we cannot (yet?) generate on the callee side}
-      signature: pchar;
+      signature: pansichar;
     end;
     end;
 
 
     { for global procedures }
     { for global procedures }

+ 2 - 2
rtl/inc/cgeneric.inc

@@ -120,9 +120,9 @@ end;
 {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
 {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
 {$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
 {$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
 
 
-function libc_pchar_length(p:pchar):size_t; cdecl; external clib name 'strlen';
+function libc_pchar_length(p:PAnsiChar):size_t; cdecl; external clib name 'strlen';
 
 
-function fpc_pchar_length(p:pchar):sizeint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
+function fpc_pchar_length(p:PAnsiChar):sizeint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
 begin
 begin
   if assigned(p) then
   if assigned(p) then
     fpc_pchar_length:=libc_pchar_length(p)
     fpc_pchar_length:=libc_pchar_length(p)

+ 19 - 19
rtl/inc/cgenstr.inc

@@ -19,7 +19,7 @@
 {$ifndef FPC_UNIT_HAS_STREND}
 {$ifndef FPC_UNIT_HAS_STREND}
 {$define FPC_UNIT_HAS_STREND}
 {$define FPC_UNIT_HAS_STREND}
 
 
- function StrEnd(P: PChar): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrEnd(P: PAnsiChar): PAnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
    begin
    begin
      strend := p+strlen(p);
      strend := p+strlen(p);
    end;
    end;
@@ -28,9 +28,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRCOPY}
 {$ifndef FPC_UNIT_HAS_STRCOPY}
 {$define FPC_UNIT_HAS_STRCOPY}
 {$define FPC_UNIT_HAS_STRCOPY}
- function libc_strcpy(dest: pchar; const src: pchar): pchar; cdecl; external 'c' name 'strcpy';
+ function libc_strcpy(dest: pansichar; const src: pansichar): pansichar; cdecl; external 'c' name 'strcpy';
 
 
- Function StrCopy(Dest, Source:PChar): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
+ Function StrCopy(Dest, Source:PAnsiChar): PAnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
    Begin
      StrCopy := libc_strcpy(dest,source);
      StrCopy := libc_strcpy(dest,source);
    end;
    end;
@@ -39,9 +39,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRSCAN}
 {$ifndef FPC_UNIT_HAS_STRSCAN}
 {$define FPC_UNIT_HAS_STRSCAN}
 {$define FPC_UNIT_HAS_STRSCAN}
- function libc_strchr(const p: pchar; c: longint): pchar; cdecl; external 'c' name 'strchr';
+ function libc_strchr(const p: PAnsiChar; c: longint): PAnsiChar; cdecl; external 'c' name 'strchr';
 
 
- function StrScan(P: PChar; C: Char): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrScan(P: PAnsiChar; C: AnsiChar): PAnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
    Begin
      StrScan := libc_strchr(p,longint(c));
      StrScan := libc_strchr(p,longint(c));
    end;
    end;
@@ -50,9 +50,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRRSCAN}
 {$ifndef FPC_UNIT_HAS_STRRSCAN}
 {$define FPC_UNIT_HAS_STRRSCAN}
 {$define FPC_UNIT_HAS_STRRSCAN}
- function libc_strrchr(const p: pchar; c: longint): pchar; cdecl; external 'c' name 'strrchr';
+ function libc_strrchr(const p: PAnsiChar; c: longint): PAnsiChar; cdecl; external 'c' name 'strrchr';
 
 
- function StrRScan(P: PChar; C: Char): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrRScan(P: PAnsiChar; C: AnsiChar): PAnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
    Begin
      StrRScan := libc_strrchr(p,longint(c));
      StrRScan := libc_strrchr(p,longint(c));
    end;
    end;
@@ -61,9 +61,9 @@
 (*
 (*
 {$ifndef FPC_UNIT_HAS_STRECOPY}
 {$ifndef FPC_UNIT_HAS_STRECOPY}
 {$define FPC_UNIT_HAS_STRECOPY}
 {$define FPC_UNIT_HAS_STRECOPY}
- function libc_stpcpy(dest: pchar; const src: pchar): pchar; cdecl; external 'c' name 'stpcpy';
+ function libc_stpcpy(dest: PAnsiChar; const src: PAnsiChar): PAnsiChar; cdecl; external 'c' name 'stpcpy';
 
 
-  Function StrECopy(Dest, Source: PChar): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
+  Function StrECopy(Dest, Source: PAnsiChar): PAnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
     Begin
     Begin
       StrECopy := libc_stpcpy(dest,source);
       StrECopy := libc_stpcpy(dest,source);
     end;
     end;
@@ -74,9 +74,9 @@
 {$ifndef FPC_UNIT_HAS_STRLCOPY}
 {$ifndef FPC_UNIT_HAS_STRLCOPY}
 {$define FPC_UNIT_HAS_STRLCOPY}
 {$define FPC_UNIT_HAS_STRLCOPY}
 
 
- function libc_strlcpy(dest: pchar; const src: pchar; maxlen: SizeInt): SizeInt; cdecl; external 'c' name 'strlcpy';
+ function libc_strlcpy(dest: PAnsiChar; const src: PAnsiChar; maxlen: SizeInt): SizeInt; cdecl; external 'c' name 'strlcpy';
 
 
- Function StrLCopy(Dest,Source: PChar; MaxLen: SizeInt): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
+ Function StrLCopy(Dest,Source: PAnsiChar; MaxLen: SizeInt): PAnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
    Begin
      libc_strlcpy(dest,source,maxlen);
      libc_strlcpy(dest,source,maxlen);
      StrLCopy := Dest;
      StrLCopy := Dest;
@@ -86,9 +86,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRCOMP}
 {$ifndef FPC_UNIT_HAS_STRCOMP}
 {$define FPC_UNIT_HAS_STRCOMP}
 {$define FPC_UNIT_HAS_STRCOMP}
- function libc_strcmp(const str1,str2: pchar): longint; cdecl; external 'c' name 'strcmp';
+ function libc_strcmp(const str1,str2: PAnsiChar): longint; cdecl; external 'c' name 'strcmp';
 
 
- function StrComp(Str1, Str2 : PChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrComp(Str1, Str2 : PAnsiChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
    Begin
      strcomp := libc_strcmp(str1,str2);
      strcomp := libc_strcmp(str1,str2);
    end;
    end;
@@ -97,9 +97,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRICOMP}
 {$ifndef FPC_UNIT_HAS_STRICOMP}
 {$define FPC_UNIT_HAS_STRICOMP}
 {$define FPC_UNIT_HAS_STRICOMP}
- function libc_strcasecmp(const str1,str2: pchar): longint; cdecl; external 'c' name 'strcasecmp';
+ function libc_strcasecmp(const str1,str2: PAnsiChar): longint; cdecl; external 'c' name 'strcasecmp';
 
 
- function StrIComp(Str1, Str2 : PChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrIComp(Str1, Str2 : PAnsiChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
    Begin
      stricomp := libc_strcasecmp(str1,str2);
      stricomp := libc_strcasecmp(str1,str2);
    end;
    end;
@@ -108,9 +108,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRLCOMP}
 {$ifndef FPC_UNIT_HAS_STRLCOMP}
 {$define FPC_UNIT_HAS_STRLCOMP}
 {$define FPC_UNIT_HAS_STRLCOMP}
- function libc_strncmp(const str1,str2: pchar; l: sizeint): longint; cdecl; external 'c' name 'strncmp';
+ function libc_strncmp(const str1,str2: PAnsiChar; l: sizeint): longint; cdecl; external 'c' name 'strncmp';
 
 
- function StrLComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrLComp(Str1, Str2 : PAnsiChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
    Begin
      strlcomp := libc_strncmp(str1,str2,l);
      strlcomp := libc_strncmp(str1,str2,l);
    end;
    end;
@@ -119,9 +119,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRLICOMP}
 {$ifndef FPC_UNIT_HAS_STRLICOMP}
 {$define FPC_UNIT_HAS_STRLICOMP}
 {$define FPC_UNIT_HAS_STRLICOMP}
- function libc_strncasecmp(const str1,str2: pchar; l: sizeint): longint; cdecl; external 'c' name 'strncasecmp';
+ function libc_strncasecmp(const str1,str2: PAnsiChar; l: sizeint): longint; cdecl; external 'c' name 'strncasecmp';
 
 
- function StrLIComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrLIComp(Str1, Str2 : PAnsiChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
    Begin
      strlicomp := libc_strncasecmp(str1,str2,l);
      strlicomp := libc_strncasecmp(str1,str2,l);
    end;
    end;

+ 2 - 2
rtl/inc/charset.pp

@@ -77,7 +77,7 @@ unit charset;
     function getmap(cp : word) : punicodemap;
     function getmap(cp : word) : punicodemap;
     function mappingavailable(const s : string) : boolean;inline;
     function mappingavailable(const s : string) : boolean;inline;
     function mappingavailable(cp :word) : boolean;inline;
     function mappingavailable(cp :word) : boolean;inline;
-    function getunicode(c : char;p : punicodemap) : tunicodechar;inline;
+    function getunicode(c : AnsiChar;p : punicodemap) : tunicodechar;inline;
     function getunicode(
     function getunicode(
       AAnsiStr : pansichar;
       AAnsiStr : pansichar;
       AAnsiLen : LongInt;
       AAnsiLen : LongInt;
@@ -609,7 +609,7 @@ unit charset;
          mappingavailable:=getmap(cp)<>nil;
          mappingavailable:=getmap(cp)<>nil;
       end;
       end;
 
 
-    function getunicode(c : char;p : punicodemap) : tunicodechar;
+    function getunicode(c : AnsiChar;p : punicodemap) : tunicodechar;
 
 
       begin
       begin
          if ord(c)<=p^.lastchar then
          if ord(c)<=p^.lastchar then

+ 42 - 42
rtl/inc/compproc.inc

@@ -50,20 +50,20 @@ 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 char; zerobased: boolean = true); compilerproc;
-procedure fpc_shortstr_to_chararray(out res: array of char; const src: ShortString); compilerproc;
+procedure fpc_chararray_to_shortstr(out res : shortstring;const arr: array of AnsiChar; zerobased: boolean = true); compilerproc;
+procedure fpc_shortstr_to_chararray(out res: array of AnsiChar; const src: ShortString); compilerproc;
 
 
 Function  fpc_shortstr_Copy(const s:shortstring;index:SizeInt;count:SizeInt):shortstring;compilerproc{$ifndef VER3_0}:fpc_in_copy_x{$endif VER3_0};
 Function  fpc_shortstr_Copy(const s:shortstring;index:SizeInt;count:SizeInt):shortstring;compilerproc{$ifndef VER3_0}:fpc_in_copy_x{$endif VER3_0};
-function  fpc_char_copy(c:char;index : SizeInt;count : SizeInt): shortstring;compilerproc{$ifndef VER3_0}:fpc_in_copy_x{$endif VER3_0};
+function  fpc_char_copy(c:AnsiChar;index : SizeInt;count : SizeInt): shortstring;compilerproc{$ifndef VER3_0}:fpc_in_copy_x{$endif VER3_0};
 {$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}
 
 
 {$ifdef FPC_HAS_FEATURE_DYNARRAYS}
 {$ifdef FPC_HAS_FEATURE_DYNARRAYS}
@@ -102,8 +102,8 @@ procedure fpc_shortstr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out
 procedure fpc_shortstr_bool(b : boolean;len:sizeint;out s:shortstring);compilerproc;
 procedure fpc_shortstr_bool(b : boolean;len:sizeint;out s:shortstring);compilerproc;
 procedure fpc_ShortStr_Currency(c : currency; len,f : SizeInt; out s : shortstring); compilerproc;
 procedure fpc_ShortStr_Currency(c : currency; len,f : SizeInt; out s : shortstring); compilerproc;
 
 
-procedure fpc_chararray_sint(v : valsint;len : SizeInt;out a : array of char); compilerproc;
-procedure fpc_chararray_uint(v : valuint;len : SizeInt;out a : array of char); compilerproc;
+procedure fpc_chararray_sint(v : valsint;len : SizeInt;out a : array of AnsiChar); compilerproc;
+procedure fpc_chararray_uint(v : valuint;len : SizeInt;out a : array of AnsiChar); compilerproc;
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 procedure fpc_AnsiStr_sint(v : valsint; Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
 procedure fpc_AnsiStr_sint(v : valsint; Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
 procedure fpc_AnsiStr_uint(v : valuint;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
 procedure fpc_AnsiStr_uint(v : valuint;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
@@ -127,8 +127,8 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
 {$ifndef CPU64}
 {$ifndef CPU64}
   procedure fpc_shortstr_qword(v : qword;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_qword(v : qword;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_int64(v : int64;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_int64(v : int64;len : SizeInt;out s : shortstring); compilerproc;
-  procedure fpc_chararray_qword(v : qword;len : SizeInt;out a : array of char); compilerproc;
-  procedure fpc_chararray_int64(v : int64;len : SizeInt;out a : array of char); compilerproc;
+  procedure fpc_chararray_qword(v : qword;len : SizeInt;out a : array of AnsiChar); compilerproc;
+  procedure fpc_chararray_int64(v : int64;len : SizeInt;out a : array of AnsiChar); compilerproc;
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
   procedure fpc_ansistr_qword(v : qword;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
   procedure fpc_ansistr_qword(v : qword;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
   procedure fpc_ansistr_int64(v : int64;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
   procedure fpc_ansistr_int64(v : int64;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
@@ -146,8 +146,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;
@@ -164,8 +164,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;
@@ -198,18 +198,18 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 
 
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
-procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;out a : array of char); compilerproc;
+procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;out a : array of AnsiChar); compilerproc;
 {$endif}
 {$endif}
 {$ifndef CPUAVR}
 {$ifndef CPUAVR}
 { currently, the avr code generator fails on this procedure, so we disable it, 
 { currently, the avr code generator fails on this procedure, so we disable it, 
   this is not a good solution but fixing compilation of this procedure for
   this is not a good solution but fixing compilation of this procedure for
   avr is hard, requires significant changes to the register allocator to take
   avr is hard, requires significant changes to the register allocator to take
   care of different register classes }
   care of different register classes }
-procedure fpc_chararray_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out a : array of char);compilerproc;
+procedure fpc_chararray_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out a : array of AnsiChar);compilerproc;
 {$endif CPUAVR}
 {$endif CPUAVR}
 
 
-procedure fpc_chararray_bool(b : boolean;len:sizeint;out a : array of char);compilerproc;
-procedure fpc_chararray_Currency(c : Currency;len,fr : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_bool(b : boolean;len:sizeint;out a : array of AnsiChar);compilerproc;
+procedure fpc_chararray_Currency(c : Currency;len,fr : SizeInt;out a : array of AnsiChar);compilerproc;
 
 
 { Val() support }
 { Val() support }
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
@@ -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;
@@ -396,10 +396,10 @@ Function fpc_WideStr_To_UnicodeStr (Const S2 : WideString): UnicodeString; compi
 Procedure fpc_UnicodeStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
 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 : Char): UnicodeString; compilerproc;
-Function fpc_PChar_To_UnicodeStr(const p : pchar): UnicodeString; compilerproc;
-Function fpc_CharArray_To_UnicodeStr(const arr: array of char; zerobased: boolean = true): UnicodeString; compilerproc;
-procedure fpc_unicodestr_to_chararray(out res: array of char; const src: UnicodeString); compilerproc;
+Function fpc_Char_To_UnicodeStr(const c : AnsiChar): 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;
+procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: UnicodeString); compilerproc;
 procedure fpc_WideCharArray_To_ShortStr(out res : shortstring;const arr: array of widechar; zerobased: boolean = true); compilerproc;
 procedure fpc_WideCharArray_To_ShortStr(out res : shortstring;const arr: array of widechar; zerobased: boolean = true); compilerproc;
 Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; {$ifdef FPC_HAS_CPSTRING}cp : TSystemCodePage;{$endif FPC_HAS_CPSTRING} zerobased: boolean = true): AnsiString; compilerproc;
 Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; {$ifdef FPC_HAS_CPSTRING}cp : TSystemCodePage;{$endif FPC_HAS_CPSTRING} zerobased: boolean = true): AnsiString; compilerproc;
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
@@ -421,8 +421,8 @@ Procedure fpc_unicodestr_insert (Const Source : UnicodeString; Var S : UnicodeSt
 Procedure fpc_unicodestr_delete (Var S : UnicodeString; Index,Size: SizeInt); compilerproc:fpc_in_delete_x_y_z;
 Procedure fpc_unicodestr_delete (Var S : UnicodeString; Index,Size: SizeInt); compilerproc:fpc_in_delete_x_y_z;
 {$endif VER3_0}
 {$endif VER3_0}
 function fpc_unicodestr_Unique(Var S : Pointer): Pointer; compilerproc;
 function fpc_unicodestr_Unique(Var S : Pointer): Pointer; compilerproc;
-Function fpc_Char_To_UChar(const c : Char): UnicodeChar; compilerproc;
-Function fpc_UChar_To_Char(const c : UnicodeChar): Char; compilerproc;
+Function fpc_Char_To_UChar(const c : AnsiChar): UnicodeChar; compilerproc;
+Function fpc_UChar_To_Char(const c : UnicodeChar): AnsiChar; compilerproc;
 Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
 Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
 Function fpc_UChar_To_AnsiStr(const c : UnicodeChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
 Function fpc_UChar_To_AnsiStr(const c : UnicodeChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
 function fpc_UChar_To_ShortStr(const c : WideChar): shortstring; compilerproc;
 function fpc_UChar_To_ShortStr(const c : WideChar): shortstring; compilerproc;
@@ -440,15 +440,15 @@ procedure fpc_PWideChar_To_ShortStr(out res : shortstring;const p : pwidechar);
 Function fpc_get_input:PText;compilerproc;
 Function fpc_get_input:PText;compilerproc;
 Function fpc_get_output:PText;compilerproc;
 Function fpc_get_output:PText;compilerproc;
 Procedure fpc_textinit_iso(var t : Text;nr : DWord);compilerproc;
 Procedure fpc_textinit_iso(var t : Text;nr : DWord);compilerproc;
-Procedure fpc_textinit_filename_iso(var t : Text;nr : DWord;const filename : string);compilerproc;
+Procedure fpc_textinit_filename_iso(var t : Text;nr : DWord;const filename : shortstring);compilerproc;
 Procedure fpc_textclose_iso(var t : Text);compilerproc;
 Procedure fpc_textclose_iso(var t : Text);compilerproc;
 Procedure fpc_Write_End(var f:Text); compilerproc;
 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_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_ShortStr(Len : Longint;var f : Text;const s : shortString); compilerproc;
+Procedure fpc_Write_Text_ShortStr_Iso(Len : Longint;var f : Text;const s : shortString); 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;
@@ -485,8 +485,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}
@@ -542,9 +542,9 @@ procedure fpc_dispinvoke_variant(dest : pvardata;var source : tvardata;  calldes
 Procedure fpc_Read_End(var f:Text); compilerproc;
 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_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_ShortStr(var f : Text;out s : shortString); 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}
@@ -554,11 +554,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;
@@ -586,7 +586,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/inc/dos.inc

@@ -25,7 +25,7 @@ begin
       p[i]:=DirectorySeparator;
       p[i]:=DirectorySeparator;
 end;
 end;
 
 
-procedure DoDirSeparators(p:Pchar);
+procedure DoDirSeparators(p:PAnsiChar);
 var
 var
   i : longint;
   i : longint;
 begin
 begin

+ 1 - 1
rtl/inc/dynlib.inc

@@ -181,7 +181,7 @@ begin
   NoDynLibsError;
   NoDynLibsError;
 end;
 end;
 
 
-function NoGetLoadErrorStr: String; noreturn;
+function NoGetLoadErrorStr: AnsiString; noreturn;
 begin
 begin
   NoDynLibsError;
   NoDynLibsError;
 end;
 end;

+ 1 - 1
rtl/inc/dynlibh.inc

@@ -35,7 +35,7 @@ type
   TGetProcAddressHandler = function(Lib: TLibHandle; const ProcName: AnsiString): {$ifdef cpui8086}FarPointer{$else}Pointer{$endif};
   TGetProcAddressHandler = function(Lib: TLibHandle; const ProcName: AnsiString): {$ifdef cpui8086}FarPointer{$else}Pointer{$endif};
   TGetProcAddressOrdinalHandler = function(Lib: TLibHandle; Ordinal: TOrdinalEntry): {$ifdef cpui8086}FarPointer{$else}Pointer{$endif};
   TGetProcAddressOrdinalHandler = function(Lib: TLibHandle; Ordinal: TOrdinalEntry): {$ifdef cpui8086}FarPointer{$else}Pointer{$endif};
   TUnloadLibraryHandler = function(Lib: TLibHandle): Boolean;
   TUnloadLibraryHandler = function(Lib: TLibHandle): Boolean;
-  TGetLoadErrorStrHandler = function: String;
+  TGetLoadErrorStrHandler = function: AnsiString;
 
 
   TDynLibsManager = record
   TDynLibsManager = record
     LoadLibraryU: TLoadLibraryUHandler;
     LoadLibraryU: TLoadLibraryUHandler;

+ 2 - 2
rtl/inc/dynlibs.pas

@@ -35,7 +35,7 @@ Function LoadLibrary(const Name : UnicodeString) : TLibHandle; inline;
 Function GetProcedureAddress(Lib : TlibHandle; const ProcName : AnsiString) : {$ifdef cpui8086}FarPointer{$else}Pointer{$endif}; inline;
 Function GetProcedureAddress(Lib : TlibHandle; const ProcName : AnsiString) : {$ifdef cpui8086}FarPointer{$else}Pointer{$endif}; inline;
 Function GetProcedureAddress(Lib : TLibHandle; Ordinal: TOrdinalEntry) : {$ifdef cpui8086}FarPointer{$else}Pointer{$endif}; inline;
 Function GetProcedureAddress(Lib : TLibHandle; Ordinal: TOrdinalEntry) : {$ifdef cpui8086}FarPointer{$else}Pointer{$endif}; inline;
 Function UnloadLibrary(Lib : TLibHandle) : Boolean; inline;
 Function UnloadLibrary(Lib : TLibHandle) : Boolean; inline;
-Function GetLoadErrorStr: string; inline;
+Function GetLoadErrorStr: ansistring; inline;
 
 
 // Kylix/Delphi compability
 // Kylix/Delphi compability
 
 
@@ -88,7 +88,7 @@ begin
   Result:=System.UnloadLibrary(Lib);
   Result:=System.UnloadLibrary(Lib);
 end;
 end;
 
 
-Function GetLoadErrorStr: String;
+Function GetLoadErrorStr: AnsiString;
 begin
 begin
   Result:=System.GetLoadErrorStr;
   Result:=System.GetLoadErrorStr;
 end;
 end;

+ 42 - 42
rtl/inc/exeinfo.pp

@@ -50,22 +50,22 @@ type
     FunctionRelative: boolean;
     FunctionRelative: boolean;
     // Offset of the binary image forming permanent offset to all retrieved values
     // Offset of the binary image forming permanent offset to all retrieved values
     ImgOffset: TExeOffset;
     ImgOffset: TExeOffset;
-    filename  : string;
+    filename  : shortstring;
     // Allocate static buffer for reading data
     // Allocate static buffer for reading data
     buf       : array[0..4095] of byte;
     buf       : array[0..4095] of byte;
     bufsize,
     bufsize,
     bufcnt    : longint;
     bufcnt    : longint;
   end;
   end;
 
 
-function OpenExeFile(var e:TExeFile;const fn:string):boolean;
-function FindExeSection(var e:TExeFile;const secname:string;var secofs,seclen:longint):boolean;
+function OpenExeFile(var e:TExeFile;const fn:shortstring):boolean;
+function FindExeSection(var e:TExeFile;const secname:shortstring;var secofs,seclen:longint):boolean;
 function CloseExeFile(var e:TExeFile):boolean;
 function CloseExeFile(var e:TExeFile):boolean;
-function ReadDebugLink(var e:TExeFile;var dbgfn:string):boolean;
+function ReadDebugLink(var e:TExeFile;var dbgfn:shortstring):boolean;
 
 
 {$ifdef CPUI8086}
 {$ifdef CPUI8086}
-procedure GetModuleByAddr(addr: farpointer; var baseaddr: farpointer; var filename: string);
+procedure GetModuleByAddr(addr: farpointer; var baseaddr: farpointer; var filename: shortstring);
 {$else CPUI8086}
 {$else CPUI8086}
-procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: string);
+procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: shortstring);
 {$endif CPUI8086}
 {$endif CPUI8086}
 
 
 implementation
 implementation
@@ -78,7 +78,7 @@ uses
 
 
 {$if defined(unix) and not defined(beos) and not defined(haiku)}
 {$if defined(unix) and not defined(beos) and not defined(haiku)}
 
 
-  procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: string);
+  procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: shortstring);
     begin
     begin
       if assigned(UnixGetModuleByAddrHook) then
       if assigned(UnixGetModuleByAddrHook) then
         UnixGetModuleByAddrHook(addr,baseaddr,filename)
         UnixGetModuleByAddrHook(addr,baseaddr,filename)
@@ -96,9 +96,9 @@ uses
 {$ifdef FPC_OS_UNICODE}
 {$ifdef FPC_OS_UNICODE}
     TST: array[0..Max_Path] of WideChar;
     TST: array[0..Max_Path] of WideChar;
 {$else}
 {$else}
-    TST: array[0..Max_Path] of Char;
+    TST: array[0..Max_Path] of AnsiChar;
 {$endif FPC_OS_UNICODE}
 {$endif FPC_OS_UNICODE}
-  procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: string);
+  procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: shortstring);
     begin
     begin
       baseaddr:=nil;
       baseaddr:=nil;
       if VirtualQuery(addr, @Tmm, SizeOf(Tmm))<>sizeof(Tmm) then
       if VirtualQuery(addr, @Tmm, SizeOf(Tmm))<>sizeof(Tmm) then
@@ -113,7 +113,7 @@ uses
 {$ifdef FPC_OS_UNICODE}
 {$ifdef FPC_OS_UNICODE}
               filename:= String(PWideChar(@TST));
               filename:= String(PWideChar(@TST));
 {$else}
 {$else}
-              filename:= String(PChar(@TST));
+              filename:= String(PAnsiChar(@TST));
 {$endif FPC_OS_UNICODE}
 {$endif FPC_OS_UNICODE}
             end;
             end;
         end;
         end;
@@ -148,7 +148,7 @@ uses
 
 
   function get_next_image_info(team: team_id; var cookie:longint; var info:image_info; size: size_t) : status_t;cdecl; external 'root' name '_get_next_image_info';
   function get_next_image_info(team: team_id; var cookie:longint; var info:image_info; size: size_t) : status_t;cdecl; external 'root' name '_get_next_image_info';
 
 
-  procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: string);
+  procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: shortstring);
     const
     const
       B_OK = 0;
       B_OK = 0;
     var
     var
@@ -167,7 +167,7 @@ uses
              (addr >= info.text) and (addr <= (info.text + info.text_size)) then
              (addr >= info.text) and (addr <= (info.text + info.text_size)) then
             begin
             begin
               baseaddr:=info.text;
               baseaddr:=info.text;
-              filename:=PChar(@info.name);
+              filename:=PAnsiChar(@info.name);
             end;
             end;
         end;
         end;
     end;
     end;
@@ -289,14 +289,14 @@ function getByte(var f:file):byte;
   end;
   end;
 
 
   function get0String (var f:file) : string;
   function get0String (var f:file) : string;
-  var c : char;
+  var c : AnsiChar;
   begin
   begin
     get0String := '';
     get0String := '';
-    c := char (getbyte(f));
+    c := AnsiChar (getbyte(f));
     while (c <> #0) do
     while (c <> #0) do
     begin
     begin
       get0String := get0String + c;
       get0String := get0String + c;
-      c := char (getbyte(f));
+      c := AnsiChar (getbyte(f));
     end;
     end;
   end;
   end;
 
 
@@ -333,7 +333,7 @@ var valid : boolean;
   begin
   begin
     getFixString := '';
     getFixString := '';
     for I := 1 to Len do
     for I := 1 to Len do
-      getFixString := getFixString + char (getbyte(e.f));
+      getFixString := getFixString + AnsiChar (getbyte(e.f));
   end;
   end;
 
 
 
 
@@ -394,7 +394,7 @@ begin
 end;
 end;
 
 
 function FindSectionNetwareNLM(var e:TExeFile;const asecname:string;var secofs,seclen:longint):boolean;
 function FindSectionNetwareNLM(var e:TExeFile;const asecname:string;var secofs,seclen:longint):boolean;
-var name : string;
+var name : shortstring;
     alignAmount : longint;
     alignAmount : longint;
 begin
 begin
   seek(e.f,e.sechdrofs);
   seek(e.f,e.sechdrofs);
@@ -427,7 +427,7 @@ end;
 {$if defined(PE32) or defined(PE32PLUS) or defined(GO32V2)}
 {$if defined(PE32) or defined(PE32PLUS) or defined(GO32V2)}
 type
 type
   tcoffsechdr=packed record
   tcoffsechdr=packed record
-    name     : array[0..7] of char;
+    name     : array[0..7] of ansichar;
     vsize    : longint;
     vsize    : longint;
     rvaofs   : longint;
     rvaofs   : longint;
     datalen  : longint;
     datalen  : longint;
@@ -439,7 +439,7 @@ type
     flags    : longint;
     flags    : longint;
   end;
   end;
   coffsymbol=packed record
   coffsymbol=packed record
-    name    : array[0..3] of char; { real is [0..7], which overlaps the strofs ! }
+    name    : array[0..3] of ansichar; { real is [0..7], which overlaps the strofs ! }
     strofs  : longint;
     strofs  : longint;
     value   : longint;
     value   : longint;
     section : smallint;
     section : smallint;
@@ -448,12 +448,12 @@ type
     aux     : byte;
     aux     : byte;
   end;
   end;
 
 
-function FindSectionCoff(var e:TExeFile;const asecname:string;var secofs,seclen:longint):boolean;
+function FindSectionCoff(var e:TExeFile;const asecname:shortstring;var secofs,seclen:longint):boolean;
 var
 var
   i : longint;
   i : longint;
   sechdr     : tcoffsechdr;
   sechdr     : tcoffsechdr;
-  secname    : string;
-  secnamebuf : array[0..255] of char;
+  secname    : shortstring;
+  secnamebuf : array[0..255] of ansichar;
   code,
   code,
   oldofs,
   oldofs,
   bufsize    : longint;
   bufsize    : longint;
@@ -696,10 +696,10 @@ end;
 {$IFDEF EMX}
 {$IFDEF EMX}
 type
 type
   TEmxHeader = packed record
   TEmxHeader = packed record
-     Version: array [1..16] of char;
+     Version: array [1..16] of AnsiChar;
      Bound: word;
      Bound: word;
      AoutOfs: longint;
      AoutOfs: longint;
-     Options: array [1..42] of char;
+     Options: array [1..42] of AnsiChar;
   end;
   end;
 
 
   TAoutHeader = packed record
   TAoutHeader = packed record
@@ -777,7 +777,7 @@ begin
 end;
 end;
 
 
 
 
-function FindSectionEMXaout (var E: TExeFile; const ASecName: string;
+function FindSectionEMXaout (var E: TExeFile; const ASecName: shortstring;
                                          var SecOfs, SecLen: longint): boolean;
                                          var SecOfs, SecLen: longint): boolean;
 begin
 begin
  FindSectionEMXaout := false;
  FindSectionEMXaout := false;
@@ -922,7 +922,7 @@ const
   AT_EXE_FN = 31;  {AT_EXECFN }
   AT_EXE_FN = 31;  {AT_EXECFN }
 
 
 var
 var
-  pc : ppchar;
+  pc : PPAnsiChar;
   pat_hdr : P_AT_HDR;
   pat_hdr : P_AT_HDR;
   i, phdr_count : ptrint;
   i, phdr_count : ptrint;
   phdr_size : ptruint;
   phdr_size : ptruint;
@@ -956,7 +956,7 @@ begin
         if pat_hdr^.typ = AT_HDR_Addr then
         if pat_hdr^.typ = AT_HDR_Addr then
           phdr := pointer(pat_hdr^.value);
           phdr := pointer(pat_hdr^.value);
         if pat_hdr^.typ = AT_EXE_FN then
         if pat_hdr^.typ = AT_EXE_FN then
-          filename:=strpas(pchar(pat_hdr^.value));
+          filename:=strpas(pansichar(pat_hdr^.value));
         inc (pointer(pat_hdr),sizeof(AT_HDR));
         inc (pointer(pat_hdr),sizeof(AT_HDR));
       end;
       end;
     if (phdr_count>0) and (phdr_size = sizeof (telfproghdr))
     if (phdr_count>0) and (phdr_size = sizeof (telfproghdr))
@@ -1071,11 +1071,11 @@ begin
 end;
 end;
 
 
 
 
-function FindSectionElf(var e:TExeFile;const asecname:string;var secofs,seclen:longint):boolean;
+function FindSectionElf(var e:TExeFile;const asecname:shortstring;var secofs,seclen:longint):boolean;
 var
 var
   elfsec     : telfsechdr;
   elfsec     : telfsechdr;
   secname    : string;
   secname    : string;
-  secnamebuf : array[0..255] of char;
+  secnamebuf : array[0..255] of ansichar;
   oldofs,
   oldofs,
   bufsize,i  : longint;
   bufsize,i  : longint;
 begin
 begin
@@ -1186,7 +1186,7 @@ type
   tmach_segment_command = record
   tmach_segment_command = record
     cmd     : cuint32;
     cmd     : cuint32;
     cmdsize : cuint32;
     cmdsize : cuint32;
-    segname : array [0..15] of Char;
+    segname : array [0..15] of AnsiChar;
     vmaddr  : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
     vmaddr  : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
     vmsize  : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
     vmsize  : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
     fileoff : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
     fileoff : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
@@ -1206,8 +1206,8 @@ type
   pmach_uuid_command = ^tmach_uuid_command;
   pmach_uuid_command = ^tmach_uuid_command;
 
 
   tmach_section = record
   tmach_section = record
-    sectname : array [0..15] of Char;
-    segname  : array [0..15] of Char;
+    sectname : array [0..15] of AnsiChar;
+    segname  : array [0..15] of AnsiChar;
     addr     : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
     addr     : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
     size     : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
     size     : {$IFDEF CPU64}cuint64{$ELSE}cuint32{$ENDIF};
     offset   : cuint32;
     offset   : cuint32;
@@ -1348,7 +1348,7 @@ begin
 end;
 end;
 
 
 
 
-function FindSectionMachO(var e:TExeFile;const asecname:string;var secofs,seclen:longint):boolean;
+function FindSectionMachO(var e:TExeFile;const asecname:shortstring;var secofs,seclen:longint):boolean;
 var
 var
    i, j: cuint32;
    i, j: cuint32;
    cmd: pmach_load_command;
    cmd: pmach_load_command;
@@ -1357,7 +1357,7 @@ var
    section: pmach_section;
    section: pmach_section;
    mappedexe: pointer;
    mappedexe: pointer;
    mappedoffset, mappedsize: SizeUInt;
    mappedoffset, mappedsize: SizeUInt;
-   dwarfsecname: string;
+   dwarfsecname: shortstring;
 begin
 begin
   FindSectionMachO:=false;
   FindSectionMachO:=false;
   { make sure to unmap again on all exit paths }
   { make sure to unmap again on all exit paths }
@@ -1449,7 +1449,7 @@ end;
 Function UpdateCrc32(InitCrc:cardinal;const InBuf;InLen:LongInt):cardinal;
 Function UpdateCrc32(InitCrc:cardinal;const InBuf;InLen:LongInt):cardinal;
 var
 var
   i : LongInt;
   i : LongInt;
-  p : pchar;
+  p : pansichar;
 begin
 begin
   if Crc32Tbl[1]=0 then
   if Crc32Tbl[1]=0 then
    MakeCrc32Tbl;
    MakeCrc32Tbl;
@@ -1470,7 +1470,7 @@ end;
 
 
 type
 type
   TOpenProc=function(var e:TExeFile):boolean;
   TOpenProc=function(var e:TExeFile):boolean;
-  TFindSectionProc=function(var e:TExeFile;const asecname:string;var secofs,seclen:longint):boolean;
+  TFindSectionProc=function(var e:TExeFile;const asecname:shortstring;var secofs,seclen:longint):boolean;
 
 
   TExeProcRec=record
   TExeProcRec=record
     openproc : TOpenProc;
     openproc : TOpenProc;
@@ -1509,7 +1509,7 @@ const
 {$endif}
 {$endif}
    );
    );
 
 
-function OpenExeFile(var e:TExeFile;const fn:string):boolean;
+function OpenExeFile(var e:TExeFile;const fn:shortstring):boolean;
 var
 var
   ofm : word;
   ofm : word;
 begin
 begin
@@ -1550,7 +1550,7 @@ begin
 end;
 end;
 
 
 
 
-function FindExeSection(var e:TExeFile;const secname:string;var secofs,seclen:longint):boolean;
+function FindExeSection(var e:TExeFile;const secname:shortstring;var secofs,seclen:longint):boolean;
 begin
 begin
   FindExeSection:=false;
   FindExeSection:=false;
   if not e.isopen then
   if not e.isopen then
@@ -1561,7 +1561,7 @@ end;
 
 
 
 
 
 
-function CheckDbgFile(var e:TExeFile;const fn:string;dbgcrc:cardinal):boolean;
+function CheckDbgFile(var e:TExeFile;const fn:shortstring;dbgcrc:cardinal):boolean;
 var
 var
   c      : cardinal;
   c      : cardinal;
   ofm    : word;
   ofm    : word;
@@ -1588,9 +1588,9 @@ begin
 end;
 end;
 
 
 {$ifndef darwin}
 {$ifndef darwin}
-function ReadDebugLink(var e:TExeFile;var dbgfn:string):boolean;
+function ReadDebugLink(var e:TExeFile;var dbgfn:shortstring):boolean;
 var
 var
-  dbglink : array[0..255] of char;
+  dbglink : array[0..255] of AnsiChar;
   i,
   i,
   dbglinklen,
   dbglinklen,
   dbglinkofs : longint;
   dbglinkofs : longint;
@@ -1632,7 +1632,7 @@ begin
     end;
     end;
 end;
 end;
 {$else}
 {$else}
-function ReadDebugLink(var e:TExeFile;var dbgfn:string):boolean;
+function ReadDebugLink(var e:TExeFile;var dbgfn:shortstring):boolean;
 var
 var
    dsymexefile: TExeFile;
    dsymexefile: TExeFile;
    execmd, dsymcmd: pmach_load_command;
    execmd, dsymcmd: pmach_load_command;

+ 24 - 24
rtl/inc/extres.inc

@@ -40,7 +40,7 @@ const
 
 
 type
 type
   TExtHeader = packed record
   TExtHeader = packed record
-    magic : array[0..5] of char;//'FPCRES'
+    magic : array[0..5] of AnsiChar;//'FPCRES'
     version : byte;             //EXT_CURRENT_VERSION
     version : byte;             //EXT_CURRENT_VERSION
     endianess : byte;           //EXT_ENDIAN_BIG or EXT_ENDIAN_LITTLE
     endianess : byte;           //EXT_ENDIAN_BIG or EXT_ENDIAN_LITTLE
     count : longword;           //resource count
     count : longword;           //resource count
@@ -85,10 +85,10 @@ var ResHeader : PExtHeader = nil;
 *****************************************************************************)
 *****************************************************************************)
 
 
 //resource functions are case insensitive... copied from genstr.inc
 //resource functions are case insensitive... copied from genstr.inc
-function ResStrIComp(Str1, Str2 : PChar): SizeInt;
+function ResStrIComp(Str1, Str2 : PAnsiChar): SizeInt;
 var
 var
   counter: SizeInt;
   counter: SizeInt;
-  c1, c2: char;
+  c1, c2: AnsiChar;
 begin
 begin
   counter := 0;
   counter := 0;
   c1 := upcase(str1[counter]);
   c1 := upcase(str1[counter]);
@@ -104,8 +104,8 @@ begin
 end;
 end;
 
 
 {!fixme!}
 {!fixme!}
-//function InternalIsIntResource(aStr : pchar; out aInt : PtrUint) : boolean;
-function InternalIsIntResource(aStr : pchar; var aInt : PtrUint) : boolean;
+//function InternalIsIntResource(aStr : PAnsiChar; out aInt : PtrUint) : boolean;
+function InternalIsIntResource(aStr : PAnsiChar; var aInt : PtrUint) : boolean;
 var i : integer;
 var i : integer;
     s : shortstring;
     s : shortstring;
     code : word;
     code : word;
@@ -134,9 +134,9 @@ begin
   GetResInfoPtr:=PResInfoNode(PtrUInt(ResHeader)+offset);
   GetResInfoPtr:=PResInfoNode(PtrUInt(ResHeader)+offset);
 end;
 end;
 
 
-function GetPchar(const offset : longword) : Pchar; inline;
+function GetPchar(const offset : longword) : PAnsiChar; inline;
 begin
 begin
-  GetPchar:=Pchar(PtrUInt(ResHeader)+offset);
+  GetPchar:=PAnsiChar(PtrUInt(ResHeader)+offset);
 end;
 end;
 
 
 function GetPtr(const offset : longword) : Pointer; inline;
 function GetPtr(const offset : longword) : Pointer; inline;
@@ -160,7 +160,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function GetExtResPath : pchar;
+function GetExtResPath : PAnsiChar;
 var len, i : integer;
 var len, i : integer;
     pathstr : shortstring;
     pathstr : shortstring;
 begin
 begin
@@ -182,10 +182,10 @@ begin
   //writeln('Resource file is ',GetExtResPath);
   //writeln('Resource file is ',GetExtResPath);
 end;
 end;
 
 
-function BinSearchStr(arr : PResInfoNode; query : pchar; left, right : integer)
+function BinSearchStr(arr : PResInfoNode; query : PAnsiChar; left, right : integer)
 : PResInfoNode;
 : PResInfoNode;
 var pivot, res : integer;
 var pivot, res : integer;
-    resstr : pchar;
+    resstr : PAnsiChar;
 begin
 begin
   BinSearchStr:=nil;
   BinSearchStr:=nil;
   while left<=right do
   while left<=right do
@@ -203,7 +203,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function BinSearchInt(arr : PResInfoNode; query : pchar; left, right : integer)
+function BinSearchInt(arr : PResInfoNode; query : PAnsiChar; left, right : integer)
 : PResInfoNode;
 : PResInfoNode;
 var pivot : integer;
 var pivot : integer;
 begin
 begin
@@ -221,11 +221,11 @@ begin
   end;
   end;
 end;
 end;
 
 
-function BinSearchRes(root : PResInfoNode; aDesc : PChar) : PResInfoNode;
+function BinSearchRes(root : PResInfoNode; aDesc : PAnsiChar) : PResInfoNode;
 var aID : PtrUint;
 var aID : PtrUint;
 begin
 begin
   if InternalIsIntResource(aDesc,aID) then
   if InternalIsIntResource(aDesc,aID) then
-    BinSearchRes:=BinSearchInt(GetResInfoPtr(root^.subptr),PChar(aID),
+    BinSearchRes:=BinSearchInt(GetResInfoPtr(root^.subptr),PAnsiChar(aID),
       root^.ncounthandle,root^.ncounthandle+root^.idcountsize-1)
       root^.ncounthandle,root^.ncounthandle+root^.idcountsize-1)
   else
   else
     BinSearchRes:=BinSearchStr(GetResInfoPtr(root^.subptr),aDesc,0,
     BinSearchRes:=BinSearchStr(GetResInfoPtr(root^.subptr),aDesc,0,
@@ -233,7 +233,7 @@ begin
 end;
 end;
 
 
 //Returns a pointer to a name node.
 //Returns a pointer to a name node.
-function InternalFindResource(ResourceName, ResourceType: PChar):
+function InternalFindResource(ResourceName, ResourceType: PAnsiChar):
  PResInfoNode;
  PResInfoNode;
 begin
 begin
   InternalFindResource:=nil;
   InternalFindResource:=nil;
@@ -268,7 +268,7 @@ procedure InitResources;
 const
 const
   PROT_READ  = 1;
   PROT_READ  = 1;
   PROT_WRITE = 2;
   PROT_WRITE = 2;
-var respath : pchar;
+var respath : PAnsiChar;
     fdstat : stat;
     fdstat : stat;
 begin
 begin
   respath:=GetExtResPath;
   respath:=GetExtResPath;
@@ -322,7 +322,7 @@ end;
 
 
 {$IFDEF EXTRES_GENERIC}
 {$IFDEF EXTRES_GENERIC}
 procedure InitResources;
 procedure InitResources;
-var respath : pchar;
+var respath : PAnsiChar;
     tmp : longword;
     tmp : longword;
     tmpptr : pbyte;
     tmpptr : pbyte;
 label ExitErrMem, ExitErrFile, ExitNoErr;
 label ExitErrMem, ExitErrFile, ExitNoErr;
@@ -396,7 +396,7 @@ end;
 function ExtEnumResourceTypes(ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
 function ExtEnumResourceTypes(ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
 var ptr : PResInfoNode;
 var ptr : PResInfoNode;
     totn, totid, i : longword;
     totn, totid, i : longword;
-    pc : pchar;
+    pc : PAnsiChar;
 begin
 begin
   ExtEnumResourceTypes:=False;
   ExtEnumResourceTypes:=False;
   if ResHeader=nil then exit;
   if ResHeader=nil then exit;
@@ -414,15 +414,15 @@ begin
   end;
   end;
   while i<totid do
   while i<totid do
   begin
   begin
-    if not EnumFunc(ModuleHandle,PChar(ptr[i].nameid),lParam) then exit;
+    if not EnumFunc(ModuleHandle,PAnsiChar(ptr[i].nameid),lParam) then exit;
     inc(i);
     inc(i);
   end;
   end;
 end;
 end;
 
 
-function ExtEnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
+function ExtEnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PAnsiChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
 var ptr : PResInfoNode;
 var ptr : PResInfoNode;
     totn, totid, i : longword;
     totn, totid, i : longword;
-    pc : pchar;
+    pc : PAnsiChar;
 begin
 begin
   ExtEnumResourceNames:=False;
   ExtEnumResourceNames:=False;
   if ResHeader=nil then exit;
   if ResHeader=nil then exit;
@@ -444,12 +444,12 @@ begin
   end;
   end;
   while i<totid do
   while i<totid do
   begin
   begin
-    if not EnumFunc(ModuleHandle,ResourceType,PChar(ptr[i].nameid),lParam) then exit;
+    if not EnumFunc(ModuleHandle,ResourceType,PAnsiChar(ptr[i].nameid),lParam) then exit;
     inc(i);
     inc(i);
   end;
   end;
 end;
 end;
 
 
-function ExtEnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
+function ExtEnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PAnsiChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
 var ptr : PResInfoNode;
 var ptr : PResInfoNode;
     tot, i : integer;
     tot, i : integer;
 begin
 begin
@@ -468,7 +468,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-Function ExtFindResource(ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PChar)
+Function ExtFindResource(ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PAnsiChar)
 : TFPResourceHandle;
 : TFPResourceHandle;
 var ptr : PResInfoNode;
 var ptr : PResInfoNode;
 begin
 begin
@@ -493,7 +493,7 @@ begin
 end;
 end;
 
 
 Function ExtFindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType,
 Function ExtFindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType,
-  ResourceName: PChar; Language : word): TFPResourceHandle;
+  ResourceName: PAnsiChar; Language : word): TFPResourceHandle;
 const LANG_NEUTRAL = 0;
 const LANG_NEUTRAL = 0;
       LANG_ENGLISH = 9;
       LANG_ENGLISH = 9;
 var nameptr,ptr : PResInfoNode;
 var nameptr,ptr : PResInfoNode;

+ 1 - 1
rtl/inc/fexpand.inc

@@ -651,7 +651,7 @@ end;
    environments - DOS, OS/2, Win32). Example is 'C:\TEST'.
    environments - DOS, OS/2, Win32). Example is 'C:\TEST'.
 
 
    FPC_FEXPAND_GETENV_PCHAR - an implementation of GetEnv returning
    FPC_FEXPAND_GETENV_PCHAR - an implementation of GetEnv returning
-   PChar instead of a shortstring is available (Unix) to support
+   PAnsiChar instead of a shortstring is available (Unix) to support
    long values of environment variables.
    long values of environment variables.
 
 
    FPC_FEXPAND_TILDE - expansion of '~/' to GetEnv('HOME') - Unix.
    FPC_FEXPAND_TILDE - expansion of '~/' to GetEnv('HOME') - Unix.

+ 5 - 5
rtl/inc/file.inc

@@ -46,7 +46,7 @@ Begin
     UnicodeString(FileRec(f).FullName):=Name;
     UnicodeString(FileRec(f).FullName):=Name;
 {$endif USE_FILEREC_FULLNAME}
 {$endif USE_FILEREC_FULLNAME}
 {$endif FPC_ANSI_TEXTFILEREC}
 {$endif FPC_ANSI_TEXTFILEREC}
-  { null terminate, since the name array is regularly used as p(wide)char }
+  { null terminate, since the name array is regularly used as p(wide/Ansi)Char }
   FileRec(f).Name[high(FileRec(f).Name)]:=#0;
   FileRec(f).Name[high(FileRec(f).Name)]:=#0;
 End;
 End;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
@@ -73,7 +73,7 @@ Begin
     UnicodeString(FileRec(f).FullName):=Name;
     UnicodeString(FileRec(f).FullName):=Name;
 {$endif USE_FILEREC_FULLNAME}
 {$endif USE_FILEREC_FULLNAME}
 {$endif FPC_ANSI_TEXTFILEREC}
 {$endif FPC_ANSI_TEXTFILEREC}
-  { null terminate, since the name array is regularly used as p(wide)char }
+  { null terminate, since the name array is regularly used as p(wide/Ansi)Char }
   FileRec(f).Name[high(FileRec(f).Name)]:=#0;
   FileRec(f).Name[high(FileRec(f).Name)]:=#0;
 End;
 End;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
@@ -89,7 +89,7 @@ Begin
   InitFile(f);
   InitFile(f);
   { warning: no encoding support }
   { warning: no encoding support }
   FileRec(f).Name:=Name;
   FileRec(f).Name:=Name;
-  { null terminate, since the name array is regularly used as p(wide)char }
+  { null terminate, since the name array is regularly used as p(wide/Ansi)Char }
   FileRec(f).Name[high(FileRec(f).Name)]:=#0;
   FileRec(f).Name[high(FileRec(f).Name)]:=#0;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 End;
 End;
@@ -629,11 +629,11 @@ Begin
 End;
 End;
 {$else FPC_HAS_FEATURE_ANSISTRINGS}
 {$else FPC_HAS_FEATURE_ANSISTRINGS}
 var
 var
-  p : array[0..255] Of Char;
+  p : array[0..255] Of AnsiChar;
 Begin
 Begin
   Move(s[1],p,Length(s));
   Move(s[1],p,Length(s));
   p[Length(s)]:=#0;
   p[Length(s)]:=#0;
-  Rename(f,Pchar(@p));
+  Rename(f,PAnsichar(@p));
 End;
 End;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 

+ 12 - 11
rtl/inc/flt_core.inc

@@ -932,7 +932,7 @@ end;
  |
  |
  *-------------------------------------------------------*)
  *-------------------------------------------------------*)
 {$ifdef cpujvm}
 {$ifdef cpujvm}
-procedure do_fillchar( var str: shortstring; pos, count: integer; c: char );
+procedure do_fillchar( var str: shortstring; pos, count: integer; c: AnsiChar );
 begin
 begin
   while count>0 do
   while count>0 do
     begin
     begin
@@ -942,7 +942,7 @@ begin
     end;
     end;
 end;
 end;
 {$else not cpujvm}
 {$else not cpujvm}
-procedure do_fillchar( var str: shortstring; pos, count: integer; c: char ); {$ifdef grisu1_inline}inline;{$endif}
+procedure do_fillchar( var str: shortstring; pos, count: integer; c: AnsiChar ); {$ifdef grisu1_inline}inline;{$endif}
 begin
 begin
   fillchar( str[pos], count, c );
   fillchar( str[pos], count, c );
 end;
 end;
@@ -1057,7 +1057,7 @@ begin
     if rounded then
     if rounded then
         while ( n_before_dot > 0 ) do
         while ( n_before_dot > 0 ) do
         begin
         begin
-            str[i] := char( temp_round[j] + ord('0') );
+            str[i] := AnsiChar( temp_round[j] + ord('0') );
             inc( i );
             inc( i );
             inc( j );
             inc( j );
             dec( n_before_dot );
             dec( n_before_dot );
@@ -1065,7 +1065,7 @@ begin
     else
     else
         while ( n_before_dot > 0 ) do
         while ( n_before_dot > 0 ) do
         begin
         begin
-            str[i] := char( digits[j] + ord('0') );
+            str[i] := AnsiChar( digits[j] + ord('0') );
             inc( i );
             inc( i );
             inc( j );
             inc( j );
             dec( n_before_dot );
             dec( n_before_dot );
@@ -1092,7 +1092,7 @@ begin
         if rounded then
         if rounded then
             while ( n_after_dot > 0 ) do
             while ( n_after_dot > 0 ) do
             begin
             begin
-                str[i] := char( temp_round[j] + ord('0') );
+                str[i] := AnsiChar( temp_round[j] + ord('0') );
                 inc( i );
                 inc( i );
                 inc( j );
                 inc( j );
                 dec( n_after_dot );
                 dec( n_after_dot );
@@ -1100,7 +1100,7 @@ begin
         else
         else
             while ( n_after_dot > 0 ) do
             while ( n_after_dot > 0 ) do
             begin
             begin
-                str[i] := char( digits[j] + ord('0') );
+                str[i] := AnsiChar( digits[j] + ord('0') );
                 inc( i );
                 inc( i );
                 inc( j );
                 inc( j );
                 dec( n_after_dot );
                 dec( n_after_dot );
@@ -1175,7 +1175,7 @@ begin
     inc( i );
     inc( i );
     // Integer part
     // Integer part
     if ( n_digits_have > 0 ) then
     if ( n_digits_have > 0 ) then
-        str[i] := char( digits[0] + ord('0') )
+        str[i] := AnsiChar( digits[0] + ord('0') )
     else
     else
         str[i] := '0';
         str[i] := '0';
     inc( i );
     inc( i );
@@ -1189,7 +1189,7 @@ begin
     j := 1;
     j := 1;
     while ( j < n_digits_have ) and ( j < n_digits_req ) do
     while ( j < n_digits_have ) and ( j < n_digits_req ) do
     begin
     begin
-        str[i] := char( digits[j] + ord('0') );
+        str[i] := AnsiChar( digits[j] + ord('0') );
         inc( i );
         inc( i );
         inc( j );
         inc( j );
     end;
     end;
@@ -1219,7 +1219,7 @@ begin
     // Exponent digits
     // Exponent digits
     for j := 0 to n_exp - 1 do
     for j := 0 to n_exp - 1 do
     begin
     begin
-        str[i] := char( buf_exp[j] + ord('0') );
+        str[i] := AnsiChar( buf_exp[j] + ord('0') );
         inc( i );
         inc( i );
     end;
     end;
 {$ifdef grisu1_debug}
 {$ifdef grisu1_debug}
@@ -1906,7 +1906,8 @@ end;
 (****************************************************************************)
 (****************************************************************************)
 
 
 {$ifndef fpc_softfpu_implementation}
 {$ifndef fpc_softfpu_implementation}
-procedure str_real_iso( len, f: longint; d: ValReal; real_type: treal_type; out s: string );
+procedure str_real_iso( len, f: longint; d: ValReal; real_type: treal_type; out s:
+shortstring );
 var
 var
     i: integer;
     i: integer;
 begin
 begin
@@ -2273,7 +2274,7 @@ end;
 
 
 (****************************************************************************)
 (****************************************************************************)
 var
 var
-    a: char;
+    a: AnsiChar;
     mantissa, bit_round, bit_round_mask: {$ifdef VALREAL_32} dword {$else} qword {$endif};
     mantissa, bit_round, bit_round_mask: {$ifdef VALREAL_32} dword {$else} qword {$endif};
 {$ifdef VALREAL_80}
 {$ifdef VALREAL_80}
     mantissa_h: dword;
     mantissa_h: dword;

+ 1 - 0
rtl/inc/fpintres.pp

@@ -14,6 +14,7 @@
 
 
  **********************************************************************}
  **********************************************************************}
 unit fpintres;
 unit fpintres;
+{$mode fpc}
 
 
 interface
 interface
 
 

+ 27 - 27
rtl/inc/generic.inc

@@ -58,9 +58,9 @@ end;
 
 
 {$ifndef FPC_HAS_SHORTSTR_CHARARRAY_INTERN_CHARMOVE}
 {$ifndef FPC_HAS_SHORTSTR_CHARARRAY_INTERN_CHARMOVE}
 {$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);
+procedure fpc_shortstr_chararray_intern_charmove(const src: shortstring; out dst: array of ansichar; const len: sizeint);
 begin
 begin
-  move(src[1],pchar(@dst)^,len);
+  move(src[1],PAnsiChar(@dst)^,len);
 end;
 end;
 {$endif FPC_HAS_SHORTSTR_CHARARRAY_INTERN_CHARMOVE}
 {$endif FPC_HAS_SHORTSTR_CHARARRAY_INTERN_CHARMOVE}
 
 
@@ -619,7 +619,7 @@ end;
 
 
 
 
 {$ifndef FPC_SYSTEM_HAS_INDEXCHAR0}
 {$ifndef FPC_SYSTEM_HAS_INDEXCHAR0}
-function IndexChar0(Const buf;len:SizeInt;b:Char):SizeInt;
+function IndexChar0(Const buf;len:SizeInt;b:AnsiChar):SizeInt;
 var
 var
   psrc,pend : pbyte;
   psrc,pend : pbyte;
 begin
 begin
@@ -826,7 +826,7 @@ begin
     len:=slen;
     len:=slen;
   move(sstr^,dstr^,len+1);
   move(sstr^,dstr^,len+1);
   if slen>len then
   if slen>len then
-    pchar(dstr)^:=chr(len);
+    PAnsiChar(dstr)^:=chr(len);
 end;
 end;
 
 
 {$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_ASSIGN}
 {$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_ASSIGN}
@@ -991,7 +991,7 @@ end;
 {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
 {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
 
 
 
 
-procedure fpc_pchar_to_shortstr(out res : shortstring;p:pchar);[public,alias:'FPC_PCHAR_TO_SHORTSTR']; compilerproc;
+procedure fpc_pchar_to_shortstr(out res : shortstring;p:PAnsiChar);[public,alias:'FPC_PCHAR_TO_SHORTSTR']; compilerproc;
 var
 var
   l : ObjpasInt;
   l : ObjpasInt;
   s: shortstring;
   s: shortstring;
@@ -1014,10 +1014,10 @@ end;
 {$ifndef cpujvm}
 {$ifndef cpujvm}
 
 
 { also define alias which can be used inside the system unit }
 { also define alias which can be used inside the system unit }
-procedure fpc_pchar_to_shortstr(out res : shortstring;p:pchar);[external name 'FPC_PCHAR_TO_SHORTSTR'];
+procedure fpc_pchar_to_shortstr(out res : shortstring;p:PAnsiChar);[external name 'FPC_PCHAR_TO_SHORTSTR'];
 
 
 
 
-function strpas(p:pchar):shortstring;{$ifdef SYSTEMINLINE}inline;{$endif}
+function strpas(p:PAnsiChar):shortstring;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
     fpc_pchar_to_shortstr(result,p);
     fpc_pchar_to_shortstr(result,p);
   end;
   end;
@@ -1264,7 +1264,7 @@ function Utf8CodePointLen(P: PAnsiChar; MaxLookAhead: SizeInt; IncludeCombiningD
 
 
 {$ifndef FPC_SYSTEM_HAS_FPC_CHARARRAY_TO_SHORTSTR}
 {$ifndef FPC_SYSTEM_HAS_FPC_CHARARRAY_TO_SHORTSTR}
 
 
-procedure fpc_chararray_to_shortstr(out res : shortstring;const arr: array of char; zerobased: boolean = true);[public,alias:'FPC_CHARARRAY_TO_SHORTSTR']; compilerproc;
+procedure fpc_chararray_to_shortstr(out res : shortstring;const arr: array of AnsiChar; zerobased: boolean = true);[public,alias:'FPC_CHARARRAY_TO_SHORTSTR']; compilerproc;
 var
 var
  l: ObjpasInt;
  l: ObjpasInt;
  index: ObjpasInt;
  index: ObjpasInt;
@@ -1294,7 +1294,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_TO_CHARARRAY}
 {$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_TO_CHARARRAY}
 
 
-procedure fpc_shortstr_to_chararray(out res: array of char; const src: ShortString); compilerproc;
+procedure fpc_shortstr_to_chararray(out res: array of AnsiChar; const src: ShortString); compilerproc;
 var
 var
   len: ObjpasInt;
   len: ObjpasInt;
 begin
 begin
@@ -1302,7 +1302,7 @@ begin
   if len > length(res) then
   if len > length(res) then
     len := length(res);
     len := length(res);
 {$push}{$r-}
 {$push}{$r-}
-  { make sure we don't access char 1 if length is 0 (JM) }
+  { make sure we don't access AnsiChar 1 if length is 0 (JM) }
   if len > 0 then
   if len > 0 then
     move(src[1],res[0],len);
     move(src[1],res[0],len);
   fillchar(res[len],length(res)-len,0);
   fillchar(res[len],length(res)-len,0);
@@ -1313,7 +1313,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
 {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
 
 
-function fpc_pchar_length(p:pchar):sizeint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
+function fpc_pchar_length(p:PAnsiChar):sizeint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
 begin
 begin
   if assigned(p) then
   if assigned(p) then
     Result:=IndexByte(p^,high(Result),0)
     Result:=IndexByte(p^,high(Result),0)
@@ -2487,7 +2487,7 @@ var
   m,m1 : longword;
   m,m1 : longword;
   pcstart,
   pcstart,
   pc2start,
   pc2start,
-  pc,pc2 : pchar;
+  pc,pc2 : PAnsiChar;
   hs : string[32];
   hs : string[32];
   overflow : longint;
   overflow : longint;
 begin
 begin
@@ -2501,12 +2501,12 @@ begin
     end
     end
   else
   else
     m:=longword(l);
     m:=longword(l);
-  pcstart:=pchar(@hs[0]);
+  pcstart:=PAnsiChar(@hs[0]);
   pc:=pcstart;
   pc:=pcstart;
   repeat
   repeat
     m1:=m div 10;
     m1:=m div 10;
     inc(pc);
     inc(pc);
-    pc^:=char(m-(m1*10)+byte('0'));
+    pc^:=AnsiChar(m-(m1*10)+byte('0'));
     m:=m1;
     m:=m1;
   until m=0;
   until m=0;
   overflow:=(pc-pcstart)+(pc2-pc2start)-high(s);
   overflow:=(pc-pcstart)+(pc2-pc2start)-high(s);
@@ -2518,7 +2518,7 @@ begin
       inc(pc2);
       inc(pc2);
       dec(pc);
       dec(pc);
     end;
     end;
-  s[0]:=char(pc2-pc2start);
+  s[0]:=AnsiChar(pc2-pc2start);
 end;
 end;
 
 
 {$endif ndef FPC_SYSTEM_HAS_INT_STR_LONGINT}
 {$endif ndef FPC_SYSTEM_HAS_INT_STR_LONGINT}
@@ -2530,18 +2530,18 @@ var
   m1 : longword;
   m1 : longword;
   pcstart,
   pcstart,
   pc2start,
   pc2start,
-  pc,pc2 : pchar;
+  pc,pc2 : PAnsiChar;
   hs : string[32];
   hs : string[32];
   overflow : longint;
   overflow : longint;
 begin
 begin
   pc2start:=@s[1];
   pc2start:=@s[1];
   pc2:=pc2start;
   pc2:=pc2start;
-  pcstart:=pchar(@hs[0]);
+  pcstart:=PAnsiChar(@hs[0]);
   pc:=pcstart;
   pc:=pcstart;
   repeat
   repeat
     inc(pc);
     inc(pc);
     m1:=l div 10;
     m1:=l div 10;
-    pc^:=char(l-(m1*10)+byte('0'));
+    pc^:=AnsiChar(l-(m1*10)+byte('0'));
     l:=m1;
     l:=m1;
   until l=0;
   until l=0;
   overflow:=(pc-pcstart)-high(s);
   overflow:=(pc-pcstart)-high(s);
@@ -2553,7 +2553,7 @@ begin
       inc(pc2);
       inc(pc2);
       dec(pc);
       dec(pc);
     end;
     end;
-  s[0]:=char(pc2-pc2start);
+  s[0]:=AnsiChar(pc2-pc2start);
 end;
 end;
 
 
 {$endif ndef FPC_SYSTEM_HAS_INT_STR_LONGWORD}
 {$endif ndef FPC_SYSTEM_HAS_INT_STR_LONGWORD}
@@ -2570,7 +2570,7 @@ var
   m,m1 : qword;
   m,m1 : qword;
   pcstart,
   pcstart,
   pc2start,
   pc2start,
-  pc,pc2 : pchar;
+  pc,pc2 : PAnsiChar;
   hs : string[32];
   hs : string[32];
   overflow : longint;
   overflow : longint;
 begin
 begin
@@ -2584,12 +2584,12 @@ begin
     end
     end
   else
   else
     m:=qword(l);
     m:=qword(l);
-  pcstart:=pchar(@hs[0]);
+  pcstart:=PAnsiChar(@hs[0]);
   pc:=pcstart;
   pc:=pcstart;
   repeat
   repeat
     m1:=m div 10;
     m1:=m div 10;
     inc(pc);
     inc(pc);
-    pc^:=char(m-(m1*10)+byte('0'));
+    pc^:=AnsiChar(m-(m1*10)+byte('0'));
     m:=m1;
     m:=m1;
   until m=0;
   until m=0;
   overflow:=(pc-pcstart)+(pc2-pc2start)-high(s);
   overflow:=(pc-pcstart)+(pc2-pc2start)-high(s);
@@ -2601,7 +2601,7 @@ begin
       inc(pc2);
       inc(pc2);
       dec(pc);
       dec(pc);
     end;
     end;
-  s[0]:=char(pc2-pc2start);
+  s[0]:=AnsiChar(pc2-pc2start);
 end;
 end;
 {$endif EXCLUDE_COMPLEX_PROCS}
 {$endif EXCLUDE_COMPLEX_PROCS}
 
 
@@ -2619,18 +2619,18 @@ var
   m1 : qword;
   m1 : qword;
   pcstart,
   pcstart,
   pc2start,
   pc2start,
-  pc,pc2 : pchar;
+  pc,pc2 : PAnsiChar;
   hs : string[64];
   hs : string[64];
   overflow : longint;
   overflow : longint;
 begin
 begin
   pc2start:=@s[1];
   pc2start:=@s[1];
   pc2:=pc2start;
   pc2:=pc2start;
-  pcstart:=pchar(@hs[0]);
+  pcstart:=PAnsiChar(@hs[0]);
   pc:=pcstart;
   pc:=pcstart;
   repeat
   repeat
     inc(pc);
     inc(pc);
     m1:=l div 10;
     m1:=l div 10;
-    pc^:=char(l-(m1*10)+byte('0'));
+    pc^:=AnsiChar(l-(m1*10)+byte('0'));
     l:=m1;
     l:=m1;
   until l=0;
   until l=0;
   overflow:=(pc-pcstart)-high(s);
   overflow:=(pc-pcstart)-high(s);
@@ -2642,7 +2642,7 @@ begin
       inc(pc2);
       inc(pc2);
       dec(pc);
       dec(pc);
     end;
     end;
-  s[0]:=char(pc2-pc2start);
+  s[0]:=AnsiChar(pc2-pc2start);
 end;
 end;
 {$endif EXCLUDE_COMPLEX_PROCS}
 {$endif EXCLUDE_COMPLEX_PROCS}
 
 

+ 20 - 20
rtl/inc/genstr.inc

@@ -13,7 +13,7 @@
  **********************************************************************}
  **********************************************************************}
 
 
 {$ifndef FPC_UNIT_HAS_STREND}
 {$ifndef FPC_UNIT_HAS_STREND}
- Function StrEnd(P: PChar): PChar;
+ Function StrEnd(P: PAnsiChar): PAnsiChar;
  var
  var
   counter: SizeInt;
   counter: SizeInt;
  begin
  begin
@@ -36,7 +36,7 @@
   happen to overlap. So do it in a bit more reliable way.
   happen to overlap. So do it in a bit more reliable way.
   Also this implementation should not need per-platform optimization,
   Also this implementation should not need per-platform optimization,
   given that IndexByte and Move are optimized. }
   given that IndexByte and Move are optimized. }
- Function StrCopy(Dest, Source:PChar): PChar;
+ Function StrCopy(Dest, Source:PAnsiChar): PAnsiChar;
  var
  var
    counter : SizeInt;
    counter : SizeInt;
  Begin
  Begin
@@ -50,7 +50,7 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRUPPER}
 {$ifndef FPC_UNIT_HAS_STRUPPER}
- function StrUpper(P: PChar): PChar;
+ function StrUpper(P: PAnsiChar): PAnsiChar;
  var
  var
   counter: SizeInt;
   counter: SizeInt;
  begin
  begin
@@ -67,7 +67,7 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRLOWER}
 {$ifndef FPC_UNIT_HAS_STRLOWER}
- function StrLower(P: PChar): PChar;
+ function StrLower(P: PAnsiChar): PAnsiChar;
  var
  var
   counter: SizeInt;
   counter: SizeInt;
  begin
  begin
@@ -85,7 +85,7 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRSCAN}
 {$ifndef FPC_UNIT_HAS_STRSCAN}
- function StrScan(P: PChar; C: Char): PChar;
+ function StrScan(P: PAnsiChar; C: AnsiChar): PAnsiChar;
    Var
    Var
      count: SizeInt;
      count: SizeInt;
   Begin
   Begin
@@ -113,10 +113,10 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRISCAN}
 {$ifndef FPC_UNIT_HAS_STRISCAN}
- function StrIScan(P: PChar; C: Char): PChar;
+ function StrIScan(P: PAnsiChar; C: AnsiChar): PAnsiChar;
    Var
    Var
      count: SizeInt;
      count: SizeInt;
-     UC: Char;
+     UC: AnsiChar;
   Begin
   Begin
    UC := upcase(C);
    UC := upcase(C);
    count := 0;
    count := 0;
@@ -143,7 +143,7 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRRSCAN}
 {$ifndef FPC_UNIT_HAS_STRRSCAN}
- function StrRScan(P: PChar; C: Char): PChar;
+ function StrRScan(P: PAnsiChar; C: AnsiChar): PAnsiChar;
  Var
  Var
   count: SizeInt;
   count: SizeInt;
   index: SizeInt;
   index: SizeInt;
@@ -171,11 +171,11 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRRISCAN}
 {$ifndef FPC_UNIT_HAS_STRRISCAN}
- function StrRIScan(P: PChar; C: Char): PChar;
+ function StrRIScan(P: PAnsiChar; C: AnsiChar): PAnsiChar;
  Var
  Var
   count: SizeInt;
   count: SizeInt;
   index: SizeInt;
   index: SizeInt;
-  UC: Char;
+  UC: AnsiChar;
  Begin
  Begin
    UC := upcase(C);
    UC := upcase(C);
    count := Strlen(P);
    count := Strlen(P);
@@ -201,7 +201,7 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRECOPY}
 {$ifndef FPC_UNIT_HAS_STRECOPY}
-  Function StrECopy(Dest, Source: PChar): PChar;
+  Function StrECopy(Dest, Source: PAnsiChar): PAnsiChar;
  { Equivalent to the following:                                          }
  { Equivalent to the following:                                          }
  {  strcopy(Dest,Source);                                                }
  {  strcopy(Dest,Source);                                                }
  {  StrECopy := StrEnd(Dest);                                            }
  {  StrECopy := StrEnd(Dest);                                            }
@@ -217,7 +217,7 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRLCOPY}
 {$ifndef FPC_UNIT_HAS_STRLCOPY}
- Function StrLCopy(Dest,Source: PChar; MaxLen: SizeInt): PChar;
+ Function StrLCopy(Dest,Source: PAnsiChar; MaxLen: SizeInt): PAnsiChar;
   var
   var
    counter: SizeInt;
    counter: SizeInt;
  Begin
  Begin
@@ -230,7 +230,7 @@
    end;
    end;
    while (Source[counter] <> #0)  and (counter < MaxLen) do
    while (Source[counter] <> #0)  and (counter < MaxLen) do
    Begin
    Begin
-      Dest[counter] := char(Source[counter]);
+      Dest[counter] := AnsiChar(Source[counter]);
       Inc(counter);
       Inc(counter);
    end;
    end;
    { terminate the string }
    { terminate the string }
@@ -241,7 +241,7 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRCOMP}
 {$ifndef FPC_UNIT_HAS_STRCOMP}
- function StrComp(Str1, Str2 : PChar): SizeInt;
+ function StrComp(Str1, Str2 : PAnsiChar): SizeInt;
      var
      var
       counter: SizeInt;
       counter: SizeInt;
      Begin
      Begin
@@ -258,10 +258,10 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRICOMP}
 {$ifndef FPC_UNIT_HAS_STRICOMP}
-     function StrIComp(Str1, Str2 : PChar): SizeInt;
+     function StrIComp(Str1, Str2 : PAnsiChar): SizeInt;
      var
      var
       counter: SizeInt;
       counter: SizeInt;
-      c1, c2: char;
+      c1, c2: AnsiChar;
      Begin
      Begin
         counter := 0;
         counter := 0;
         c1 := upcase(str1[counter]);
         c1 := upcase(str1[counter]);
@@ -279,10 +279,10 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRLCOMP}
 {$ifndef FPC_UNIT_HAS_STRLCOMP}
-     function StrLComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;
+     function StrLComp(Str1, Str2 : PAnsiChar; L: SizeInt): SizeInt;
      var
      var
       counter: SizeInt;
       counter: SizeInt;
-      c1, c2: char;
+      c1, c2: AnsiChar;
      Begin
      Begin
         counter := 0;
         counter := 0;
        if L = 0 then
        if L = 0 then
@@ -302,10 +302,10 @@
 
 
 
 
 {$ifndef FPC_UNIT_HAS_STRLICOMP}
 {$ifndef FPC_UNIT_HAS_STRLICOMP}
-     function StrLIComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;
+     function StrLIComp(Str1, Str2 : PAnsiChar; L: SizeInt): SizeInt;
      var
      var
       counter: SizeInt;
       counter: SizeInt;
-      c1, c2: char;
+      c1, c2: AnsiChar;
      Begin
      Begin
         counter := 0;
         counter := 0;
        if L = 0 then
        if L = 0 then

+ 1 - 1
rtl/inc/genstrs.inc

@@ -13,7 +13,7 @@
  **********************************************************************}
  **********************************************************************}
 
 
 {$ifndef FPC_UNIT_HAS_STRPCOPY}
 {$ifndef FPC_UNIT_HAS_STRPCOPY}
-   function strpcopy(d : pchar;const s : string) : pchar;
+   function strpcopy(d : PAnsiChar;const s : string) : PAnsiChar;
    var
    var
     counter : byte;
     counter : byte;
   Begin
   Begin

+ 20 - 20
rtl/inc/getopts.pp

@@ -32,24 +32,24 @@ Type
   TOption = Record
   TOption = Record
     Name    : String;
     Name    : String;
     Has_arg : Integer;
     Has_arg : Integer;
-    Flag    : PChar;
-    Value   : Char;
-    Procedure SetOption(const aName:String;AHas_Arg:integer=0;AFlag:PChar=nil;AValue:Char=#0);
+    Flag    : PAnsiChar;
+    Value   : AnsiChar;
+    Procedure SetOption(const aName:String;AHas_Arg:integer=0;AFlag:PAnsiChar=nil;AValue:AnsiChar=#0);
   end;
   end;
 
 
   Orderings = (require_order,permute,return_in_order);
   Orderings = (require_order,permute,return_in_order);
 
 
 Const
 Const
-  OptSpecifier : set of char=['-'];
+  OptSpecifier : set of AnsiChar=['-'];
 
 
 Var
 Var
   OptArg : String;
   OptArg : String;
   OptInd : Longint;
   OptInd : Longint;
   OptErr : Boolean;
   OptErr : Boolean;
-  OptOpt : Char;
+  OptOpt : AnsiChar;
 
 
-Function GetOpt (ShortOpts : String) : char;
-Function GetLongOpts (ShortOpts : String;LongOpts : POption;var Longind : Longint) : char;
+Function GetOpt (ShortOpts : String) : AnsiChar;
+Function GetLongOpts (ShortOpts : String;LongOpts : POption;var Longind : Longint) : AnsiChar;
 
 
 
 
 Implementation
 Implementation
@@ -66,24 +66,24 @@ uses SysUtils;
     type PtrInt = Integer;
     type PtrInt = Integer;
 
 
 type
 type
-  ppchar = ^pchar;
-  apchar = array[0..127] of pchar;
+  PPAnsiChar = ^pansichar;
+  apchar = array[0..127] of pansichar;
 
 
 var
 var
   argc  : longint;
   argc  : longint;
   argv  : apchar;
   argv  : apchar;
 
 
 const
 const
-  CHAR_SIZE = SizeOf(Char);
+  CHAR_SIZE = SizeOf(AnsiChar);
 
 
 procedure setup_arguments;
 procedure setup_arguments;
 var
 var
   arglen,
   arglen,
   count   : longint;
   count   : longint;
   argstart,
   argstart,
-  cmdline : pchar;
-  quote   : set of char;
-  argsbuf : array[0..127] of pchar;
+  cmdline : pansichar;
+  quote   : set of ansichar;
+  argsbuf : array[0..127] of ansipchar;
   s       : string;
   s       : string;
   i       : integer;
   i       : integer;
 begin
 begin
@@ -146,7 +146,7 @@ end;
 
 
 {$ENDIF}
 {$ENDIF}
 
 
-function strpas(p : pchar) : ansistring;
+function strpas(p : pansichar) : ansistring;
 
 
 begin
 begin
   if p=nil then 
   if p=nil then 
@@ -155,7 +155,7 @@ begin
     strpas:=p;
     strpas:=p;
 end;
 end;
 
 
-Procedure TOption.SetOption(const aName:String;AHas_Arg:integer=0;AFlag:PChar=nil;AValue:Char=#0);
+Procedure TOption.SetOption(const aName:String;AHas_Arg:integer=0;AFlag:PAnsiChar=nil;AValue:AnsiChar=#0);
 begin
 begin
   Name:=aName; Has_Arg:=AHas_Arg; Flag:=AFlag; Value:=Avalue;
   Name:=aName; Has_Arg:=AHas_Arg; Flag:=AFlag; Value:=Avalue;
 end;
 end;
@@ -176,7 +176,7 @@ var
   bottom,
   bottom,
   middle,
   middle,
   top,i,len : longint;
   top,i,len : longint;
-  temp      : pchar;
+  temp      : pansichar;
 begin
 begin
   bottom:=first_nonopt;
   bottom:=first_nonopt;
   middle:=last_nonopt;
   middle:=last_nonopt;
@@ -239,7 +239,7 @@ end;
 
 
 
 
 Function Internal_getopt (Var Optstring : string;LongOpts : POption;
 Function Internal_getopt (Var Optstring : string;LongOpts : POption;
-                          LongInd : pointer;Long_only : boolean ) : char;
+                          LongInd : pointer;Long_only : boolean ) : AnsiChar;
 var
 var
   temp,endopt,
   temp,endopt,
   option_index : byte;
   option_index : byte;
@@ -248,7 +248,7 @@ var
   optname      : string;
   optname      : string;
   p,pfound     : POption;
   p,pfound     : POption;
   exact,ambig  : boolean;
   exact,ambig  : boolean;
-  c            : char;
+  c            : AnsiChar;
 begin
 begin
   optarg:='';
   optarg:='';
   if optind=0 then
   if optind=0 then
@@ -506,13 +506,13 @@ begin
 end; { End of internal getopt...}
 end; { End of internal getopt...}
 
 
 
 
-Function GetOpt(ShortOpts : String) : char;
+Function GetOpt(ShortOpts : String) : AnsiChar;
 begin
 begin
   getopt:=internal_getopt(shortopts,nil,nil,false);
   getopt:=internal_getopt(shortopts,nil,nil,false);
 end;
 end;
 
 
 
 
-Function GetLongOpts(ShortOpts : String;LongOpts : POption;var Longind : Longint) : char;
+Function GetLongOpts(ShortOpts : String;LongOpts : POption;var Longind : Longint) : AnsiChar;
 begin
 begin
   getlongopts:=internal_getopt(shortopts,longopts,@longind,true);
   getlongopts:=internal_getopt(shortopts,longopts,@longind,true);
 end;
 end;

+ 22 - 22
rtl/inc/heaptrc.pp

@@ -216,12 +216,12 @@ end;
 Function UpdateCrc32(InitCrc:longword;var InBuf;InLen:ptruint):longword;
 Function UpdateCrc32(InitCrc:longword;var InBuf;InLen:ptruint):longword;
 var
 var
   i : ptruint;
   i : ptruint;
-  p : pchar;
+  p : pbyte;
 begin
 begin
   p:=@InBuf;
   p:=@InBuf;
   for i:=1 to InLen do
   for i:=1 to InLen do
    begin
    begin
-     InitCrc:=Crc32Tbl[byte(InitCrc) xor byte(p^)] xor (InitCrc shr 8);
+     InitCrc:=Crc32Tbl[byte(InitCrc) xor p^] xor (InitCrc shr 8);
      inc(p);
      inc(p);
    end;
    end;
   UpdateCrc32:=InitCrc;
   UpdateCrc32:=InitCrc;
@@ -297,10 +297,10 @@ begin
     writeln(ptext, ' - ');
     writeln(ptext, ' - ');
 
 
   for i:=0 to s-1 do
   for i:=0 to s-1 do
-    if pchar(p + sizeof(theap_mem_info) + i)^ < ' ' then
+    if pansichar(p + sizeof(theap_mem_info) + i)^ < ' ' then
       write(ptext, ' ')
       write(ptext, ' ')
     else
     else
-      write(ptext, pchar(p + i)^);
+      write(ptext, pansichar(p + i)^);
 
 
   if size > maxprintedblocklength then
   if size > maxprintedblocklength then
     writeln(ptext,'..')
     writeln(ptext,'..')
@@ -407,7 +407,7 @@ end;
 
 
 {$ifdef EXTRA}
 {$ifdef EXTRA}
 procedure dump_change_after(p : pheap_mem_info;var ptext : text);
 procedure dump_change_after(p : pheap_mem_info;var ptext : text);
- var pp : pchar;
+ var pp : pansichar;
      i : ptruint;
      i : ptruint;
 begin
 begin
   Writeln(ptext,'Marked memory at $',HexStr(pointer(p)+sizeof(theap_mem_info)),' invalid');
   Writeln(ptext,'Marked memory at $',HexStr(pointer(p)+sizeof(theap_mem_info)),' invalid');
@@ -1254,9 +1254,9 @@ const
 type
 type
   Pdl_info = ^dl_info;
   Pdl_info = ^dl_info;
   dl_info = record
   dl_info = record
-    dli_fname      : Pchar;
+    dli_fname      : Pansichar;
     dli_fbase      : pointer;
     dli_fbase      : pointer;
-    dli_sname      : Pchar;
+    dli_sname      : Pansichar;
     dli_saddr      : pointer;
     dli_saddr      : pointer;
   end;
   end;
 
 
@@ -1274,7 +1274,7 @@ function GetModuleName:string;
 {$ifdef MSWINDOWS}
 {$ifdef MSWINDOWS}
 var
 var
   sz:cardinal;
   sz:cardinal;
-  buf:array[0..8191] of char;
+  buf:array[0..8191] of ansichar;
 {$endif}
 {$endif}
 {$if defined(LINUX) or defined(BSD)}
 {$if defined(LINUX) or defined(BSD)}
 var
 var
@@ -1295,7 +1295,7 @@ begin
   else
   else
     GetModuleName:=ParamStr(0);
     GetModuleName:=ParamStr(0);
 {$elseif defined(MSWINDOWS)}
 {$elseif defined(MSWINDOWS)}
-  sz:=_GetModuleFileNameA(hInstance,PChar(@buf),sizeof(buf));
+  sz:=_GetModuleFileNameA(hInstance,PAnsiChar(@buf),sizeof(buf));
   if sz>0 then
   if sz>0 then
     setstring(GetModuleName,PAnsiChar(@buf),sz)
     setstring(GetModuleName,PAnsiChar(@buf),sz)
 {$else}
 {$else}
@@ -1657,15 +1657,15 @@ begin
 end;
 end;
 
 
 {$if defined(win32) or defined(win64)}
 {$if defined(win32) or defined(win64)}
-   function GetEnvironmentStrings : pchar; stdcall;
+   function GetEnvironmentStrings : pansichar; stdcall;
      external 'kernel32' name 'GetEnvironmentStringsA';
      external 'kernel32' name 'GetEnvironmentStringsA';
-   function FreeEnvironmentStrings(p : pchar) : longbool; stdcall;
+   function FreeEnvironmentStrings(p : pansichar) : longbool; stdcall;
      external 'kernel32' name 'FreeEnvironmentStringsA';
      external 'kernel32' name 'FreeEnvironmentStringsA';
-Function  GetEnv(envvar: string): string;
+Function  GetEnv(envvar: ansistring): ansistring;
 var
 var
-   s : string;
+   s : ansistring;
    i : ptruint;
    i : ptruint;
-   hp,p : pchar;
+   hp,p : pansichar;
 begin
 begin
    getenv:='';
    getenv:='';
    p:=GetEnvironmentStrings;
    p:=GetEnvironmentStrings;
@@ -1685,7 +1685,7 @@ begin
    FreeEnvironmentStrings(p);
    FreeEnvironmentStrings(p);
 end;
 end;
 {$elseif defined(wince)}
 {$elseif defined(wince)}
-Function GetEnv(P:string):Pchar;
+Function GetEnv(P:string):PAnsichar;
 begin
 begin
   { WinCE does not have environment strings.
   { WinCE does not have environment strings.
     Add some way to specify heaptrc options? }
     Add some way to specify heaptrc options? }
@@ -1693,11 +1693,11 @@ begin
 end;
 end;
 {$elseif defined(msdos) or defined(msxdos)}
 {$elseif defined(msdos) or defined(msxdos)}
    type
    type
-     PFarChar=^Char;far;
+     PFarChar=^AnsiChar;far;
      PPFarChar=^PFarChar;
      PPFarChar=^PFarChar;
    var
    var
      envp: PPFarChar;external name '__fpc_envp';
      envp: PPFarChar;external name '__fpc_envp';
-Function GetEnv(P:string):string;
+Function GetEnv(P:ansistring):ansistring;
 var
 var
   ep    : ppfarchar;
   ep    : ppfarchar;
   pc    : pfarchar;
   pc    : pfarchar;
@@ -1734,14 +1734,14 @@ Begin
     end;
     end;
 end;
 end;
 {$else}
 {$else}
-Function GetEnv(P:string):Pchar;
+Function GetEnv(P:ansistring):Pansichar;
 {
 {
   Searches the environment for a string with name p and
   Searches the environment for a string with name p and
-  returns a pchar to it's value.
-  A pchar is used to accomodate for strings of length > 255
+  returns a pansichar to it's value.
+  A pansichar is used to accomodate for strings of length > 255
 }
 }
 var
 var
-  ep    : ppchar;
+  ep    : ppansichar;
   i     : ptruint;
   i     : ptruint;
   found : boolean;
   found : boolean;
 Begin
 Begin
@@ -1773,7 +1773,7 @@ end;
 procedure LoadEnvironment;
 procedure LoadEnvironment;
 var
 var
   i,j : ptruint;
   i,j : ptruint;
-  s,s2   : string;
+  s,s2   : ansistring;
   err : word;
   err : word;
 begin
 begin
   s:=Getenv('HEAPTRC');
   s:=Getenv('HEAPTRC');

+ 15 - 15
rtl/inc/intres.inc

@@ -15,7 +15,7 @@
 type
 type
   PResInfoNode = ^TResInfoNode;
   PResInfoNode = ^TResInfoNode;
   TResInfoNode = packed record
   TResInfoNode = packed record
-    nameid : PChar;             //name / integer ID / languageID
+    nameid : PAnsiChar;             //name / integer ID / languageID
     ncounthandle : longword;    //named sub-entries count / resource handle
     ncounthandle : longword;    //named sub-entries count / resource handle
     idcountsize : longword;     //id sub-entries count / resource size
     idcountsize : longword;     //id sub-entries count / resource size
     subptr : PResInfoNode;      //first sub-entry pointer
     subptr : PResInfoNode;      //first sub-entry pointer
@@ -75,10 +75,10 @@ end;
 
 
 
 
 //resource functions are case insensitive... copied from genstr.inc
 //resource functions are case insensitive... copied from genstr.inc
-function ResStrIComp(Str1, Str2 : PChar): SizeInt;
+function ResStrIComp(Str1, Str2 : PAnsiChar): SizeInt;
 var
 var
   counter: SizeInt;
   counter: SizeInt;
-  c1, c2: char;
+  c1, c2: AnsiChar;
 begin
 begin
   counter := 0;
   counter := 0;
   c1 := upcase(str1[counter]);
   c1 := upcase(str1[counter]);
@@ -94,8 +94,8 @@ begin
 end;
 end;
 
 
 {!fixme!}
 {!fixme!}
-//function InternalIsIntResource(aStr : pchar; out aInt : PtrUint) : boolean;
-function InternalIsIntResource(aStr : pchar; var aInt : PtrUint) : boolean;
+//function InternalIsIntResource(aStr : PAnsiChar; out aInt : PtrUint) : boolean;
+function InternalIsIntResource(aStr : pansichar; var aInt : PtrUint) : boolean;
 var i : integer;
 var i : integer;
     s : shortstring;
     s : shortstring;
     code : word;
     code : word;
@@ -119,10 +119,10 @@ begin
   end;
   end;
 end;
 end;
 
 
-function BinSearchStr(arr : PResInfoNode; query : pchar; left, right : integer)
+function BinSearchStr(arr : PResInfoNode; query : pansichar; left, right : integer)
 : PResInfoNode;
 : PResInfoNode;
 var pivot, res : integer;
 var pivot, res : integer;
-    resstr : pchar;
+    resstr : pansichar;
 begin
 begin
   BinSearchStr:=nil;
   BinSearchStr:=nil;
   while left<=right do
   while left<=right do
@@ -140,7 +140,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function BinSearchInt(arr : PResInfoNode; query : pchar; left, right : integer)
+function BinSearchInt(arr : PResInfoNode; query : pansichar; left, right : integer)
 : PResInfoNode;
 : PResInfoNode;
 var pivot : integer;
 var pivot : integer;
 begin
 begin
@@ -158,18 +158,18 @@ begin
   end;
   end;
 end;
 end;
 
 
-function BinSearchRes(root : PResInfoNode; aDesc : PChar) : PResInfoNode;
+function BinSearchRes(root : PResInfoNode; aDesc : PAnsiChar) : PResInfoNode;
 var aID : PtrUint;
 var aID : PtrUint;
 begin
 begin
   if InternalIsIntResource(aDesc,aID) then
   if InternalIsIntResource(aDesc,aID) then
-    BinSearchRes:=BinSearchInt(root^.subptr,PChar(aID),root^.ncounthandle,
+    BinSearchRes:=BinSearchInt(root^.subptr,PAnsiChar(aID),root^.ncounthandle,
       root^.ncounthandle+root^.idcountsize-1)
       root^.ncounthandle+root^.idcountsize-1)
   else
   else
     BinSearchRes:=BinSearchStr(root^.subptr,aDesc,0,root^.ncounthandle-1);
     BinSearchRes:=BinSearchStr(root^.subptr,aDesc,0,root^.ncounthandle-1);
 end;
 end;
 
 
 //Returns a pointer to a name node.
 //Returns a pointer to a name node.
-function InternalFindResource(ResHdr:PResHdr;ResourceName, ResourceType: PChar):
+function InternalFindResource(ResHdr:PResHdr;ResourceName, ResourceType: PAnsiChar):
  PResInfoNode;
  PResInfoNode;
 begin
 begin
   InternalFindResource:=nil;
   InternalFindResource:=nil;
@@ -230,7 +230,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-Function IntEnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
+Function IntEnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PAnsiChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
 var ptr : PResInfoNode;
 var ptr : PResInfoNode;
     tot, i : integer;
     tot, i : integer;
     res_hdr:PResHdr;
     res_hdr:PResHdr;
@@ -254,7 +254,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-Function IntEnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
+Function IntEnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PAnsiChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
 var ptr : PResInfoNode;
 var ptr : PResInfoNode;
     tot, i : integer;
     tot, i : integer;
     res_hdr:PResHdr;
     res_hdr:PResHdr;
@@ -277,7 +277,7 @@ begin
 end;
 end;
 
 
 Function IntFindResource(ModuleHandle: TFPResourceHMODULE; ResourceName,
 Function IntFindResource(ModuleHandle: TFPResourceHMODULE; ResourceName,
-  ResourceType: PChar): TFPResourceHandle;
+  ResourceType: PAnsiChar): TFPResourceHandle;
 var ptr : PResInfoNode;
 var ptr : PResInfoNode;
     res_hdr: PresHdr;
     res_hdr: PresHdr;
 begin
 begin
@@ -299,7 +299,7 @@ begin
 end;
 end;
 
 
 Function IntFindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType,
 Function IntFindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType,
-  ResourceName: PChar; Language : word): TFPResourceHandle;
+  ResourceName: PAnsiChar; Language : word): TFPResourceHandle;
 const LANG_NEUTRAL = 0;
 const LANG_NEUTRAL = 0;
       LANG_ENGLISH = 9;
       LANG_ENGLISH = 9;
 var nameptr,ptr : PResInfoNode;
 var nameptr,ptr : PResInfoNode;

+ 2 - 2
rtl/inc/iso7185.pp

@@ -190,7 +190,7 @@ unit iso7185;
 
 
     procedure Get(var t : Text);[IOCheck];
     procedure Get(var t : Text);[IOCheck];
       var
       var
-        c : char;
+        c : AnsiChar;
       Begin
       Begin
         Read(t,c);
         Read(t,c);
       End;
       End;
@@ -208,7 +208,7 @@ unit iso7185;
 
 
     procedure Get;[IOCheck];
     procedure Get;[IOCheck];
       var
       var
-        c : char;
+        c : AnsiChar;
       Begin
       Begin
         Read(input,c);
         Read(input,c);
       End;
       End;

+ 1 - 1
rtl/inc/lineinfo.pp

@@ -88,7 +88,7 @@ var
   filestab   : tstab;   { stab with current file info }
   filestab   : tstab;   { stab with current file info }
   filename,
   filename,
   lastfilename,         { store last processed file }
   lastfilename,         { store last processed file }
-  dbgfn : string;
+  dbgfn : ansistring;
   lastopenstabs: Boolean; { store last result of processing a file }
   lastopenstabs: Boolean; { store last result of processing a file }
 
 
 
 

+ 2 - 2
rtl/inc/lnfodwrf.pp

@@ -242,7 +242,7 @@ var
   index : TFilePos;
   index : TFilePos;
   baseaddr : {$ifdef cpui8086}farpointer{$else}pointer{$endif};
   baseaddr : {$ifdef cpui8086}farpointer{$else}pointer{$endif};
   filename,
   filename,
-  dbgfn : string;
+  dbgfn : ansistring;
   lastfilename: string;   { store last processed file }
   lastfilename: string;   { store last processed file }
   lastopendwarf: Boolean; { store last result of processing a file }
   lastopendwarf: Boolean; { store last result of processing a file }
 
 
@@ -521,7 +521,7 @@ begin
   i := 1;
   i := 1;
   temp := ReadNext();
   temp := ReadNext();
   while (temp > 0) do begin
   while (temp > 0) do begin
-    ReadString[i] := char(temp);
+    ReadString[i] := AnsiChar(temp);
     if (i = 255) then begin
     if (i = 255) then begin
       { skip remaining characters }
       { skip remaining characters }
       repeat
       repeat

+ 19 - 19
rtl/inc/lstrings.pp

@@ -14,17 +14,17 @@
 {
 {
   This file contains the implementation of the LongString type,
   This file contains the implementation of the LongString type,
   and all things that are needed for it.
   and all things that are needed for it.
-  LongSTring is defined as a 'silent' pchar :
-  a pchar that points to :
+  LongSTring is defined as a 'silent' pansichar :
+  a pansichar that points to :
 
 
   @   : Longint for size
   @   : Longint for size
   @+4 : Unused byte;
   @+4 : Unused byte;
-  @+5 : String;
+  @+5 : AnsiString;
    So LS[i] is converted to the address @LS+4+i.
    So LS[i] is converted to the address @LS+4+i.
 
 
-  pchar[0]-pchar[3] : Longint Size
-  pchar [4] : Unused
-  pchar[5] : String;
+  pansichar[0]-pansichar[3] : Longint Size
+  pansichar [4] : Unused
+  pansichar[5] : AnsiString;
 
 
 }
 }
 
 
@@ -34,7 +34,7 @@ unit lstrings;
 
 
 Interface
 Interface
 
 
-Type longstring = pchar;
+Type longstring = pansichar;
      ShortString = string;
      ShortString = string;
 
 
 { Internal functions, will not appear in systemh.inc }
 { Internal functions, will not appear in systemh.inc }
@@ -98,7 +98,7 @@ begin
   If P<>Nil then
   If P<>Nil then
      begin
      begin
      PLongint(P)^:=0;
      PLongint(P)^:=0;
-     pchar(P+4)^:=#0;
+     pansichar(P+4)^:=#0;
      end;
      end;
   NewLongString:=P;
   NewLongString:=P;
 end;
 end;
@@ -128,7 +128,7 @@ begin
     if Size+PLongint(S1)^>MaxLen then
     if Size+PLongint(S1)^>MaxLen then
       Size:=Maxlen-PLongint(S1)^;
       Size:=Maxlen-PLongint(S1)^;
   If Size<=0 then exit;
   If Size<=0 then exit;
-  Move (pchar(S2)[5],pchar(S1)[PLongint(S1)^+5],Size);
+  Move (pansichar(S2)[5],ansipchar(S1)[PLongint(S1)^+5],Size);
   PLongint(S1)^:=PLongint(S1)^+Size;
   PLongint(S1)^:=PLongint(S1)^+Size;
 end;
 end;
 
 
@@ -147,7 +147,7 @@ begin
     if Size+PLongint(S1)^>Maxlen then
     if Size+PLongint(S1)^>Maxlen then
       Size:=Maxlen-PLongint(S1)^;
       Size:=Maxlen-PLongint(S1)^;
   If Size<=0 then exit;
   If Size<=0 then exit;
-  Move (S2[1],Pchar(S1)[PLongint(S1)^+5],Size);
+  Move (S2[1],PAnsiChar(S1)[PLongint(S1)^+5],Size);
   PLongint(S1)^:=PLongint(S1)^+Size;
   PLongint(S1)^:=PLongint(S1)^+Size;
 end;
 end;
 
 
@@ -165,7 +165,7 @@ begin
   Size:=PLongint(S2)^;
   Size:=PLongint(S2)^;
   if maxlen=-1 then maxlen:=255;
   if maxlen=-1 then maxlen:=255;
   If Size>maxlen then Size:=maxlen;
   If Size>maxlen then Size:=maxlen;
-  Move (Pchar(S2)[5],S1[1],Size);
+  Move (PAnsiChar(S2)[5],S1[1],Size);
   S1[0]:=chr(Size);
   S1[0]:=chr(Size);
 end;
 end;
 
 
@@ -182,7 +182,7 @@ begin
   Size:=Byte(S2[0]);
   Size:=Byte(S2[0]);
   if maxlen=-1 then maxlen:=255;
   if maxlen=-1 then maxlen:=255;
   If Size>maxlen then Size:=maxlen;
   If Size>maxlen then Size:=maxlen;
-  Move (S2[1],pchar(S1)[5],Size);
+  Move (S2[1],PAnsiChar(S1)[5],Size);
   PLongint(S1)^:=Size;
   PLongint(S1)^:=Size;
 end;
 end;
 
 
@@ -205,7 +205,7 @@ begin
  if MaxI>PLOngint(S2)^ then MaxI:=PLongint(S2)^;
  if MaxI>PLOngint(S2)^ then MaxI:=PLongint(S2)^;
  While (i<=MaxI) and (Temp=0) do
  While (i<=MaxI) and (Temp=0) do
    begin
    begin
-   Temp:= Byte( Pchar(S1)[i+4] ) - Byte( Pchar(S2)[I+4] );
+   Temp:= Byte( PAnsiChar(S1)[i+4] ) - Byte( PAnsiChar(S2)[I+4] );
    inc(i);
    inc(i);
    end;
    end;
  if temp=0 then temp:=Plongint(S1)^-PLongint(S2)^;
  if temp=0 then temp:=Plongint(S1)^-PLongint(S2)^;
@@ -231,7 +231,7 @@ begin
  if MaxI>byte(S2[0]) then MaxI:=Byte(S2[0]);
  if MaxI>byte(S2[0]) then MaxI:=Byte(S2[0]);
  While (i<=MaxI) and (Temp=0) do
  While (i<=MaxI) and (Temp=0) do
    begin
    begin
-   Temp:=(Byte(Pchar(S1)[i+4])-Byte(S2[I]));
+   Temp:=(Byte(PAnsiChar(S1)[i+4])-Byte(S2[I]));
    inc(i);
    inc(i);
    end;
    end;
  LongCompare:=Temp;
  LongCompare:=Temp;
@@ -267,7 +267,7 @@ end;
 
 
 Function Copy (Const S : LongString; Index,Size : Longint) : LongString;
 Function Copy (Const S : LongString; Index,Size : Longint) : LongString;
 
 
-var ResultAddress : pchar;
+var ResultAddress : PAnsiChar;
 
 
 begin
 begin
   ResultAddress:=NewLongString (Size);
   ResultAddress:=NewLongString (Size);
@@ -278,7 +278,7 @@ begin
   if PLongint(S)^<Index+Size then
   if PLongint(S)^<Index+Size then
     Size:=PLongint(S)^-Index;
     Size:=PLongint(S)^-Index;
   if Size>0 then
   if Size>0 then
-    Move (Pchar(S)[Index+5],ResultAddress[5],Size)
+    Move (PAnsiChar(S)[Index+5],ResultAddress[5],Size)
   Else
   Else
     Size:=0;
     Size:=0;
   PLongint(ResultAddress)^:=Size;
   PLongint(ResultAddress)^:=Size;
@@ -505,20 +505,20 @@ begin
       Size:=PLongint(s)^-Index+1;
       Size:=PLongint(s)^-Index+1;
     PLongint(s)^:=PLongint(s)^-Size;
     PLongint(s)^:=PLongint(s)^-Size;
     if Index<=Length(s) then
     if Index<=Length(s) then
-      Move(pchar(s)[Index+Size+4],pchar(s)[Index+4],Length(s)-Index+1);
+      Move(PAnsiChar(s)[Index+Size+4],PAnsiChar(s)[Index+4],Length(s)-Index+1);
     end;
     end;
 end;
 end;
 
 
 Procedure Insert (Const Source : LongString; Var S : LongString; Index : Longint);
 Procedure Insert (Const Source : LongString; Var S : LongString; Index : Longint);
 
 
-var s3,s4 : pchar;
+var s3,s4 : PAnsiChar;
 
 
 begin
 begin
   if index <= 0 then index := 1;
   if index <= 0 then index := 1;
   s3 := longString(copy (s, index, length(s)));
   s3 := longString(copy (s, index, length(s)));
   if index > PLongint(s)^ then index := PLongint(S)^+1;
   if index > PLongint(s)^ then index := PLongint(S)^+1;
   PLongint(s)^ := index - 1;
   PLongint(s)^ := index - 1;
-  s4 :=Pchar ( NewLongString (Plongint(Source)^) );
+  s4 :=PAnsiChar ( NewLongString (Plongint(Source)^) );
   Long_String_Concat(LongString(s4),Source,-1);
   Long_String_Concat(LongString(s4),Source,-1);
   Long_String_Concat(LongString(S4),LongString(s3),-1);
   Long_String_Concat(LongString(S4),LongString(s3),-1);
   Long_String_Concat(S,LongString(S4),-1);
   Long_String_Concat(S,LongString(S4),-1);

+ 1 - 1
rtl/inc/macpas.pp

@@ -30,7 +30,7 @@ type
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
   LongDouble = ValReal;
   LongDouble = ValReal;
 {$endif}
 {$endif}
-  FourCharArray = packed array[1..4] of char;
+  FourCharArray = packed array[1..4] of AnsiChar;
 
 
   UnsignedByte = Byte;
   UnsignedByte = Byte;
   UnsignedWord = Word;
   UnsignedWord = Word;

+ 31 - 31
rtl/inc/objc1.inc

@@ -122,12 +122,12 @@ type
   function  objc_msgSend_fpret (self: id; op: SEL): double; cdecl; varargs; external libname name 'objc_msgSend';
   function  objc_msgSend_fpret (self: id; op: SEL): double; cdecl; varargs; external libname name 'objc_msgSend';
 {$endif cpui386}
 {$endif cpui386}
 
 
-  function sel_getName(sel: SEL): PChar; cdecl; external libname;
-  function sel_registerName(str: PChar): SEL; cdecl; external libname;
-  function object_getClassName(obj: id): PChar; cdecl; external libname;
+  function sel_getName(sel: SEL): PAnsiChar; cdecl; external libname;
+  function sel_registerName(str: PAnsiChar): SEL; cdecl; external libname;
+  function object_getClassName(obj: id): PAnsiChar; cdecl; external libname;
   function object_getIndexedIvars(obj: id ): Pointer; cdecl; external libname;
   function object_getIndexedIvars(obj: id ): Pointer; cdecl; external libname;
 
 
-  function sel_getUid(const str: PChar): SEL; cdecl; external libname;
+  function sel_getUid(const str: PAnsiChar): SEL; cdecl; external libname;
 
 
   function object_copy(obj:id; size:size_t):id; cdecl; external libname;
   function object_copy(obj:id; size:size_t):id; cdecl; external libname;
   function object_dispose(obj:id):id; cdecl; external libname;
   function object_dispose(obj:id):id; cdecl; external libname;
@@ -138,20 +138,20 @@ type
   function object_getIvar(obj:id; _ivar:Ivar):id; cdecl;
   function object_getIvar(obj:id; _ivar:Ivar):id; cdecl;
   procedure object_setIvar(obj:id; _ivar:Ivar; value:id); cdecl;
   procedure object_setIvar(obj:id; _ivar:Ivar; value:id); cdecl;
 
 
-  function object_setInstanceVariable(obj:id; name:pchar; value:pointer):Ivar; cdecl; external libname;
-  function object_getInstanceVariable(obj:id; name:pchar; var outValue: Pointer):Ivar; cdecl; external libname;
+  function object_setInstanceVariable(obj:id; name:PAnsiChar; value:pointer):Ivar; cdecl; external libname;
+  function object_getInstanceVariable(obj:id; name:PAnsiChar; var outValue: Pointer):Ivar; cdecl; external libname;
 
 
-  function objc_getClass(name:pchar):id; cdecl; external libname;
-  function objc_getMetaClass(name:pchar):id; cdecl; external libname;
-  function objc_lookUpClass(name:pchar):id; cdecl; external libname;
+  function objc_getClass(name:PAnsiChar):id; cdecl; external libname;
+  function objc_getMetaClass(name:PAnsiChar):id; cdecl; external libname;
+  function objc_lookUpClass(name:PAnsiChar):id; cdecl; external libname;
   function objc_getClassList(buffer:pClass; bufferCount:cint):cint; cdecl; external libname;
   function objc_getClassList(buffer:pClass; bufferCount:cint):cint; cdecl; external libname;
 
 
 {$ifdef FPC_HAS_FEATURE_OBJECTIVEC1}
 {$ifdef FPC_HAS_FEATURE_OBJECTIVEC1}
-  function objc_getProtocol(name:pchar): pobjc_protocol; cdecl; weakexternal libname;
+  function objc_getProtocol(name:PAnsiChar): pobjc_protocol; cdecl; weakexternal libname;
   function objc_copyProtocolList(outCount:pdword):ppobjc_protocol; cdecl; weakexternal libname;
   function objc_copyProtocolList(outCount:pdword):ppobjc_protocol; cdecl; weakexternal libname;
 {$endif}
 {$endif}
 
 
-  function class_getName(cls:pobjc_class):PChar; cdecl; inline;
+  function class_getName(cls:pobjc_class):PAnsiChar; cdecl; inline;
   function class_isMetaClass(cls:pobjc_class):ObjCBOOL; cdecl;
   function class_isMetaClass(cls:pobjc_class):ObjCBOOL; cdecl;
   function class_getSuperclass(cls:pobjc_class):pobjc_class; cdecl; inline;
   function class_getSuperclass(cls:pobjc_class):pobjc_class; cdecl; inline;
 
 
@@ -160,8 +160,8 @@ type
 
 
   function class_getInstanceSize(cls:pobjc_class):size_t; cdecl; external libname;
   function class_getInstanceSize(cls:pobjc_class):size_t; cdecl; external libname;
 
 
-  function class_getInstanceVariable(cls:pobjc_class; name:pchar):Ivar; cdecl; external libname;
-  function class_getClassVariable(cls:pobjc_class; name:pchar):Ivar; cdecl; external libname;
+  function class_getInstanceVariable(cls:pobjc_class; name:PAnsiChar):Ivar; cdecl; external libname;
+  function class_getClassVariable(cls:pobjc_class; name:PAnsiChar):Ivar; cdecl; external libname;
   function class_copyIvarList(cls:pobjc_class; outCount:pdword):PIvar; cdecl; external libname;
   function class_copyIvarList(cls:pobjc_class; outCount:pdword):PIvar; cdecl; external libname;
 
 
   function class_getInstanceMethod(cls:pobjc_class; name:SEL):Method; cdecl; external libname;
   function class_getInstanceMethod(cls:pobjc_class; name:SEL):Method; cdecl; external libname;
@@ -177,31 +177,31 @@ type
   function class_createInstance(cls:pobjc_class; extraBytes:size_t):id; cdecl; external libname;
   function class_createInstance(cls:pobjc_class; extraBytes:size_t):id; cdecl; external libname;
 
 
 (*
 (*
-  function objc_allocateClassPair(superclass:pobjc_class; name:pchar; extraBytes:size_t):pobjc_class; cdecl; external libname;
+  function objc_allocateClassPair(superclass:pobjc_class; name:PAnsiChar; extraBytes:size_t):pobjc_class; cdecl; external libname;
   procedure objc_registerClassPair(cls:pobjc_class); cdecl; external libname;
   procedure objc_registerClassPair(cls:pobjc_class); cdecl; external libname;
-  function objc_duplicateClass(original:pobjc_class; name:pchar; extraBytes:size_t):pobjc_class; cdecl; external libname;
+  function objc_duplicateClass(original:pobjc_class; name:PAnsiChar; extraBytes:size_t):pobjc_class; cdecl; external libname;
   procedure objc_disposeClassPair(cls:pobjc_class); cdecl; external libname;
   procedure objc_disposeClassPair(cls:pobjc_class); cdecl; external libname;
 
 
-  function class_addMethod(cls:pobjc_class; name:SEL; imp:IMP; types:pchar):ObjCBOOL; cdecl; external libname;
-  function class_addIvar(cls:pobjc_class; name:pchar; size:size_t; alignment:uint8_t; types:pchar):ObjCBOOL; cdecl; external libname;
+  function class_addMethod(cls:pobjc_class; name:SEL; imp:IMP; types:PAnsiChar):ObjCBOOL; cdecl; external libname;
+  function class_addIvar(cls:pobjc_class; name:PAnsiChar; size:size_t; alignment:uint8_t; types:PAnsiChar):ObjCBOOL; cdecl; external libname;
   function class_addProtocol(cls:pobjc_class; protocol:pProtocol):ObjCBOOL; cdecl; external libname;
   function class_addProtocol(cls:pobjc_class; protocol:pProtocol):ObjCBOOL; cdecl; external libname;
 *)
 *)
 
 
   function method_getName(m:Method):SEL; cdecl; inline;
   function method_getName(m:Method):SEL; cdecl; inline;
   function method_getImplementation(m:Method):IMP; cdecl; inline;
   function method_getImplementation(m:Method):IMP; cdecl; inline;
-  function method_getTypeEncoding(m:Method):Pchar; cdecl; inline;
+  function method_getTypeEncoding(m:Method):PAnsiChar; cdecl; inline;
 
 
   function method_getNumberOfArguments(m:Method):dword; cdecl; external libname;
   function method_getNumberOfArguments(m:Method):dword; cdecl; external libname;
 (*
 (*
-  function method_copyReturnType(m:Method):Pchar; cdecl; weakexternal libname;
-  function method_copyArgumentType(m:Method; index:dword):Pchar; cdecl; weakexternal libname;
-  procedure method_getReturnType(m:Method; dst:pchar; dst_len:size_t); cdecl; external libname;
+  function method_copyReturnType(m:Method):PAnsiChar; cdecl; weakexternal libname;
+  function method_copyArgumentType(m:Method; index:dword):PAnsiChar; cdecl; weakexternal libname;
+  procedure method_getReturnType(m:Method; dst:PAnsiChar; dst_len:size_t); cdecl; external libname;
 
 
   function method_setImplementation(m:Method; imp:IMP):IMP; cdecl; external libname;
   function method_setImplementation(m:Method; imp:IMP):IMP; cdecl; external libname;
 *)
 *)
 
 
-  function ivar_getName(v:Ivar):Pchar; cdecl; inline;
-  function ivar_getTypeEncoding(v:Ivar):Pchar; cdecl; inline;
+  function ivar_getName(v:Ivar):PAnsiChar; cdecl; inline;
+  function ivar_getTypeEncoding(v:Ivar):PAnsiChar; cdecl; inline;
   function ivar_getOffset(v:Ivar):ptrdiff_t; cdecl; inline;
   function ivar_getOffset(v:Ivar):ptrdiff_t; cdecl; inline;
 
 
 (*
 (*
@@ -221,7 +221,7 @@ type
 
 
   objc_method1 = packed record
   objc_method1 = packed record
     method_name   : SEL;
     method_name   : SEL;
-    method_types  : PChar;
+    method_types  : PAnsiChar;
     method_imp    : IMP;
     method_imp    : IMP;
   end;
   end;
   Pobjc_method_list1 = ^objc_method_list1;
   Pobjc_method_list1 = ^objc_method_list1;
@@ -241,8 +241,8 @@ type
   Ivar1 = Pobjc_ivar1;
   Ivar1 = Pobjc_ivar1;
   PIvar1 = ^Ivar1;
   PIvar1 = ^Ivar1;
   objc_ivar1 = packed record
   objc_ivar1 = packed record
-    ivar_name   : PChar;
-    ivar_type   : PChar;
+    ivar_name   : PAnsiChar;
+    ivar_type   : PAnsiChar;
     ivar_offset : cint;
     ivar_offset : cint;
   {$ifdef __alpha__}
   {$ifdef __alpha__}
     space: cint;
     space: cint;
@@ -278,7 +278,7 @@ type
   objc_class1 = packed record
   objc_class1 = packed record
 	  isa           : Pobjc_class1;
 	  isa           : Pobjc_class1;
 	  super_class   : Pobjc_class1;
 	  super_class   : Pobjc_class1;
-	  name          : PChar;
+	  name          : PAnsiChar;
 	  version       : culong;
 	  version       : culong;
 	  info          : culong;
 	  info          : culong;
 	  instance_size : culong;
 	  instance_size : culong;
@@ -324,7 +324,7 @@ procedure object_setIvar(obj:id; _ivar:Ivar; value:id); cdecl;
     Pid(PtrUInt(obj) + ivar_getOffset(_ivar))^ := value;
     Pid(PtrUInt(obj) + ivar_getOffset(_ivar))^ := value;
   end;
   end;
 
 
-function class_getName(cls:pobjc_class):PChar; cdecl; inline;
+function class_getName(cls:pobjc_class):PAnsiChar; cdecl; inline;
   begin
   begin
     class_getName := pobjc_class1(cls)^.name;
     class_getName := pobjc_class1(cls)^.name;
   end;
   end;
@@ -349,17 +349,17 @@ function method_getImplementation(m:Method):IMP; cdecl; inline;
     method_getImplementation := IMP(Method1(m)^.method_imp);
     method_getImplementation := IMP(Method1(m)^.method_imp);
   end;
   end;
 
 
-function method_getTypeEncoding(m:Method):Pchar; cdecl; inline;
+function method_getTypeEncoding(m:Method):PAnsiChar; cdecl; inline;
   begin
   begin
     method_getTypeEncoding := Method1(m)^.method_types;
     method_getTypeEncoding := Method1(m)^.method_types;
   end;
   end;
 
 
-function ivar_getName(v:Ivar):Pchar; cdecl; inline;
+function ivar_getName(v:Ivar):PAnsiChar; cdecl; inline;
   begin
   begin
     ivar_getName := IVar1(v)^.ivar_name;
     ivar_getName := IVar1(v)^.ivar_name;
   end;
   end;
 
 
-function ivar_getTypeEncoding(v:Ivar):Pchar; cdecl; inline;
+function ivar_getTypeEncoding(v:Ivar):PAnsiChar; cdecl; inline;
   begin
   begin
     ivar_getTypeEncoding := IVar1(v)^.ivar_type;
     ivar_getTypeEncoding := IVar1(v)^.ivar_type;
   end;
   end;

+ 31 - 31
rtl/inc/objcnf.inc

@@ -105,7 +105,7 @@ type
 (* From Clang:
 (* From Clang:
   // struct _protocol_t {
   // struct _protocol_t {
   //   id isa;  // NULL
   //   id isa;  // NULL
-  //   const char * const protocol_name;
+  //   const AnsiChar * const protocol_name;
   //   const struct _protocol_list_t * protocol_list; // super protocols
   //   const struct _protocol_list_t * protocol_list; // super protocols
   //   const struct method_list_t * const instance_methods;
   //   const struct method_list_t * const instance_methods;
   //   const struct method_list_t * const class_methods;
   //   const struct method_list_t * const class_methods;
@@ -120,7 +120,7 @@ type
 *)
 *)
   objc_protocol = record
   objc_protocol = record
     isa: id;
     isa: id;
-    protocol_name: pchar;
+    protocol_name: PAnsiChar;
     protocol_list: pointer;
     protocol_list: pointer;
     instance_methods,
     instance_methods,
     class_methods,
     class_methods,
@@ -136,8 +136,8 @@ type
 (* From Clang:
 (* From Clang:
 ///  struct _ivar_t {
 ///  struct _ivar_t {
 ///   unsigned long int *offset;  // pointer to ivar offset location
 ///   unsigned long int *offset;  // pointer to ivar offset location
-///   char *name;
-///   char *type;
+///   AnsiChar *name;
+///   AnsiChar *type;
 ///   uint32_t alignment;
 ///   uint32_t alignment;
 ///   uint32_t size;
 ///   uint32_t size;
   
   
@@ -145,8 +145,8 @@ type
 *)
 *)
   objc_ivar = record
   objc_ivar = record
     offset: pculong;
     offset: pculong;
-    name: pchar;
-    ttype: pchar;
+    name: PAnsiChar;
+    ttype: PAnsiChar;
     alignment: cuint32;
     alignment: cuint32;
     size: cuint32;
     size: cuint32;
   end;
   end;
@@ -157,8 +157,8 @@ type
   // Full definition required by the compiler, do not make opaque!
   // Full definition required by the compiler, do not make opaque!
   objc_method = record
   objc_method = record
     _cmd: SEL;
     _cmd: SEL;
-    method_type: pchar;
-    _imp: pchar;
+    method_type: PAnsiChar;
+    _imp: PAnsiChar;
   end;
   end;
   Pobjc_method = ^objc_method;
   Pobjc_method = ^objc_method;
   Method = Pobjc_method;
   Method = Pobjc_method;
@@ -196,12 +196,12 @@ type
   function  objc_msgSend_fpret (self: id; op: SEL): double; cdecl; varargs; external libname name 'objc_msgSend';
   function  objc_msgSend_fpret (self: id; op: SEL): double; cdecl; varargs; external libname name 'objc_msgSend';
 {$endif cpui386}
 {$endif cpui386}
 
 
-  function sel_getName(sel: SEL): PChar; cdecl; external libname;
-  function sel_registerName(str: PChar): SEL; cdecl; external libname;
-  function object_getClassName(obj: id): PChar; cdecl; external libname;
+  function sel_getName(sel: SEL): PAnsiChar; cdecl; external libname;
+  function sel_registerName(str: PAnsiChar): SEL; cdecl; external libname;
+  function object_getClassName(obj: id): PAnsiChar; cdecl; external libname;
   function object_getIndexedIvars(obj: id ): Pointer; cdecl; external libname;
   function object_getIndexedIvars(obj: id ): Pointer; cdecl; external libname;
 
 
-  function sel_getUid(const str: PChar): SEL; cdecl; external libname;
+  function sel_getUid(const str: PAnsiChar): SEL; cdecl; external libname;
 
 
   function object_copy(obj:id; size:size_t):id; cdecl; external libname;
   function object_copy(obj:id; size:size_t):id; cdecl; external libname;
   function object_dispose(obj:id):id; cdecl; external libname;
   function object_dispose(obj:id):id; cdecl; external libname;
@@ -212,18 +212,18 @@ type
   function object_getIvar(obj:id; _ivar:Ivar):id; cdecl; external libname;
   function object_getIvar(obj:id; _ivar:Ivar):id; cdecl; external libname;
   procedure object_setIvar(obj:id; _ivar:Ivar; value:id); cdecl; external libname;
   procedure object_setIvar(obj:id; _ivar:Ivar; value:id); cdecl; external libname;
 
 
-  function object_setInstanceVariable(obj:id; name:pchar; value:pointer):Ivar; cdecl; external libname;
-  function object_getInstanceVariable(obj:id; name:pchar; var outValue: Pointer):Ivar; cdecl; external libname;
+  function object_setInstanceVariable(obj:id; name:PAnsiChar; value:pointer):Ivar; cdecl; external libname;
+  function object_getInstanceVariable(obj:id; name:PAnsiChar; var outValue: Pointer):Ivar; cdecl; external libname;
 
 
-  function objc_getClass(name:pchar):id; cdecl; external libname;
-  function objc_getMetaClass(name:pchar):id; cdecl; external libname;
-  function objc_lookUpClass(name:pchar):id; cdecl; external libname;
+  function objc_getClass(name:PAnsiChar):id; cdecl; external libname;
+  function objc_getMetaClass(name:PAnsiChar):id; cdecl; external libname;
+  function objc_lookUpClass(name:PAnsiChar):id; cdecl; external libname;
   function objc_getClassList(buffer:pClass; bufferCount:cint):cint; cdecl; external libname;
   function objc_getClassList(buffer:pClass; bufferCount:cint):cint; cdecl; external libname;
 
 
-  function objc_getProtocol(name:pchar): pobjc_protocol; cdecl; external libname;
+  function objc_getProtocol(name:PAnsiChar): pobjc_protocol; cdecl; external libname;
   function objc_copyProtocolList(outCount:pdword):ppobjc_protocol; cdecl; external libname;
   function objc_copyProtocolList(outCount:pdword):ppobjc_protocol; cdecl; external libname;
 
 
-  function class_getName(cls:pobjc_class):PChar; cdecl; external libname;
+  function class_getName(cls:pobjc_class):PAnsiChar; cdecl; external libname;
   function class_isMetaClass(cls:pobjc_class):ObjCBOOL; cdecl; external libname;
   function class_isMetaClass(cls:pobjc_class):ObjCBOOL; cdecl; external libname;
   function class_getSuperclass(cls:pobjc_class):pobjc_class; cdecl; external libname;
   function class_getSuperclass(cls:pobjc_class):pobjc_class; cdecl; external libname;
 
 
@@ -232,8 +232,8 @@ type
 
 
   function class_getInstanceSize(cls:pobjc_class):size_t; cdecl; external libname;
   function class_getInstanceSize(cls:pobjc_class):size_t; cdecl; external libname;
 
 
-  function class_getInstanceVariable(cls:pobjc_class; name:pchar):Ivar; cdecl; external libname;
-  function class_getClassVariable(cls:pobjc_class; name:pchar):Ivar; cdecl; external libname;
+  function class_getInstanceVariable(cls:pobjc_class; name:PAnsiChar):Ivar; cdecl; external libname;
+  function class_getClassVariable(cls:pobjc_class; name:PAnsiChar):Ivar; cdecl; external libname;
   function class_copyIvarList(cls:pobjc_class; outCount:pdword):PIvar; cdecl; external libname;
   function class_copyIvarList(cls:pobjc_class; outCount:pdword):PIvar; cdecl; external libname;
 
 
   function class_getInstanceMethod(cls:pobjc_class; name:SEL):Method; cdecl; external libname;
   function class_getInstanceMethod(cls:pobjc_class; name:SEL):Method; cdecl; external libname;
@@ -250,28 +250,28 @@ type
 
 
   function class_createInstance(cls:pobjc_class; extraBytes:size_t):id; cdecl; external libname;
   function class_createInstance(cls:pobjc_class; extraBytes:size_t):id; cdecl; external libname;
 
 
-  function objc_allocateClassPair(superclass:pobjc_class; name:pchar; extraBytes:size_t):pobjc_class; cdecl; external libname;
+  function objc_allocateClassPair(superclass:pobjc_class; name:PAnsiChar; extraBytes:size_t):pobjc_class; cdecl; external libname;
   procedure objc_registerClassPair(cls:pobjc_class); cdecl; external libname;
   procedure objc_registerClassPair(cls:pobjc_class); cdecl; external libname;
-  function objc_duplicateClass(original:pobjc_class; name:pchar; extraBytes:size_t):pobjc_class; cdecl; external libname;
+  function objc_duplicateClass(original:pobjc_class; name:PAnsiChar; extraBytes:size_t):pobjc_class; cdecl; external libname;
   procedure objc_disposeClassPair(cls:pobjc_class); cdecl; external libname;
   procedure objc_disposeClassPair(cls:pobjc_class); cdecl; external libname;
 
 
-  function class_addMethod(cls:pobjc_class; name:SEL; _imp:IMP; types:pchar):ObjCBOOL; cdecl; external libname;
-  function class_addIvar(cls:pobjc_class; name:pchar; size:size_t; alignment:cuint8; types:pchar):ObjCBOOL; cdecl; external libname;
+  function class_addMethod(cls:pobjc_class; name:SEL; _imp:IMP; types:PAnsiChar):ObjCBOOL; cdecl; external libname;
+  function class_addIvar(cls:pobjc_class; name:PAnsiChar; size:size_t; alignment:cuint8; types:PAnsiChar):ObjCBOOL; cdecl; external libname;
   function class_addProtocol(cls:pobjc_class; protocol:pobjc_protocol):ObjCBOOL; cdecl; external libname;
   function class_addProtocol(cls:pobjc_class; protocol:pobjc_protocol):ObjCBOOL; cdecl; external libname;
 
 
   function method_getName(m:Method):SEL; cdecl; external libname;
   function method_getName(m:Method):SEL; cdecl; external libname;
   function method_getImplementation(m:Method):IMP; cdecl; external libname;
   function method_getImplementation(m:Method):IMP; cdecl; external libname;
-  function method_getTypeEncoding(m:Method):Pchar; cdecl; external libname;
+  function method_getTypeEncoding(m:Method):PAnsichar; cdecl; external libname;
 
 
   function method_getNumberOfArguments(m:Method):dword; cdecl; external libname;
   function method_getNumberOfArguments(m:Method):dword; cdecl; external libname;
-  function method_copyReturnType(m:Method):Pchar; cdecl; external libname;
-  function method_copyArgumentType(m:Method; index:dword):Pchar; cdecl; external libname;
-  procedure method_getReturnType(m:Method; dst:pchar; dst_len:size_t); cdecl; external libname;
+  function method_copyReturnType(m:Method):PAnsichar; cdecl; external libname;
+  function method_copyArgumentType(m:Method; index:dword):PAnsichar; cdecl; external libname;
+  procedure method_getReturnType(m:Method; dst:PAnsiChar; dst_len:size_t); cdecl; external libname;
 
 
   function method_setImplementation(m:Method; imp:IMP):IMP; cdecl; external libname;
   function method_setImplementation(m:Method; imp:IMP):IMP; cdecl; external libname;
 
 
-  function ivar_getName(v:Ivar):Pchar; cdecl; external libname;
-  function ivar_getTypeEncoding(v:Ivar):Pchar; cdecl; external libname;
+  function ivar_getName(v:Ivar):PAnsiChar; cdecl; external libname;
+  function ivar_getTypeEncoding(v:Ivar):PAnsiChar; cdecl; external libname;
   function ivar_getOffset(v:Ivar):ptrdiff_t; cdecl; external libname;
   function ivar_getOffset(v:Ivar):ptrdiff_t; cdecl; external libname;
 
 
   function sel_isEqual(lhs:SEL; rhs:SEL):ObjCBOOL; cdecl; external libname;
   function sel_isEqual(lhs:SEL; rhs:SEL):ObjCBOOL; cdecl; external libname;

+ 3 - 3
rtl/inc/objpash.inc

@@ -390,7 +390,7 @@
          procedure(reason: FPC_Unwind_Reason_Code; exc: PFPC_Unwind_Exception); cdecl;
          procedure(reason: FPC_Unwind_Reason_Code; exc: PFPC_Unwind_Exception); cdecl;
 
 
        FPC_Unwind_Exception = record
        FPC_Unwind_Exception = record
-         { qword instead of array of char to ensure proper alignment and
+         { qword instead of array of AnsiChar to ensure proper alignment and
            padding, and also easier to compare }
            padding, and also easier to compare }
          exception_class: qword;
          exception_class: qword;
          exception_cleanup: FPC_Unwind_Exception_Cleanup_Fn;
          exception_cleanup: FPC_Unwind_Exception_Cleanup_Fn;
@@ -555,12 +555,12 @@
 {$ifdef ENDIAN_BIG}
 {$ifdef ENDIAN_BIG}
            vtInteger       : ({$IFDEF CPU64}integerdummy1 : Longint;{$ENDIF CPU64}VInteger: Longint);
            vtInteger       : ({$IFDEF CPU64}integerdummy1 : Longint;{$ENDIF CPU64}VInteger: Longint);
            vtBoolean       : ({$IFDEF CPU64}booldummy : Longint;{$ENDIF CPU64}booldummy1,booldummy2,booldummy3: byte; VBoolean: Boolean);
            vtBoolean       : ({$IFDEF CPU64}booldummy : Longint;{$ENDIF CPU64}booldummy1,booldummy2,booldummy3: byte; VBoolean: Boolean);
-           vtChar          : ({$IFDEF CPU64}chardummy : Longint;{$ENDIF CPU64}chardummy1,chardummy2,chardummy3: byte; VChar: Char);
+           vtChar          : ({$IFDEF CPU64}chardummy : Longint;{$ENDIF CPU64}chardummy1,chardummy2,chardummy3: byte; VChar: AnsiChar);
            vtWideChar      : ({$IFDEF CPU64}widechardummy : Longint;{$ENDIF CPU64}wchardummy1,VWideChar: WideChar);
            vtWideChar      : ({$IFDEF CPU64}widechardummy : Longint;{$ENDIF CPU64}wchardummy1,VWideChar: WideChar);
 {$else ENDIAN_BIG}
 {$else ENDIAN_BIG}
            vtInteger       : (VInteger: Longint);
            vtInteger       : (VInteger: Longint);
            vtBoolean       : (VBoolean: Boolean);
            vtBoolean       : (VBoolean: Boolean);
-           vtChar          : (VChar: Char);
+           vtChar          : (VChar: AnsiChar);
            vtWideChar      : (VWideChar: WideChar);
            vtWideChar      : (VWideChar: WideChar);
 {$endif ENDIAN_BIG}
 {$endif ENDIAN_BIG}
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}

+ 1 - 1
rtl/inc/psabiehh.inc

@@ -63,7 +63,7 @@ type
   TFPC_psabieh_exceptionClass = record
   TFPC_psabieh_exceptionClass = record
     case byte of
     case byte of
       0: (u: qword); {cuint64}
       0: (u: qword); {cuint64}
-      1: (a: array[0..7] of char);
+      1: (a: array[0..7] of AnsiChar);
   end;
   end;
 
 
 {$push}
 {$push}

+ 17 - 17
rtl/inc/resh.inc

@@ -18,7 +18,7 @@ type
   {roozbeh : maybe it shoud be moved after ifndef mswindows,as there is one declared in wince,base.inc}
   {roozbeh : maybe it shoud be moved after ifndef mswindows,as there is one declared in wince,base.inc}
   MAKEINTRESOURCE = pwidechar;
   MAKEINTRESOURCE = pwidechar;
 {$else}
 {$else}
-  MAKEINTRESOURCE = pchar;
+  MAKEINTRESOURCE = PAnsiChar;
 {$endif}  
 {$endif}  
 {$endif not Win16}
 {$endif not Win16}
   
   
@@ -51,12 +51,12 @@ const
 
 
 // Win32 API compatible Resource callbacks
 // Win32 API compatible Resource callbacks
 type
 type
-  EnumResTypeProc = function(ModuleHandle : TFPResourceHMODULE; ResourceType : PChar; lParam : PtrInt) : LongBool; stdcall;
-  EnumResNameProc = function(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PChar; lParam : PtrInt) : LongBool; stdcall;
-  EnumResLangProc = function(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PChar; IDLanguage : word; lParam : PtrInt) : LongBool; stdcall;
+  EnumResTypeProc = function(ModuleHandle : TFPResourceHMODULE; ResourceType : PAnsiChar; lParam : PtrInt) : LongBool; stdcall;
+  EnumResNameProc = function(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PAnsiChar; lParam : PtrInt) : LongBool; stdcall;
+  EnumResLangProc = function(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PAnsiChar; IDLanguage : word; lParam : PtrInt) : LongBool; stdcall;
 
 
 // Useful functions (macros in win32 headers)
 // Useful functions (macros in win32 headers)
-function Is_IntResource(aStr : pchar) : boolean; {$ifdef SYSTEMINLINE}inline;{$endif}
+function Is_IntResource(aStr : PAnsiChar) : boolean; {$ifdef SYSTEMINLINE}inline;{$endif}
 function MakeLangID(primary,sub : word) : word; {$ifdef SYSTEMINLINE}inline;{$endif}
 function MakeLangID(primary,sub : word) : word; {$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 // Win32 API compatible Resource functions
 // Win32 API compatible Resource functions
@@ -64,11 +64,11 @@ function MakeLangID(primary,sub : word) : word; {$ifdef SYSTEMINLINE}inline;{$en
 Function HINSTANCE : TFPResourceHMODULE;
 Function HINSTANCE : TFPResourceHMODULE;
 {$endif Win16}
 {$endif Win16}
 Function EnumResourceTypes(ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
 Function EnumResourceTypes(ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
-Function EnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
-Function EnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
+Function EnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PAnsiChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
+Function EnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PAnsiChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
 {$ifndef Win16}
 {$ifndef Win16}
-Function FindResource(ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PChar): TFPResourceHandle;
-Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType, ResourceName: PChar; Language : word): TFPResourceHandle;
+Function FindResource(ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PAnsiChar): TFPResourceHandle;
+Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType, ResourceName: PAnsiChar; Language : word): TFPResourceHandle;
 Function LoadResource(ModuleHandle: TFPResourceHMODULE; ResHandle: TFPResourceHandle): TFPResourceHGLOBAL;
 Function LoadResource(ModuleHandle: TFPResourceHMODULE; ResHandle: TFPResourceHandle): TFPResourceHGLOBAL;
 Function SizeofResource(ModuleHandle: TFPResourceHMODULE; ResHandle: TFPResourceHandle): LongWord;
 Function SizeofResource(ModuleHandle: TFPResourceHMODULE; ResHandle: TFPResourceHandle): LongWord;
 Function LockResource(ResData: TFPResourceHGLOBAL): Pointer;
 Function LockResource(ResData: TFPResourceHGLOBAL): Pointer;
@@ -79,10 +79,10 @@ Function FreeResource(ResData: TFPResourceHGLOBAL): LongBool;
 Function FindResource(ModuleHandle: TFPResourceHMODULE; const ResourceName, ResourceType: AnsiString): TFPResourceHandle;
 Function FindResource(ModuleHandle: TFPResourceHMODULE; const ResourceName, ResourceType: AnsiString): TFPResourceHandle;
 Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; const ResourceType, ResourceName: AnsiString; Language : word): TFPResourceHandle;
 Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; const ResourceType, ResourceName: AnsiString; Language : word): TFPResourceHandle;
 {$ifndef Win16}
 {$ifndef Win16}
-Function FindResource(ModuleHandle: TFPResourceHMODULE; const ResourceName: AnsiString; ResourceType: PChar): TFPResourceHandle;
-Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType: PChar; const ResourceName: AnsiString; Language : word): TFPResourceHandle;
-Function FindResource(ModuleHandle: TFPResourceHMODULE; ResourceName: PChar; const ResourceType: AnsiString): TFPResourceHandle;
-Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; const ResourceType: AnsiString; ResourceName: PChar; Language : word): TFPResourceHandle;
+Function FindResource(ModuleHandle: TFPResourceHMODULE; const ResourceName: AnsiString; ResourceType: PAnsiChar): TFPResourceHandle;
+Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType: PAnsiChar; const ResourceName: AnsiString; Language : word): TFPResourceHandle;
+Function FindResource(ModuleHandle: TFPResourceHMODULE; ResourceName: PAnsiChar; const ResourceType: AnsiString): TFPResourceHandle;
+Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; const ResourceType: AnsiString; ResourceName: PAnsiChar; Language : word): TFPResourceHandle;
 {$endif Win16}
 {$endif Win16}
 {$endif}
 {$endif}
 
 
@@ -90,10 +90,10 @@ type
   TResourceManager = record
   TResourceManager = record
     HINSTANCEFunc : function : TFPResourceHMODULE;
     HINSTANCEFunc : function : TFPResourceHMODULE;
     EnumResourceTypesFunc : function (ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
     EnumResourceTypesFunc : function (ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
-    EnumResourceNamesFunc : function (ModuleHandle : TFPResourceHMODULE; ResourceType : PChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
-    EnumResourceLanguagesFunc : function (ModuleHandle : TFPResourceHMODULE; ResourceType,ResourceName : PChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
-    FindResourceFunc : function (ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PChar): TFPResourceHandle;
-    FindResourceExFunc : function (ModuleHandle: TFPResourceHMODULE; ResourceType, ResourceName: PChar; Language : word): TFPResourceHandle;
+    EnumResourceNamesFunc : function (ModuleHandle : TFPResourceHMODULE; ResourceType : PAnsiChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
+    EnumResourceLanguagesFunc : function (ModuleHandle : TFPResourceHMODULE; ResourceType,ResourceName : PAnsiChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
+    FindResourceFunc : function (ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PAnsiChar): TFPResourceHandle;
+    FindResourceExFunc : function (ModuleHandle: TFPResourceHMODULE; ResourceType, ResourceName: PAnsiChar; Language : word): TFPResourceHandle;
     LoadResourceFunc : function (ModuleHandle: TFPResourceHMODULE; ResHandle: TFPResourceHandle): TFPResourceHGLOBAL;
     LoadResourceFunc : function (ModuleHandle: TFPResourceHMODULE; ResHandle: TFPResourceHandle): TFPResourceHGLOBAL;
     SizeofResourceFunc : function (ModuleHandle: TFPResourceHMODULE; ResHandle: TFPResourceHandle): LongWord;
     SizeofResourceFunc : function (ModuleHandle: TFPResourceHMODULE; ResHandle: TFPResourceHandle): LongWord;
     LockResourceFunc : function (ResData: TFPResourceHGLOBAL): Pointer;
     LockResourceFunc : function (ResData: TFPResourceHGLOBAL): Pointer;

+ 1 - 1
rtl/inc/rtti.inc

@@ -178,7 +178,7 @@ begin
     tkWstring,tkUString,
     tkWstring,tkUString,
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
     tkInterface:
     tkInterface:
-      PPchar(Data)^:=Nil;
+      PPAnsiChar(Data)^:=Nil;
     tkArray:
     tkArray:
       arrayrtti(data,typeinfo,@int_initialize);
       arrayrtti(data,typeinfo,@int_initialize);
 {$ifdef FPC_HAS_FEATURE_OBJECTS}
 {$ifdef FPC_HAS_FEATURE_OBJECTS}

+ 38 - 38
rtl/inc/sstrings.inc

@@ -101,7 +101,7 @@ end;
 
 
 {$ifndef FPC_HAS_SHORTSTR_INSERT_CHAR}
 {$ifndef FPC_HAS_SHORTSTR_INSERT_CHAR}
 {$define FPC_HAS_SHORTSTR_INSERT_CHAR}
 {$define FPC_HAS_SHORTSTR_INSERT_CHAR}
-procedure {$ifdef ver3_0}insert{$else}fpc_shortstr_insert_char{$endif}(source : Char;var s : shortstring;index : SizeInt);
+procedure {$ifdef ver3_0}insert{$else}fpc_shortstr_insert_char{$endif}(source : AnsiChar;var s : shortstring;index : SizeInt);
 var
 var
   indexlen : SizeInt;
   indexlen : SizeInt;
 begin
 begin
@@ -128,7 +128,7 @@ end;
 function pos(const substr : shortstring;const s : shortstring; Offset : Sizeint = 1):SizeInt;
 function pos(const substr : shortstring;const s : shortstring; Offset : Sizeint = 1):SizeInt;
 var
 var
   i,MaxLen : SizeInt;
   i,MaxLen : SizeInt;
-  pc : pchar;
+  pc : PAnsiChar;
 begin
 begin
   Pos:=0;
   Pos:=0;
   if (Length(SubStr)>0) and (Offset>0) and (Offset<=Length(S)) then
   if (Length(SubStr)>0) and (Offset>0) and (Offset<=Length(S)) then
@@ -154,11 +154,11 @@ end;
 
 
 {$ifndef FPC_HAS_SHORTSTR_POS_CHAR}
 {$ifndef FPC_HAS_SHORTSTR_POS_CHAR}
 {$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;
-  pc : pchar;
+  pc : PAnsiChar;
 begin
 begin
   Pos:=0;
   Pos:=0;
   if (Offset<1) or (Offset>Length(S)) then
   if (Offset<1) or (Offset>Length(S)) then
@@ -178,7 +178,7 @@ end;
 {$endif FPC_HAS_SHORTSTR_POS_CHAR}
 {$endif FPC_HAS_SHORTSTR_POS_CHAR}
 
 
 
 
-function fpc_char_copy(c:char;index : SizeInt;count : SizeInt): shortstring;compilerproc;
+function fpc_char_copy(c:ansichar;index : SizeInt;count : SizeInt): shortstring;compilerproc;
 begin
 begin
   if (index=1) and (Count>0) then
   if (index=1) and (Count>0) then
    fpc_char_Copy:=c
    fpc_char_Copy:=c
@@ -186,7 +186,7 @@ begin
    fpc_char_Copy:='';
    fpc_char_Copy:='';
 end;
 end;
 
 
-function pos(const substr : shortstring;c:char;  Offset : Sizeint = 1): SizeInt;
+function pos(const substr : shortstring;c:Ansichar;  Offset : Sizeint = 1): SizeInt;
 begin
 begin
   if (length(substr)=1) and (substr[1]=c) and (Offset=1) then
   if (length(substr)=1) and (substr[1]=c) and (Offset=1) then
    Pos:=1
    Pos:=1
@@ -205,14 +205,14 @@ const
 
 
 {$ifndef FPC_UPCASE_CHAR}
 {$ifndef FPC_UPCASE_CHAR}
 {$define FPC_UPCASE_CHAR}
 {$define FPC_UPCASE_CHAR}
-function upcase(c : char) : char;
+function upcase(c : Ansichar) : Ansichar;
 {$IFDEF IBM_CHAR_SET}
 {$IFDEF IBM_CHAR_SET}
 var
 var
   i : ObjpasInt;
   i : ObjpasInt;
 {$ENDIF}
 {$ENDIF}
 begin
 begin
   if (c in ['a'..'z']) then
   if (c in ['a'..'z']) then
-    upcase:=char(byte(c)-32)
+    upcase:=AnsiChar(byte(c)-32)
   else
   else
 {$IFDEF IBM_CHAR_SET}
 {$IFDEF IBM_CHAR_SET}
     begin
     begin
@@ -244,14 +244,14 @@ end;
 
 
 {$ifndef FPC_LOWERCASE_CHAR}
 {$ifndef FPC_LOWERCASE_CHAR}
 {$define FPC_LOWERCASE_CHAR}
 {$define FPC_LOWERCASE_CHAR}
-function lowercase(c : char) : char;overload;
+function lowercase(c : AnsiChar) : AnsiChar;overload;
 {$IFDEF IBM_CHAR_SET}
 {$IFDEF IBM_CHAR_SET}
 var
 var
   i : ObjpasInt;
   i : ObjpasInt;
 {$ENDIF}
 {$ENDIF}
 begin
 begin
   if (c in ['A'..'Z']) then
   if (c in ['A'..'Z']) then
-   lowercase:=char(byte(c)+32)
+   lowercase:=AnsiChar(byte(c)+32)
   else
   else
 {$IFDEF IBM_CHAR_SET}
 {$IFDEF IBM_CHAR_SET}
    begin
    begin
@@ -281,13 +281,13 @@ end;
 {$endif FPC_LOWERCASE_SHORTSTR}
 {$endif FPC_LOWERCASE_SHORTSTR}
 
 
 const
 const
-  HexTbl : array[0..15] of char='0123456789ABCDEF';
+  HexTbl : array[0..15] of AnsiChar='0123456789ABCDEF';
 
 
 function hexstr(val : longint;cnt : byte) : shortstring;
 function hexstr(val : longint;cnt : byte) : shortstring;
 var
 var
   i : ObjpasInt;
   i : ObjpasInt;
 begin
 begin
-  hexstr[0]:=char(cnt);
+  hexstr[0]:=AnsiChar(cnt);
   for i:=cnt downto 1 do
   for i:=cnt downto 1 do
    begin
    begin
      hexstr[i]:=hextbl[val and $f];
      hexstr[i]:=hextbl[val and $f];
@@ -299,7 +299,7 @@ function octstr(val : longint;cnt : byte) : shortstring;
 var
 var
   i : ObjpasInt;
   i : ObjpasInt;
 begin
 begin
-  octstr[0]:=char(cnt);
+  octstr[0]:=AnsiChar(cnt);
   for i:=cnt downto 1 do
   for i:=cnt downto 1 do
    begin
    begin
      octstr[i]:=hextbl[val and 7];
      octstr[i]:=hextbl[val and 7];
@@ -312,10 +312,10 @@ function binstr(val : longint;cnt : byte) : shortstring;
 var
 var
   i : ObjpasInt;
   i : ObjpasInt;
 begin
 begin
-  binstr[0]:=char(cnt);
+  binstr[0]:=AnsiChar(cnt);
   for i:=cnt downto 1 do
   for i:=cnt downto 1 do
    begin
    begin
-     binstr[i]:=char(48+val and 1);
+     binstr[i]:=AnsiChar(48+val and 1);
      val:=val shr 1;
      val:=val shr 1;
    end;
    end;
 end;
 end;
@@ -325,7 +325,7 @@ function hexstr(val : int64;cnt : byte) : shortstring;
 var
 var
   i : ObjpasInt;
   i : ObjpasInt;
 begin
 begin
-  hexstr[0]:=char(cnt);
+  hexstr[0]:=AnsiChar(cnt);
   for i:=cnt downto 1 do
   for i:=cnt downto 1 do
    begin
    begin
      hexstr[i]:=hextbl[val and $f];
      hexstr[i]:=hextbl[val and $f];
@@ -338,7 +338,7 @@ function octstr(val : int64;cnt : byte) : shortstring;
 var
 var
   i : ObjpasInt;
   i : ObjpasInt;
 begin
 begin
-  octstr[0]:=char(cnt);
+  octstr[0]:=AnsiChar(cnt);
   for i:=cnt downto 1 do
   for i:=cnt downto 1 do
    begin
    begin
      octstr[i]:=hextbl[val and 7];
      octstr[i]:=hextbl[val and 7];
@@ -351,10 +351,10 @@ function binstr(val : int64;cnt : byte) : shortstring;
 var
 var
   i : ObjpasInt;
   i : ObjpasInt;
 begin
 begin
-  binstr[0]:=char(cnt);
+  binstr[0]:=AnsiChar(cnt);
   for i:=cnt downto 1 do
   for i:=cnt downto 1 do
    begin
    begin
-     binstr[i]:=char(48+val and 1);
+     binstr[i]:=AnsiChar(48+val and 1);
      val:=val shr 1;
      val:=val shr 1;
    end;
    end;
 end;
 end;
@@ -518,7 +518,7 @@ type
   Tenum_typeinfo={$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}packed{$endif}record
   Tenum_typeinfo={$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}packed{$endif}record
     kind:TTypeKind; { always tkEnumeration }
     kind:TTypeKind; { always tkEnumeration }
     num_chars:byte;
     num_chars:byte;
-    chars:array[0..0] of char; { variable length with size of num_chars }
+    chars:array[0..0] of AnsiChar; { variable length with size of num_chars }
   end;
   end;
 
 
 {$push}
 {$push}
@@ -689,7 +689,7 @@ procedure fpc_shortstr_currency({$ifdef cpujvm}constref{$endif} c : currency; le
 const
 const
   MinLen = 8; { Minimal string length in scientific format }
   MinLen = 8; { Minimal string length in scientific format }
 var
 var
-  buf : array[1..19] of char;
+  buf : array[1..19] of AnsiChar;
   i,j,k,reslen,tlen,sign,r,point : ObjpasInt;
   i,j,k,reslen,tlen,sign,r,point : ObjpasInt;
   ic : qword;
   ic : qword;
 begin
 begin
@@ -865,10 +865,10 @@ begin
 end;
 end;
 
 
 {
 {
-   Array Of Char Str() helpers
+   Array Of AnsiChar Str() helpers
 }
 }
 
 
-procedure fpc_chararray_sint(v : valsint;len : SizeInt;out a:array of char);compilerproc;
+procedure fpc_chararray_sint(v : valsint;len : SizeInt;out a:array of AnsiChar);compilerproc;
 var
 var
   ss : shortstring;
   ss : shortstring;
   maxlen : SizeInt;
   maxlen : SizeInt;
@@ -884,7 +884,7 @@ begin
 end;
 end;
 
 
 
 
-procedure fpc_chararray_uint(v : valuint;len : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_uint(v : valuint;len : SizeInt;out a : array of AnsiChar);compilerproc;
 var
 var
   ss : shortstring;
   ss : shortstring;
   maxlen : SizeInt;
   maxlen : SizeInt;
@@ -902,7 +902,7 @@ end;
 
 
 {$ifndef CPU64}
 {$ifndef CPU64}
 
 
-procedure fpc_chararray_qword(v : qword;len : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_qword(v : qword;len : SizeInt;out a : array of AnsiChar);compilerproc;
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 begin
 begin
   runerror(219);
   runerror(219);
@@ -924,7 +924,7 @@ end;
 {$endif EXCLUDE_COMPLEX_PROCS}
 {$endif EXCLUDE_COMPLEX_PROCS}
 
 
 
 
-procedure fpc_chararray_int64(v : int64;len : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_int64(v : int64;len : SizeInt;out a : array of AnsiChar);compilerproc;
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 begin
 begin
   runerror(219);
   runerror(219);
@@ -950,7 +950,7 @@ end;
 
 
 {$if defined(CPU16) or defined(CPU8)}
 {$if defined(CPU16) or defined(CPU8)}
 
 
-procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of AnsiChar);compilerproc;
 var
 var
   ss : shortstring;
   ss : shortstring;
   maxlen : SizeInt;
   maxlen : SizeInt;
@@ -966,7 +966,7 @@ begin
 end;
 end;
 
 
 
 
-procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of AnsiChar);compilerproc;
 var
 var
   ss : shortstring;
   ss : shortstring;
   maxlen : SizeInt;
   maxlen : SizeInt;
@@ -982,7 +982,7 @@ begin
 end;
 end;
 
 
 
 
-procedure fpc_chararray_word(v : word;len : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_word(v : word;len : SizeInt;out a : array of AnsiChar);compilerproc;
 var
 var
   ss : shortstring;
   ss : shortstring;
   maxlen : SizeInt;
   maxlen : SizeInt;
@@ -998,7 +998,7 @@ begin
 end;
 end;
 
 
 
 
-procedure fpc_chararray_smallint(v : smallint;len : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_smallint(v : smallint;len : SizeInt;out a : array of AnsiChar);compilerproc;
 var
 var
   ss : shortstring;
   ss : shortstring;
   maxlen : SizeInt;
   maxlen : SizeInt;
@@ -1017,7 +1017,7 @@ end;
 
 
 
 
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
-procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;out a : array of AnsiChar);compilerproc;
 var
 var
   ss : shortstring;
   ss : shortstring;
   maxlen : SizeInt;
   maxlen : SizeInt;
@@ -1036,7 +1036,7 @@ end;
   this is not a good solution but fixing compilation of this procedure for
   this is not a good solution but fixing compilation of this procedure for
   avr is hard, requires significant changes to the register allocator to take
   avr is hard, requires significant changes to the register allocator to take
   care of different register classes }
   care of different register classes }
-procedure fpc_chararray_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out a : array of char);compilerproc;
+procedure fpc_chararray_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out a : array of AnsiChar);compilerproc;
 var
 var
   ss : shortstring;
   ss : shortstring;
   maxlen : SizeInt;
   maxlen : SizeInt;
@@ -1054,7 +1054,7 @@ begin
 end;
 end;
 {$endif not FPC_STR_ENUM_INTERN}
 {$endif not FPC_STR_ENUM_INTERN}
 
 
-procedure fpc_chararray_bool(b : boolean;len:sizeint;out a : array of char);compilerproc;
+procedure fpc_chararray_bool(b : boolean;len:sizeint;out a : array of AnsiChar);compilerproc;
 var
 var
   ss : shortstring;
   ss : shortstring;
   maxlen : SizeInt;
   maxlen : SizeInt;
@@ -1070,7 +1070,7 @@ end;
 
 
 {$ifndef FPC_HAS_CHARARRAY_CURRENCY}
 {$ifndef FPC_HAS_CHARARRAY_CURRENCY}
 {$define FPC_HAS_CHARARRAY_CURRENCY}
 {$define FPC_HAS_CHARARRAY_CURRENCY}
-procedure fpc_chararray_Currency(c : Currency;len,fr : SizeInt;out a : array of char);compilerproc;
+procedure fpc_chararray_Currency(c : Currency;len,fr : SizeInt;out a : array of AnsiChar);compilerproc;
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 begin
 begin
   runerror(217);
   runerror(217);
@@ -1643,7 +1643,7 @@ function fpc_val_enum_shortstr(str2ordindex:pointer;const s:shortstring;out code
      comparison.}
      comparison.}
 
 
     var i,l:byte;
     var i,l:byte;
-        c1,c2:char;
+        c1,c2:AnsiChar;
 
 
     begin
     begin
       l:=length(s1);
       l:=length(s1);
@@ -1871,7 +1871,7 @@ end;
 
 
 {$ifndef FPC_HAS_SETSTRING_SHORTSTR}
 {$ifndef FPC_HAS_SETSTRING_SHORTSTR}
 {$define FPC_HAS_SETSTRING_SHORTSTR}
 {$define FPC_HAS_SETSTRING_SHORTSTR}
-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}
 begin
 begin
   If Len > High(S) then
   If Len > High(S) then
     Len := High(S);
     Len := High(S);
@@ -1890,7 +1890,7 @@ var
   c1, c2: Byte;
   c1, c2: Byte;
   i: SizeInt;
   i: SizeInt;
   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);

+ 32 - 32
rtl/inc/strings.pp

@@ -2,7 +2,7 @@
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
     Copyright (c) 1999-2000 by the Free Pascal development team.
     Copyright (c) 1999-2000 by the Free Pascal development team.
 
 
-    Strings unit for PChar (asciiz/C compatible strings) handling
+    Strings unit for PAnsiChar (asciiz/C compatible strings) handling
 
 
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
@@ -18,86 +18,86 @@ unit Strings;
 interface
 interface
 
 
     { Implemented in System Unit }
     { Implemented in System Unit }
-    function strpas(p:pchar):shortstring;inline;
+    function strpas(p:PAnsiChar):shortstring;inline;
 
 
-    function strlen(p:pchar):sizeint;external name 'FPC_PCHAR_LENGTH';
+    function strlen(p:PAnsiChar):sizeint;external name 'FPC_PCHAR_LENGTH';
 
 
     { Converts a Pascal string to a null-terminated string }
     { Converts a Pascal string to a null-terminated string }
-    function strpcopy(d : pchar;const s : string) : pchar;
+    function strpcopy(d : PAnsiChar;const s : string) : PAnsiChar;
 
 
     { Copies source to dest, returns a pointer to dest }
     { Copies source to dest, returns a pointer to dest }
-    function strcopy(dest,source : pchar) : pchar; overload;
+    function strcopy(dest,source : PAnsiChar) : PAnsiChar; overload;
 
 
     { Copies at most maxlen bytes from source to dest. }
     { Copies at most maxlen bytes from source to dest. }
     { Returns a pointer to dest }
     { Returns a pointer to dest }
-    function strlcopy(dest,source : pchar;maxlen : SizeInt) : pchar; overload;
+    function strlcopy(dest,source : PAnsiChar;maxlen : SizeInt) : PAnsiChar; overload;
 
 
     { Copies source to dest and returns a pointer to the terminating }
     { Copies source to dest and returns a pointer to the terminating }
     { null character.    }
     { null character.    }
-    function strecopy(dest,source : pchar) : pchar;
+    function strecopy(dest,source : PAnsiChar) : PAnsiChar;
 
 
     { Returns a pointer tro the terminating null character of p }
     { Returns a pointer tro the terminating null character of p }
-    function strend(p : pchar) : pchar;
+    function strend(p : PAnsiChar) : PAnsiChar;
 
 
     { Appends source to dest, returns a pointer do dest}
     { Appends source to dest, returns a pointer do dest}
-    function strcat(dest,source : pchar) : pchar;
+    function strcat(dest,source : PAnsiChar) : PAnsiChar;
 
 
     { Compares str1 und str2, returns }
     { Compares str1 und str2, returns }
     { a value <0 if str1<str2;        }
     { a value <0 if str1<str2;        }
     {  0 when str1=str2               }
     {  0 when str1=str2               }
     { and a value >0 if str1>str2     }
     { and a value >0 if str1>str2     }
-    function strcomp(str1,str2 : pchar) : SizeInt;
+    function strcomp(str1,str2 : PAnsiChar) : SizeInt;
 
 
     { The same as strcomp, but at most l characters are compared  }
     { The same as strcomp, but at most l characters are compared  }
-    function strlcomp(str1,str2 : pchar;l : SizeInt) : SizeInt;
+    function strlcomp(str1,str2 : PAnsiChar;l : SizeInt) : SizeInt;
 
 
     { The same as strcomp but case insensitive }
     { The same as strcomp but case insensitive }
-    function stricomp(str1,str2 : pchar) : SizeInt;
+    function stricomp(str1,str2 : PAnsiChar) : SizeInt;
 
 
     { The same as stricomp, but at most l characters are compared }
     { The same as stricomp, but at most l characters are compared }
-    function strlicomp(str1,str2 : pchar;l : SizeInt) : SizeInt;
+    function strlicomp(str1,str2 : PAnsiChar;l : SizeInt) : SizeInt;
 
 
     { Copies l characters from source to dest, returns dest. }
     { Copies l characters from source to dest, returns dest. }
-    function strmove(dest,source : pchar;l : SizeInt) : pchar;
+    function strmove(dest,source : PAnsiChar;l : SizeInt) : PAnsiChar;
 
 
     { Appends at most l characters from source to dest }
     { Appends at most l characters from source to dest }
-    function strlcat(dest,source : pchar;l : SizeInt) : pchar;
+    function strlcat(dest,source : PAnsiChar;l : SizeInt) : PAnsiChar;
 
 
     { Returns a pointer to the first occurrence of c in p }
     { Returns a pointer to the first occurrence of c in p }
     { If c doesn't occur, nil is returned }
     { If c doesn't occur, nil is returned }
-    function strscan(p : pchar;c : char) : pchar;
+    function strscan(p : PAnsiChar;c : AnsiChar) : PAnsiChar;
 
 
     { The same as strscan but case insensitive }
     { The same as strscan but case insensitive }
-    function striscan(p : pchar;c : char) : pchar;
+    function striscan(p : PAnsiChar;c : AnsiChar) : PAnsiChar;
 
 
     { Returns a pointer to the last occurrence of c in p }
     { Returns a pointer to the last occurrence of c in p }
     { If c doesn't occur, nil is returned }
     { If c doesn't occur, nil is returned }
-    function strrscan(p : pchar;c : char) : pchar;
+    function strrscan(p : PAnsiChar;c : AnsiChar) : PAnsiChar;
 
 
     { The same as strrscan but case insensitive }
     { The same as strrscan but case insensitive }
-    function strriscan(p : pchar;c : char) : pchar;
+    function strriscan(p : PAnsiChar;c : AnsiChar) : PAnsiChar;
 
 
     { converts p to all-lowercase, returns p }
     { converts p to all-lowercase, returns p }
-    function strlower(p : pchar) : pchar;
+    function strlower(p : PAnsiChar) : PAnsiChar;
 
 
     { converts p to all-uppercase, returns p }
     { converts p to all-uppercase, returns p }
-    function strupper(p : pchar) : pchar;
+    function strupper(p : PAnsiChar) : PAnsiChar;
 
 
     { Returns a pointer to the first occurrence of str2 in }
     { Returns a pointer to the first occurrence of str2 in }
     { str1 Otherwise returns nil }
     { str1 Otherwise returns nil }
-    function strpos(str1,str2 : pchar) : pchar;
+    function strpos(str1,str2 : PAnsiChar) : PAnsiChar;
 
 
     { The same as strpos but case insensitive       }
     { The same as strpos but case insensitive       }
-    function stripos(str1,str2 : pchar) : pchar;
+    function stripos(str1,str2 : PAnsiChar) : PAnsiChar;
 
 
     { Makes a copy of p on the heap, and returns a pointer to this copy  }
     { Makes a copy of p on the heap, and returns a pointer to this copy  }
-    function strnew(p : pchar) : pchar;
+    function strnew(p : PAnsiChar) : PAnsiChar;
 
 
-    { Allocates L bytes on the heap, returns a pchar pointer to it }
-    function stralloc(L : SizeInt) : pchar;
+    { Allocates L bytes on the heap, returns a PAnsiChar pointer to it }
+    function stralloc(L : SizeInt) : PAnsiChar;
 
 
     { Releases a null-terminated string from the heap }
     { Releases a null-terminated string from the heap }
-    procedure strdispose(p : pchar);
+    procedure strdispose(p : PAnsiChar);
 
 
 implementation
 implementation
 
 
@@ -121,22 +121,22 @@ implementation
 { Functions, different from the one in sysutils }
 { Functions, different from the one in sysutils }
 
 
 
 
-    procedure fpc_pchar_to_shortstr(var res : openstring;p:pchar);[external name 'FPC_PCHAR_TO_SHORTSTR'];
+    procedure fpc_pchar_to_shortstr(var res : openstring;p:PAnsiChar);[external name 'FPC_PCHAR_TO_SHORTSTR'];
 
 
 
 
-    function strpas(p:pchar):shortstring;{$ifdef SYSTEMINLINE}inline;{$endif}
+    function strpas(p:PAnsiChar):shortstring;{$ifdef SYSTEMINLINE}inline;{$endif}
       begin
       begin
         fpc_pchar_to_shortstr(strpas,p);
         fpc_pchar_to_shortstr(strpas,p);
       end;
       end;
 
 
-    function stralloc(L : SizeInt) : pchar;
+    function stralloc(L : SizeInt) : PAnsiChar;
 
 
       begin
       begin
          StrAlloc:=Nil;
          StrAlloc:=Nil;
          GetMem (Stralloc,l);
          GetMem (Stralloc,l);
       end;
       end;
 
 
-    function strnew(p : pchar) : pchar;
+    function strnew(p : PAnsiChar) : PAnsiChar;
 
 
       var
       var
          len : SizeInt;
          len : SizeInt;
@@ -151,7 +151,7 @@ implementation
            move(p^,strnew^,len);
            move(p^,strnew^,len);
       end;
       end;
 
 
-    procedure strdispose(p : pchar);
+    procedure strdispose(p : PAnsiChar);
 
 
       begin
       begin
          if p<>nil then
          if p<>nil then

+ 8 - 8
rtl/inc/stringsi.inc

@@ -13,17 +13,17 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
-    function strcat(dest,source : pchar) : pchar;
+    function strcat(dest,source : PAnsiChar) : PAnsiChar;
 
 
       begin
       begin
         strcopy(strend(dest),source);
         strcopy(strend(dest),source);
         strcat:=dest;
         strcat:=dest;
       end;
       end;
 
 
-    function strlcat(dest,source : pchar;l : SizeInt) : pchar;
+    function strlcat(dest,source : PAnsiChar;l : SizeInt) : PAnsiChar;
 
 
       var
       var
-         destend : pchar;
+         destend : PAnsiChar;
 
 
       begin
       begin
          destend:=strend(dest);
          destend:=strend(dest);
@@ -33,7 +33,7 @@
          strlcat:=dest;
          strlcat:=dest;
       end;
       end;
 
 
-    function strmove(dest,source : pchar;l : SizeInt) : pchar;
+    function strmove(dest,source : PAnsiChar;l : SizeInt) : PAnsiChar;
 
 
       begin
       begin
          move(source^,dest^,l);
          move(source^,dest^,l);
@@ -41,9 +41,9 @@
       end;
       end;
 
 
 
 
-    function strpos(str1,str2 : pchar) : pchar;
+    function strpos(str1,str2 : PAnsiChar) : PAnsiChar;
       var
       var
-         p : pchar;
+         p : PAnsiChar;
          lstr2 : SizeInt;
          lstr2 : SizeInt;
       begin
       begin
          strpos:=nil;
          strpos:=nil;
@@ -65,9 +65,9 @@
            end;
            end;
       end;
       end;
 
 
-    function stripos(str1,str2 : pchar) : pchar;
+    function stripos(str1,str2 : PAnsiChar) : PAnsiChar;
       var
       var
-         p : pchar;
+         p : PAnsiChar;
          lstr2 : SizeInt;
          lstr2 : SizeInt;
       begin
       begin
          stripos:=nil;
          stripos:=nil;

+ 19 - 19
rtl/inc/sysres.inc

@@ -17,7 +17,7 @@
                              Utility functions
                              Utility functions
 *****************************************************************************)
 *****************************************************************************)
 
 
-function Is_IntResource(aStr : pchar) : boolean; {$ifdef SYSTEMINLINE}inline;{$endif}
+function Is_IntResource(aStr : PAnsiChar) : boolean; {$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   Result:=((PtrUInt(aStr) shr 16)=0);
   Result:=((PtrUInt(aStr) shr 16)=0);
 end;
 end;
@@ -35,38 +35,38 @@ end;
 Function FindResource(ModuleHandle: TFPResourceHMODULE; const ResourceName, ResourceType: AnsiString): TFPResourceHandle;
 Function FindResource(ModuleHandle: TFPResourceHMODULE; const ResourceName, ResourceType: AnsiString): TFPResourceHandle;
 
 
 begin
 begin
-  Result:=FindResource(ModuleHandle,PChar(ResourceName),PChar(ResourceType));
+  Result:=FindResource(ModuleHandle,PAnsiChar(ResourceName),PAnsiChar(ResourceType));
 end;
 end;
 
 
 Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; const ResourceType, ResourceName: AnsiString; Language : word): TFPResourceHandle;
 Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; const ResourceType, ResourceName: AnsiString; Language : word): TFPResourceHandle;
 
 
 begin
 begin
-  Result:=FindResourceEx(ModuleHandle,PChar(ResourceType),PChar(ResourceName),Language);
+  Result:=FindResourceEx(ModuleHandle,PAnsiChar(ResourceType),PAnsiChar(ResourceName),Language);
 end;
 end;
 
 
 {$ifndef Win16}
 {$ifndef Win16}
-Function FindResource(ModuleHandle: TFPResourceHMODULE; const ResourceName: AnsiString; ResourceType: PChar): TFPResourceHandle;
+Function FindResource(ModuleHandle: TFPResourceHMODULE; const ResourceName: AnsiString; ResourceType: PAnsiChar): TFPResourceHandle;
 
 
 begin
 begin
-  Result:=FindResource(ModuleHandle,PChar(ResourceName),ResourceType);
+  Result:=FindResource(ModuleHandle,PAnsiChar(ResourceName),ResourceType);
 end;
 end;
 
 
-Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType: PChar; const ResourceName: AnsiString; Language : word): TFPResourceHandle;
+Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType: PAnsiChar; const ResourceName: AnsiString; Language : word): TFPResourceHandle;
 
 
 begin
 begin
-  Result:=FindResourceEx(ModuleHandle,ResourceType,PChar(ResourceName),Language);
+  Result:=FindResourceEx(ModuleHandle,ResourceType,PAnsiChar(ResourceName),Language);
 end;
 end;
 
 
-Function FindResource(ModuleHandle: TFPResourceHMODULE; ResourceName: PChar; const ResourceType: AnsiString): TFPResourceHandle;
+Function FindResource(ModuleHandle: TFPResourceHMODULE; ResourceName: PAnsiChar; const ResourceType: AnsiString): TFPResourceHandle;
 
 
 begin
 begin
-  Result:=FindResource(ModuleHandle,ResourceName,PChar(ResourceType));
+  Result:=FindResource(ModuleHandle,ResourceName,PAnsiChar(ResourceType));
 end;
 end;
 
 
-Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; const ResourceType: AnsiString; ResourceName: PChar; Language : word): TFPResourceHandle;
+Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; const ResourceType: AnsiString; ResourceName: PAnsiChar; Language : word): TFPResourceHandle;
 
 
 begin
 begin
-  Result:=FindResourceEx(ModuleHandle,PChar(ResourceType),ResourceName,Language);
+  Result:=FindResourceEx(ModuleHandle,PAnsiChar(ResourceType),ResourceName,Language);
 end;
 end;
 {$endif Win16}
 {$endif Win16}
 {$endif}
 {$endif}
@@ -87,22 +87,22 @@ begin
   Result:=False;
   Result:=False;
 end;
 end;
 
 
-Function DefaultEnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
+Function DefaultEnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PAnsiChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
 begin
 begin
   Result:=False;
   Result:=False;
 end;
 end;
 
 
-Function DefaultEnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
+Function DefaultEnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PAnsiChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
 begin
 begin
   Result:=False;
   Result:=False;
 end;
 end;
 
 
-Function DefaultFindResource(ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PChar): TFPResourceHandle;
+Function DefaultFindResource(ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PAnsiChar): TFPResourceHandle;
 begin
 begin
   Result:=0;
   Result:=0;
 end;
 end;
 
 
-Function DefaultFindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType, ResourceName: PChar; Language : word): TFPResourceHandle;
+Function DefaultFindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType, ResourceName: PAnsiChar; Language : word): TFPResourceHandle;
 begin
 begin
   Result:=0;
   Result:=0;
 end;
 end;
@@ -179,23 +179,23 @@ begin
   Result:=resourcemanager.EnumResourceTypesFunc(ModuleHandle,EnumFunc,lParam);
   Result:=resourcemanager.EnumResourceTypesFunc(ModuleHandle,EnumFunc,lParam);
 end;
 end;
 
 
-Function EnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
+Function EnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PAnsiChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
 begin
 begin
   Result:=resourcemanager.EnumResourceNamesFunc(ModuleHandle,ResourceType,EnumFunc,lParam);
   Result:=resourcemanager.EnumResourceNamesFunc(ModuleHandle,ResourceType,EnumFunc,lParam);
 end;
 end;
 
 
-Function EnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
+Function EnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PAnsiChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
 begin
 begin
   Result:=resourcemanager.EnumResourceLanguagesFunc(ModuleHandle,ResourceType,ResourceName,EnumFunc,lParam);
   Result:=resourcemanager.EnumResourceLanguagesFunc(ModuleHandle,ResourceType,ResourceName,EnumFunc,lParam);
 end;
 end;
 
 
 {$ifndef Win16}
 {$ifndef Win16}
-Function FindResource(ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PChar): TFPResourceHandle;
+Function FindResource(ModuleHandle: TFPResourceHMODULE; ResourceName, ResourceType: PAnsiChar): TFPResourceHandle;
 begin
 begin
   Result:=resourcemanager.FindResourceFunc(ModuleHandle,ResourceName,ResourceType);
   Result:=resourcemanager.FindResourceFunc(ModuleHandle,ResourceName,ResourceType);
 end;
 end;
 
 
-Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType, ResourceName: PChar; Language : word): TFPResourceHandle;
+Function FindResourceEx(ModuleHandle: TFPResourceHMODULE; ResourceType, ResourceName: PAnsiChar; Language : word): TFPResourceHandle;
 begin
 begin
   Result:=resourcemanager.FindResourceExFunc(ModuleHandle,ResourceType,ResourceName,Language);
   Result:=resourcemanager.FindResourceExFunc(ModuleHandle,ResourceType,ResourceName,Language);
 end;
 end;

+ 19 - 19
rtl/inc/system.inc

@@ -374,7 +374,7 @@ begin
 end;
 end;
 
 
 
 
-procedure fillchar(var x;count : {$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};value : char);
+procedure fillchar(var x;count : {$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};value : AnsiChar);
 begin
 begin
   fillchar(x,count,byte(value));
   fillchar(x,count,byte(value));
 end;
 end;
@@ -386,7 +386,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;
@@ -661,7 +661,7 @@ type
     procedure Setup(const seed: uint64);
     procedure Setup(const seed: uint64);
     function Next: uint32; inline; // inlined as it is actually internal and called only through xsr128_32_u32rand
     function Next: uint32; inline; // inlined as it is actually internal and called only through xsr128_32_u32rand
   private
   private
-    state: array[0 .. 3] of uint32;
+    state: array[0 .. 3] of longword;
   end;
   end;
 
 
   procedure Xoshiro128ss_32.Setup(const seed: uint64);
   procedure Xoshiro128ss_32.Setup(const seed: uint64);
@@ -1562,21 +1562,21 @@ End;
 
 
 {$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 ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint):ppansichar; // const ?
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 begin
 begin
   runerror(217);
   runerror(217);
 end;
 end;
 {$else EXCLUDE_COMPLEX_PROCS}
 {$else EXCLUDE_COMPLEX_PROCS}
-// Extra allocate reserveentries pchar's at the beginning (default param=0 after 1.0.x ?)
+// 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   : ObjpasInt;
     i   : ObjpasInt;
 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
@@ -1586,31 +1586,31 @@ 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;
 {$endif EXCLUDE_COMPLEX_PROCS}
 {$endif EXCLUDE_COMPLEX_PROCS}
 
 
 
 
-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;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
 
 
-Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
+Function StringToPPChar(S: PAnsiChar;ReserveEntries:integer):ppansichar;
 
 
 var
 var
   i,nr  : ObjpasInt;
   i,nr  : ObjpasInt;
-  Buf : ^char;
-  p   : ppchar;
+  Buf : ^ansichar;
+  p   : ppansichar;
 
 
 begin
 begin
   buf:=s;
   buf:=s;
@@ -1634,7 +1634,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
@@ -1777,11 +1777,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 : ObjpasInt;
   i : ObjpasInt;
   len : sizeint;
   len : sizeint;
-  newp : pchar;
+  newp : pansichar;
 begin
 begin
   len:=length(p);
   len:=length(p);
   newp:=nil;
   newp:=nil;
@@ -1836,7 +1836,7 @@ end;
 procedure DoDirSeparators(var ps:RawByteString);
 procedure DoDirSeparators(var ps:RawByteString);
 var
 var
   i : ObjpasInt;
   i : ObjpasInt;
-  p : pchar;
+  p : pansichar;
   unique : boolean;
   unique : boolean;
 begin
 begin
   unique:=false;
   unique:=false;
@@ -1846,7 +1846,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;

+ 44 - 27
rtl/inc/systemh.inc

@@ -19,9 +19,15 @@
 ****************************************************************************}
 ****************************************************************************}
 
 
 {$I-,Q-,H-,R-,V-}
 {$I-,Q-,H-,R-,V-}
+
 {$mode objfpc}
 {$mode objfpc}
 {$modeswitch advancedrecords}
 {$modeswitch advancedrecords}
 
 
+{$IFDEF UNICODERTL}
+{$modeswitch unicodestrings}
+{ modeswitch typehelpers}
+{$ENDIF}
+
 { At least 3.0.0 is required }
 { At least 3.0.0 is required }
 {$if FPC_FULLVERSION<30000}
 {$if FPC_FULLVERSION<30000}
   {$fatal You need at least FPC 3.0.0 to build this version of FPC}
   {$fatal You need at least FPC 3.0.0 to build this version of FPC}
@@ -538,17 +544,28 @@ Type
 {$endif}
 {$endif}
 
 
 { Zero - terminated strings }
 { Zero - terminated strings }
+
+{$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}
+
   PChar               = ^Char;
   PChar               = ^Char;
   PPChar              = ^PChar;
   PPChar              = ^PChar;
   PPPChar             = ^PPChar;
   PPPChar             = ^PPChar;
 
 
-  { AnsiChar is equivalent of Char, so we need
-    to use type renamings }
-  TAnsiChar           = Char;
-  AnsiChar            = Char;
-  PAnsiChar           = PChar;
-  PPAnsiChar          = PPChar;
-  PPPAnsiChar         = PPPChar;
+  TAnsiChar           = AnsiChar;
+  PAnsiChar           = ^AnsiChar;
+  PPAnsiChar          = ^PAnsiChar;
+  PPPAnsiChar         = ^PPAnsiChar;
 
 
   UTF8Char = AnsiChar;
   UTF8Char = AnsiChar;
   PUTF8Char = PAnsiChar;
   PUTF8Char = PAnsiChar;
@@ -760,9 +777,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;
 
 
@@ -839,7 +856,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; // MVC: TODO ?
 {$endif}
 {$endif}
 
 
 {$ifdef FPC_HAS_FEATURE_THREADING}
 {$ifdef FPC_HAS_FEATURE_THREADING}
@@ -892,12 +909,12 @@ function StackTop: Pointer;
 Procedure Move(const source;var dest;count:{$ifdef MOVE_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif});
 Procedure Move(const source;var dest;count:{$ifdef MOVE_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif});
 Procedure FillChar(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};Value:Byte);
 Procedure FillChar(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};Value:Byte);
 Procedure FillChar(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};Value:Boolean);
 Procedure FillChar(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};Value:Boolean);
-Procedure FillChar(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};Value:Char);
+Procedure FillChar(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};Value:AnsiChar);
 procedure FillByte(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};value:byte);
 procedure FillByte(var x;count:{$ifdef FILLCHAR_HAS_SIZEUINT_COUNT}SizeUInt{$else}SizeInt{$endif};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; {$if defined(cpui386)} inline; {$endif}
 function  IndexByte(const buf;len:SizeInt;b:byte):SizeInt; {$if defined(cpui386)} inline; {$endif}
 function  Indexword(const buf;len:SizeInt;b:word):SizeInt; {$if defined(cpui386)} inline; {$endif}
 function  Indexword(const buf;len:SizeInt;b:word):SizeInt; {$if defined(cpui386)} inline; {$endif}
 function  IndexDWord(const buf;len:SizeInt;b:DWord):SizeInt; {$if defined(cpui386)} inline; {$endif}
 function  IndexDWord(const buf;len:SizeInt;b:DWord):SizeInt; {$if defined(cpui386)} inline; {$endif}
@@ -907,7 +924,7 @@ function  CompareByte(const buf1,buf2;len:SizeInt):SizeInt; {$if defined(cpui386
 function  CompareWord(const buf1,buf2;len:SizeInt):SizeInt; {$if defined(cpui386)} inline; {$endif}
 function  CompareWord(const buf1,buf2;len:SizeInt):SizeInt; {$if defined(cpui386)} inline; {$endif}
 function  CompareDWord(const buf1,buf2;len:SizeInt):SizeInt; {$if defined(cpui386)} inline; {$endif}
 function  CompareDWord(const buf1,buf2;len:SizeInt):SizeInt; {$if defined(cpui386)} inline; {$endif}
 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;
@@ -1256,11 +1273,11 @@ Function  DSeg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function  SSeg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
 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:
   <0: invalid sequence detected after processing "-result" bytes
   <0: invalid sequence detected after processing "-result" bytes
@@ -1274,10 +1291,10 @@ function Utf8CodePointLen(P: PAnsiChar; MaxLookAhead: SizeInt; IncludeCombiningD
 {$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;
 
 
@@ -1289,7 +1306,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;
@@ -1317,13 +1334,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;
 
 
 
 
 {****************************************************************************
 {****************************************************************************
@@ -1738,10 +1755,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}
 
 
 
 

+ 94 - 89
rtl/inc/text.inc

@@ -114,7 +114,7 @@ begin
     UnicodeString(TextRec(t).FullName):=S;
     UnicodeString(TextRec(t).FullName):=S;
 {$endif USE_FILEREC_FULLNAME}
 {$endif USE_FILEREC_FULLNAME}
 {$endif FPC_ANSI_TEXTFILEREC}
 {$endif FPC_ANSI_TEXTFILEREC}
-  { null terminate, since the name array is regularly used as p(wide)char }
+  { null terminate, since the name array is regularly used as p(wide)AnsiChar }
   TextRec(t).Name[high(TextRec(t).Name)]:=#0;
   TextRec(t).Name[high(TextRec(t).Name)]:=#0;
 end;
 end;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
@@ -138,7 +138,7 @@ Begin
     UnicodeString(TextRec(t).FullName):=S;
     UnicodeString(TextRec(t).FullName):=S;
 {$endif USE_FILEREC_FULLNAME}
 {$endif USE_FILEREC_FULLNAME}
 {$endif FPC_ANSI_TEXTFILEREC}
 {$endif FPC_ANSI_TEXTFILEREC}
-  { null terminate, since the name array is regularly used as p(wide)char }
+  { null terminate, since the name array is regularly used as p(wide)AnsiChar }
   TextRec(t).Name[high(TextRec(t).Name)]:=#0;
   TextRec(t).Name[high(TextRec(t).Name)]:=#0;
 End;
 End;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
@@ -152,7 +152,7 @@ Begin
   InitText(t);
   InitText(t);
   { warning: no encoding support }
   { warning: no encoding support }
   TextRec(t).Name:=s;
   TextRec(t).Name:=s;
-  { null terminate, since the name array is regularly used as p(wide)char }
+  { null terminate, since the name array is regularly used as p(wide)AnsiChar }
   TextRec(t).Name[high(TextRec(t).Name)]:=#0;
   TextRec(t).Name[high(TextRec(t).Name)]:=#0;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 End;
 End;
@@ -389,11 +389,11 @@ Begin
 End;
 End;
 {$else FPC_HAS_FEATURE_ANSISTRINGS}
 {$else FPC_HAS_FEATURE_ANSISTRINGS}
 var
 var
-  p : array[0..255] Of Char;
+  p : array[0..255] Of AnsiChar;
 Begin
 Begin
   Move(s[1],p,Length(s));
   Move(s[1],p,Length(s));
   p[Length(s)]:=#0;
   p[Length(s)]:=#0;
-  Rename(t,Pchar(@p));
+  Rename(t,PAnsiChar(@p));
 End;
 End;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
@@ -591,7 +591,7 @@ Begin
   TextRec(f).BufEnd:=0;
   TextRec(f).BufEnd:=0;
 End;
 End;
 
 
-Procedure SetTextLineEnding(Var f:Text; Ending:string);
+Procedure SetTextLineEnding(Var f:Text; Ending: string);
 Begin
 Begin
   TextRec(F).LineEnd:=Ending;
   TextRec(F).LineEnd:=Ending;
 End;
 End;
@@ -675,7 +675,7 @@ begin
 end;
 end;
 
 
 
 
-Procedure fpc_textinit_filename_iso(var t : Text;nr : DWord;const filename : string);compilerproc;
+Procedure fpc_textinit_filename_iso(var t : Text;nr : DWord;const filename : shortstring);compilerproc;
 begin
 begin
 {$ifdef FPC_HAS_FEATURE_COMMANDARGS}
 {$ifdef FPC_HAS_FEATURE_COMMANDARGS}
   if paramstr(nr)='' then
   if paramstr(nr)='' then
@@ -708,11 +708,11 @@ end;
 
 
 Procedure fpc_WriteBuffer(var f:Text;const b;len:SizeInt);
 Procedure fpc_WriteBuffer(var f:Text;const b;len:SizeInt);
 var
 var
-  p   : pchar;
+  p   : pansichar;
   left,
   left,
   idx : SizeInt;
   idx : SizeInt;
 begin
 begin
-  p:=pchar(@b);
+  p:=pansichar(@b);
   idx:=0;
   idx:=0;
   left:=TextRec(f).BufSize-TextRec(f).BufPos;
   left:=TextRec(f).BufSize-TextRec(f).BufPos;
   while len>left do
   while len>left do
@@ -772,7 +772,7 @@ begin
 end;
 end;
 
 
 
 
-Procedure fpc_Write_Text_ShortStr(Len : Longint;var f : Text;const s : String); iocheck; [Public,Alias:'FPC_WRITE_TEXT_SHORTSTR']; compilerproc;
+Procedure fpc_Write_Text_ShortStr(Len : Longint;var f : Text;const s : ShortString); iocheck; [Public,Alias:'FPC_WRITE_TEXT_SHORTSTR']; compilerproc;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
@@ -789,7 +789,7 @@ Begin
 End;
 End;
 
 
 
 
-Procedure fpc_Write_Text_ShortStr_Iso(Len : Longint;var f : Text;const s : String); iocheck; [Public,Alias:'FPC_WRITE_TEXT_SHORTSTR_ISO']; compilerproc;
+Procedure fpc_Write_Text_ShortStr_Iso(Len : Longint;var f : Text;const s : ShortString); iocheck; [Public,Alias:'FPC_WRITE_TEXT_SHORTSTR_ISO']; compilerproc;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
@@ -815,22 +815,22 @@ End;
 
 
 
 
 { provide local access to write_str }
 { provide local access to write_str }
-procedure Write_Str(Len : Longint;var f : Text;const s : String); iocheck; [external name 'FPC_WRITE_TEXT_SHORTSTR'];
+procedure Write_Str(Len : Longint;var f : Text;const s : ShortString); iocheck; [external name 'FPC_WRITE_TEXT_SHORTSTR'];
 
 
 { provide local access to write_str_iso }
 { provide local access to write_str_iso }
-procedure Write_Str_Iso(Len : Longint;var f : Text;const s : String); iocheck; [external name 'FPC_WRITE_TEXT_SHORTSTR_ISO'];
+procedure Write_Str_Iso(Len : Longint;var f : Text;const s : ShortString); iocheck; [external name 'FPC_WRITE_TEXT_SHORTSTR_ISO'];
 
 
-Procedure fpc_Write_Text_Pchar_as_Array(Len : Longint;var f : Text;const s : array of char; zerobased: boolean = true); iocheck; compilerproc;
+Procedure fpc_Write_Text_Pchar_as_Array(Len : Longint;var f : Text;const s : array of ansichar; zerobased: boolean = true); iocheck; compilerproc;
 var
 var
   ArrayLen : longint;
   ArrayLen : longint;
-  p : pchar;
+  p : pansichar;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
   case TextRec(f).mode of
   case TextRec(f).mode of
     fmOutput { fmAppend gets changed to fmOutPut in do_open (JM) }:
     fmOutput { fmAppend gets changed to fmOutPut in do_open (JM) }:
       begin
       begin
-        p:=pchar(@s);
+        p:=pansichar(@s);
         if zerobased then
         if zerobased then
           begin
           begin
             { can't use StrLen, since that one could try to read past the end }
             { can't use StrLen, since that one could try to read past the end }
@@ -852,17 +852,17 @@ Begin
 End;
 End;
 
 
 
 
-Procedure fpc_Write_Text_Pchar_as_Array_Iso(Len : Longint;var f : Text;const s : array of char; zerobased: boolean = true); iocheck; compilerproc;
+Procedure fpc_Write_Text_Pchar_as_Array_Iso(Len : Longint;var f : Text;const s : array of ansichar; zerobased: boolean = true); iocheck; compilerproc;
 var
 var
   ArrayLen : longint;
   ArrayLen : longint;
-  p : pchar;
+  p : pansichar;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
   case TextRec(f).mode of
   case TextRec(f).mode of
     fmOutput { fmAppend gets changed to fmOutPut in do_open (JM) }:
     fmOutput { fmAppend gets changed to fmOutPut in do_open (JM) }:
       begin
       begin
-        p:=pchar(@s);
+        p:=pansichar(@s);
         if zerobased then
         if zerobased then
           begin
           begin
             { can't use StrLen, since that one could try to read past the end }
             { can't use StrLen, since that one could try to read past the end }
@@ -893,7 +893,7 @@ Begin
 End;
 End;
 
 
 
 
-Procedure fpc_Write_Text_PChar_As_Pointer(Len : Longint;var f : Text;p : PChar); iocheck; compilerproc;
+Procedure fpc_Write_Text_PChar_As_Pointer(Len : Longint;var f : Text;p : PAnsiChar); iocheck; compilerproc;
 var
 var
   PCharLen : longint;
   PCharLen : longint;
 Begin
 Begin
@@ -1013,7 +1013,7 @@ end;
 
 
 Procedure fpc_Write_Text_SInt(Len : Longint;var t : Text;l : ValSInt); iocheck; compilerproc;
 Procedure fpc_Write_Text_SInt(Len : Longint;var t : Text;l : ValSInt); iocheck; compilerproc;
 var
 var
-  s : String;
+  s : ShortString;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
@@ -1024,7 +1024,7 @@ End;
 
 
 Procedure fpc_Write_Text_UInt(Len : Longint;var t : Text;l : ValUInt); iocheck; compilerproc;
 Procedure fpc_Write_Text_UInt(Len : Longint;var t : Text;l : ValUInt); iocheck; compilerproc;
 var
 var
-  s : String;
+  s : ShortString;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
@@ -1035,7 +1035,7 @@ End;
 
 
 Procedure fpc_Write_Text_SInt_Iso(Len : Longint;var t : Text;l : ValSInt); iocheck; compilerproc;
 Procedure fpc_Write_Text_SInt_Iso(Len : Longint;var t : Text;l : ValSInt); iocheck; compilerproc;
 var
 var
-  s : String;
+  s : ShortString;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
@@ -1123,7 +1123,7 @@ end;
 {$if defined(CPU16) or defined(CPU8)}
 {$if defined(CPU16) or defined(CPU8)}
 procedure fpc_write_text_longword(len : longint;var t : text;q : longword); iocheck; compilerproc;
 procedure fpc_write_text_longword(len : longint;var t : text;q : longword); iocheck; compilerproc;
 var
 var
-  s : string;
+  s : shortstring;
 begin
 begin
   if (InOutRes<>0) then
   if (InOutRes<>0) then
    exit;
    exit;
@@ -1134,7 +1134,7 @@ end;
 
 
 procedure fpc_write_text_longint(len : longint;var t : text;i : longint); iocheck; compilerproc;
 procedure fpc_write_text_longint(len : longint;var t : text;i : longint); iocheck; compilerproc;
 var
 var
-  s : string;
+  s : shortstring;
 begin
 begin
   if (InOutRes<>0) then
   if (InOutRes<>0) then
    exit;
    exit;
@@ -1145,7 +1145,7 @@ end;
 
 
 procedure fpc_write_text_longword_iso(len : longint;var t : text;q : longword); iocheck; compilerproc;
 procedure fpc_write_text_longword_iso(len : longint;var t : text;q : longword); iocheck; compilerproc;
 var
 var
-  s : string;
+  s : shortstring;
 begin
 begin
   if (InOutRes<>0) then
   if (InOutRes<>0) then
     exit;
     exit;
@@ -1161,7 +1161,7 @@ end;
 
 
 procedure fpc_write_text_longint_iso(len : longint;var t : text;i : longint); iocheck; compilerproc;
 procedure fpc_write_text_longint_iso(len : longint;var t : text;i : longint); iocheck; compilerproc;
 var
 var
-  s : string;
+  s : shortstring;
 begin
 begin
   if (InOutRes<>0) then
   if (InOutRes<>0) then
    exit;
    exit;
@@ -1177,7 +1177,7 @@ end;
 
 
 procedure fpc_write_text_word(len : longint;var t : text;q : word); iocheck; compilerproc;
 procedure fpc_write_text_word(len : longint;var t : text;q : word); iocheck; compilerproc;
 var
 var
-  s : string;
+  s : shortstring;
 begin
 begin
   if (InOutRes<>0) then
   if (InOutRes<>0) then
    exit;
    exit;
@@ -1188,7 +1188,7 @@ end;
 
 
 procedure fpc_write_text_smallint(len : longint;var t : text;i : smallint); iocheck; compilerproc;
 procedure fpc_write_text_smallint(len : longint;var t : text;i : smallint); iocheck; compilerproc;
 var
 var
-  s : string;
+  s : shortstring;
 begin
 begin
   if (InOutRes<>0) then
   if (InOutRes<>0) then
    exit;
    exit;
@@ -1199,7 +1199,7 @@ end;
 
 
 procedure fpc_write_text_word_iso(len : longint;var t : text;q : word); iocheck; compilerproc;
 procedure fpc_write_text_word_iso(len : longint;var t : text;q : word); iocheck; compilerproc;
 var
 var
-  s : string;
+  s : shortstring;
 begin
 begin
   if (InOutRes<>0) then
   if (InOutRes<>0) then
     exit;
     exit;
@@ -1215,7 +1215,7 @@ end;
 
 
 procedure fpc_write_text_smallint_iso(len : longint;var t : text;i : smallint); iocheck; compilerproc;
 procedure fpc_write_text_smallint_iso(len : longint;var t : text;i : smallint); iocheck; compilerproc;
 var
 var
-  s : string;
+  s : shortstring;
 begin
 begin
   if (InOutRes<>0) then
   if (InOutRes<>0) then
    exit;
    exit;
@@ -1232,7 +1232,7 @@ end;
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
 Procedure fpc_Write_Text_Float(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); iocheck; compilerproc;
 Procedure fpc_Write_Text_Float(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); iocheck; compilerproc;
 var
 var
-  s : String;
+  s : shortString;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
@@ -1243,7 +1243,7 @@ End;
 
 
 Procedure fpc_Write_Text_Float_iso(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); iocheck; compilerproc;
 Procedure fpc_Write_Text_Float_iso(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); iocheck; compilerproc;
 var
 var
-  s : String;
+  s : shortString;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
@@ -1255,7 +1255,7 @@ End;
 procedure fpc_write_text_enum(typinfo,ord2strindex:pointer;len:sizeint;var t:text;ordinal:longint); iocheck; compilerproc;
 procedure fpc_write_text_enum(typinfo,ord2strindex:pointer;len:sizeint;var t:text;ordinal:longint); iocheck; compilerproc;
 
 
 var
 var
-    s:string;
+    s:shortstring;
 
 
 begin
 begin
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 {$ifdef EXCLUDE_COMPLEX_PROCS}
@@ -1283,7 +1283,7 @@ Procedure fpc_Write_Text_Currency(fixkomma,Len : Longint;var t : Text;c : Curren
       end;
       end;
 {$else EXCLUDE_COMPLEX_PROCS}
 {$else EXCLUDE_COMPLEX_PROCS}
 var
 var
-  s : String;
+  s : shortstring;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
    exit;
    exit;
@@ -1319,7 +1319,7 @@ Begin
 End;
 End;
 
 
 
 
-Procedure fpc_Write_Text_Char(Len : Longint;var t : Text;c : Char); iocheck; compilerproc;
+Procedure fpc_Write_Text_Char(Len : Longint;var t : Text;c : AnsiChar); iocheck; compilerproc;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
     exit;
     exit;
@@ -1340,7 +1340,7 @@ Begin
 End;
 End;
 
 
 
 
-Procedure fpc_Write_Text_Char_Iso(Len : Longint;var t : Text;c : Char); iocheck; compilerproc;
+Procedure fpc_Write_Text_Char_Iso(Len : Longint;var t : Text;c : AnsiChar); iocheck; compilerproc;
 Begin
 Begin
   If (InOutRes<>0) then
   If (InOutRes<>0) then
     exit;
     exit;
@@ -1400,7 +1400,7 @@ End;
                                 Read(Ln)
                                 Read(Ln)
 *****************************************************************************}
 *****************************************************************************}
 
 
-Function NextChar(var f:Text;var s:string):Boolean;
+Function NextChar(var f:Text;var s:shortstring):Boolean;
 begin
 begin
   NextChar:=false;
   NextChar:=false;
   if (TextRec(f).BufPos<TextRec(f).BufEnd) then
   if (TextRec(f).BufPos<TextRec(f).BufEnd) then
@@ -1408,7 +1408,7 @@ begin
     begin
     begin
      if length(s)<high(s) then
      if length(s)<high(s) then
       begin
       begin
-        inc(s[0]);
+        SetLength(s,Length(s)+1);
         s[length(s)]:=TextRec(f).BufPtr^[TextRec(f).BufPos];
         s[length(s)]:=TextRec(f).BufPtr^[TextRec(f).BufPos];
       end;
       end;
      Inc(TextRec(f).BufPos);
      Inc(TextRec(f).BufPos);
@@ -1425,7 +1425,7 @@ Function IgnoreSpaces(var f:Text):Boolean;
   the buffer is empty
   the buffer is empty
 }
 }
 var
 var
-  s : string;
+  s : shortstring;
 begin
 begin
   s:='';
   s:='';
   IgnoreSpaces:=false;
   IgnoreSpaces:=false;
@@ -1449,7 +1449,7 @@ begin
 end;
 end;
 
 
 
 
-procedure ReadNumeric(var f:Text;var s:string);
+procedure ReadNumeric(var f:Text;var s:shortstring);
 {
 {
   Read numeric input, if buffer is empty then return True
   Read numeric input, if buffer is empty then return True
 }
 }
@@ -1483,7 +1483,7 @@ begin
 end;
 end;
 
 
 
 
-procedure ReadInteger(var f:Text;var s:string);
+procedure ReadInteger(var f:Text;var s:shortstring);
 {
 {
  Ignore leading blanks (incl. EOF) and return the first characters matching
  Ignore leading blanks (incl. EOF) and return the first characters matching
  an integer in the format recognized by the Val procedure:
  an integer in the format recognized by the Val procedure:
@@ -1541,7 +1541,7 @@ begin
 end;
 end;
 
 
 
 
-procedure ReadReal(var f:Text;var s:string);
+procedure ReadReal(var f:Text;var s:shortstring);
 {
 {
  Ignore leading blanks (incl. EOF) and return the first characters matching
  Ignore leading blanks (incl. EOF) and return the first characters matching
  a float number in the format recognized by the Val procedure:
  a float number in the format recognized by the Val procedure:
@@ -1615,7 +1615,7 @@ end;
 
 
 
 
 Procedure fpc_ReadLn_End(var f : Text);[Public,Alias:'FPC_READLN_END']; iocheck; compilerproc;
 Procedure fpc_ReadLn_End(var f : Text);[Public,Alias:'FPC_READLN_END']; iocheck; compilerproc;
-var prev: char;
+var prev: AnsiChar;
 Begin
 Begin
   If not CheckRead(f) then
   If not CheckRead(f) then
     exit;
     exit;
@@ -1667,7 +1667,7 @@ End;
 
 
 
 
 Procedure fpc_ReadLn_End_Iso(var f : Text);[Public,Alias:'FPC_READLN_END_ISO']; iocheck; compilerproc;
 Procedure fpc_ReadLn_End_Iso(var f : Text);[Public,Alias:'FPC_READLN_END_ISO']; iocheck; compilerproc;
-var prev: char;
+var prev: AnsiChar;
 Begin
 Begin
   If not CheckRead(f) then
   If not CheckRead(f) then
     exit;
     exit;
@@ -1724,10 +1724,10 @@ Begin
 End;
 End;
 
 
 
 
-Function ReadPCharLen(var f:Text;s:pchar;maxlen:longint):longint;
+Function ReadPCharLen(var f:Text;s:pansichar;maxlen:longint):longint;
 var
 var
   sPos,len : Longint;
   sPos,len : Longint;
-  p,startp,maxp : pchar;
+  p,startp,maxp : pansichar;
   end_of_string:boolean;
   end_of_string:boolean;
 Begin
 Begin
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 {$ifdef EXCLUDE_COMPLEX_PROCS}
@@ -1778,23 +1778,28 @@ Begin
 End;
 End;
 
 
 
 
-Procedure fpc_Read_Text_ShortStr(var f : Text;out s : String); iocheck; compilerproc;
+Procedure fpc_Read_Text_ShortStr(var f : Text;out s : ShortString); iocheck; compilerproc;
+
+var
+  Len : Longint;
+
 Begin
 Begin
-  s[0]:=chr(ReadPCharLen(f,pchar(@s[1]),high(s)));
+  Len:=ReadPCharLen(f,pansichar(@s[1]),high(s));
+  SetLength(S,Len);
 End;
 End;
 
 
 
 
-Procedure fpc_Read_Text_PChar_As_Pointer(var f : Text; const s : PChar); iocheck; compilerproc;
+Procedure fpc_Read_Text_PChar_As_Pointer(var f : Text; const s : PAnsiChar); iocheck; compilerproc;
 Begin
 Begin
-  pchar(s+ReadPCharLen(f,s,$7fffffff))^:=#0;
+  pansichar(s+ReadPCharLen(f,s,$7fffffff))^:=#0;
 End;
 End;
 
 
 
 
-Procedure fpc_Read_Text_PChar_As_Array(var f : Text;out s : array of char; zerobased: boolean = false); iocheck; compilerproc;
+Procedure fpc_Read_Text_PChar_As_Array(var f : Text;out s : array of ansichar; zerobased: boolean = false); iocheck; compilerproc;
 var
 var
   len: longint;
   len: longint;
 Begin
 Begin
-  len := ReadPCharLen(f,pchar(@s),high(s)+1);
+  len := ReadPCharLen(f,pansichar(@s),high(s)+1);
   if zerobased and
   if zerobased and
      (len > high(s)) then
      (len > high(s)) then
     len := high(s);
     len := high(s);
@@ -1812,7 +1817,7 @@ Begin
   Repeat
   Repeat
     // SetLength will reallocate the length.
     // SetLength will reallocate the length.
     SetLength(s,slen+255);
     SetLength(s,slen+255);
-    len:=ReadPCharLen(f,pchar(Pointer(s)+slen),255);
+    len:=ReadPCharLen(f,pansichar(Pointer(s)+slen),255);
     inc(slen,len);
     inc(slen,len);
   Until len<255;
   Until len<255;
   // Set actual length
   // Set actual length
@@ -1861,7 +1866,7 @@ Begin
 End;
 End;
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
 
 
-procedure fpc_Read_Text_Char(var f : Text; out c: char); [public, alias: 'FPC_READ_TEXT_CHAR']; iocheck; compilerproc;
+procedure fpc_Read_Text_Char(var f : Text; out c: AnsiChar); [public, alias: 'FPC_READ_TEXT_CHAR']; iocheck; compilerproc;
 Begin
 Begin
   c:=#0;
   c:=#0;
   If not CheckRead(f) then
   If not CheckRead(f) then
@@ -1875,10 +1880,10 @@ Begin
   inc(TextRec(f).BufPos);
   inc(TextRec(f).BufPos);
 end;
 end;
 
 
-procedure fpc_Read_Text_Char_intern(var f : Text; out c: char); iocheck; [external name 'FPC_READ_TEXT_CHAR'];
+procedure fpc_Read_Text_Char_intern(var f : Text; out c: AnsiChar); iocheck; [external name 'FPC_READ_TEXT_CHAR'];
 
 
 
 
-function fpc_GetBuf_Text(var f : Text) : pchar; iocheck; compilerproc;
+function fpc_GetBuf_Text(var f : Text) : pansichar; iocheck; compilerproc;
 Begin
 Begin
   Result:=@TextRec(f).Bufptr^[TextRec(f).BufEnd];
   Result:=@TextRec(f).Bufptr^[TextRec(f).BufEnd];
   if TextRec(f).mode=fmOutput then
   if TextRec(f).mode=fmOutput then
@@ -1897,7 +1902,7 @@ var
   ws: widestring;
   ws: widestring;
   i: longint;
   i: longint;
   { maximum code point length is 6 characters (with UTF-8) }
   { maximum code point length is 6 characters (with UTF-8) }
-  str: array[0..5] of char;
+  str: array[0..5] of AnsiChar;
 Begin
 Begin
   fillchar(str[0],sizeof(str),0);
   fillchar(str[0],sizeof(str),0);
   for i:=low(str) to high(str) do
   for i:=low(str) to high(str) do
@@ -1936,7 +1941,7 @@ end;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 
 
 
 
-procedure fpc_Read_Text_Char_Iso(var f : Text; out c: char); iocheck;compilerproc;
+procedure fpc_Read_Text_Char_Iso(var f : Text; out c: AnsiChar); iocheck;compilerproc;
 Begin
 Begin
   c:=' ';
   c:=' ';
   If not CheckRead(f) then
   If not CheckRead(f) then
@@ -1981,7 +1986,7 @@ end;
 
 
 Procedure fpc_Read_Text_SInt(var f : Text; out l : ValSInt); iocheck; compilerproc;
 Procedure fpc_Read_Text_SInt(var f : Text; out l : ValSInt); iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : ValSInt;
   code : ValSInt;
 Begin
 Begin
   l:=0;
   l:=0;
@@ -2011,7 +2016,7 @@ End;
 
 
 Procedure fpc_Read_Text_SInt_Iso(var f : Text; out l : ValSInt); iocheck; compilerproc;
 Procedure fpc_Read_Text_SInt_Iso(var f : Text; out l : ValSInt); iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : ValSInt;
   code : ValSInt;
 Begin
 Begin
   l:=0;
   l:=0;
@@ -2028,7 +2033,7 @@ End;
 
 
 Procedure fpc_Read_Text_UInt(var f : Text; out u : ValUInt);  iocheck; compilerproc;
 Procedure fpc_Read_Text_UInt(var f : Text; out u : ValUInt);  iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : ValSInt;
   code : ValSInt;
 Begin
 Begin
   u:=0;
   u:=0;
@@ -2055,7 +2060,7 @@ End;
 
 
 Procedure fpc_Read_Text_UInt_Iso(var f : Text; out u : ValUInt);  iocheck; compilerproc;
 Procedure fpc_Read_Text_UInt_Iso(var f : Text; out u : ValUInt);  iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : ValSInt;
   code : ValSInt;
 Begin
 Begin
   u:=0;
   u:=0;
@@ -2072,7 +2077,7 @@ End;
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
 procedure fpc_Read_Text_Float(var f : Text; out v : ValReal); iocheck; compilerproc;
 procedure fpc_Read_Text_Float(var f : Text; out v : ValReal); iocheck; compilerproc;
 var
 var
-  hs : string;
+  hs : shortstring;
   code : Word;
   code : Word;
 begin
 begin
   v:=0.0;
   v:=0.0;
@@ -2095,7 +2100,7 @@ end;
 
 
 procedure fpc_Read_Text_Float_Iso(var f : Text; out v : ValReal); iocheck; compilerproc;
 procedure fpc_Read_Text_Float_Iso(var f : Text; out v : ValReal); iocheck; compilerproc;
 var
 var
-  hs : string;
+  hs : shortstring;
   code : Word;
   code : Word;
 begin
 begin
   v:=0.0;
   v:=0.0;
@@ -2115,7 +2120,7 @@ procedure fpc_read_text_enum(str2ordindex:pointer;var t:text;out ordinal:longint
 procedure fpc_read_text_enum_longint(str2ordindex:pointer;var t:text;out ordinal:longint); iocheck;compilerproc;
 procedure fpc_read_text_enum_longint(str2ordindex:pointer;var t:text;out ordinal:longint); iocheck;compilerproc;
 {$endif VER3_2}
 {$endif VER3_2}
 
 
-var s:string;
+var s:shortstring;
     code:valsint;
     code:valsint;
 
 
 begin
 begin
@@ -2137,7 +2142,7 @@ end;
 {$ifndef VER3_2}
 {$ifndef VER3_2}
 procedure fpc_read_text_enum_smallint(str2ordindex:pointer;var t:text;out ordinal:smallint); iocheck;compilerproc;
 procedure fpc_read_text_enum_smallint(str2ordindex:pointer;var t:text;out ordinal:smallint); iocheck;compilerproc;
 
 
-var s:string;
+var s:shortstring;
     code:valsint;
     code:valsint;
 
 
 begin
 begin
@@ -2158,7 +2163,7 @@ end;
 
 
 procedure fpc_read_text_enum_shortint(str2ordindex:pointer;var t:text;out ordinal:shortint); iocheck;compilerproc;
 procedure fpc_read_text_enum_shortint(str2ordindex:pointer;var t:text;out ordinal:shortint); iocheck;compilerproc;
 
 
-var s:string;
+var s:shortstring;
     code:valsint;
     code:valsint;
 
 
 begin
 begin
@@ -2180,7 +2185,7 @@ end;
 
 
 procedure fpc_Read_Text_Currency(var f : Text; out v : Currency); iocheck; compilerproc;
 procedure fpc_Read_Text_Currency(var f : Text; out v : Currency); iocheck; compilerproc;
 var
 var
-  hs : string;
+  hs : shortstring;
   code : ValSInt;
   code : ValSInt;
 begin
 begin
 {$ifdef FPUNONE}
 {$ifdef FPUNONE}
@@ -2207,7 +2212,7 @@ end;
 
 
 procedure fpc_Read_Text_Currency_Iso(var f : Text; out v : Currency); iocheck; compilerproc;
 procedure fpc_Read_Text_Currency_Iso(var f : Text; out v : Currency); iocheck; compilerproc;
 var
 var
-  hs : string;
+  hs : shortstring;
   code : ValSInt;
   code : ValSInt;
 begin
 begin
   v:=0;
   v:=0;
@@ -2225,7 +2230,7 @@ end;
 
 
 procedure fpc_Read_Text_QWord(var f : text; out q : qword); iocheck; compilerproc;
 procedure fpc_Read_Text_QWord(var f : text; out q : qword); iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : longint;
   code : longint;
 Begin
 Begin
   q:=0;
   q:=0;
@@ -2247,7 +2252,7 @@ End;
 
 
 procedure fpc_Read_Text_QWord_Iso(var f : text; out q : qword); iocheck; compilerproc;
 procedure fpc_Read_Text_QWord_Iso(var f : text; out q : qword); iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : longint;
   code : longint;
 Begin
 Begin
   q:=0;
   q:=0;
@@ -2262,7 +2267,7 @@ End;
 
 
 procedure fpc_Read_Text_Int64(var f : text; out i : int64); iocheck; compilerproc;
 procedure fpc_Read_Text_Int64(var f : text; out i : int64); iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : Longint;
   code : Longint;
 Begin
 Begin
   i:=0;
   i:=0;
@@ -2284,7 +2289,7 @@ End;
 
 
 procedure fpc_Read_Text_Int64_Iso(var f : text; out i : int64); iocheck; compilerproc;
 procedure fpc_Read_Text_Int64_Iso(var f : text; out i : int64); iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : Longint;
   code : Longint;
 Begin
 Begin
   i:=0;
   i:=0;
@@ -2303,7 +2308,7 @@ End;
 {$if defined(CPU16) or defined(CPU8)}
 {$if defined(CPU16) or defined(CPU8)}
 procedure fpc_Read_Text_LongWord(var f : text; out q : longword); iocheck; compilerproc;
 procedure fpc_Read_Text_LongWord(var f : text; out q : longword); iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : longint;
   code : longint;
 Begin
 Begin
   q:=0;
   q:=0;
@@ -2325,7 +2330,7 @@ End;
 
 
 procedure fpc_Read_Text_LongInt(var f : text; out i : longint); iocheck; compilerproc;
 procedure fpc_Read_Text_LongInt(var f : text; out i : longint); iocheck; compilerproc;
 var
 var
-  hs   : String;
+  hs   : shortstring;
   code : Longint;
   code : Longint;
 Begin
 Begin
   i:=0;
   i:=0;
@@ -2353,13 +2358,13 @@ End;
 *****************************************************************************}
 *****************************************************************************}
 
 
 const
 const
-  { pointer to target string }
+  { pointer to target shortstring }
   StrPtrIndex = 1;
   StrPtrIndex = 1;
   { temporary destination for writerstr, because the original value of the
   { temporary destination for writerstr, because the original value of the
     destination may be used in the writestr expression }
     destination may be used in the writestr expression }
   TempWriteStrDestIndex = 9;
   TempWriteStrDestIndex = 9;
   ShortStrLenIndex = 17;
   ShortStrLenIndex = 17;
-  { how many bytes of the string have been processed already (used for readstr) }
+  { how many bytes of the shortstring have been processed already (used for readstr) }
   BytesReadIndex = 17;
   BytesReadIndex = 17;
 
 
 procedure WriteStrShort(var t: textrec);
 procedure WriteStrShort(var t: textrec);
@@ -2379,7 +2384,7 @@ begin
 {$ifdef writestr_iolencheck}
 {$ifdef writestr_iolencheck}
       // GPC only gives an io error if {$no-truncate-strings} is active
       // GPC only gives an io error if {$no-truncate-strings} is active
       // FPC does not have this setting (it never gives errors when a
       // FPC does not have this setting (it never gives errors when a
-      // a string expression is truncated)
+      // a shortstring expression is truncated)
 
 
       { "disk full" }
       { "disk full" }
       inoutres:=101;
       inoutres:=101;
@@ -2393,12 +2398,12 @@ end;
 
 
 procedure WriteStrShortFlush(var t: textrec);
 procedure WriteStrShortFlush(var t: textrec);
 begin
 begin
-  { move written data from internal buffer to temporary string (don't move
-    directly from buffer to final string, because the temporary string may
-    already contain data in case the textbuf was smaller than the string
+  { move written data from internal buffer to temporary shortstring (don't move
+    directly from buffer to final shortstring, because the temporary shortstring may
+    already contain data in case the textbuf was smaller than the shortstring
     length) }
     length) }
   WriteStrShort(t);
   WriteStrShort(t);
-  { move written data to original string }
+  { move written data to original shortstring }
   move(PPointer(@t.userdata[TempWriteStrDestIndex])^^,
   move(PPointer(@t.userdata[TempWriteStrDestIndex])^^,
        PPointer(@t.userdata[StrPtrIndex])^^,
        PPointer(@t.userdata[StrPtrIndex])^^,
        t.userdata[ShortStrLenIndex]+1);
        t.userdata[ShortStrLenIndex]+1);
@@ -2446,7 +2451,7 @@ begin
       { we don't care about combining diacritical marks here: we just want a
       { we don't care about combining diacritical marks here: we just want a
         valid UTF-8 codepoint that we can translate to UTF-16. The combining
         valid UTF-8 codepoint that we can translate to UTF-16. The combining
         diacritical marks can be translated separately }
         diacritical marks can be translated separately }
-      codepointlen:=Utf8CodePointLen(pchar(@t.bufptr^[i]),(t.bufpos-1-i)+1,false);
+      codepointlen:=Utf8CodePointLen(pansichar(@t.bufptr^[i]),(t.bufpos-1-i)+1,false);
       { complete codepoint -> flush till here }
       { complete codepoint -> flush till here }
       if codepointlen>0 then
       if codepointlen>0 then
         begin
         begin
@@ -2577,7 +2582,7 @@ begin
   SetupWriteStrCommon(TextRec(ReadWriteStrText),cp);
   SetupWriteStrCommon(TextRec(ReadWriteStrText),cp);
   PPointer(@TextRec(ReadWriteStrText).userdata[StrPtrIndex])^:=@s;
   PPointer(@TextRec(ReadWriteStrText).userdata[StrPtrIndex])^:=@s;
 
 
-  { temp destination ansistring, nil = empty string }
+  { temp destination ansistring, nil = empty shortstring }
   PPointer(@TextRec(ReadWriteStrText).userdata[TempWriteStrDestIndex])^:=nil;
   PPointer(@TextRec(ReadWriteStrText).userdata[TempWriteStrDestIndex])^:=nil;
 
 
   TextRec(ReadWriteStrText).InOutFunc:=@WriteStrAnsi;
   TextRec(ReadWriteStrText).InOutFunc:=@WriteStrAnsi;
@@ -2592,7 +2597,7 @@ begin
   SetupWriteStrCommon(TextRec(ReadWriteStrText),CP_UTF8);
   SetupWriteStrCommon(TextRec(ReadWriteStrText),CP_UTF8);
   PPointer(@TextRec(ReadWriteStrText).userdata[StrPtrIndex])^:=@s;
   PPointer(@TextRec(ReadWriteStrText).userdata[StrPtrIndex])^:=@s;
 
 
-  { temp destination unicodestring, nil = empty string }
+  { temp destination unicodestring, nil = empty shortstring }
   PPointer(@TextRec(ReadWriteStrText).userdata[TempWriteStrDestIndex])^:=nil;
   PPointer(@TextRec(ReadWriteStrText).userdata[TempWriteStrDestIndex])^:=nil;
 
 
   TextRec(ReadWriteStrText).InOutFunc:=@WriteStrUnicode;
   TextRec(ReadWriteStrText).InOutFunc:=@WriteStrUnicode;
@@ -2625,7 +2630,7 @@ end;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
 
 
 
-procedure ReadStrCommon(var t: textrec; strdata: pchar; len: sizeint);
+procedure ReadStrCommon(var t: textrec; strdata: pansichar; len: sizeint);
 var
 var
   newbytes: sizeint;
   newbytes: sizeint;
 begin
 begin
@@ -2688,8 +2693,8 @@ begin
     *********************
     *********************
     Apart from the restrictions imposed by requirements given in this clause,
     Apart from the restrictions imposed by requirements given in this clause,
     the execution of readstr(e,v 1 ,...,v n ) where e denotes a
     the execution of readstr(e,v 1 ,...,v n ) where e denotes a
-    string-expression and v 1 ,...,v n denote variable-accesses possessing the
-    char-type (or a subrange of char-type), the integer-type (or a subrange of
+    shortstring-expression and v 1 ,...,v n denote variable-accesses possessing the
+    AnsiChar-type (or a subrange of AnsiChar-type), the integer-type (or a subrange of
     integer-type), the real-type, a fixed-string-type, or a
     integer-type), the real-type, a fixed-string-type, or a
     variable-string-type, shall be equivalent to
     variable-string-type, shall be equivalent to
 
 

+ 3 - 3
rtl/inc/threadvr.inc

@@ -44,7 +44,7 @@ begin
   while tableEntry^.varaddr <> nil do
   while tableEntry^.varaddr <> nil do
    begin
    begin
      CurrentTM.InitThreadvar (tableEntry^.varaddr^, tableEntry^.size);
      CurrentTM.InitThreadvar (tableEntry^.varaddr^, tableEntry^.size);
-     inc (pchar (tableEntry), sizeof (tableEntry^));
+     inc (pansichar (tableEntry), sizeof (tableEntry^));
    end;
    end;
 end;
 end;
 
 
@@ -76,9 +76,9 @@ begin
   while tableEntry^.varaddr <> nil do
   while tableEntry^.varaddr <> nil do
    begin
    begin
      newp:=CurrentTM.RelocateThreadVar(tableEntry^.varaddr^);
      newp:=CurrentTM.RelocateThreadVar(tableEntry^.varaddr^);
-     oldp:=pointer(pchar(tableEntry^.varaddr)+sizeof(pointer));
+     oldp:=pointer(pansichar(tableEntry^.varaddr)+sizeof(pointer));
      move(oldp^,newp^,tableEntry^.size);
      move(oldp^,newp^,tableEntry^.size);
-     inc (pchar (tableEntry), sizeof (tableEntry^));
+     inc (pansichar (tableEntry), sizeof (tableEntry^));
    end;
    end;
 end;
 end;
 
 

+ 18 - 18
rtl/inc/ustringh.inc

@@ -17,7 +17,7 @@
 
 
 Procedure UniqueString (Var S : UnicodeString);{$ifdef SYSTEMINLINE}inline;{$endif}
 Procedure UniqueString (Var S : UnicodeString);{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString; Offset: Sizeint = 1) : SizeInt;
 Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString; Offset: Sizeint = 1) : SizeInt;
-Function Pos (c : Char; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
+Function Pos (c : AnsiChar; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
 Function Pos (c : UnicodeChar; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
 Function Pos (c : UnicodeChar; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
 Function Pos (const c : RawByteString; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
 Function Pos (const c : RawByteString; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
 Function Pos (const c : UnicodeString; Const s : RawByteString; Offset: Sizeint = 1) : SizeInt;
 Function Pos (const c : UnicodeString; Const s : RawByteString; Offset: Sizeint = 1) : SizeInt;
@@ -33,7 +33,7 @@ Procedure Insert (Const Source : UnicodeString; Var S : UnicodeString; Index : S
 Procedure Delete (Var S : UnicodeString; Index,Size: SizeInt);
 Procedure Delete (Var S : UnicodeString; Index,Size: SizeInt);
 {$endif VER3_0}
 {$endif VER3_0}
 Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pwidechar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
 Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pwidechar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pansichar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pansichar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
 
 
 function WideCharToString(S : PWideChar) : UnicodeString;
 function WideCharToString(S : PWideChar) : UnicodeString;
 function StringToWideChar(const Src : RawByteString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
 function StringToWideChar(const Src : RawByteString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
@@ -51,7 +51,7 @@ procedure UnicodeCharLenToStrVar(Src : PUnicodeChar;Len : SizeInt;out Dest : Ans
 procedure UnicodeCharToStrVar(S : PUnicodeChar;out Dest : AnsiString);
 procedure UnicodeCharToStrVar(S : PUnicodeChar;out Dest : AnsiString);
 
 
 procedure DefaultUnicode2AnsiMove(source:punicodechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt);
 procedure DefaultUnicode2AnsiMove(source:punicodechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt);
-procedure DefaultAnsi2UnicodeMove(source:pchar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);
+procedure DefaultAnsi2UnicodeMove(source:pansichar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);
 
 
 Type
 Type
   { please only enable options below after creating a test program for them that
   { please only enable options below after creating a test program for them that
@@ -73,7 +73,7 @@ Type
     please add new procedures at the end, it makes it easier to detect new procedures }
     please add new procedures at the end, it makes it easier to detect new procedures }
   TUnicodeStringManager = record
   TUnicodeStringManager = record
     Wide2AnsiMoveProc : procedure(source:pwidechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt);
     Wide2AnsiMoveProc : procedure(source:pwidechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt);
-    Ansi2WideMoveProc : procedure(source:pchar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
+    Ansi2WideMoveProc : procedure(source:pansichar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
 
 
 //    UpperUTF8 : procedure(p:PUTF8String);
 //    UpperUTF8 : procedure(p:PUTF8String);
 
 
@@ -94,29 +94,29 @@ Type
       code point is encountered, all characters part of this invalid code point
       code point is encountered, all characters part of this invalid code point
       are considered to form one "character" and the next character is
       are considered to form one "character" and the next character is
       considered to be the start of a new (possibly also invalid) code point }
       considered to be the start of a new (possibly also invalid) code point }
-    CharLengthPCharProc : function(const Str: PChar): PtrInt;
+    CharLengthPCharProc : function(const Str: PAnsiChar): PtrInt;
     { 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,
       > 0 if that's the length in bytes of the code point }
       > 0 if that's the length in bytes of the code point }
-    CodePointLengthProc : function(const Str: PChar; MaxLookAead: PtrInt): Ptrint;
+    CodePointLengthProc : function(const Str: PAnsiChar; MaxLookAead: PtrInt): Ptrint;
 
 
     UpperAnsiStringProc : function(const s : ansistring) : ansistring;
     UpperAnsiStringProc : function(const s : ansistring) : ansistring;
     LowerAnsiStringProc : function(const s : ansistring) : ansistring;
     LowerAnsiStringProc : function(const s : ansistring) : ansistring;
     CompareStrAnsiStringProc : function(const S1, S2: ansistring): PtrInt;
     CompareStrAnsiStringProc : function(const S1, S2: ansistring): PtrInt;
     CompareTextAnsiStringProc : function(const S1, S2: ansistring): PtrInt;
     CompareTextAnsiStringProc : function(const S1, S2: ansistring): PtrInt;
-    StrCompAnsiStringProc : function(S1, S2: PChar): PtrInt;
-    StrICompAnsiStringProc : function(S1, S2: PChar): PtrInt;
-    StrLCompAnsiStringProc : function(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
-    StrLICompAnsiStringProc : function(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
-    StrLowerAnsiStringProc : function(Str: PChar): PChar;
-    StrUpperAnsiStringProc : function(Str: PChar): PChar;
+    StrCompAnsiStringProc : function(S1, S2: PAnsiChar): PtrInt;
+    StrICompAnsiStringProc : function(S1, S2: PAnsiChar): PtrInt;
+    StrLCompAnsiStringProc : function(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
+    StrLICompAnsiStringProc : function(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
+    StrLowerAnsiStringProc : function(Str: PAnsiChar): PAnsiChar;
+    StrUpperAnsiStringProc : function(Str: PAnsiChar): PAnsiChar;
     ThreadInitProc : procedure;
     ThreadInitProc : procedure;
     ThreadFiniProc : procedure;
     ThreadFiniProc : procedure;
 
 
     { this is only different on windows }
     { this is only different on windows }
     Unicode2AnsiMoveProc : procedure(source:punicodechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt);
     Unicode2AnsiMoveProc : procedure(source:punicodechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt);
-    Ansi2UnicodeMoveProc : procedure(source:pchar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);
+    Ansi2UnicodeMoveProc : procedure(source:pansichar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);
     UpperUnicodeStringProc : function(const S: UnicodeString): UnicodeString;
     UpperUnicodeStringProc : function(const S: UnicodeString): UnicodeString;
     LowerUnicodeStringProc : function(const S: UnicodeString): UnicodeString;
     LowerUnicodeStringProc : function(const S: UnicodeString): UnicodeString;
     CompareUnicodeStringProc : function(const s1, s2 : UnicodeString; Options : TCompareOptions) : PtrInt;
     CompareUnicodeStringProc : function(const s1, s2 : UnicodeString; Options : TCompareOptions) : PtrInt;
@@ -131,11 +131,11 @@ Type
 var
 var
   widestringmanager : TUnicodeStringManager;
   widestringmanager : TUnicodeStringManager;
 
 
-function UnicodeToUtf8(Dest: PChar; Source: PUnicodeChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PUnicodeChar; SourceChars: SizeUInt): SizeUInt;
-function Utf8ToUnicode(Dest: PUnicodeChar; Source: PChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-function Utf8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt): SizeUInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-function Utf8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt; IgnoreInvalid : Boolean): SizeUInt;
+function UnicodeToUtf8(Dest: PAnsiChar; Source: PUnicodeChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+function UnicodeToUtf8(Dest: PAnsiChar; MaxDestBytes: SizeUInt; Source: PUnicodeChar; SourceChars: SizeUInt): SizeUInt;
+function Utf8ToUnicode(Dest: PUnicodeChar; Source: PAnsiChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+function Utf8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PAnsiChar; SourceBytes: SizeUInt): SizeUInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+function Utf8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PAnsiChar; SourceBytes: SizeUInt; IgnoreInvalid : Boolean): SizeUInt;
 function UTF8Encode(const s : RawByteString) : RawByteString; inline;
 function UTF8Encode(const s : RawByteString) : RawByteString; inline;
 function UTF8Encode(const s : UnicodeString) : RawByteString;
 function UTF8Encode(const s : UnicodeString) : RawByteString;
 function UTF8Decode(const s : RawByteString): UnicodeString;
 function UTF8Decode(const s : RawByteString): UnicodeString;

+ 45 - 45
rtl/inc/ustrings.inc

@@ -60,7 +60,7 @@ Const
 {$endif FPC_UNICODESTRING_TYPE_DEFINED}
 {$endif FPC_UNICODESTRING_TYPE_DEFINED}
 
 
 {
 {
-  Default UnicodeChar <-> Char conversion is to only convert the
+  Default UnicodeChar <-> AnsiChar conversion is to only convert the
   lower 127 chars, all others are translated to '?'.
   lower 127 chars, all others are translated to '?'.
 
 
   These routines can be overridden for the Current Locale
   These routines can be overridden for the Current Locale
@@ -81,7 +81,7 @@ begin
   for i:=1 to len do
   for i:=1 to len do
     begin
     begin
       if word(source^)<256 then
       if word(source^)<256 then
-        p^:=char(word(source^))
+        p^:=AnsiChar(word(source^))
       else
       else
         p^:='?';
         p^:='?';
       inc(source);
       inc(source);
@@ -93,7 +93,7 @@ end;
 
 
 {$ifndef FPC_HAS_DEFAULT_ANSI_2_UNICODE}
 {$ifndef FPC_HAS_DEFAULT_ANSI_2_UNICODE}
 {$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
   i : SizeInt;
   i : SizeInt;
   p : PUnicodeChar;
   p : PUnicodeChar;
@@ -111,13 +111,13 @@ end;
 
 
 
 
 {$ifndef FPC_HAS_BUILTIN_WIDESTR_MANAGER}
 {$ifndef FPC_HAS_BUILTIN_WIDESTR_MANAGER}
-function DefaultCharLengthPChar(const Str: PChar): PtrInt;
+function DefaultCharLengthPChar(const Str: PAnsiChar): PtrInt;
   begin
   begin
     DefaultCharLengthPChar:=length(Str);
     DefaultCharLengthPChar:=length(Str);
   end;
   end;
 
 
 
 
-function DefaultCodePointLength(const Str: PChar; MaxLookAead: PtrInt): Ptrint;
+function DefaultCodePointLength(const Str: PAnsiChar; MaxLookAead: PtrInt): Ptrint;
   begin
   begin
     if str[0]<>#0 then
     if str[0]<>#0 then
       DefaultCodePointLength:=1
       DefaultCodePointLength:=1
@@ -294,7 +294,7 @@ begin
   result:='';
   result:='';
   Size:=Length(S2);
   Size:=Length(S2);
   if Size>0 then
   if Size>0 then
-    widestringmanager.Ansi2UnicodeMoveProc(PChar(@S2[1]),DefaultSystemCodePage,result,Size);
+    widestringmanager.Ansi2UnicodeMoveProc(PAnsiChar(@S2[1]),DefaultSystemCodePage,result,Size);
 end;
 end;
 {$endif FPC_HAS_SHORTSTR_TO_UNICODESTR}
 {$endif FPC_HAS_SHORTSTR_TO_UNICODESTR}
 
 
@@ -340,7 +340,7 @@ begin
   if Size>0 then
   if Size>0 then
   begin
   begin
     cp:=TranslatePlaceholderCP(StringCodePage(S2));
     cp:=TranslatePlaceholderCP(StringCodePage(S2));
-    widestringmanager.Ansi2UnicodeMoveProc(PChar(S2),cp,result,Size);
+    widestringmanager.Ansi2UnicodeMoveProc(PAnsiChar(S2),cp,result,Size);
   end;
   end;
 end;
 end;
 {$endif FPC_HAS_ANSISTR_TO_UNICODESTR}
 {$endif FPC_HAS_ANSISTR_TO_UNICODESTR}
@@ -565,7 +565,7 @@ end;
 
 
 {$ifndef FPC_HAS_CHAR_TO_UCHAR}
 {$ifndef FPC_HAS_CHAR_TO_UCHAR}
 {$define FPC_HAS_CHAR_TO_UCHAR}
 {$define FPC_HAS_CHAR_TO_UCHAR}
-Function fpc_Char_To_UChar(const c : Char): UnicodeChar; compilerproc;
+Function fpc_Char_To_UChar(const c : AnsiChar): UnicodeChar; compilerproc;
 var
 var
   w: unicodestring;
   w: unicodestring;
 begin
 begin
@@ -577,9 +577,9 @@ end;
 
 
 {$ifndef FPC_HAS_CHAR_TO_UNICODESTR}
 {$ifndef FPC_HAS_CHAR_TO_UNICODESTR}
 {$define FPC_HAS_CHAR_TO_UNICODESTR}
 {$define FPC_HAS_CHAR_TO_UNICODESTR}
-Function fpc_Char_To_UnicodeStr(const c : Char): UnicodeString; compilerproc;
+Function fpc_Char_To_UnicodeStr(const c : AnsiChar): UnicodeString; compilerproc;
 {
 {
-  Converts a Char to a UnicodeString;
+  Converts a AnsiChar to a UnicodeString;
 }
 }
 begin
 begin
   widestringmanager.Ansi2UnicodeMoveProc(@c,DefaultSystemCodePage,result,1);
   widestringmanager.Ansi2UnicodeMoveProc(@c,DefaultSystemCodePage,result,1);
@@ -589,9 +589,9 @@ end;
 
 
 {$ifndef FPC_HAS_UCHAR_TO_CHAR}
 {$ifndef FPC_HAS_UCHAR_TO_CHAR}
 {$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
   s: ansistring;
   s: ansistring;
@@ -655,7 +655,7 @@ end;
 
 
 {$ifndef FPC_HAS_PCHAR_TO_UNICODESTR}
 {$ifndef FPC_HAS_PCHAR_TO_UNICODESTR}
 {$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
   L : SizeInt;
   L : SizeInt;
 begin
 begin
@@ -672,7 +672,7 @@ end;
 
 
 {$ifndef FPC_HAS_CHARARRAY_TO_UNICODESTR}
 {$ifndef FPC_HAS_CHARARRAY_TO_UNICODESTR}
 {$define FPC_HAS_CHARARRAY_TO_UNICODESTR}
 {$define FPC_HAS_CHARARRAY_TO_UNICODESTR}
-Function fpc_CharArray_To_UnicodeStr(const arr: array of char; zerobased: boolean = true): UnicodeString; compilerproc;
+Function fpc_CharArray_To_UnicodeStr(const arr: array of ansichar; zerobased: boolean = true): UnicodeString; compilerproc;
 var
 var
   i  : SizeInt;
   i  : SizeInt;
 begin
 begin
@@ -689,7 +689,7 @@ begin
     end
     end
   else
   else
     i:=high(arr)+1;
     i:=high(arr)+1;
-  widestringmanager.Ansi2UnicodeMoveProc(pchar(@arr),DefaultSystemCodePage,fpc_CharArray_To_UnicodeStr,i);
+  widestringmanager.Ansi2UnicodeMoveProc(pansichar(@arr),DefaultSystemCodePage,fpc_CharArray_To_UnicodeStr,i);
 end;
 end;
 {$endif FPC_HAS_CHARARRAY_TO_UNICODESTR}
 {$endif FPC_HAS_CHARARRAY_TO_UNICODESTR}
 
 
@@ -799,7 +799,7 @@ end;
 
 
 {$ifndef FPC_HAS_UNICODESTR_TO_CHARARRAY}
 {$ifndef FPC_HAS_UNICODESTR_TO_CHARARRAY}
 {$define FPC_HAS_UNICODESTR_TO_CHARARRAY}
 {$define FPC_HAS_UNICODESTR_TO_CHARARRAY}
-procedure fpc_unicodestr_to_chararray(out res: array of char; const src: UnicodeString); compilerproc;
+procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: UnicodeString); compilerproc;
 var
 var
   len: SizeInt;
   len: SizeInt;
   temp: ansistring;
   temp: ansistring;
@@ -830,7 +830,7 @@ begin
   len := length(src);
   len := length(src);
   { make sure we don't dereference src if it can be nil (JM) }
   { make sure we don't dereference src if it can be nil (JM) }
   if len > 0 then
   if len > 0 then
-    widestringmanager.ansi2widemoveproc(pchar(@src[1]),TranslatePlaceholderCP(StringCodePage(src)),temp,len);
+    widestringmanager.ansi2widemoveproc(pansichar(@src[1]),TranslatePlaceholderCP(StringCodePage(src)),temp,len);
   len := length(temp);
   len := length(temp);
   if len > length(res) then
   if len > length(res) then
     len := length(res);
     len := length(res);
@@ -851,9 +851,9 @@ var
   temp : widestring;
   temp : widestring;
 begin
 begin
   len := length(src);
   len := length(src);
-  { make sure we don't access char 1 if length is 0 (JM) }
+  { make sure we don't access AnsiChar 1 if length is 0 (JM) }
   if len > 0 then
   if len > 0 then
-    widestringmanager.ansi2widemoveproc(pchar(@src[1]),DefaultSystemCodePage,temp,len);
+    widestringmanager.ansi2widemoveproc(pansichar(@src[1]),DefaultSystemCodePage,temp,len);
   len := length(temp);
   len := length(temp);
   if len > length(res) then
   if len > length(res) then
     len := length(res);
     len := length(res);
@@ -1045,7 +1045,7 @@ function StringToWideChar(const Src : RawByteString;Dest : PWideChar;DestSize :
     temp: widestring;
     temp: widestring;
     Len: SizeInt;
     Len: SizeInt;
   begin
   begin
-     widestringmanager.Ansi2WideMoveProc(PChar(Src),StringCodePage(Src),temp,Length(Src));
+     widestringmanager.Ansi2WideMoveProc(PAnsiChar(Src),StringCodePage(Src),temp,Length(Src));
      Len:=Length(temp);
      Len:=Length(temp);
      if DestSize<=Len then
      if DestSize<=Len then
        Len:=Destsize-1;
        Len:=Destsize-1;
@@ -1259,11 +1259,11 @@ end;
 
 
 {$ifndef FPC_HAS_POS_CHAR_UNICODESTR}
 {$ifndef FPC_HAS_POS_CHAR_UNICODESTR}
 {$define FPC_HAS_POS_CHAR_UNICODESTR}
 {$define FPC_HAS_POS_CHAR_UNICODESTR}
-{ 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 : Char; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
+Function Pos (c : AnsiChar; Const s : UnicodeString; Offset: Sizeint = 1) : SizeInt;
 var
 var
   ns,idx: SizeInt;
   ns,idx: SizeInt;
 begin
 begin
@@ -1378,7 +1378,7 @@ end;
 
 
 {$ifndef FPC_HAS_SETSTRING_UNICODESTR_PCHAR}
 {$ifndef FPC_HAS_SETSTRING_UNICODESTR_PCHAR}
 {$define FPC_HAS_SETSTRING_UNICODESTR_PCHAR}
 {$define FPC_HAS_SETSTRING_UNICODESTR_PCHAR}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pansichar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_unicodestr_pansichar{$else}SetString{$endif}(Out S : UnicodeString; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
 begin
 begin
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
     widestringmanager.Ansi2UnicodeMoveProc(Buf,DefaultSystemCodePage,S,Len)
     widestringmanager.Ansi2UnicodeMoveProc(Buf,DefaultSystemCodePage,S,Len)
@@ -1681,7 +1681,7 @@ end;
 {$endif CPU16 or CPU8}
 {$endif CPU16 or CPU8}
 
 
 
 
-function UnicodeToUtf8(Dest: PChar; Source: PUnicodeChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+function UnicodeToUtf8(Dest: PAnsiChar; Source: PUnicodeChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
     if assigned(Source) then
     if assigned(Source) then
       Result:=UnicodeToUtf8(Dest,MaxBytes,Source,Length(Source))
       Result:=UnicodeToUtf8(Dest,MaxBytes,Source,Length(Source))
@@ -1690,7 +1690,7 @@ function UnicodeToUtf8(Dest: PChar; Source: PUnicodeChar; MaxBytes: SizeInt): Si
   end;
   end;
 
 
 
 
-function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PUnicodeChar; SourceChars: SizeUInt): SizeUInt;
+function UnicodeToUtf8(Dest: PAnsiChar; MaxDestBytes: SizeUInt; Source: PUnicodeChar; SourceChars: SizeUInt): SizeUInt;
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 begin
 begin
   runerror(217);
   runerror(217);
@@ -1713,24 +1713,24 @@ end;
             case lw of
             case lw of
               0..$7f:
               0..$7f:
                 begin
                 begin
-                  Dest[j]:=char(lw);
+                  Dest[j]:=AnsiChar(lw);
                   inc(j);
                   inc(j);
                 end;
                 end;
               $80..$7ff:
               $80..$7ff:
                 begin
                 begin
                   if j+1>=MaxDestBytes then
                   if j+1>=MaxDestBytes then
                     break;
                     break;
-                  Dest[j]:=char($c0 or (lw shr 6));
-                  Dest[j+1]:=char($80 or (lw and $3f));
+                  Dest[j]:=AnsiChar($c0 or (lw shr 6));
+                  Dest[j+1]:=AnsiChar($80 or (lw and $3f));
                   inc(j,2);
                   inc(j,2);
                 end;
                 end;
               $800..$d7ff,$e000..$ffff:
               $800..$d7ff,$e000..$ffff:
                 begin
                 begin
                   if j+2>=MaxDestBytes then
                   if j+2>=MaxDestBytes then
                     break;
                     break;
-                  Dest[j]:=char($e0 or (lw shr 12));
-                  Dest[j+1]:=char($80 or ((lw shr 6) and $3f));
-                  Dest[j+2]:=char($80 or (lw and $3f));
+                  Dest[j]:=AnsiChar($e0 or (lw shr 12));
+                  Dest[j+1]:=AnsiChar($80 or ((lw shr 6) and $3f));
+                  Dest[j+2]:=AnsiChar($80 or (lw and $3f));
                   inc(j,3);
                   inc(j,3);
                 end;
                 end;
               $d800..$dbff:
               $d800..$dbff:
@@ -1744,10 +1744,10 @@ end;
                     begin
                     begin
                       { $d7c0 is ($d800 - ($10000 shr 10)) }
                       { $d7c0 is ($d800 - ($10000 shr 10)) }
                       lw:=(longword(lw-$d7c0) shl 10) + (ord(source[i+1]) xor $dc00);
                       lw:=(longword(lw-$d7c0) shl 10) + (ord(source[i+1]) xor $dc00);
-                      Dest[j]:=char($f0 or (lw shr 18));
-                      Dest[j+1]:=char($80 or ((lw shr 12) and $3f));
-                      Dest[j+2]:=char($80 or ((lw shr 6) and $3f));
-                      Dest[j+3]:=char($80 or (lw and $3f));
+                      Dest[j]:=AnsiChar($f0 or (lw shr 18));
+                      Dest[j+1]:=AnsiChar($80 or ((lw shr 12) and $3f));
+                      Dest[j+2]:=AnsiChar($80 or ((lw shr 6) and $3f));
+                      Dest[j+3]:=AnsiChar($80 or (lw and $3f));
                       inc(j,4);
                       inc(j,4);
                       inc(i);
                       inc(i);
                     end;
                     end;
@@ -1791,7 +1791,7 @@ end;
 {$endif EXCLUDE_COMPLEX_PROCS}
 {$endif EXCLUDE_COMPLEX_PROCS}
 
 
 
 
-function Utf8ToUnicode(Dest: PUnicodeChar; Source: PChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+function Utf8ToUnicode(Dest: PUnicodeChar; Source: PAnsiChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
     if assigned(Source) then
     if assigned(Source) then
       Result:=Utf8ToUnicode(Dest,MaxChars,Source,length(Source),True)
       Result:=Utf8ToUnicode(Dest,MaxChars,Source,length(Source),True)
@@ -1800,13 +1800,13 @@ function Utf8ToUnicode(Dest: PUnicodeChar; Source: PChar; MaxChars: SizeInt): Si
   end;
   end;
 
 
 
 
-function UTF8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt): SizeUInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+function UTF8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PAnsiChar; SourceBytes: SizeUInt): SizeUInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 begin
 begin
   Result:=Utf8ToUnicode(Dest,MaxDestChars,Source,SourceBytes,True);
   Result:=Utf8ToUnicode(Dest,MaxDestChars,Source,SourceBytes,True);
 end;
 end;
 
 
-function Utf8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt; IgnoreInvalid : Boolean): SizeUInt;
+function Utf8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PAnsiChar; SourceBytes: SizeUInt; IgnoreInvalid : Boolean): SizeUInt;
 
 
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 {$ifdef EXCLUDE_COMPLEX_PROCS}
 begin
 begin
@@ -1862,7 +1862,7 @@ end;
                 if SizeUInt(InputUTF8+CharLen-1)>SourceBytes then
                 if SizeUInt(InputUTF8+CharLen-1)>SourceBytes then
                   begin
                   begin
                     //Insuficient chars in string to decode
                     //Insuficient chars in string to decode
-                    //UTF-8 array. Fallback to single char.
+                    //UTF-8 array. Fallback to single AnsiChar.
                     CharLen:= 1;
                     CharLen:= 1;
                   end;
                   end;
                 for LookAhead := 1 to CharLen-1 do
                 for LookAhead := 1 to CharLen-1 do
@@ -1976,7 +1976,7 @@ end;
                 if SizeUInt(InputUTF8+CharLen-1)>SourceBytes then
                 if SizeUInt(InputUTF8+CharLen-1)>SourceBytes then
                   begin
                   begin
                     //Insuficient chars in string to decode
                     //Insuficient chars in string to decode
-                    //UTF-8 array. Fallback to single char.
+                    //UTF-8 array. Fallback to single AnsiChar.
                     CharLen:= 1;
                     CharLen:= 1;
                   end;
                   end;
                 for LookAhead := 1 to CharLen-1 do
                 for LookAhead := 1 to CharLen-1 do
@@ -2067,7 +2067,7 @@ function UTF8Encode(const s : UnicodeString) : RawByteString;
     if s='' then
     if s='' then
       exit;
       exit;
     SetLength(hs,length(s)*3);
     SetLength(hs,length(s)*3);
-    i:=UnicodeToUtf8(pchar(hs),length(hs)+1,PUnicodeChar(s),length(s));
+    i:=UnicodeToUtf8(pansichar(hs),length(hs)+1,PUnicodeChar(s),length(s));
     if i>0 then
     if i>0 then
       begin
       begin
         SetLength(hs,i-1);
         SetLength(hs,i-1);
@@ -2088,7 +2088,7 @@ function UTF8Decode(const s : RawByteString): UnicodeString;
     if s='' then
     if s='' then
       exit;
       exit;
     SetLength(hs,length(s));
     SetLength(hs,length(s));
-    i:=Utf8ToUnicode(PUnicodeChar(hs),length(hs)+1,pchar(s),length(s));
+    i:=Utf8ToUnicode(PUnicodeChar(hs),length(hs)+1,pansichar(s),length(s));
     if i>0 then
     if i>0 then
       begin
       begin
         SetLength(hs,i-1);
         SetLength(hs,i-1);
@@ -2402,7 +2402,7 @@ begin
   Count := Length(S);
   Count := Length(S);
   SetLength(rs, Count);
   SetLength(rs, Count);
   if Count > 0 then
   if Count > 0 then
-    fpc_pchar_ansistr_intern_charmove(pchar(@S),Low(S),rs,0,Count);
+    fpc_pchar_ansistr_intern_charmove(pansichar(@S),Low(S),rs,0,Count);
   Result := UTF8ToString(rs);
   Result := UTF8ToString(rs);
 end;
 end;
 {$endif not CPUJVM}
 {$endif not CPUJVM}

+ 3 - 3
rtl/inc/uuchar.pp

@@ -2,7 +2,7 @@
     This file is part of the Free Pascal Run time library.
     This file is part of the Free Pascal Run time library.
     Copyright (c) 2011 by the Free Pascal development team
     Copyright (c) 2011 by the Free Pascal development team
 
 
-    This unit redefines the Char type from ansichar into widechar
+    This unit redefines the AnsiChar type from ansichar into widechar
 
 
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     For details about the copyright.
     For details about the copyright.
@@ -18,8 +18,8 @@ unit uuchar;
 interface
 interface
 
 
   type
   type
-    char = widechar;
-    pchar = pwidechar;
+    AnsiChar = widechar;
+    PAnsiChar = pwidechar;
 
 
 
 
 {$ifdef FPC_HAS_FEATURE_COMMANDARGS}
 {$ifdef FPC_HAS_FEATURE_COMMANDARGS}

+ 6 - 6
rtl/inc/variant.inc

@@ -238,7 +238,7 @@ end;
 
 
 { Chars }
 { Chars }
 
 
-operator :=(const source : char) dest : variant;{$ifdef SYSTEMINLINE}inline;{$endif}
+operator :=(const source : AnsiChar) dest : variant;{$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   VariantManager.VarFromPStr(Dest,Source);
   VariantManager.VarFromPStr(Dest,Source);
 end;
 end;
@@ -443,7 +443,7 @@ end;
 
 
 { Chars }
 { Chars }
 
 
-operator :=(const source : variant) dest : char;{$ifdef SYSTEMINLINE}inline;{$endif}
+operator :=(const source : variant) dest : AnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
 Var
 Var
   S : String;
   S : String;
 begin
 begin
@@ -795,7 +795,7 @@ operator :=(const source : olevariant) dest : longbool;{$ifdef SYSTEMINLINE}inli
 
 
 
 
 { Chars }
 { Chars }
-operator :=(const source : olevariant) dest : char;{$ifdef SYSTEMINLINE}inline;{$endif}
+operator :=(const source : olevariant) dest : AnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
   var
   var
     S : String;
     S : String;
   begin
   begin
@@ -983,7 +983,7 @@ operator :=(const source : longbool) dest : olevariant;{$ifdef SYSTEMINLINE}inli
 
 
 
 
 { Chars }
 { Chars }
-operator :=(const source : char) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
+operator :=(const source : AnsiChar) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
     variantmanager.olevarfrompstr(dest,source);
     variantmanager.olevarfrompstr(dest,source);
   end;
   end;
@@ -1112,7 +1112,7 @@ begin
 end;
 end;
 
 
 
 
-Function Pos (c : Char; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+Function Pos (c : AnsiChar; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
     Result:=Pos(c,ShortString(v));
     Result:=Pos(c,ShortString(v));
   end;
   end;
@@ -1144,7 +1144,7 @@ Function Pos (const w : UnicodeString; Const v : Variant) : SizeInt;{$ifdef SYST
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
 
 
 
 
-Function Pos (const v : Variant; Const c : Char) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+Function Pos (const v : Variant; Const c : AnsiChar) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
   begin
   begin
     Result:=Pos(ShortString(v),c);
     Result:=Pos(ShortString(v),c);
   end;
   end;

+ 6 - 6
rtl/inc/varianth.inc

@@ -252,7 +252,7 @@ operator :=(const source : wordbool) dest : variant;{$ifdef SYSTEMINLINE}inline;
 operator :=(const source : longbool) dest : variant;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : longbool) dest : variant;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { Chars }
 { Chars }
-operator :=(const source : char) dest : variant;{$ifdef SYSTEMINLINE}inline;{$endif}
+operator :=(const source : AnsiChar) dest : variant;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : widechar) dest : variant;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : widechar) dest : variant;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { Strings }
 { Strings }
@@ -311,7 +311,7 @@ operator :=(const source : variant) dest : wordbool;{$ifdef SYSTEMINLINE}inline;
 operator :=(const source : variant) dest : longbool;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : variant) dest : longbool;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { Chars }
 { Chars }
-operator :=(const source : variant) dest : char;{$ifdef SYSTEMINLINE}inline;{$endif}
+operator :=(const source : variant) dest : AnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : variant) dest : widechar;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : variant) dest : widechar;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { Strings }
 { Strings }
@@ -400,7 +400,7 @@ operator :=(const source : olevariant) dest : wordbool;{$ifdef SYSTEMINLINE}inli
 operator :=(const source : olevariant) dest : longbool;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : olevariant) dest : longbool;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { Chars }
 { Chars }
-operator :=(const source : olevariant) dest : char;{$ifdef SYSTEMINLINE}inline;{$endif}
+operator :=(const source : olevariant) dest : AnsiChar;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : olevariant) dest : widechar;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : olevariant) dest : widechar;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { Strings }
 { Strings }
@@ -455,7 +455,7 @@ operator :=(const source : wordbool) dest : olevariant;{$ifdef SYSTEMINLINE}inli
 operator :=(const source : longbool) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : longbool) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { Chars }
 { Chars }
-operator :=(const source : char) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
+operator :=(const source : AnsiChar) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : widechar) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : widechar) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { Strings }
 { Strings }
@@ -491,14 +491,14 @@ operator :=(const source : tdatetime) dest : olevariant;{$ifdef SYSTEMINLINE}inl
 operator :=(const source : terror) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
 operator :=(const source : terror) dest : olevariant;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { silly, but how else should the compiler know what to do with pos(<string type>,<variant>)? (FK) }
 { silly, but how else should the compiler know what to do with pos(<string type>,<variant>)? (FK) }
-Function Pos (c : Char; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+Function Pos (c : AnsiChar; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (s : ShortString; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (s : ShortString; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const a : AnsiString; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const a : AnsiString; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const w : WideString; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const w : WideString; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
 Function Pos (const w : UnicodeString; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const w : UnicodeString; Const v : Variant) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
 {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
-Function Pos (const v : Variant; Const c : Char) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+Function Pos (const v : Variant; Const c : AnsiChar) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const v : Variant; Const s : ShortString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const v : Variant; Const s : ShortString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const v : Variant; Const a : AnsiString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const v : Variant; Const a : AnsiString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const v : Variant; Const w : WideString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (const v : Variant; Const w : WideString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}

+ 3 - 3
rtl/inc/wstringh.inc

@@ -17,7 +17,7 @@
 
 
 Procedure UniqueString (Var S : WideString);{$ifdef SYSTEMINLINE}inline;{$endif}
 Procedure UniqueString (Var S : WideString);{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Pos (Const Substr : WideString; Const Source : WideString; Offset : SizeInt = 1) : SizeInt;
 Function Pos (Const Substr : WideString; Const Source : WideString; Offset : SizeInt = 1) : SizeInt;
-Function Pos (c : Char; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
+Function Pos (c : AnsiChar; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
 Function Pos (c : WideChar; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
 Function Pos (c : WideChar; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
 Function Pos (c : WideChar; Const s : RawByteString; Offset : SizeInt = 1) : SizeInt;
 Function Pos (c : WideChar; Const s : RawByteString; Offset : SizeInt = 1) : SizeInt;
 Function Pos (const c : RawByteString; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
 Function Pos (const c : RawByteString; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
@@ -31,9 +31,9 @@ Procedure Insert (Const Source : WideString; Var S : WideString; Index : SizeInt
 Procedure Delete (Var S : WideString; Index,Size: SizeInt);
 Procedure Delete (Var S : WideString; Index,Size: SizeInt);
 {$endif VER3_0}
 {$endif VER3_0}
 Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pwidechar{$else}SetString{$endif}(Out S : WideString; Buf : PWideChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
 Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pwidechar{$else}SetString{$endif}(Out S : WideString; Buf : PWideChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pansichar{$else}SetString{$endif}(Out S : WideString; Buf : PChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pansichar{$else}SetString{$endif}(Out S : WideString; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
 
 
-procedure DefaultAnsi2WideMove(source:pchar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
+procedure DefaultAnsi2WideMove(source:PAnsiChar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
 
 
 type
 type
   TWideStringManager = TUnicodeStringManager;
   TWideStringManager = TUnicodeStringManager;

+ 16 - 16
rtl/inc/wstrings.inc

@@ -43,13 +43,13 @@ Const
   WideFirstOff = SizeOf(TWideRec)-sizeof(WideChar);
   WideFirstOff = SizeOf(TWideRec)-sizeof(WideChar);
 
 
 {
 {
-  Default WideChar <-> Char conversion is to only convert the
+  Default WideChar <-> AnsiChar conversion is to only convert the
   lower 127 chars, all others are translated to spaces.
   lower 127 chars, all others are translated to spaces.
 
 
   These routines can be overwritten for the Current Locale
   These routines can be overwritten for the Current Locale
 }
 }
 
 
-procedure DefaultAnsi2WideMove(source:pchar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
+procedure DefaultAnsi2WideMove(source:PAnsiChar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
 var
 var
   i : SizeInt;
   i : SizeInt;
 begin
 begin
@@ -172,7 +172,7 @@ begin
   result:='';
   result:='';
   Size:=Length(S2);
   Size:=Length(S2);
   if Size>0 then
   if Size>0 then
-    widestringmanager.Ansi2WideMoveProc(PChar(@S2[1]),DefaultSystemCodePage,result,Size);
+    widestringmanager.Ansi2WideMoveProc(PAnsiChar(@S2[1]),DefaultSystemCodePage,result,Size);
 end;
 end;
 
 
 
 
@@ -212,7 +212,7 @@ begin
   if Size>0 then
   if Size>0 then
   begin
   begin
     cp:=TranslatePlaceholderCP(StringCodePage(S2));
     cp:=TranslatePlaceholderCP(StringCodePage(S2));
-    widestringmanager.Ansi2WideMoveProc(PChar(S2),cp,result,Size);
+    widestringmanager.Ansi2WideMoveProc(PAnsiChar(S2),cp,result,Size);
   end;
   end;
 end;
 end;
 
 
@@ -340,9 +340,9 @@ end;
 
 
 
 
 
 
-Function fpc_Char_To_WideStr(const c : Char): WideString; compilerproc;
+Function fpc_Char_To_WideStr(const c : AnsiChar): WideString; compilerproc;
 {
 {
-  Converts a Char to a WideString;
+  Converts a AnsiChar to a WideString;
 }
 }
 begin
 begin
   widestringmanager.Ansi2WideMoveProc(@c,DefaultSystemCodePage,fpc_char_To_WideStr,1);
   widestringmanager.Ansi2WideMoveProc(@c,DefaultSystemCodePage,fpc_char_To_WideStr,1);
@@ -359,7 +359,7 @@ begin
 end;
 end;
 
 
 
 
-Function fpc_PChar_To_WideStr(const p : pchar): WideString; compilerproc;
+Function fpc_PChar_To_WideStr(const p : PAnsiChar): WideString; compilerproc;
 Var
 Var
   L : SizeInt;
   L : SizeInt;
 begin
 begin
@@ -373,7 +373,7 @@ begin
 end;
 end;
 
 
 
 
-Function fpc_CharArray_To_WideStr(const arr: array of char; zerobased: boolean = true): WideString; compilerproc;
+Function fpc_CharArray_To_WideStr(const arr: array of AnsiChar; zerobased: boolean = true): WideString; compilerproc;
 var
 var
   i  : SizeInt;
   i  : SizeInt;
 begin
 begin
@@ -390,11 +390,11 @@ begin
     end
     end
   else
   else
     i := high(arr)+1;
     i := high(arr)+1;
-  widestringmanager.Ansi2WideMoveProc(pchar(@arr),DefaultSystemCodePage,fpc_CharArray_To_WideStr,i);
+  widestringmanager.Ansi2WideMoveProc(pansichar(@arr),DefaultSystemCodePage,fpc_CharArray_To_WideStr,i);
 end;
 end;
 
 
 
 
-procedure fpc_widestr_to_chararray(out res: array of char; const src: WideString); compilerproc;
+procedure fpc_widestr_to_chararray(out res: array of AnsiChar; const src: WideString); compilerproc;
 var
 var
   len: SizeInt;
   len: SizeInt;
   temp: ansistring;
   temp: ansistring;
@@ -665,11 +665,11 @@ Function Pos (const c : WideString; Const s : RawByteString;Offset : SizeInt = 1
     result:=Pos(c,WideString(s),Offset);
     result:=Pos(c,WideString(s),Offset);
   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)           }
-Function Pos (c : Char; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
+Function Pos (c : AnsiChar; Const s : WideString; Offset : SizeInt = 1) : SizeInt;
 var
 var
   i: SizeInt;
   i: SizeInt;
   wc : widechar;
   wc : widechar;
@@ -751,7 +751,7 @@ begin
 end;
 end;
 
 
 
 
-Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pansichar{$else}SetString{$endif}(Out S : WideString; Buf : PChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
+Procedure {$ifdef FPC_HAS_CPSTRING}fpc_setstring_widestr_pansichar{$else}SetString{$endif}(Out S : WideString; Buf : PAnsiChar; Len : SizeInt); {$ifdef FPC_HAS_CPSTRING} compilerproc; {$endif FPC_HAS_CPSTRING}
 begin
 begin
   If (Buf<>Nil) and (Len>0) then
   If (Buf<>Nil) and (Len>0) then
     widestringmanager.Ansi2WideMoveProc(Buf,DefaultSystemCodePage,S,Len)
     widestringmanager.Ansi2WideMoveProc(Buf,DefaultSystemCodePage,S,Len)
@@ -951,7 +951,7 @@ function UTF8Encode(const s : WideString) : RawByteString;
     if s='' then
     if s='' then
       exit;
       exit;
     SetLength(hs,length(s)*3);
     SetLength(hs,length(s)*3);
-    i:=UnicodeToUtf8(pchar(hs),length(hs)+1,PWideChar(s),length(s));
+    i:=UnicodeToUtf8(pansichar(hs),length(hs)+1,PWideChar(s),length(s));
     if i>0 then
     if i>0 then
       begin
       begin
         SetLength(hs,i-1);
         SetLength(hs,i-1);