variable. In this example, we can safely set the character set in the module because we haven't used any multi−byte
strings. (For more information about multi−byte string parsing see Sections #suilcomps and #suiltext.) The objects
option allows you to choose whether the gadget or widget version of the Label, PushButton, ToggleButton,
CascadeButton, and Separator objects is used by default. The widget or gadget variant is specified independently for
each type of object. In our example, we use the following setting to get the gadget version PushButton:
module paint
objects = { XmPushButton = gadget; }
The default value for each object is widget, so you need to specify the objects option only if you want to create
gadgets by default instead. Setting this option does not prevent you from explicitly using the widget or gadget variant
of a control in an object definition. We recommend setting the objects option when you know that you are going
to be using gadgets for all or most of a certain type of object.
23.3.3 Include Files
As in C, it is possible to include other files in a UIL module. However, the syntax of an include directive in UIL is
different. Our example application isn't large enough to make it worth using include files, but to include a file named
procedures.uih we would use the following line in a module:
include file "procedures.uih";
The .uih suffix is not required; it is a convention that we've chosen to distinguish a UIL module from a UIL include
file. Nested include files are supported, so an include file may itself contain include directives. Unlike a module, an
include file must not begin with the module name statement or end with the end module statement. In addition, an
include file may contain only one or more complete UIL sections. You cannot start a section in one UIL file and
continue it in an include file.
Since you've probably used C include files before, you should already have a good idea of how to use UIL include
files. You can avoid repetitive and time−consuming declarations of variables, procedures, and widgets that are
referenced in multiple modules by placing them in a single include file. Then you simply include the appropriate file if
you need to reference any of its declarations. Include files can also be used to obtain definitions of commonly used
user interface components. (Chapter 26, Advanced UIL Programming, discusses using include files in more detail
and contains several examples of their use.)
23.3.4 Adding Comments
There are two different types of comments that you can add to a UIL module. The first type of comment can span one
or more lines; it begins with the character sequence /* and ends with */. This style is the same as a C comment. The
second type of comment begins with an exclamation mark and ends at the end of the line. Both comment styles appear
in the source code
You can place comments anywhere in a UIL module except, of course, within a quoted string. Comments are the only
text that can occur before the module name statement or after the end module statement. For example, the first line of
the hello_world.uil module is a C−style comment.
23.3.5 Overview of UIL Language Syntax
UIL, like C, is a free−form language, which means that the compiler doesn't care about the spacing and positioning of
symbols within a UIL module. The only requirements are that one or more whitespace characters (space, newline,
etc.) must appear between successive symbols, and lines cannot exceed 132 characters in length.
23 Introduction to UIL 23.3.3 Include Files
636
A symbol is a string of characters, like module or age. Single character operators and separators, such as +, =, and
:, are not considered symbols. Most UIL modules contain both predefined and programmer−defined symbols.
Predefined symbols, or keywords, are built into the UIL compiler. The built−in symbols are categorized as either
reserved or unreserved keywords. The difference between the two is that you can redefine unreserved keywords, while
the meaning of reserved keywords is fixed. The complete list of UIL reserved keywords appears in and the complete
list of unreserved keywords is shown in We suggest you avoid redefining unreserved keywords, as this practice can
easily lead to confusion and programming errors. lp9w(1.4i) | lp9w(3.25i) lp9w(1.4i) | lp9w(3.25i). Type Reserved
Keywords
_
General T{ module, end, widget, gadget T}
Section and list names T{
arguments, callbacks, controls, identifier,
include, list, object, procedure,
procedures, value
T}
Storage classes T{
exported, private
T}
Boolean constants T{
on, off, true, false
T}
_
lp9w(1.4i) | lp9w(3.25i)
lp9w(1.4i) | lp9w(3.25i).
Type Unreserved Keywords
_
Resource names T{
XmNaccelerators, XmNactivateCallback, et al.
T}
Character set names T{
iso_latin1, iso_greek, et al.
T}
Enumerated values T{
XmATTACH_FORM, XmSHADOW_ETCHED_IN, et al.
T}
Widget class names T{
XmPushButton, XmSeparator, et al.
T}
Option names and values T{
background, case_insensitive, case_sensitive,
file, foreground, imported, managed,
names, objects, right_to_left, unmanaged,
user_defined
T}
Type names T{
any, argument, asciz_table, asciz_string_table,
boolean, character_set, color, color_table,
compound_string, compound_string_table, float,
font, font_table, fontset, icon,
integer, integer_table, keysym, reason,
23 Introduction to UIL 23.3.3 Include Files
637
Get Volume 6A: Motif Programming Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.