version 1.5 | | version 1.6 |
---|
| | |
/* | | /* |
* static char *rcsid_plugins_c = | | * static char *rcsid_plugins_c = |
* "$Id: plugins.c,v 1.5 2001/10/30 02:30:20 michtoen Exp $"; | | * "$Id: plugins.c,v 1.6 2001/11/11 09:39:54 gros Exp $"; |
*/ | | */ |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
/* Note that find_plugin_command is called *before* the internal commands are*/ | | /* Note that find_plugin_command is called *before* the internal commands are*/ |
/* checked, meaning that you can "overwrite" them. */ | | /* checked, meaning that you can "overwrite" them. */ |
/*****************************************************************************/ | | /*****************************************************************************/ |
CommArray_s *find_plugin_command(char *cmd) | | CommArray_s *find_plugin_command(char *cmd, object *op) |
{ | | { |
CFParm* CmdParm; | | CFParm* CmdParm; |
CFParm* RTNValue; | | CFParm* RTNValue; |
| | |
CmdParm = (CFParm *)(malloc(sizeof(CFParm))); | | CmdParm = (CFParm *)(malloc(sizeof(CFParm))); |
CmdParm->Value[0] = cmdchar; | | CmdParm->Value[0] = cmdchar; |
CmdParm->Value[1] = cmd; | | CmdParm->Value[1] = cmd; |
| | CmdParm->Value[2] = op; |
RTNCmd = (CommArray_s *)(malloc(sizeof(CommArray_s))); | | RTNCmd = (CommArray_s *)(malloc(sizeof(CommArray_s))); |
| | |
for(i=0;i<PlugNR;i++) | | for(i=0;i<PlugNR;i++) |
| | |
HookParm->Value[1] = &CFWNewDrawInfo; | | HookParm->Value[1] = &CFWNewDrawInfo; |
break; | | break; |
}; | | }; |
/* Gros: this must be a linux special, or? ;-) */ | | HookParm->dparm = 2044; |
/* HookParm->dparm = 2044; */ | | |
PlugList[PlugNR].hookfunc(HookParm); | | PlugList[PlugNR].hookfunc(HookParm); |
}; | | }; |
free(HookParm->Value[0]); | | free(HookParm->Value[0]); |
| | |
}; | | }; |
} | | } |
}; | | }; |
| | if (namelist != NULL) free(namelist); |
}; | | }; |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
PlugList[PlugNR].eventfunc = (f_plugin)(dlsym(ptr,"triggerEvent")); | | PlugList[PlugNR].eventfunc = (f_plugin)(dlsym(ptr,"triggerEvent")); |
PlugList[PlugNR].pinitfunc = (f_plugin)(dlsym(ptr,"postinitPlugin")); | | PlugList[PlugNR].pinitfunc = (f_plugin)(dlsym(ptr,"postinitPlugin")); |
PlugList[PlugNR].propfunc = (f_plugin)(dlsym(ptr,"getPluginProperty")); | | PlugList[PlugNR].propfunc = (f_plugin)(dlsym(ptr,"getPluginProperty")); |
| | printf("Done\n"); |
if (PlugList[PlugNR].pinitfunc==NULL) | | if (PlugList[PlugNR].pinitfunc==NULL) |
{ | | { |
printf("Plugin postinit error: %s\n", dlerror()); | | printf("Plugin postinit error: %s\n", dlerror()); |
| | |
for(j=1; j<=NR_OF_HOOKS;j++) | | for(j=1; j<=NR_OF_HOOKS;j++) |
{ | | { |
memcpy(HookParm->Value[0], &j, sizeof(int)); | | memcpy(HookParm->Value[0], &j, sizeof(int)); |
switch(j) | | HookParm->Value[1] = HookList[j]; |
| | /*switch(j) |
{ | | { |
case HOOK_NONE: | | case HOOK_NONE: |
break; | | break; |
| | |
case HOOK_NEWDRAWINFO: | | case HOOK_NEWDRAWINFO: |
HookParm->Value[1] = &CFWNewDrawInfo; | | HookParm->Value[1] = &CFWNewDrawInfo; |
break; | | break; |
}; | | case HOOK_SENDCUSTOMCOMMAND: |
| | HookParm->Value[1] = &CFWSendCustomCommand; |
| | break; |
| | };*/ |
PlugList[PlugNR].hookfunc(HookParm); | | PlugList[PlugNR].hookfunc(HookParm); |
}; | | }; |
free(HookParm->Value[0]); | | free(HookParm->Value[0]); |
| | |
(object *)(PParm->Value[0]), | | (object *)(PParm->Value[0]), |
(object *)(PParm->Value[1]) | | (object *)(PParm->Value[1]) |
); | | ); |
return PParm; | | |
}; | | }; |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
update_ob_speed( | | update_ob_speed( |
(object *)(PParm->Value[0]) | | (object *)(PParm->Value[0]) |
); | | ); |
| | return NULL; |
return PParm; | | |
}; | | }; |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
(object *)(PParm->Value[0]), | | (object *)(PParm->Value[0]), |
*(int *)(PParm->Value[1]) | | *(int *)(PParm->Value[1]) |
); | | ); |
| | return NULL; |
return PParm; | | |
}; | | }; |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
(object *)(PParm->Value[0]), | | (object *)(PParm->Value[0]), |
*(int *)(PParm->Value[1]) | | *(int *)(PParm->Value[1]) |
); | | ); |
return PParm; | | |
}; | | }; |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
{ | | { |
CFParm* CFP; | | CFParm* CFP; |
char* val; | | char* val; |
/* object* ob; not used yet */ | | object* ob; |
val = (char *)(malloc(sizeof(char)*10240)); | | val = (char *)(malloc(sizeof(char)*10240)); |
CFP = (CFParm*)(malloc(sizeof(CFParm))); | | CFP = (CFParm*)(malloc(sizeof(CFParm))); |
dump_me((object *)(PParm->Value[0]),val); | | dump_me((object *)(PParm->Value[0]),val); |
| | |
}; | | }; |
CFParm* CFWFreeString(CFParm* PParm) | | CFParm* CFWFreeString(CFParm* PParm) |
{ | | { |
/* CFParm* CFP; not used yet */ | | CFParm* CFP; |
char* val; | | char* val; |
val = (char *)(PParm->Value[0]); | | val = (char *)(PParm->Value[0]); |
free_string (val); | | free_string (val); |
| | |
(char *)(PParm->Value[3])); | | (char *)(PParm->Value[3])); |
return NULL; | | return NULL; |
}; | | }; |
/* | | |
CFParm* CFW(CFParm* PParm) | | CFParm* CFWSendCustomCommand(CFParm* PParm) |
CFParm* CFW(CFParm* PParm) | | { |
CFParm* CFW(CFParm* PParm) | | send_plugin_custom_message((object *)(PParm->Value[0]),(char *)(PParm->Value[1])); |
*/ | | return NULL; |
| | }; |
| | |
| | CFParm* CFWCFTimerCreate(CFParm* PParm) |
| | { |
| | //int cftimer_create(int id, long delay, object* ob, int mode) |
| | CFParm* CFP; |
| | static int val; |
| | CFP = (CFParm*)(malloc(sizeof(CFParm))); |
| | val = cftimer_create(*(int *)(PParm->Value[0]), |
| | *(long *)(PParm->Value[1]), |
| | (object *)(PParm->Value[2]), |
| | *(int *)(PParm->Value[3])); |
| | CFP->Value[0] = (void *)(&val); |
| | return CFP; |
| | }; |
| | |
| | CFParm* CFWCFTimerDestroy(CFParm* PParm) |
| | { |
| | //int cftimer_destroy(int id) |
| | CFParm* CFP; |
| | static int val; |
| | CFP = (CFParm*)(malloc(sizeof(CFParm))); |
| | val = cftimer_destroy(*(int *)(PParm->Value[0])); |
| | CFP->Value[0] = (void *)(&val); |
| | return CFP; |
| | }; |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
/* The following is not really a wrapper like the others are. */ | | /* The following is not really a wrapper like the others are. */ |