Author: ArcRiley Date: 2009-03-05 14:30:40 -0500 (Thu, 05 Mar 2009) New Revision: 1554
Modified: trunk/concordance/src/_core/__init__.c trunk/concordance/src/_core/step.c trunk/concordance/src/services/Service.c trunk/concordance/src/services/__init__.c trunk/concordance/src/sockets/Client.c trunk/concordance/src/sockets/Socket.c trunk/concordance/src/sockets/__init__.c trunk/concordance/src/utils.c Log: removed trailing spaces Modified: trunk/concordance/src/_core/__init__.c =================================================================== --- trunk/concordance/src/_core/__init__.c 2009-03-05 19:30:36 UTC (rev 1553) +++ trunk/concordance/src/_core/__init__.c 2009-03-05 19:30:40 UTC (rev 1554) @@ -175,17 +175,17 @@ /* Initialize Glib threading support gboolean g_thread_supported (); - This function returns TRUE if the thread system is initialized, and - FALSE if it is not. + This function returns TRUE if the thread system is initialized, and + FALSE if it is not. void g_thread_init (GThreadFunctions *vtable); - If you use GLib from more than one thread, you must initialize the - thread system by calling g_thread_init(). Most of the time you will + If you use GLib from more than one thread, you must initialize the + thread system by calling g_thread_init(). Most of the time you will only have to call g_thread_init (NULL). */ if (!g_thread_supported()) g_thread_init(NULL); - + #ifdef MS_WINDOWS /* initialize wsaData if it hasn't already @@ -200,21 +200,21 @@ wsaInit = TRUE; } #endif - - + + /* Create concordance module object PyObject* PyModule_Create(struct PyModuleDef*) */ module = PyModule_Create(&concord_Module); - + /* Retrieve the module-global state, which will be initialized to zero by the above based on m_size in concord_Module - + void* PyModule_GetState (PyObject*); */ globals = (concordGlobals*) PyModule_GetState(module); - + /* We use a non-default context to avoid conflict with other glib-based Python packages which may have their own GMainLoop in other threads. Modified: trunk/concordance/src/_core/step.c =================================================================== --- trunk/concordance/src/_core/step.c 2009-03-05 19:30:36 UTC (rev 1553) +++ trunk/concordance/src/_core/step.c 2009-03-05 19:30:40 UTC (rev 1554) @@ -58,7 +58,7 @@ if (!pmsg) Py_RETURN_NONE; - /* call the appropriate Python method + /* call the appropriate Python method PyObject* PyObject_CallMethod (PyObject *o, char *method, @@ -82,7 +82,7 @@ concordMsg_xmlStart* msg = (concordMsg_xmlStart*) pmsg; /* create a TreeBuilder if one wasn't provided */ - if (!*msg->tree) { + if (!*msg->tree) { if (!(temp = PyImport_ImportModule("xml.etree.cElementTree"))) BREAKNULL *msg->tree = PyEval_CallMethod(temp, "TreeBuilder", "()"); @@ -103,7 +103,7 @@ /* add element to tree - decref return value since we don't want/need it yet. + decref return value since we don't want/need it yet. */ temp = PyEval_CallMethod(*msg->tree, "start", "(UO)", msg->name, atts); @@ -111,7 +111,7 @@ Py_DECREF(atts); /* check to ensure the method returned ok */ - if (!temp) + if (!temp) BREAKNULL /* decref return value since we don't want/need it yet */ @@ -146,7 +146,7 @@ Py_DECREF(temp); break; } - + case CONCORD_MT_XMLCLOSE : { /*\ cdef : \*/ concordMsg_xmlClose* msg = (concordMsg_xmlClose*) pmsg; @@ -159,7 +159,7 @@ /* discard old TreeBuilder */ Py_DECREF(*msg->tree); *msg->tree = NULL; - + output = PyEval_CallMethod(msg->self, "xml", "(O)", temp); if (!output) BREAKNULL @@ -202,7 +202,7 @@ PyErr_SetString(PyExc_TypeError, "bad return type from XML handler"); BREAKNULL } - + case CONCORD_MT_SASL : { /*\ cdef : \*/ concordMsg_sasl* msg = (concordMsg_sasl*) pmsg; @@ -213,24 +213,24 @@ /* set callback hook to current message - + void gsasl_session_hook_set (Gsasl_session * sctx, void * hook); */ gsasl_session_hook_set(msg->sctx, (gpointer) msg); /* process gsasl step with base64 conversion - + int gsasl_step64 (Gsasl_session *sctx, const char *b64input, char **b64output); */ status = gsasl_step64(msg->sctx, msg->inpt->str, &output); - /* break here if Python callback raised an exception */ + /* break here if Python callback raised an exception */ if (PyErr_Occurred()) BREAKNULL - + switch (status) { case GSASL_OK : { element = "success"; @@ -310,7 +310,7 @@ g_free(msg); break; } - + case CONCORD_MT_XMLEND : { /*\ cdef : \*/ concordMsg_xmlEnd* msg = (concordMsg_xmlEnd*) pmsg; @@ -318,7 +318,7 @@ g_free(msg); break; } - + case CONCORD_MT_XMLCHARDATA : { /*\ cdef : \*/ concordMsg_xmlCharData* msg = (concordMsg_xmlCharData*) pmsg; @@ -334,12 +334,12 @@ g_free(pmsg); break; } - + default : g_free(pmsg); break; } - + /* return either NULL or None depending on BREAKNULL or break; */ if (err) return NULL; Modified: trunk/concordance/src/services/Service.c =================================================================== --- trunk/concordance/src/services/Service.c 2009-03-05 19:30:36 UTC (rev 1553) +++ trunk/concordance/src/services/Service.c 2009-03-05 19:30:40 UTC (rev 1554) @@ -80,22 +80,22 @@ _new(PyTypeObject* type, PyObject* args, PyObject* kwds) { /*\ cdef : \*/ servicesService_Object* self; - + /* this is lowest level, just alloc */ self = (servicesService_Object*) type->tp_alloc(type, 0); if (!self) return NULL; /* Get a reference to our local module - + This is to keep our module alive as long as this instance. - + PyObject* PyImport_ImportModule (const char *name); */ self->module = PyImport_ImportModule("concordance.services"); - - self->domain = NULL; + self->domain = NULL; + /* return self */ return (PyObject*) self; } @@ -109,14 +109,14 @@ /* decref our module handle*/ if (self->module) Py_DECREF(self->module); - + if (self->domain) g_free(self->domain); - /* lastly delete the object */ + /* lastly delete the object */ PyObject_Del(self); - } - + } + /* # ########################################################################### Modified: trunk/concordance/src/services/__init__.c =================================================================== --- trunk/concordance/src/services/__init__.c 2009-03-05 19:30:36 UTC (rev 1553) +++ trunk/concordance/src/services/__init__.c 2009-03-05 19:30:40 UTC (rev 1554) @@ -48,23 +48,23 @@ /* Initialize Glib threading support gboolean g_thread_supported (); - This function returns TRUE if the thread system is initialized, and - FALSE if it is not. + This function returns TRUE if the thread system is initialized, and + FALSE if it is not. void g_thread_init (GThreadFunctions *vtable); - If you use GLib from more than one thread, you must initialize the - thread system by calling g_thread_init(). Most of the time you will + If you use GLib from more than one thread, you must initialize the + thread system by calling g_thread_init(). Most of the time you will only have to call g_thread_init (NULL). */ if (!g_thread_supported()) g_thread_init(NULL); - /* set pointers + /* set pointers /* Initialize all types prior to module creation int PyType_Ready(PyTypeObject*) - Finalize a type object. This should be called on all type objects to - finish their initialization. This function is responsible for adding + Finalize a type object. This should be called on all type objects to + finish their initialization. This function is responsible for adding inherited slots from a type’s base class. Return 0 on success, or return -1 and sets an exception on error. */ Modified: trunk/concordance/src/sockets/Client.c =================================================================== --- trunk/concordance/src/sockets/Client.c 2009-03-05 19:30:36 UTC (rev 1553) +++ trunk/concordance/src/sockets/Client.c 2009-03-05 19:30:40 UTC (rev 1554) @@ -46,7 +46,7 @@ guint addrlen = sizeof(addr); socketsClient_Data* session; GSource* source; - + /* accept new connection, return if we fail to connect int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); @@ -102,7 +102,7 @@ g_source_unref(source); /* specify "raw" channel by turning off encoding and buffering - + GIOStatus g_io_channel_set_encoding(GIOChannel *channel, const gchar *encoding, GError **error); @@ -145,9 +145,9 @@ /* this will be the TreeBuilder object for the session */ session->tree = NULL; - + /* lookup hostname - currently unimplemented */ - + /* return true so GMainLoop will continue watching this channel */ return TRUE; } @@ -179,7 +179,7 @@ /* before parsing, reset connection if it needs to be */ if (session->state == CONCORD_E_RESET) { /* reset XML parser and stream state - + XML_Bool XML_ParserReset (XML_Parser p, const XML_Char *encoding); */ @@ -263,7 +263,7 @@ cdef : \*/ socketsClient_Object* self = session->self; guint sent; - GSource* source; + GSource* source; /* make sure the session write buffer is empty first */ if (session->wbuff->len == 0) { @@ -391,7 +391,7 @@ NULL, /*finalize*/ }; - + /* # ########################################################################### @@ -667,7 +667,7 @@ void g_string_append_printf (GString *string, const gchar *format, ...); - + g_string_printf(session->ebuff, "<%s xmlns='%s'", element[1], element[0]); for (i = 0; atts[i]; i += 2) @@ -685,7 +685,7 @@ if (g_ascii_strcasecmp(element[1], "auth") == 0) { gchar* mec = concordFindAttr(atts, "mechanism"); if (!mec) { - mec = ""; + mec = ""; } /* initiate server session @@ -698,7 +698,7 @@ */ gsasl_server_start(self->saslCntx, mec, &session->sctx); if (session->srvc) { - gsasl_property_set(session->sctx, GSASL_REALM, + gsasl_property_set(session->sctx, GSASL_REALM, ((servicesService_Object*) session->srvc)->domain); } @@ -730,7 +730,7 @@ void g_string_append_printf (GString *string, const gchar *format, ...); - + g_string_append_printf(session->ebuff, "<%s xmlns='%s'", element[1], element[0]); for (i = 0; atts[i]; i += 2) @@ -818,7 +818,7 @@ /* push message onto queue */ g_async_queue_push(self->queueCall, pmsgs); - + /* create a new ebuff since we just handed our last to Python */ session->ebuff = g_string_new(""); break; @@ -842,9 +842,9 @@ pmsge->type = CONCORD_MT_XMLEND; pmsge->tree = &session->tree; pmsge->name = g_strjoin(NULL, "{", name, NULL); - + /* push message onto queue */ - g_async_queue_push(self->queueCall, pmsge); + g_async_queue_push(self->queueCall, pmsge); } break; } @@ -855,7 +855,7 @@ void g_strfreev (gchar **str_array); */ g_strfreev(element); - } + } static void Modified: trunk/concordance/src/sockets/Socket.c =================================================================== --- trunk/concordance/src/sockets/Socket.c 2009-03-05 19:30:36 UTC (rev 1553) +++ trunk/concordance/src/sockets/Socket.c 2009-03-05 19:30:40 UTC (rev 1554) @@ -216,7 +216,7 @@ gint socket; struct sockaddr addr; guint addrlen = sizeof(addr); - + /* accept new connection, return if we fail to connect int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); @@ -229,7 +229,7 @@ /* this is a generic Socket object, just close incoming connections */ close(socket); - + /* return true so GMainLoop will continue watching this channel */ return TRUE; } @@ -247,14 +247,14 @@ cdef : \*/ socketsSocket_Object* self; PyObject* _core; - + /* this is lowest level, just alloc */ self = (socketsSocket_Object*) type->tp_alloc(type, 0); if (!self) return NULL; /* set addr, port, and sock to default values - + 0.0.0.0 = listen to every available interface port is overridden by child class */ @@ -263,13 +263,13 @@ self->sock = -1; /* Get a reference to our local module - + This is to keep our module alive as long as this instance. - + PyObject* PyImport_ImportModule (const char *name); */ self->module = PyImport_ImportModule("concordance.sockets"); - + /* Get context from global state I'm sorry for this. Here's the natural language for this block: @@ -294,7 +294,7 @@ GAsyncQueue* g_async_queue_new (void); */ self->queueRetn = g_async_queue_new(); - + /* create new domains hashtable GHashTable* g_hash_table_new_full (GHashFunc hash_func, @@ -331,9 +331,9 @@ if (self->module) Py_DECREF(self->module); - /* lastly delete the object */ + /* lastly delete the object */ PyObject_Del(self); - } + } /* # @@ -347,7 +347,7 @@ socketsSocket_Object* self = (socketsSocket_Object*) s; /* return number of domains - + guint g_hash_table_size (GHashTable *hash_table); */ return (Py_ssize_t) g_hash_table_size(self->domains); @@ -368,7 +368,7 @@ /* get the UTF8 key */ key = concordPyUnicodeToUTF8(k); - + /* lookup value in domains table gpointer g_hash_table_lookup (GHashTable *hash_table, @@ -411,7 +411,7 @@ return -1; } /* insert key:value into table, freeing existing value if needed - + void g_hash_table_insert (GHashTable *hash_table, gpointer key, gpointer value); @@ -421,7 +421,7 @@ } else { /* delete key from table - + gboolean g_hash_table_remove (GHashTable *hash_table, gconstpointer key); */ @@ -432,11 +432,11 @@ g_free(key); PyErr_SetString(PyExc_KeyError, "domain not found"); return -1; - } + } } return 0; } - + /* # ########################################################################### Modified: trunk/concordance/src/sockets/__init__.c =================================================================== --- trunk/concordance/src/sockets/__init__.c 2009-03-05 19:30:36 UTC (rev 1553) +++ trunk/concordance/src/sockets/__init__.c 2009-03-05 19:30:40 UTC (rev 1554) @@ -53,12 +53,12 @@ /* Initialize Glib threading support gboolean g_thread_supported (); - This function returns TRUE if the thread system is initialized, and - FALSE if it is not. + This function returns TRUE if the thread system is initialized, and + FALSE if it is not. void g_thread_init (GThreadFunctions *vtable); - If you use GLib from more than one thread, you must initialize the - thread system by calling g_thread_init(). Most of the time you will + If you use GLib from more than one thread, you must initialize the + thread system by calling g_thread_init(). Most of the time you will only have to call g_thread_init (NULL). */ if (!g_thread_supported()) g_thread_init(NULL); @@ -66,8 +66,8 @@ /* Initialize all types prior to module creation int PyType_Ready(PyTypeObject*) - Finalize a type object. This should be called on all type objects to - finish their initialization. This function is responsible for adding + Finalize a type object. This should be called on all type objects to + finish their initialization. This function is responsible for adding inherited slots from a type’s base class. Return 0 on success, or return -1 and sets an exception on error. */ @@ -86,7 +86,7 @@ return NULL; /* Copy pointer to external types - + */ servicesService_TypeP = (servicesService_TypeObject*) PyObject_GetAttrString(services, "Service"); Modified: trunk/concordance/src/utils.c =================================================================== --- trunk/concordance/src/utils.c 2009-03-05 19:30:36 UTC (rev 1553) +++ trunk/concordance/src/utils.c 2009-03-05 19:30:40 UTC (rev 1554) @@ -127,10 +127,10 @@ cdef : \*/ gint i; gchar map[] = "0123456789abcdefghijklmnopqrstuv"; - + for (i = 0; i<15; i += 1) { /* generate a 5-bit random int and map it to an alphanumeric value - + gint32 g_random_int_range (gint32 begin, gint32 end); */ _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn