/* Retrieve Module Function */
#define MODULE_FUNC(h, m, func, ...) \
if((h = lt_dlsym(m, func))) { \
- h(__VAR_ARGS__) \
+ h(__VA_ARGS__); \
+ }
+#define MODULE_FUNC_NOARGS(h, m, func) \
+ if((h = lt_dlsym(m, func))) { \
+ h(); \
}
#define MODULE_FUNCRET(m, func) lt_dlsym(m, func);
#define AUTORESTART
#endif
#include <setjmp.h>
+#include <ltdl.h>
#include "conf.h"
#include "modules.h"
#include "lua.h"
#include "mushlua.h"
+#include "modules.h"
#ifdef HAS_WAITPID
/** What does wait*() return? */
#define WAIT_TYPE int
#define FD_ISSET(n,p) (*p & (1<<(n)))
#endif /* defines for BSD 4.2 */
+
+extern struct module_entry_t *module_list;
#ifdef HAS_GETRUSAGE
void rusage_stats(void);
#endif
static int
dump_messages(DESC *d, dbref player, int isnew)
{
+ struct module_entry_t *m;
+ void (*handle)(dbref, int, int);
+
int is_hidden;
int num = 0;
DESC *tmpd;
if (Haven(player))
notify(player, T("Your HAVEN flag is set. You cannot receive pages."));
local_connect(player, isnew, num);
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_connect", player, isnew, num);
+
return 1;
}
#include <unistd.h>
#endif
#include <errno.h>
+#include <ltdl.h>
#include "conf.h"
#include "externs.h"
#include "help.h"
#include "dbio.h"
#include "pcre.h"
+#include "modules.h"
#ifdef hpux
#include <sys/syscall.h>
static dbref *errdbtail; /**< Pointer to end of errdblist */
static int errdbsize = 4; /**< Current size of errdblist array */
extern int use_flagfile;
+extern struct module_entry_t *module_list;
static void errdb_grow(void);
char realtmpfl[2048];
char tmpfl[2048];
FILE *f = NULL;
+ struct module_entry_t *m;
+ void (*handle)();
+
#ifndef PROFILING
#ifndef WIN32
return 1;
} else {
local_dump_database();
+ MODULE_ITER(m)
+ MODULE_FUNC_NOARGS(handle, m->handle, "module_dump_database");
#ifdef ALWAYS_PARANOID
paranoid_checkpt = db_top / 5;
void
init_game_config(const char *conf)
{
+ struct module_entry_t *m;
+ void (*handler)();
+
int a;
global_eval_context.process_command_port = 0;
/* Load all the config file stuff except restrict_* */
local_configs();
+ MODULE_ITER(m)
+ MODULE_FUNC_NOARGS(handler, m->handle, "module_configs");
+
conf_default_set();
config_file_startup(conf, 0);
start_all_logs();
void
init_game_postdb(const char *conf)
{
+ struct module_entry_t *m;
+ void (*handle)();
+
/* access file stuff */
read_access_file();
/* initialize random number generator */
#endif /* CRON */
/* Call Local Startup */
local_startup();
+ MODULE_ITER(m)
+ MODULE_FUNC_NOARGS(handle, m->handle, "module_startup");
+
+
/* everything else ok. Restart all objects. */
do_restart();
#ifdef HAS_OPENSSL
int module_entry_del(struct module_entry_t *entry) {
struct module_entry_t *m, *e = NULL;
- if(module_list == entry)
+ if(module_list == entry) {
e = module_list;
+ module_list = NULL;
+ }
+
else MODULE_ITER(m)
if(m->next != NULL && m->next == entry) {
e = m;
#include <sys/types.h>
#endif
#include <fcntl.h>
+#include <ltdl.h>
#include "conf.h"
#include "externs.h"
#include "flags.h"
#include "lock.h"
#include "parse.h"
+#include "modules.h"
#ifdef HAS_CRYPT
#ifdef I_CRYPT
extern char *crypt(const char *, const char *);
#endif
#endif
+extern struct module_entry_t *module_list;
#include "extmail.h"
#include "confmagic.h"
dbref player;
char temp[SBUF_LEN];
object_flag_type flags;
+ struct module_entry_t *m;
+ void (*handle)(dbref player);
player = new_object();
current_state.players++;
local_data_create(player);
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_create", player);
+
return player;
}
#ifdef I_UNISTD
#include <unistd.h>
#endif
+#include <ltdl.h>
#include "conf.h"
#include "externs.h"
#include "help.h"
#include "parse.h"
#include "confmagic.h"
+#include "modules.h"
+/* Module extern */
+extern struct module_entry_t *module_list;
static sig_atomic_t hup_triggered = 0;
static sig_atomic_t usr1_triggered = 0;
dispatch(void)
{
static int idle_counter = 0;
+ struct module_entry_t *m;
+ void (*handle)(void);
/* A HUP reloads configuration and reopens logs */
if (hup_triggered) {
#endif
local_timer();
+
+ MODULE_ITER(m)
+ MODULE_FUNC_NOARGS(handle, m->handle, "module_timer");
}
sig_atomic_t cpu_time_limit_hit = 0; /** Was the cpu time limit hit? */