[NeoStats-Devel] [Commits] r2648 - in trunk: include src

[email protected]
Newsgroups gmane.comp.neostats.devel
Message-ID <[email protected]>
Author: Fish
Date: Thu Jul  7 21:04:12 2005
New Revision: 2648

Modified:
   trunk/include/dl.h
   trunk/include/modules.h
   trunk/include/neostats.h
   trunk/include/perlmod.h
   trunk/src/conf.c
   trunk/src/modules.c
Log:
compile fixes when --disable-perl is enabled

Modified: trunk/include/dl.h
==============================================================================
--- trunk/include/dl.h	(original)
+++ trunk/include/dl.h	Thu Jul  7 21:04:12 2005
@@ -51,14 +51,15 @@
 #ifdef WIN32
 #ifndef NDEBUG
 /* The extra d in debug mode uses debug versions of DLLs */
-#define MOD_EXT	"d.dll"
+#define MOD_STDEXT	"d.dll"
 #else
-#define MOD_EXT	".dll"
+#define MOD_STDEXT	".dll"
 #endif
 #else
-#define MOD_EXT	".so"
+#define MOD_STDEXT	".so"
 #endif
 
+
 /* 
  * Prototypes
  */

Modified: trunk/include/modules.h
==============================================================================
--- trunk/include/modules.h	(original)
+++ trunk/include/modules.h	Thu Jul  7 21:04:12 2005
@@ -31,7 +31,7 @@
 
 int InitModules( void );
 void FiniModules( void );
-Module *load_module( const char *path, Client * u );
+Module *ns_load_module( const char *path, Client * u );
 int unload_module( const char *module_name, Client * u );
 void unload_modules( void );
 int ns_cmd_modlist( CmdParams* cmdparams );
@@ -40,5 +40,8 @@
 void SendModuleEvent( Event event, CmdParams* cmdparams, Module* module_ptr );
 int SynchModule( Module* module_ptr );
 int SynchAllModules( void );
+void assign_mod_number(Module *mod_ptr);
+void insert_module(Module *mod_ptr);
+void load_module_error(const Client *target, const char *fmt, ...);
 
 #endif /* _MODULES_H_ */

Modified: trunk/include/neostats.h
==============================================================================
--- trunk/include/neostats.h	(original)
+++ trunk/include/neostats.h	Thu Jul  7 21:04:12 2005
@@ -919,6 +919,8 @@
 typedef int (*mod_auth) ( Client *u );
 typedef int (*userauthfunc) ( Client *u );
 
+#ifdef USE_PERL	
+
 typedef enum MOD_TYPE {
 	/* standard C Modules */
 	MOD_STANDARD = 1,
@@ -926,6 +928,27 @@
 	MOD_PERL
 } MOD_TYPE;
 	
+/* forward decleration (in perlmod.h) for perl module info
+ * we don't include any perl includes here because it screws up
+ * some of the existing system defines (like readdir) */
+struct PerlModInfo;
+
+
+/* defines to easily detect different modules */
+#define IS_PERL_MOD(mod) ((mod)->modtype & MOD_PERL)
+#define IS_STD_MOD(mod) ((mod)->modtype & MOD_STANDARD)
+
+/* to save some chars while typing */
+
+#define PMI PerlInterpreter
+
+#endif
+
+#ifndef USE_PERL
+#define IS_STD_MOD(mod) (1)
+#define IS_PERL_MOD(mod) (0)
+
+#endif
 
 /** @brief Module structure
  * 
@@ -940,9 +963,14 @@
 	unsigned int insynch;
 	unsigned int synched;
 	unsigned int error;
+#ifdef USE_PERL
 	MOD_TYPE modtype;
+	struct PerlModInfo *pm;
+#endif
 }_Module;
 
+
+
 EXPORTVAR extern Module *RunModule[10];
 EXPORTVAR extern int RunLevel;
 

Modified: trunk/include/perlmod.h
==============================================================================
--- trunk/include/perlmod.h	(original)
+++ trunk/include/perlmod.h	Thu Jul  7 21:04:12 2005
@@ -23,9 +23,29 @@
 
 #ifndef _PERLMOD_H_
 #define _PERLMOD_H_
+#include "config.h"
+#ifdef USE_PERL
+
+#ifdef PERLDEFINES
+#include <EXTERN.h>
+#define WIN32IOP_H
+#include <perl.h>
+#include <XSUB.h>
+
+
+typedef struct PerlModInfo {
+	char filename[MAXPATH];
+	PerlInterpreter *my_perl;
+} PerlModInfo;
+#endif
+
+#define MOD_PERLEXT	".pl"
+
 
 int Init_Perl();
-void FiniPerl();
+void PerlModFini(Module *);
+void unload_perlmod(Module *);
 void ns_cmd_modperlist(CmdParams *cmd);
-
+Module *load_perlmodule(const char *, Client *);
+#endif
 #endif /* _PERLMOD_H_ */

Modified: trunk/src/conf.c
==============================================================================
--- trunk/src/conf.c	(original)
+++ trunk/src/conf.c	Thu Jul  7 21:04:12 2005
@@ -373,11 +373,15 @@
 	struct stat buf;
 	ircsnprintf(buf2, MAXPATH, "%s/%s%s", MOD_PATH, file, MOD_STDEXT);
 	if (stat(buf2, &buf) == -1) {
+#ifdef USE_PERL
 		ircsnprintf(buf2, MAXPATH, "%s/%s%s", MOD_PATH, file, MOD_PERLEXT);
 		if (stat(buf2, &buf) == -1) {
+#endif
 			cfg_error(cfg, "File %s Specified in Option %s is Invalid: %s", buf2, opt->name, strerror(errno));
 			return CFG_PARSE_ERROR;
+#ifdef USE_PERL
 		}
+#endif
 	}
 	if (!S_ISREG(buf.st_mode)) {
 		cfg_error(cfg, "File %s Specified in Option %s is Invalid: Not a Regular File", buf2, opt->name);

Modified: trunk/src/modules.c
==============================================================================
--- trunk/src/modules.c	(original)
+++ trunk/src/modules.c	Thu Jul  7 21:04:12 2005
@@ -270,10 +270,12 @@
 	if (stat(path, &buf) != -1) {
 		return load_stdmodule(path, u);
 	}
+#ifdef USE_PERL
 	ircsnprintf (path, 255, "%s/%s%s", MOD_PATH, loadmodname, MOD_PERLEXT);
 	if (stat(path, &buf) != -1) {
 		return load_perlmodule(path, u);
 	}
+#endif
 	/* if we get here, ehhh, doesn't exist */
 	load_module_error (u, __("Unable to load module: %s", u), modfilename);
 	return NULL;
@@ -531,8 +533,10 @@
 			RESET_RUN_LEVEL();
 			SET_SEGV_LOCATION();
 		}
+#if USE_PERL
 	} else {
 		PerlModFini(mod_ptr);
+#endif
 	}
 	/* Delete any bots used by this module. Done after ModFini, so the bot 
 	 * can still send messages during ModFini 
@@ -556,8 +560,10 @@
 	DBACloseDatabase ();
 	if (IS_STD_MOD(mod_ptr)) {
 		ns_dlclose (mod_ptr->handle);
+#ifdef USE_PERL
 	} else {
 		unload_perlmod(mod_ptr);
+#endif
 	}
 	RESET_RUN_LEVEL();
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.