commit-gnue
[Top][All Lists]
Advanced

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

gnue/geas/src/methods methods_python.c


From: Neil Tiffin
Subject: gnue/geas/src/methods methods_python.c
Date: Thu, 20 Sep 2001 14:18:48 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Neil Tiffin <address@hidden>    01/09/20 14:18:48

Modified files:
        geas/src/methods: methods_python.c 

Log message:
        Reformate to GNU standards.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/methods/methods_python.c.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: gnue/geas/src/methods/methods_python.c
diff -u gnue/geas/src/methods/methods_python.c:1.9 
gnue/geas/src/methods/methods_python.c:1.10
--- gnue/geas/src/methods/methods_python.c:1.9  Tue Sep 18 20:45:59 2001
+++ gnue/geas/src/methods/methods_python.c      Thu Sep 20 14:18:47 2001
@@ -19,7 +19,7 @@
   along with GEAS; if not, write to the Free Software Foundation, Inc.,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-  $Id: methods_python.c,v 1.9 2001/09/19 00:45:59 ntiffin Exp $
+  $Id: methods_python.c,v 1.10 2001/09/20 18:18:47 ntiffin Exp $
 */
 
 /*
@@ -44,7 +44,7 @@
 
 #include "methods_python.h"
 
-#if USE_PYTHON_METHODS  
+#if USE_PYTHON_METHODS
 
 #define DEFAULT_IDL_FILE   "geas.idl"
 #define DEFAULT_METHOD_DIR "../examples/businessobjects/methods"
@@ -77,34 +77,36 @@
 
 /* ------------------------------------------------------------------------- *\
  * methods_register_python - this C function is called through python
- *   to get register the python stuff needed to call a method later.
+ *   to register the python stuff needed to call a method later.
 \* ------------------------------------------------------------------------- */
 
 static PyObject *
-methods_register_python(PyObject * self, PyObject * args)
+methods_register_python (PyObject * self, PyObject * args)
 {
   PyObject *function;
   char *methodname;
-  
-                            /*  g_assert (self); */
+
+  /*  g_assert (self); */
   g_assert (args);
 
   if (!PyArg_ParseTuple
       (args, "sO:methods_register_python", &methodname, &function))
     {
-      errormsg("Failed to parse tuple when registering method\n");
+      errormsg ("Failed to parse tuple when registering method\n");
       return Py_BuildValue ("i", 0);
     }
   Py_XINCREF (function);
-  PyObject_Print(function, stdout, 0);
+  PyObject_Print (function, stdout, 0);
   if (!PyCallable_Check (function))
     {
       Py_XDECREF (function);
-      errormsg("Attempt to register Python function that is not callable: 
%s\n", methodname);
+      errormsg
+        ("Attempt to register Python function that is not callable: %s\n",
+         methodname);
       return Py_BuildValue ("i", 0);
     }
   if (current_provider)
-    {                       /* save pointer to function for later use */
+    {                           /* save pointer to function for later use */
       current_provider->extra = (void *) function;
     }
   return Py_BuildValue ("i", 1);        /* succeed */
@@ -126,7 +128,7 @@
  * python_initialise_method_handling
 \* ------------------------------------------------------------------------- */
 gboolean
-python_init_method_handling(configuration config)
+python_init_method_handling (configuration config)
 {
   char *buf = NULL;
   PyObject *m;
@@ -199,7 +201,7 @@
   mainInterpreterState = mainThreadState->interp;
   py_threadstate = PyThreadState_New (mainInterpreterState);
   PyEval_ReleaseLock ();
-  
+
   return (TRUE);
 }
 
@@ -220,7 +222,7 @@
   GList *l, *l2;
   odl_class *c;
   char *full_classname;
-  
+
   g_return_val_if_fail (config, FALSE);
 
   PyEval_AcquireLock ();
@@ -237,7 +239,7 @@
   while (dirname[strlen (dirname) - 1] == '\\' ||
          dirname[strlen (dirname) - 1] == '/')
     dirname[strlen (dirname) - 1] = '\0';
-  message( "method dir name: '%s'" , dirname );
+  message ("method dir name: '%s'", dirname);
 
   dir = opendir (dirname);
   if (!dir)
@@ -246,10 +248,10 @@
       g_free (dirname);
       return (FALSE);
     }
-                       /* load all .py files into embedded python
-                          note that this executes the file and any
-                          non function code will be executed.
-                        */
+  /* load all .py files into embedded python
+     note that this executes the file and any
+     non function code will be executed.
+   */
   while ((entry = readdir (dir)) != NULL)
     {
       if (!strcmp (&entry->d_name[strlen (entry->d_name) - 3], ".py"))
@@ -262,28 +264,28 @@
               g_free (dirname);
               return (FALSE);
             }
-                             /* make sure it can be opened */
-                             /* TODO make sure this matches a gcd function */
+          /* make sure it can be opened */
+          /* TODO make sure this matches a gcd function */
           fp = fopen (name, "r");
           if (!name)
             {
               errormsg ("Could not open file '%s'", name);
               closedir (dir);
               g_free (dirname);
-              g_free (name);  /* TODO continue on with other names */
+              g_free (name);    /* TODO continue on with other names */
               return (FALSE);
             }
-                             /* run file 'name' */
+          /* run file 'name' */
           message ("Loading file %s", name);
           PyRun_SimpleFile (fp, name);
-                             /* done this file */
+          /* done this file */
           fclose (fp);
           g_free (name);
         }
     }
   closedir (dir);
   g_free (dirname);
