myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-35-g


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-35-gef4da49
Date: Tue, 23 Feb 2010 17:02:32 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  ef4da49b38d71a122baf5e3540fb5b5a611f2f37 (commit)
       via  cd677cb139885b450448d93fb08af6474902a0c3 (commit)
       via  e227b682cbbe4c1c6b7c991750a6002712d690c8 (commit)
      from  066e82ff008c457d753dc1ce1daca163171a0e12 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit ef4da49b38d71a122baf5e3540fb5b5a611f2f37
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Feb 23 18:02:19 2010 +0100

    Introduce a macro PLUGIN_NAME to simplify the plugin name export.

diff --git a/myserver/include/plugin/plugin.h b/myserver/include/plugin/plugin.h
index 3e44854..721310a 100644
--- a/myserver/include/plugin/plugin.h
+++ b/myserver/include/plugin/plugin.h
@@ -25,6 +25,9 @@
 # define EXPORTABLE(x) extern "C" x
 # endif
 
+#define PLUGIN_NAME(X) static const char * __name = X; \
+        EXPORTABLE(const char*) name (){return X;}
+
 # include "myserver.h"
 # include <include/base/dynamic_lib/dynamiclib.h>
 # include <include/base/hash_map/hash_map.h>
@@ -44,7 +47,7 @@ public:
   virtual int preLoad (string& file, bool global);
   virtual int postLoad (Server* server);
   virtual int unLoad ();
-  virtual const char* getName (char* buffer, u_long len);
+  virtual const char* getName ();
   virtual void* getDirectMethod (char* name);
 protected:
   DynamicLibrary hinstLib;
diff --git a/myserver/src/plugin/plugin.cpp b/myserver/src/plugin/plugin.cpp
index f104dca..0c4310a 100644
--- a/myserver/src/plugin/plugin.cpp
+++ b/myserver/src/plugin/plugin.cpp
@@ -24,7 +24,7 @@ typedef int (*loadPROC)(Server*);
 typedef int (*postLoadPROC)(Server*);
 typedef int (*unLoadPROC)();
 typedef int (*versionPROC)();
-typedef const char* (*getNamePROC)(char*, u_long);
+typedef const char* (*getNamePROC)();
 
 /*!
  * Construct a plugin object.
@@ -106,19 +106,18 @@ int Plugin::unLoad ()
 
 /*!
  * Get the plugin name.
- * \param buffer The buffer where write the plugin name.
- * \param len The buffer length in bytes.
  */
