Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

ZirToken

A community discussion post from the original code:zIRON forum.

Replies

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

sorry , does Ziron detect thsose symbols & && || |

i got that error

[325,30]: Unknown Identifier "71" in [basic.zir] Code: taAndSym:
eax = Ziron_GetNextToken(); 
              case (eax) {
                    taAndSym:
                    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; 
                   /*
                    state zirFunction:   
                        Ziron_ShowMessage('found func'); 
                        break;  
                   */
                    default:
                        Ziron_FatalError('Expected "+" or "&" or ";"');
                        return true;       
                }

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

& = zirAndSym

&& = taDoubleAndSym

| = taPipe

|| = taDoublePipe

i see your error - i sugest you check your code more often before posting it....

case (eax) {
                    taAndSym:
                    state zirComma:

you are missing state... your out outputing the value of taAndSym - btw i've fixed this and changed them to zirAndSym. I sugest you change the framework file and replace ta to zir, ta is old test prefix.

ps:

           case (eax) {
                    state zirAndSym:
                    state zirComma:
Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , now it works good.

1- Ziron_RegisterUFunction & Ziron_CallUFunc , how can i make use of them.

2- is there a way to detect a function call in let expression , something like this

function dummy()
{
  global char d = ' there';  
  Eax=@d;
}


Let Name = 'hello ' , dummy()

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

detecting a function call is

zironProc

not zirFunction... zirFunction is the keyword 'function'

as for UFunc yes you can use them.

  const sc_code = 'function  H_strcpy(Dword dst,src) { Eax = dst; Edx = src; push Eax; BL = [Edx]; while ( BL != 0) { [Eax] = BL; Eax++; Edx++; BL = [Edx]; } [Eax] = 0; pop Eax; }'; 
    Ziron_Execute(@sc_code,H_strlen(@sc_code));

instead of this...

first you will need to save your function id's global scope, so outside of the function, accessible to the callbacks.

DWord U_strcpy;

and then in init..

  const sc_code = 'function  H_strcpy(Dword dst,src) { Eax = dst; Edx = src; push Eax; BL = [Edx]; while ( BL != 0) { [Eax] = BL; Eax++; Edx++; BL = [Edx]; } [Eax] = 0; pop Eax; }'; 
    Ziron_RegisterUFunction(sc_code);

then in your callbacks instead of executing a function call, you use the CallUFunc functions.

so

 // here we start getting what after '=' 
          Ziron_GetNextToken(); 
          H_strcpy(@str1,Ziron_GetStringValue());

          eax = Ziron_IsNextLineBreak();
          if (!eax) {
              Ziron_GetNextToken(); // remove ';'
           }         
          buf=0;
          H_strjoin(@buf, 'H_strcpy(@' , @var, ', \'' , @str1, '\');' );

this would be something like....

          // here we start getting what after '=' 
          Ziron_GetNextToken(); 
          H_strcpy(@str1,Ziron_GetStringValue());

          eax = Ziron_IsNextLineBreak();
          if (!eax) {
              Ziron_GetNextToken(); // remove ';'
           }         
          buf=0;
          H_strjoin(@buf, '(', @var, ',', @str1, ')'); //build param string "(par1, par2)"
          Ziron_CallUFunc(U_strcpy, @buf);
Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok ,i got it now, have a question to make things clear for me

in my code

 const sc_code = 'function  H_strcpy(Dword dst,src) { Eax = dst; Edx = src; push Eax; BL = [Edx]; while ( BL != 0) { [Eax] = BL; Eax++; Edx++; BL = [Edx]; } [Eax] = 0; pop Eax; }'; 
    Ziron_Execute(@sc_code,H_strlen(@sc_code));

at execution time it is exist with code, the function H_strcpy is part of code , so when

you type this

 H_strjoin(@buf, 'H_strcpy(@' , @var, ', \'' , @str1, '\');' );

you just type code that will use the H_strcpy at run time.

does Ziron_RegisterUFunction & Ziron_CallUFunc work the same way ?

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

yes it is the same except it is nameless so it does not interfere with users code... so if they have a h_strcpy it won't affect it...

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

zironProc does not make any difference , ziron does not detect function call .

http://www.freewebs.com/ogremagic/index.htm

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt
it does not interfere with users code.

very good , you are so smart.

http://www.freewebs.com/ogremagic/index.htm