浏览代码

* Char -> AnsiChar

Michael VAN CANNEYT 2 年之前
父节点
当前提交
d3bc874500
共有 6 个文件被更改,包括 61 次插入61 次删除
  1. 13 13
      rtl/msdos/dos.pp
  2. 3 3
      rtl/msdos/sysdir.inc
  3. 7 7
      rtl/msdos/sysfile.inc
  4. 3 3
      rtl/msdos/sysheap.inc
  5. 17 17
      rtl/msdos/system.pp
  6. 18 18
      rtl/msdos/sysutils.pp

+ 13 - 13
rtl/msdos/dos.pp

@@ -76,7 +76,7 @@ uses
 
 type
   PFarByte = ^Byte;far;
-  PFarChar = ^Char;far;
+  PFarChar = ^AnsiChar;far;
   PFarWord = ^Word;far;
 
 {$DEFINE HAS_GETMSCOUNT}
@@ -581,7 +581,7 @@ var
   lfnfile : text;
 {$endif DEBUG_LFN}
 
-procedure LFNFindFirst(path:pchar;attr:longint;var s:searchrec);
+procedure LFNFindFirst(path:PAnsiChar;attr:longint;var s:searchrec);
 var
   w : LFNSearchRec;
 begin
@@ -678,7 +678,7 @@ begin
 end;
 
 
-procedure DosFindfirst(path : pchar;attr : word;var f : searchrec);
+procedure DosFindfirst(path : PAnsiChar;attr : word;var f : searchrec);
 begin
   { allow slash as backslash }
   DoDirSeparators(path);
@@ -715,7 +715,7 @@ end;
 
 procedure findfirst(const path : pathstr;attr : word;var f : searchRec);
 var
-  path0 : array[0..255] of char;
+  path0 : array[0..255] of AnsiChar;
 begin
   doserror:=0;
   strpcopy(path0,path);
@@ -817,7 +817,7 @@ end;
 { change to short filename if successful DOS call PM }
 function GetShortName(var p : String) : boolean;
 var
-  c : array[0..255] of char;
+  c : array[0..255] of AnsiChar;
 begin
   move(p[1],c[0],length(p));
   c[length(p)]:=#0;
@@ -832,7 +832,7 @@ begin
   if DosError=0 then
    begin
      move(c[0],p[1],strlen(c));
-     p[0]:=char(strlen(c));
+     p[0]:=AnsiChar(strlen(c));
      GetShortName:=true;
    end
   else
@@ -843,7 +843,7 @@ end;
 { change to long filename if successful DOS call PM }
 function GetLongName(var p : String) : boolean;
 var
-  c : array[0..260] of char;
+  c : array[0..260] of AnsiChar;
 begin
   move(p[1],c[0],length(p));
   c[length(p)]:=#0;
@@ -859,7 +859,7 @@ begin
    begin
      c[255]:=#0;
      move(c[0],p[1],strlen(c));
-     p[0]:=char(strlen(c));
+     p[0]:=AnsiChar(strlen(c));
      GetLongName:=true;
    end
   else
@@ -894,7 +894,7 @@ end;
 
 procedure getfattr(var f;var attr : word);
 var
-  path: pchar;
+  path: PAnsiChar;
 {$ifndef FPC_ANSI_TEXTFILEREC}
   r: rawbytestring;
 {$endif not FPC_ANSI_TEXTFILEREC}
@@ -903,7 +903,7 @@ begin
   path:=@filerec(f).Name;
 {$else}
   r:=ToSingleByteFileSystemEncodedFileName(filerec(f).Name);
-  path:=pchar(r);
+  path:=PAnsiChar(r);
 {$endif}
   dosregs.dx:=Ofs(path^);
   dosregs.ds:=Seg(path^);
@@ -922,7 +922,7 @@ end;
 
 procedure setfattr(var f;attr : word);
 var
-  path: pchar;
+  path: PAnsiChar;
 {$ifndef FPC_ANSI_TEXTFILEREC}
   r: rawbytestring;
 {$endif not FPC_ANSI_TEXTFILEREC}
@@ -937,7 +937,7 @@ begin
   path:=@filerec(f).Name;
 {$else}
   r:=ToSingleByteFileSystemEncodedFileName(filerec(f).Name);
-  path:=pchar(r);
+  path:=PAnsiChar(r);
 {$endif}
   dosregs.dx:=Ofs(path^);
   dosregs.ds:=Seg(path^);
