Bläddra i källkod

* replace strlenint with sizeint

peter 21 år sedan
förälder
incheckning
81b6d9f16c

+ 57 - 54
rtl/inc/astrings.inc

@@ -24,9 +24,9 @@
   AnsiString is defined as a 'silent' pchar :
   a pchar that points to :
 
-  @-12 : StrLenInt for maximum size;
-  @-8  : StrLenInt for size;
-  @-4  : StrLenInt for reference count;
+  @-12 : SizeInt for maximum size;
+  @-8  : SizeInt for size;
+  @-4  : SizeInt for reference count;
   @    : String + Terminating #0;
   Pchar(Ansistring) is a valid typecast.
   So AS[i] is converted to the address @AS+i-1.
@@ -40,7 +40,7 @@ Type
   TAnsiRec = Packed Record
     Maxlen,
     len,
-    ref   : StrLenint;
+    ref   : SizeInt;
     First : Char;
   end;
 
@@ -55,14 +55,14 @@ Const
 
 
 
-Function NewAnsiString(Len : StrLenInt) : Pointer;
+Function NewAnsiString(Len : SizeInt) : Pointer;
 {
   Allocate a new AnsiString on the heap.
   initialize it to zero length and reference count 1.
 }
 Var
   P : Pointer;
-  l : StrLenInt;
+  l : SizeInt;
 begin
   l:=Len+AnsiRecLen;
 
@@ -101,9 +101,9 @@ Procedure fpc_AnsiStr_Decr_Ref (Var S : Pointer);saveregisters;[Public,Alias:'FP
   If the reference count is zero, deallocate the string;
 }
 Type
-  pStrLenInt = ^StrLenInt;
+  pSizeInt = ^SizeInt;
 Var
-  l : pStrLenInt;
+  l : pSizeInt;
 Begin
   { Zero string }
   If S=Nil then exit;
@@ -174,7 +174,7 @@ Procedure fpc_AnsiStr_Concat (const S1,S2 : ansistring;var S3 : ansistring);[Pub
   Result Goes to S3;
 }
 Var
-  Size,Location : StrLenInt;
+  Size,Location : SizeInt;
 begin
   { only assign if s1 or s2 is empty }
   if (S1='') then
@@ -201,7 +201,7 @@ Procedure AnsiStr_ShortStr_Concat (Var S1: AnsiString; Var S2 : ShortString);
   Concatenates a Ansi with a short string; : S2 + S2
 }
 Var
-  Size,Location : StrLenInt;
+  Size,Location : SizeInt;
 begin
   Size:=Length(S2);
   Location:=Length(S1);
@@ -221,12 +221,12 @@ end;
 { procedure fpc_AnsiStr_To_ShortStr (Var S1 : ShortString;S2 : Pointer);     }
 { which is what the old helper was, so we don't need an extra implementation }
 { of the old helper (JM)                                                     }
-function fpc_AnsiStr_To_ShortStr (high_of_res: StrLenInt;const S2 : Ansistring): shortstring;[Public, alias: 'FPC_ANSISTR_TO_SHORTSTR'];  {$ifdef hascompilerproc} compilerproc; {$endif}
+function fpc_AnsiStr_To_ShortStr (high_of_res: SizeInt;const S2 : Ansistring): shortstring;[Public, alias: 'FPC_ANSISTR_TO_SHORTSTR'];  {$ifdef hascompilerproc} compilerproc; {$endif}
 {
   Converts a AnsiString to a ShortString;
 }
 Var
-  Size : StrLenInt;
+  Size : SizeInt;
 begin
   if S2='' then
    fpc_AnsiStr_To_ShortStr:=''
@@ -246,7 +246,7 @@ Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString): ansistring; {$ifdef h
   Converts a ShortString to a AnsiString;
 }
 Var
-  Size : StrLenInt;
+  Size : SizeInt;
 begin
   Size:=Length(S2);
   Setlength (fpc_ShortStr_To_AnsiStr,Size);
@@ -284,7 +284,7 @@ end;
 
 Function fpc_PChar_To_AnsiStr(const p : pchar): ansistring; {$ifdef hascompilerproc} compilerproc; {$endif}
 Var
-  L : StrLenInt;
+  L : SizeInt;
 begin
   if (not assigned(p)) or (p[0]=#0) Then
     { result is automatically set to '' }
@@ -305,7 +305,7 @@ end;
 
 Function fpc_CharArray_To_AnsiStr(const arr: array of char): ansistring; {$ifdef hascompilerproc} compilerproc; {$endif}
 var
-  i  : StrLenInt;
+  i  : SizeInt;
 begin
   if arr[0]=#0 Then
     { result is automatically set to '' }
@@ -322,10 +322,10 @@ end;
 { the declaration below is the same as                                              }
 { which is what the old helper was (we need the parameter as "array of char" type   }
 { so we can pass it to the new style helper (JM)                                    }
-Procedure fpc_CharArray_To_AnsiStr(var a : ansistring; p: pointer; len: StrLenInt);[Public,Alias : 'FPC_CHARARRAY_TO_ANSISTR'];  {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_CharArray_To_AnsiStr(var a : ansistring; p: pointer; len: SizeInt);[Public,Alias : 'FPC_CHARARRAY_TO_ANSISTR'];  {$ifdef hascompilerproc} compilerproc; {$endif}
 var
   src: pchar;
-  i: StrLenInt;
+  i: SizeInt;
 begin
   src := pchar(p);
   if src[0]=#0 Then
@@ -347,9 +347,9 @@ end;
 
 { note: inside the compiler, the resulttype is modified to be the length }
 { of the actual chararray to which we convert (JM)                       }
-function fpc_ansistr_to_chararray(arraysize: StrLenInt; const src: ansistring): fpc_big_chararray; [public, alias: 'FPC_ANSISTR_TO_CHARARRAY']; compilerproc;
+function fpc_ansistr_to_chararray(arraysize: SizeInt; const src: ansistring): fpc_big_chararray; [public, alias: 'FPC_ANSISTR_TO_CHARARRAY']; compilerproc;
 var
-  len: StrLenInt;
+  len: SizeInt;
 begin
   len := length(src);
   if len > arraysize then
@@ -363,7 +363,7 @@ end;
 {$endif hascompilerproc}
 
 
-Function fpc_AnsiStr_Compare(const S1,S2 : AnsiString): StrLenInt;[Public,Alias : 'FPC_ANSISTR_COMPARE'];  {$ifdef hascompilerproc} compilerproc; {$endif}
+Function fpc_AnsiStr_Compare(const S1,S2 : AnsiString): SizeInt;[Public,Alias : 'FPC_ANSISTR_COMPARE'];  {$ifdef hascompilerproc} compilerproc; {$endif}
 {
   Compares 2 AnsiStrings;
   The result is
@@ -372,7 +372,7 @@ Function fpc_AnsiStr_Compare(const S1,S2 : AnsiString): StrLenInt;[Public,Alias
    >0 if S1>S2
 }
 Var
-  MaxI,Temp : StrLenInt;
+  MaxI,Temp : SizeInt;
 begin
   if pointer(S1)=pointer(S2) then
    begin
@@ -397,16 +397,16 @@ begin
 end;
 
 
-Procedure fpc_AnsiStr_CheckRange(len,index : StrLenInt);[Public,Alias : 'FPC_ANSISTR_RANGECHECK'];  {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_AnsiStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_ANSISTR_RANGECHECK'];  {$ifdef hascompilerproc} compilerproc; {$endif}
 begin
   if (index>len) or (Index<1) then
     HandleErrorFrame(201,get_frame);
 end;
 
 {$ifndef INTERNSETLENGTH}
-Procedure SetLength (Var S : AnsiString; l : StrLenInt);
+Procedure SetLength (Var S : AnsiString; l : SizeInt);
 {$else INTERNSETLENGTH}
-Procedure fpc_AnsiStr_SetLength (Var S : AnsiString; l : StrLenInt);[Public,Alias : 'FPC_ANSISTR_SETLENGTH'];  {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_AnsiStr_SetLength (Var S : AnsiString; l : SizeInt);[Public,Alias : 'FPC_ANSISTR_SETLENGTH'];  {$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif INTERNSETLENGTH}
 {
   Sets The length of string S to L.
@@ -414,7 +414,7 @@ Procedure fpc_AnsiStr_SetLength (Var S : AnsiString; l : StrLenInt);[Public,Alia
 }
 Var
   Temp : Pointer;
-  movelen, NewLen: StrLenInt;
+  movelen, NewLen: SizeInt;
 begin
   if (l>0) then
     begin
@@ -465,7 +465,7 @@ begin
 end;
 
 {$ifdef EXTRAANSISHORT}
-Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString): StrLenInt;  {$ifdef hascompilerproc} compilerproc; {$endif}
+Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString): SizeInt;  {$ifdef hascompilerproc} compilerproc; {$endif}
 {
   Compares a AnsiString with a ShortString;
   The result is
@@ -474,7 +474,7 @@ Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString):
    >0 if S1>S2
 }
 Var
-  i,MaxI,Temp : StrLenInt;
+  i,MaxI,Temp : SizeInt;
 begin
   Temp:=0;
   i:=0;
@@ -496,7 +496,7 @@ end;
 *****************************************************************************}
 
 {$ifndef INTERNLENGTH}
-Function Length (Const S : AnsiString) : StrLenInt;
+Function Length (Const S : AnsiString) : SizeInt;
 {
   Returns the length of an AnsiString.
   Takes in acount that zero strings are NIL;
@@ -520,7 +520,7 @@ Function fpc_ansistr_Unique(Var S : Pointer): Pointer; [Public,Alias : 'FPC_ANSI
 }
 Var
   SNew : Pointer;
-  L    : StrLenInt;
+  L    : SizeInt;
 begin
   pointer(result) := pointer(s);
   If Pointer(S)=Nil then
@@ -546,7 +546,7 @@ end;
 
 Procedure fpc_ansistr_append_shortstring(Var S : AnsiString;Str : ShortString); [Public,Alias : 'FPC_ANSISTR_APPEND_SHORTSTRING']; {$ifdef hascompilerproc} compilerproc; {$endif}
 var
-   ofs : StrLenInt;
+   ofs : SizeInt;
 begin
    ofs:=Length(S);
    SetLength(S,ofs+length(Str));
@@ -556,7 +556,7 @@ end;
 
 Procedure fpc_ansistr_append_ansistring(Var S : AnsiString;Str : AnsiString); [Public,Alias : 'FPC_ANSISTR_APPEND_ANSISTRING']; {$ifdef hascompilerproc} compilerproc; {$endif}
 var
-   ofs : StrLenInt;
+   ofs : SizeInt;
 begin
    if Str<>'' then
      begin
@@ -567,9 +567,9 @@ begin
 end;
 
 {$ifdef interncopy}
-Function Fpc_Ansistr_Copy (Const S : AnsiString; Index,Size : StrLenInt) : AnsiString;compilerproc;
+Function Fpc_Ansistr_Copy (Const S : AnsiString; Index,Size : SizeInt) : AnsiString;compilerproc;
 {$else}
-Function Copy (Const S : AnsiString; Index,Size : StrLenInt) : AnsiString;
+Function Copy (Const S : AnsiString; Index,Size : SizeInt) : AnsiString;
 {$endif}
 var
   ResultAddress : Pointer;
@@ -603,9 +603,9 @@ begin
 end;
 
 
-Function Pos (Const Substr : AnsiString; Const Source : AnsiString) : StrLenInt;
+Function Pos (Const Substr : AnsiString; Const Source : AnsiString) : SizeInt;
 var
-  i,MaxLen : StrLenInt;
+  i,MaxLen : SizeInt;
   pc : pchar;
 begin
   Pos:=0;
@@ -633,9 +633,9 @@ end;
 { pos(c: char; const s: shortstring) also exists, so otherwise   }
 { using pos(char,pchar) will always call the shortstring version }
 { (exact match for first argument), also with $h+ (JM)           }
-Function Pos (c : Char; Const s : AnsiString) : StrLenInt;
+Function Pos (c : Char; Const s : AnsiString) : SizeInt;
 var
-  i: StrLenInt;
+  i: SizeInt;
   pc : pchar;
 begin
   pc:=@s[1];
@@ -682,7 +682,7 @@ begin
 end;
 
 
-Function fpc_Val_SInt_AnsiStr (DestSize: StrLenInt; Const S : AnsiString; Var Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_ANSISTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Function fpc_Val_SInt_AnsiStr (DestSize: SizeInt; Const S : AnsiString; Var Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_ANSISTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
 Var
   SS : ShortString;
 begin
@@ -731,7 +731,7 @@ end;
 {$endif CPU64}
 
 
-procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : StrLenInt;var s : ansistring);[public,alias:'FPC_ANSISTR_FLOAT']; {$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : SizeInt;var s : ansistring);[public,alias:'FPC_ANSISTR_FLOAT']; {$ifdef hascompilerproc} compilerproc; {$endif}
 var
   ss: ShortString;
 begin
@@ -741,9 +741,9 @@ end;
 
 
 {$ifdef STR_USES_VALINT}
-Procedure fpc_AnsiStr_UInt(v : ValUInt;Len : StrLenInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_VALUINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_AnsiStr_UInt(v : ValUInt;Len : SizeInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_VALUINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$else}
-Procedure fpc_AnsiStr_Longword(v : Longword;Len : StrLenInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_LONGWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_AnsiStr_Longword(v : Longword;Len : SizeInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_LONGWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif}
 Var
   SS : ShortString;
@@ -755,9 +755,9 @@ end;
 
 
 {$ifdef STR_USES_VALINT}
-Procedure fpc_AnsiStr_SInt(v : ValSInt;Len : StrLenInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_VALSINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_AnsiStr_SInt(v : ValSInt;Len : SizeInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_VALSINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$else}
-Procedure fpc_AnsiStr_Longint(v : Longint; Len : StrLenInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_LONGINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_AnsiStr_Longint(v : Longint; Len : SizeInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_LONGINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif}
 Var
   SS : ShortString;
@@ -769,7 +769,7 @@ end;
 
 {$ifndef CPU64}
 
-Procedure fpc_AnsiStr_QWord(v : QWord;Len : StrLenInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_QWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_AnsiStr_QWord(v : QWord;Len : SizeInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_QWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
 Var
   SS : ShortString;
 begin
@@ -779,7 +779,7 @@ end;
 
 
 
-Procedure fpc_AnsiStr_Int64(v : Int64; Len : StrLenInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_INT64']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_AnsiStr_Int64(v : Int64; Len : SizeInt; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_INT64']; {$ifdef hascompilerproc} compilerproc; {$endif}
 Var
   SS : ShortString;
 begin
@@ -790,9 +790,9 @@ end;
 {$endif CPU64}
 
 
-Procedure Delete (Var S : AnsiString; Index,Size: StrLenInt);
+Procedure Delete (Var S : AnsiString; Index,Size: SizeInt);
 Var
-  LS : StrLenInt;
+  LS : SizeInt;
 begin
   ls:=Length(S);
   If (Index>LS) or (Index<=0) or (Size<=0) then
@@ -809,10 +809,10 @@ begin
 end;
 
 
-Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : StrLenInt);
+Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : SizeInt);
 var
   Temp : AnsiString;
-  LS : StrLenInt;
+  LS : SizeInt;
 begin
   If Length(Source)=0 then
    exit;
@@ -833,13 +833,13 @@ begin
 end;
 
 
-Function StringOfChar(c : char;l : StrLenInt) : AnsiString;
+Function StringOfChar(c : char;l : SizeInt) : AnsiString;
 begin
   SetLength(StringOfChar,l);
   FillChar(Pointer(StringOfChar)^,Length(StringOfChar),c);
 end;
 
-Procedure SetString (Var S : AnsiString; Buf : PChar; Len : StrLenInt);
+Procedure SetString (Var S : AnsiString; Buf : PChar; Len : SizeInt);
 begin
   SetLength(S,Len);
   If (Buf<>Nil) then
@@ -851,7 +851,7 @@ end;
 
 function upcase(const s : ansistring) : ansistring;
 var
-  i : StrLenInt;
+  i : SizeInt;
 begin
   Setlength(result,length(s));
   for i := 1 to length (s) do
@@ -861,7 +861,7 @@ end;
 
 function lowercase(const s : ansistring) : ansistring;
 var
-  i : StrLenInt;
+  i : SizeInt;
 begin
   Setlength(result,length(s));
   for i := 1 to length (s) do
@@ -871,7 +871,10 @@ end;
 
 {
   $Log$
-  Revision 1.42  2004-04-29 18:59:43  peter
+  Revision 1.43  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.42  2004/04/29 18:59:43  peter
     * str() helpers now also use valint/valuint
     * int64/qword helpers disabled for cpu64
 

+ 10 - 7
rtl/inc/cgenstr.inc

@@ -86,9 +86,9 @@
 {$ifndef FPC_UNIT_HAS_STRLCOPY}
 {$define FPC_UNIT_HAS_STRLCOPY}
 
- function libc_strlcpy(dest: pchar; const src: pchar; maxlen: StrLenInt): StrLenInt; cdecl; external 'c' name 'strlcpy';
+ function libc_strlcpy(dest: pchar; const src: pchar; maxlen: SizeInt): SizeInt; cdecl; external 'c' name 'strlcpy';
 
- Function StrLCopy(Dest,Source: PChar; MaxLen: StrLenInt): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
+ Function StrLCopy(Dest,Source: PChar; MaxLen: SizeInt): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
      libc_strlcpy(dest,source,maxlen);
      StrLCopy := Dest;
@@ -100,7 +100,7 @@
 {$define FPC_UNIT_HAS_STRCOMP}
  function libc_strcmp(const str1,str2: pchar): longint; cdecl; external 'c' name 'strcmp';
 
- function StrComp(Str1, Str2 : PChar): StrLenInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrComp(Str1, Str2 : PChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
      strcomp := libc_strcmp(str1,str2);
    end;
@@ -111,7 +111,7 @@
 {$define FPC_UNIT_HAS_STRICOMP}
  function libc_strcasecmp(const str1,str2: pchar): longint; cdecl; external 'c' name 'strcasecmp';
 
- function StrIComp(Str1, Str2 : PChar): StrLenInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrIComp(Str1, Str2 : PChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
      stricomp := libc_strcasecmp(str1,str2);
    end;
@@ -122,7 +122,7 @@
 {$define FPC_UNIT_HAS_STRLCOMP}
  function libc_strncmp(const str1,str2: pchar; l: Cardinal): longint; cdecl; external 'c' name 'strncmp';
 
- function StrLComp(Str1, Str2 : PChar; L: StrLenInt): StrLenInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrLComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
      strlcomp := libc_strncmp(str1,str2,l);
    end;
@@ -133,7 +133,7 @@
 {$define FPC_UNIT_HAS_STRLICOMP}
  function libc_strncasecmp(const str1,str2: pchar; l: Cardinal): longint; cdecl; external 'c' name 'strncasecmp';
 
- function StrLIComp(Str1, Str2 : PChar; L: StrLenInt): StrLenInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+ function StrLIComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
    Begin
      strlicomp := libc_strncasecmp(str1,str2,l);
    end;
@@ -142,7 +142,10 @@
 
 {
   $Log$
-  Revision 1.1  2004-05-01 15:26:33  jonas
+  Revision 1.2  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.1  2004/05/01 15:26:33  jonas
     * use some more string routines from libc if FPC_USE_LIBC is used
 
 

+ 43 - 40
rtl/inc/compproc.inc

@@ -40,7 +40,7 @@ Function  fpc_getmem(size:ptrint):pointer;compilerproc;
 Procedure fpc_freemem(p:pointer);compilerproc;
 {$endif valuefreemem}
 
-procedure fpc_Shortstr_SetLength(var s:shortstring;len:StrLenInt); compilerproc;
+procedure fpc_Shortstr_SetLength(var s:shortstring;len:SizeInt); compilerproc;
 function fpc_shortstr_to_shortstr(len:longint; const sstr: shortstring): shortstring; compilerproc;
 function fpc_shortstr_concat(const s1,s2:shortstring): shortstring; compilerproc;
 procedure fpc_shortstr_append_shortstr(var s1:shortstring;const s2:shortstring); compilerproc;
@@ -53,10 +53,10 @@ function fpc_pwidechar_length(p:pwidechar):longint; compilerproc;
 function fpc_chararray_to_shortstr(const arr: array of char):shortstring; compilerproc;
 function fpc_shortstr_to_chararray(arraysize: longint; const src: ShortString): fpc_big_chararray; compilerproc;
 
-Function  fpc_shortstr_Copy(const s:shortstring;index:StrLenInt;count:StrLenInt):shortstring;compilerproc;
-Function  fpc_ansistr_Copy (Const S : AnsiString; Index,Size : StrLenInt) : AnsiString;compilerproc;
-Function  fpc_widestr_Copy (Const S : WideString; Index,Size : StrLenInt) : WideString;compilerproc;
-function  fpc_char_copy(c:char;index : StrLenInt;count : StrLenInt): shortstring;compilerproc;
+Function  fpc_shortstr_Copy(const s:shortstring;index:SizeInt;count:SizeInt):shortstring;compilerproc;
+Function  fpc_ansistr_Copy (Const S : AnsiString; Index,Size : SizeInt) : AnsiString;compilerproc;
+Function  fpc_widestr_Copy (Const S : WideString; Index,Size : SizeInt) : WideString;compilerproc;
+function  fpc_char_copy(c:char;index : SizeInt;count : SizeInt): shortstring;compilerproc;
 procedure fpc_dynarray_copy(var pdest : pointer;psrc : pointer;ti : pointer;lowidx,count:tdynarrayindex);compilerproc;
 
 function  fpc_dynarray_length(p : pointer) : tdynarrayindex; compilerproc;
@@ -68,14 +68,14 @@ procedure fpc_dynarray_setlength(var p : pointer;pti : pointer; dimcount : dword
 
 { Str() support }
 {$ifdef STR_USES_VALINT}
-procedure fpc_ShortStr_sint(v : valsint;len : strlenint;var s : shortstring); compilerproc;
-procedure fpc_shortstr_uint(v : valuint;len : strlenint;var s : shortstring); compilerproc;
-procedure fpc_chararray_sint(v : valsint;len : strlenint;var a : array of char); compilerproc;
-procedure fpc_chararray_uint(v : valuint;len : strlenint;var a : array of char); compilerproc;
-procedure fpc_AnsiStr_sint(v : valsint; Len : strlenint; Var S : AnsiString); compilerproc;
-procedure fpc_AnsiStr_uint(v : valuint;Len : strlenint; Var S : AnsiString); compilerproc;
-procedure fpc_WideStr_sint(v : valsint; Len : strlenint; Var S : WideString); compilerproc;
-procedure fpc_WideStr_uint(v : valuint;Len : strlenint; Var S : WideString); compilerproc;
+procedure fpc_ShortStr_sint(v : valsint;len : SizeInt;var s : shortstring); compilerproc;
+procedure fpc_shortstr_uint(v : valuint;len : SizeInt;var s : shortstring); compilerproc;
+procedure fpc_chararray_sint(v : valsint;len : SizeInt;var a : array of char); compilerproc;
+procedure fpc_chararray_uint(v : valuint;len : SizeInt;var a : array of char); compilerproc;
+procedure fpc_AnsiStr_sint(v : valsint; Len : SizeInt; Var S : AnsiString); compilerproc;
+procedure fpc_AnsiStr_uint(v : valuint;Len : SizeInt; Var S : AnsiString); compilerproc;
+procedure fpc_WideStr_sint(v : valsint; Len : SizeInt; Var S : WideString); compilerproc;
+procedure fpc_WideStr_uint(v : valuint;Len : SizeInt; Var S : WideString); compilerproc;
 {$else}
 procedure fpc_ShortStr_Longint(v : longint;len : longint;var s : shortstring); compilerproc;
 procedure fpc_shortstr_longword(v : longword;len : longint;var s : shortstring); compilerproc;
@@ -87,30 +87,30 @@ procedure fpc_WideStr_Longint(v : Longint; Len : Longint; Var S : WideString); c
 procedure fpc_WideStr_Longword(v : Longword;Len : Longint; Var S : WideString); compilerproc;
 {$endif}
 {$ifndef CPU64}
-procedure fpc_shortstr_qword(v : qword;len : strlenint;var s : shortstring); compilerproc;
-procedure fpc_shortstr_int64(v : int64;len : strlenint;var s : shortstring); compilerproc;
-procedure fpc_chararray_qword(v : qword;len : strlenint;var a : array of char); compilerproc;
-procedure fpc_chararray_int64(v : int64;len : strlenint;var a : array of char); compilerproc;
-procedure fpc_ansistr_qword(v : qword;len : strlenint;var s : ansistring); compilerproc;
-procedure fpc_ansistr_int64(v : int64;len : strlenint;var s : ansistring); compilerproc;
-procedure fpc_widestr_qword(v : qword;len : strlenint;var s : widestring); compilerproc;
-procedure fpc_widestr_int64(v : int64;len : strlenint;var s : widestring); compilerproc;
+procedure fpc_shortstr_qword(v : qword;len : SizeInt;var s : shortstring); compilerproc;
+procedure fpc_shortstr_int64(v : int64;len : SizeInt;var s : shortstring); compilerproc;
+procedure fpc_chararray_qword(v : qword;len : SizeInt;var a : array of char); compilerproc;
+procedure fpc_chararray_int64(v : int64;len : SizeInt;var a : array of char); compilerproc;
+procedure fpc_ansistr_qword(v : qword;len : SizeInt;var s : ansistring); compilerproc;
+procedure fpc_ansistr_int64(v : int64;len : SizeInt;var s : ansistring); compilerproc;
+procedure fpc_widestr_qword(v : qword;len : SizeInt;var s : widestring); compilerproc;
+procedure fpc_widestr_int64(v : int64;len : SizeInt;var s : widestring); compilerproc;
 {$endif CPU64}
-procedure fpc_ShortStr_Float(d : ValReal;len,fr,rt : strlenint;var s : shortstring); compilerproc;
-procedure fpc_chararray_Float(d : ValReal;len,fr,rt : strlenint;var a : array of char); compilerproc;
-procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : strlenint;var s : ansistring); compilerproc;
-procedure fpc_WideStr_Float(d : ValReal;len,fr,rt : strlenint;var s : WideString); compilerproc;
+procedure fpc_ShortStr_Float(d : ValReal;len,fr,rt : SizeInt;var s : shortstring); compilerproc;
+procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;var a : array of char); compilerproc;
+procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : SizeInt;var s : ansistring); compilerproc;
+procedure fpc_WideStr_Float(d : ValReal;len,fr,rt : SizeInt;var s : WideString); compilerproc;
 
 { Val() support }
 Function fpc_Val_Real_ShortStr(const s : shortstring; var code : ValSInt): ValReal; compilerproc;
 Function fpc_Val_Real_AnsiStr(Const S : AnsiString; Var Code : ValSInt): ValReal; compilerproc;
 Function fpc_Val_Real_WideStr(Const S : WideString; Var Code : ValSInt): ValReal; compilerproc;
-Function fpc_Val_SInt_ShortStr(DestSize: StrLenInt; Const S: ShortString; var Code: ValSInt): ValSInt; compilerproc;
+Function fpc_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; var Code: ValSInt): ValSInt; compilerproc;
 Function fpc_Val_UInt_Shortstr(Const S: ShortString; var Code: ValSInt): ValUInt; compilerproc;
 Function fpc_Val_UInt_AnsiStr (Const S : AnsiString; Var Code : ValSInt): ValUInt; compilerproc;
-Function fpc_Val_SInt_AnsiStr (DestSize: StrLenInt; Const S : AnsiString; Var Code : ValSInt): ValSInt; compilerproc;
+Function fpc_Val_SInt_AnsiStr (DestSize: SizeInt; Const S : AnsiString; Var Code : ValSInt): ValSInt; compilerproc;
 Function fpc_Val_UInt_WideStr (Const S : WideString; Var Code : ValSInt): ValUInt; compilerproc;
-Function fpc_Val_SInt_WideStr (DestSize: StrLenInt; Const S : WideString; Var Code : ValSInt): ValSInt; compilerproc;
+Function fpc_Val_SInt_WideStr (DestSize: SizeInt; Const S : WideString; Var Code : ValSInt): ValSInt; compilerproc;
 {$ifndef CPU64}
 Function fpc_val_int64_shortstr(Const S: ShortString; var Code: ValSInt): Int64; compilerproc;
 Function fpc_val_qword_shortstr(Const S: ShortString; var Code: ValSInt): QWord; compilerproc;
@@ -130,18 +130,18 @@ Procedure fpc_ansistr_append_ansistring(Var S : AnsiString;Str : AnsiString); co
 {$ifdef EXTRAANSISHORT}
 Procedure fpc_AnsiStr_ShortStr_Concat (Var S1: AnsiString; Var S2 : ShortString); compilerproc;
 {$endif EXTRAANSISHORT}
-function fpc_AnsiStr_To_ShortStr (high_of_res: StrLenInt;const S2 : Ansistring): shortstring; compilerproc;
+function fpc_AnsiStr_To_ShortStr (high_of_res: SizeInt;const S2 : Ansistring): shortstring; compilerproc;
 Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString): ansistring; compilerproc;
 Function fpc_Char_To_AnsiStr(const c : Char): AnsiString; compilerproc;
 Function fpc_PChar_To_AnsiStr(const p : pchar): ansistring; compilerproc;
 Function fpc_CharArray_To_AnsiStr(const arr: array of char): ansistring; compilerproc;
-function fpc_ansistr_to_chararray(arraysize: StrLenInt; const src: ansistring): fpc_big_chararray; compilerproc;
-Function fpc_AnsiStr_Compare(const S1,S2 : AnsiString): StrLenInt; compilerproc;
+function fpc_ansistr_to_chararray(arraysize: SizeInt; const src: ansistring): fpc_big_chararray; compilerproc;
+Function fpc_AnsiStr_Compare(const S1,S2 : AnsiString): SizeInt; compilerproc;
 Procedure fpc_AnsiStr_CheckZero(p : pointer); compilerproc;
-Procedure fpc_AnsiStr_CheckRange(len,index : StrLenInt); compilerproc;
-Procedure fpc_AnsiStr_SetLength (Var S : AnsiString; l : StrLenInt); compilerproc;
+Procedure fpc_AnsiStr_CheckRange(len,index : SizeInt); compilerproc;
+Procedure fpc_AnsiStr_SetLength (Var S : AnsiString; l : SizeInt); compilerproc;
 {$ifdef EXTRAANSISHORT}
-Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString): StrLenInt; compilerproc;
+Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString): SizeInt; compilerproc;
 {$endif EXTRAANSISHORT}
 { pointer argument because otherwise when calling this, we get }
 { an endless loop since a 'var s: ansistring' must be made     }
@@ -150,7 +150,7 @@ Function fpc_ansistr_Unique(Var S : Pointer): Pointer; compilerproc;
 
 Procedure fpc_WideStr_Decr_Ref (Var S : Pointer); compilerproc;
 Procedure fpc_WideStr_Incr_Ref (S : Pointer); compilerproc;
-function fpc_WideStr_To_ShortStr (high_of_res: StrLenInt;const S2 : WideString): shortstring; compilerproc;
+function fpc_WideStr_To_ShortStr (high_of_res: SizeInt;const S2 : WideString): shortstring; compilerproc;
 Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; compilerproc;
 Function fpc_WideStr_To_AnsiStr (const S2 : WideString): AnsiString; compilerproc;
 Function fpc_AnsiStr_To_WideStr (Const S2 : AnsiString): WideString; compilerproc;
@@ -159,11 +159,11 @@ Function fpc_WideStr_Concat (const S1,S2 : WideString) : WideString; compilerpro
 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): WideString; compilerproc;
-function fpc_widestr_to_chararray(arraysize: StrLenInt; const src: WideString): fpc_big_chararray; compilerproc;
-Function fpc_WideStr_Compare(const S1,S2 : WideString): StrLenInt; compilerproc;
+function fpc_widestr_to_chararray(arraysize: SizeInt; const src: WideString): fpc_big_chararray; compilerproc;
+Function fpc_WideStr_Compare(const S1,S2 : WideString): SizeInt; compilerproc;
 Procedure fpc_WideStr_CheckZero(p : pointer); compilerproc;
-Procedure fpc_WideStr_CheckRange(len,index : StrLenInt); compilerproc;
-Procedure fpc_WideStr_SetLength (Var S : WideString; l : StrLenInt); compilerproc;
+Procedure fpc_WideStr_CheckRange(len,index : SizeInt); compilerproc;
+Procedure fpc_WideStr_SetLength (Var S : WideString; l : SizeInt); compilerproc;
 function fpc_widestr_Unique(Var S : Pointer): Pointer; compilerproc;
 
 {$ifdef HASWIDECHAR}
@@ -330,7 +330,10 @@ function fpc_qword_to_double(q: qword): double; compilerproc;
 
 {
   $Log$
-  Revision 1.55  2004-05-01 20:52:50  peter
+  Revision 1.56  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.55  2004/05/01 20:52:50  peter
     * ValSInt fixed for 64 bit
 
   Revision 1.54  2004/04/29 19:50:13  peter

+ 7 - 4
rtl/inc/generic.inc

@@ -604,15 +604,15 @@ var
    s1,s2,max,i : byte;
    d : longint;
 begin
-  s1:=length(left);
-  s2:=length(right);
+  s1:=length(right);
+  s2:=length(left);
   if s1<s2 then
     max:=s1
   else
     max:=s2;
   for i:=1 to max do
     begin
-     d:=byte(left[i])-byte(right[i]);
+     d:=byte(right[i])-byte(left[i]);
      if d>0 then
        exit(1)
      else if d<0 then
@@ -1221,7 +1221,10 @@ end;
 
 {
   $Log$
-  Revision 1.75  2004-05-01 20:52:50  peter
+  Revision 1.76  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.75  2004/05/01 20:52:50  peter
     * ValSInt fixed for 64 bit
 
   Revision 1.74  2004/05/01 15:26:33  jonas

+ 24 - 21
rtl/inc/genstr.inc

@@ -14,9 +14,9 @@
  **********************************************************************}
 
 {$ifndef FPC_UNIT_HAS_STRLEN}
- function strlen(P : pchar) : StrLenInt;
+ function strlen(P : pchar) : SizeInt;
   var
-   counter : StrLenInt;
+   counter : SizeInt;
  Begin
    counter := 0;
    while P[counter] <> #0 do
@@ -29,7 +29,7 @@
 {$ifndef FPC_UNIT_HAS_STREND}
  Function StrEnd(P: PChar): PChar;
  var
-  counter: StrLenInt;
+  counter: SizeInt;
  begin
    counter := 0;
    while P[counter] <> #0 do
@@ -42,7 +42,7 @@
 {$ifndef FPC_UNIT_HAS_STRCOPY}
  Function StrCopy(Dest, Source:PChar): PChar;
  var
-   counter : StrLenInt;
+   counter : SizeInt;
  Begin
    counter := 0;
    while Source[counter] <> #0 do
@@ -61,7 +61,7 @@
 {$ifndef FPC_UNIT_HAS_STRUPPER}
  function StrUpper(P: PChar): PChar;
  var
-  counter: StrLenInt;
+  counter: SizeInt;
  begin
    counter := 0;
    while (P[counter] <> #0) do
@@ -78,7 +78,7 @@
 {$ifndef FPC_UNIT_HAS_STRLOWER}
  function StrLower(P: PChar): PChar;
  var
-  counter: StrLenInt;
+  counter: SizeInt;
  begin
    counter := 0;
    while (P[counter] <> #0) do
@@ -96,7 +96,7 @@
 {$ifndef FPC_UNIT_HAS_STRSCAN}
  function StrScan(P: PChar; C: Char): PChar;
    Var
-     count: StrLenInt;
+     count: SizeInt;
   Begin
 
    count := 0;
@@ -126,8 +126,8 @@
 {$ifndef FPC_UNIT_HAS_STRRSCAN}
  function StrRScan(P: PChar; C: Char): PChar;
  Var
-  count: StrLenInt;
-  index: StrLenInt;
+  count: SizeInt;
+  index: SizeInt;
  Begin
    count := Strlen(P);
    { As in Borland Pascal , if looking for NULL return null }
@@ -157,7 +157,7 @@
  {  strcopy(Dest,Source);                                                }
  {  StrECopy := StrEnd(Dest);                                            }
  var
-   counter : StrLenInt;
+   counter : SizeInt;
  Begin
    counter := 0;
    while Source[counter] <> #0 do
@@ -173,9 +173,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRLCOPY}
- Function StrLCopy(Dest,Source: PChar; MaxLen: StrLenInt): PChar;
+ Function StrLCopy(Dest,Source: PChar; MaxLen: SizeInt): PChar;
   var
-   counter: StrLenInt;
+   counter: SizeInt;
  Begin
    counter := 0;
    { To be compatible with BP, on a null string, put two nulls }
@@ -197,9 +197,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRCOMP}
- function StrComp(Str1, Str2 : PChar): StrLenInt;
+ function StrComp(Str1, Str2 : PChar): SizeInt;
      var
-      counter: StrLenInt;
+      counter: SizeInt;
      Begin
         counter := 0;
        While str1[counter] = str2[counter] do
@@ -214,9 +214,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRICOMP}
-     function StrIComp(Str1, Str2 : PChar): StrLenInt;
+     function StrIComp(Str1, Str2 : PChar): SizeInt;
      var
-      counter: StrLenInt;
+      counter: SizeInt;
       c1, c2: char;
      Begin
         counter := 0;
@@ -235,9 +235,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRLCOMP}
-     function StrLComp(Str1, Str2 : PChar; L: StrLenInt): StrLenInt;
+     function StrLComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;
      var
-      counter: StrLenInt;
+      counter: SizeInt;
       c1, c2: char;
      Begin
         counter := 0;
@@ -258,9 +258,9 @@
 
 
 {$ifndef FPC_UNIT_HAS_STRLICOMP}
-     function StrLIComp(Str1, Str2 : PChar; L: StrLenInt): StrLenInt;
+     function StrLIComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;
      var
-      counter: StrLenInt;
+      counter: SizeInt;
       c1, c2: char;
      Begin
         counter := 0;
@@ -281,7 +281,10 @@
 
 {
   $Log$
-  Revision 1.2  2003-07-07 20:22:05  peter
+  Revision 1.3  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.2  2003/07/07 20:22:05  peter
     * generic string routines added
 
   Revision 1.1  2003/04/30 16:36:39  florian

+ 42 - 39
rtl/inc/sstrings.inc

@@ -17,9 +17,9 @@
 ****************************************************************************}
 
 {$ifndef INTERNSETLENGTH}
-procedure SetLength(var s:shortstring;len:StrLenInt);
+procedure SetLength(var s:shortstring;len:SizeInt);
 {$else INTERNSETLENGTH}
-procedure fpc_Shortstr_SetLength(var s:shortstring;len:StrLenInt);[Public,Alias : 'FPC_SHORTSTR_SETLENGTH']; {$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_Shortstr_SetLength(var s:shortstring;len:SizeInt);[Public,Alias : 'FPC_SHORTSTR_SETLENGTH']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif INTERNSETLENGTH}
 begin
   if Len>255 then
@@ -28,9 +28,9 @@ begin
 end;
 
 {$ifdef interncopy}
-function fpc_shortstr_copy(const s : shortstring;index : StrLenInt;count : StrLenInt): shortstring;compilerproc;
+function fpc_shortstr_copy(const s : shortstring;index : SizeInt;count : SizeInt): shortstring;compilerproc;
 {$else}
-function copy(const s : shortstring;index : StrLenInt;count : StrLenInt): shortstring;
+function copy(const s : shortstring;index : SizeInt;count : SizeInt): shortstring;
 {$endif}
 begin
   if count<0 then
@@ -54,7 +54,7 @@ begin
 end;
 
 
-procedure delete(var s : shortstring;index : StrLenInt;count : StrLenInt);
+procedure delete(var s : shortstring;index : SizeInt;count : SizeInt);
 begin
   if index<=0 then
      exit;
@@ -69,7 +69,7 @@ begin
 end;
 
 
-procedure insert(const source : shortstring;var s : shortstring;index : StrLenInt);
+procedure insert(const source : shortstring;var s : shortstring;index : SizeInt);
 var
   cut,srclen,indexlen : longint;
 begin
@@ -96,7 +96,7 @@ begin
 end;
 
 
-procedure insert(source : Char;var s : shortstring;index : StrLenInt);
+procedure insert(source : Char;var s : shortstring;index : SizeInt);
 var
   indexlen : longint;
 begin
@@ -113,9 +113,9 @@ begin
 end;
 
 
-function pos(const substr : shortstring;const s : shortstring):StrLenInt;
+function pos(const substr : shortstring;const s : shortstring):SizeInt;
 var
-  i,MaxLen : StrLenInt;
+  i,MaxLen : SizeInt;
   pc : pchar;
 begin
   Pos:=0;
@@ -140,9 +140,9 @@ end;
 
 
 {Faster when looking for a single char...}
-function pos(c:char;const s:shortstring):StrLenInt;
+function pos(c:char;const s:shortstring):SizeInt;
 var
-  i : StrLenInt;
+  i : SizeInt;
   pc : pchar;
 begin
   pc:=@s[1];
@@ -160,7 +160,7 @@ end;
 
 
 {$ifdef interncopy}
-function fpc_char_copy(c:char;index : StrLenInt;count : StrLenInt): shortstring;compilerproc;
+function fpc_char_copy(c:char;index : SizeInt;count : SizeInt): shortstring;compilerproc;
 begin
   if (index=1) and (Count>0) then
    fpc_char_Copy:=c
@@ -168,7 +168,7 @@ begin
    fpc_char_Copy:='';
 end;
 {$else}
-function copy(c:char;index : StrLenInt;count : StrLenInt): shortstring;
+function copy(c:char;index : SizeInt;count : SizeInt): shortstring;
 begin
   if (index=1) and (Count>0) then
    Copy:=c
@@ -178,7 +178,7 @@ end;
 {$endif}
 
 
-function pos(const substr : shortstring;c:char): StrLenInt;
+function pos(const substr : shortstring;c:char): SizeInt;
 begin
   if (length(substr)=1) and (substr[1]=c) then
    Pos:=1
@@ -351,9 +351,9 @@ end;
 *****************************************************************************}
 
 {$ifdef STR_USES_VALINT}
-procedure fpc_shortstr_SInt(v : valSInt;len : StrLenInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_SINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_shortstr_SInt(v : valSInt;len : SizeInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_SINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$else}
-procedure fpc_shortstr_longint(v : longint;len : StrLenInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_LONGINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_shortstr_longint(v : longint;len : SizeInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_LONGINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif}
 begin
   int_str(v,s);
@@ -362,12 +362,12 @@ begin
 end;
 
 {$ifdef STR_USES_VALINT}
-procedure fpc_shortstr_UInt(v : valUInt;len : StrLenInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_UINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_shortstr_UInt(v : valUInt;len : SizeInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_UINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$else}
   {$ifdef ver1_0}
-  procedure fpc_shortstr_cardinal(v : longword;len : StrLenInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_CARDINAL']; {$ifdef hascompilerproc} compilerproc; {$endif}
+  procedure fpc_shortstr_cardinal(v : longword;len : SizeInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_CARDINAL']; {$ifdef hascompilerproc} compilerproc; {$endif}
   {$else}
-  procedure fpc_shortstr_longword(v : longword;len : StrLenInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_LONGWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
+  procedure fpc_shortstr_longword(v : longword;len : SizeInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_LONGWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
   {$endif}
 {$endif}
 begin
@@ -402,7 +402,7 @@ end;
 
 {$I real2str.inc}
 
-procedure fpc_ShortStr_Float(d : ValReal;len,fr,rt : StrLenInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_FLOAT']; {$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
+procedure fpc_ShortStr_Float(d : ValReal;len,fr,rt : SizeInt;var s : shortstring);[public,alias:'FPC_SHORTSTR_FLOAT']; {$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
 begin
   str_real(len,fr,d,treal_type(rt),s);
 end;
@@ -413,13 +413,13 @@ end;
 }
 
 {$ifdef STR_USES_VALINT}
-procedure fpc_chararray_sint(v : valsint;len : StrLenInt;var a:array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_chararray_sint(v : valsint;len : SizeInt;var a:array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
 {$else}
-procedure fpc_chararray_longint(v : longint;len : StrLenInt;var a:array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_chararray_longint(v : longint;len : SizeInt;var a:array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif}
 var
   ss : shortstring;
-  maxlen : StrLenInt;
+  maxlen : SizeInt;
 begin
   int_str(v,ss);
   if length(ss)<len then
@@ -433,13 +433,13 @@ end;
 
 
 {$ifdef STR_USES_VALINT}
-procedure fpc_chararray_uint(v : valuint;len : StrLenInt;var a : array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_chararray_uint(v : valuint;len : SizeInt;var a : array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
 {$else}
-procedure fpc_chararray_longword(v : longword;len : StrLenInt;var a : array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_chararray_longword(v : longword;len : SizeInt;var a : array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif}
 var
   ss : shortstring;
-  maxlen : StrLenInt;
+  maxlen : SizeInt;
 begin
   int_str(v,ss);
   if length(ss)<len then
@@ -454,10 +454,10 @@ end;
 
 {$ifndef CPU64}
 
-procedure fpc_chararray_qword(v : qword;len : StrLenInt;var a : array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_chararray_qword(v : qword;len : SizeInt;var a : array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
 var
   ss : shortstring;
-  maxlen : StrLenInt;
+  maxlen : SizeInt;
 begin
   int_str(v,ss);
   if length(ss)<len then
@@ -470,10 +470,10 @@ begin
 end;
 
 
-procedure fpc_chararray_int64(v : int64;len : StrLenInt;var a : array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_chararray_int64(v : int64;len : SizeInt;var a : array of char);{$ifdef hascompilerproc} compilerproc; {$endif}
 var
   ss : shortstring;
-  maxlen : StrLenInt;
+  maxlen : SizeInt;
 begin
   int_str(v,ss);
   if length(ss)<len then
@@ -488,10 +488,10 @@ end;
 {$endif CPU64}
 
 
-procedure fpc_chararray_Float(d : ValReal;len,fr,rt : StrLenInt;var a : array of char);{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
+procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;var a : array of char);{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
 var
   ss : shortstring;
-  maxlen : StrLenInt;
+  maxlen : SizeInt;
 begin
   str_real(len,fr,d,treal_type(rt),ss);
   if length(ss)<high(a)+1 then
@@ -508,7 +508,7 @@ end;
 
 Function InitVal(const s:shortstring;var negativ:boolean;var base:byte):ValSInt;
 var
-  Code : StrLenInt;
+  Code : SizeInt;
 begin
 {Skip Spaces and Tab}
   code:=1;
@@ -550,7 +550,7 @@ begin
 end;
 
 
-Function fpc_Val_SInt_ShortStr(DestSize: StrLenInt; Const S: ShortString; var Code: ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_SHORTSTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Function fpc_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; var Code: ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_SHORTSTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
 var
   u, temp, prev, maxPrevValue, maxNewValue: ValUInt;
   base : byte;
@@ -597,14 +597,14 @@ begin
       1: fpc_Val_SInt_ShortStr := shortint(fpc_Val_SInt_ShortStr);
       2: fpc_Val_SInt_ShortStr := smallint(fpc_Val_SInt_ShortStr);
 {     Uncomment the folling once full 64bit support is in place
-      4: fpc_Val_SInt_ShortStr := StrLenInt(fpc_Val_SInt_ShortStr);}
+      4: fpc_Val_SInt_ShortStr := SizeInt(fpc_Val_SInt_ShortStr);}
     End;
 end;
 
 {$ifdef hascompilerproc}
 { we need this for fpc_Val_SInt_Ansistr and fpc_Val_SInt_WideStr because }
 { we have to pass the DestSize parameter on (JM)                         }
-Function fpc_Val_SInt_ShortStr(DestSize: StrLenInt; Const S: ShortString; var Code: ValSInt): ValSInt; [external name 'FPC_VAL_SINT_SHORTSTR'];
+Function fpc_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; var Code: ValSInt): ValSInt; [external name 'FPC_VAL_SINT_SHORTSTR'];
 {$endif hascompilerproc}
 
 
@@ -750,7 +750,7 @@ Function fpc_Val_Real_ShortStr(const s : shortstring; var code : ValSInt): ValRe
 var
   hd,
   esign,sign : valreal;
-  exponent,i : StrLenInt;
+  exponent,i : SizeInt;
   flags      : byte;
 begin
   fpc_Val_Real_ShortStr:=0.0;
@@ -849,7 +849,7 @@ fpc_Val_Real_ShortStr:=fpc_Val_Real_ShortStr*10+(ord(s[code])-ord('0'));
 end;
 
 
-Procedure SetString (Var S : Shortstring; Buf : PChar; Len : StrLenInt);
+Procedure SetString (Var S : Shortstring; Buf : PChar; Len : SizeInt);
 begin
   If Len > High(S) then
     Len := High(S);
@@ -862,7 +862,10 @@ end;
 
 {
   $Log$
-  Revision 1.29  2004-05-01 20:52:50  peter
+  Revision 1.30  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.29  2004/05/01 20:52:50  peter
     * ValSInt fixed for 64 bit
 
   Revision 1.28  2004/04/29 18:59:43  peter

+ 16 - 13
rtl/inc/strings.pp

@@ -18,7 +18,7 @@ unit strings;
 interface
 
     { Returns the length of a string }
-    function strlen(p : pchar) : strlenint;
+    function strlen(p : pchar) : SizeInt;
 
     { Converts a Pascal string to a null-terminated string }
     function strpcopy(d : pchar;const s : string) : pchar;
@@ -31,7 +31,7 @@ interface
 
     { Copies at most maxlen bytes from source to dest. }
     { Returns a pointer to dest }
-    function strlcopy(dest,source : pchar;maxlen : strlenint) : pchar;
+    function strlcopy(dest,source : pchar;maxlen : SizeInt) : pchar;
 
     { Copies source to dest and returns a pointer to the terminating }
     { null character.    }
@@ -47,19 +47,19 @@ interface
     { a value <0 if str1<str2;        }
     {  0 when str1=str2               }
     { and a value >0 if str1>str2     }
-    function strcomp(str1,str2 : pchar) : strlenint;
+    function strcomp(str1,str2 : pchar) : SizeInt;
 
     { The same as strcomp, but at most l characters are compared  }
-    function strlcomp(str1,str2 : pchar;l : strlenint) : strlenint;
+    function strlcomp(str1,str2 : pchar;l : SizeInt) : SizeInt;
 
     { The same as strcomp but case insensitive       }
-    function stricomp(str1,str2 : pchar) : strlenint;
+    function stricomp(str1,str2 : pchar) : SizeInt;
 
     { Copies l characters from source to dest, returns dest. }
-    function strmove(dest,source : pchar;l : strlenint) : pchar;
+    function strmove(dest,source : pchar;l : SizeInt) : pchar;
 
     { Appends at most l characters from source to dest }
-    function strlcat(dest,source : pchar;l : strlenint) : pchar;
+    function strlcat(dest,source : pchar;l : SizeInt) : pchar;
 
     { Returns a pointer to the first occurrence of c in p }
     { If c doesn't occur, nil is returned }
@@ -76,7 +76,7 @@ interface
     function strupper(p : pchar) : pchar;
 
     { The same al stricomp, but at most l characters are compared }
-    function strlicomp(str1,str2 : pchar;l : strlenint) : strlenint;
+    function strlicomp(str1,str2 : pchar;l : SizeInt) : SizeInt;
 
     { Returns a pointer to the first occurrence of str2 in    }
     { str2 Otherwise returns nil                          }
@@ -86,7 +86,7 @@ interface
     function strnew(p : pchar) : pchar;
 
     { Allocates L bytes on the heap, returns a pchar pointer to it }
-    function stralloc(L : strlenint) : pchar;
+    function stralloc(L : SizeInt) : pchar;
 
     { Releases a null-terminated string from the heap  }
     procedure strdispose(p : pchar);
@@ -112,7 +112,7 @@ implementation
 
 { Functions, different from the one in sysutils }
 
-    function stralloc(L : strlenint) : pchar;
+    function stralloc(L : SizeInt) : pchar;
 
       begin
          StrAlloc:=Nil;
@@ -122,7 +122,7 @@ implementation
     function strnew(p : pchar) : pchar;
 
       var
-         len : strlenint;
+         len : SizeInt;
 
       begin
          strnew:=nil;
@@ -148,11 +148,14 @@ end.
 
 {
   $Log$
-  Revision 1.7  2004-05-01 15:26:33  jonas
+  Revision 1.8  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.7  2004/05/01 15:26:33  jonas
     * use some more string routines from libc if FPC_USE_LIBC is used
 
   Revision 1.6  2004/02/18 22:00:59  peter
-    * use strlenint instead of longint
+    * use SizeInt instead of longint
 
   Revision 1.5  2003/07/07 20:22:05  peter
     * generic string routines added

+ 7 - 4
rtl/inc/stringsi.inc

@@ -21,7 +21,7 @@
         strcat:=dest;
       end;
 
-    function strlcat(dest,source : pchar;l : strlenint) : pchar;
+    function strlcat(dest,source : pchar;l : SizeInt) : pchar;
 
       var
          destend : pchar;
@@ -34,7 +34,7 @@
          strlcat:=dest;
       end;
 
-    function strmove(dest,source : pchar;l : strlenint) : pchar;
+    function strmove(dest,source : pchar;l : SizeInt) : pchar;
 
       begin
          move(source^,dest^,l);
@@ -66,8 +66,11 @@
 
 {
   $Log$
-  Revision 1.5  2004-02-18 22:00:59  peter
-    * use strlenint instead of longint
+  Revision 1.6  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.5  2004/02/18 22:00:59  peter
+    * use SizeInt instead of longint
 
   Revision 1.4  2003/12/29 19:24:12  florian
     + introduced PtrInt and PtrUInt

+ 41 - 40
rtl/inc/systemh.inc

@@ -173,8 +173,6 @@ Type
 {$endif CPUARM}
 
 {$ifdef CPU64}
-  StrLenInt = Int64;
-  StrLenUInt = QWord;
   SizeInt = Int64;
   SizeUInt = QWord;
   PtrInt = Int64;
@@ -184,8 +182,6 @@ Type
 {$endif CPU64}
 
 {$ifdef CPU32}
-  StrLenInt = Longint;
-  StrLenUInt = DWord;
   SizeInt = Longint;
   SizeUInt = DWord;
   PtrInt = Longint;
@@ -241,7 +237,9 @@ Type
   PCardinal           = ^Cardinal;
   PQWord              = ^QWord;
   PInt64              = ^Int64;
-
+  PPtrInt             = ^PtrInt;
+  PSizeInt            = ^SizeInt;
+  
   PPointer            = ^Pointer;
   PPPointer           = ^PPointer;
 
@@ -456,18 +454,18 @@ function strlen(p:pchar):longint;
 
 { Shortstring functions }
 {$ifndef INTERNSETLENGTH}
-Procedure SetLength (Var S:ShortString;len:StrLenInt);
+Procedure SetLength (Var S:ShortString;len:SizeInt);
 {$endif INTERNSETLENGTH}
 {$ifndef InternCopy}
-Function  Copy(const s:shortstring;index:StrLenInt;count:StrLenInt):shortstring;
+Function  Copy(const s:shortstring;index:SizeInt;count:SizeInt):shortstring;
 {$endif interncopy}
-Procedure Delete(Var s:shortstring;index:StrLenInt;count:StrLenInt);
-Procedure Insert(const source:shortstring;Var s:shortstring;index:StrLenInt);
-Procedure Insert(source:Char;Var s:shortstring;index:StrLenInt);
-Function  Pos(const substr:shortstring;const s:shortstring):StrLenInt;
-Function  Pos(C:Char;const s:shortstring):StrLenInt;
-Procedure SetString (Var S : Shortstring; Buf : PChar; Len : StrLenInt);
-Procedure SetString (Var S : AnsiString; Buf : PChar; Len : StrLenInt);
+Procedure Delete(Var s:shortstring;index:SizeInt;count:SizeInt);
+Procedure Insert(const source:shortstring;Var s:shortstring;index:SizeInt);
+Procedure Insert(source:Char;Var s:shortstring;index:SizeInt);
+Function  Pos(const substr:shortstring;const s:shortstring):SizeInt;
+Function  Pos(C:Char;const s:shortstring):SizeInt;
+Procedure SetString (Var S : Shortstring; Buf : PChar; Len : SizeInt);
+Procedure SetString (Var S : AnsiString; Buf : PChar; Len : SizeInt);
 {$ifndef INTERNLENGTH}
 Function  Length(s:string):byte;
 {$endif INTERNLENGTH}
@@ -486,9 +484,9 @@ Function  Chr(b:byte):Char;
 Function  upCase(c:Char):Char;
 Function  lowerCase(c:Char):Char; overload;
 {$ifndef InternCopy}
-function  copy(c:char;index : StrLenInt;count : StrLenInt): shortstring;
+function  copy(c:char;index : SizeInt;count : SizeInt): shortstring;
 {$endif interncopy}
-function  pos(const substr : shortstring;c:char): StrLenInt;
+function  pos(const substr : shortstring;c:char): SizeInt;
 {$ifndef INTERNLENGTH}
 function  length(c:char):byte;
 {$endif INTERNLENGTH}
@@ -499,20 +497,20 @@ function  length(c:char):byte;
 ****************************************************************************}
 
 {$ifndef INTERNSETLENGTH}
-Procedure SetLength (Var S : AnsiString; l : StrLenInt);
+Procedure SetLength (Var S : AnsiString; l : SizeInt);
 {$endif INTERNSETLENGTH}
 Procedure UniqueString (Var S : AnsiString);
 {$ifndef INTERNLENGTH}
-Function  Length (Const S : AnsiString) : StrLenInt;
+Function  Length (Const S : AnsiString) : SizeInt;
 {$endif INTERNLENGTH}
 {$ifndef InternCopy}
-Function  Copy (Const S : AnsiString; Index,Size : StrLenInt) : AnsiString;
+Function  Copy (Const S : AnsiString; Index,Size : SizeInt) : AnsiString;
 {$endif interncopy}
-Function  Pos (Const Substr : AnsiString; Const Source : AnsiString) : StrLenInt;
-Function  Pos (c : Char; Const s : AnsiString) : StrLenInt;
-Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : StrLenInt);
-Procedure Delete (Var S : AnsiString; Index,Size: StrLenInt);
-Function  StringOfChar(c : char;l : StrLenInt) : AnsiString;
+Function  Pos (Const Substr : AnsiString; Const Source : AnsiString) : SizeInt;
+Function  Pos (c : Char; Const s : AnsiString) : SizeInt;
+Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : SizeInt);
+Procedure Delete (Var S : AnsiString; Index,Size: SizeInt);
+Function  StringOfChar(c : char;l : SizeInt) : AnsiString;
 function  upcase(const s : ansistring) : ansistring;
 function  lowercase(const s : ansistring) : ansistring;
 
@@ -523,32 +521,32 @@ function  lowercase(const s : ansistring) : ansistring;
 
 {$ifdef HASWIDESTRING}
 {$ifndef INTERNSETLENGTH}
-Procedure SetLength (Var S : WideString; l : StrLenInt);
+Procedure SetLength (Var S : WideString; l : SizeInt);
 {$endif INTERNSETLENGTH}
 Procedure UniqueString (Var S : WideString);
 {$ifndef INTERNLENGTH}
-Function  Length (Const S : WideString) : StrLenInt;
+Function  Length (Const S : WideString) : SizeInt;
 {$endif INTERNLENGTH}
 {$ifndef InternCopy}
-Function  Copy (Const S : WideString; Index,Size : StrLenInt) : WideString;
+Function  Copy (Const S : WideString; Index,Size : SizeInt) : WideString;
 {$endif interncopy}
-Function  Pos (Const Substr : WideString; Const Source : WideString) : StrLenInt;
-Function  Pos (c : Char; Const s : WideString) : StrLenInt;
-Function  Pos (c : WideChar; Const s : WideString) : StrLenInt;
-Procedure Insert (Const Source : WideString; Var S : WideString; Index : StrLenInt);
-Procedure Delete (Var S : WideString; Index,Size: StrLenInt);
-Procedure SetString (Var S : WideString; Buf : PWideChar; Len : StrLenInt);
-Procedure SetString (Var S : WideString; Buf : PChar; Len : StrLenInt);
+Function  Pos (Const Substr : WideString; Const Source : WideString) : SizeInt;
+Function  Pos (c : Char; Const s : WideString) : SizeInt;
+Function  Pos (c : WideChar; Const s : WideString) : SizeInt;
+Procedure Insert (Const Source : WideString; Var S : WideString; Index : SizeInt);
+Procedure Delete (Var S : WideString; Index,Size: SizeInt);
+Procedure SetString (Var S : WideString; Buf : PWideChar; Len : SizeInt);
+Procedure SetString (Var S : WideString; Buf : PChar; Len : SizeInt);
 
 function WideCharToString(S : PWideChar) : AnsiString;
-function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : StrLenInt) : PWideChar;
-function WideCharLenToString(S : PWideChar;Len : StrLenInt) : AnsiString;
-procedure WideCharLenToStrVar(Src : PWideChar;Len : StrLenInt;var Dest : AnsiString);
+function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
+function WideCharLenToString(S : PWideChar;Len : SizeInt) : AnsiString;
+procedure WideCharLenToStrVar(Src : PWideChar;Len : SizeInt;var Dest : AnsiString);
 procedure WideCharToStrVar(S : PWideChar;var Dest : AnsiString);
 
 Type
-  TWide2AnsiMove=procedure(source:pwidechar;dest:pchar;len:StrLenInt);
-  TAnsi2WideMove=procedure(source:pchar;dest:pwidechar;len:StrLenInt);
+  TWide2AnsiMove=procedure(source:pwidechar;dest:pchar;len:SizeInt);
+  TAnsi2WideMove=procedure(source:pchar;dest:pwidechar;len:SizeInt);
 
   TWideStringManager = record
     Wide2AnsiMove : TWide2AnsiMove;
@@ -731,7 +729,10 @@ const
 
 {
   $Log$
-  Revision 1.90  2004-05-01 20:52:50  peter
+  Revision 1.91  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.90  2004/05/01 20:52:50  peter
     * ValSInt fixed for 64 bit
 
   Revision 1.89  2004/04/29 18:59:43  peter

+ 66 - 63
rtl/inc/wstrings.inc

@@ -21,9 +21,9 @@
   WideString is defined as a 'silent' pwidechar :
   a pwidechar that points to :
 
-  @-12 : StrLenInt for maximum size;
-  @-8  : StrLenInt for size;
-  @-4  : StrLenInt for reference count;
+  @-12 : SizeInt for maximum size;
+  @-8  : SizeInt for size;
+  @-4  : SizeInt for reference count;
   @    : String + Terminating #0;
   Pwidechar(Widestring) is a valid typecast.
   So WS[i] is converted to the address @WS+i-1.
@@ -37,7 +37,7 @@ Type
   TWideRec = Packed Record
     Maxlen,
     len,
-    ref   : StrLenInt;
+    ref   : SizeInt;
     First : WideChar;
   end;
 
@@ -53,9 +53,9 @@ Const
   These routines can be overwritten for the Current Locale
 }
 
-procedure Wide2AnsiMove(source:pwidechar;dest:pchar;len:StrLenInt);
+procedure Wide2AnsiMove(source:pwidechar;dest:pchar;len:SizeInt);
 var
-  i : StrLenInt;
+  i : SizeInt;
 begin
   for i:=1 to len do
    begin
@@ -69,9 +69,9 @@ begin
 end;
 
 
-procedure Ansi2WideMove(source:pchar;dest:pwidechar;len:StrLenInt);
+procedure Ansi2WideMove(source:pchar;dest:pwidechar;len:SizeInt);
 var
-  i : StrLenInt;
+  i : SizeInt;
 begin
   for i:=1 to len do
    begin
@@ -144,14 +144,14 @@ end;
 {$endif}
 
 
-Function NewWideString(Len : StrLenInt) : Pointer;
+Function NewWideString(Len : SizeInt) : Pointer;
 {
   Allocate a new WideString on the heap.
   initialize it to zero length and reference count 1.
 }
 Var
   P : Pointer;
-  l : StrLenInt;
+  l : SizeInt;
 begin
   { request a multiple of 16 because the heap manager alloctes anyways chunks of 16 bytes }
   L := (Len*sizeof(WideChar)+WideRecLen+15) and (not 15);
@@ -187,9 +187,9 @@ Procedure fpc_WideStr_Decr_Ref (Var S : Pointer);saveregisters;[Public,Alias:'FP
   If the reference count is zero, deallocate the string;
 }
 Type
-  pStrLenInt = ^StrLenInt;
+  pSizeInt = ^SizeInt;
 Var
-  l : pStrLenInt;
+  l : pSizeInt;
 Begin
   { Zero string }
   If S=Nil then exit;
@@ -226,12 +226,12 @@ end;
 Procedure fpc_WideStr_Incr_Ref (S : Pointer);saveregisters;[external name 'FPC_WIDESTR_INCR_REF'];
 {$endif compilerproc}
 
-function fpc_WideStr_To_ShortStr (high_of_res: StrLenInt;const S2 : WideString): shortstring;[Public, alias: 'FPC_WIDESTR_TO_SHORTSTR'];  {$ifdef hascompilerproc} compilerproc; {$endif}
+function fpc_WideStr_To_ShortStr (high_of_res: SizeInt;const S2 : WideString): shortstring;[Public, alias: 'FPC_WIDESTR_TO_SHORTSTR'];  {$ifdef hascompilerproc} compilerproc; {$endif}
 {
   Converts a WideString to a ShortString;
 }
 Var
-  Size : StrLenInt;
+  Size : SizeInt;
 begin
   if S2='' then
    fpc_WideStr_To_ShortStr:=''
@@ -251,7 +251,7 @@ Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; {$ifdef h
   Converts a ShortString to a WideString;
 }
 Var
-  Size : StrLenInt;
+  Size : SizeInt;
 begin
   Size:=Length(S2);
   Setlength (fpc_ShortStr_To_WideStr,Size);
@@ -277,7 +277,7 @@ Function fpc_WideStr_To_AnsiStr (const S2 : WideString): AnsiString; {$ifdef has
   Converts a WideString to an AnsiString
 }
 Var
-  Size : StrLenInt;
+  Size : SizeInt;
 begin
   if s2='' then
     exit;
@@ -305,7 +305,7 @@ Function fpc_AnsiStr_To_WideStr (Const S2 : AnsiString): WideString; {$ifdef has
   Converts an AnsiString to a WideString;
 }
 Var
-  Size : StrLenInt;
+  Size : SizeInt;
 begin
    if s2='' then
      exit;
@@ -322,7 +322,7 @@ end;
 { compilers with widestrings should have compiler procs }
 Function fpc_PWideChar_To_AnsiStr(const p : pwidechar): ansistring; compilerproc;
 var
-  Size : StrLenInt;
+  Size : SizeInt;
 begin
   if p=nil then
    exit;
@@ -339,7 +339,7 @@ end;
 
 Function fpc_PWideChar_To_WideStr(const p : pwidechar): widestring; compilerproc;
 var
-  Size : StrLenInt;
+  Size : SizeInt;
 begin
   if p=nil then
    exit;
@@ -356,7 +356,7 @@ end;
 
 Function fpc_PWideChar_To_ShortStr(const p : pwidechar): shortstring; compilerproc;
 var
-  Size : StrLenInt;
+  Size : SizeInt;
 begin
   if p=nil then
    begin
@@ -417,7 +417,7 @@ Procedure fpc_WideStr_Concat (S1,S2 : WideString;var S3 : WideString);[Public, a
   Result Goes to S3;
 }
 Var
-  Size,Location : StrLenInt;
+  Size,Location : SizeInt;
 begin
 { only assign if s1 or s2 is empty }
   if (S1='') then
@@ -462,7 +462,7 @@ end;
 
 Function fpc_PChar_To_WideStr(const p : pchar): WideString; {$ifdef hascompilerproc} compilerproc; {$endif}
 Var
-  L : StrLenInt;
+  L : SizeInt;
 begin
   if (not assigned(p)) or (p[0]=#0) Then
     { result is automatically set to '' }
@@ -483,7 +483,7 @@ end;
 
 Function fpc_CharArray_To_WideStr(const arr: array of char): WideString; {$ifdef hascompilerproc} compilerproc; {$endif}
 var
-  i  : StrLenInt;
+  i  : SizeInt;
 begin
   if arr[0]=#0 Then
     { result is automatically set to '' }
@@ -497,10 +497,10 @@ end;
 
 { old style helper }
 {$ifndef hascompilerproc}
-Procedure fpc_CharArray_To_WideStr(var a : WideString; p: pointer; len: StrLenInt); [Public,Alias : 'FPC_CHARARRAY_TO_WIDESTR'];  {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_CharArray_To_WideStr(var a : WideString; p: pointer; len: SizeInt); [Public,Alias : 'FPC_CHARARRAY_TO_WIDESTR'];  {$ifdef hascompilerproc} compilerproc; {$endif}
 var
   src: pchar;
-  i: StrLenInt;
+  i: SizeInt;
 begin
   src := pchar(p);
   if src[0]=#0 Then
@@ -519,9 +519,9 @@ end;
 {$ifdef hascompilerproc}
 { inside the compiler, the resulttype is modified to that of the actual }
 { chararray we're converting to (JM)                                    }
-function fpc_widestr_to_chararray(arraysize: StrLenInt; const src: WideString): fpc_big_chararray;[public,alias: 'FPC_WIDESTR_TO_CHARARRAY']; compilerproc;
+function fpc_widestr_to_chararray(arraysize: SizeInt; const src: WideString): fpc_big_chararray;[public,alias: 'FPC_WIDESTR_TO_CHARARRAY']; compilerproc;
 var
-  len: StrLenInt;
+  len: SizeInt;
 begin
   len := length(src);
   if len > arraysize then
@@ -533,7 +533,7 @@ begin
 end;
 {$endif hascompilerproc}
 
-Function fpc_WideStr_Compare(const S1,S2 : WideString): StrLenInt;[Public,Alias : 'FPC_WIDESTR_COMPARE']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Function fpc_WideStr_Compare(const S1,S2 : WideString): SizeInt;[Public,Alias : 'FPC_WIDESTR_COMPARE']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {
   Compares 2 WideStrings;
   The result is
@@ -542,7 +542,7 @@ Function fpc_WideStr_Compare(const S1,S2 : WideString): StrLenInt;[Public,Alias
    >0 if S1>S2
 }
 Var
-  MaxI,Temp : StrLenInt;
+  MaxI,Temp : SizeInt;
 begin
   if pointer(S1)=pointer(S2) then
    begin
@@ -567,16 +567,16 @@ begin
 end;
 
 
-Procedure fpc_WideStr_CheckRange(len,index : StrLenInt);[Public,Alias : 'FPC_WIDESTR_RANGECHECK']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_WideStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_WIDESTR_RANGECHECK']; {$ifdef hascompilerproc} compilerproc; {$endif}
 begin
   if (index>len) or (Index<1) then
     HandleErrorFrame(201,get_frame);
 end;
 
 {$ifndef INTERNSETLENGTH}
-Procedure SetLength (Var S : WideString; l : StrLenInt);
+Procedure SetLength (Var S : WideString; l : SizeInt);
 {$else INTERNSETLENGTH}
-Procedure fpc_WideStr_SetLength (Var S : WideString; l : StrLenInt);[Public,Alias : 'FPC_WIDESTR_SETLENGTH']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_WideStr_SetLength (Var S : WideString; l : SizeInt);[Public,Alias : 'FPC_WIDESTR_SETLENGTH']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif INTERNSETLENGTH}
 {
   Sets The length of string S to L.
@@ -584,7 +584,7 @@ Procedure fpc_WideStr_SetLength (Var S : WideString; l : StrLenInt);[Public,Alia
 }
 Var
   Temp : Pointer;
-  movelen, NewLen: StrLenInt;
+  movelen, NewLen: SizeInt;
 begin
    if (l>0) then
     begin
@@ -646,7 +646,7 @@ function WideCharToString(S : PWideChar) : AnsiString;
      result:=WideCharLenToString(s,Length(WideString(s)));
   end;
 
-function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : StrLenInt) : PWideChar;
+function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
   begin
      if Length(Src)<DestSize then
        Ansi2WideMoveProc(PChar(Src),Dest,Length(Src))
@@ -655,13 +655,13 @@ function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : Str
      result:=Dest;
   end;
 
-function WideCharLenToString(S : PWideChar;Len : StrLenInt) : AnsiString;
+function WideCharLenToString(S : PWideChar;Len : SizeInt) : AnsiString;
   begin
      SetLength(result,Len);
      Wide2AnsiMove(S,PChar(result),Len);
   end;
 
-procedure WideCharLenToStrVar(Src : PWideChar;Len : StrLenInt;var Dest : AnsiString);
+procedure WideCharLenToStrVar(Src : PWideChar;Len : SizeInt;var Dest : AnsiString);
   begin
      Dest:=WideCharLenToString(Src,Len);
   end;
@@ -673,7 +673,7 @@ procedure WideCharToStrVar(S : PWideChar;var Dest : AnsiString);
 
 
 {$ifndef INTERNLENGTH}
-Function Length (Const S : WideString) : StrLenInt;
+Function Length (Const S : WideString) : SizeInt;
 {
   Returns the length of an WideString.
   Takes in acount that zero strings are NIL;
@@ -697,7 +697,7 @@ Function fpc_widestr_Unique(Var S : Pointer): Pointer; [Public,Alias : 'FPC_WIDE
 }
 Var
   SNew : Pointer;
-  L    : StrLenInt;
+  L    : SizeInt;
 begin
   pointer(result) := pointer(s);
   If Pointer(S)=Nil then
@@ -716,9 +716,9 @@ end;
 
 
 {$ifdef interncopy}
-Function Fpc_WideStr_Copy (Const S : WideString; Index,Size : StrLenInt) : WideString;compilerproc;
+Function Fpc_WideStr_Copy (Const S : WideString; Index,Size : SizeInt) : WideString;compilerproc;
 {$else}
-Function Copy (Const S : WideString; Index,Size : StrLenInt) : WideString;
+Function Copy (Const S : WideString; Index,Size : SizeInt) : WideString;
 {$endif}
 var
   ResultAddress : Pointer;
@@ -752,9 +752,9 @@ begin
 end;
 
 
-Function Pos (Const Substr : WideString; Const Source : WideString) : StrLenInt;
+Function Pos (Const Substr : WideString; Const Source : WideString) : SizeInt;
 var
-  i,MaxLen : StrLenInt;
+  i,MaxLen : SizeInt;
   pc : pwidechar;
 begin
   Pos:=0;
@@ -779,9 +779,9 @@ end;
 
 
 { Faster version for a widechar alone }
-Function Pos (c : WideChar; Const s : WideString) : StrLenInt;
+Function Pos (c : WideChar; Const s : WideString) : SizeInt;
 var
-  i: StrLenInt;
+  i: SizeInt;
   pc : pwidechar;
 begin
   pc:=@s[1];
@@ -802,9 +802,9 @@ end;
 { pos(c: char; const s: shortstring) also exists, so otherwise   }
 { using pos(char,pchar) will always call the shortstring version }
 { (exact match for first argument), also with $h+ (JM)           }
-Function Pos (c : Char; Const s : WideString) : StrLenInt;
+Function Pos (c : Char; Const s : WideString) : SizeInt;
 var
-  i: StrLenInt;
+  i: SizeInt;
   wc : widechar;
   pc : pwidechar;
 begin
@@ -824,9 +824,9 @@ end;
 
 
 
-Procedure Delete (Var S : WideString; Index,Size: StrLenInt);
+Procedure Delete (Var S : WideString; Index,Size: SizeInt);
 Var
-  LS : StrLenInt;
+  LS : SizeInt;
 begin
   If Length(S)=0 then
    exit;
@@ -848,10 +848,10 @@ begin
 end;
 
 
-Procedure Insert (Const Source : WideString; Var S : WideString; Index : StrLenInt);
+Procedure Insert (Const Source : WideString; Var S : WideString; Index : SizeInt);
 var
   Temp : WideString;
-  LS : StrLenInt;
+  LS : SizeInt;
 begin
   If Length(Source)=0 then
    exit;
@@ -872,9 +872,9 @@ begin
 end;
 
 
-Procedure SetString (Var S : WideString; Buf : PWideChar; Len : StrLenInt);
+Procedure SetString (Var S : WideString; Buf : PWideChar; Len : SizeInt);
 var
-  BufLen: StrLenInt;
+  BufLen: SizeInt;
 begin
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
@@ -888,9 +888,9 @@ begin
 end;
 
 
-Procedure SetString (Var S : WideString; Buf : PChar; Len : StrLenInt);
+Procedure SetString (Var S : WideString; Buf : PChar; Len : SizeInt);
 var
-  BufLen: StrLenInt;
+  BufLen: SizeInt;
 begin
   SetLength(S,Len);
   If (Buf<>Nil) and (Len>0) then
@@ -934,7 +934,7 @@ begin
 end;
 
 
-Function fpc_Val_SInt_WideStr (DestSize: StrLenInt; Const S : WideString; Var Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_WIDESTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
+Function fpc_Val_SInt_WideStr (DestSize: SizeInt; Const S : WideString; Var Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_WIDESTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
 Var
   SS : ShortString;
 begin
@@ -983,7 +983,7 @@ end;
 {$endif CPU64}
 
 
-procedure fpc_WideStr_Float(d : ValReal;len,fr,rt : StrLenInt;var s : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
+procedure fpc_WideStr_Float(d : ValReal;len,fr,rt : SizeInt;var s : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
 var
   ss : shortstring;
 begin
@@ -993,9 +993,9 @@ end;
 
 
 {$ifdef STR_USES_VALINT}
-Procedure fpc_WideStr_SInt(v : ValSint; Len : StrLenInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_WideStr_SInt(v : ValSint; Len : SizeInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
 {$else}
-Procedure fpc_WideStr_Longint(v : Longint; Len : StrLenInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_WideStr_Longint(v : Longint; Len : SizeInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif}
 Var
   SS : ShortString;
@@ -1006,9 +1006,9 @@ end;
 
 
 {$ifdef STR_USES_VALINT}
-Procedure fpc_WideStr_UInt(v : ValUInt;Len : StrLenInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_WideStr_UInt(v : ValUInt;Len : SizeInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
 {$else}
-Procedure fpc_WideStr_Longword(v : Longword;Len : StrLenInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_WideStr_Longword(v : Longword;Len : SizeInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
 {$endif}
 Var
   SS : ShortString;
@@ -1020,7 +1020,7 @@ end;
 
 {$ifndef CPU64}
 
-Procedure fpc_WideStr_Int64(v : Int64; Len : StrLenInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_WideStr_Int64(v : Int64; Len : SizeInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
 Var
   SS : ShortString;
 begin
@@ -1029,7 +1029,7 @@ begin
 end;
 
 
-Procedure fpc_WideStr_Qword(v : Qword;Len : StrLenInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
+Procedure fpc_WideStr_Qword(v : Qword;Len : SizeInt; Var S : WideString);{$ifdef hascompilerproc} compilerproc; {$endif}
 Var
   SS : ShortString;
 begin
@@ -1041,7 +1041,10 @@ end;
 
 {
   $Log$
-  Revision 1.36  2004-04-29 18:59:43  peter
+  Revision 1.37  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.36  2004/04/29 18:59:43  peter
     * str() helpers now also use valint/valuint
     * int64/qword helpers disabled for cpu64
 

+ 8 - 5
rtl/objpas/sysutils/syspch.inc

@@ -85,8 +85,8 @@ end ;
 {  StrPLCopy copies MaxLen or less characters from the pascal string
    Source to Dest and returns Dest  }
 
-function StrPLCopy(Dest: PChar; Source: string; MaxLen: strlenuint): PChar;
-var Count: strlenuint;
+function StrPLCopy(Dest: PChar; Source: string; MaxLen: SizeUInt): PChar;
+var Count: SizeUInt;
 begin
 result := Dest;
 if (Result <> Nil) and (MaxLen <> 0) then begin
@@ -112,17 +112,20 @@ end;
 
 {  StrBufSize returns the amount of memory allocated for pchar Str allocated with StrAlloc  }
 
-function StrBufSize(Str: PChar): strlenuint;
+function StrBufSize(Str: PChar): SizeUInt;
 begin
   if Str <> Nil then
-   result := strlenuint(pointer(Str - SizeOf(strlenuint))^)-sizeof(strlenuint)
+   result := SizeUInt(pointer(Str - SizeOf(SizeUInt))^)-sizeof(SizeUInt)
   else
    result := 0;
 end ;
 
 {
   $Log$
-  Revision 1.2  2004-02-20 22:15:16  florian
+  Revision 1.3  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.2  2004/02/20 22:15:16  florian
     + x86_64 dependend sysutils part added
     * some 64 bit adaptions
 

+ 14 - 11
rtl/objpas/sysutils/syspchh.inc

@@ -22,36 +22,39 @@
 }
 
 { shared with strings unit }
-function strlen(p : pchar) : strlenint;
+function strlen(p : pchar) : SizeInt;
 function strcopy(dest,source : pchar) : pchar;
-function strlcopy(dest,source : pchar;maxlen : strlenint) : pchar;
+function strlcopy(dest,source : pchar;maxlen : SizeInt) : pchar;
 function strecopy(dest,source : pchar) : pchar;
 function strend(p : pchar) : pchar;
 function strcat(dest,source : pchar) : pchar;
-function strcomp(str1,str2 : pchar) : strlenint;
-function strlcomp(str1,str2 : pchar;l : strlenint) : strlenint;
-function stricomp(str1,str2 : pchar) : strlenint;
-function strmove(dest,source : pchar;l : strlenint) : pchar;
-function strlcat(dest,source : pchar;l : strlenint) : pchar;
+function strcomp(str1,str2 : pchar) : SizeInt;
+function strlcomp(str1,str2 : pchar;l : SizeInt) : SizeInt;
+function stricomp(str1,str2 : pchar) : SizeInt;
+function strmove(dest,source : pchar;l : SizeInt) : pchar;
+function strlcat(dest,source : pchar;l : SizeInt) : pchar;
 function strscan(p : pchar;c : char) : pchar;
 function strrscan(p : pchar;c : char) : pchar;
 function strlower(p : pchar) : pchar;
 function strupper(p : pchar) : pchar;
-function strlicomp(str1,str2 : pchar;l : strlenint) : strlenint;
+function strlicomp(str1,str2 : pchar;l : SizeInt) : SizeInt;
 function strpos(str1,str2 : pchar) : pchar;
 function strnew(p : pchar) : pchar;
 
 { Different from strings unit - ansistrings or different behaviour }
 function StrPas(Str: PChar): string;
 function StrPCopy(Dest: PChar; Source: string): PChar;
-function StrPLCopy(Dest: PChar; Source: string; MaxLen: strlenuint): PChar;
+function StrPLCopy(Dest: PChar; Source: string; MaxLen: SizeUInt): PChar;
 function StrAlloc(Size: cardinal): PChar;
-function StrBufSize(Str: PChar): strlenuint;
+function StrBufSize(Str: PChar): SizeUInt;
 procedure StrDispose(Str: PChar);
 
 {
   $Log$
-  Revision 1.2  2004-02-20 22:15:16  florian
+  Revision 1.3  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.2  2004/02/20 22:15:16  florian
     + x86_64 dependend sysutils part added
     * some 64 bit adaptions
 

+ 9 - 7
rtl/x86_64/strings.inc

@@ -17,7 +17,7 @@
  **********************************************************************}
 
 {$define FPC_UNIT_HAS_STRLEN}
-function strlen(p : pchar) : strlenint;assembler;
+function strlen(p : pchar) : SizeInt;assembler;
 {$i strlen.inc}
 
 
@@ -145,13 +145,12 @@ asm
 
 .LFPC_STRCOPY_4:
         movq        %rdi, %rax        { Source is return value.  }
-        retq
 end;
 
 
 {$define FPC_UNIT_HAS_STRCOMP}
 { Created from glibc: libc/sysdeps/x86_64/strcmp.S Version 1.2 }
-function StrComp(Str1, Str2: PChar): StrLenInt;assembler;
+function StrComp(Str1, Str2: PChar): SizeInt;assembler;
 asm
 .LFPC_STRCMP_LOOP:
         movb        (%rdi), %al
@@ -163,19 +162,22 @@ asm
         jnz         .LFPC_STRCMP_LOOP
 
         xorq        %rax, %rax
-        ret
+	jmp .Lexit
 
 .LFPC_STRCMP_NEG:
         movl        $1, %eax
         movl        $-1, %ecx
         cmovbl      %ecx, %eax
-        ret
+.Lexit:
 end;
 
 {
   $Log$
-  Revision 1.3  2004-02-18 22:00:59  peter
-    * use strlenint instead of longint
+  Revision 1.4  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.3  2004/02/18 22:00:59  peter
+    * use SizeInt instead of longint
 
   Revision 1.2  2003/04/30 22:11:06  florian
     + for a lot of x86-64 dependend files mostly dummies added

+ 4 - 2
rtl/x86_64/strlen.inc

@@ -128,13 +128,15 @@ asm
         incq %rax                { increment pointer }
 .LFPC_STRLEN_2:
         subq %rdi, %rax                { compute difference to string start }
-        ret
 end;
 
 
 {
   $Log$
-  Revision 1.2  2004-02-18 22:00:59  peter
+  Revision 1.3  2004-05-01 23:55:18  peter
+    * replace strlenint with sizeint
+
+  Revision 1.2  2004/02/18 22:00:59  peter
     * use strlenint instead of longint
 
   Revision 1.1  2003/04/30 16:36:39  florian