From dc12fac5f8a36d0276719bc5a98aa63bffe86399 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 17 Feb 2005 21:11:18 +0000 Subject: 2005-02-17 Colin Walters * glib/dbus-gparser.c (struct Parser): Add in_annotation boolean. (parse_node, parse_interface, parse_method, parse_signal) (parse_property, parse_annotation): Lose if we're currently in an annotation. (parse_annotation): New function. (parser_start_element, parser_end_element): Handle annotation. (parse_method, parse_interface): Remove support for c_name attribute, switch to annotations. * glib/dbus-gidl.h (interface_info_get_binding_names) (method_info_get_binding_names) (interface_info_get_binding_name, method_info_get_binding_name) (interface_info_set_binding_name, method_info_set_binding_name): Remove. (interface_info_get_annotations, method_info_get_annotations) (interface_info_get_annotation, method_info_get_annotation) (interface_info_add_annotation, method_info_add_annotation): Prototype. * glib/dbus-gidl.c (struct InterfaceInfo): Substitute "annotations" for "bindings". (struct MethodInfo): Ditto. Straightfoward conversion of binding methods into annotation methods as prototyped. * glib/dbus-glib-tool.c (pretty_print): Print annotations. * glib/dbus-binding-tool-glib.h (DBUS_GLIB_ANNOTATION_C_SYMBOL): Define. * glib/dbus-binding-tool-glib.c (gather_marshallers, generate_glue): Use new annotation API. * doc/introspect.dtd: Fix a number of DTD syntax errors. Add annotation element. * doc/dbus-specification.xml: Discuss introspection annotations, include list of well-known annotations. * test/glib/test-service-glib.xml: Make validate against new DTD. --- glib/dbus-gidl.c | 60 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'glib/dbus-gidl.c') diff --git a/glib/dbus-gidl.c b/glib/dbus-gidl.c index 554e18c3..fb9573e5 100644 --- a/glib/dbus-gidl.c +++ b/glib/dbus-gidl.c @@ -43,7 +43,7 @@ struct NodeInfo struct InterfaceInfo { BaseInfo base; - GHashTable *bindings; + GHashTable *annotations; /* Since we have BaseInfo now these could be one list */ GSList *methods; GSList *signals; @@ -53,7 +53,7 @@ struct InterfaceInfo struct MethodInfo { BaseInfo base; - GHashTable *bindings; + GHashTable *annotations; GSList *args; }; @@ -345,9 +345,9 @@ interface_info_new (const char *name) info->base.refcount = 1; info->base.name = g_strdup (name); info->base.type = INFO_TYPE_INTERFACE; - info->bindings = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_free); + info->annotations = g_hash_table_new_full (g_str_hash, g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_free); return info; } @@ -366,7 +366,7 @@ interface_info_unref (InterfaceInfo *info) info->base.refcount -= 1; if (info->base.refcount == 0) { - g_hash_table_destroy (info->bindings); + g_hash_table_destroy (info->annotations); free_method_list (&info->methods); free_signal_list (&info->signals); free_property_list (&info->properties); @@ -381,16 +381,16 @@ interface_info_get_name (InterfaceInfo *info) } GSList * -interface_info_get_binding_names (InterfaceInfo *info) +interface_info_get_annotations (InterfaceInfo *info) { - return get_hash_keys (info->bindings); + return get_hash_keys (info->annotations); } const char* -interface_info_get_binding_name (InterfaceInfo *info, - const char *binding_type) +interface_info_get_annotation (InterfaceInfo *info, + const char *name) { - return g_hash_table_lookup (info->bindings, binding_type); + return g_hash_table_lookup (info->annotations, name); } GSList* @@ -412,13 +412,13 @@ interface_info_get_properties (InterfaceInfo *info) } void -interface_info_set_binding_name (InterfaceInfo *info, - const char *binding_type, - const char *bound_name) +interface_info_add_annotation (InterfaceInfo *info, + const char *name, + const char *value) { - g_hash_table_insert (info->bindings, - g_strdup (binding_type), - g_strdup (bound_name)); + g_hash_table_insert (info->annotations, + g_strdup (name), + g_strdup (value)); } void @@ -470,7 +470,7 @@ method_info_new (const char *name) info->base.refcount = 1; info->base.name = g_strdup (name); info->base.type = INFO_TYPE_METHOD; - info->bindings = g_hash_table_new_full (g_str_hash, g_str_equal, + info->annotations = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_free); @@ -491,7 +491,7 @@ method_info_unref (MethodInfo *info) info->base.refcount -= 1; if (info->base.refcount == 0) { - g_hash_table_destroy (info->bindings); + g_hash_table_destroy (info->annotations); free_arg_list (&info->args); base_info_free (info); } @@ -504,16 +504,16 @@ method_info_get_name (MethodInfo *info) } GSList * -method_info_get_binding_names (MethodInfo *info) +method_info_get_annotations (MethodInfo *info) { - return get_hash_keys (info->bindings); + return get_hash_keys (info->annotations); } const char* -method_info_get_binding_name (MethodInfo *info, - const char *binding_type) +method_info_get_annotation (MethodInfo *info, + const char *name) { - return g_hash_table_lookup (info->bindings, binding_type); + return g_hash_table_lookup (info->annotations, name); } GSList* @@ -544,13 +544,13 @@ args_sort_by_direction (const void *a, } void -method_info_set_binding_name (MethodInfo *info, - const char *binding_type, - const char *bound_name) +method_info_add_annotation (MethodInfo *info, + const char *name, + const char *value) { - g_hash_table_insert (info->bindings, - g_strdup (binding_type), - g_strdup (bound_name)); + g_hash_table_insert (info->annotations, + g_strdup (name), + g_strdup (value)); } void -- cgit