@@ -962,7 +962,7 @@ function GetEnvStr(EnvNo: Integer; var OutEnvStr: string): integer;
 var
   dos_env_seg: Word;
   ofs: Word;
-  Ch, Ch2: Char;
+  Ch, Ch2: AnsiChar;
 begin
   dos_env_seg := PFarWord(Ptr(PrefixSeg, $2C))^;
   GetEnvStr := 1;

+ 3 - 3
rtl/msdos/sysdir.inc

@@ -87,7 +87,7 @@ end;
 
 procedure do_GetDir (DriveNr: byte; var Dir: RawByteString);
 var
-  temp : array[0..260] of char;
+  temp : array[0..260] of AnsiChar;
   i    : integer;
   regs : Registers;
 begin
@@ -102,7 +102,7 @@ begin
   if (regs.Flags and fCarry) <> 0 then
    Begin
      GetInOutRes (regs.AX);
-     Dir := char (DriveNr + 64) + ':\';
+     Dir := AnsiChar (DriveNr + 64) + ':\';
      SetCodePage (Dir,DefaultFileSystemCodePage,false);
      exit;
    end
@@ -126,7 +126,7 @@ begin
   if not FileNameCasePreserving then
    dir:=upcase(dir);
   if drivenr<>0 then   { Drive was supplied. We know it }
-   dir[1]:=char(65+drivenr-1)
+   dir[1]:=AnsiChar(65+drivenr-1)
   else
    begin
    { We need to get the current drive from DOS function 19H  }

+ 7 - 7
rtl/msdos/sysfile.inc

@@ -19,7 +19,7 @@
    var
       openfiles : array [0..max_files-1] of boolean;
 {$ifdef SYSTEMDEBUG}
-      opennames : array [0..max_files-1] of pchar;
+      opennames : array [0..max_files-1] of PAnsiChar;
    const
       free_closed_names : boolean = true;
       verbose_files : boolean = true;
@@ -67,10 +67,10 @@ begin
 end;
 
 
-procedure do_erase(p : pchar; pchangeable: boolean);
+procedure do_erase(p : PAnsiChar; pchangeable: boolean);
 var
   regs : Registers;
-  oldp : pchar;
+  oldp : PAnsiChar;
 begin
   oldp:=p;
   DoDirSeparators(p,pchangeable);
@@ -92,10 +92,10 @@ begin
 end;
 
 
-procedure do_rename(p1,p2 : pchar; p1changeable, p2changeable: boolean);
+procedure do_rename(p1,p2 : PAnsiChar; p1changeable, p2changeable: boolean);
 var
   regs : Registers;
-  oldp1, oldp2 : pchar;
+  oldp1, oldp2 : PAnsiChar;
 begin
   oldp1:=p1;
   oldp2:=p2;
@@ -257,7 +257,7 @@ begin
     Increase_file_handle_count:=true;
 end;
 
-procedure do_open(var f;p:pchar;flags:longint; pchangeable: boolean);
+procedure do_open(var f;p:PAnsiChar;flags:longint; pchangeable: boolean);
 {
   filerec and textrec have both handle and mode as the first items so
   they could use the same routine for opening/creating.
@@ -268,7 +268,7 @@ procedure do_open(var f;p:pchar;flags:longint; pchangeable: boolean);
 var
   regs   : Registers;
   action : word;
-  oldp : pchar;
+  oldp : PAnsiChar;
 begin
 {$ifdef SYSTEMDEBUG}
   if verbose_files then

+ 3 - 3
rtl/msdos/sysheap.inc

@@ -24,11 +24,11 @@
 { Internal structure used by MSDOS }
 type
   MCB = packed record
-    sig : char;
+    sig : AnsiChar;
     psp : word;
     paragraphs : word;
-    res : array [0..2] of char;
-    exename : array [0..7] of char;
+    res : array [0..2] of AnsiChar;
+    exename : array [0..7] of AnsiChar;
   end;
   PMCB = ^MCB;
 {$endif def DEBUG_TINY_HEAP}

+ 17 - 17
rtl/msdos/system.pp

@@ -22,12 +22,12 @@ interface
   systemh.inc is included otherwise the
   $mode switch is not effective }
 
-{ Use Ansi Char for files }
+{ Use AnsiChar for files }
 {$define FPC_ANSI_TEXTFILEREC}
 {$define FPC_STDOUT_TRUE_ALIAS}
 
 {$ifdef NO_WIDESTRINGS}
