mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-10 21:38:18 +02:00
* added str(enum,charray) and export str(enum,ansistr/widestr/unicodestr)
(mantis #15504) * fixed result parameter of str(enum,ansistr) helper (was shortstring) git-svn-id: trunk@14629 -
This commit is contained in:
parent
28cd8271c9
commit
08a4ede9c4
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10220,6 +10220,7 @@ tests/webtbs/tw15415.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15446.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15453a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15467.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw15504.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1567.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1573.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1592.pp svneol=native#text/plain
|
||||
|
@ -929,7 +929,7 @@ begin
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
procedure fpc_ansistr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:shortstring);[public,alias:'FPC_ANSISTR_ENUM'];compilerproc; {$IFNDEF VER2_0} Inline; {$ENDIF}
|
||||
procedure fpc_ansistr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:ansistring);[public,alias:'FPC_ANSISTR_ENUM'];compilerproc; {$IFNDEF VER2_0} Inline; {$ENDIF}
|
||||
|
||||
var ss:shortstring;
|
||||
|
||||
|
@ -112,6 +112,7 @@ procedure fpc_AnsiStr_uint(v : valuint;Len : SizeInt; out S : AnsiString); compi
|
||||
{$ifndef FPUNONE}
|
||||
procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : ansistring); compilerproc;
|
||||
{$endif}
|
||||
procedure fpc_ansistr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:ansistring); compilerproc;
|
||||
{$ifdef FPC_HAS_STR_CURRENCY}
|
||||
procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : ansistring); compilerproc;
|
||||
{$endif FPC_HAS_STR_CURRENCY}
|
||||
@ -154,6 +155,7 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : ansistring)
|
||||
{$ifndef FPUNONE}
|
||||
procedure fpc_WideStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : WideString); compilerproc;
|
||||
{$endif}
|
||||
procedure fpc_widestr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:widestring);compilerproc;
|
||||
{$ifdef FPC_HAS_STR_CURRENCY}
|
||||
procedure fpc_WideStr_Currency(c : Currency;len,fr : SizeInt;out s : WideString);compilerproc;
|
||||
{$endif FPC_HAS_STR_CURRENCY}
|
||||
@ -162,6 +164,7 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : ansistring)
|
||||
{$ifndef FPUNONE}
|
||||
procedure fpc_UnicodeStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : UnicodeString); compilerproc;
|
||||
{$endif}
|
||||
procedure fpc_unicodestr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:unicodestring);compilerproc;
|
||||
{$ifdef FPC_HAS_STR_CURRENCY}
|
||||
procedure fpc_UnicodeStr_Currency(c : Currency;len,fr : SizeInt;out s : UnicodeString);compilerproc;
|
||||
{$endif FPC_HAS_STR_CURRENCY}
|
||||
@ -171,6 +174,7 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : ansistring)
|
||||
{$ifndef FPUNONE}
|
||||
procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;out a : array of char); compilerproc;
|
||||
{$endif}
|
||||
procedure fpc_chararray_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out a : array of char);compilerproc;
|
||||
{$ifdef FPC_HAS_STR_CURRENCY}
|
||||
procedure fpc_chararray_Currency(c : Currency;len,fr : SizeInt;out a : array of char);compilerproc;
|
||||
{$endif FPC_HAS_STR_CURRENCY}
|
||||
|
@ -767,6 +767,21 @@ begin
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
||||
procedure fpc_chararray_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out a : array of char);compilerproc;
|
||||
var
|
||||
ss : shortstring;
|
||||
maxlen : SizeInt;
|
||||
begin
|
||||
fpc_shortstr_enum(ordinal,len,typinfo,ord2strindex,ss);
|
||||
if length(ss)<high(a)+1 then
|
||||
maxlen:=length(ss)
|
||||
else
|
||||
maxlen:=high(a)+1;
|
||||
move(ss[1],pchar(@a)^,maxlen);
|
||||
end;
|
||||
|
||||
|
||||
{$ifdef FPC_HAS_STR_CURRENCY}
|
||||
procedure fpc_chararray_Currency(c : Currency;len,fr : SizeInt;out a : array of char);compilerproc;
|
||||
var
|
||||
|
32
tests/webtbs/tw15504.pp
Normal file
32
tests/webtbs/tw15504.pp
Normal file
@ -0,0 +1,32 @@
|
||||
program strtest;
|
||||
|
||||
{$MODE OBJFPC}
|
||||
{$LONGSTRINGS ON}
|
||||
|
||||
{$ifdef unix}
|
||||
uses CWstring;
|
||||
{$endif}
|
||||
|
||||
type
|
||||
tEnum = (North, East, South, West);
|
||||
|
||||
var s0: shortstring;
|
||||
s1: widestring;
|
||||
s2: ansistring;
|
||||
s3: array[3..7] of char;
|
||||
e: tEnum;
|
||||
|
||||
begin
|
||||
e := West; Str(e, s0);
|
||||
if s0<>'West' then
|
||||
halt(1);
|
||||
e := East; Str(e, s1);
|
||||
if s1<>'East' then
|
||||
halt(2);
|
||||
e := South; Str(e, s2);
|
||||
if s2<>'South' then
|
||||
halt(3);
|
||||
e:= North; Str(e, s3);
|
||||
if s3<>'North' then
|
||||
halt(4);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user