Modulinos: Difference between revisions
Content added Content deleted
m (added whitespace before the TOC (table of contents).) |
|||
Line 1,221: | Line 1,221: | ||
say ~LUE.^methods; |
say ~LUE.^methods; |
||
}</lang> |
}</lang> |
||
=={{header|Phix}}== |
|||
Here is a simple little dirty hack to do this. You can put the function in any file, but you have to call it from the right place. |
|||
<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 |
|||
printf(1,"This is %s\n",{{"An Include","Main"}[isMainOrInclude()+1]})</lang> |
|||
=={{header|PHP}}== |
=={{header|PHP}}== |