Executable library: Difference between revisions
Content added Content deleted
(→{{header|Scala}}: migrate to Scala 2.13) |
(→{{header|Phix}}: now builtin (0.8.1+)) |
||
Line 1,294: | Line 1,294: | ||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Simply test whether include_file() returns 1. hail.exw: |
|||
hail.exw: |
|||
⚫ | |||
<lang Phix>function isMainOrInclude() |
|||
-- returns 1 if called from the main file, 0 if from an include |
|||
integer res |
|||
#ilASM{ |
|||
[32] |
|||
mov eax,[ebp+20] -- prev_ebp |
|||
mov eax,[eax+8] -- rtn |
|||
mov [res],eax |
|||
[64] |
|||
mov rax,[rbp+40] -- prev_ebp |
|||
mov rax,[rax+16] -- rtn |
|||
mov [res],rax |
|||
[] |
|||
} |
|||
return res=21 -- (21=T_maintls) |
|||
end function |
|||
⚫ | |||
function hailstone(atom n) |
function hailstone(atom n) |
||
sequence s = {n} |
sequence s = {n} |
||
Line 1,339: | Line 1,322: | ||
end function |
end function |
||
if |
if include_file()==1 then |
||
sequence s = hailstone(27) |
sequence s = hailstone(27) |