[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue geas/examples/python/neil_methods_test.py ...
From: |
Neil Tiffin |
Subject: |
gnue geas/examples/python/neil_methods_test.py ... |
Date: |
Sat, 22 Sep 2001 17:46:35 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Neil Tiffin <address@hidden> 01/09/22 17:46:35
Modified files:
geas/examples/python: neil_methods_test.py
geas/src/methods: methods_python.c
gnue-config : neil_test.gcd
Log message:
Update tests and remove unsupported gcd stuff.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/examples/python/neil_methods_test.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/methods/methods_python.c.diff?cvsroot=OldCVS&tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-config/neil_test.gcd.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gnue/geas/examples/python/neil_methods_test.py
diff -u gnue/geas/examples/python/neil_methods_test.py:1.4
gnue/geas/examples/python/neil_methods_test.py:1.5
--- gnue/geas/examples/python/neil_methods_test.py:1.4 Fri Sep 21 14:40:21 2001
+++ gnue/geas/examples/python/neil_methods_test.py Sat Sep 22 17:46:35 2001
@@ -3,7 +3,7 @@
# a test file: relies on GEAS being run from gnue/geas/src
# and this from gnue/geas/examples/python
-# $Id: neil_methods_test.py,v 1.4 2001/09/21 18:40:21 ntiffin Exp $
+# $Id: neil_methods_test.py,v 1.5 2001/09/22 21:46:35 ntiffin Exp $
import sys
import md5
@@ -89,7 +89,9 @@
return obj_list
print
print "This query test requires the zip code database be loaded into GEAS.
Email"
-print "address@hidden if you do not have a copy of it."
+print "address@hidden if you do not have a copy of it"
+print "or you can get it from:"
+print "http://www.gnuenterprise.org/~neilt/insert-en-us-zipcodes.geas"
print
num_loops = 50
print "neil_methods_test.py"
@@ -103,7 +105,7 @@
while (x < num_loops):
try:
obj = con.newObject( "mod1::class1" )
- obj.setField("a_text_field","joe")
+ obj.setField("text_fld","joe")
obj.delete()
except GEAS.ServerError,ex:
print ex.detail
@@ -119,7 +121,7 @@
while (x < num_loops):
try:
obj = con.newObject( "mod1::class1" )
- obj.setField("a_text_field","joe")
+ obj.setField("text_fld","joe")
try:
a_result = obj.callMethod( "helloworld" , [a, b])
# print str(x) + ", Call method: " + str(a_result)
Index: gnue/geas/src/methods/methods_python.c
diff -u gnue/geas/src/methods/methods_python.c:1.10
gnue/geas/src/methods/methods_python.c:1.11
--- gnue/geas/src/methods/methods_python.c:1.10 Thu Sep 20 14:18:47 2001
+++ gnue/geas/src/methods/methods_python.c Sat Sep 22 17:46:35 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.10 2001/09/20 18:18:47 ntiffin Exp $
+ $Id: methods_python.c,v 1.11 2001/09/22 21:46:35 ntiffin Exp $
*/
/*
@@ -72,7 +72,7 @@
/* ========================================================================= *\
- * START PYTHON MODULE
+ * START C Code called as a python MODULE
\* ========================================================================= */
/* ------------------------------------------------------------------------- *\
@@ -112,6 +112,7 @@
return Py_BuildValue ("i", 1); /* succeed */
}
+
PyMethodDef method_system_methods[] = {
{"register_method", methods_register_python, METH_VARARGS}
,
@@ -119,8 +120,44 @@
};
+/* ========================================================================= *\
+ * Start generic python code - python must have intiialized by calling
+ * load_python_binding(), python_init_method_handling() and
+ * load_method_handlers(). These are normally called by the geas server.
+\* ========================================================================= */
+
+CORBA_char * /* TODO should be a structure that represents a type */
+python_execute_function( const char *function_name, GEAS_Arguments *args)
+{
+ g_return_val_if_fail (function_name, NULL);
+ g_return_val_if_fail (args, NULL);
+
+ /* find 'call' object */
+ 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);
+ if (!g_strcasecmp
+ (((provider_t *) list->data)->classname,
+ g_strdelimit (obj->classname, ":", '_'))
+ && !g_strcasecmp (((provider_t *) list->data)->methodname,
+ methodname))
+ {
+ function = ((provider_t *) list->data)->extra;
+ list = NULL;
+ }
+ if (list)
+ list = list->next;
+ }
+ return NULL;
+}
+
+
/* ========================================================================= *\
- * END PYTHON MODULE
+ * Start python method handling code
\* ========================================================================= */
@@ -187,7 +224,7 @@
PyRun_SimpleString ("import sys");
PyRun_SimpleString ("import method_system");
PyRun_SimpleString ("import CORBA");
- message (buf);
+ /* message (buf); */
PyRun_SimpleString (buf);
PyRun_SimpleString ("import GEAS");
g_free (buf);
@@ -311,8 +348,8 @@
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));
+ /* message ("Attempt to register method: %s_%s\n", full_classname,
+ odl_field_get_name (f)); */
PyRun_SimpleString (buf);
g_free (buf);
current_provider = NULL;
Index: gnue/gnue-config/neil_test.gcd
diff -u gnue/gnue-config/neil_test.gcd:1.1 gnue/gnue-config/neil_test.gcd:1.2
--- gnue/gnue-config/neil_test.gcd:1.1 Tue Sep 18 20:45:59 2001
+++ gnue/gnue-config/neil_test.gcd Sat Sep 22 17:46:35 2001
@@ -1,74 +1,56 @@
module mod1
{
- enum a_enum
- {
- first_emum,
- second_emum,
- third_emum
- };
type type1
{
- char a_char_8_field<8>;
- text a_text_field;
- float a_float_field;
- int a_int_field;
- int16 a_int16_field;
- int32 a_int32_field;
- int64 a_int64_field;
- boolean a_bool_field = true;
+ char char_8_fld<8>;
+ text text_fld;
+ float float_fld;
+ int int_fld;
+ int16 int16_fld;
+ int32 int32_fld;
+ int64 int64_fld;
+ boolean bool_fld = true;
};
-
- type type2
- {
- char a_char_8_field<8>;
- text a_text_field;
- float a_float_field;
- int a_int_field;
- int16 a_int16_field;
- int32 a_int32_field;
- int64 a_int64_field;
- boolean a_bool_field;
- };
-
+
class class1
{
#test_module_1::type1 * bad_type_ref1;
#test_module_1::type2 [] bad_type_list1;
- char a_char_8_field<8>;
- date a_date;
- text a_text_field;
- float a_float_field;
- int a_int_field;
- int16 a_int16_field;
- int32 a_int32_field;
- int64 a_int64_field;
- boolean a_bool_field;
- mod1::type2 a_type2;
- mod1::type1 a_type1;
+ char char_8_fld<8>;
+ date date_fld;
+ time time_fld;
+ text text_fld;
+ float float_fld;
+ int int_fld;
+ int16 int16_fld;
+ int32 int32_fld;
+ int64 int64_fld;
+ boolean boolean_fld;
+ bool bool_fld;
+
+ mod1::type1 t1;
+
+ list list_fld : mod1::class2(code) = this.char_8_fld;
text helloworld(char a, char b);
};
+
class class2
{
- char dummy<8>;
+ char code<8>;
+ reference ref_fld : mod1::class1(char_8_fld) = this.code;
};
- # class class2
+
class class3
{
mod1::class1 * a_ref_field;
mod1::class2 [] a_list_field;
- class class4
- {
- class class5
- {
- char dummy<8>;
- };
- };
};
};
+
module mod2
{
class class1 : mod1::class1
@@ -79,25 +61,6 @@
extend mod1::class1
{
- char an_extend_char_field<8>;
-};
-
-MODULE neil_order
-{
- class master
- {
- int order_number;
- char stuff<20>;
- int more_stuff;
- char the_last_stuff<20>;
- };
-
- class detail
- {
- int det_order_number;
- REFERENCE master_order_number : neil_order::master(order_number) =
this.det_order_number;
- int detail_stuff;
- char last_detail_stuff;
- };
+ char extend_char_fld<8>;
};
- gnue geas/examples/python/neil_methods_test.py ...,
Neil Tiffin <=