Procházet zdrojové kódy

* Char -> AnsiChar

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

+ 3 - 3
rtl/msdos/sysdir.inc

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

+ 7 - 7
rtl/msdos/sysfile.inc

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

+ 3 - 3
rtl/msdos/sysheap.inc

@@ -24,11 +24,11 @@
 { Internal structure used by MSDOS }
 { Internal structure used by MSDOS }
 type
 type
   MCB = packed record
   MCB = packed record
-    sig : char;
+    sig : AnsiChar;
     psp : word;
     psp : word;
     paragraphs : 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;
   end;
   PMCB = ^MCB;
   PMCB = ^MCB;
 {$endif def DEBUG_TINY_HEAP}
 {$endif def DEBUG_TINY_HEAP}

+ 17 - 17
rtl/msdos/system.pp

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

+ 18 - 18
rtl/msdos/sysutils.pp

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