SCI: Slim down struct SciKernelFunction
svn-id: r40081
This commit is contained in:
parent
3af8918e1a
commit
3774b9cd0c
2 changed files with 10 additions and 7 deletions
|
@ -55,8 +55,8 @@ static int sci_max_allowed_unknown_kernel_functions[] = {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFUN(nm, cname, sig) {KF_NEW, nm, {cname, sig, NULL}}
|
#define DEFUN(nm, cname, sig) {KF_NEW, nm, cname, sig}
|
||||||
#define NOFUN(nm) {KF_NONE, nm, {NULL, NULL, NULL}}
|
#define NOFUN(nm) {KF_NONE, nm, NULL, NULL}
|
||||||
|
|
||||||
SciKernelFunction kfunct_mappers[] = {
|
SciKernelFunction kfunct_mappers[] = {
|
||||||
/*00*/ DEFUN("Load", kLoad, "iii*"),
|
/*00*/ DEFUN("Load", kLoad, "iii*"),
|
||||||
|
@ -208,9 +208,9 @@ SciKernelFunction kfunct_mappers[] = {
|
||||||
|
|
||||||
|
|
||||||
// Special and NOP stuff
|
// Special and NOP stuff
|
||||||
{KF_NEW, NULL, {k_Unknown, NULL, NULL}},
|
{KF_NEW, NULL, k_Unknown, NULL},
|
||||||
|
|
||||||
{KF_TERMINATOR, NULL, {NULL, NULL, NULL}} // Terminator
|
{KF_TERMINATOR, NULL, NULL, NULL} // Terminator
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *argtype_description[] = { "Undetermined (WTF?)", "List", "Node", "Object", "Reference", "Arithmetic" };
|
static const char *argtype_description[] = { "Undetermined (WTF?)", "List", "Node", "Object", "Reference", "Arithmetic" };
|
||||||
|
@ -321,7 +321,7 @@ reg_t k_Unknown(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
} else {
|
} else {
|
||||||
switch (kfunct_mappers[funct_nr].type) {
|
switch (kfunct_mappers[funct_nr].type) {
|
||||||
case KF_NEW:
|
case KF_NEW:
|
||||||
return kfunct_mappers[funct_nr].sig_pair.fun(s, funct_nr, argc, argv);
|
return kfunct_mappers[funct_nr].fun(s, funct_nr, argc, argv);
|
||||||
case KF_NONE:
|
case KF_NONE:
|
||||||
default:
|
default:
|
||||||
warning("Unhandled Unknown function %04x", funct_nr);
|
warning("Unhandled Unknown function %04x", funct_nr);
|
||||||
|
@ -642,7 +642,9 @@ int script_map_kernel(EngineState *s) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KF_NEW:
|
case KF_NEW:
|
||||||
s->_kfuncTable[functnr] = kfunct_mappers[found].sig_pair;
|
s->_kfuncTable[functnr].fun = kfunct_mappers[found].fun;
|
||||||
|
s->_kfuncTable[functnr].signature = kfunct_mappers[found].signature;
|
||||||
|
s->_kfuncTable[functnr].orig_name.clear();
|
||||||
kernel_compile_signature(&(s->_kfuncTable[functnr].signature));
|
kernel_compile_signature(&(s->_kfuncTable[functnr].signature));
|
||||||
++mapped;
|
++mapped;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -318,7 +318,8 @@ struct kfunct_sig_pair_t {
|
||||||
struct SciKernelFunction {
|
struct SciKernelFunction {
|
||||||
int type; /* KF_* */
|
int type; /* KF_* */
|
||||||
const char *name;
|
const char *name;
|
||||||
kfunct_sig_pair_t sig_pair;
|
kfunct *fun; /* The actual function */
|
||||||
|
const char *signature; /* kfunct signature */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SciKernelFunction kfunct_mappers[];
|
extern SciKernelFunction kfunct_mappers[];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue