mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:29:13 +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 }
|
{ emit a shortstring constant, and return its def }
|
||||||
function emit_shortstring_const(const str: shortstring): tdef;
|
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 }
|
{ emit a guid constant }
|
||||||
procedure emit_guid_const(const guid: tguid);
|
procedure emit_guid_const(const guid: tguid);
|
||||||
{ emit a procdef constant }
|
{ emit a procdef constant }
|
||||||
@ -1522,6 +1524,18 @@ implementation
|
|||||||
end;
|
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);
|
procedure ttai_typedconstbuilder.emit_guid_const(const guid: tguid);
|
||||||
var
|
var
|
||||||
i: longint;
|
i: longint;
|
||||||
|
Loading…
Reference in New Issue
Block a user