Register | Login
Forum Index > Source Help > assignment detecting
Author Message
Pages: 1 2 3 4
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1069] - posted: 2012-05-11 21:40:53

sorry i did not get it.

example please

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1070] - posted: 2012-05-11 21:53:22
Code:
edi = Ziron_ExtractLine(....

//move through tokens etc


anyways i would suggest for what you are trying to do then use FileEntry instead since it is better suited for such things.

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
[1071] - posted: 2012-05-11 22:14:41

still did not know how to use Ziron_ExtractLin inside ProgramEntry handler?

FileEntry did not allow use of excution.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1072] - posted: 2012-05-11 22:34:00
With FileEntry, you would not use Ziron_Execute, instead you would use Ziron_SetFileBuffer

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
[1073] - posted: 2012-05-12 18:21:39

Hi Mr Colin,

as i mentioned before , FileEntry is not my point here and i am not willing use it in this
case because i want to Ziron execute something from plugin.

so is programEntry will help here or not and if so , please give me an example of using it.

thanks.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1074] - posted: 2012-05-12 18:31:20
as i've said, what you are trying to do is not possible, simply because Ziron does not compile line by line, it is char to char.

take these 2 examples

Code:
mov
  eax,
  ecx

MyFunc(
  a, b, c
  d, e, f
);


now what you are wanting to do is get a line and then execute it.. so lets take a look

first line
Code:
mov


execute -> syntax error.

2nd line
Code:
  eax,


execute -> syntax error.

and so on...., like i've said, FileEntry would be your only option, using SetFileBuffer, you can go through line by line, changing anything you need to change, and then let Ziron process the whole new buffer.

If you give me an exact description of what you actually want to do (if it is not just exec each line) then please give me a deep explanation and maybe i can implement some new pf functions to help in some better way.

as for ProgramEntry, this would not be suitable.

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
[1075] - posted: 2012-05-12 18:50:23

ok,

what i want to do is , make a trick , because of Ziron is an assembler and not a compiler.

i was thinking to get around this problem by the next consept

Code:
plugin will take the control from the beginning , of course that will be after program statement , as you have said using event handler for 'program' term will be impossible.   

plugin will parse the source code here , by this sequence
   1- get the line , if it has a ';' then we have a valid line that ziron can execute it,
      else still get the next line and keep searching for ';' trem.
   2- start parse this line and see if we need to modify it then go ahead else pass it
      without changed to Ziron ,EG executes it.
   3- if we get the needed line we can modify it as desired and parse it then we can 
      make new line and execute it.
   4- loop this procedure until we found end of code       


hope you get my point.

thanks.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1077] - posted: 2012-05-12 20:57:47
ok then i would still suggest to use FileEntry, i've wrote some code for you to help understand the usage, i have not tested it and it is not fully correct, will need a little work, but should give you a good idea how to do what you want to do smile

Code:
int bufSize;
char* strSource;

procedure emitLine(char* line) {
  if (strAppend(strSource, line, bufSize) = false) {
    //we need to re-alloc strSource and extend buffer size
    edx = strSource;
    add bufSize, 2048
    strSource = new bufSize;    
    strlcpy(strSource, edx, 2048);
    delete edx; //delete old mem
    
    //now append it, maybe should check line is not 2048 bytes long :-p
    strAppend(strSource, line, bufSize);
  }
}

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

  //init strSource here
  bufSize = 2048;
  strSource = new 2048;

  return strLoaded;
}

function UnloadPlugin() {
  //free strSource here
  delete strSource;
}

function FileEntry(DWord handle; char* code) {
  uses edi;
  m_strFill(strSource, 1, 0); //set first character as null so we can re-use for strAppend
  
  //your usual code here
  char tmp[2048];
 
  edi = strGetLine(code, @tmp);
  while(edi <> 0) {
    Ziron_ShowMessage(@tmp);
    
    emitLine(@tmp);
    edi = strGetLine(edi, @tmp);
  }  
  
  Ziron_SetFileBuffer(handle, strSource, strLen(strSource));
}

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

  return false;
}



exports InitPlugin, UnloadPlugin, FileEntry;


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2 3 4
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