-  { Do NOT use wide Char for files }
+  { Do NOT use wide AnsiChar for files }
   {$undef FPC_HAS_FEATURE_WIDESTRINGS}
 {$endif NO_WIDESTRINGS}
 
@@ -42,8 +42,8 @@ const
   DriveSeparator = ':';
   ExtensionSeparator = '.';
   PathSeparator = ';';
-  AllowDirectorySeparators : set of char = ['\','/'];
-  AllowDriveSeparators : set of char = [':'];
+  AllowDirectorySeparators : set of AnsiChar = ['\','/'];
+  AllowDriveSeparators : set of AnsiChar = [':'];
   { FileNameCaseSensitive and FileNameCasePreserving are defined separately below!!! }
   maxExitCode = 255;
   MaxPathLen = 256;
@@ -78,7 +78,7 @@ var
   meml : array[0..($7fff div sizeof(longint))-1] of longint absolute $0:$0;
 { C-compatible arguments and environment }
   argc:smallint; //!! public name 'operatingsystem_parameter_argc';
-  argv:PPchar; //!! public name 'operatingsystem_parameter_argv';
+  argv:PPAnsiChar; //!! public name 'operatingsystem_parameter_argv';
 
 { The DOS Program Segment Prefix segment (TP7 compatibility) }
   PrefixSeg:Word;public name '__fpc_PrefixSeg';
@@ -122,7 +122,7 @@ const
 
 type
   PFarByte = ^Byte;far;
-  PFarChar = ^Char;far;
+  PFarChar = ^AnsiChar;far;
   PFarWord = ^Word;far;
   PPFarChar = ^PFarChar;
 
@@ -359,13 +359,13 @@ end;
 procedure setup_arguments;
 var
   I: SmallInt;
-  pc: PChar;
+  pc: PAnsiChar;
   pfc: PFarChar;
-  quote: Char;
+  quote: AnsiChar;
   count: SmallInt;
   arglen, argv0len: SmallInt;
-  argblock: PChar;
-  arg: PChar;
+  argblock: PAnsiChar;
+  arg: PAnsiChar;
   doscmd   : string[129];  { Dos commandline copied from PSP, max is 128 chars +1 for terminating zero }
 begin
   { force environment to be setup so dos_argv0 is loaded }
@@ -417,7 +417,7 @@ begin
               begin
                 if quote<>'''' then
                   begin
-                    if pchar(pc+1)^<>'"' then
+                    if PAnsiChar(pc+1)^<>'"' then
                       begin
                         if quote='"' then
                           quote:=' '
@@ -434,7 +434,7 @@ begin
               begin
                 if quote<>'"' then
                   begin
-                    if pchar(pc+1)^<>'''' then
+                    if PAnsiChar(pc+1)^<>'''' then
                       begin
                         if quote=''''  then
                          quote:=' '
@@ -457,7 +457,7 @@ begin
     end;
   { set argc and allocate argv }
   argc:=count;
-  argv:=AllocMem((count+1)*SizeOf(PChar));
+  argv:=AllocMem((count+1)*SizeOf(PAnsiChar));
   { allocate a single memory block for all arguments }
   argblock:=GetMem(arglen);
   { create argv[0] }
@@ -505,7 +505,7 @@ begin
               begin
                 if quote<>'''' then
                   begin
-                    if pchar(pc+1)^<>'"' then
+                    if PAnsiChar(pc+1)^<>'"' then
                       begin
                         if quote='"' then
                           quote:=' '
@@ -525,7 +525,7 @@ begin
               begin
                 if quote<>'"' then
                   begin
-                    if pchar(pc+1)^<>'''' then
+                    if PAnsiChar(pc+1)^<>'''' then
                       begin
                         if quote=''''  then
                           quote:=' '
@@ -636,8 +636,8 @@ end;
 function CheckLFN:boolean;
 var
   regs     : Registers;
-  RootName : pchar;
-  buf      : array [0..31] of char;
+  RootName : PAnsiChar;
+  buf      : array [0..31] of AnsiChar;
 begin
 { Check LFN API on drive c:\ }
   RootName:='C:\';

+ 18 - 18
rtl/msdos/sysutils.pp

@@ -56,7 +56,7 @@ implementation
 {$i sysutils.inc}
 
 type
-  PFarChar=^Char;far;
+  PFarChar=^AnsiChar;far;
   PPFarChar=^PFarChar;
 var
   dos_env_count:smallint;external name '__dos_env_count';
@@ -83,11 +83,11 @@ const
 Type
   PSearchrec = ^Searchrec;
 
-{  converts S to a pchar and copies it to the transfer-buffer.   }
+{  converts S to a PAnsiChar and copies it to the transfer-buffer.   }
 
 {procedure StringToTB(const S: string);
 var
-  P: pchar;
+  P: PAnsiChar;
   Len: integer;
 begin
   Len := Length(S) + 1;
@@ -110,7 +110,7 @@ begin
     begin
       Regs.ax := $716c;                    { Use LFN Open/Create API }
       Regs.dx := Action;                   { Action if file does/doesn't exist }
-      Regs.si := Ofs(PChar(FileName)^);
+      Regs.si := Ofs(PAnsiChar(FileName)^);
       Regs.bx := $2000 + (Mode and $ff);   { File open mode }
     end
   else
@@ -119,9 +119,9 @@ begin
         Regs.ax := $3c00                   { Map to Create/Replace API }
       else
         Regs.ax := $3d00 + (Mode and $ff); { Map to Open_Existing API }
-      Regs.dx := Ofs(PChar(FileName)^);
+      Regs.dx := Ofs(PAnsiChar(FileName)^);
     end;
-  Regs.Ds := Seg(PChar(FileName)^);
+  Regs.Ds := Seg(PAnsiChar(FileName)^);
   Regs.cx := $20;                          { Attributes }
   MsDos(Regs);
   if (Regs.Flags and fCarry) <> 0 then
@@ -460,8 +460,8 @@ Function FileGetAttr (Const FileName : RawByteString) : Longint;
 var
   Regs: registers;
 begin
-  Regs.dx := Ofs(PChar(FileName)^);
-  Regs.Ds := Seg(PChar(FileName)^);
+  Regs.dx := Ofs(PAnsiChar(FileName)^);
+  Regs.Ds := Seg(PAnsiChar(FileName)^);
   if LFNSupport then
    begin
      Regs.Ax := $7143;
@@ -481,8 +481,8 @@ Function FileSetAttr (Const Filename : RawByteString; Attr: longint) : Longint;
 var
   Regs: registers;
 begin
-  Regs.dx := Ofs(PChar(FileName)^);
-  Regs.Ds := Seg(PChar(FileName)^);
+  Regs.dx := Ofs(PAnsiChar(FileName)^);
+  Regs.Ds := Seg(PAnsiChar(FileName)^);
   if LFNSupport then
     begin
       Regs.Ax := $7143;
@@ -503,8 +503,8 @@ Function DeleteFile (Const FileName : RawByteString) : Boolean;
 var
   Regs: registers;
 begin
-  Regs.dx := Ofs(PChar(FileName)^);
-  Regs.Ds := Seg(PChar(FileName)^);
+  Regs.dx := Ofs(PAnsiChar(FileName)^);
+  Regs.Ds := Seg(PAnsiChar(FileName)^);
   if LFNSupport then
     Regs.ax := $7141
   else
@@ -521,10 +521,10 @@ var
   Regs: registers;
 begin
 //  StringToTB(OldName + #0 + NewName);
-  Regs.dx := Ofs(PChar(OldName)^);
-  Regs.Ds := Seg(PChar(OldName)^);
-  Regs.di := Ofs(PChar(NewName)^);
-  Regs.Es := Seg(PChar(NewName)^);
+  Regs.dx := Ofs(PAnsiChar(OldName)^);
+  Regs.Ds := Seg(PAnsiChar(OldName)^);
+  Regs.di := Ofs(PAnsiChar(NewName)^);
+  Regs.Es := Seg(PAnsiChar(NewName)^);
   if LFNSupport then
     Regs.ax := $7156
   else
@@ -656,7 +656,7 @@ end ;
 ****************************************************************************}
 
 const
-  BeepChars: array [1..2] of char = #7'$';
+  BeepChars: array [1..2] of AnsiChar = #7'$';
 
 procedure sysBeep;
 var
@@ -721,7 +721,7 @@ end;
 
 procedure InitAnsi;
 type
-  PFarChar = ^char; far;
+  PFarChar = ^AnsiChar; far;
 var
   CountryInfo: TCountryInfo; i: integer;
 begin