Copyright (C) 2000-2012 |
GNU Info (libIDL.info)ExampleUsage ***** The following C program using libIDL will parse an IDL file and print the Repository IDs of the interfaces in the IDL module. #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <libIDL/IDL.h> gboolean print_repo_id (IDL_tree_func_data *tfd, gpointer user_data) { char *repo_id = NULL; if (IDL_NODE_TYPE (tfd->tree) == IDLN_INTERFACE) repo_id = IDL_IDENT_REPO_ID (IDL_INTERFACE (tfd->tree).ident); if (repo_id) printf ("%s\n", repo_id); return TRUE; } int main (int argc, char *argv[]) { IDL_tree tree; IDL_ns ns; char *fn; int rv; if (argc < 2) { fprintf (stderr, "usage: %s <file>\n", argv[0]); exit (1); } fn = argv[1]; rv = IDL_parse_filename (fn, NULL, NULL, &tree, &ns, 0, IDL_WARNING1); if (rv == IDL_ERROR || rv < 0) { if (rv < 0) perror (fn); exit (1); } IDL_tree_walk_in_order (tree, print_repo_id, NULL); IDL_ns_free (ns); IDL_tree_free (tree); return 0; } automatically generated by info2www version 1.2.2.9 |