The code of macro T1 can execute successfully in both qm and exe,
but the code of macro T2 only executes successfully under qm and returns empty in exe.
The purpose of creating the `gr` function is just to be more concise.
Macro T1
Macro T2
Function gr
Function getRetCode
but the code of macro T2 only executes successfully under qm and returns empty in exe.
The purpose of creating the `gr` function is just to be more concise.
Macro T1
Macro T2
Function gr
Function getRetCode
function $macro str&code [context]
#exe addtextof "<script>"
#opt nowarnings 1
opt noerrorshere 1
if(!macro or (macro>=0x10000 and !macro[0]))
,int iid=+getopt(itemid -iif(context context 2))
else
,iid=qmitem(macro 1); if(!iid) end ERR_MACRO
code.getmacro(iid)
int n i=findrx(code "^#ret\b.*[]" 0 8 _i)
if i>=0
,i+_i-2
,code[i]=0; n=numlines(code)-1; code[i]=13
,code.replace(_s.all(n 2 10) 0 i)
else if 0=findrx(code "^[ ;]*[/\\](?![/\*]).*[]" 0 0 _i)
,code.remove(0 _i-2)
code.trim
