ZirToken
A community discussion post from the original code:zIRON forum.
Replies
OK, i've updated the beta package and i've added 2 new pf functions....
Ziron_RegisterUFunction
This function is called with 1 parameter, your code for your function and returns a ufunc id, which you will need to store for later..
e.g.
DWord U_myFunc;
//later calling to register your functions.
U_myFunc = Ziron_RegisterUFunction('function myFunc(dword a; dword b) { return a; }');
and then to call them is a new function.
Ziron_CallUFunc
This function takes 2 parameters, 1 is the U_ID and the second is the parameter code, this should be called as if calling a regular function only without a name, using the U_ID as first param instead. This function returns true when call is successful.
e.g.
eax = Ziron_CallUFunc(U_myFunc, '(25, 65)');
//eax is true, now we know that the assembled eax would equal 25, since myFunc first param is returned, if we wanted to move it we can do...
Ziron_Execute('ecx = eax;');
and that's all there is too it, very simple :)
the reason you are not detecting the + sym is because ziron already is putting Emil and halim together and removing the plus sym.
this is strang, when plugin take the control it should handle the line as it wants , for example,suppose my basic plugin will handle 'str1' + 'str2' in deferent way as zrion do.
how can i use those 2 new function in my pluhin?
BTW , how to detect a function call inside a Let line , this does not work as wanted
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, 'H_strcpy(@' , @var, ', \'' , @str1, '\');' );
@lop:
eax = Ziron_IsNextLineBreak();
if (!eax) {
eax = Ziron_GetNextToken();
case (eax) {
//state zirPlusSym:
state zirComma:
Ziron_GetNextToken();
H_strcpy(@str1,Ziron_GetStringValue());
H_strjoin(@buf, ' H_strcat(@' , @var, ', \'' , @str1, '\');' );
break;
// remove ';' if found
state zirSemi_Colon:
//Ziron_ShowMessage('found ;');
break;
// this does not works as expected
state zirFunction:
Ziron_ShowMessage('found func');
break;
default:
Ziron_FatalError('Expected "+" or "&" or ";"');
return true;
}
goto @lop;
}
Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('error in let statment');
return true;
}
return true;
}
else
{
return false; // let Ziron handle the line
}
}
http://www.freewebs.com/ogremagic/index.htm
so i can call like this
Let c = 'Emil' , ' ' , 'halim' , StrToFloat('1.22');
http://www.freewebs.com/ogremagic/index.htm
this is strang, when plugin take the control it should handle the line as it wants , for example,suppose my basic plugin will handle 'str1' + 'str2' in deferent way as zrion do.
before the plug-in even gets control, Ziron has already folded constants, this is normal behavior and will not be changed.
why Ziron can detect taAndSym just like + , .....etc
http://www.freewebs.com/ogremagic/index.htm
i don't understand your question, if you mean does it already, then yes, in the update i made it detects &, &&, | and ||