-                             /* done loading, now register */
+  /* done loading, now register */
   lst = l = odl_tree_list_classes (all_classes);
   while (l)
     {
@@ -295,20 +297,22 @@
           char *buf;
           f = l2->data;
           debug_output (DEBUGLEVEL_2, "        method: %s",
-                        odl_field_get_name(f));
+                        odl_field_get_name (f));
           full_classname =
-            g_strdup_printf("%s__%s", (odl_class_get_parent(c))->name, 
odl_class_get_name (c)); 
+            g_strdup_printf ("%s__%s", (odl_class_get_parent (c))->name,
+                             odl_class_get_name (c));
           current_provider =
-            alloc_provider_data (full_classname, NULL,
-                                 odl_field_get_name(f), NULL);
+            alloc_provider_data (full_classname, NULL, odl_field_get_name (f),
+                                 NULL);
           provider_list = g_list_append (provider_list, current_provider);
 
           buf = g_strdup_printf
             ("method_system.register_method( \"%s_%s\" , %s_%s )",
-             full_classname, odl_field_get_name(f),
-             full_classname, odl_field_get_name(f));
+             full_classname, odl_field_get_name (f),
+             full_classname, odl_field_get_name (f));
           g_strdown (buf);
-          warnmsg("Attempt to register method: %s_%s\n", full_classname, 
odl_field_get_name (f) );
+          warnmsg ("Attempt to register method: %s_%s\n", full_classname,
+                   odl_field_get_name (f));
           PyRun_SimpleString (buf);
           g_free (buf);
           current_provider = NULL;
@@ -339,8 +343,8 @@
 \* ------------------------------------------------------------------------- */
 CORBA_char *
 python_execute_method (GEAS_object_reference * obj,
-                const char *methodname, GEAS_Arguments * args,
-                CORBA_Environment * ev)
+                       const char *methodname, GEAS_Arguments * args,
+                       CORBA_Environment * ev)
 {
   char *retval = NULL;
   // int i;
@@ -361,10 +365,10 @@
                                obj->sessionid, ev);
   if (ev->_major != CORBA_NO_EXCEPTION)
     {
-    /* didn't work */
-    return (NULL);
+      /* didn't work */
+      return (NULL);
     }
-    
+
   serverobj =
     make_connection_reference (obj->username, "server_allocated", ev);
   if (ev->_major != CORBA_NO_EXCEPTION)
