Ziron_GetID is a id for the internal data, so it is not valid for anything else, only for Ziron_GetVarTypeString for now.
ZirToken
A community discussion post from the original code:zIRON forum.
Replies
as for strComp we could have something like:
function strCmp(char* s1, s2) {
uses edi esi;
esi = s1;
edi = s2;
lodsb
while (char[edi] == al) {
lodsb
edi++;
if (al == 0) { break; }
}
if (al == 0 and char[edi] == 0) {
xinc eax;
} else {
eax = xor;
}
}
i will add it to strings.zir next release, will improve it over time :)
thank you.
BTW , i was did it in sphinx C-- like this
int fastcall strcmp2(ESI,EDI) // mixed asm & C
{
AL = DSBYTE[ESI];
while(AL==DSBYTE[EDI])
{
if(AL==0) return 0;
ESI++; EDI++;
AL = DSBYTE[ESI];
}
return DSBYTE[ESI] - DSBYTE[EDI];
}
hope Ziron will be close to sphinx C--
http://www.freewebs.com/ogremagic/index.htm
i dont think that would give correct results. Also the assembled code will be larger.
why you did not think so
here is my full example
/***************************************
* Sphinx C-- *
* *
* strcmp demo By Emil Halim *
* 23 / 9 / 2011 *
***************************************/
#pragma option w32 //create Windows GUI EXE.
#pragma option OBJ //create OBJ file
#pragma option OS //speed optimization
#pragma option J0 //no startup code.
#include <Windows.h>
#pragma option ia // allow inline asm
#pragma option LST
extern cdecl _printf();
#define printf _printf
/***************
s > t >>> > 0
s = t >>> = 0
s < t >>> < 0
***************/
int strcmp1(char *s, char *t) // pure C code
{
for( ;byte *s == byte *t; s++, t++)
if (byte *s == '\0') return 0;
return DSBYTE[s] - DSBYTE[t];
}
int fastcall strcmp2(ESI,EDI) // mixed asm & C
{
AL = DSBYTE[ESI];
while(AL==DSBYTE[EDI])
{
if(AL==0) return 0;
ESI++; EDI++;
AL = DSBYTE[ESI];
}
return DSBYTE[ESI] - DSBYTE[EDI];
}
char* testStr1 = "SPHINX C-- is so easy (an intermediate position between Assembler and C)";
char* testStr2 = "SPHINX C-- is so easy (an intermediate position between Assembler and C)";
main()
{
_start:
printf("string length is %d\n",strcmp1( testStr1 , testStr2 ));
printf("string length is %d\n",strcmp2( testStr1 , testStr2 ));
MessageBox(0,"","",0);
}
http://www.freewebs.com/ogremagic/index.htm
try your strcmp with both variations of
str1 = "test "
str2 = "test"
then
str1 = "test"
str2 = "test "
tell me result, or maybe i do not understand something, what is dsbyte ? i assume like char[esi] ?
yes , you are wright.
BTW , dsbyte[esi] is like char[esi]
http://www.freewebs.com/ogremagic/index.htm