Uil(3X) SDK X11 R4.11MU05 Uil(3X)
NAME
Uil--Invokes the UIL compiler from within an application
SYNOPSIS
#include <uil/UilDef.h>
Uilstatustype Uil (commanddesc, compiledesc, messagecb,
messagedata, statuscb, statusdata)
Uilcommandtype *commanddesc;
Uilcompiledesctype*compiledesc;
Uilcontinuetype (*messagecb) ();
char *messagedata;
Uilcontinuetype (*statuscb) ();
char *statusdata;
DESCRIPTION
The Uil function provides a callable entry point for the UIL
compiler. The Uil callable interface can be used to process a UIL
source file and to generate UID files, as well as return a detailed
description of the UIL source module in the form of a symbol table
(parse tree).
commanddesc Specifies the uil command line.
compiledesc Returns the results of the compilation.
messagecb Specifies a callback function that is called when
the compiler encounters errors in the UIL source.
messagedata Specifies user data that is passed to the message
callback function (message_cb). Note that this
argument is not interpreted by UIL, and is used
exclusively by the calling application.
statuscb Specifies a callback function that is called to
allow X applications to service X events such as
updating the screen. This function is called at
various check points, which have been hard coded
into the UIL compiler. The status_update_delay
argument in command_desc specifies the number of
check points to be passed before the status_cb
function is invoked.
statusdata Specifies user data that is passed to the status
callback function (status_cb). Note that this
argument is not interpreted by the UIL compiler,
and is used exclusively by the calling
application.
The data structures Uilcommandtype and Uilcompiledesctype are
detailed below.
typedef struct Uilcommandtype {
char *sourcefile;
/* single source to compile */
char *resourcefile; /* name of output file */
char *listingfile; /* name of listing file */
unsigned int *includedircount;
/* number of dirs. in includedir */
char *((*includedir) []);
/* dir. to search for include files */
unsigned listingfileflag: 1;
/* produce a listing */
unsigned resourcefileflag: 1;
/* generate UID output */
unsigned machinecodeflag: 1;
/* generate machine code */
unsigned reportinfomsgflag: 1;
/* report info messages */
unsigned reportwarnmsgflag: 1;
/* report warnings */
unsigned parsetreeflag: 1;
/* generate parse tree */
unsigned int statusupdatedelay;
/* number of times a status point is */
/* passed before calling statuscb */
/* function 0 means called every time */
char *database;
/* name of database file */
unsigned databaseflag: 1;
/* read a new database file */
unsigned usesetlocaleflag: 1;
/* enable calls to setlocale */
};
typedef struct Uilcompiledesctype {
unsigned int compilerversion;
/* version number of compiler */
unsigned int dataversion;
/* version number of structures */
char *parsetreeroot; /* parse tree output */
unsigned int messagecount [Uilkmaxstatus+1];
/* array of severity counts */
};
Following is a description of the message callback function specified
by messagecb:
Uilcontinuetype (*messagecb) (messagedata, messagenumber,
severity, msgbuffer, srcbuffer, ptrbuffer, locbuffer,
messagecount)
char *messagedata;
int messagenumber;
int severity;
char *msgbuffer, *srcbuffer;
char *ptrbuffer, *locbuffer;
int messagecount[];
Specifies a callback function that UIL invokes instead of printing an
error message when the compiler encounters an error in the UIL
source. The callback should return one of these values:
Uilkterminate Tells UIL to terminate processing of the source
file.
Uilkcontinue Tells UIL to continue processing the source file.
Following are the arguments:
messagedata Data supplied by the application as the
messagedata argument to the Uil function. UIL
does not interpret this data in any way; it just
passes it to the callback.
messagenumber An index into a table of error messages and
severities, for internal use by UIL.
severity An integer that indicates the severity of the
error. The possible values are the status
constants returned by the Uil function. See the
"RETURN VALUE" section below.
msgbuffer A string that describes the error.
srcbuffer A string consisting of the source line where the
error occurred. This is not always available;
the argument is then NULL.
ptrbuffer A string consisting of whitespace and a printing
character in the character position corresponding
to the column of the source line where the error
occurred. This string may be printed beneath the
source line to provide a visual indication of the
column where the error occurred. This is not
always available; the argument is then NULL.
locbuffer A string identifying the line number and file of
the source line where the error occurred. This
is not always available; the argument is then
NULL.
messagecount An array of integers containing the number of
diagnostic messages issued thus far for each
severity level. To find the number of messages
issued for the current severity level, use the
severity argument as the index into this array.
Following is a description of the status callback function specified
by statuscb:
Uilcontinuetype (*statuscb) (statusdata, percentcomplete,
linesprocessed, currentfile, messagecount)
char *statusdata;
int percentcomplete;
int linesprocessed;
char *currentfile;
int messagecount[];
Specifies a callback function that is invoked to allow X applications
to service X events such as updating the screen. The callback should
return one of these values:
Uilkterminate Tells UIL to terminate processing of the source
file.
Uilkcontinue Tells UIL to continue processing the source file.
Following are the arguments:
statusdata Data supplied by the application as the
statusdata argument to the Uil function. UIL
does not interpret this data in any way; it just
passes it to the callback.
percentcomplete An integer indicating what percentage of the
current source file has been processed so far.
linesprocessed An integer indicating how many lines of the
current source file have been read so far.
currentfile A string containing the pathname of the current
source file.
messagecount An array of integers containing the number of
diagnostic messages issued thus far for each
severity level. To find the number of messages
issued for a given severity level, use the
severity level as the index into this array. The
possible severity levels are the status constants
returned by the Uil function. See the "RETURN
VALUE" section below.
RETURN VALUE
This function returns one of these status return constants:
Uilksuccessstatus The operation succeeded.
Uilkinfostatus The operation succeeded, and an
informational message is returned.
Uilkwarningstatus The operation succeeded, and a warning
message is returned.
Uilkerrorstatus The operation failed due to an error.
Uilkseverestatus The operation failed due to an error.
RELATED INFORMATION
UilDumpSymbolTable(3X) and uil(1X).
Licensed material--property of copyright holder(s)