Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/bin Modified Files: ecore_dbus_receiver_test.c ecore_dbus_test.c Log Message: support arrays (via a more general marshal function) add utility function to get length of a "complete type" in the signature this assumes the signature is valid. we should probably add a validator (and enfore the recursion limits in the spec) =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/bin/ecore_dbus_receiver_test.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ecore_dbus_receiver_test.c 27 Sep 2006 23:37:01 -0000 1.3 +++ ecore_dbus_receiver_test.c 29 Sep 2006 02:04:06 -0000 1.4 @@ -101,21 +101,35 @@ { Ecore_DBus_Message *msg; unsigned int *i; - char *s; + char *s1, *s2; + Ecore_List *l; + int first; printf("received call to test!\n"); msg = event->message; i = (unsigned int *)ecore_dbus_message_body_field_get(msg, 0); - s = (char *)ecore_dbus_message_body_field_get(msg, 1); + s1 = (char *)ecore_dbus_message_body_field_get(msg, 1); + l = (Ecore_List *)ecore_dbus_message_body_field_get(msg, 2); + s2 = (char *)ecore_dbus_message_body_field_get(msg, 3); - if (!i || !s) + if (!i || !s1 || !l || !s2) { /* XXX reply with error */ return; } - printf(" params: i = %d, s = \"%s\"\n", i ? *i : 0, s); + printf(" params: i = %d, s1 = \"%s\", l = (", i ? *i : 0, s1); + ecore_list_goto_first(l); + first = 1; + while(i = ecore_list_next(l)) + { + if (!first) printf(", "); + else first = 0; + + printf("%d", i ? *i : 0); + } + printf("), s2: %s\n", s2); } static void =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/bin/ecore_dbus_test.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- ecore_dbus_test.c 27 Sep 2006 23:37:01 -0000 1.14 +++ ecore_dbus_test.c 29 Sep 2006 02:04:06 -0000 1.15 @@ -13,6 +13,7 @@ static void ecore_dbus_method_error_cb(void *data, const char *error); static const char *event_type_get(Ecore_DBus_Message_Type type); +static void _test_type_length(); static Ecore_DBus_Server *svr = NULL; @@ -21,6 +22,7 @@ { ecore_dbus_init(); + _test_type_length(); svr = ecore_dbus_server_session_connect(NULL); if (!svr) { @@ -53,12 +55,24 @@ ecore_dbus_event_server_add(void *udata, int ev_type, void *ev) { Ecore_DBus_Event_Server_Add *event; + Ecore_List *ids; + int i; event = ev; printf("ecore_dbus_event_server_add\n"); ecore_dbus_method_list_names(event->server, ecore_dbus_method_list_names_cb, ecore_dbus_method_error_cb, NULL); + + ids = ecore_list_new(); + ecore_list_set_free_cb(ids, free); + for(i = 0; i < 5; i++) + { + unsigned int *id; + id = malloc(sizeof(int)); + *id = i * 2; + ecore_list_append(ids, id); + } ecore_dbus_message_new_method_call(event->server, "/org/enlightenment/test" /*path*/, "org.enlightenment.Test" /*interface*/, @@ -66,8 +80,10 @@ "org.enlightenment.Test" /*destination*/, ecore_dbus_method_test_cb, ecore_dbus_method_error_cb, NULL, - "us" /*fmt*/, - 5, "hello"); + "usaus" /*fmt*/, + 5, "hello", ids, "goodbye"); + + ecore_list_destroy(ids); return 0; } @@ -139,6 +155,29 @@ return "ECORE_DBUS_MESSAGE_TYPE_SIGNAL"; } return "UNKNOWN"; +} + +//int _ecore_dbus_complete_type_length(const char *); +static void +_test_type_length() +{ +#define _NUM_TYPES 4 + struct { char *type; int len; } types[_NUM_TYPES] = { + { "us", 1 }, + { "ads", 2 }, + { "a(a(ai))su", 8 }, + { "a{ss}u", 5 } + }; + + int i; + + printf("Test type length\n---------------\n"); + for (i = 0; i < _NUM_TYPES; i++) + { + int len = _ecore_dbus_complete_type_length_get(types[i].type); + printf("\"%s\" => %d (expected %d) %s\n", types[i].type, len, types[i].len, len == types[i].len ? "PASS" : "FAIL"); + } + printf("---------------\n"); } #else ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs