mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 02:29:12 +02:00
+ added Str() helpers for 32-bit ints for 16/8-bit CPUs
git-svn-id: branches/i8086@24008 -
This commit is contained in:
parent
8fa9105151
commit
4dfbf148f2
@ -1190,6 +1190,30 @@ end;
|
||||
|
||||
{$endif CPU64}
|
||||
|
||||
{$if defined(CPU16) or defined(CPU8)}
|
||||
Procedure fpc_AnsiStr_LongWord(v : LongWord;Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_LONGWORD']; compilerproc; {$IFNDEF VER2_0} Inline; {$ENDIF}
|
||||
Var
|
||||
SS : ShortString;
|
||||
begin
|
||||
str(v:Len,SS);
|
||||
S:=SS;
|
||||
{$ifdef FPC_HAS_CPSTRING}
|
||||
SetCodePage(s,cp,false);
|
||||
{$endif FPC_HAS_CPSTRING}
|
||||
end;
|
||||
|
||||
Procedure fpc_AnsiStr_LongInt(v : LongInt; Len : SizeInt; out S : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING});[Public,Alias : 'FPC_ANSISTR_LONGINT']; compilerproc; {$IFNDEF VER2_0} Inline; {$ENDIF}
|
||||
Var
|
||||
SS : ShortString;
|
||||
begin
|
||||
str (v:Len,SS);
|
||||
S:=SS;
|
||||
{$ifdef FPC_HAS_CPSTRING}
|
||||
SetCodePage(s,cp,false);
|
||||
{$endif FPC_HAS_CPSTRING}
|
||||
end;
|
||||
{$endif CPU16 or CPU8}
|
||||
|
||||
Procedure Delete(Var S : RawByteString; Index,Size: SizeInt);
|
||||
Var
|
||||
LS : SizeInt;
|
||||
|
@ -125,6 +125,25 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : RawByteStri
|
||||
procedure fpc_UnicodeStr_int64(v : int64;len : SizeInt;out s : UnicodeString); compilerproc;
|
||||
{$endif FPC_HAS_FEATURE_WIDESTRINGS}
|
||||
{$endif CPU64}
|
||||
{$if defined(CPU16) or defined(CPU8)}
|
||||
procedure fpc_shortstr_longword(v : longword;len : SizeInt;out s : shortstring); compilerproc;
|
||||
procedure fpc_shortstr_longint(v : longint;len : SizeInt;out s : shortstring); compilerproc;
|
||||
procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of char); compilerproc;
|
||||
procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of char); compilerproc;
|
||||
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
|
||||
procedure fpc_ansistr_longword(v : longword;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
|
||||
procedure fpc_ansistr_longint(v : longint;len : SizeInt;out s : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
|
||||
{$endif FPC_HAS_FEATURE_ANSISTRINGS}
|
||||
|
||||
{$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
|
||||
{$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
||||
procedure fpc_widestr_longword(v : longword;len : SizeInt;out s : widestring); compilerproc;
|
||||
procedure fpc_widestr_longint(v : longint;len : SizeInt;out s : widestring); compilerproc;
|
||||
{$endif ndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
||||
procedure fpc_UnicodeStr_longword(v : longword;len : SizeInt;out s : UnicodeString); compilerproc;
|
||||
procedure fpc_UnicodeStr_longint(v : longint;len : SizeInt;out s : UnicodeString); compilerproc;
|
||||
{$endif FPC_HAS_FEATURE_WIDESTRINGS}
|
||||
{$endif CPU16 or CPU8}
|
||||
{$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
|
||||
{$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
||||
{$ifndef FPUNONE}
|
||||
|
@ -448,6 +448,23 @@ end;
|
||||
|
||||
{$endif CPU64}
|
||||
|
||||
{$if defined(CPU16) or defined(CPU8)}
|
||||
procedure fpc_shortstr_longword(v : longword;len : SizeInt;out s : shortstring);[public,alias:'FPC_SHORTSTR_LONGWORD']; compilerproc;
|
||||
begin
|
||||
int_str_unsigned(v,s);
|
||||
if length(s)<len then
|
||||
s:=space(len-length(s))+s;
|
||||
end;
|
||||
|
||||
|
||||
procedure fpc_shortstr_longint(v : longint;len : SizeInt;out s : shortstring);[public,alias:'FPC_SHORTSTR_LONGINT']; compilerproc;
|
||||
begin
|
||||
int_str(v,s);
|
||||
if length(s)<len then
|
||||
s:=space(len-length(s))+s;
|
||||
end;
|
||||
{$endif CPU16 or CPU8}
|
||||
|
||||
|
||||
{ fpc_shortstr_sInt must appear before this file is included, because }
|
||||
{ it's used inside real2str.inc and otherwise the searching via the }
|
||||
@ -869,6 +886,42 @@ end;
|
||||
{$endif CPU64}
|
||||
|
||||
|
||||
{$if defined(CPU16) or defined(CPU8)}
|
||||
|
||||
procedure fpc_chararray_longword(v : longword;len : SizeInt;out a : array of char);compilerproc;
|
||||
var
|
||||
ss : shortstring;
|
||||
maxlen : SizeInt;
|
||||
begin
|
||||
int_str_unsigned(v,ss);
|
||||
if length(ss)<len then
|
||||
ss:=space(len-length(ss))+ss;
|
||||
if length(ss)<high(a)+1 then
|
||||
maxlen:=length(ss)
|
||||
else
|
||||
maxlen:=high(a)+1;
|
||||
fpc_shortstr_chararray_intern_charmove(ss,a,maxlen);
|
||||
end;
|
||||
|
||||
|
||||
procedure fpc_chararray_longint(v : longint;len : SizeInt;out a : array of char);compilerproc;
|
||||
var
|
||||
ss : shortstring;
|
||||
maxlen : SizeInt;
|
||||
begin
|
||||
int_str(v,ss);
|
||||
if length(ss)<len then
|
||||
ss:=space(len-length(ss))+ss;
|
||||
if length(ss)<high(a)+1 then
|
||||
maxlen:=length(ss)
|
||||
else
|
||||
maxlen:=high(a)+1;
|
||||
fpc_shortstr_chararray_intern_charmove(ss,a,maxlen);
|
||||
end;
|
||||
|
||||
{$endif CPU16 or CPU8}
|
||||
|
||||
|
||||
{$ifndef FPUNONE}
|
||||
procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;out a : array of char);compilerproc;
|
||||
var
|
||||
|
@ -1557,6 +1557,28 @@ end;
|
||||
{$endif CPU64}
|
||||
|
||||
|
||||
{$if defined(CPU16) or defined(CPU8)}
|
||||
|
||||
Procedure fpc_UnicodeStr_LongInt(v : LongInt; Len : SizeInt; out S : UnicodeString);compilerproc;
|
||||
Var
|
||||
SS: ShortString;
|
||||
begin
|
||||
Str (v:Len,SS);
|
||||
S:=UnicodeString(SS);
|
||||
end;
|
||||
|
||||
|
||||
Procedure fpc_UnicodeStr_LongWord(v : LongWord;Len : SizeInt; out S : UnicodeString);compilerproc;
|
||||
Var
|
||||
SS: ShortString;
|
||||
begin
|
||||
str(v:Len,SS);
|
||||
S:=UnicodeString(SS);
|
||||
end;
|
||||
|
||||
{$endif CPU16 or CPU8}
|
||||
|
||||
|
||||
function UnicodeToUtf8(Dest: PChar; Source: PUnicodeChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
begin
|
||||
if assigned(Source) then
|
||||
|
Loading…
Reference in New Issue
Block a user