-const char* Plugin::getName (char* buffer, u_long len)
+const char* Plugin::getName ()
 {
   getNamePROC proc;
   if (!hinstLib.validHandle ())
-    return 0;
-  proc = (getNamePROC)hinstLib.getProc ("name");
+    return NULL;
+
+  proc = (getNamePROC) hinstLib.getProc ("name");
   if (proc)
-    return proc (buffer, len);
+    return proc ();
 
-  return 0;
+  return NULL;
 }
 
 /*!
diff --git a/myserver/src/plugin/plugins_manager.cpp 
b/myserver/src/plugin/plugins_manager.cpp
index 038c681..6da2ebb 100644
--- a/myserver/src/plugin/plugins_manager.cpp
+++ b/myserver/src/plugin/plugins_manager.cpp
@@ -492,7 +492,7 @@ PluginsManager::preLoadPlugin (string &file, Server* 
server, bool global)
       delete plugin;
       return NULL;
     }
-  namePtr = plugin->getName (0, 0);
+  namePtr = plugin->getName ();
 
   if (namePtr)
     name.assign (namePtr);
diff --git a/myserver/tests/test_plugins_manager.cpp 
b/myserver/tests/test_plugins_manager.cpp
index c2bb5d8..cd8e836 100644
--- a/myserver/tests/test_plugins_manager.cpp
+++ b/myserver/tests/test_plugins_manager.cpp
@@ -84,6 +84,13 @@ public:
   }
 
 protected:
+  virtual PluginInfo* loadInfo (Server* server, string &name, string &path)
+  {
+    PluginInfo *pinfo = new PluginInfo (name);
+    pinfo->setPlugin (new MockPlugin ());
+    return pinfo;
+  }
+
   virtual int loadFile (Server* server, string &name, string &file,
                         PluginInfo* pinfo)
   {
@@ -95,7 +102,7 @@ protected:
 
   virtual Plugin* preLoadPlugin (string &file, Server* server, bool global)
   {
-    new MockPlugin ();
+
   }
 };
 
diff --git a/plugins/src/guile/guile.cpp b/plugins/src/guile/guile.cpp
index 0cab65d..ffc897a 100644
--- a/plugins/src/guile/guile.cpp
+++ b/plugins/src/guile/guile.cpp
@@ -1,6 +1,6 @@
 /*
   MyServer
-  Copyright (C) 2009 The Free Software Foundation Inc.
+  Copyright (C) 2009, 2010 The Free Software Foundation Inc.
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
@@ -19,13 +19,8 @@
 #include <libguile.h>
 #include <include/plugin/plugin.h>
 
-EXPORTABLE(char*) name (char* name, u_long len)
-{
-  char* str = (char*) "guile";
-  if(name)
-    strncpy(name, str, len);
-  return str;
-}
+
+PLUGIN_NAME ("guile");
 
 EXPORTABLE(int) eval (char *const string)
 {
@@ -33,12 +28,12 @@ EXPORTABLE(int) eval (char *const string)
   return 0;
 }
 
-EXPORTABLE(int) load (void* server,void* parser)
+EXPORTABLE(int) load (void* server, void* parser)
 {
   return 0;
 }
 
-EXPORTABLE(int) postLoad (void* server,void* parser)
+EXPORTABLE(int) postLoad (void* server, void* parser)
 {
   return 0;
 }
diff --git a/plugins/src/mime_magic/mime_magic.cpp 
b/plugins/src/mime_magic/mime_magic.cpp
index 617a39b..b948b7d 100755
--- a/plugins/src/mime_magic/mime_magic.cpp
+++ b/plugins/src/mime_magic/mime_magic.cpp
@@ -26,6 +26,8 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include <magic.h>
 #include <include/plugin/plugin.h>
 
+PLUGIN_NAME ("mime_magic");
+
 class MagicHandler : public MimeManagerHandler
 {
 public:
@@ -54,7 +56,7 @@ public:
     close ();
   }
 
-       virtual MimeRecord *getMIME (const char *file)
+  virtual MimeRecord *getMIME (const char *file)
   {
     MimeRecord *rec = NULL;
     lock.lock ();
@@ -95,18 +97,10 @@ private:
 
 static MagicHandler *handler;
 
-EXPORTABLE(char*) name (char* name, u_long len)
-{
-       char* str = (char*) "mime_magic";
-       if (name)
-               strncpy (name, str, len);
-       return str;
-}
-
 EXPORTABLE(int) load (void* server)
 {
   handler = NULL;
-       return 0;
+  return 0;
 }
 
 static MimeManagerHandler *builder ()
@@ -121,20 +115,20 @@ void XmlMimeHandler::registerBuilder (MimeManager& 
manager)
 EXPORTABLE(int) postLoad (void* server)
 {
   string name ("mime_magic");
-       Server *serverInstance = (Server*)server;
+  Server *serverInstance = (Server*)server;
   MimeManager *mimeManager = serverInstance->getMimeManager ();
 
   MagicHandler *handler = new MagicHandler;
   if (handler->load (NULL))
     {
       serverInstance->log (MYSERVER_LOG_MSG_ERROR,
-                                  _("cannot load mime magic configuration"));
+                           _("cannot load mime magic configuration"));
       return 1;
     }
 
   mimeManager->registerHandler (name, handler);
   mimeManager->registerBuilder (name, builder);
-       return 0;
+  return 0;
 }
 
 EXPORTABLE(int) unLoad()
@@ -142,5 +136,5 @@ EXPORTABLE(int) unLoad()
   if (handler)
     delete handler;
 
-       return 0;
+  return 0;
 }
diff --git a/plugins/src/python/python.cpp b/plugins/src/python/python.cpp
index f1db8c3..84b71d0 100644
--- a/plugins/src/python/python.cpp
+++ b/plugins/src/python/python.cpp
@@ -1,6 +1,6 @@
 /*
   MyServer
-  Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+  Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
@@ -22,16 +22,7 @@ HashMap<ThreadID, PythonData*> pythonThreadData;
 
 static Server *serverInstance;
 
-char* name (char* name, u_long len)
-{
-       char* str = (char*)"python";
-
-       if (name)
-               strncpy (name, str, len);
-
-       return str;
-}
-
+PLUGIN_NAME ("python");
 
 PyInterpreterState* PythonData::getInterpreter ()
 {
@@ -43,29 +34,29 @@ PyInterpreterState* PythonData::getInterpreter ()
 
 PythonData::PythonData ()
 {
-       clear ();
+  clear ();
 }
 
 void PythonData::clear ()
 {
-       interp = 0;
+  interp = 0;
 }
 
 
 
 int load (void* server)
 {
-       serverInstance = (Server*)server;
-       const char* pathData = serverInstance->getData("PYTHON_PATH");
-       PyThreadState * mainThreadState;
-       if (pathData)
+  serverInstance = (Server*)server;
+  const char* pathData = serverInstance->getData("PYTHON_PATH");
+  PyThreadState * mainThreadState;
+  if (pathData)
     {
       string path (pathData);
       FilesUtility::completePath (path);
 
       setenv ("PYTHONPATH", path.c_str(), 1);
     }
-       else
+  else
     {
       string path (".");
       FilesUtility::completePath (path);
@@ -74,54 +65,54 @@ int load (void* server)
     }
 
   Py_SetProgramName ((char *)("python"));
-       Py_Initialize ();
-       PyEval_InitThreads ();
+  Py_Initialize ();
+  PyEval_InitThreads ();
 
-       mainThreadState = PyThreadState_Get ();
+  mainThreadState = PyThreadState_Get ();
 
-       pythonMainInterpreterState = mainThreadState->interp;
+  pythonMainInterpreterState = mainThreadState->interp;
 
-       PyEval_ReleaseLock ();
+  PyEval_ReleaseLock ();
 
-       return 0;
+  return 0;
 }
 
 /*! Unload the plugin.  Called once.  Returns 0 on success.  */
 int unLoad (void* p)
 {
-       PyInterpreterState *interpreter = NULL;
-       PyThreadState *threadState = NULL;
-       PythonData* data = NULL;
-       ThreadID tid = Thread::threadID ();
+  PyInterpreterState *interpreter = NULL;
+  PyThreadState *threadState = NULL;
+  PythonData* data = NULL;
+  ThreadID tid = Thread::threadID ();
 
-       PyEval_AcquireLock ();
+  PyEval_AcquireLock ();
 
 
-       data = pythonThreadData.get (tid);
-       if(data == 0)
+  data = pythonThreadData.get (tid);
+  if(data == 0)
     {
       data = new PythonData ();
       pythonThreadData.put (tid, data);
     }
 
-       interpreter = data->getInterpreter ();
-       threadState = PyThreadState_New (interpreter);
+  interpreter = data->getInterpreter ();
+  threadState = PyThreadState_New (interpreter);
 
-       PyThreadState_Swap (threadState);
+  PyThreadState_Swap (threadState);
 
 
-       Py_Finalize ();
+  Py_Finalize ();
 
 
-       PyThreadState_Swap (NULL);
+  PyThreadState_Swap (NULL);
 
 
-       PyEval_ReleaseLock ();
+  PyEval_ReleaseLock ();
 
-       HashMap<ThreadID, PythonData*>::Iterator it = pythonThreadData.begin ();
-       while (it != pythonThreadData.end ())
-               delete *it++;
-       return 0;
+  HashMap<ThreadID, PythonData*>::Iterator it = pythonThreadData.begin ();
+  while (it != pythonThreadData.end ())
+    delete *it++;
+  return 0;
 }
 
 int execute (char* code, u_long length)
