📄 libidl.texi
字号:
\input texinfo @c -*- mode: texinfo -*-@setfilename libIDL.info@settitle libIDL@setchapternewpage odd@ifinfo@dircategory Libraries@direntry* libIDL: (libIDL). Interface Definition Language parsing library.@end direntryCopyright 1998 Andrew T. Veliath@end ifinfo@titlepage@title libIDL@author Andrew T. Veliath@page@vskip 0pt plus 1filllCopyright @copyright{} 1998, 1999 Andrew T. Veliath@end titlepage@node Top, , , (dir)@ifinfoThis file documents the Interface Definition Language (IDL) parsinglibrary, libIDL.This document applies to version 0.6 of libIDL. It is still incomplete.@end ifinfo@menu* Overview:: General overview.* Example:: Simple example.* Reference:: Data structure and function reference.* Function Index:: Index of available functions.@end menu@node Overview, Example, top, top@chapter OverviewlibIDL is a library licensed under the GNU LGPL for creating trees ofCORBA Interface Definition Language (IDL) files, which is aspecification for defining portable interfaces. libIDL was initiallywritten for ORBit (the ORB from the GNOME project, and the primarymeans of libIDL distribution). However, the functionality wasdesigned to be as reusable and portable as possible.It is written in C, and the aim is to retain the ability to compile iton a system with a standard C compiler. Preprocessed parser files areincluded so you are not forced to rebuild the parser, however aneffort is made to keep the parser and lexer compatible with standardUnix yacc and lex (although bison and flex are more efficient, and areused for the preprocessed parsers in the distribution).With libIDL, you can parse an IDL file which will be automatically runthrough the C preprocessor (on systems with one available), and havedetailed error and warning messages displayed. On a compilationwithout errors, the tree is returned to the custom application.libIDL performs compilation phases from lexical analysis to nearlyfull semantic analysis with some optimizations, and will attempt togenerate meaningful errors and warnings for invalid or deprecated IDL.libIDL exports functionality used to generate detailed conformingerror and warning messages in gcc-like format, and also comes with adefault backend to generate IDL into a file or string (useful forcustomized messages or comments in the output). The IDL backend iscomplete enough that most generated IDL can be reparsed by libIDLwithout errors. libIDL returns separate syntax and namespace trees,and includes functionality to hide syntactical information from theprimary tree, while keeping it accessible through the namespace fortype information and name lookup.Optional extensions to standard IDL can be enabled using parse flags.These include node properties, embedded code fragments, and XPIDL.Nodes can also have declarations tags which assign particularattributions to certain IDL constructs to further facilitate customapplications.@node Example, Reference, Overview, top@chapter UsageThe following C program using libIDL will parse an IDL file and printthe Repository IDs of the interfaces in the IDL module.@example#include <assert.h>#include <stdio.h>#include <stdlib.h>#include <libIDL/IDL.h>gbooleanprint_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;@}@end example@node Reference, Function Index, Example, top@chapter Reference@menu* Data Types:: Constructed data types used.* Functions:: Functions provided.* Extensions:: Extensions provided to standard IDL.* Tree Structure:: The C IDL tree representation.@end menu@node Data Types, Functions, , Reference@chapter Data Types@itemize @bullet@itemIDL_treeA semi-opaque tree which encapsulates an IDL tree node. Must be freedwith IDL_tree_free (@pxref{Functions}).@itemIDL_nsA semi-opaque structure which encapsulates the IDL module namespace.Must be freed with IDL_ns_free (@pxref{Functions}).@itemIDL_msg_callbackDefined as typedef int (*IDL_msg_callback)(int LEVEL, int NUM, int LINE,const char *NAME, const char *ERR). A function of this type can beoptionally passed to IDL_parse_filename to be called when a parsewarning or error occurs.@itemIDL_tree_funcDefined as typedef gboolean (*IDL_tree_func) (IDL_tree_func_data*TREE_FUNC_DATA, gpointer DATA). A function of this type is passed toIDL_tree_walk_in_order to traverse the tree. TREE_FUNC_DATA contains anup traversal hierarchy of the current traversal, as well as some stateinformation. The current node being processed is given byTREE_FUNC_DATA->tree.@end itemize@node Functions, Extensions, Data Types, Reference@chapter Functions@itemize @bullet@itemFunction: int IDL_parse_filename (const char *NAME, const char *CPP_ARGS,IDL_msg_callback CALLBACK, IDL_tree *TREE, IDL_ns *NS, unsigned long FLAGS,int MAX_MESSAGE_LEVEL)@findex IDL_parse_filenameParse an file containing an IDL definition into a parse tree. ReturnsIDL_SUCCESS if successful, or IDL_ERROR if there was a parse error. If-1 is returned, errno will be set accordingly. Usually, if IDL_ERROR isreturned, all one needs to do is exit with a non-zero status, sincelibIDL will probably have made the reason for failure explictly known.@itemize @minus@itemNAME: required, specifies the filename to be parsed.@itemCPP_ARGS: optional, if non-NULL, specifies extra arguments to pass tothe C preprocessor. The most common type of string would be in the formof -I<dir> to include additional directories for file inclusion search,or defines in the form of -D<define>=<value>.@itemCALLBACK: optional, if non-NULL, this function will be called when awarning or error is generated (@pxref{Data Types}). If not given,warnings and errors will be sent to stderr. All errors and warning,including callbacks, are subject to MAX_MESSAGE_LEVEL as describedbelow.@itemTREE: optional, if non-NULL, points to an IDL_tree * to return thegenerated tree which must be freed with IDL_tree_free. If NULL, thetree is freed and not returned.@itemNS: optional, if non-NULL, points to an IDL_ns * to return the namespacetree which must be freed with IDL_ns_free. If NULL, the tree is freedand not returned. If TREE is NULL, then NS must also be NULL, since thenamespace is created as the AST is generated.@itemFLAGS: optional, specifies extra flags for parsing or 0. The variousflags are described here.@itemGeneral Parse Flags@itemize @minus@itemIDLF_NO_EVAL_CONST: instructs the parser not to evaluate constant expressions.@itemIDLF_COMBINE_REOPENED_MODULES: instructs the parser to combine modulesdefined later in the IDL code in the first module node in the tree.@itemIDLF_PREFIX_FILENAME: instructs the parser to prefix the filename to thenamespace.@itemIDLF_IGNORE_FORWARDS: instructs the parser to not try to resolve andprint messages for unresovled forward declarations.@itemIDLF_PEDANTIC: instructs the parser to display stricter errors andwarnings.@itemIDLF_INHIBIT_TAG_ONLY: only tag inhibited nodes, do not remove them.Use IDL_tree_remove_inhibits to remove them at a later time.@itemIDLF_INHIBIT_INCLUDES: causes libIDL to automatically inhibit IDL treesin included files.@end itemize@itemSyntax Extension Flags@itemize @minus@itemIDLF_TYPECODES: understand the `TypeCode' keyword extension.@itemIDLF_XPIDL: enable XPIDL syntax.@itemIDLF_PROPERTIES: enable support for node properties.@itemIDLF_CODEFRAGS: enable support for embedded code fragments.@end itemize@itemMAX_MESSAGE_LEVEL:This specifies the maximum message level to display. Possible valuesare -1 for no messages, IDL_ERROR for errors only, or IDL_WARNING1,IDL_WARNING2 and IDL_WARNING3. A typical value is IDL_WARNING1, whichwill limit verbosity. IDL_WARNINGMAX is defined as the value in whichall messages will be displayed.@end itemize@itemFunction: void IDL_tree_walk_in_order (IDL_tree ROOT, IDL_tree_funcFUNC, gpointer DATA)@findex IDL_tree_walk_in_orderWalks an IDL_tree, calling FUNC for every node. If the FUNC returnsTRUE for a particular node, that particular node will also be traversed,if FALSE is returned, that particular node will be skipped, in theassumption that the function has taken care of it.@itemize @minus@itemROOT: required, specifies the IDL_tree to traverse.@itemFUNC: required, specifies the callback function (@pxref{Data Types}).@itemDATA: optional, specifies the callback data.@end itemize@itemFunction: void IDL_tree_free (IDL_tree TREE)@findex IDL_tree_freeFrees the memory associated with TREE.@itemFunction: void IDL_ns_free (IDL_ns NS)@findex IDL_ns_freeFrees the memory associated with NS.@end itemize@node Extensions, Tree Structure, Functions, Reference@chapter ExtensionsThis page documents extensions to standard IDL which libIDL willunderstand. To maintain portability, it is recommended that theseextensions are only used with some sort of C preprocessor define so theycan be conditionally omitted.@itemize @bullet@item__declspec (<spec>)This token assigns special attributions to particular IDL constructs.@itemize @minus@iteminhibitIf __declspec (inhibit) is placed before a definition or export, thatmodule or interface definition will be removed from the tree. The treeis only deleted when the IDL_ns component is freed, so it can betraversed from the namespace component for extended information, butwill be omitted from the primary tree.@end itemize@end itemize@node Tree Structure, , Extensions, Reference@chapter Tree Structure@node Function Index, , Reference, top@chapter Function Index@printindex fn@contents@bye
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -