mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 00:09:31 +02:00
+ emit_pchar_const() helper for high level typed const builder
git-svn-id: trunk@32899 -
This commit is contained in:
parent
c863cd5bc8
commit
508038a691
@ -331,6 +331,8 @@ type
|
||||
|
||||
{ emit a shortstring constant, and return its def }
|
||||
function emit_shortstring_const(const str: shortstring): tdef;
|
||||
{ emit a pchar string constant (the characters, not a pointer to them), and return its def }
|
||||
function emit_pchar_const(str: pchar; len: pint): tdef;
|
||||
{ emit a guid constant }
|
||||
procedure emit_guid_const(const guid: tguid);
|
||||
{ emit a procdef constant }
|
||||
@ -1522,6 +1524,18 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function ttai_typedconstbuilder.emit_pchar_const(str: pchar; len: pint): tdef;
|
||||
begin
|
||||
result:=carraydef.getreusable(cansichartype,len+1);
|
||||
maybe_begin_aggregate(result);
|
||||
if len=0 then
|
||||
emit_tai(Tai_const.Create_8bit(0),cansichartype)
|
||||
else
|
||||
emit_tai(Tai_string.Create_pchar(str,len+1),result);
|
||||
maybe_end_aggregate(result);
|
||||
end;
|
||||
|
||||
|
||||
procedure ttai_typedconstbuilder.emit_guid_const(const guid: tguid);
|
||||
var
|
||||
i: longint;
|
||||
|
Loading…
Reference in New Issue
Block a user