Author: ArcRiley Date: 2009-03-03 23:34:46 -0500 (Tue, 03 Mar 2009) New Revision: 1540
Modified: trunk/concordance/include/concordance.h trunk/concordance/src/_core/step.c Log: reverted multitype messaging Modified: trunk/concordance/include/concordance.h =================================================================== --- trunk/concordance/include/concordance.h 2009-03-04 04:34:41 UTC (rev 1539) +++ trunk/concordance/include/concordance.h 2009-03-04 04:34:46 UTC (rev 1540) @@ -59,12 +59,7 @@ PyObject* self; gchar* method; GAsyncQueue* returnQueue; /* callback return queue */ - union { - gint type1; /* type == 1 */ - GString* type2; /* type == 2 */ - } message; - gint message_type; /* message type (see above) */ - gint return_type; /* type response needs to be */ + GString* message; } concordQueueMsg; #endif Modified: trunk/concordance/src/_core/step.c =================================================================== --- trunk/concordance/src/_core/step.c 2009-03-04 04:34:41 UTC (rev 1539) +++ trunk/concordance/src/_core/step.c 2009-03-04 04:34:46 UTC (rev 1540) @@ -30,9 +30,7 @@ void g_free (gpointer mem); */ g_free(msg->method); - if (msg->message_type == 2) { - g_string_free(msg->message.type2, TRUE); - } + g_string_free(msg->message, TRUE); g_free(msg); } @@ -66,7 +64,7 @@ if (!popped) return; - /* call our handler method using correct message type + /* call our handler method PyObject* PyObject_CallMethod (PyObject *o, char *method, @@ -80,29 +78,14 @@ Therefore, Py_BuildValue will return NULL but won’t raise an exception. If no exception has been raised yet, SystemError is set. - i (integer) [int] - Convert a plain C int to a Python integer object. - U# (string) [char *, int] Convert a C string and its length to a Python unicode object. If the C string pointer is NULL, the length is ignored and None is returned. */ - switch (popped->message_type) { - case 1 : { - /* int message */ - output = PyEval_CallMethod(popped->self, popped->method, "Oi", - popped->self, popped->message.type1); - break; - } - case 2 : { - /* str message */ - output = PyEval_CallMethod(popped->self, popped->method, "OU#", - popped->self, - popped->message.type2->str, - popped->message.type2->len); - break; - } - } + output = PyEval_CallMethod(popped->self, popped->method, "OU#", + popped->self, + popped->message->str, + popped->message->len); if (!output) { /* free message struct and exit here if callback raised an error */ @@ -145,8 +128,8 @@ GString* g_string_assign (GString *string, const gchar *rval); */ - popped->message.type2 = g_string_assign(popped->message.type2, - concordPyUnicodeToUTF8(output)); + popped->message = g_string_assign(popped->message, + concordPyUnicodeToUTF8(output)); /* send response with the included self-addressed stamped envelope _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn