Register | Login
Forum Index > Bugs and Fixes > zironProc problem
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[592] zironProc problem - posted: 2011-11-11 15:51:29

i think i have to open this topic

Ziron did not detect function/procedure call with zironProc token.


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[601] - posted: 2011-11-11 18:40:54
i've just tested and it works...

sample plugin:

Code:
program WIN32DLL 'test PLUGIN';

#include 'strings.zir';
#include 'zirplug/framework.zir';
#include 'smm32.zir';


//////////////////////////////

const strLoaded = 'test plugin has loaded!';

//////////////////////////////


function event_callf() {
  char buf[64];
  buf = 0;

  eax = Ziron_ExpectNextToken(zironProc);
  if (eax <> -1) {
    strAppend(@buf, Ziron_GetStringValue(), 64);

    Ziron_ShowMessage(@buf);
    
  }

  return false; //returned false since this is just an example of detecting function call.
  
  //note ziron will output error unknown keyword callf because i returned false.
}

function InitPlugin(pointer pGetF) {
  Ziron_LoadAll(pGetF); //use framework utility function to load all

  //register our keyword
  Ziron_RegisterKeyword('callf', @event_callf);
  
  return strLoaded;
}

entry function DLLMain(DWord iDLL; DWord iReason; Pointer iResult) {
  if (iReason == DLL_PROCESS_ATTACH) {
    return true;
  }

  return false;
}

exports InitPlugin;


the test code i've just used:

Code:
program WIN32CUI 'test';

#include 'ch.zir'; 

///

function abc() {
  eax = true;
}


// our keyword.

callf abc();


wait_key(nil);
ExitProcess(0);



and the output shows

Code:
PlugSys: abc


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
[603] - posted: 2011-11-11 18:56:08
i did not mean that
Code:
callf abc();


i meant that calling inside an expression
Code:
function myFunc()
{
   global char Num[10] = '123';
   Eax = @Num;
}
let name = 'num is' & myFubc() 


so plugin did not detect function call here.

sorry i am not having my computer now to show you the plugin code.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[605] - posted: 2011-11-11 19:00:01
it is the same concept, just my plugin expression is smaller it expects it as first operand, but it will be the same for larger expression, i'm guessing there is a small problem with your code, once you are able to show me the code i will take a look and see if i can fix it 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
[611] - posted: 2011-11-11 20:17:41

here is the let code that did not detect function call
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, '(@' , @var, ', \'' , @str1, '\');' );
          Ziron_CallUFunc(U_strcpy, @buf);
      @lop:              
          eax = Ziron_IsNextLineBreak();
          if (!eax) {
              eax = Ziron_GetNextToken(); 
              case (eax) {
                    state zirAndSym:
                   // state zirPlusSym:  // already done by Ziron
                        buf=0;
                        Ziron_GetNextToken(); 
                        H_strcpy(@str1,Ziron_GetStringValue());   
                        H_strjoin(@buf, '(@' , @var, ', \'' , @str1, '\');' );
                        Ziron_CallUFunc(U_strcat, @buf);
                        break;
                    // remove ';' if found     
                    state zirSemi_Colon:
                        //Ziron_ShowMessage('found ;'); 
                        break; 
                   // is there a function call
                    state zironProc:   
                        Ziron_ShowMessage('found func'); 
                        break;  
                   
                    default:
                        Ziron_FatalError('Expected "+" or "&" or ";"');
                        return true;       
                }
               goto @lop;     
           }         
          return true;
   }
  else
   {   
      return false;                           // let Ziron handle the line  
   }  

}


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[645] - posted: 2011-11-11 23:24:59
i will take a look at this possibly tomorrow, right now i'm in the middle of rewriting a few of the handlers so i can't compile anything.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 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