added MOO_MOD_INDEX
This commit is contained in:
@ -397,6 +397,7 @@ pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -337,6 +337,10 @@ int moo_setoption (moo_t* moo, moo_option_t id, const void* value)
|
||||
moo->option.dfl_procstk_size = *(moo_oow_t*)value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
case MOO_MOD_INCTX:
|
||||
moo->option.mod_inctx = *(void**)value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
einval:
|
||||
@ -371,6 +375,10 @@ int moo_getoption (moo_t* moo, moo_option_t id, void* value)
|
||||
case MOO_PROCSTK_SIZE:
|
||||
*(moo_oow_t*)value = moo->option.dfl_procstk_size;
|
||||
return 0;
|
||||
|
||||
case MOO_MOD_INCTX:
|
||||
*(void**)value = moo->option.mod_inctx;
|
||||
return 0;
|
||||
};
|
||||
|
||||
moo_seterrnum (moo, MOO_EINVAL);
|
||||
@ -535,6 +543,7 @@ moo_mod_data_t* moo_openmod (moo_t* moo, const moo_ooch_t* name, moo_oow_t namel
|
||||
/* found the module in the staic module table */
|
||||
|
||||
MOO_MEMSET (&md, 0, MOO_SIZEOF(md));
|
||||
md.mod.inctx = moo->option.mod_inctx;
|
||||
moo_copy_oochars ((moo_ooch_t*)md.mod.name, name, namelen);
|
||||
/* Note md.handle is MOO_NULL for a static module */
|
||||
|
||||
@ -579,6 +588,7 @@ moo_mod_data_t* moo_openmod (moo_t* moo, const moo_ooch_t* name, moo_oow_t namel
|
||||
|
||||
/* attempt to find a dynamic external module */
|
||||
MOO_MEMSET (&md, 0, MOO_SIZEOF(md));
|
||||
md.mod.inctx = moo->option.mod_inctx;
|
||||
moo_copy_oochars ((moo_ooch_t*)md.mod.name, name, namelen);
|
||||
if (moo->vmprim.dl_open && moo->vmprim.dl_getsym && moo->vmprim.dl_close)
|
||||
{
|
||||
|
@ -95,7 +95,8 @@ enum moo_option_t
|
||||
MOO_LOG_MAXCAPA,
|
||||
MOO_SYMTAB_SIZE, /* default system table size */
|
||||
MOO_SYSDIC_SIZE, /* default system dictionary size */
|
||||
MOO_PROCSTK_SIZE /* default process stack size */
|
||||
MOO_PROCSTK_SIZE, /* default process stack size */
|
||||
MOO_MOD_INCTX
|
||||
};
|
||||
typedef enum moo_option_t moo_option_t;
|
||||
|
||||
@ -1111,8 +1112,9 @@ typedef void (*moo_mod_gc_t) (
|
||||
struct moo_mod_t
|
||||
{
|
||||
/* input */
|
||||
/*const*/ moo_ooch_t name[MOO_MOD_NAME_LEN_MAX + 1];
|
||||
/*const*/ int hints; /* bitwised-ORed of moo_mod_hint_t enumerators */
|
||||
moo_ooch_t name[MOO_MOD_NAME_LEN_MAX + 1];
|
||||
void* inctx;
|
||||
unsigned int hints; /* bitwised-ORed of moo_mod_hint_t enumerators */
|
||||
|
||||
/* user-defined data */
|
||||
moo_mod_import_t import;
|
||||
@ -1193,6 +1195,8 @@ struct moo_t
|
||||
moo_oow_t dfl_sysdic_size;
|
||||
moo_oow_t dfl_procstk_size;
|
||||
|
||||
void* mod_inctx;
|
||||
|
||||
#if defined(MOO_BUILD_DEBUG)
|
||||
/* set automatically when trait is set */
|
||||
moo_oow_t karatsuba_cutoff;
|
||||
|
Reference in New Issue
Block a user