adding string assignment to Ziron is good idea ,
what do you mean by term
unnamed functions
, is it away to allow us handling
assignment and expressions from plugin ?
http://www.freewebs.com/ogremagic/index.htm
A community discussion post from the original code:zIRON forum.
adding string assignment to Ziron is good idea ,
what do you mean by term
unnamed functions
, is it away to allow us handling
assignment and expressions from plugin ?
http://www.freewebs.com/ogremagic/index.htm
no it is a way to have functions in plugins that do not affect source functions, i will explain in detail once done
ok , but is there a way to handle expression from plugIn?
http://www.freewebs.com/ogremagic/index.htm
you could pre-process the files
I think ziron will need to have a special string type and handled with special care, lets take this into account
char* myStr;
myStr = strUpper('Testing this string'); //myStr points a constant 19 bytes
print('myStr = ', myStr, '\r\n');
string assignment is already possible as you see, but this uses constant strings and so on... so i think ziron needs a special 'string' type that needs to be initialized and handled differently to other data types.
maybe if when a string is created it is 4+length. e.g.
string = [dword][data];
the first 4 bytes would contain how much memory has been allocated for this string, ziron could then keep track of this when referencing a string and do an automatic check to see if more space needs allocated, else a string would be referenced with a 4 byte offset.
e.g.
string myStr;
myStr = 'testing';
the following string would be initialized with a default string length, lets say 4+32=36 characters. then [myStr+4] is copied 'testing' and the first 4 bytes will be set to 32
now lets say we do
myStr = 'This is a longer string that will not fit into the 32 character buffer so will need to be extended';
first ziron will product code to check the length of the new string or using sizeof if it is a constant, which then will product code to check the allocated size of memory for the string.
pseudo e.g.
eax = [mystring_address];
if (total_new > eax) {
eax = total_new + allign to 32 byte boundary
reallocate old string to new buffer and free old buffer
set first 4 bytes to new size
}
anyways i think i will need to carefully think about this
Ok , pascal and HLa-asm uses an other way of zero terminated string. something like this
block string
{
DWord strLen;
char* strAddr;
}
so if you have a variable that holds a string pointer , you can get it's Len by seeing the
address before the pointer.
BCX , has an other way , already convert it to ziron, by function H_GetTmpStr.
every time you call H_GetTmpStr it will allocate a new string with desired length , it has
pointer table that stores pointers in it and if it exceed it's boundary it will free the first one in the table and allocate a new one. here is the the H_GetTmpStr code.
function H_GetTmpStr(DWord sizeInByte)
{
uses Ebx Ecx;
global int32 StrCnt;
global char* StrFunc[2048];
Eax = StrCnt;
Eax++;
and Eax,2047
StrCnt = Eax;
Ebx = @StrFunc;
lea Ebx,[Ebx+Eax]
Eax=DWord[Ebx];
if( Eax> 0)
{
freemem( Eax);
}
[Ebx]= malloc(sizeInByte);
}
actually i prefer it.
http://www.freewebs.com/ogremagic/index.htm
i will add some new event functions such as....
onVariable
onLocal
onRegister
each of them will be fired when lets say:
eax = 1;
onRegister would be fired before anything is processed here, but not inside of calls or other code so...
mov eax, 5
this code would not be affected by the event, only when a register is the start of a new command, for higher level code, this would allow for you to write assignment plugins and so on....
good idea ,
BTW does Ziron keep track of global variables, local variables , local addresses, global
addresses in a tables.
and if so can we access to them from plugin ?
http://www.freewebs.com/ogremagic/index.htm