[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4 Files Reference

UIL File Format

Purpose

Contains information on the user interface for a widget-based application.

Description

User Interface Language (UIL) is used to describe the initial state of a user interface for a widget-based application. UIL describes the widgets used in the interface, the resources of those widgets, and the callbacks of those widgets. A UIL file is compiled into a user interface definition (UID) file using the uil command or the Uil callable compiler function. The contents of the compiled UID file can then be accessed by the various AIXwindows Resource Manager (MRM) functions from within an application program.

The syntax for the UIL is as follows:

MODULE ModuleName
               [ NAMES = CASE_INSENSITIVE | CASE_SENSITIVE ]
               [ CHARACTER_SET = CharacterSet ]
               [ OBJECTS = { WidgetName = GADGET | WIDGET; [...] } ]
               { [
               [ ValueSection ] |
               [ ProcedureSection ] |
               [ ListSection ] |
               [ ObjectSection ] |
               [ IdentifierSection ] |
               [ ... ]
               ] }
END MODULE;

File Format

UIL is a free-form language. This means that high-level constructs, such as object and value declarations, do not need to begin in any particular column and can span any number of lines. Low-level constructs, such as keywords and punctuation characters, can also begin in any column; however, except for string literals and comments, they cannot span lines.

The UIL compiler accepts input lines up to 132 characters in length.

MODULE ModuleName The name by which the UIL module is known in the UID file. This name is stored in the UID file for later use in the retrieval of resources by the MRM. This module name is always uppercase.
NAMES = CASE_INSENSITIVE | CASE_SENSITIVE Indicates whether names should be treated as case-sensitive or case-insensitive. The default is case-sensitive. The case-sensitivity clause should be the first clause in the module header and must precede any statement that contains a name. If names are case-sensitive in a UIL module, UIL keywords in that module must be in lowercase. Each name is stored in the UIL file in the same case as it appears in the UIL module. If names are case-insensitive, keywords can be in uppercase, lowercase, or mixed case, and the uppercase equivalent of each name is stored in the UID file.
CHARACTER_SET = CharacterSet Specifies the default character set for string literals in the module that do not explicitly set their character set. In the absence of this clause, the default character set is the codeset component of the LANG environment variable, or the value of XmFALLBACK_CHARSET if LANG is not set or has no codeset component. The value of XmFALLBACK_CHARSET is defined by the UIL supplier, but is usually ISO8859-1 (equivalent to ISO_LATIN1). Use of this clause turns off all localized string literal processing turned on by either the -s compiler flag or the Uil_command_type data structure element use_setlocale_flag.
OBJECTS = { WidgetName = GADGET | WIDGET;} Indicates whether the widget or gadget form of the control specified by WidgetName variable is used by default. The widget form is used by default. The specified control should be one that has both a widget and gadget version, for example: XmCascadeButton, XmLabel, XmPushButton, XmSeparator, and XmToggleButton. The form of more than one control can be specified by delimiting them with ; (semicolons). The gadget or widget form of an instance of a control can be specified with the GADGET and WIDGET keywords in a particular object declaration.
ValueSection Provides a way to name a value expression or literal. The value name can then be referred to by declarations that occur elsewhere in the UIL module in any context where a value can be used. Values can be forward-referenced. See "Value Sections" for more detail.
ProcedureSection Defines the callback functions used by a widget and the creation functions for user-defined widgets. These definitions are used for error checking. See "Procedure Sections" for more detail.
ListSection Provides a way to group together a set of arguments, controls (children), callbacks, or procedures for later use in the UIL module. Lists can contain other lists so you can set up a hierarchy to clearly show which arguments, controls, callbacks, and procedures are common to which widgets. See "List Sections" for more detail.
ObjectSection Defines the objects that make up the user interface of the application. You can reference the object names in declarations that occur elsewhere in the UIL module in any context where an object name can be used (for example, in a controls list, as a symbolic reference to a widget ID, or as the TagValue argument for a callback procedure). Objects can be forward-referenced. See "Object Sections" for more detail.
IdentifierSection Defines a run-time binding of data to names that appear in the UIL module. See "Identifier Sections" for more detail.

The UIL file can also contain comments and include directives. These, as well as the main elements of the UIL file format, are described in the following sections.

Comments

Comments can take one of two forms, neither of which can be nested:

Value Sections

A value section consists of the VALUE keyword followed by a sequence of value declarations. It has the following syntax:

VALUE ValueName :
             [ EXPORTED | PRIVATE ] ValueExpression |
             IMPORTED ValueType ;

ValueExpression is assigned to ValueName, or a ValueType is assigned to an imported value name. A value declaration provides a way to name a value expression or literal. The value name can be referred to by declarations that occur later in the UIL module in any context where a value can be used. Values can be forward-referenced.

EXPORTED A value that you define as exported is stored in the UID file as a named resource and can be referenced by name in other UID files. When you define a value as exported, MRM looks outside the module in which the exported value is declared to get its value at run time.
PRIVATE A private value is a value that is not imported or exported. A value that you define as private is not stored as a distinct resource in the UID file. You can reference a private value only in the UIL module containing the value declaration. The value or object is directly incorporated into anything in the UIL module that references the declaration.
IMPORTED A value that you define as imported is one that is defined as a named resource in a UID file. MRM resolves this declaration with the corresponding exported declaration at application run time.

By default, values and objects are private. The following is a list of the supported value types in UIL:

Procedure Sections

A procedure section consists of the PROCEDURE keyword followed by a sequence of procedure declarations. It has the following syntax:

PROCEDURE
                ProcedureName [ ( [ ValueType ] ) ] ;

Use a procedure declaration to declare the following:

You can reference a procedure name in declarations that occur later in the UIL module in any context where a procedure can be used. Procedures can be forward-referenced. You cannot use a name that you used in another context as a procedure name.

In a procedure declaration, you have the option of specifying that a parameter is passed to the corresponding callback function at run time. This parameter is called the callback tag. You can specify the data type of the callback tag by putting the data type in parentheses following the procedure name. When you compile the module, the UIL compiler checks that the argument you specify in references to the procedure is of this type. Note that the data type of the callback tag must be one of the valid UIL data types. You can use a widget as a callback tag, as long as the widget is defined in the same widget hierarchy as the callback; that is, they must have a common ancestor that is in the same UIL hierarchy.

The following list summarizes how the UIL compiler checks argument type and argument count, depending on the procedure declaration:

No parameters No argument type or argument count checking occurs. You can supply either 0 or 1 arguments in the procedure reference.
( ) Checks that the argument count is 0.
(ANY) Checks that the argument count is 1. Does not check the argument type. Use the ANY data type to prevent type checking on procedure tags.
(Type) Checks for one argument of the specified type.
(ClassName) Checks for one widget argument of the specified widget class.

While it is possible to use any UIL data type to specify the type of a tag in a procedure declaration, you must be able to represent that data type in the programming language you are using. Some data types (such as integer, Boolean, and string) are common data types recognized by most programming languages. Other UIL data types (such as string tables) are more complicated and may require you to set up an appropriate corresponding data structure in the application in order to pass a tag of that type to a callback function.

You can also use a procedure declaration to specify the creation function for a user-defined widget. In this case, you specify no formal parameters. The procedure is called with the standard three arguments passed to all widget creation functions. See "AIXwindows Programming Overview" in AIXwindows Programming Guide for more information about widget creation functions.

List Sections

A list section consists of the LIST keyword followed by a sequence of list declarations. It has the following syntax:

LIST
                ListName : { ListItem; [...] }
                [...]

You can also use list sections to group together a set of arguments, controls (children), callbacks, or procedures for later use in the UIL module. Lists can contain other lists so you can set up a hierarchy to clearly show which arguments, controls, callbacks, and procedures are common to which widgets. You cannot mix the different types of lists; a list of a particular type cannot contain entries of a different list type or reference the name of a different list type. A list name is always private to the UIL module in which you declare the list and cannot be stored as a named resource in a UID file.

The additional list types are described in the following sections.

Arguments List Structure

An arguments list defines which arguments are specified in the arguments-list parameter when the creation function for a particular object is called at run time. An arguments list also specifies the values for those arguments. Arguments lists have the following syntax:

LIST        ListName : ARGUMENTS {
                                ArgumentName = ValueExpression;
                                [...] }
               [...]

The argument name (ArgumentName) must be either a built-in argument name or a user-defined argument name that is specified with the ARGUMENTS function.

If you use a built-in argument name as an arguments list entry in an object definition, the UIL compiler checks the argument name to be sure that it is supported by the type of object that you are defining. If the same argument name is displayed more than once in a given arguments list, the last entry that uses that argument name supersedes all previous entries with that name, and the compiler issues a message.

Some arguments, such as XmNitems and XmNitemCount, are coupled by the UIL compiler. When you specify one of the coupled arguments, the compiler also sets the other one. The coupled argument is not available to you.

AIXwindows and the X Toolkit (Intrinsics) support constraint arguments. A constraint argument is one that is passed to children of an object, beyond those arguments normally available. For example, the Form widget grants a set of constraint arguments to its children. These arguments control the position of the children within the Form widget.

Unlike the arguments used to define the attributes of a particular widget, constraint arguments are used exclusively to define additional attributes of the children of a particular widget. These attributes affect the behavior of the children within their parent. To supply constraint arguments to the children, include the arguments in the arguments list for the child.

Callbacks List Structure

Use a callbacks list to define which callback reasons are to be processed by a particular widget at run time. Callback lists have the following syntax:

LIST
        ListName : CALLBACKS {
                  ReasonName = PROCEDURE ProcedureName [ ( [ ValueExpression ] ) ]; |
                  ReasonName = ProcedureList ;
                  [...] }
        [...]

For AIXwindows widgets, the reason name must be a built-in reason name. For a user-defined widget, you can use a reason name that you previously specified using the REASON function. If you use a built-in reason in an object definition, the UIL compiler ensures that reason is supported by the type of object you are defining.

If the same reason is displayed more than once in a callbacks list, the last entry referring to that name supersedes all previous entries using the same reason. The UIL compiler then issues a diagnostic message.

If you specify a named value for the procedure argument (callback tag), the data type of the value must match the type specified for the callback tag in the corresponding procedure declaration. When specifying a widget name as a procedure value expression, you must also specify the type of the widget and a space before the name of the widget.

Because the UIL compiler produces a UID file rather that an object module (.o), the binding of the UIL name to the address of the entry point and then to the procedure is not done by the loader. Instead, this binding is established at run time with the MrmRegisterNames MRM function. You call this function before fetching any objects, giving it both the UIL names and the procedure addresses of each callback. The name you register with MRM in the application program must match the name you specified for the procedure in the UIL module.

Each callback procedure received three arguments. The first two arguments have the same form for each callback. The form of the third argument varies from object to object.

The first argument is the address of the data structure maintained by the AIXwindows for this object instance. This address is called the widget ID for this object.

The second argument is the address of the value you specified in the callbacks list for this procedure. If you do not specify an argument, the address is null.

The third argument is the reason name you specified in the callbacks list.

Controls List Structure

A controls list defines which objects are children of, or controlled by, a particular object. Each entry in a controls list has the following syntax:

LIST
       ListName : CONTROLS {
                         [ ChildName] [MANAGED | UNMANAGED] ObjectDefinition;
                         [...] }
       [...]

If you specify the MANAGED keyword at run time, the object is created and managed; if you specify the UNMANAGED keyword at run time, the object is only created. Objects are managed by default.

You can use the ChildName parameter to specify resources for the automatically created children of a particular control. Names for automatically created children are formed by appending Xm_ to the name of the child widget. This name is specified in the documentation for the parent widget.

Unlike the arguments list and the callbacks list, a controls list entry that is identical to a previous entry does not supersede the previous entry. At run time, each controls list entry causes a child to be created when the parent is created. If the same object definition is used for multiple children, multiple instances of the child are created at run time.

Procedures List Structure

You can specify multiple procedures for a callback reason in UIL by defining a procedures list. Just as with other list types, procedures lists can be defined in-line or in a list section and referenced by name.

If you define a reason more than once (for example, when the reason is defined both in a referenced procedures list and in the callbacks list for the object), previous definitions are overridden by the latest definition. The syntax for a procedures list is as follows:

LIST
               ListName : PROCEDURES {
                                 ProcedureName [ ( [ ValueExpression ] ) ];
                                 [...] }
               [...]

When specifying a widget name as a procedure value expression, you must also specify the type of the widget and a space before the name of the widget.

Object Sections

An object section consists of the OBJECT keyword followed by a sequence of object declarations. It has the following syntax:

OBJECT ObjectName :
                  [ EXPORTED | PRIVATE | IMPORTED ] ObjectType
                                      [ PROCEDURE CreationFunction ]
                                      [ ObjectName [ WIDGET | GADGET ] | { ListDefinitions } ]

Use an object declaration to define the objects that are stored in the UID file. You can reference the object name in declarations that occur elsewhere in the UIL module in any context where an object name can be used (for example, in a controls list, as a symbolic reference to a widget ID, or as the TagValue argument for a callback procedure). Objects can be forward-referenced, meaning that you can declare an object name after you have referenced it. All references to an object name must be consistent with the type of the object, as specified in the object declaration. You can specify an object as exported, imported, or private.

The object definition can contain a sequence of lists that define the arguments, hierarchy, and callbacks for the widget. You can only specify one list of each type for an object. When you declare a user-defined widget, you must include a reference to the widget creation function for the user-defined widget.

Use the GADGET or WIDGET keyword to specify the object type or to override the default variant for this object type. You can use the AIXwindows name of an object type that has a gadget variant (for example, XmLabelGadget) as an attribute of an object declaration. The ObjectType can be any object type, including gadgets. You need to specify the GADGET or WIDGET keyword only in the declaration of an object, not when you reference the object. You cannot specify the GADGET or WIDGET keyword for a user-defined object; user-defined objects are always widgets.

Identifier Sections

The identifier section allows you to define an identifier, a mechanism that achieves run-time binding of data to names that appear in a UIL module. The identifier section consists of the reserved IDENTIFIER keyword, followed by a list of names. Each name is followed by a semicolon (;). The syntax is as follows:

IDENTIFIER IdentifierName; [...;]

You can use these names later in the UIL module as either the value of an argument to a widget or the tag value to a callback procedure. At run time, use the MrmRegisterNames and MrmRegisterNamesInHierarchy MRM functions to bind the identifier name with the data (or, in the case of callbacks, with the address of the data) associated with the identifier.

Each UIL module has a single name space; therefore, you cannot use the name you used for a value, object, or procedure as an identifier name in the same module.

The UIL compiler does not do any type checking on the use of identifiers in a UIL module. Unlike a UIL value, an identifier does not have a UIL type associated with it. Regardless of what particular type a widget argument or callback procedure tag is defined to be, you can use an identifier in that context instead of a value of the corresponding type.

To reference these identifier names in a UIL module, use the name of the identifier wherever you want its value to be used.

Include Directives

The include directive incorporates the contents of a specified file into a UIL module. This mechanism allows several UIL modules to share common definitions. The syntax for the include directive is as follows:

INCLUDE FILE FileName ;

The UIL compiler replaces the include directive with the contents of the include file and processes it as if these contents were displayed in the current UIL source file.

You can nest include files, meaning that an include file can contain include directives. The UIL compiler can process up to 100 references (including the file containing the UIL module). Therefore, you can include up to 99 files in a single UIL module, including nested files. Each time a file is opened counts as a reference; therefore, including the same file twice counts as two references.

The character expression is a file specification that identifies the file to be included. The rules for finding the specified file are similar to the rules for finding header, or .h, files using the include directive, #include, with a quoted string in C language. The uil command uses the -I option for specifying a search directory for include files. Search rules are as follows:

Language Syntax

This section contains information on the following:

Names and Strings

Names can consist of any of the characters A to Z, a to z, 0 to 9, $ (dollar sign), and _ (underscore). Names cannot begin with a digit (0 to 9). The maximum length of a name is 31 characters.

UIL gives you a choice of either case-sensitive or case-insensitive names through a clause in the MODULE header. For example, if names are case-sensitive, the names "sample" and "Sample" are distinct from each other. If names are case-insensitive, these names are treated as the same name and can be used interchangeably. By default, UIL assumes names are case-sensitive.

In case-insensitive mode, the compiler outputs all names in the UID file in uppercase form. In case-sensitive mode, names are displayed in the UIL file exactly as they are displayed in the source file.

The following lists the reserved keywords, which cannot be used for programmer-defined names:

ARGUMENTS CALLBACKS CONTROLS END
EXPORTED FALSE GADGET IDENTIFIER
INCLUDE LIST MODULE OFF
ON OBJECT PRIVATE PROCEDURE
PROCEDURES TRUE VALUE WIDGET

The following lists UIL unreserved keywords. These keywords can be used as programmer-defined names; however, if you use any of these keywords as names, you cannot use the UIL-supplied form of that keyword.

Built-in argument names (for example, XmNx, XmNheight)
Built-in reason names (for example, XmNactivateCallback, XmNhelpCallback)
Character set names (for example, ISO_LATIN1, ISO_HEBREW_LR)
Constant value names (for example, XmMENU_OPTION, XmBROWSE_SELECT)
Object types (for example, XmPushButton, XmBulletinBoard)

ANY FILE IMPORTED
ARGUMENT FLOAT REASON
ASCIZ_STRING_TABLE FONT RGB
ASCIZ_TABLE FONTSET SINGLE_FLOAT
BACKGROUND FONT_TABLE STRING
BOOLEAN FOREGROUND STRING_TABLE
CASE_INSENSITIVE ICON TRANSLATION_TABLE
CASE_SENSITIVE INTEGER UNMANAGED
CHARACTER_SET INTEGER_TABLE USER_DEFINED
COLOR KEYSYM VERSION
COLOR_TABLE MANAGED WIDE_CHARACTER
COMPOUND_STRING NAMES WIDGET
COMPOUND_STRING_TABLE OBJECTS XBITMAPFILE

RIGHT_TO_LEFT

String literals can be composed of uppercase and lowercase letters, digits, and punctuation characters. Spaces, tabs, and comments are special elements in the language. They are a means of delimiting other elements, such as two names. One or more of these elements can be displayed before or after any other element in the language. However, spaces, tabs, and comments that are displayed in string literals are treated as character sequences rather than delimiters.

Data Types

UIL provides literals for several of the value types it supports. Some of the value types are not supported as literals (for example, pixmaps and string tables). You can specify values for these types by using functions described in the "Functions" section. UIL directly supports the following literal types:

UIL also includes the ANY data type, which is used to turn off compile-time checking of data types.

String Literals

A string literal is a sequence of 0 or more 8-bit or 16-bit characters or a combination delimited by ' (single quotation marks) or " (double quotation marks). String literals can also contain multibyte characters delimited with double quotation marks. String literals can be no more than 2,000 characters long.

A single-quoted string literal can span multiple source lines. To continue a single-quoted string literal, end the continued line with a \ (backslash). The literal continues with the first character on the next line.

Double-quoted string literals cannot span multiple source lines. (Because double-quoted strings can contain escape sequences and other special characters, you cannot use the backslash character to designate the continuation of the string.) To build a string value that must span multiple source lines, use the concatenation operation that is described later in this section.

The syntax of a string literal can be one of the following:

'[CharacterString]'
[#CharSet]"[CharacterString]"

Both string forms associate a character set with a string value. UIL uses the following rules to determine the character set and storage format for string literals:

The following lists the character sets supported by the UIL compiler for string literals. Note that several UIL names map to the same character set. In some cases, the UIL name influences how string literals are read. For example, strings identified by a UIL character set name ending in _LR are read left-to-right. Names that end in a different number reflect different fonts (for example, ISO_LATIN1 or ISO_LATIN6). All character sets in this list are represented by 8 bits.

UIL Name Description
ISO_LATIN1 GL: ASCII, GR: Latin-1 Supplement
ISO_LATIN2 GL: ASCII, GR: Latin-2 Supplement
ISO_ARABIC GL: ASCII, GR: Latin-Arabic Supplement
ISO_LATIN6 GL: ASCII, GR: Latin-Arabic Supplement
ISO_GREEK GL: ASCII, GR: Latin-Greek Supplement
ISO_LATIN7 GL: ASCII, GR: Latin-Greek Supplement
ISO_HEBREW GL: ASCII, GR: Latin-Hebrew Supplement
ISO_LATIN8 GL: ASCII, GR: Latin-Hebrew Supplement
ISO_HEBREW_LR GL: ASCII, GR: Latin-Hebrew Supplement
ISO_LATIN8_LR GL: ASCII, GR: Latin-Hebrew Supplement
JIS_KATAKANA GL: JIS Roman, GR: JIS Katakana

Following are the parsing rules for each of the character sets:

All character sets Character codes in the range 00 to 1F, 7F, and 80 to 9F are control characters including both bytes of 16-bit characters. The compiler flags these as illegal characters.
ISO_LATIN1, ISO_LATIN2, ISO_ARABIC, ISO_LATIN6, ISO_GREEK, ISO_LATIN7
                          These sets are parsed from left to right. The escape sequences for null-terminated strings are also supported by these character sets.
ISO_HEBREW, ISO_LATIN8 These sets are parsed from right to left. For example, the string #ISO_HEBREW"012345" generates a primitive string "543210" with the character set ISO_HEBREW. A DDIS descriptor for such a string has this segment marked as being right to left. The escape sequences for null-terminated strings are also supported by these character sets, and the characters that compose the escape sequences are in left-to-right order. For example, you type \n, not n\.
ISO_HEBREW_LR, ISO_LATIN8_LR These sets are parsed from left to right. For example, the string #ISO_HEBREW"012345" generates a primitive string "012345" with the character set ISO_HEBREW. A DDIS descriptor for such a string marks this segment as being left to right. The escape sequences for null-terminated strings are also supported by these character sets.
JIS_KATAKANA This set is parsed from left to right. The escape sequences for null-terminated strings are also supported by these character sets. Note that the \ (backslash) can be displayed as a yen symbol.

In addition to designating parsing rules for strings, character set information remains an attribute of a compound string. If the string is included in a string consisting of several concatenated segments, the character set information is included with that string segment. This gives AIXwindows the information it needs to decipher the compound string and choose a font to display the string.

For an application interface displayed only in English, UIL lets you ignore the distinctions between the two uses of strings. The compiler recognizes by context when a string must be passed as a null-terminated string or as a compound string.

The UIL compiler recognizes enough information about the various character sets to correctly parse string literals. The compiler also issues errors if you use a compound string in a context that supports only null-terminated strings.

Since the character set names are keywords, you must put them in lowercase if case-sensitive names are in force. If names are case-insensitive, character set names can be uppercase, lowercase, or mixed case.

In addition to the built-in character sets recognized by UIL, you can define your own character sets with the CHARACTER_SET function. You can use the CHARACTER_SET function anywhere a character set can be specified.

String literals can contain characters with the eighth (high-order) bit set. You cannot type control characters (00 to 1F, 7F, and 80 to 9F) directly in a single-quoted string literal. However, you can represent these characters with escape sequences. The following list shows the escape sequences for special characters:

\b Backspace
\f Form-feed
\n New-line
\r Carriage return
\t Horizontal tab
\v Vertical tab
\' Single quotation mark
\" Double quotation mark
\\ Backslash
\Integer\ Character whose internal representation is given by Integer (in the range 0 to 255 decimal).
Note: Escape sequences are processed literally in strings that are parsed in the current locale (localized strings).

The UIL compiler does not process new-line characters in compound strings. The effect of a new-line character in a compound string depends only on the character set of the string. The result is not guaranteed to be a multiline string.

Compound String Literals

A compound string consists of a string of 8-bit, 16-bit, or multibyte characters, a named character set, and a writing direction. Its UIL data type is compound_string.

The writing direction of a compound string is implied by the character set specified for the string. You can explicitly set the writing direction for a compound string by using the COMPOUND_STRING function.

A compound string can consist of a sequence of concatenated compound strings, null-terminated strings, or a combination of both, each of which can have a different character set property and writing direction. Use the & (ampersand) concatenation operator to create a sequence of compound strings.

Each string in the sequence is stored, including the character set and writing direction information.

Generally, a string literal is stored in the UID file as a compound string when the literal consists of concatenated strings having different character sets or writing directions, or when you use the string to specify a value for an argument that requires a compound string value. If you want to guarantee that a string literal is stored as a compound string, you must use the COMPOUND_STRING function.

Data Storage Consumption for String Literals

The way a string literal is stored in the UID file depends on how you declare and use the string. The UIL compiler automatically converts a null-terminated string to a compound string if you use the string to specify the value of an argument that requires a compound string. However, this conversion is costly in terms of storage consumption.

PRIVATE, EXPORTED, and IMPORTED string literals require storage for a single allocation when the literal is declared; thereafter, storage is required for each reference to the literal. Literals declared in-line require storage for both an allocation and a reference.

The following list summarizes data storage consumption for string literals. The storage requirement for an allocation consists of a fixed portion and a variable portion. The fixed portion of an allocation is roughly the same as the storage requirement for a reference (a few bytes). The storage consumed by the variable portion depends on the size of the literal value (the length of the string). To conserve storage space, avoid making string literal declarations that result in an allocation per use.

Declaration Data Type Used As Storage Requirements Per Use
In-line Null-terminated Null-terminated An allocation and a reference (within the module)
Private Null-terminated Null-terminated A reference (within the module)
Exported Null-terminated Null-terminated A reference (within the UID hierarchy)
Imported Null-terminated Null-terminated A reference (within the UID hierarchy)
In-line Null-terminated Compound An allocation and a reference (within the module)
Private Null-terminated Compound An allocation and a reference (within the module)
Exported Null-terminated Compound A reference (within the UID hierarchy)
Imported Null-terminated Compound A reference (within the UID hierarchy
In-line Compound Compound An allocation and a reference (within the module)
Private Compound Compound A reference (within the module)
Exported Compound Compound A reference (within the UID hierarchy)
Imported Compound Compound A reference (within the UID hierarchy)

Integer Literals

An integer literal represents the value of a whole number. Integer literals have the form of an optional sign followed by one or more decimal digits. An integer literal must not contain embedded spaces or commas.

Integer literals are stored in the UID file as long integers. Exported and imported integer literals require a single allocation when the literal is declared; thereafter, a few bytes of storage are required for each reference to the literal. Private integer literals and those declared in-line require allocation and reference storage per use. To conserve storage space, avoid making integer literal declarations that result in an allocation per use.

The following list shows data storage consumption for integer literals:

Declaration Storage Requirements Per Use
In-line An allocation and a reference (within the module).
Private An allocation and a reference (within the module).
Exported A reference (within the UID hierarchy).
Imported A reference (within the UID hierarchy).

Boolean Literals

A Boolean literal represents the True value (reserved keyword TRUE or On) or False value (reserved keyword FALSE or Off). These keywords are subject to case-sensitivity rules.

In a UID file, TRUE is represented by the integer value 1 and FALSE is represented by the integer value 0.

Data storage consumption for Boolean literals is the same as that for integer literals.

Floating-Point Literals

A floating-point literal represents the value of a real (or float) number. Floating-point literals have the following form:

[+|-][Integer].Integer[E|e[+|-]Exponent]

For maximum portability, a floating-point literal can represent values in the range 1.0E-37 to 1.0E+37 with at least six significant digits. On many machines, this range is wider, with more significant digits. A floating-point literal must not contain embedded spaces or commas.

Floating-point literals are stored in the UID file as double-precision, floating-point numbers. The following gives examples of valid and invalid floating-point notation for the UIL compiler:

Valid Floating-Point Literals Invalid Floating-Point Literals
1.0 1e1 (no decimal point)
.1 E-1 (no decimal point or digits)
3.1415E-2 (equals .031415) 2.87 e6 (embedded blanks)
-6.29e7 (equals -62900000) 2.0e100 (out of range)

Data storage consumption for floating-point literals is the same as that for integer literals.

ANY Data Type

The purpose of the ANY data type is to shut off the data-type checking feature of the UIL compiler. You can use the ANY data type for either of the following:

You can use the ANY data type when you need to use a type not supported by the UIL compiler or when you want the data-type restrictions imposed by the compiler to be relaxed. For example, you might want to define a widget having an argument that can accept different types of values, depending on run-time circumstances.

If you specify that an argument takes an ANY value, the compiler does not check the type of the value specified for that argument. Therefore, you need to take care when specifying a value for an argument of the ANY data type. You may get unexpected results at run time if you pass a value having a data type that the widget does not support for that argument.

Expressions

UIL includes compile-time value expressions. These expressions can contain references to other UIL values, but cannot be forward-referenced.

The following lists the set of operators in UIL that allow you to create integer, real, and Boolean values based on other values defined with the UIL module. In the list, a precedence of 1 is the highest.

Operator Operand Types Meaning Precedence

~ Boolean NOT 1

integer Ones complement
- float Negate 1

integer Negate
+ float NOP 1

integer NOP
* float,float Multiply 2

integer,integer Multiply
/ float,float Divide 2

integer,integer Divide
+ float,float Add 3

integer,integer Add
- float,float Subtract 3

integer,integer Subtract
>> integer,integer Shift right 4
<< integer,integer Shift left 4
& Boolean,Boolean AND 5

integer,integer Bitwise AND

string,string Concatenate
| Boolean,Boolean OR 6

integer,integer Bitwise OR
^ Boolean,Boolean XOR 6

integer,integer Bitwise XOR

A string can be either a single compound string or a sequence of compound strings. If the two concatenated strings have different properties (such as writing direction or character set), the result of the concatenation is a multisegment compound string.

The string resulting from the concatenation is a null-terminated string unless one or more of the following conditions exists:

If one or more of previous conditions are met, the resulting string is a compound string. You cannot use imported or exported values as operands of the concatenation operator.

The result of each operator has the same type as its operands. You cannot mix types in an expression without using conversion functions.

You can use parentheses to override the normal precedence of operators. In a sequence of unary operators, the operations are performed in right-to-left order. For example, - + -A is equivalent to -(+(-A)). In a sequence of binary operators of the same precedence, the operations are performed in left-to-right order. For example, A*B/C*D is equivalent to ((A*B)/c)*D.

A value declaration gives a value a name. You cannot redefine the value of that name in a subsequent value declaration. You can use a value containing operators and functions anywhere you can use a value in a UIL module. You cannot use imported values as operands in expressions.

Several of the binary operators are defined for multiple data types. For example, the operator for multiplication (*) is defined for both floating-point and integer operands.

For the UIL compiler to perform these binary operations, both operands must be of the same type. If you supply operands of different data types, the UIL compiler automatically converts one of the operands to the type of the other according to the following conversion rules:

You can also explicitly convert the data type of a value by using one of the INTEGER, FLOAT, or SINGLE_FLOAT conversion functions.

Functions

UIL provides functions to generate the following types of values:

All examples in the following sections assume case-insensitive mode. Keywords are shown in uppercase letters to distinguish them from user-specified names, which are shown in mixed-case italics. This use of uppercase letters is not required in case-insensitive mode. In case-sensitive mode, keywords must be in lowercase letters.

CHARACTER_SET(StringExpression[,Property[, ...]])
                          You can define your own character sets with the CHARACTER_SET function. You can use the CHARACTER_SET function anywhere a character set can be specified.

The result of the CHARACTER_SET function is a character set with the name StringExpression and the properties you specify. StringExpression must be a null-terminated string. You can optionally include one or both of the following clauses to specify properties for the resulting character set:

RIGHT_TO_LEFT = BooleanExpression
SIXTEEN_BIT = BooleanExpression

The RIGHT_TO_LEFT clause sets the default writing direction of the string from right to left if BooleanExpression is True, and left to right otherwise.

The SIXTEEN_BIT clause allows the strings associated with this character set to be interpreted as 16-bit characters if BooleanExpression is True, and 8-bit characters otherwise.

KEYSYM(StringLiteral) The KEYSYM function is used to specify a keysym for a mnemonic resource. The StringLiteral must contain exactly one character. If the -s compiler flag is used, StringLiteral which uses double quotes must specify a character set.
COLOR(StringExpression[,FOREGROUND|BACKGROUND])
                          The COLOR function supports the definition of colors. Using the COLOR function, you can designate a value to specify a color and use that value for arguments requiring a color value. The string expression names the color you want to define. The optional FOREGROUND and BACKGROUND keywords identify how the color is to be displayed on a monochrome device when the color is used in the definition of a color table.

The UIL compiler does not have built-in color names. Colors are a server-dependent attribute of an object. Colors are defined on each server and may have different red-green-blue (RGB) values on each server. The string you specify as the color argument must be recognized by the server on which your application runs.

In a UID file, UIL represents a color as a character string. MRM calls X translation functions that convert a color string to the device-specific pixel value. If you are running on a monochrome server, all colors translate to black or white. If you are on a color server, the color names translate to their proper colors if the following conditions are met:

  • The color is defined.
  • The color map is not yet full.

If the color map is full, even valid colors translate to black or white (foreground or background).

Generally, interfaces do not specify colors for widgets. This enables the selection of colors to be controlled by the user through the .Xdefaults file.

To write an application that runs on both monochrome and color devices, you need to specify which colors in a color table (defined with the COLOR_TABLE function) map to the background and which colors map to the foreground. UIL lets you use the COLOR function to map the color red to the background color on a monochrome device as follows:

VALUE c: COLOR ( 'red',BACKGROUND );

Mapping is necessary only when the MRM is given a color and the application is to be displayed on a monochrome device. In this case, each color is considered to be in one of the following three categories:

  • The color is mapped to the background color on the monochrome device.
  • The color is mapped to the foreground color on the monochrome device.
  • Monochrome mapping is undefined for this color.

If the color is mapped to the foreground or background color, MRM substitutes the foreground or background color, respectively. If you do not specify the monochrome mapping for a color, MRM passes the color string to AIXwindows for mapping to the foreground or background color.

RGB(RedInteger, GreenInteger, BlueInteger)
                          The three integers define the values for the red, green, and blue components of the color, in that order. The values of these components can range from 0 to 65,535, inclusive.

In a UID file, UIL represents an RGB value as three integers. MRM calls X translation functions that convert the integers to the device-specific pixel value. If you are running on a monochrome server, all colors translate to black or white. If you are on a color server, RGB values translate to their proper colors if the color map is not yet full. If the color map is full, values translate to black or white (foreground or background).

COLOR_TABLE(ColorExpression='Character'[, ...])
                          The color expression is a previously defined color, a color defined in-line with the COLOR function, or the phrase BACKGROUND COLOR or FOREGROUND COLOR. The character can be any valid UIL character.

The COLOR_TABLE function provides a device-independent way to specify a set of colors. The COLOR_TABLE function accepts either previously defined UIL color names or in-line color definitions (using the COLOR function). A color table must be private because its contents must be known by the UIL compiler to construct an icon. The colors within a color table, however, can be imported, exported, or private.

The single letter associated with each color is the character you use to represent that color when creating an icon. Each letter used to represent a color must be unique within the color table.

ICON([COLOR_TABLE=ColorTableName,] Row[, ...])
                          The color table name must refer to a previously defined color table. The row is a character expression that gives one row of the icon.

The ICON function describes a rectangular icon that is x pixels wide and y pixels high. The strings surrounded by single quotation marks describe the icon. Each string represents a row in the icon; each character in the string represents a pixel.

The first row in an icon definition determines the width of the icon. All rows must have the same number of characters as the first row. The height of the icon is dictated by the number of rows.

The first argument of the ICON function (the color table specification) is optional and identifies the colors that are available in this icon. By using the single letter associated with each color, you can specify the color of each pixel in the icon. The icon must be constructed of characters defined in the specified color table.

A default color table is used if you omit the argument specifying the color table. To make use of the default color table, the rows of your icon must contain only spaces and asterisks. The default color table is defined as follows:

COLOR_TABLE( BACKGROUND COLOR = ' ', FOREGROUND COLOR = '*' )

You can define other characters to represent the background color and foreground color by replacing the space and asterisk in the BACKGROUND COLOR and FOREGROUND COLOR clauses shown in the example statement. You can specify icons as private, imported, or exported. Use the MrmFetchIconLiteral MRM function to retrieve an exported icon at run time.

XBITMAPFILE(StringExpression) The XBITMAPFILE function is similar to the ICON function in that both describe a rectangular icon that is x pixels wide and y pixels high. However, the XBITMAPFILE function allows you to specify an external file containing the definition of an X bitmap, while all ICON function definitions must be coded directly within UIL. X bitmap files can be generated by many different X applications. UIL reads these files through the XBITMAPFILE function, but does not support creation of these files. The X bitmap file specified as the argument to the XBITMAPFILE function is read by MRM at application run time.

The XBITMAPFILE function returns a value of type pixmap and can be used anywhere a pixmap data type is expected.

SINGLE_FLOAT(RealNumberLiteral) The SINGLE_FLOAT function lets you store floating-point literals in UIL files as single-precision, floating-point numbers. Single-precision, floating-point numbers can often be stored using less memory than double-precision, floating-point numbers. The RealNumberLiteral can be either an integer literal or a floating-point literal. A value defined using this function cannot be used in an arithmetic expression.
FLOAT(RealNumberLiteral) The FLOAT function lets you store floating-point literals in UIL files as double-precision, floating-point numbers. The RealNumberLiteral can be either an integer literal or a floating-point literal.
FONT(StringExpression[,CHARACTER_SET=CharSet])
                          You define fonts with the FONT function. Using the FONT function, you designate a value to specify a font and use that value for arguments that require a font value. The UIL compiler has no built-in fonts.

Each font makes sense only in the context of a character set. The FONT function has an additional parameter to let you specify the character set for the font. This parameter is optional; if you omit it, the default character set depends on the value of the LANG environment variable. If LANG is not set, the default character set is set to XmFALLBACK_CHARSET.

The string expression specifies the name of the font and the clause CHARACTER_SET=CharSet specifies the character set for the font. The string expression used in the FONT function cannot be a compound string.

FONTSET(StringExpression[,...][,CHARACTER_SET=CharSet])
                          You define fontsets with the FONTSET function. Using the FONTSET function, you designate a set of values to specify a font and use those values for arguments that require a fontset value. The UIL compiler has no built-in fonts.

Each font makes sense only in the context of a character set. The FONTSET function has an additional parameter to let you specify the character set for the font. This parameter is optional; if you omit it, the default character set depends on the value of the LANG environment variable. If LANG is not set, the default character set is set to XmFALLBACK_CHARSET.

The string expression specifies the name of the font and the clause CHARACTER_SET=CharSet specifies the character set for the font. The string expression used in the FONTSET function cannot be a compound string.

FONT_TABLE(FontExpression[,...]) A font table is a sequence of pairs of fonts and character sets. At run time when an object needs to display a string, the object scans the font table for the character set that matches the character set of the string to be displayed. UIL provides the FONT_TABLE function to let you supply such an argument. The font expression is created with the FONT and FONTSET functions.

If you specify a single font value to specify an argument that requires a font table, the UIL compiler automatically converts a font value to a font table.

COMPOUND_STRING(StringExpression[,Property[,...]])
                           Use the COMPOUND_STRING function to set properties of a null-terminated string and to convert it into a compound string. The properties you can set are the character set, writing direction, and separator.

The result of the COMPOUND_STRING function is a compound string with the string expression as its value. You can optionally include one or more of the following clauses to specify properties for the resulting compound string:

     CHARACTER_SET=CharacterSet
     RIGHT_TO_LEFT=BooleanExpression
     SEPARATE=BooleanExpression

The CHARACTER_SET clause specifies the character set for the string. If you omit the CHARACTER_SET clause, the resulting string has the same character set as StringExpression.

The RIGHT_TO_LEFT clause sets the writing direction of the string from right to left if BooleanExpression is True. Otherwise, writing direction is left to right. Specifying this argument does not cause the value of the string expression to change. If you omit the RIGHT_TO_LEFT argument, the resulting string has the same writing direction as StringExpression.

The SEPARATE clause appends a separator to the end of the compound string if BooleanExpression is True. If you omit the SEPARATE clause, the resulting string does not have a separator.

You cannot use imported or exported values as the operands of the COMPOUND_STRING function.

COMPOUND_STRING_TABLE(StringExpression[,...])
                          A compound string table is an array of compound strings. Objects requiring a list of string values, such as the XmNitems and XmNselectedItems arguments for the List widget, use string table values. The COMPOUND_STRING_TABLE function builds the values for these two arguments of the List widget. The COMPOUND_STRING_TABLE function generates a value of type string_table. The name STRING_TABLE is a synonym for COMPOUND_STRING_TABLE.

The strings inside the string table can be simple strings, which the UIL compiler automatically converts to compound strings.

ASCIZ_STRING_TABLE(StringExpression[,...])
                          An ASCIZ string table is an array of ASCIZ (null-terminated) string values separated by commas. This function allows you to pass more than one ASCIZ string as a callback tag value. The ASCIZ_STRING_TABLE function generates a value of type asciz_table. The name ASCIZ_TABLE is a synonym for ASCIZ_STRING_TABLE.
WIDE_CHARACTER(StringExpression) Use the WIDE_CHARACTER function to generate a wide character string from a null-terminated string in the current locale.
CLASS_REC_NAME(StringExpression) Use the CLASS_REC_NAME function to generate a widget class name. For a widget class defined by the toolkit, the string argument is the name of the class. For a user-defined widget, the string argument is the name of the creation function for the widget.
INTEGER_TABLE(IntegerExpression[,...])
                          An integer table is an array of integer values separated by commas. This function allows you to pass more than one integer per callback tag value. The INTEGER_TABLE function generates a value of type integer_table.
ARGUMENTS(StringExpression[,ArgumentType])
                          The ARGUMENTS function defines the arguments to a user-defined widget. Each of the objects that can be described by UIL permits a set of arguments. For example, XmNheight is an argument to most objects and has the integer data type. To specify height for a user-defined widget, you can use the built-in argument name XmNheight and specify an integer value when you declare the user-defined widget. Do not use the ARGUMENTS function to specify arguments that are built into the UIL compiler.

The StringExpression name is the name the UIL compiler uses for the argument in the UID file. The ArgumentType is the type of value that can be associated with the argument. If you omit the second argument, the default type is ANY and no value type checking occurs. Use any of the following keywords to specify the argument type:

  • Any
  • Asciz_Table
  • Boolean
  • Color
  • Color_Table
  • Compound_String
  • Float
  • Font
  • Font_Table
  • Fontset
  • Icon
  • Integer
  • Integer_Table
  • Reason
  • Single_Float
  • String
  • String_Table
  • Translation_Table
  • Wide_Character
  • WIdget

You can use the ARGUMENTS function to allow the UIL compiler to recognize extensions to AIXwindows. For example, an existing widget can accept a new argument. Using the ARGUMENTS function, you can make this new argument available to the UIL compiler before the updated version of the compiler is released.

REASON(StringExpression) The REASON function is useful for defining new reasons for user-defined widgets.

Each of the objects in AIXwindows defines a set of conditions under which it calls a user-defined function. These conditions are known as callback reasons. The user-defined functions are called callback procedures. In a UIL module, you use a callbacks list to specify which user-defined functions are to be called for which reasons.

When you declare a user-defined widget, you can define callback reasons for that widget using the REASON function. The string expression specifies the argument name stored in the UID file for the reason. This reason name is supplied to the widget creation function at run time.

TRANSLATION_TABLE(StringExpression[,...])
                          Each of the AIXwindows widgets have a translation table that maps X events (for example, pressing mouse button 1) to a sequence of actions. Through widget arguments, such as the common translations argument, you can specify an alternate set of events or actions for a particular widget. The TRANSLATION_TABLE function creates a translation table that can be used as the value of an argument that is of the data type translation_table.

You can use one of the following translation table directives with the TRANSLATION_TABLE function: #override, #augment, or #replace. The default is #replace. If you specify one of these directives, it must be the first entry in the translation table.

The #override directive causes any duplicate translations to be ignored. For example, if a translation for <Btn1Down> is already defined in the current translations for a PushButton, the translation defined by NewTranslations overrides the current definition. If the #augment directive is specified, the current definition takes precedence. The #replace directive replaces all current translations with those specified in the XmNtranslations resource.

Implementation Specifics

This file is part of the AIXwindows Development Environment in AIXwindows environment.

Files

/usr/include/uil/Uil.h
/usr/include/uil/UilDBDef.h
/usr/include/uil/UilDef.h
/usr/include/uil/UilSymDef.h
/usr/include/uil/UilSymGl.h

Related Information

The uil command.

The WML file format.


[ Previous | Next | Contents | Glossary | Home | Search ]