no problem, i am happy to help :)
Replies
your function that i tested with just now
function event_Dim() {
char var[255];
char buf[1024];
buf = 0; //make sure buf is initialized otherwise it may be filled with junk
eax = Ziron_ExpectNextToken(zirIdent);
if (eax == -1) {
Ziron_FatalError('Expected Variable Name');
return true;
}
H_strcpy(@var,Ziron_GetStringValue());
eax = Ziron_ExpectNextToken(zirAs);
if (eax == -1) {
Ziron_FatalError('Expected as Keyword');
return true;
}
eax = Ziron_ExpectNextToken(zirDATA_TYPE);
if (eax == -1) {
Ziron_FatalError('Expected data type');
return true;
}
eax = Ziron_GetStringValue();
strAppend(@buf,eax,1023);
if (eax == false) {
Ziron_FatalError('strAppend failed\r\n');
}
strAppend(@buf,' ',1023);
if (eax == false) {
Ziron_FatalError('strAppend failed\r\n');
}
strAppend(@buf,@var,1023);
if (eax == false) {
Ziron_FatalError('strAppend failed\r\n');
}
strAppend(@buf,';',1023);
if (eax == false) {
Ziron_FatalError('strAppend failed\r\n');
}
Ziron_Execute(@buf, strLen(@buf));
return true;
}
yes , and here is a test program , works as expected.
program WIN32CUI 'test';
#include 'console.zir';
eax = 1;
print('eax = ', eax:int, '\r\n');
Dim Var as int32;
Var = 1000;
print('Var = ', Var, '\r\n');
wait_key(nil);
ExitProcess(0);
http://www.freewebs.com/ogremagic/index.htm
note that if you want to enforce the semi colon ";" you will also need to do a expectNextToken, however in such case i don't think it is required, usually enforcement of semi colon is only useful when there is several different uses of a keyword, e.g. for mov opcode,
anyways, looking good, look forward to see what else you add :)