@@ -378,10 +382,13 @@
   list = provider_list;
   while (list)
     {
-      g_message ("classname: %s = %s", ((provider_t *) list->data)->classname, 
obj->classname);
-      g_message ("fieldname: %s = %s", ((provider_t *) 
list->data)->methodname, methodname);
+      g_message ("classname: %s = %s", ((provider_t *) list->data)->classname,
+                 obj->classname);
+      g_message ("fieldname: %s = %s",
+                 ((provider_t *) list->data)->methodname, methodname);
       if (!g_strcasecmp
-          (((provider_t *) list->data)->classname, 
g_strdelimit(obj->classname,":", '_'))
+          (((provider_t *) list->data)->classname,
+           g_strdelimit (obj->classname, ":", '_'))
           && !g_strcasecmp (((provider_t *) list->data)->methodname,
                             methodname))
         {
@@ -421,8 +428,8 @@
       if (result != 0)
         {
           /*         printf( "result: " );
-                     PyObject_Print(result, stdout, 0);
-                     printf( "\n" ); */
+             PyObject_Print(result, stdout, 0);
+             printf( "\n" ); */
           if (PyString_AsString (result))
             {
               resultstr = g_strdup (PyString_AsString (result));
@@ -463,12 +470,12 @@
  * python_load_python_binding
 \* ------------------------------------------------------------------------- */
 static int
-load_python_binding(configuration config)
+load_python_binding (configuration config)
 {
   gpointer gsym;
   gchar *option_string;
   CORBA_to_Python_func = NULL;
-  
+
   g_assert (config);
 
   if (!g_module_supported ())
@@ -476,7 +483,8 @@
       errormsg ("glib dynamic module loading is not supported.");
       return (ERR_NO_GMODULE);
     }
-  option_string = get_global_option_str(config, "ORBit-python", 
ORBIT_PYTHON_SO);
+  option_string =
+    get_global_option_str (config, "ORBit-python", ORBIT_PYTHON_SO);
   orbit_python_library = g_module_open (option_string, G_MODULE_BIND_LAZY);
   if (!orbit_python_library)
     {
@@ -486,13 +494,13 @@
     }
   g_module_symbol (orbit_python_library, "CORBA_Object_to_PyObject", &gsym);
   CORBA_to_Python_func = gsym;
-  
+
 #ifdef __APPLE__
 #ifdef __ppc__
   /* TODO i wonder if this will work for linux stuff */
   /* for whatever reason without this i get dyld duplicate definition */
   /* because the module appears to be loaded already */
-  g_module_close(orbit_python_library);
+  g_module_close (orbit_python_library);
 #endif
 #endif
 
@@ -511,7 +519,8 @@
 /* ------------------------------------------------------------------------- *\
  * python_initialise_method_handling
 \* ------------------------------------------------------------------------- */
-gboolean python_init_method_handling(configuration config)
+gboolean
+python_init_method_handling (configuration config)
 {
   return FALSE;
 }
@@ -520,7 +529,8 @@
 /* ------------------------------------------------------------------------- *\
  * python_load_method_handlers
 \* ------------------------------------------------------------------------- */
-gboolean python_load_method_handlers (configuration config)
+gboolean
+python_load_method_handlers (configuration config)
 {
   return FALSE;
 }
@@ -529,7 +539,8 @@
 /* ------------------------------------------------------------------------- *\
  * python_shutdown_method_handling
 \* ------------------------------------------------------------------------- */
-gboolean python_shutdown_method_handling (void)
+gboolean
+python_shutdown_method_handling (void)
 {
   return FALSE;
 }
@@ -538,9 +549,10 @@
 /* ------------------------------------------------------------------------- *\
  * python_execute_method
 \* ------------------------------------------------------------------------- */
-CORBA_char * python_execute_method (GEAS_object_reference * obj,
-                const char *methodname, GEAS_Arguments * args,
-                CORBA_Environment * ev)
+CORBA_char *
+python_execute_method (GEAS_object_reference * obj,
+                       const char *methodname, GEAS_Arguments * args,
+                       CORBA_Environment * ev)
 {
   return NULL;
 }



reply via email to

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