anything inside ' is classed as a literal string and will be passed regardless as size as a pointer to a string, however inside " will be converted do the ordinal, it will accept strings sized 1-4
i've just added it to the function i have from your main plugin post
function event_Dim() {
uses edi;
Dword Len;
char var[255];
char buf[1024];
char tmp[16];
repeat {
buf = 0; //make sure buf is initialized otherwise it may be filled with junk
tmp = 0;
eax = Ziron_ExpectNextToken(zirIdent);
if (eax == -1) {
Ziron_FatalError('Expected Variable Name');
return true;
}
H_strcpy(@var,Ziron_GetStringValue());
Ziron_ShowMessage(@var);
eax = Ziron_GetNextToken();
//push eax; Ziron_ShowMessage(@var); pop eax;
case (eax) {
/********* Dim Var as int32; **************/
state zirAs:
eax = Ziron_ExpectNextToken(zirDATA_TYPE);
if (eax == -1) {
Ziron_FatalError('Expected data type');
return true;
}
eax = Ziron_GetStringValue();
H_strcat(@buf,eax);
H_strcat(@buf,' ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k%; **************/
state zirModSym:
H_strcat(@buf,'int32 ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k$; **************/
state zirDollarSym:
H_strcat(@buf,'char ');
H_strcat(@buf,@var);
H_strcat(@buf,'[1024];');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k!; **************/
state zirExclamation:
H_strcat(@buf,'single ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k#; **************/
state zirHash:
H_strcat(@buf,'double ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k [1024] as char; **************/
state zirBracketOpen:
eax = Ziron_ExpectNextToken(zirNumber);
if (eax == -1) {
Ziron_FatalError('Expected max index number of array');
return true;
}
H_strcpy(@tmp,Ziron_GetStringValue());
eax = Ziron_ExpectNextToken(zirBracketClose);
if (eax == -1) {
Ziron_FatalError('Expected ]');
return true;
}
eax = Ziron_ExpectNextToken(zirAs);
if (eax == -1) {
Ziron_FatalError('Expected As');
return true;
}
eax = Ziron_ExpectNextToken(zirDATA_TYPE);
if (eax == -1) {
Ziron_FatalError('Expected data type');
return true;
}
eax = Ziron_GetStringValue();
H_strcat(@buf,eax);
H_strcat(@buf,' ');
H_strcat(@buf,@var);
H_strcat(@buf,'[');
H_strcat(@buf,@tmp);
H_strcat(@buf,']');
H_strcat(@buf,';');
Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* **************
//state zirIdent:
//eax = Ziron_GetStringValue();
//break;
/********* **************/
default:
Ziron_FatalError('Expected as Keyword');
return true;
}
eax = Ziron_IsNextLineBreak();
if (eax) {
break; // check end of line so we end without semicolon
}
eax = Ziron_PeekNextToken();
if (eax == zirCOMMA) {
Ziron_GetNextToken();
} else {
break;
}
};
return true;
}
and it works like a charm, i do not seem any problem, i just tested with
dim myarr[1024] as char
if you still have a problem, can you paste your whole event code?
ok here is the entire function, note i add code to pares \\\'=\\\' and \\\'*\\\'
function event_Dim() {
uses edi;
Dword Len;
char var[255];
char buf[1024];
char tmp[255];
repeat {
buf = 0;
// get the variable name and hold it in Var
eax = Ziron_ExpectNextToken(zirIdent);
if (eax == -1) {
Ziron_FatalError('Expected Variable Name');
return true;
}
H_strcpy(@var,Ziron_GetStringValue());
// get whatever after variable name
eax = Ziron_GetNextToken();
// let's pares it
// it can be one of those
// As % $ ! # []
case (eax) {
/********* Dim Var as int32; **************/
state zirAs:
eax = Ziron_ExpectNextToken(zirDATA_TYPE);
if (eax == -1) {
Ziron_FatalError('Expected data type');
return true;
}
eax = Ziron_GetStringValue();
H_strcat(@buf,eax);
H_strcat(@buf,' ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k%; **************/
state zirModSym:
H_strcat(@buf,'int32 ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k$; **************/
state zirDollarSym:
buf = 0;
H_strcat(@buf,'char ');
H_strcat(@buf,@var);
eax = Ziron_PeekNextToken();
if (eax == zirMulSym)
{
Ziron_GetNextToken(); // remove '*'
eax = Ziron_ExpectNextToken(zirNumber);
if (eax == -1) {
Ziron_FatalError('Expected number');
return true;
}
H_strcat(@buf,'[');
H_strcat(@buf,Ziron_GetStringValue());
H_strcat(@buf,'];');
}
else
{
H_strcat(@buf,'[1024];');
}
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k!; **************/
state zirExclamation:
H_strcat(@buf,'single ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k#; **************/
state zirHash:
H_strcat(@buf,'double ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k [1024] as char; **************/
state zirBracketOpen:
eax = Ziron_ExpectNextToken(zirNumber);
if (eax == -1) {
Ziron_FatalError('Expected max index number of array');
return true;
}
H_strcpy(@tmp,Ziron_GetStringValue());
eax = Ziron_ExpectNextToken(zirBracketClose);
if (eax == -1) {
Ziron_FatalError('Expected ]');
return true;
}
eax = Ziron_ExpectNextToken(zirAs);
if (eax == -1) {
Ziron_FatalError('Expected As');
return true;
}
eax = Ziron_ExpectNextToken(zirDATA_TYPE);
if (eax == -1) {
Ziron_FatalError('Expected data type');
return true;
}
eax = Ziron_GetStringValue();
H_strcat(@buf,eax);
H_strcat(@buf,' ');
H_strcat(@buf,@var);
H_strcat(@buf,'[');
H_strcat(@buf,@tmp);
H_strcat(@buf,']');
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* **************
//state zirIdent:
//eax = Ziron_GetStringValue();
//break;
/********* **************/
default:
Ziron_FatalError('Expected as Keyword');
return true;
}
eax = Ziron_IsNextLineBreak();
if (eax) {
break; // check end of line so we end without semicolon
}
eax = Ziron_PeekNextToken();
/********* pares Assignment '=' **************/
if (eax == zirAssignment)
{
Ziron_GetNextToken();
eax = Ziron_ExpectNextToken(zirNumber);
if (eax == -1) {
Ziron_FatalError('Expected max index number of array');
return true;
}
H_strcpy(@tmp,Ziron_GetStringValue());
H_strcpy(@buf,@var);
H_strcat(@buf,' = ');
H_strcat(@buf,@tmp);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
}
if (eax == zirCOMMA) {
Ziron_GetNextToken();
} else {
break;
}
};
return true;
}
I have just compiled that function you posted and it had no compile errors. Can you explain the problem you have when compiling, and can you quote the exact error message you receive?