source: trunk/third/ORBit/libIDL/libIDL.info @ 15271

Revision 15271, 11.4 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15270, which included commits to RCS files with non-trunk default branches.
Line 
1This is libIDL.info, produced by makeinfo version 4.0 from libIDL.texi.
2
3INFO-DIR-SECTION Libraries
4START-INFO-DIR-ENTRY
5* libIDL: (libIDL).     Interface Definition Language parsing library.
6END-INFO-DIR-ENTRY
7
8   Copyright 1998 Andrew T. Veliath
9
10
11File: libIDL.info,  Node: Top,  Up: (dir)
12
13   This file documents the Interface Definition Language (IDL) parsing
14library, libIDL.
15
16   This document applies to version 0.6 of libIDL.  It is still
17incomplete.
18
19* Menu:
20
21* Overview::                  General overview.
22* Example::                   Simple example.
23* Reference::                 Data structure and function reference.
24
25* Function Index::            Index of available functions.
26
27
28File: libIDL.info,  Node: Overview,  Next: Example,  Prev: Top,  Up: Top
29
30Overview
31********
32
33   libIDL is a library licensed under the GNU LGPL for creating trees of
34CORBA Interface Definition Language (IDL) files, which is a
35specification for defining portable interfaces.  libIDL was initially
36written for ORBit (the ORB from the GNOME project, and the primary
37means of libIDL distribution).  However, the functionality was designed
38to be as reusable and portable as possible.
39
40   It is written in C, and the aim is to retain the ability to compile
41it on a system with a standard C compiler.  Preprocessed parser files
42are included so you are not forced to rebuild the parser, however an
43effort is made to keep the parser and lexer compatible with standard
44Unix yacc and lex (although bison and flex are more efficient, and are
45used for the preprocessed parsers in the distribution).
46
47   With libIDL, you can parse an IDL file which will be automatically
48run through the C preprocessor (on systems with one available), and have
49detailed error and warning messages displayed.  On a compilation
50without errors, the tree is returned to the custom application.  libIDL
51performs compilation phases from lexical analysis to nearly full
52semantic analysis with some optimizations, and will attempt to generate
53meaningful errors and warnings for invalid or deprecated IDL.
54
55   libIDL exports functionality used to generate detailed conforming
56error and warning messages in gcc-like format, and also comes with a
57default backend to generate IDL into a file or string (useful for
58customized messages or comments in the output).  The IDL backend is
59complete enough that most generated IDL can be reparsed by libIDL
60without errors. libIDL returns separate syntax and namespace trees, and
61includes functionality to hide syntactical information from the primary
62tree, while keeping it accessible through the namespace for type
63information and name lookup.
64
65   Optional extensions to standard IDL can be enabled using parse flags.
66These include node properties, embedded code fragments, and XPIDL.
67Nodes can also have declarations tags which assign particular
68attributions to certain IDL constructs to further facilitate custom
69applications.
70
71
72File: libIDL.info,  Node: Example,  Next: Reference,  Prev: Overview,  Up: Top
73
74Usage
75*****
76
77   The following C program using libIDL will parse an IDL file and print
78the Repository IDs of the interfaces in the IDL module.
79
80     #include <assert.h>
81     #include <stdio.h>
82     #include <stdlib.h>
83     #include <libIDL/IDL.h>
84     
85     gboolean
86     print_repo_id (IDL_tree_func_data *tfd, gpointer user_data)
87     {
88        char *repo_id = NULL;
89     
90        if (IDL_NODE_TYPE (tfd->tree) == IDLN_INTERFACE)
91                repo_id = IDL_IDENT_REPO_ID (IDL_INTERFACE (tfd->tree).ident);
92     
93        if (repo_id)
94                printf ("%s\n", repo_id);
95     
96        return TRUE;
97     }
98     
99     int
100     main (int argc, char *argv[])
101     {
102        IDL_tree tree;
103        IDL_ns ns;
104        char *fn;
105        int rv;
106     
107        if (argc < 2) {
108                fprintf (stderr, "usage: %s <file>\n", argv[0]);
109                exit (1);
110        }
111        fn = argv[1];
112     
113        rv = IDL_parse_filename (fn, NULL, NULL, &tree, &ns, 0, IDL_WARNING1);
114     
115        if (rv == IDL_ERROR || rv < 0) {
116                if (rv < 0)
117                        perror (fn);
118                exit (1);
119        }
120        IDL_tree_walk_in_order (tree, print_repo_id, NULL);
121        IDL_ns_free (ns);
122        IDL_tree_free (tree);
123     
124        return 0;
125     }
126
127
128File: libIDL.info,  Node: Reference,  Next: Function Index,  Prev: Example,  Up: Top
129
130Reference
131*********
132
133* Menu:
134
135* Data Types::                Constructed data types used.
136* Functions::                 Functions provided.
137* Extensions::                Extensions provided to standard IDL.
138* Tree Structure::            The C IDL tree representation.
139
140
141File: libIDL.info,  Node: Data Types,  Next: Functions,  Up: Reference
142
143Data Types
144**********
145
146   * IDL_tree
147
148     A semi-opaque tree which encapsulates an IDL tree node.  Must be
149     freed with IDL_tree_free (*note Functions::).
150
151   * IDL_ns
152
153     A semi-opaque structure which encapsulates the IDL module
154     namespace.  Must be freed with IDL_ns_free (*note Functions::).
155
156   * IDL_msg_callback
157
158     Defined as typedef int (*IDL_msg_callback)(int LEVEL, int NUM, int
159     LINE, const char *NAME, const char *ERR).  A function of this type
160     can be optionally passed to IDL_parse_filename to be called when a
161     parse warning or error occurs.
162
163   * IDL_tree_func
164
165     Defined as typedef gboolean (*IDL_tree_func) (IDL_tree_func_data
166     *TREE_FUNC_DATA, gpointer DATA).  A function of this type is
167     passed to IDL_tree_walk_in_order to traverse the tree.
168     TREE_FUNC_DATA contains an up traversal hierarchy of the current
169     traversal, as well as some state information.  The current node
170     being processed is given by TREE_FUNC_DATA->tree.
171
172
173
174File: libIDL.info,  Node: Functions,  Next: Extensions,  Prev: Data Types,  Up: Reference
175
176Functions
177*********
178
179   * Function: int IDL_parse_filename (const char *NAME, const char
180     *CPP_ARGS, IDL_msg_callback CALLBACK, IDL_tree *TREE, IDL_ns *NS,
181     unsigned long FLAGS, int MAX_MESSAGE_LEVEL)
182
183     Parse an file containing an IDL definition into a parse tree.
184     Returns IDL_SUCCESS if successful, or IDL_ERROR if there was a
185     parse error.  If -1 is returned, errno will be set accordingly.
186     Usually, if IDL_ERROR is returned, all one needs to do is exit
187     with a non-zero status, since libIDL will probably have made the
188     reason for failure explictly known.
189
190        - NAME: required, specifies the filename to be parsed.
191
192        - CPP_ARGS: optional, if non-NULL, specifies extra arguments to
193          pass to the C preprocessor.  The most common type of string
194          would be in the form of -I<dir> to include additional
195          directories for file inclusion search, or defines in the form
196          of -D<define>=<value>.
197
198        - CALLBACK: optional, if non-NULL, this function will be called
199          when a warning or error is generated (*note Data Types::).
200          If not given, warnings and errors will be sent to stderr.
201          All errors and warning, including callbacks, are subject to
202          MAX_MESSAGE_LEVEL as described below.
203
204        - TREE: optional, if non-NULL, points to an IDL_tree * to
205          return the generated tree which must be freed with
206          IDL_tree_free.  If NULL, the tree is freed and not returned.
207
208        - NS: optional, if non-NULL, points to an IDL_ns * to return
209          the namespace tree which must be freed with IDL_ns_free.  If
210          NULL, the tree is freed and not returned.  If TREE is NULL,
211          then NS must also be NULL, since the namespace is created as
212          the AST is generated.
213
214        - FLAGS: optional, specifies extra flags for parsing or 0.  The
215          various flags are described here.
216
217        - General Parse Flags
218
219             - IDLF_NO_EVAL_CONST: instructs the parser not to evaluate
220               constant expressions.
221
222             - IDLF_COMBINE_REOPENED_MODULES: instructs the parser to
223               combine modules defined later in the IDL code in the
224               first module node in the tree.
225
226             - IDLF_PREFIX_FILENAME: instructs the parser to prefix the
227               filename to the namespace.
228
229             - IDLF_IGNORE_FORWARDS: instructs the parser to not try to
230               resolve and print messages for unresovled forward
231               declarations.
232
233             - IDLF_PEDANTIC: instructs the parser to display stricter
234               errors and warnings.
235
236             - IDLF_INHIBIT_TAG_ONLY: only tag inhibited nodes, do not
237               remove them.  Use IDL_tree_remove_inhibits to remove
238               them at a later time.
239
240             - IDLF_INHIBIT_INCLUDES: causes libIDL to automatically
241               inhibit IDL trees in included files.
242
243        - Syntax Extension Flags
244
245             - IDLF_TYPECODES: understand the `TypeCode' keyword
246               extension.
247
248             - IDLF_XPIDL: enable XPIDL syntax.
249
250             - IDLF_PROPERTIES: enable support for node properties.
251
252             - IDLF_CODEFRAGS: enable support for embedded code
253               fragments.
254
255        - MAX_MESSAGE_LEVEL:
256
257          This specifies the maximum message level to display.
258          Possible values are -1 for no messages, IDL_ERROR for errors
259          only, or IDL_WARNING1, IDL_WARNING2 and IDL_WARNING3.  A
260          typical value is IDL_WARNING1, which will limit verbosity.
261          IDL_WARNINGMAX is defined as the value in which all messages
262          will be displayed.
263
264
265   * Function: void IDL_tree_walk_in_order (IDL_tree ROOT, IDL_tree_func
266     FUNC, gpointer DATA)
267
268     Walks an IDL_tree, calling FUNC for every node.  If the FUNC
269     returns TRUE for a particular node, that particular node will also
270     be traversed, if FALSE is returned, that particular node will be
271     skipped, in the assumption that the function has taken care of it.
272
273        - ROOT: required, specifies the IDL_tree to traverse.
274
275        - FUNC: required, specifies the callback function (*note Data
276          Types::).
277
278        - DATA: optional, specifies the callback data.
279
280
281   * Function: void IDL_tree_free (IDL_tree TREE)
282
283     Frees the memory associated with TREE.
284
285   * Function: void IDL_ns_free (IDL_ns NS)
286
287     Frees the memory associated with NS.
288
289
290
291File: libIDL.info,  Node: Extensions,  Next: Tree Structure,  Prev: Functions,  Up: Reference
292
293Extensions
294**********
295
296   This page documents extensions to standard IDL which libIDL will
297understand.  To maintain portability, it is recommended that these
298extensions are only used with some sort of C preprocessor define so they
299can be conditionally omitted.
300
301   * __declspec (<spec>)
302
303     This token assigns special attributions to particular IDL
304     constructs.
305
306        - inhibit
307
308          If __declspec (inhibit) is placed before a definition or
309          export, that module or interface definition will be removed
310          from the tree.  The tree is only deleted when the IDL_ns
311          component is freed, so it can be traversed from the namespace
312          component for extended information, but will be omitted from
313          the primary tree.
314
315
316
317
318File: libIDL.info,  Node: Tree Structure,  Prev: Extensions,  Up: Reference
319
320Tree Structure
321**************
322
323
324File: libIDL.info,  Node: Function Index,  Prev: Reference,  Up: Top
325
326Function Index
327**************
328
329* Menu:
330
331* IDL_ns_free:                           Functions.
332* IDL_parse_filename:                    Functions.
333* IDL_tree_free:                         Functions.
334* IDL_tree_walk_in_order:                Functions.
335
336
337
338Tag Table:
339Node: Top249
340Node: Overview694
341Node: Example2925
342Node: Reference4181
343Node: Data Types4537
344Node: Functions5605
345Node: Extensions10155
346Node: Tree Structure11018
347Node: Function Index11128
348
349End Tag Table
Note: See TracBrowser for help on using the repository browser.