Pascal plugIn
hi
i am start a new Pascal plugin that will understand this function prototype.
// this is dummy function used for testing purpose
function* SetCursorProperties(XHotSpot, YHotSpot: LongWord; pCursorBitmap: IDirect3DSurface9): HResult; stdcall;
and here is my first step , it is only find out is that a pascal function or not
//******************************************************//
// //
// Pascal Plugin //
// //
// By Emil Halim //
// 8 / 11 / 2011 //
// //
//******************************************************//
plugins off;
program WIN32DLL 'Pas PLUGIN';
#include 'zirplug/framework.zir';
#include 'strings.zir';
//////////////////////////////
const strLoaded = 'Pas plugin has loaded!';
//////////////////////////////
function H_strlen(char* str) {
Eax = str;
while(char[eax] != 0) {
Eax++;
}
sub eax, str
}
function H_strcpy(Dword dst,src)
{
Eax = dst;
Edx = src;
push Eax;
BL = [Edx];
while ( BL != 0)
{
[Eax] = BL;
Eax++; Edx++;
BL = [Edx];
}
[Eax] = 0;
pop Eax;
}
function H_strcat(Dword dst,src)
{
Eax = dst;
Edx = src;
push Eax;
while (byte [Eax] != 0) { Eax++; }
while (byte [Edx] != 0)
{
BL = [Edx];
[Eax] = BL;
Edx++; Eax++;
}
[Eax] = 0;
pop Eax;
}
inline procedure H_strjoin(;)
{
$temp = 1;
$to = $argc - 1;
$repeat $to:
H_strcat($arg[0],$arg[$temp]);
$temp++;
$end
}
inline procedure Ziron_ExecuteF(m_st)
{
Ziron_Execute($m_st,H_strlen($m_st));
}
//
// event_Pas()
//
function event_Pas()
{
uses edi;
char buf[2048];
char line[2048];
char val[255];
Dword Len;
boolean ParesFlg;
len = Ziron_ExtractLine(@line, 2048);
//Ziron_ShowMessage(@line); // show our entire line for debug purpose
Eax = @line;
Cl = char[Eax];
Edx = false;
ParesFlg = false;
while( cl != 0)
{
if(cl == '(')
{
Edx = true;
}
if(cl == ')')
{
Edx = false;
}
if( Edx == true and cl == ":")
{
ParesFlg = true;
}
Cl = char[Eax];
Eax++;
}
// see if the line have to pares with this plugin
if(ParesFlg)
{
Ziron_ShowMessage(@line); // show our entire line for debug purpose
return true;
}
else
{
return false; // let Ziron handle the line
}
}
function InitPlugin(pointer pGetF) {
Ziron_LoadAll(pGetF); //use framework utility function to load all
//add some variable type
const MyType = 'type HResult = DWord;';
Ziron_Execute(@MyType,H_strlen(@MyType));
//register our keyword
Ziron_RegisterKeyword('function', @event_Pas);
return strLoaded;
}
entry function DLLMain(DWord iDLL; DWord iReason; Pointer iResult) {
if (iReason == DLL_PROCESS_ATTACH) {
return true;
}
return false;
}
exports InitPlugin;
any suggestion ?
http://www.freewebs.com/ogremagic/index.htm