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

plugin for Ziron

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

plugin for Ziron

when it will be possible to extend the features of Ziron by using plugin system?

I was thinking to add a macro system that smiler to Fasm or Masm and also include some Fasm &

Masm code directly inside Ziron code , there are a big variety code already made and we can

make use of them without converting them.

Emil.

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

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Maybe in second coming release, if you tell me what sort of functions you will require, i will put them on a priority list. :)

Colin admin
Posts
928
Threads
49
Location
Bulgaria

just spend some time finishing the plugin system, i will begin exposing some functionality tomorrow most likely.. a sample ziron assembler plugin written in ziron

program WIN32DLL 'Sample';

#include 'ziron32.zir';

const strLoaded = 'Test plugin has been loaded'; 

//////////////////////////////
function* GetFunction(char* strName): DWord; stdcall;

function InitPlugin(pointer pGetF) {
	GetFunction = pGetF;
	
	//do something	
	//GetFunction(.... coming soon
	
	return strLoaded;
}

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

  return false;
}

exports InitPlugin;

of course this does nothing much apart from output the message the plugin has been loaded, but it gives an example of the simplicity of the plugin system.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

so nice and simple system.

I suggest that , you can path the entire source code line to the plugin ,then the plugin

will pares it and changes it then paths back to Ziron to also pares it again.

Emil.

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I do not quite understand your request, can you please clarify :)

-Thanks

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

sorry ,

I want to allow the plugin system to share Ziron when parsing the source code , so we can extend the Ziron features without touching Ziron itself.

for example , if i have this line in source code

xor eax;

so Ziron will not understand it , but we can pass this line to a plugin then it will changes it to be like this

xor eax,eax;

then passing this changed line back to Ziron again to parsing it as usual.

so i can made a plugin that understand basic syntax and convert it to Ziron normal syntax.

hope you got me now.

Emil.

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Ziron's parser does not work on a line by line basis, so passing line by line to a plugin is not possible, however I have added a function to allow access to each file's code as it is included before compilation of the file begins.

Basically a pointer is passed to the code in memory, allowing for changes in code, however this is a problem since the size of memory needs also to be expanded, so i'm thinking about adding a grow function, allowing plugins to call Ziron_GrowMem(32)

which of course will realloc the memory with the additional size of 32 kb of ram.. it may be difficult for plugin writers to know exactly how much more ram their plugin would require, meaning they would need to often call the grow function as it becomes necessary.

Reallocating is not fast of course, however... plugins can resize by lets say 32kb, and keep track of the size, and if it plans to go over 32kb, to call to realloc again, 32kb i believe is more than enough space for any changes anyways. infact, in most cases, they may not even need to reallocate more than for 10000 character changes, 10kb would usually be more than enough.

Optionally, it could be made that the plugin writer allocates the space they need, write the entire file into a buffer, pass it to the plugin and the compiler can replace the internal buffer by copying the contents of the new buffer.

anyhow it is up for sugestions :)

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

i have two ideas.

first: we can pass the filename of source code that will compiled by Ziron to the pluging

then the plugin will load the file and changes it then save it again the Ziron will take the

control.

second: and i prefer it , Ziron will load the file then pass each line to a plugin and after

the plugin changes the code , Ziron save that to file and load it again to compile it as usual.

note will , there will be more than one plugins form the users and each one will change the code as wanted. so the plugins must be ordered and the second solution will do it.

Emil.

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