diff options
author | Andreas Rottmann <a.rottmann@gmx.at> | 2009-02-27 00:17:16 +0100 |
---|---|---|
committer | Andreas Rottmann <a.rottmann@gmx.at> | 2009-02-27 00:17:16 +0100 |
commit | 7320bb9dfa92f28914ca18335e7f30d2bbce7e8f (patch) | |
tree | 0b20f81edf2907b7b226ebac2999c61510ca8dc6 /tools/generate.c | |
parent | 2912b22236bf25a3236a0465b7e790d8dbdd6dbd (diff) | |
download | gobject-introspection-7320bb9dfa92f28914ca18335e7f30d2bbce7e8f.tar.gz |
Add --all option to g-ir-generate
Add --all option, which is intended to show some information not
usually included in the GIR.
Currently, it shows the size of structs and unions.
Signed-off-by: Andreas Rottmann <a.rottmann@gmx.at>
Diffstat (limited to 'tools/generate.c')
-rw-r--r-- | tools/generate.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/generate.c b/tools/generate.c index 80c39807..b95e0522 100644 --- a/tools/generate.c +++ b/tools/generate.c @@ -32,6 +32,7 @@ /* FIXME: Avoid global */ static gchar *output = NULL; gchar **includedirs = NULL; +static gboolean show_all = FALSE; typedef struct { FILE *file; @@ -365,6 +366,12 @@ write_field_info (const gchar *namespace, xml_printf (file, "\""); } + if (show_all) + { + if (offset >= 0) + xml_printf (file, "offset=\"%d\"", offset); + } + write_type_info (namespace, type, file); g_base_info_unref ((GIBaseInfo *)type); @@ -568,6 +575,7 @@ write_struct_info (const gchar *namespace, gboolean deprecated; gboolean is_gtype_struct; gint i; + gint size; int n_elts; name = g_base_info_get_name ((GIBaseInfo *)info); @@ -597,6 +605,10 @@ write_struct_info (const gchar *namespace, if (is_gtype_struct) xml_printf (file, " glib:is-gtype-struct=\"1\""); + size = g_struct_info_get_size (info); + if (show_all && size >= 0) + xml_printf (file, " size=\"%d\"", size); + n_elts = g_struct_info_get_n_fields (info) + g_struct_info_get_n_methods (info); if (n_elts > 0) { @@ -1113,6 +1125,7 @@ write_union_info (const gchar *namespace, const gchar *type_init; gboolean deprecated; gint i; + gint size; name = g_base_info_get_name ((GIBaseInfo *)info); deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info); @@ -1129,6 +1142,9 @@ write_union_info (const gchar *namespace, if (deprecated) xml_printf (file, " deprecated=\"1\""); + size = g_union_info_get_size (info); + if (show_all && size >= 0) + xml_printf (file, " size=\"%d\"", size); if (g_union_info_is_discriminated (info)) { @@ -1349,7 +1365,8 @@ main (int argc, char *argv[]) { { "shlib", 0, 0, G_OPTION_ARG_NONE, &shlib, "handle typelib embedded in shlib", NULL }, { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" }, - { "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL }, + { "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL }, + { "all", 0, 0, G_OPTION_ARG_NONE, &show_all, "show all available information", NULL, }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL }, { NULL, } }; |