|
@@ -968,11 +968,11 @@ type
|
|
constructor create_int(v: int64);
|
|
constructor create_int(v: int64);
|
|
constructor create_uint(v: qword);
|
|
constructor create_uint(v: qword);
|
|
constructor create_bool(b: boolean);
|
|
constructor create_bool(b: boolean);
|
|
- constructor create_str(s: string);
|
|
|
|
|
|
+ constructor create_str(const s: string);
|
|
constructor create_set(ns: tnormalset);
|
|
constructor create_set(ns: tnormalset);
|
|
constructor create_real(r: bestreal);
|
|
constructor create_real(r: bestreal);
|
|
- class function try_parse_number(s:string):texprvalue; static;
|
|
|
|
- class function try_parse_real(s:string):texprvalue; static;
|
|
|
|
|
|
+ class function try_parse_number(const s:string):texprvalue; static;
|
|
|
|
+ class function try_parse_real(const s:string):texprvalue; static;
|
|
function evaluate(v:texprvalue;op:ttoken):texprvalue;
|
|
function evaluate(v:texprvalue;op:ttoken):texprvalue;
|
|
procedure error(expecteddef, place: string);
|
|
procedure error(expecteddef, place: string);
|
|
function isBoolean: Boolean;
|
|
function isBoolean: Boolean;
|
|
@@ -1087,7 +1087,7 @@ type
|
|
def:=booldef;
|
|
def:=booldef;
|
|
end;
|
|
end;
|
|
|
|
|
|
- constructor texprvalue.create_str(s: string);
|
|
|
|
|
|
+ constructor texprvalue.create_str(const s: string);
|
|
var
|
|
var
|
|
sp: pansichar;
|
|
sp: pansichar;
|
|
len: integer;
|
|
len: integer;
|
|
@@ -1120,7 +1120,7 @@ type
|
|
def:=realdef;
|
|
def:=realdef;
|
|
end;
|
|
end;
|
|
|
|
|
|
- class function texprvalue.try_parse_number(s:string):texprvalue;
|
|
|
|
|
|
+ class function texprvalue.try_parse_number(const s:string):texprvalue;
|
|
var
|
|
var
|
|
ic: int64;
|
|
ic: int64;
|
|
qc: qword;
|
|
qc: qword;
|
|
@@ -1141,7 +1141,7 @@ type
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
- class function texprvalue.try_parse_real(s:string):texprvalue;
|
|
|
|
|
|
+ class function texprvalue.try_parse_real(const s:string):texprvalue;
|
|
var
|
|
var
|
|
d: bestreal;
|
|
d: bestreal;
|
|
code: integer;
|
|
code: integer;
|
|
@@ -1648,7 +1648,7 @@ type
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
- function preproc_substitutedtoken(searchstr:string;eval:Boolean):texprvalue;
|
|
|
|
|
|
+ function preproc_substitutedtoken(const basesearchstr:string;eval:Boolean):texprvalue;
|
|
{ Currently this parses identifiers as well as numbers.
|
|
{ Currently this parses identifiers as well as numbers.
|
|
The result from this procedure can either be that the token
|
|
The result from this procedure can either be that the token
|
|
itself is a value, or that it is a compile time variable/macro,
|
|
itself is a value, or that it is a compile time variable/macro,
|
|
@@ -1661,20 +1661,23 @@ type
|
|
macrocount,
|
|
macrocount,
|
|
len: integer;
|
|
len: integer;
|
|
foundmacro: boolean;
|
|
foundmacro: boolean;
|
|
|
|
+ searchstr: pshortstring;
|
|
|
|
+ searchstr2store: string;
|
|
begin
|
|
begin
|
|
if not eval then
|
|
if not eval then
|
|
begin
|
|
begin
|
|
- result:=texprvalue.create_str(searchstr);
|
|
|
|
|
|
+ result:=texprvalue.create_str(basesearchstr);
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ searchstr := @basesearchstr;
|
|
mac:=nil;
|
|
mac:=nil;
|
|
foundmacro:=false;
|
|
foundmacro:=false;
|
|
{ Substitue macros and compiler variables with their content/value.
|
|
{ Substitue macros and compiler variables with their content/value.
|
|
For real macros also do recursive substitution. }
|
|
For real macros also do recursive substitution. }
|
|
macrocount:=0;
|
|
macrocount:=0;
|
|
repeat
|
|
repeat
|
|
- mac:=tmacro(search_macro(searchstr));
|
|
|
|
|
|
+ mac:=tmacro(search_macro(searchstr^));
|
|
|
|
|
|
inc(macrocount);
|
|
inc(macrocount);
|
|
if macrocount>max_macro_nesting then
|
|
if macrocount>max_macro_nesting then
|
|
@@ -1695,13 +1698,14 @@ type
|
|
len:=mac.buflen;
|
|
len:=mac.buflen;
|
|
hs[0]:=char(len);
|
|
hs[0]:=char(len);
|
|
move(mac.buftext^,hs[1],len);
|
|
move(mac.buftext^,hs[1],len);
|
|
- searchstr:=upcase(hs);
|
|
|
|
|
|
+ searchstr2store:=upcase(hs);
|
|
|
|
+ searchstr:=@searchstr2store;
|
|
mac.is_used:=true;
|
|
mac.is_used:=true;
|
|
foundmacro:=true;
|
|
foundmacro:=true;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- Message1(scan_e_error_macro_lacks_value,searchstr);
|
|
|
|
|
|
+ Message1(scan_e_error_macro_lacks_value,searchstr^);
|
|
break;
|
|
break;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -1713,12 +1717,12 @@ type
|
|
|
|
|
|
{ At this point, result do contain the value. Do some decoding and
|
|
{ At this point, result do contain the value. Do some decoding and
|
|
determine the type.}
|
|
determine the type.}
|
|
- result:=texprvalue.try_parse_number(searchstr);
|
|
|
|
|
|
+ result:=texprvalue.try_parse_number(searchstr^);
|
|
if not assigned(result) then
|
|
if not assigned(result) then
|
|
begin
|
|
begin
|
|
- if foundmacro and (searchstr='FALSE') then
|
|
|
|
|
|
+ if foundmacro and (searchstr^='FALSE') then
|
|
result:=texprvalue.create_bool(false)
|
|
result:=texprvalue.create_bool(false)
|
|
- else if foundmacro and (searchstr='TRUE') then
|
|
|
|
|
|
+ else if foundmacro and (searchstr^='TRUE') then
|
|
result:=texprvalue.create_bool(true)
|
|
result:=texprvalue.create_bool(true)
|
|
else if (m_mac in current_settings.modeswitches) and
|
|
else if (m_mac in current_settings.modeswitches) and
|
|
(not assigned(mac) or not mac.defined) and
|
|
(not assigned(mac) or not mac.defined) and
|
|
@@ -1726,11 +1730,11 @@ type
|
|
begin
|
|
begin
|
|
{Errors in mode mac is issued here. For non macpas modes there is
|
|
{Errors in mode mac is issued here. For non macpas modes there is
|
|
more liberty, but the error will eventually be caught at a later stage.}
|
|
more liberty, but the error will eventually be caught at a later stage.}
|
|
- Message1(scan_e_error_macro_undefined,searchstr);
|
|
|
|
- result:=texprvalue.create_str(searchstr); { just to have something }
|
|
|
|
|
|
+ Message1(scan_e_error_macro_undefined,searchstr^);
|
|
|
|
+ result:=texprvalue.create_str(searchstr^); { just to have something }
|
|
end
|
|
end
|
|
else
|
|
else
|
|
- result:=texprvalue.create_str(searchstr);
|
|
|
|
|
|
+ result:=texprvalue.create_str(searchstr^);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|