zironProc problem
i think i have to open this topic
Ziron did not detect function/procedure call with zironProc token.
http://www.freewebs.com/ogremagic/index.htm
A community discussion post from the original code:zIRON forum.
i think i have to open this topic
Ziron did not detect function/procedure call with zironProc token.
http://www.freewebs.com/ogremagic/index.htm
i've just tested and it works...
sample plugin:
program WIN32DLL 'test PLUGIN';
#include 'strings.zir';
#include 'zirplug/framework.zir';
#include 'smm32.zir';
//////////////////////////////
const strLoaded = 'test plugin has loaded!';
//////////////////////////////
function event_callf() {
char buf[64];
buf = 0;
eax = Ziron_ExpectNextToken(zironProc);
if (eax <> -1) {
strAppend(@buf, Ziron_GetStringValue(), 64);
Ziron_ShowMessage(@buf);
}
return false; //returned false since this is just an example of detecting function call.
//note ziron will output error unknown keyword callf because i returned false.
}
function InitPlugin(pointer pGetF) {
Ziron_LoadAll(pGetF); //use framework utility function to load all
//register our keyword
Ziron_RegisterKeyword('callf', @event_callf);
return strLoaded;
}
entry function DLLMain(DWord iDLL; DWord iReason; Pointer iResult) {
if (iReason == DLL_PROCESS_ATTACH) {
return true;
}
return false;
}
exports InitPlugin;
the test code i've just used:
program WIN32CUI 'test';
#include 'ch.zir';
///
function abc() {
eax = true;
}
// our keyword.
callf abc();
wait_key(nil);
ExitProcess(0);
and the output shows
PlugSys: abc
i did not mean that
callf abc();
i meant that calling inside an expression
function myFunc()
{
global char Num[10] = '123';
Eax = @Num;
}
let name = 'num is' & myFubc()
so plugin did not detect function call here.
sorry i am not having my computer now to show you the plugin code.
http://www.freewebs.com/ogremagic/index.htm
it is the same concept, just my plugin expression is smaller it expects it as first operand, but it will be the same for larger expression, i'm guessing there is a small problem with your code, once you are able to show me the code i will take a look and see if i can fix it :)
here is the let code that did not detect function call
function event_Let() {
uses edi;
char buf[2048];
char var[255];
char str1[255];
Dword Len;
boolean StringFlg;
// get the variable name and hold it in Var
eax = Ziron_GetNextToken();
case (eax) {
state zironVar:
state zironLocalVar:
break;
default:
Ziron_FatalError('Expected Variable Name');
return true;
}
H_strcpy(@var,Ziron_GetStringValue());
StringFlg = strCmp(Ziron_GetVarTypeString(Ziron_GetID()),'char');
// check for'=' symbol
eax = Ziron_ExpectNextToken(zirAssignment);
if (eax == -1) {
Ziron_FatalError('Expected = symbol');
return true;
}
// start pares if the var type is string
if(StringFlg)
{
// here we start getting what after '='
Ziron_GetNextToken();
H_strcpy(@str1,Ziron_GetStringValue());
buf=0;
H_strjoin(@buf, '(@' , @var, ', \'' , @str1, '\');' );
Ziron_CallUFunc(U_strcpy, @buf);
@lop:
eax = Ziron_IsNextLineBreak();
if (!eax) {
eax = Ziron_GetNextToken();
case (eax) {
state zirAndSym:
// state zirPlusSym: // already done by Ziron
buf=0;
Ziron_GetNextToken();
H_strcpy(@str1,Ziron_GetStringValue());
H_strjoin(@buf, '(@' , @var, ', \'' , @str1, '\');' );
Ziron_CallUFunc(U_strcat, @buf);
break;
// remove ';' if found
state zirSemi_Colon:
//Ziron_ShowMessage('found ;');
break;
// is there a function call
state zironProc:
Ziron_ShowMessage('found func');
break;
default:
Ziron_FatalError('Expected "+" or "&" or ";"');
return true;
}
goto @lop;
}
return true;
}
else
{
return false; // let Ziron handle the line
}
}
http://www.freewebs.com/ogremagic/index.htm
i will take a look at this possibly tomorrow, right now i'm in the middle of rewriting a few of the handlers so i can't compile anything.