mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 12:49:26 +01:00
pastojs: added $i %EnvVar%
git-svn-id: trunk@40488 -
This commit is contained in:
parent
58e50ef07e
commit
8d3c133caa
@ -2097,6 +2097,20 @@ var
|
||||
begin
|
||||
if (Param<>'') and (Param[1]='%') then
|
||||
begin
|
||||
if (length(Param)<3) or (Param[length(Param)]<>'%') then
|
||||
begin
|
||||
SetStr('');
|
||||
DoLog(mtWarning,nWarnIllegalCompilerDirectiveX,SWarnIllegalCompilerDirectiveX,
|
||||
['$i '+Param]);
|
||||
exit;
|
||||
end;
|
||||
if length(Param)>255 then
|
||||
begin
|
||||
SetStr('');
|
||||
DoLog(mtWarning,nWarnIllegalCompilerDirectiveX,SWarnIllegalCompilerDirectiveX,
|
||||
['$i '+copy(Param,1,255)+'...']);
|
||||
exit;
|
||||
end;
|
||||
case lowercase(Param) of
|
||||
'%date%':
|
||||
begin
|
||||
@ -2160,8 +2174,8 @@ begin
|
||||
exit;
|
||||
end;
|
||||
else
|
||||
DoLog(mtWarning,nWarnIllegalCompilerDirectiveX,SWarnIllegalCompilerDirectiveX,
|
||||
['$i '+Param]);
|
||||
SetStr(GetEnvironmentVariable(copy(Param,2,length(Param)-2)));
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
Result:=inherited HandleInclude(Param);
|
||||
|
||||
@ -2803,7 +2803,10 @@ End.
|
||||
<li>{$I %param%}:
|
||||
<ul>
|
||||
<li>%date%: current date as string literal, '[yyyy/mm/dd]'</li>
|
||||
<li>%time%: current time as string literal, 'hh:mm:ss'</li>
|
||||
<li>%time%: current time as string literal, 'hh:mm:ss'. Note that the
|
||||
inclusion of %date% and %time% will not cause the compiler to
|
||||
recompile the unit every time it is used:
|
||||
the date and time will be the date and time when the unit was last compiled.</li>
|
||||
<li>%file%: current source filename as string literal, e.g. <i>'unit1.pas'</i></li>
|
||||
<li>%line%: current source line number as string literal, e.g. <i>'123'</i></li>
|
||||
<li>%linenum%: current source line number as integer, e.g. <i>123</i></li>
|
||||
@ -2811,6 +2814,9 @@ End.
|
||||
<li>%pas2jstarget%, %pas2jstargetos%, %fpctarget%, %fpctargetos%: target os as string literal, e.g. 'Browser'</li>
|
||||
<li>%pas2jstargetcpu%, %fpctargetcpu%: target cpu as string literal, e.g. 'ECMAScript5'</li>
|
||||
<li>%pas2jsversion%, %fpcversion%: compiler version as strnig literal, e.g. '1.0.2'</li>
|
||||
<li>If param is none of the above it will use the environment variable.
|
||||
Keep in mind that depending on the platform the name may be case sensitive.
|
||||
If there is no such variable an empty string <i>''</i> is inserted.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>{$Warnings on|off}</li>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user