@@ -132,30 +123,30 @@ int execute (char* code, u_long length)
 int executeImpl (char* code, u_long length, PyThreadState *threadState,
                  int newThreadState)
 {
-       PyInterpreterState *interpreter = NULL;
-       PythonData* data = NULL;
-       ThreadID tid = Thread::threadID ();
+  PyInterpreterState *interpreter = NULL;
+  PythonData* data = NULL;
+  ThreadID tid = Thread::threadID ();
 
-       PyEval_AcquireLock ();
+  PyEval_AcquireLock ();
 
-       data = pythonThreadData.get (tid);
-       if (data == 0)
+  data = pythonThreadData.get (tid);
+  if (data == 0)
     {
       data = new PythonData();
       pythonThreadData.put(tid, data);
     }
 
-       interpreter = data->getInterpreter ();
+  interpreter = data->getInterpreter ();
 
   if (newThreadState)
     threadState = PyThreadState_New (interpreter);
 
-       PyThreadState_Swap (threadState);
+  PyThreadState_Swap (threadState);
 
 
-       PyRun_SimpleString (code);
+  PyRun_SimpleString (code);
 
-       PyThreadState_Swap (NULL);
+  PyThreadState_Swap (NULL);
 
   if (newThreadState)
     {
@@ -163,7 +154,7 @@ int executeImpl (char* code, u_long length, PyThreadState 
*threadState,
       PyThreadState_Delete (threadState);
     }
 
-       PyEval_ReleaseLock ();
+  PyEval_ReleaseLock ();
 
   return 0;
 
@@ -178,41 +169,41 @@ int executeFromFile (char* filename)
 int executeFromFileImpl(char* filename, PyThreadState *threadState,
                         int newThreadState)
 {
-       PyInterpreterState *interpreter = NULL;
-       int ret = 0;
-       FILE *file = NULL;
-       PythonData* data = NULL;
-       ThreadID tid = Thread::threadID ();
+  PyInterpreterState *interpreter = NULL;
+  int ret = 0;
+  FILE *file = NULL;
+  PythonData* data = NULL;
+  ThreadID tid = Thread::threadID ();
 
-       PyEval_AcquireLock ();
+  PyEval_AcquireLock ();
 
-       data = pythonThreadData.get (tid);
-       if(data == 0)
+  data = pythonThreadData.get (tid);
+  if(data == 0)
     {
       data = new PythonData ();
       pythonThreadData.put (tid, data);
     }
 
-       interpreter = data->getInterpreter ();
+  interpreter = data->getInterpreter ();
 
   if (newThreadState)
     threadState = PyThreadState_New (interpreter);
 
-       PyThreadState_Swap (threadState);
+  PyThreadState_Swap (threadState);
 
-       file = fopen (filename, "r");
+  file = fopen (filename, "r");
 
-       if(file == 0)
+  if(file == 0)
     {
       serverInstance->log (MYSERVER_LOG_MSG_ERROR,
                            _("Python: cannot load file %s"), filename);
       ret = -1;
     }
-       else
-               ret = PyRun_AnyFileEx (file, filename, 1);
+  else
+    ret = PyRun_AnyFileEx (file, filename, 1);
 
 
-       PyThreadState_Swap (NULL);
+  PyThreadState_Swap (NULL);
 
   if (newThreadState)
     {
@@ -220,7 +211,7 @@ int executeFromFileImpl(char* filename, PyThreadState 
*threadState,
       PyThreadState_Delete(threadState);
     }
 
-       PyEval_ReleaseLock ();
+  PyEval_ReleaseLock ();
 
   return ret;
 
@@ -235,32 +226,32 @@ PyObject* callObject(PyObject *obj, PyObject *args)
 PyObject* callObjectImpl(PyObject *obj, PyObject *args,
                          PyThreadState *threadState, int newThreadState)
 {
-       PyInterpreterState *interpreter = NULL;
-       PythonData* data = NULL;
-       ThreadID tid = Thread::threadID();
+  PyInterpreterState *interpreter = NULL;
+  PythonData* data = NULL;
+  ThreadID tid = Thread::threadID();
   PyObject *result;
 
-       PyEval_AcquireLock ();
+  PyEval_AcquireLock ();
 
-       data = pythonThreadData.get (tid);
-       if(data == 0)
+  data = pythonThreadData.get (tid);
+  if(data == 0)
     {
       data = new PythonData ();
       pythonThreadData.put (tid, data);
     }
 
-       interpreter = data->getInterpreter();
+  interpreter = data->getInterpreter();
 
   if (newThreadState)
     threadState = PyThreadState_New(interpreter);
 
-       PyThreadState_Swap (threadState);
+  PyThreadState_Swap (threadState);
 
 
   result = PyEval_CallObject (obj, args);
 
 
-       PyThreadState_Swap (NULL);
+  PyThreadState_Swap (NULL);
 
   if (newThreadState)
     {
@@ -268,7 +259,7 @@ PyObject* callObjectImpl(PyObject *obj, PyObject *args,
       PyThreadState_Delete (threadState);
     }
 
-       PyEval_ReleaseLock ();
+  PyEval_ReleaseLock ();
 
   return result;
 }
@@ -276,33 +267,33 @@ PyObject* callObjectImpl(PyObject *obj, PyObject *args,
 
 int initModule (char* name, PyMethodDef methods[])
 {
-       PyInterpreterState *interpreter = NULL;
-       PyThreadState *threadState = NULL;
-       PythonData* data = NULL;
-       ThreadID tid = Thread::threadID ();
+  PyInterpreterState *interpreter = NULL;
+  PyThreadState *threadState = NULL;
+  PythonData* data = NULL;
+  ThreadID tid = Thread::threadID ();
 
-       PyEval_AcquireLock ();
+  PyEval_AcquireLock ();
 
-       data = pythonThreadData.get (tid);
-       if (data == 0)
+  data = pythonThreadData.get (tid);
+  if (data == 0)
     {
       data = new PythonData ();
       pythonThreadData.put (tid, data);
     }
 
-       interpreter = data->getInterpreter ();
-       threadState = PyThreadState_New (interpreter);
+  interpreter = data->getInterpreter ();
+  threadState = PyThreadState_New (interpreter);
 
-       PyThreadState_Swap (threadState);
+  PyThreadState_Swap (threadState);
 
 
-       Py_InitModule (name, methods);
+  Py_InitModule (name, methods);
 
-       PyThreadState_Swap (NULL);
+  PyThreadState_Swap (NULL);
 
 
-       PyEval_ReleaseLock ();
+  PyEval_ReleaseLock ();
 
-       return 0;
+  return 0;
 }
 
diff --git a/plugins/src/python/python.h b/plugins/src/python/python.h
index 13f6470..7c98348 100644
--- a/plugins/src/python/python.h
+++ b/plugins/src/python/python.h
@@ -1,18 +1,18 @@
 /*
-MyServer
-Copyright (C) 2007, 2008 The MyServer Team
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  MyServer
+  Copyright (C) 2007, 2008, 2010 The MyServer Team
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include <Python.h>
@@ -28,29 +28,30 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 
 struct PythonData
 {
-       PyThreadState* interp;
-       PyInterpreterState* getInterpreter();
-       PythonData();
-       void clear();
+  PyThreadState* interp;
+  PyInterpreterState* getInterpreter();
+  PythonData();
+  void clear();
 };
 
 extern HashMap<ThreadID, PythonData*> pythonThreadData;
 
-EXPORTABLE(char*) name(char* name, u_long len);
+EXPORTABLE(int) load (void* server,void* parser);
+EXPORTABLE(int) unLoad (void* p);
 
-EXPORTABLE(int) load(void* server,void* parser);
-EXPORTABLE(int) unLoad(void* p);
 
+EXPORTABLE(int) execute (char* code, u_long length);
+EXPORTABLE(int) executeFromFile (char* filename);
 
-EXPORTABLE(int) execute(char* code, u_long length);
-EXPORTABLE(int) executeFromFile(char* filename);
 
+EXPORTABLE(int) executeImpl (char* code, u_long length,
+                             PyThreadState *threadState, int newThreadState);
+EXPORTABLE(int) executeFromFileImpl (char* filename, PyThreadState 
*threadState,
+                                     int newThreadState);
 
-EXPORTABLE(int) executeImpl (char* code, u_long length, PyThreadState 
*threadState, int newThreadState);
-EXPORTABLE(int) executeFromFileImpl(char* filename, PyThreadState 
*threadState, int newThreadState);
+EXPORTABLE(PyObject*) callObject (PyObject *obj, PyObject *args);
+EXPORTABLE(PyObject*) callObjectImpl (PyObject *obj, PyObject *args,
+                                      PyThreadState *threadState, int 
newThreadState);
 
-EXPORTABLE(PyObject*) callObject(PyObject *obj, PyObject *args);
-EXPORTABLE(PyObject*) callObjectImpl(PyObject *obj, PyObject *args, 
PyThreadState *threadState, int newThreadState);
 
-
-EXPORTABLE(int) initModule(char*, PyMethodDef[]);
+EXPORTABLE(int) initModule (char*, PyMethodDef[]);
diff --git a/plugins/src/python_http_handler/python_http_handler.cpp 
b/plugins/src/python_http_handler/python_http_handler.cpp
index e56b112..bd588a5 100644
--- a/plugins/src/python_http_handler/python_http_handler.cpp
+++ b/plugins/src/python_http_handler/python_http_handler.cpp
@@ -27,6 +27,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include <include/conf/main/xml_main_configuration.h>
 #include <include/plugin/plugin.h>
 
+
+PLUGIN_NAME ("python_http_handler");
+
 static Server* serverInstance;
 
 typedef int (*executePROC)(char*, u_long);
@@ -34,8 +37,8 @@ typedef int (*executeFromFilePROC)(char*);
 
 class ThreadData : public HttpDataHandler
 {
-       HttpThreadContext* td;
-       int ret;
+  HttpThreadContext* td;
+  int ret;
   bool keepalive;
   bool useChunks;
   FiltersChain chain;
@@ -47,14 +50,14 @@ public:
     ret = 0;
   }
 
-       HttpThreadContext* getHttpThreadContext (){return td;}
-       int getRet (){return ret;}
+  HttpThreadContext* getHttpThreadContext (){return td;}
+  int getRet (){return ret;}
 
-       void setHttpThreadContext (HttpThreadContext* td){this->td = td;}
-       void setRet (int r){ret = r;}
+  void setHttpThreadContext (HttpThreadContext* td){this->td = td;}
+  void setRet (int r){ret = r;}
 
 
-       virtual int send (HttpThreadContext*, ConnectionPtr s,
+  virtual int send (HttpThreadContext*, ConnectionPtr s,
                     const char* exec, const char* cmdLine,
                     int execute, int onlyHeader)
   {
@@ -85,94 +88,94 @@ static INIT_MODULE init;
 
 static ThreadData* getThreadData ()
 {
-       ThreadID tid = Thread::threadID();
-       ThreadData* ret;
-       mutex.lock ();
-       ret = pythonThreadData.get (tid);
-       mutex.unlock ();
-       return ret;
+  ThreadID tid = Thread::threadID();
+  ThreadData* ret;
+  mutex.lock ();
+  ret = pythonThreadData.get (tid);
+  mutex.unlock ();
+  return ret;
 }
 
 static HttpThreadContext* getThreadContext ()
 {
-       return getThreadData ()->getHttpThreadContext ();
+  return getThreadData ()->getHttpThreadContext ();
 }
 
 static PyObject *get_remote_addr (PyObject *self, PyObject *args)
 {
-       HttpThreadContext* context = getThreadContext ();
+  HttpThreadContext* context = getThreadContext ();
   return Py_BuildValue((char*)"s", context->connection->getIpAddr ());
 }
 
 static PyObject *get_remote_port (PyObject *self, PyObject *args)
 {
-       HttpThreadContext* context = getThreadContext ();
+  HttpThreadContext* context = getThreadContext ();
   return Py_BuildValue((char*)"i", context->connection->getPort ());
 }
 
 static PyObject *get_local_addr (PyObject *self, PyObject *args)
 {
-       HttpThreadContext* context = getThreadContext ();
+  HttpThreadContext* context = getThreadContext ();
   return Py_BuildValue ((char*)"s", context->connection->getLocalIpAddr ());
 }
 
 static PyObject *get_local_port (PyObject *self, PyObject *args)
 {
-       HttpThreadContext* context = getThreadContext ();
+  HttpThreadContext* context = getThreadContext ();
   return Py_BuildValue ((char*)"i", context->connection->getLocalPort ());
 }
 
 
 static PyObject *get_response_header (PyObject *self, PyObject *args)
 {
-       char *header;
-       string value;
-       if (!PyArg_ParseTuple (args, (char*)"s", &header))
-               return NULL;
+  char *header;
+  string value;
+  if (!PyArg_ParseTuple (args, (char*)"s", &header))
+    return NULL;
 
-       HttpThreadContext* context = getThreadContext ();
+  HttpThreadContext* context = getThreadContext ();
 
-       context->response.getValue (header, &value);
+  context->response.getValue (header, &value);
 
-       return Py_BuildValue ((char*)"s", value.c_str());
+  return Py_BuildValue ((char*)"s", value.c_str());
 }
 
 static PyObject *get_request_header (PyObject *self, PyObject *args)
 {
-       char *header;
-       string value;
-       if (!PyArg_ParseTuple(args, (char*)"s", &header))
-               return NULL;
+  char *header;
+  string value;
+  if (!PyArg_ParseTuple(args, (char*)"s", &header))
+    return NULL;
 
-       HttpThreadContext* context = getThreadContext ();
+  HttpThreadContext* context = getThreadContext ();
 
-       context->request.getValue (header, &value);
+  context->request.getValue (header, &value);
 
-       return Py_BuildValue ((char*)"s", value.c_str ());
+  return Py_BuildValue ((char*)"s", value.c_str ());
 }
 
 static PyObject *log_server_error (PyObject *self, PyObject *args)
 {
-       char *msg;
+  char *msg;
 
-       if (!PyArg_ParseTuple(args, (char*)"s", &msg))
-               return NULL;
+  if (!PyArg_ParseTuple(args, (char*)"s", &msg))
+    return NULL;
 
   serverInstance->log (MYSERVER_LOG_MSG_ERROR, "%s", msg);
-       return NULL;
+  return NULL;
 }
 
 static PyObject *set_response_header (PyObject *self, PyObject *args)
 {
-       char *header;
-       char *value;
-       const char* ret;
-       if (!PyArg_ParseTuple(args, (char*)"ss", &header, &value))
-               return NULL;
+  char *header;
+  char *value;
+  const char* ret;
+  if (!PyArg_ParseTuple(args, (char*)"ss", &header, &value))
+    return NULL;
 
-       HttpThreadContext* context = getThreadContext ();
+  HttpThreadContext* context = getThreadContext ();
 
-       string *retS =  context->response.setValue (header, value);
+  string *retS =  context->response.setValue (header, value);
 
   if (retS)
     {
@@ -184,15 +187,15 @@ static PyObject *set_response_header (PyObject *self, 
PyObject *args)
 
 static PyObject *set_request_header (PyObject *self, PyObject *args)
 {
-       char *header;
-       char *value;
-       const char* ret;
-       if (!PyArg_ParseTuple(args, (char*)"ss", &header, &value))
-               return NULL;
+  char *header;
+  char *value;
+  const char* ret;
+  if (!PyArg_ParseTuple(args, (char*)"ss", &header, &value))
+    return NULL;
 
-       HttpThreadContext* context = getThreadContext ();
+  HttpThreadContext* context = getThreadContext ();
 
-       string *retS =  context->request.setValue (header, value);
+  string *retS =  context->request.setValue (header, value);
   if (retS)
     {
       ret = retS->c_str ();
@@ -203,8 +206,8 @@ static PyObject *set_request_header (PyObject *self, 
PyObject *args)
 
 static PyObject *send_header (PyObject *self, PyObject *args)
 {
-       ThreadData *tdata = getThreadData ();
-       HttpThreadContext* td = tdata->getHttpThreadContext ();
+  ThreadData *tdata = getThreadData ();
+  HttpThreadContext* td = tdata->getHttpThreadContext ();
 
   tdata->check ();
 
@@ -212,7 +215,7 @@ static PyObject *send_header (PyObject *self, PyObject 
*args)
                                         &(td->response));
 
   if(td->connection->socket->send (td->buffer->getBuffer(),
-                                  (u_long)strlen(td->buffer->getBuffer()), 0)
+                                   (u_long)strlen(td->buffer->getBuffer()), 0)
      < 0)
     return Py_BuildValue((char*)"i", 1);
 
@@ -223,261 +226,252 @@ static PyObject *send_header (PyObject *self, PyObject 
*args)
 
 static PyObject *get_document_root (PyObject *self, PyObject *args)
 {
-       char *data;
-       if (!PyArg_ParseTuple(args, (char*)"s", &data))
-               return NULL;
+  char *data;
+  if (!PyArg_ParseTuple(args, (char*)"s", &data))
+    return NULL;
 
-       HttpThreadContext* context = getThreadContext ();
+  HttpThreadContext* context = getThreadContext ();
 
-       return Py_BuildValue ((char*)"s", context->getVhostDir ());
+  return Py_BuildValue ((char*)"s", context->getVhostDir ());
 }
 
 static PyObject *send_data (PyObject *self, PyObject *args)
 {
-       char *data;
+  char *data;
   u_long size = 0;
-       if (!PyArg_ParseTuple(args, (char*)"s", &data))
-               return NULL;
+  if (!PyArg_ParseTuple(args, (char*)"s", &data))
+    return NULL;
 
   size = strlen (data);
 
-       ThreadData *tdata = getThreadData ();
+  ThreadData *tdata = getThreadData ();
 
   if (tdata->send(data, size))
     return Py_BuildValue ((char*)"i", 0);
 
   tdata->setRet (1);
 
-       return Py_BuildValue((char*)"i", size);
+  return Py_BuildValue((char*)"i", size);
 }
 
 static PyObject *end_send_data (PyObject *, PyObject *)
 {
-       ThreadData *tdata = getThreadData ();
+  ThreadData *tdata = getThreadData ();
 
   tdata->send (0, 0);
 
-       return Py_BuildValue ((char*)"i", 0);
+  return Py_BuildValue ((char*)"i", 0);
 }
 
 static PyObject *raise_error (PyObject *self, PyObject *args)
 {
-       int error;
-       if (!PyArg_ParseTuple(args, (char*)"i", &error))
-               return NULL;
+  int error;
+  if (!PyArg_ParseTuple(args, (char*)"i", &error))
+    return NULL;
 
-       ThreadData* data = getThreadData ();
+  ThreadData* data = getThreadData ();
 
-       if(data->getRet())
-               return NULL;
+  if(data->getRet())
+    return NULL;
 
-       data->getHttpThreadContext ()->http->raiseHTTPError (error);
+  data->getHttpThreadContext ()->http->raiseHTTPError (error);
 
-       data->setRet (1);
+  data->setRet (1);
 
-       return Py_BuildValue ((char*)"s", "");
+  return Py_BuildValue ((char*)"s", "");
 }
 
 
 static PyObject *is_ssl (PyObject *self, PyObject *args)
 {
-       HttpThreadContext* context = getThreadContext ();
-       int isSsl = context->http->getProtocolOptions () & Protocol::SSL;
+  HttpThreadContext* context = getThreadContext ();
+  int isSsl = context->http->getProtocolOptions () & Protocol::SSL;
 
-       return Py_BuildValue ((char*)"b", isSsl);
+  return Py_BuildValue ((char*)"b", isSsl);
 }
 
 
 static PyObject *send_redirect (PyObject *self, PyObject *args)
 {
-       char* dest;
-       if (!PyArg_ParseTuple(args, (char*)"s", &dest))
-               return NULL;
+  char* dest;
+  if (!PyArg_ParseTuple(args, (char*)"s", &dest))
+    return NULL;
 
-       ThreadData* data = getThreadData ();
+  ThreadData* data = getThreadData ();
 
-       if (data->getRet())
-               return NULL;
+  if (data->getRet())
+    return NULL;
 
-       data->getHttpThreadContext ()->http->sendHTTPRedirect (dest);
+  data->getHttpThreadContext ()->http->sendHTTPRedirect (dest);
 
-       data->setRet (1);
+  data->setRet (1);
 
-       return Py_BuildValue ((char*)"s", dest);
+  return Py_BuildValue ((char*)"s", dest);
 }
 
 static PyMethodDef PythonHttpHandlerMethods[] = {
-       {(char*)"get_remote_port", get_remote_port, METH_VARARGS, (char*)"Get 
the remote TCP port"},
-       {(char*)"get_local_port", get_local_port, METH_VARARGS, (char*)"Get the 
local TCP port"},
-       {(char*)"get_remote_addr", get_remote_addr, METH_VARARGS, (char*)"Get 
the remote IP address"},
-       {(char*)"get_local_addr", get_local_addr, METH_VARARGS, (char*)"Get the 
local IP address"},
-       {(char*)"get_request_header", get_request_header, METH_VARARGS, 
(char*)"Get HTTP request header field value"},
-       {(char*)"set_request_header", set_request_header, METH_VARARGS, 
(char*)"Set HTTP request header field value"},
-       {(char*)"get_response_header", get_response_header, METH_VARARGS, 
(char*)"Get HTTP response header field value"},
-       {(char*)"set_response_header", set_response_header, METH_VARARGS, 
(char*)"Set HTTP response header field value"},
-       {(char*)"send_redirect", send_redirect, METH_VARARGS, (char*)"Send a 
redirect to another location"},
-       {(char*)"raise_error", raise_error, METH_VARARGS, (char*)"Raise HTTP 
error page"},
-       {(char*)"send_data", send_data, METH_VARARGS, (char*)"Send data to the 
client"},
-       {(char*)"send_header", send_header, METH_VARARGS, (char*)"Send the HTTP 
header to the client"},
-       {(char*)"end_send_data", end_send_data, METH_VARARGS, (char*)"Complete 
a data transfer"},
-       {(char*)"get_document_root", get_document_root, METH_VARARGS, 
(char*)"Return the document root directory"},
-       {(char*)"is_ssl", is_ssl, METH_VARARGS, (char*)"Check if the connection 
is using a secure channel"},
-       {(char*)"log_server_error", log_server_error, METH_VARARGS, (char*)"Log 
a server message"},
-       {NULL, NULL, 0, NULL}
+  {(char*)"get_remote_port", get_remote_port, METH_VARARGS, (char*)"Get the 
remote TCP port"},
+  {(char*)"get_local_port", get_local_port, METH_VARARGS, (char*)"Get the 
local TCP port"},
+  {(char*)"get_remote_addr", get_remote_addr, METH_VARARGS, (char*)"Get the 
remote IP address"},
+  {(char*)"get_local_addr", get_local_addr, METH_VARARGS, (char*)"Get the 
local IP address"},
+  {(char*)"get_request_header", get_request_header, METH_VARARGS, (char*)"Get 
HTTP request header field value"},
+  {(char*)"set_request_header", set_request_header, METH_VARARGS, (char*)"Set 
HTTP request header field value"},
+  {(char*)"get_response_header", get_response_header, METH_VARARGS, 
(char*)"Get HTTP response header field value"},
+  {(char*)"set_response_header", set_response_header, METH_VARARGS, 
(char*)"Set HTTP response header field value"},
+  {(char*)"send_redirect", send_redirect, METH_VARARGS, (char*)"Send a 
redirect to another location"},
+  {(char*)"raise_error", raise_error, METH_VARARGS, (char*)"Raise HTTP error 
page"},
+  {(char*)"send_data", send_data, METH_VARARGS, (char*)"Send data to the 
client"},
+  {(char*)"send_header", send_header, METH_VARARGS, (char*)"Send the HTTP 
header to the client"},
+  {(char*)"end_send_data", end_send_data, METH_VARARGS, (char*)"Complete a 
data transfer"},
+  {(char*)"get_document_root", get_document_root, METH_VARARGS, (char*)"Return 
the document root directory"},
+  {(char*)"is_ssl", is_ssl, METH_VARARGS, (char*)"Check if the connection is 
using a secure channel"},
+  {(char*)"log_server_error", log_server_error, METH_VARARGS, (char*)"Log a 
server message"},
+  {NULL, NULL, 0, NULL}
 };
 
 
 class HttpObserver : public Multicast<string, void*, int>
 {
-       struct Item
-       {
-               string data;
-               bool file;
-       };
+  struct Item
+  {
+    string data;
+    bool file;
+  };
 public:
 
-       virtual int updateMulticast (MulticastRegistry<string, void*, int>* reg,
+  virtual int updateMulticast (MulticastRegistry<string, void*, int>* reg,
                                string& msg, void* arg)
-       {
-               HttpThreadContext *td = (HttpThreadContext*)arg;
-               ThreadID tid = Thread::threadID ();
-               list<Item>::iterator it;
-               mutex.lock ();
-               ThreadData threadData (td);
-               pythonThreadData.put (tid, &threadData);
-               mutex.unlock ();
-
-               init ((char*)"python_http_handler_internal", 
PythonHttpHandlerMethods);
-
-               for (it = rules.begin (); it != rules.end (); it++)
+  {
+    HttpThreadContext *td = (HttpThreadContext*)arg;
+    ThreadID tid = Thread::threadID ();
+    list<Item>::iterator it;
+    mutex.lock ();
+    ThreadData threadData (td);
+    pythonThreadData.put (tid, &threadData);
+    mutex.unlock ();
+
+    init ((char*)"python_http_handler_internal", PythonHttpHandlerMethods);
+
+    for (it = rules.begin (); it != rules.end (); it++)
       {
         if ((*it).file)
           {
             char *method = (char*)"executeFromFile";
             executeFromFilePROC execute =
               ((executeFromFilePROC)python->getDirectMethod(method);
-            if (execute)
-              execute((char*)(*it).data.c_str ());
-          }
-        else
-          {
-            executePROC execute =
-              ((executePROC)python->getDirectMethod((char*)"execute"));
-            if (execute)
-              execute ((char*)(*it).data.c_str(), (*it).data.length());
+               if (execute)
+                 execute((char*)(*it).data.c_str ());
+               }
+            else
+              {
+                executePROC execute =
+                ((executePROC)python->getDirectMethod((char*)"execute"));
+                if (execute)
+                  execute ((char*)(*it).data.c_str(), (*it).data.length());
+              }
           }
+        return threadData.getRet ();
       }
-               return threadData.getRet ();
-       }
-
-       void addRule (const char* rule, bool file)
-       {
-               Item it;
-               it.data.assign (rule);
-               it.file = file;
-               rules.push_back (it);
-       }
-
-       void setPythonExecutor (Plugin* python){this->python = python;}
-private:
-       list<Item> rules;
-       Plugin* python;
-};
 
-static HttpObserver observer;
+    void addRule (const char* rule, bool file)
+    {
+      Item it;
+      it.data.assign (rule);
+      it.file = file;
+      rules.push_back (it);
+    }
 
+    void setPythonExecutor (Plugin* python){this->python = python;}
+  private:
+    list<Item> rules;
+    Plugin* python;
+  };
 
-EXPORTABLE(char*) name (char* name, u_long len)
-{
-       char* str = (char*)"python_http_handler";
-       if(name)
-               strncpy(name, str, len);
-       return str;
-}
+  static HttpObserver observer;
 
-EXPORTABLE(int) load (void* server)
-{
-       serverInstance = (Server*)server;
-       string msg("new-http-request");
-       string pythonName("python");
-       Plugin* python;
-  MainConfiguration* configuration;
-       xmlDocPtr xmlDoc;
-       python = serverInstance->getPluginsManager ()->getPlugin (pythonName);
-
-       if(!python)
-    {
-      serverInstance->log (MYSERVER_LOG_MSG_ERROR,
-                           _("PythonHttpHandler: Cannot find python"));
-      return -1;
-    }
-       observer.setPythonExecutor(python);
+  EXPORTABLE(int) load (void* server)
+  {
+    serverInstance = (Server*)server;
+    string msg("new-http-request");
+    string pythonName("python");
+    Plugin* python;
+    MainConfiguration* configuration;
+    xmlDocPtr xmlDoc;
+    python = serverInstance->getPluginsManager ()->getPlugin (pythonName);
+
+    if(!python)
+      {
+        serverInstance->log (MYSERVER_LOG_MSG_ERROR,
+                             _("PythonHttpHandler: Cannot find python"));
+        return -1;
+      }
+    observer.setPythonExecutor(python);
 
-  string httpStr ("http");
-  Protocol *p = serverInstance->getProtocolsManager ()->getProtocol (httpStr);
-  static_cast<HttpProtocol*>(p)->addMulticast(msg, &observer);
+    string httpStr ("http");
+    Protocol *p = serverInstance->getProtocolsManager ()->getProtocol 
(httpStr);
+    static_cast<HttpProtocol*>(p)->addMulticast(msg, &observer);
 
-       init = (INIT_MODULE) python->getDirectMethod((char*)"initModule");
+    init = (INIT_MODULE) python->getDirectMethod((char*)"initModule");
 
-       if(!init)
-    {
-      serverInstance->log (MYSERVER_LOG_MSG_ERROR,
-      _("PythonHttpHandler: Cannot find method initModule in python"));
-      return -1;
-    }
+    if(!init)
+      {
+        serverInstance->log (MYSERVER_LOG_MSG_ERROR,
+                             _("PythonHttpHandler: Cannot find method 
initModule in python"));
+        return -1;
+      }
 
-  configuration = serverInstance->getConfiguration ();
-
-  /* FIXME: DON'T DO THIS.  */
-  xmlDoc = ((XmlMainConfiguration*)configuration)->getDoc ();
-
-       for (xmlNodePtr ptr = xmlDoc->children->next->children; ptr; ptr = 
ptr->next)
-         {
-           if (!xmlStrcmp(ptr->name, (const xmlChar *)"PYTHON_HTTP_HANDLER"))
-             {
-          bool file = false;
-          xmlAttrPtr properties = ptr->properties;
-          char* data = 0;
-          while (properties)
-            {
-              if (!xmlStrcmp(properties->name, (const xmlChar *)"file"))
-                {
-                  if(properties->children && properties->children->content)
-                    data = (char*)properties->children->content;
-
-                  file = true;
-                }
-              properties = properties->next;
-            }
-
-          if (!file && ptr->children && ptr->children->next
-             && ptr->children->next->content)
-            data = (char*)ptr->children->next->content;
-
-          if (!data)
-            {
-              serverInstance->log (MYSERVER_LOG_MSG_ERROR,
-                                   _("PythonHttpHandler: Invalid rule"));
-              return -1;
-            }
-
-          observer.addRule (data, file);
-             }
-
-         }
-
-       mutex.init();
-
-       return 0;
-}
+    configuration = serverInstance->getConfiguration ();
 
-EXPORTABLE(int) postLoad (void* server)
-{
-  return 0;
-}
+    /* FIXME: DON'T DO THIS.  */
+    xmlDoc = ((XmlMainConfiguration*)configuration)->getDoc ();
 
-EXPORTABLE(int) unLoad ()
-{
-  mutex.destroy ();
-  return 0;
-}
+    for (xmlNodePtr ptr = xmlDoc->children->next->children; ptr; ptr = 
ptr->next)
+      {
+        if (!xmlStrcmp(ptr->name, (const xmlChar *)"PYTHON_HTTP_HANDLER"))
+          {
+            bool file = false;
+            xmlAttrPtr properties = ptr->properties;
+            char* data = 0;
+            while (properties)
+              {
+                if (!xmlStrcmp(properties->name, (const xmlChar *)"file"))
+                  {
+                    if(properties->children && properties->children->content)
+                      data = (char*)properties->children->content;
+
+                    file = true;
+                  }
+                properties = properties->next;
+              }
+
+            if (!file && ptr->children && ptr->children->next
+                && ptr->children->next->content)
+              data = (char*)ptr->children->next->content;
+
+            if (!data)
+              {
+                serverInstance->log (MYSERVER_LOG_MSG_ERROR,
+                                     _("PythonHttpHandler: Invalid rule"));
+                return -1;
+              }
+
+            observer.addRule (data, file);
+          }
+
+      }
+
+    mutex.init();
+
+    return 0;
+  }
+
+  EXPORTABLE(int) postLoad (void* server)
+  {
+    return 0;
+  }
+
+  EXPORTABLE(int) unLoad ()
+  {
+    mutex.destroy ();
+    return 0;
+  }
diff --git a/plugins/src/rules_checker/rules_checker.cpp 
b/plugins/src/rules_checker/rules_checker.cpp
index 9f0a622..ae38dd6 100644
--- a/plugins/src/rules_checker/rules_checker.cpp
+++ b/plugins/src/rules_checker/rules_checker.cpp
@@ -23,6 +23,8 @@
 #include "heading.h"
 #include <include/plugin/plugin.h>
 
+PLUGIN_NAME ("rules_checker");
+
 class RulesCheckerObserver : public Multicast<string, void*, int>
 {
   struct Item
@@ -79,15 +81,6 @@ private:
 
 static RulesCheckerObserver observer;
 
-
-EXPORTABLE(char*) name (char* name, u_long len)
-{
-  char* str = (char*)"rules_checker";
-  if(name)
-    strncpy(name, str, len);
-  return str;
-}
-
 EXPORTABLE(int) load (void* server)
 {
   Server* serverInstance = (Server*)server;



commit cd677cb139885b450448d93fb08af6474902a0c3
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Feb 23 17:39:32 2010 +0100

    Move definition of EXPORTABLE in plugin.h

diff --git a/myserver/include/plugin/plugin.h b/myserver/include/plugin/plugin.h
index c405eea..3e44854 100644
--- a/myserver/include/plugin/plugin.h
+++ b/myserver/include/plugin/plugin.h
@@ -19,6 +19,12 @@
 #ifndef PLUGIN_H
 # define PLUGIN_H
 
+#ifdef WIN32
+# define EXPORTABLE(x) x _declspec(dllexport)
+#else
+# define EXPORTABLE(x) extern "C" x
+# endif
+
 # include "myserver.h"
 # include <include/base/dynamic_lib/dynamiclib.h>
 # include <include/base/hash_map/hash_map.h>
diff --git a/plugins/src/guile/guile.cpp b/plugins/src/guile/guile.cpp
index b60bcb7..0cab65d 100644
--- a/plugins/src/guile/guile.cpp
+++ b/plugins/src/guile/guile.cpp
@@ -17,12 +17,7 @@
 #include <myserver.h>
 
 #include <libguile.h>
-
-#ifdef WIN32
-# define EXPORTABLE(x) x _declspec(dllexport)
-#else
-# define EXPORTABLE(x) extern "C" x
-#endif
+#include <include/plugin/plugin.h>
 
 EXPORTABLE(char*) name (char* name, u_long len)
 {
diff --git a/plugins/src/http_checker/http_checker.cpp 
b/plugins/src/http_checker/http_checker.cpp
index d30c11f..915907f 100644
--- a/plugins/src/http_checker/http_checker.cpp
+++ b/plugins/src/http_checker/http_checker.cpp
@@ -24,12 +24,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include <include/protocol/http/http.h>
 #include <include/plugin/plugin.h>
 #include <include/conf/main/xml_main_configuration.h>
-
-#ifdef WIN32
-# define EXPORTABLE(x) x _declspec(dllexport)
-#else
-# define EXPORTABLE(x) extern "C" x
-#endif
+#include <include/plugin/plugin.h>
 
 typedef int (*executePROC)(char*, u_long);
 typedef int (*executeFromFilePROC)(char*);
diff --git a/plugins/src/mime_magic/mime_magic.cpp 
b/plugins/src/mime_magic/mime_magic.cpp
index 0709a21..617a39b 100755
--- a/plugins/src/mime_magic/mime_magic.cpp
+++ b/plugins/src/mime_magic/mime_magic.cpp
@@ -24,12 +24,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include <include/conf/mime/mime_manager.h>
 #include <include/base/hash_map/hash_map.h>
 #include <magic.h>
-
-#ifdef WIN32
-#define EXPORTABLE(x) x _declspec(dllexport)
-#else
-#define EXPORTABLE(x) extern "C" x
-#endif
+#include <include/plugin/plugin.h>
 
 class MagicHandler : public MimeManagerHandler
 {
diff --git a/plugins/src/php/php.h b/plugins/src/php/php.h
index fc997ab..ab9753f 100644
--- a/plugins/src/php/php.h
+++ b/plugins/src/php/php.h
@@ -26,12 +26,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include <include/base/file/files_utility.h>
 #include <include/protocol/http/http.h>
 #include <include/protocol/http/dyn_http_manager.h>
-
-#ifdef WIN32
-#define EXPORTABLE(x) x _declspec(dllexport);
-#else
-#define EXPORTABLE(x) extern "C" x
-#endif
+#include <include/plugin/plugin.h>
 
 EXPORTABLE(char*) name(char* name, u_long len);
 
diff --git a/plugins/src/python/python.h b/plugins/src/python/python.h
index f765d8a..13f6470 100644
--- a/plugins/src/python/python.h
+++ b/plugins/src/python/python.h
@@ -24,7 +24,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include <include/base/sync/mutex.h>
 #include <include/base/file/file.h>
 #include <include/base/file/files_utility.h>
-
+#include <include/plugin/plugin.h>
 
 struct PythonData
 {
@@ -36,15 +36,6 @@ struct PythonData
 
 extern HashMap<ThreadID, PythonData*> pythonThreadData;
 
-
-
-#ifdef WIN32
-#define EXPORTABLE(x) x _declspec(dllexport)
-#else
-#define EXPORTABLE(x) extern "C" x
-#endif
-
-
 EXPORTABLE(char*) name(char* name, u_long len);
 
 EXPORTABLE(int) load(void* server,void* parser);
diff --git a/plugins/src/python_http_handler/python_http_handler.cpp 
b/plugins/src/python_http_handler/python_http_handler.cpp
index 806731f..e56b112 100644
--- a/plugins/src/python_http_handler/python_http_handler.cpp
+++ b/plugins/src/python_http_handler/python_http_handler.cpp
@@ -25,16 +25,10 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include <include/protocol/http/http.h>
 #include <include/plugin/plugin.h>
 #include <include/conf/main/xml_main_configuration.h>
-
+#include <include/plugin/plugin.h>
 
 static Server* serverInstance;
 
-#ifdef WIN32
-# define EXPORTABLE(x) x _declspec(dllexport)
-#else
-# define EXPORTABLE(x) extern "C" x
-#endif
-
 typedef int (*executePROC)(char*, u_long);
 typedef int (*executeFromFilePROC)(char*);
 
diff --git a/plugins/src/rules_checker/rules_checker.cpp 
b/plugins/src/rules_checker/rules_checker.cpp
index f8e78a9..9f0a622 100644
--- a/plugins/src/rules_checker/rules_checker.cpp
+++ b/plugins/src/rules_checker/rules_checker.cpp
@@ -21,12 +21,7 @@
 #include <include/protocol/http/http.h>
 #include <include/conf/main/xml_main_configuration.h>
 #include "heading.h"
-
-#ifdef WIN32
-# define EXPORTABLE(x) x _declspec(dllexport)
-#else
-# define EXPORTABLE(x) extern "C" x
-#endif
+#include <include/plugin/plugin.h>
 
 class RulesCheckerObserver : public Multicast<string, void*, int>
 {



commit e227b682cbbe4c1c6b7c991750a6002712d690c8
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Feb 23 17:29:25 2010 +0100

    Add guile interpreter plugin.

diff --git a/plugins/src/guile/SConscript b/plugins/src/guile/SConscript
new file mode 100644
index 0000000..b9b76f2
--- /dev/null
+++ b/plugins/src/guile/SConscript
@@ -0,0 +1,29 @@
+#-*- mode: python -*-
+Import('dest_dir','listinc')
+
+local_listinc=[
+      GetLaunchDir(),
+      '../../../',
+      '/usr/local/include',
+      '/usr/include/',
+      '/usr/include/guile',
+      '/usr/local/include/guile',
+      '/usr/local/include/libxml2',
+      '/usr/include/libxml2',
+      '.'
+      ]
+
+local_listinc.extend(listinc)
+
+env = Environment(CPPPATH=local_listinc)
+
+conf = Configure(env, config_h="config.h")
+
+if conf.CheckHeader("libguile.h"):
+    conf.Define('GUILE', 1)
+
+env = conf.Finish()
+
+env.SharedLibrary(GetLaunchDir() + "/" + dest_dir + "/guile", ["guile.cpp" ], 
SHLIBPREFIX="")
+
+
diff --git a/plugins/src/guile/guile.cpp b/plugins/src/guile/guile.cpp
new file mode 100644
index 0000000..b60bcb7
--- /dev/null
+++ b/plugins/src/guile/guile.cpp
@@ -0,0 +1,54 @@
+/*
+  MyServer
+  Copyright (C) 2009 The Free Software Foundation Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <myserver.h>
+
+#include <libguile.h>
+
+#ifdef WIN32
+# define EXPORTABLE(x) x _declspec(dllexport)
+#else
+# define EXPORTABLE(x) extern "C" x
+#endif
+
+EXPORTABLE(char*) name (char* name, u_long len)
+{
+  char* str = (char*) "guile";
+  if(name)
+    strncpy(name, str, len);
+  return str;
+}
+
+EXPORTABLE(int) eval (char *const string)
+{
+  scm_c_eval_string (string);
+  return 0;
+}
+
+EXPORTABLE(int) load (void* server,void* parser)
+{
+  return 0;
+}
+
+EXPORTABLE(int) postLoad (void* server,void* parser)
+{
+  return 0;
+}
+
+EXPORTABLE(int) unLoad (void* parser)
+{
+  return 0;
+}
diff --git a/plugins/src/guile/plugin.xml b/plugins/src/guile/plugin.xml
new file mode 100644
index 0000000..a5452bf
--- /dev/null
+++ b/plugins/src/guile/plugin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<PLUGIN min-version="0.9" max-version="0.10">
+  <NAME>guile</NAME>
+  <VERSION>0.1</VERSION>
+  <AUTHOR>The Free Software Foundation Inc.</AUTHOR>
+  <MAINTAINER>The Free Software Foundation Inc.</MAINTAINER>
+  <DESCRIPTION>This plugin enables the guile interpreter</DESCRIPTION>
+</PLUGIN>

-----------------------------------------------------------------------

Summary of changes:
 myserver/include/plugin/plugin.h                   |   11 +-
 myserver/src/plugin/plugin.cpp                     |   15 +-
 myserver/src/plugin/plugins_manager.cpp            |    2 +-
 myserver/tests/test_plugins_manager.cpp            |    9 +-
 plugins/src/{rules_checker => guile}/SConscript    |    8 +-
 .../src/guile/guile.cpp                            |   36 +-
 plugins/src/guile/plugin.xml                       |    9 +
 plugins/src/http_checker/http_checker.cpp          |    7 +-
 plugins/src/mime_magic/mime_magic.cpp              |   27 +-
 plugins/src/php/php.h                              |    7 +-
 plugins/src/python/python.cpp                      |  175 ++++----
 plugins/src/python/python.h                        |   70 ++--
 .../python_http_handler/python_http_handler.cpp    |  468 ++++++++++----------
 plugins/src/rules_checker/rules_checker.cpp        |   16 +-
 14 files changed, 413 insertions(+), 447 deletions(-)
 copy plugins/src/{rules_checker => guile}/SConscript (60%)
 copy myserver/src/protocol/http/dyn_http_manager.cpp => 
plugins/src/guile/guile.cpp (60%)
 create mode 100644 plugins/src/guile/plugin.xml


hooks/post-receive
-- 
GNU MyServer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]