Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Source Help

assignment detecting

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

assignment detecting

Hi Mr Colin.

i made this to detecting assignment but seems that it does not work?

plugins off;

program WIN32DLL 'test PLUGIN';

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

const strLoaded = 'dummy plugin has loaded!';

function token_Assign()
{
  char  line[2048];
  int32 linelen;
  linelen = Ziron_ExtractLine(@line, 2048);
  Ziron_ShowMessage(@line);
  return false; // let Ziron handle the line  
}

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

     //register token
     //Ziron_RegisterUserToken('=', @token_Assign);
	
    //register our keyword
    Ziron_RegisterKeyword('=', @token_Assign);
    
	return strLoaded;
}

have tried both Ziron_RegisterUserToken & Ziron_RegisterKeyword but no detecting.

any help please?

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

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

from plugin_interface.rtf:

1.6. function Ziron_RegisterKeyword(char* name; pointer callback): DWord; stdcall; Parameter 1: The keyword for the token, should not contain any special characters. usable letters: a-z, _, 0-9, note the keyword must start with a letter from a-z. Parameter 2: A pointer to the callback function. The callback function is declared with no parameters and stdcall. e.g. function myCallback() { Result is a reference ID to the keyword.

because the internal text processor works on byte to byte basis, it would be very slow to have a callback and keyword events based on characters.

This sort of thing would be best to be pre-processed by the plugin using the event "ProgramEntry", Ziron_Execute can be called from this event, but note that you must manually process all of the buffer and then execute it:

3.4. procedure ProgramEntry(char* apptype); stdcall; This procedure is called if exported when the program has passed declaration type. e.g. "program WIN32DLL 'name';" and Ziron system files. The parameter is a pointer to a null terminated string containing the app type "WIN32DLL" or such. Note: that the system.zir file will take priority and be included before this event is called.
Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

BTW , what is the deference between the ProgramBegin and ProgramEntry function.

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

There is no ProgramBegin... where do you see this?

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

oh , sorry , it was my mistake.

so i will try the programEntry ,and see the results.

BTW, i was trying to detect assignment to allow this in plugin

qword[edi] = mm0;

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

not to worry, some of the mmx high level stuff will be added shortly, the problem is that by adding high level for movq and movd is people may forget to call emms before fpu instructions.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , no problem.

please can you give a working example of using programEntry.

i have tryied that but no successful.

procedure ProgramEntry(char* apptype) 
{
   char tmp[2048];
 
   edi = strGetLine(apptype, @tmp);
   while(edi <> 0) {
      Ziron_ShowMessage(@tmp);
      eax = Ziron_Exec(@tmp);
        if (eax == false) {
          Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
          return true;
        }       
      edi = strGetLine(edi, @tmp);
   }  
 
}

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

apptype is just the "WIN32CUI" you would need to use Ziron_ExtractLine