Register | Login
Forum Index > Requests and Feedback > ZirToken
Author Message
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[562] - posted: 2011-11-10 13:47:05
ps.

Code:
char* mystr = 'test ' + 'this' + 13 + 10;
print('msg = ', mystr);


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[563] - posted: 2011-11-10 14:29:28
OK, i've updated the beta package and i've added 2 new pf functions....

Ziron_RegisterUFunction
This function is called with 1 parameter, your code for your function and returns a ufunc id, which you will need to store for later..

e.g.
Code:
DWord U_myFunc;

//later calling to register your functions.
U_myFunc = Ziron_RegisterUFunction('function myFunc(dword a; dword b) { return a; }');


and then to call them is a new function.

Ziron_CallUFunc
This function takes 2 parameters, 1 is the U_ID and the second is the parameter code, this should be called as if calling a regular function only without a name, using the U_ID as first param instead. This function returns true when call is successful.

e.g.
Code:
eax = Ziron_CallUFunc(U_myFunc, '(25, 65)');

//eax is true, now we know that the assembled eax would equal 25, since myFunc first param is returned, if we wanted to move it we can do...

Ziron_Execute('ecx = eax;');


and that's all there is too it, very simple smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[564] - posted: 2011-11-10 16:02:51

the reason you are not detecting the + sym is because ziron already is putting Emil and halim together and removing the plus sym.

this is strang, when plugin take the control it should handle the line as it wants , for example,suppose my basic plugin will handle 'str1' + 'str2' in deferent way as zrion do.

how can i use those 2 new function in my pluhin?

BTW , how to detect a function call inside a Let line , this does not work as wanted
Code:
function event_Let() {
  uses edi;
  char buf[2048];
  char var[255];
  char str1[255];
  Dword Len;
  boolean StringFlg;  
    
  // get the variable name and hold it in Var 
  eax = Ziron_GetNextToken();
  case (eax) {
            state zironVar:
            state zironLocalVar:
                  break;
            default:
                  Ziron_FatalError('Expected Variable Name');
                  return true;
   }
  H_strcpy(@var,Ziron_GetStringValue());   
     
  StringFlg = strCmp(Ziron_GetVarTypeString(Ziron_GetID()),'char');
   
  // check for'=' symbol 
  eax = Ziron_ExpectNextToken(zirAssignment);
  if (eax == -1) {
           Ziron_FatalError('Expected =  symbol');
           return true;
   }
       
  // start pares if the var type is string
  if(StringFlg)
   {
          // here we start getting what after '=' 
          Ziron_GetNextToken(); 
          H_strcpy(@str1,Ziron_GetStringValue());

          buf=0;
          H_strjoin(@buf, 'H_strcpy(@' , @var, ', \'' , @str1, '\');' );
      @lop:              
          eax = Ziron_IsNextLineBreak();
          if (!eax) {
              eax = Ziron_GetNextToken(); 
              case (eax) {
                    //state zirPlusSym:
                    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; 
                // this does not works as expected   
                    state zirFunction:   
                        Ziron_ShowMessage('found func'); 
                        break;  
                   
                    default:
                        Ziron_FatalError('Expected "+" or "&" or ";"');
                        return true;       
                }
               goto @lop;     
           }         
          Ziron_ShowMessage(@buf); 
          Len = H_strlen(@buf);    
          eax = Ziron_Execute(@buf,Len);
          if (eax == false) {
              Ziron_FatalError('error in let statment');
             return true;
          }
          return true;
   }
  else
   {   
      return false;                           // let Ziron handle the line  
   }  

}



http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[565] - posted: 2011-11-10 16:19:42
so i can call like this
Code:
Let  c = 'Emil' , ' ' , 'halim' ,  StrToFloat('1.22');


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[566] - posted: 2011-11-10 16:23:29

this is strang, when plugin take the control it should handle the line as it wants , for example,suppose my basic plugin will handle 'str1' + 'str2' in deferent way as zrion do.


before the plug-in even gets control, Ziron has already folded constants, this is normal behavior and will not be changed.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[567] - posted: 2011-11-10 16:32:21

why Ziron can detect taAndSym just like + , .....etc

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[568] - posted: 2011-11-10 16:42:43
i don't understand your question, if you mean does it already, then yes, in the update i made it detects &, &&, | and ||

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[569] - posted: 2011-11-10 16:45:06

yes that what i meant.

thanks.

http://www.freewebs.com/ogremagic/index.htm
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 9 user(s) online. 0 member(s) and 9 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd