UIL(5)
π UIL π (file formats)
okay bestie, buckle up, this is the UIL page from the file formats manual and it's a whole vibe. it's long, so we're doing this in parts. let's go π«Ά
β¨ NAME β¨
UIL β the user interface language file format. that's it, that's the name, iconic π
πΈ SYNOPSIS πΈ
MODULE module_name
[ NAMES = CASE_INSENSITIVE | CASE_SENSITIVE ]
[ CHARACTER_SET = character_set ]
[ OBJECTS = { widget_name = GADGET | WIDGET; [...] } ]
{ [
[ value_section ] |
[ procedure_section ] |
[ list_section ] |
[ object_section ] |
[ identifier_section ]
[ ... ]
] }
END MODULE;
π¦ DESCRIPTION π¦
so the UIL language is literally how you describe the initial state of a user interface for a widget based application. like, you're writing down what the interface looks like before it even exists. main character energy fr.
UIL describes the widgets used in the interface, the resources of those widgets, and the callbacks of those widgets. then the UIL file gets compiled into a UID file β you do that with the command uil or with the callable compiler Uil(). once you've got that compiled UID file, the various Motif Resource Management (MRM) functions can access its contents from inside an application program. slay.
and here's the best part: the UID file is independent of the platform the Motif program will eventually run on. in other words, the same UID file can be used on any system that can run Motif. portable queen π
π File π
a UIL file is made of a single complete module (that's the syntax up in the synopsis), or β if the file is gonna be included in a bigger UIL file β one complete "section," as described below. and there are five different kinds of sections: value, procedure, list, object, and identifier.
UIL is a free-form language. translation? high-level constructs like object and value declarations don't need to start in any particular column and can span any number of lines. low-level constructs like keywords and punctuation characters can also start in any column β BUT, except for string literals and comments, they cannot span lines. no cap.
also, heads up: the UIL compiler accepts input lines up to 132 characters in length. so don't be out here writing a novel on one line π
MODULE module_nameβ the name by which the UIL module is known in the UID file. this name gets stored in the UID file for later use when the MRM retrieves resources. and it is always stored in uppercase in the UID file, always.NAMES = CASE_INSENSITIVE | CASE_SENSITIVEβ tells UIL 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 in any case it must come before any statement that contains a name. if names are case sensitive in a UIL module, then UIL keywords in that module have to 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, then keywords can be uppercase, lowercase, or mixed case, and the uppercase equivalent of each name is what gets stored in the UID file.CHARACTER_SET = character_setβ sets the default character set for string literals in the module that don't explicitly set their own character set. if you don't include this clause, the default character set is the codeset component of theLANGenvironment variable, or the value ofXmFALLBACK_CHARSETifLANGisn't set or has no codeset component. the value ofXmFALLBACK_CHARSETis defined by the UIL supplier, but it's usuallyISO8859-1(equivalent toISO_LATIN1). β οΈ using this clause turns off all localized string literal processing that was turned on by the compiler flag-sor theUil_command_typedata structure elementuse_setlocale_flag.OBJECTS = { widget_name = GADGET | WIDGET; }β says whether the widget or gadget form of the control specified bywidget_nameis used by default. by default the widget form is used, sogadgetis usually the only keyword you'll actually use. the control you name should be one that has both a widget and a gadget version:XmCascadeButton,XmLabel,XmPushButton,XmSeparator, andXmToggleButton. you can specify the form of more than one control by delimiting them with semicolons. and if you wanna set the gadget or widget form for one specific instance of a control, you can do that with theGADGETandWIDGETkeywords in that particular object declaration. β¨value_sectionβ a way to name a value expression or literal. once it's named, that value name can be referred to by declarations anywhere else in the UIL module, in any context where a value can be used. values can be forward referenced. value sections get described in more detail later in this reference page.procedure_sectionβ defines the callback routines used by a widget and the creation routines for user-defined widgets. these definitions are used for error checking. procedure sections get described in more detail later in the reference page.list_sectionβ 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 build a whole hierarchy that clearly shows which arguments, controls, callbacks, and procedures are common to which widgets. list sections get described in more detail later in the reference page.object_sectionβ defines the objects that make up the user interface of the application. you can reference the object names in declarations 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 thetag_valueargument for a callback procedure. objects can be forward referenced. object sections get described in more detail later in the reference page.identifier_sectionβ defines a run-time binding of data to names that appear in the UIL module. identifier sections get described in more detail later in the reference page.
the UIL file can also contain comments and include directives, which are described along with the main elements of the UIL file format in the following sections. iykyk π§
π¬ Comments π¬
comments come in one of two forms, as follows:
- the comment is introduced with the sequence
/*, followed by the text of the comment, and terminated with the sequence*/. this form of comment can span multiple source lines. - the comment is introduced with an
!(exclamation point), followed by the text of the comment, and terminated by the end of the source line.
neither form of comment can be nested. that's a hard no, bestie. π
π Value sections π
a value section consists of the keyword VALUE followed by a sequence of value declarations. here's the syntax:
VALUE value_name : [ EXPORTED | PRIVATE ] value_expression | IMPORTED value_type ;
where value_expression is assigned to value_name, or a value_type is assigned to an imported value name. a value declaration is how you give a name to a value expression or literal. after that, 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. and yes, values can be forward referenced.
EXPORTEDβ a value you define as exported is stored in the UID file as a named resource, which means it 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 one that is not imported or exported. a value you define as private is not stored as a distinct resource in the UID file. you can only reference a private value 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 you define as imported is one that's 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. and here's the full list of the supported value types in UIL:
ANYARGUMENTBOOLEANCOLORCOLOR_TABLECOMPOUND_STRINGFLOATFONTFONT_TABLEFONTSETICONINTEGERINTEGER_TABLEKEYSYMREASONSINGLE_FLOATSTRINGSTRING_TABLETRANSLATION_TABLEWIDE_CHARACTERWIDGET
π§ Procedure sections π§
a procedure section consists of the keyword PROCEDURE followed by a sequence of procedure declarations. here's the syntax:
PROCEDURE
procedure_name [ ( [ value_type ]) ];
use a procedure declaration to declare:
- a routine that can be used as a callback routine for a widget
- the creation function for a user-defined widget
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. and ngl, one rule: you cannot use a name you used in another context as a procedure name.
in a procedure declaration you have the option of specifying that a parameter will be passed to the corresponding callback routine 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 right after 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. and yes, 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 have a common ancestor that's 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 one arguments in the procedure reference.
( )β checks that the argument count is 0 (zero).(ANY)β checks that the argument count is1. It does not check the argument type. Use theANYtype to prevent type checking on procedure tags. π(type)β checks for one argument of the specifiedtype. β¨(class_name)β 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 that you set up an appropriate corresponding data structure in the application in order to pass a tag of that type to a callback routine. iykyk π
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 invoked with the standard three arguments passed to all widget creation functions. (See the Motif Toolkit documentation for more information about widget creation functions.) periodt β¨
πΈ List sections πΈ
A list section consists of the keyword LIST followed by a sequence of list declarations. It has the following syntax:
LIST
list_name: { list_item; [...] }
[...]
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 that 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. no cap
The additional list types are described in the following sections. let's gooo π¦
π Arguments List Structure π
An arguments list defines which arguments are to be specified in the arguments list parameter when the creation routine for a particular object is called at run time. An arguments list also specifies the values for those arguments. Argument lists have the following syntax:
LIST
list_name: ARGUMENTS {
argument_name = value_expression;
[...] }
[...]
The argument name must be either a built-in argument name or a user-defined argument name that is specified with the ARGUMENT 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 appears 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. bestie, last one wins but you get a lil warning π
Some arguments, such as XmNitems and XmNitemCount, are coupled by the UIL compiler. When you specify one of the arguments, the compiler also sets the other. The coupled argument is not available to you. the way that's giving package deal π
The Motif Toolkit 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.
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, you include the arguments in the arguments list for the child.
See Appendix B for information about which arguments are supported by which widgets. See Appendix C for information about what the valid value type is for each built-in argument.
π 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 list_name : CALLBACKS { reason_name = PROCEDURE procedure_name [ ( [ value_expression ] ) ]; | reason_name = procedure_list ; [...] } [...]
For Motif Toolkit 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. Appendix B shows which reasons each object supports.
If the same reason appears more than once in a callbacks list, the last entry referring to that name supersedes all previous entries using the same reason, and the UIL compiler issues a diagnostic message. again: last one eats π
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. don't forget the space, it's giving picky but valid π
Because the UIL compiler produces a UID file rather than an object module (.o), the binding of the UIL name to the address of the entry point to the procedure is not done by the loader, but is established at run time with the MRM function MrmRegisterNames. 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. match it or it's not gonna hit, fr fr
Each callback procedure receives 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 Motif Toolkit for this object instance. This address is called the widget ID for this object. iconic
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. Note that, in the case where the value you specified is a string or an XmString, the value specified in the callbacks list already represents an address rather than an actual value. In the case of a simple string, for example, the value is the address of the first character of that string. In these cases, UIL does not add a level of indirection, and the second argument to the callback procedure is simply the value as specified in the callbacks list. no extra indirection bestie, it's already a pointer vibe β¨
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
list_name: CONTROLS {
[child_name: ] [MANAGED | UNMANAGED] object_definition;
[...] }
[...]
If you specify the keyword MANAGED at run time, the object is created and managed; if you specify UNMANAGED at run time, the object is only created. Objects are managed by default. default = managed, noted π
You can use child_name 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. so like Xm_ + child name, got it
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. See Appendix B for a list of which widget types can be controlled by which other widget types. so if you repeat it, you get multiples, no cap
β¨ 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
list_name: PROCEDURES {
procedure_name [ ( [ value_expression ]) ];
[...] }
[...]
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. space before name, don't skip it π
π Object Sections π
An object section consists of the keyword OBJECT followed by a sequence of object declarations. It has the following syntax:
OBJECT object_name:
[ EXPORTED | PRIVATE | IMPORTED ] object_type
[ PROCEDURE creation_function ]
[ object_name [ WIDGET | GADGET ] | {list_definitions } ]
Use an object declaration to define the objects that are to be 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 tag_value argument for a callback procedure). Objects can be forward referenced; that is, you can declare an object name after you reference 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. forward reference? we love a flexible queen π
The object definition can contain a sequence of lists that define the arguments, hierarchy, and callbacks for the widget. You can specify only 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. one list per type, and don't forget the creation function π
okay so real talk, bestie β a note first, because this is important and we don't gatekeep: several widgets in the Motif Toolkit actually consist of two linked widgets. For example, XmScrolledText and XmScrolledList each consist of children XmText and XmList widgets under a XmScrolledWindow widget. When such a widget is created, its resources are available to both of the underlying widgets. This can occasionally cause problems, as when the programmer wants a XmNdestroyCallback routine named to act when the widget is destroyed. In this case, the callback resource will be available to both sub-widgets, and will cause an error when the widget is destroyed. To avoid these problems, the programmer should separately create the parent and child widgets, rather than relying on these linked widgets. π
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 Motif Toolkit name of an object type that has a gadget variant (for example, XmLabelGadget) as an attribute of an object declaration. The object_type 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 is literally your girl's way to define an identifier β a mechanism that achieves run-time binding of data to names that appear in a UIL module. It's giving β¨dynamicβ¨. The identifier section consists of the reserved keyword IDENTIFIER, followed by a list of names, each name followed by a semicolon.
IDENTIFIER identifier_name; [...;]
You can later use these names 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, you use the MRM functions MrmRegisterNames and MrmRegisterNamesInHierarchy 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 a name you used for a value, object, or procedure as an identifier name in the same module. No cap, one name space, one vibe.
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. It's giving type-fluid, periodt.
To reference these identifier names in a UIL module, you 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 file_name;
The UIL compiler replaces the include directive with the contents of the include file and processes it as if these contents had appeared in the current UIL source file.
You can nest include files; that is, 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, so including the same file twice counts as two references.
The file_name is a simple string containing 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. The UIL uses the -I option for specifying a search directory for include files.
- If you do not supply a directory, the UIL compiler searches for the include file in the directory of the main source file.
- If the compiler does not find the include file there, the compiler looks in the same directory as the source file.
- If you supply a directory, the UIL compiler searches only that directory for the file.
β¨ 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. So like, 31 chars max, bestie, don't push it.
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. Default = case sensitive, iykyk.
In CASE-INSENSITIVE mode, the compiler outputs all names in the UID file in uppercase form. In CASE-SENSITIVE mode, names appear in the UIL file exactly as they appear in the source.
The following table lists the reserved keywords, which are not available for defining programmer defined names.
ARGUMENTSCALLBACKSCONTROLSENDEXPORTEDFALSEGADGETIDENTIFIERINCLUDELISTMODULEOFFONOBJECTPRIVATEPROCEDUREPROCEDURESTRUEVALUEWIDGET
The UIL unreserved keywords are described in the following list and table. These keywords can be used as programmer defined names, however, if you use any keyword as a name, you cannot use the UIL-supplied usage of that keyword. It's giving "you can sit with us but you can't be us" energy.
- 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)
Unreserved keywords:
ANY
ARGUMENT
ASCIZ_STRING_TABLE
ASCIZ_TABLE
BACKGROUND
BOOLEAN
CASE_INSENSITIVE
CASE_SENSITIVE
CHARACTER_SET
COLOR
COLOR_TABLE
COMPOUND_STRING
COMPOUND_STRING_COMPONENT
COMPOUND_STRING_TABLE
FILE
FLOAT
FONT
FONT_TABLE
FONTSET
FOREGROUND
ICON
IMPORTED
INTEGER
INTEGER_TABLE
KEYSYM
MANAGED
NAMES
OBJECTS
REASON
RGB
RIGHT_TO_LEFT
SINGLE_FLOAT
STRING
STRING_TABLE
TRANSLATION_TABLE
UNMANAGED
USER_DEFINED
VERSION
WIDE_CHARACTER
WIDGET
XBITMAPFILE
String literals can be composed of the 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 appear before or after any other element in the language. However, spaces, tabs, and comments that appear 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:
- String literal
- Integer literal
- Boolean literal
- Floating-point literal
UIL also includes the data type ANY, which is used to turn off compile time checking of data types. It's giving "no type check, we vibe."
π String Literals π
A string literal is a sequence of zero 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 2000 characters long. Two thousand, bestie, that's the limit.
A single-quoted string literal can span multiple source lines. To continue a single-quoted string literal, terminate 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 continuation of the string.) To build a string value that must span multiple source lines, use the concatenation operator described later in this section.
The syntax of a string literal is one of the following:
'[character_string]'
[#char_set]"[character_string]"
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:
- A string declared as
'string'is equivalent to#cur_charset"string", wherecur_charsetwill be the codeset portion of the value of theLANGenvironment variable if it is set or the value ofXmFALLBACK_CHARSETifLANGis not set or has no codeset component. By default,XmFALLBACK_CHARSETisISO8859-1(equivalent toISO_LATIN1), but vendors may define a different default. π - A string declared as
"string"is equivalent to#char_set"string"if you specifiedchar_setas the default character set for the module. If no default character set has been specified for the module, then if the-soption is provided to theuilcommand or theuse_setlocale_flagis set for the callable compiler,Uil(), the string will be interpreted to be a string in the current locale. This means that the string is parsed in the locale of the user by callingsetlocale, its charset isXmFONTLIST_DEFAULT_TAG, and that if the string is converted to a compound string, it is stored as a locale encoded text segment. Otherwise,"string"is equivalent to#cur_charset"string", wherecur_charsetis interpreted as described for single quoted strings. - A string of the form
"string"or#char_set"string"is stored as a null-terminated string. π
If the char_set in a string specified in the form above is not a built-in charset, and is not a user-defined charset, the charset of the string will be set to XmFONTLIST_DEFAULT_TAG, and an informational message will be issued to the user to note that this substitution has been made. π
The following table 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 table are represented by 8 bits. π
Supported Character Sets β the columns are UIL Name and Description, but we're doing bullets because tables are not the vibe here: π¦
ISO_LATIN1β GL: ASCII, GR: Latin-1 SupplementISO_LATIN2β GL: ASCII, GR: Latin-2 SupplementISO_ARABICβ GL: ASCII, GR: Latin-Arabic SupplementISO_LATIN6β GL: ASCII, GR: Latin-Arabic SupplementISO_GREEKβ GL: ASCII, GR: Latin-Greek SupplementISO_LATIN7β GL: ASCII, GR: Latin-Greek SupplementISO_HEBREWβ GL: ASCII, GR: Latin-Hebrew SupplementISO_LATIN8β GL: ASCII, GR: Latin-Hebrew SupplementISO_HEBREW_LRβ GL: ASCII, GR: Latin-Hebrew SupplementISO_LATIN8_LRβ GL: ASCII, GR: Latin-Hebrew SupplementJIS_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...1F,7F, and80...9Fare control characters including both bytes of 16-bit characters. The compiler flags these as illegal characters. π ISO_LATIN1ISO_LATIN2ISO_LATIN3ISO_GREEKISO_LATIN4β These sets are parsed from left to right. The escape sequences for null-terminated strings are also supported by these character sets.ISO_HEBREWISO_ARABICISO_LATIN8β These sets are parsed from right to left. For example, the string#ISO_HEBREW"012345"will generate a primitive string of"543210"with character setISO_HEBREW. The string direction for such a string would be right-to-left, so when rendered, the string will appear as"012345."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 would enter\n, notn\.ISO_HEBREW_LRISO_ARABIC_LRISO_LATIN8_LRβ These sets are parsed from left to right. For example, the string#ISO_HEBREW_LR"012345"generates a primitive string"012345"with character setISO_HEBREW. The string direction for such a string would still be right-to-left, however, so when rendered, it will appear as"543210."In other words, the characters were originally typed in the same order in which they would have been typed in Hebrew (although in Hebrew, the typist would have been using a text editor that went from right to left). 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 this character set. Note that the\(backslash) may 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 the Motif Toolkit 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 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-1F, 7F, and 80-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β Newline\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 that escape sequences are processed literally in strings that are parsed in the current locale (localized strings). π¨
The UIL compiler does not process newline characters in compound strings. The effect of a newline character in a compound string depends only on the character set of the string, and 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 concatenation operator & (ampersand) 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. π
okay bestie, let's talk β¨storageβ¨ because this is where it gets real. every time you make an allocation, you're paying two separate bills: a fixed portion and a variable portion. the fixed portion of an allocation is roughly the same as the storage requirement for a reference (aka a few bytes, nbd π ). the variable portion is the drama queen β it depends on the size of the literal value, which is to say the length of the string π§΅.
so if you're trying to conserve storage space? avoid making string literal declarations that result in an allocation per use. that's the whole vibe. periodt.
ββββββββββββββββββββββββββββββββββββββββββββββββ
β Data Storage Consumption for String Literals β
ββββββββββββββββββββββββββββββββββββββββββββββββ
π’ Integer Literals π’
an integer literal represents the value of a whole number. it looks like an optional sign followed by one or more decimal digits. and it must not contain embedded spaces or commas β not even one, bestie, the compiler will simply not be having it π.
integer literals are stored in the UID file as 32-bit integers. exported and imported integer literals require a single allocation when the literal is declared; after that, only a few bytes of storage are needed for each reference to the literal. private integer literals, and the ones declared in-line, are high-maintenance π β they require allocation and reference storage per use. so again, to conserve storage space, avoid making integer literal declarations that result in an allocation per use.
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 Literal π
a Boolean literal represents the value True (reserved keyword TRUE or On) or False (reserved keyword FALSE or Off). heads up: 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 (zero).
data storage consumption for Boolean literals is the same as that for integer literals β no special treatment, she's just like her sister π .
πΈ Floating-Point Literal πΈ
a floating-point literal represents the value of a real (or float) number. she comes in this shape:
[+|-][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 6 significant digits. on many machines this range will be wider, with more significant digits β lucky you π. and yes, 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. here's the receipts on what the UIL compiler will and will not accept π
Floating Point Literals
- Valid β
1.03.1415E-2 (equals .031415)-6.29e7 (equals -62900000)
- Invalid π
1e1 (no decimal point)2.87 e6 (embedded blanks)2.0e100 (out of range)
data storage consumption for floating-point literals is the same as that for integer literals.
okay so the whole point of the ANY data type is to shut off the data-type checking feature of the UIL compiler. it's giving "i do what i want" π. you can use the ANY data type for the following:
- specifying the type of a callback procedure tag
- specifying the type of a user-defined argument
reach for ANY when you need a type that the UIL compiler doesn't support, or when you just want the data-type restrictions the compiler imposes to be relaxed. like, maybe you're defining a widget with an argument that can accept different types of values depending on run-time circumstances. slay, flexible queen π.
β οΈ but be careful, bestie!! if you specify that an argument takes anANYvalue, the compiler does not check the type of the value you specified for that argument. so you have to take care when specifying a value for an argument of typeANY. you could get unexpected results at run time if you pass a value whose data type the widget does not support for that argument. no cap π«Ά
β¨ Expressions β¨
UIL includes compile-time value expressions. these expressions can contain references to other UIL values, but they cannot be forward referenced β no time travel, sorry π°οΈ.
the operators below are the whole toolkit for building integer, real, and Boolean values out of other values defined in your UIL module. quick note: in this list, a precedence of 1 is the highest π.
~β Boolean β NOT; integer β One's complement. precedence 1-β float β Negate; integer β Negate. precedence 1+β float β NOP; integer β NOP. precedence 1*β float,float β Multiply; integer,integer β Multiply. precedence 2/β float,float β Divide; integer,integer β Divide. precedence 2+β float,float β Add; integer,integer β Add. precedence 3-β float,float β Subtract; integer,integer β Subtract. precedence 3>>β integer,integer β Shift right. precedence 4<<β integer,integer β Shift left. precedence 4&β Boolean,Boolean β AND; integer,integer β Bitwise AND; string,string β Concatenate. precedence 5|β Boolean,Boolean β OR; integer,integer β Bitwise OR. precedence 6^β Boolean,Boolean β XOR; integer,integer β Bitwise XOR. precedence 6
a string can be either a single compound string or a sequence of compound strings. if the two concatenated strings have different properties (like 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:
- one of the operands is a compound string
- the operands have different character set properties
- the operands have different writing directions
and then the resulting string is a compound string. also, lowkey important: 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 routines β so no chaotic type-mashing, bestie, use the converters π.
okay so bestie, parentheses? they're literally your bestie for overriding the normal precedence of operators. π
In a sequence of unary operators, the operations go down in right-to-left order. like, - + -A is equivalent to -(+(-A)). and for a sequence of binary operators of the same precedence, they go left-to-right. for example, A*B/C*D is equivalent to ((A*B)/C)*D. periodt. β¨
A value declaration gives a value a name. but no cap, 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. but lowkey, you cannot use imported values as operands in expressions. π«
Several of the binary operators are defined for multiple data types. like, the operator for multiplication (*) is defined for both floating-point and integer operands. it's giving versatile. β¨
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 conversions rules:
- If the operands are an integer and a Boolean, the Boolean is converted to an integer.
- If the operands are an integer and a floating-point, the integer is converted to an floating-point.
- If the operands are a floating-point and a Boolean, the Boolean is converted to a floating-point.
You can also explicitly convert the data type of a value by using one of the conversion functions INTEGER, FLOAT or SINGLE_FLOAT. π
β¨ Functions β¨
UIL provides functions to generate the following types of values:
- Character sets
- Keysyms
- Colors
- Pixmaps
- Single-precision, floating-point numbers
- Double-precision, floating-point numbers
- Fonts
- Fontsets
- Font tables
- Compound strings
- Compound string tables
- ASCIZ (null-terminated) string tables
- Wide character strings
- Widget class names
- Integer tables
- Arguments
- Reasons
- Translation tables
Remember that 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 lowercase letters. This use of uppercase letters is not required in case-insensitive mode. In case-sensitive mode, keywords must be in lowercase letters. π₯
CHARACTER_SET(string_expression[, 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 string_expression and the properties you specify. string_expression 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 = boolean_expression
SIXTEEN_BIT = boolean_expression
The RIGHT_TO_LEFT clause sets the default writing direction of the string from right to left if boolean_expression is True, and right to left otherwise.
The SIXTEEN_BIT clause allows the strings associated with this character set to be interpreted as 16-bit characters if boolean_expression is True, and 8-bit characters otherwise. π
KEYSYM(string_literal)
The KEYSYM function is used to specify a keysym for a mnemonic resource. string_literal must contain a valid KeySym name. (See XStringToKeysym(3 X11) for more information.) π
COLOR(string_expression[,FOREGROUND|BACKGROUND])
The COLOR function supports the definition of colors. Using the COLOR function, you can designate a value to specify a color and then use that value for arguments requiring a color value. The string expression names the color you want to define; the optional keywords FOREGROUND and BACKGROUND 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 routines 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).
Interfaces do not, in general, specify colors for widgets, so that the selection of colors can 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 designate this mapping in the definition of the color. The following example shows how to use the COLOR function to map the color red to the background color on a monochrome device:
VALUE c: COLOR ( 'red',BACKGROUND );
The mapping comes into play 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 the Motif Toolkit for mapping to the foreground or background color. π¨
RGB(red_integer, green_integer, blue_integer)
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. The values may be represented as integer expressions.
In a UID file, UIL represents an RGB value as three integers. MRM calls X translation routines 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 colormap is not yet full. If the colormap is full, values translate to black or white (foreground or background). π
COLOR_TABLE(color_expression='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=color_table_name,] row[,...)
color-table-name must refer to a previously defined color table, and row is a character expression giving 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 maximum number of rows is 999.
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 previous statement. You can specify icons as private, imported, or exported. Use the MRM function MrmFetchIconLiteral to retrieve an exported icon at run time. πΌοΈ
πΎ XBITMAPFILE πΎ
XBITMAPFILE(string_expression)
okay so bestie, XBITMAPFILE is giving cousin of ICON β they're both describing a rectangular icon that's x pixels wide and y pixels high. πΌοΈ But here's the plot twist: XBITMAPFILE lets you point at an external file that holds the definition of an X bitmap, whereas every single ICON function definition has to be coded directly inside your UIL. no outsourcing for ICON, she does her own stunts π
X bitmap files can be generated by lots of different X applications, so you've got options. UIL reads these files through the XBITMAPFILE function, but it does not support creating them β she reads, she does not write, no cap. πβ¨ And the X bitmap file you hand over as the argument gets read at application run time by MRM.
XBITMAPFILE returns a value of type pixmap, so you can use it literally anywhere a pixmap data type is expected. slay.
π SINGLE_FLOAT π
SINGLE_FLOAT(real_number_literal)
The SINGLE_FLOAT function lets you store floating-point literals in UIL files as single-precision floating-point numbers. π« And the cute part? Single-precision floating-point numbers can often be stored using less memory than double-precision floating-point numbers. tiny but mighty fr fr.
The real_number_literal can be either an integer literal or a floating-point literal. π§
πΈ FLOAT πΈ
FLOAT(real_number_literal)
The FLOAT function lets you store floating-point literals in UIL files as double-precision floating-point numbers. That's the fuller, beefier version, she ate. π
And yep β the real_number_literal can be either an integer literal or a floating-point literal. π
β¨ FONT β¨
FONT(string_expression[, CHARACTER_SET=char_set])
You define fonts with the FONT function, bestie. π Using FONT, you designate a value to specify a font, and then you use that value for arguments that require a font value. And heads up: the UIL compiler has no built-in fonts. you bring your own, periodt.
Now for the important lore: each font only makes sense in the context of a character set. So FONT has an extra parameter letting 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 it's set, or on the value of XmFALLBACK_CHARSET if LANG is not set. π
string_expression specifies the name of the font, and the clause CHARACTER_SET = char_set specifies the character set for the font. π¦ One lil caveat tho: the string expression used in the FONT function cannot be a compound string. nope. not today. π
π FONTSET π
FONTSET(string_expression[,...][, CHARACTER_SET=charset])
You define fontsets with the FONTSET function. Using FONTSET, you designate a set of values to specify fonts, and then you use those values for arguments that require a fontset. π« And again, just so we're clear: the UIL compiler has no built-in fonts. iconic of her to make you supply your own.
Same character set energy as FONT: each font only makes sense in the context of a character set, and FONTSET has an additional parameter so you can specify the character set for the font. It's optional β omit it and the default character set depends on the value of the LANG environment variable if it's set, or on the value of XmFALLBACK_CHARSET if LANG is not set. π
The string expression specifies the name of the font, and the clause CHARACTER_SET = char_set specifies the character set for the font. π And once again: the string expression used in the FONTSET function cannot be a compound string. π
π FONT_TABLE π
FONT_TABLE(font_expression[,...])
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. she's matching, she's scanning, she's doing the work. π
UIL provides the FONT_TABLE function to let you supply such an argument. And font_expression is created with the FONT and FONTSET functions. β¨
π cute lil shortcut alert: 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. convenient!
π COMPOUND_STRING π
COMPOUND_STRING(string_expression[,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 writing direction and separator. main character transformation fr.
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:
RIGHT_TO_LEFT = boolean_expression
SEPARATE = boolean_expression
- The
RIGHT_TO_LEFTclause sets the writing direction of the string from right to left ifboolean_expressionis True, and left to right otherwise. π¦ And heads up: specifying this argument does not cause the value of the string expression to change. If you omit theRIGHT_TO_LEFTargument, the resulting string has the same writing direction asstring_expression. - The
SEPARATEclause appends a separator to the end of the compound string ifboolean_expressionis True. β¨ If you omit theSEPARATEclause, the resulting string does not have a separator.
β οΈ okay important one: you cannot use imported or exported values as the operands of the COMPOUND_STRING function. nope nope nope. π
π§© COMPOUND_STRING_COMPONENT π§©
COMPOUND_STRING_COMPONENT(component_type [, {string | enumval}])
Use the COMPOUND_STRING_COMPONENT function to create compound strings in UIL consisting of single components. π This function is analogous to XmStringComponentCreate. It lets you create simple compound strings containing components such as XmSTRING_COMPONENT_TAB and XmSTRING_COMPONENT_RENDITION_BEGIN which are not produced by the COMPOUND_STRING function. And then β plot twist β these components can be concatenated to other compound strings to build more complex compound strings. build-a-bear but make it strings. π§Έβ¨
The first argument must be an XmStringComponentType enumerated constant. The type and interpretation of the second argument depends on the first argument. Let's break it down, bestie:
- If you specify any of these enumerated constants for the first argument, then you should not specify a second argument:
XmSTRING_COMPONENT_SEPARATOR,XmSTRING_COMPONENT_LAYOUT_POP,XmSTRING_COMPONENT_TAB, andXmSTRING_COMPONENT_LOCALE. π - If you specify an enumerated constant from this group, then you must supply a string as the second argument:
XmSTRING_COMPONENT_CHARSET,XmSTRING_COMPONENT_TEXT,XmSTRING_COMPONENT_LOCALE_TEXT,XmSTRING_COMPONENT_WIDECHAR_TEXT,XmSTRING_COMPONENT_RENDITION_BEGIN, andXmSTRING_COMPONENT_RENDITION_END. π - If you specify
XmSTRING_COMPONENT_DIRECTIONas the first argument, then you must specify anXmStringDirectionenumerated constant as the second argument. πΈ - Finally, if you specify
XmSTRING_COMPONENT_LAYOUT_PUSHas the first argument, then you must specify anXmDirectionenumerated constant as the second argument. π
And one more lil detail: the compound string components XmSTRING_COMPONENT_RENDITION_BEGIN and XmSTRING_COMPONENT_RENDITION_END take, for their argument, the "tag," or name, of a rendition from the current render table. π See the following section for more information about how to specify a render table. iykyk.
π COMPOUND_STRING_TABLE π
COMPOUND_STRING_TABLE(string_expression[,...])
A compound string table is an array of compound strings. π Objects that require a list of string values β like 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. she's doing the heavy lifting fr fr. π
The COMPOUND_STRING_TABLE function generates a value of type string_table. And guess what β STRING_TABLE is a synonym for COMPOUND_STRING_TABLE. β¨
π¦ lil heads up: the strings inside the string table must be simple strings, which the UIL compiler automatically converts to compound strings. no compound-string-inception here, sorry bestie.
π ASCIZ_STRING_TABLE π
ASCIZ_STRING_TABLE(string_expression[,...])
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. flexible, versatile, ate.
The ASCIZ_STRING_TABLE function generates a value of type asciz_table. And yes β ASCIZ_TABLE is a synonym for ASCIZ_STRING_TABLE. π
π¦ WIDE_CHARACTER π¦
WIDE_CHARACTER(string_expression)
Use the WIDE_CHARACTER function to generate a wide character string from null-terminated string in the current locale. π she's wide, she's characterful, she's locale-aware.
π CLASS_REC_NAME π
CLASS_REC_NAME(string_expression)
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 routine for the widget.
π’ INTEGER_TABLE π’
INTEGER_TABLE(integer_expression[,...])
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. so many numbers, so few callbacks.
The INTEGER_TABLE function generates a value of type integer_table. β¨
π― ARGUMENT π―
ARGUMENT(string_expression[, argument_type])
The ARGUMENT function defines the arguments to a user-defined widget. π Each of the objects that can be described by UIL permits a set of arguments, listed in Appendix B. For example, XmNheight is an argument to most objects and has an 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. π
π and here's the thing: you do not use the ARGUMENT function to specify arguments that are built into the UIL compiler. those are already handled, bestie, don't double up.
Okay so the string_expression name? Thatβs literally the name the UIL compiler uses for the argument in the UID file. π
And argument_type 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. Lowkey a free-for-all, bestie. π Use one of these keywords to specify the argument type:
ANYASCIZ_TABLEBOOLEANCOLORCOMPOUND_STRINGFLOATFONTFONT_TABLEFONTSETICONINTEGERINTEGER_TABLEKEYSYMPIXMAPREASONSINGLE_FLOATSTRINGSTRING_TABLETRANSLATION_TABLEWIDE_CHARACTERWIDGET
And bestie, you can use the ARGUMENT function to let the UIL compiler recognize extensions to the Motif Toolkit. For example, an existing widget may accept a new argument. Using the ARGUMENT function, you can make this new argument available to the UIL compiler before the updated version of the compiler is released. No cap, future-proofing your vibes. π
β¨ REASON(string_expression) β¨
The REASON function is useful for defining new reasons for user-defined widgets. Itβs giving custom callback energy. π
Each of the objects in the Motif Toolkit 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 termed callback procedures. In a UIL module, you use a callbacks list to specify which user-defined functions are to be called for which reasons.
Appendix B lists the callback reasons supported by the Motif Toolkit objects. (Yes, bestie, Appendix B is that girl.) π
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 routine at run time. Periodt. π
β¨ TRANSLATION_TABLE(string_expression[,...]) β¨
Each of the Motif Toolkit widgets has a translation table that maps X events (for example, mouse button 1 being pressed) 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. Itβs giving event-to-action glow-up. π
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. No skipping the line, bestie. π«
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 new_translations 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. So like, choose your fighter wisely. π
π Renditions and Render Tables π
In addition to the string direction, each compound string carries a great deal of information about how its text is to be rendered. Each compound string contains a "tag," identifying the "rendition" to be used to draw that string. The rendition contains such information as the font, the size, the color, whether the text is to be underlined or crossed out, and the position and style of any tab stops. Many renditions are combined into a "render table," which is specified to any widget with the XmNrenderTable resource, and in the widget's controls list. Itβs giving full glam on every string. π
UIL implements render tables, renditions, tab lists, and tab stops as a special class of objects, in a form similar to the widget class. These objects are not themselves widgets or gadgets, but the format used by UIL to specify widget resources provides a convenient way to specify the qualities and dependencies of these objects. Lowkey iconic design choice. π
For example, a render table, included in some widget's controls list, must also have a controls list in its specification, containing the names of its member renditions. Each rendition, in its specification, will contain an arguments list specifying such qualities as the font, the color, and whether the text is to be underlined. Any of the renditions may also control a tablist, which will itself control one or more tab stops. Nested lists? We love a hierarchy. π§
Please refer to the Motif Programmer's Guide for a complete description of renditions and render tables, and for an example of how to use them in UIL. Bestie, go read the source. π
π RELATED INFORMATION π
And thatβs the whole vibe from source/version UIL(file formats). Date? Not shown in this chunk, but consider it timeless, bestie. πβ¨
π¦ where this page comes from
- arch rolling: openmotif 2.3.8-4 Β· LGPL-2.1-or-later
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- epel 10: motif-devel 2.3.8-2.el10_2 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- nixos 26.05: motif 2.3.8
- nixpkgs unstable: motif 2.3.8
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms