Appendix A. The Widget Meta-Language Facility

The Widget Meta-Language (WML) facility generates the components of the User Interface Language (UIL) compiler that can change depending on the widget set. WML adds support in UIL for additional widgets that are not in the OSF/Motif widget set or for a totally new widget set.

UIL is made up of the following:

The static syntax elements are the basic syntax and keywords of UIL. These elements do not change when the widget set is modified. The static syntax elements of UIL are defined in the file Uil.y in the WML source directory.

The dynamic syntax elements are the parts of UIL that change with the widget set. These elements describe the widget and gadget classes supported by UIL, including their resources and hierarchy. The dynamic elements of UIL are defined in WML files. For the OSF/Motif widget set, these elements are defined in the file motif.wml in the WML source directory.

The data type elements describe the allowable data types for each widget and gadget resource. Although the data types do not change, the resources that they are assigned to change with the widget set. The allowable data types for each resource are defined in the same file as the dynamic syntax elements.

The WML facility combines the static syntax, dynamic syntax, and data type elements to produce new source code for UIL. This allows a developer to modify the dynamic elements of UIL, adding resources, widgets, gadgets, or even new widget sets.

A developer can use WML files to modify UIL in two ways:

Using WML

When Motif is built, the WML facility uses the file motif.wml to produce UIL source files. The motif.wml file contains definitions for the OSF/Motif widget set. A developer can create a new WML file in the directory tools/wml to use in place of motif.wml. By convention, WML files have a suffix of .wml. For information on the syntax of WML files, see the WML(5X) reference page in the OSF/Motif Programmer's Reference.

A developer uses a customized WML file to build UIL in a four-step process:

  1. Build WML

  2. Run WML with the customized WML file

  3. Install the UIL source files

  4. Build UIL

All four steps are done as needed each time Motif is built. By default, UIL is built using the motif.wml file from the tools/wml directory. The command-line make variable TABLE specifies the WML file to use in building UIL:

make TABLE=anyfile.wml

where anyfile.wml is the name of a WML file in the tools/wml directory of the Motif build tree.

When Motif is built, a default WMD file named motif.wmd is created. By convention, WMD files use the suffix .wmd. WMD files provide a method for including new widget definitions into the UIL compiler without rebuilding the compiler. Rebuilding this file or building a new WMD file is a two-step process that closely parallels the first two steps of creating a new UIL compiler:

  1. Build WML

  2. Run WML with the customized WML file

The following make command line rebuilds motif.wmd based on a given WML file:

make TABLE=anyfile.wml motif.wmd 

The following make command line creates a new WMD file based on a given WML file:

make TABLE=anyfile.wml WMDTABLE=anyfile.wmd anyfile.wmd 

where anyfile.wmd is the name of the WMD file to create. In both of the preceding make commands, the make variable TABLE specifies the WML file to use as the source for the WMD file.

A developer of a UIL application specifies a WMD file for the UIL compiler in one of two ways:

  • By using the -wmd option to the uil command

  • By supplying values for the database and database_flag members of the Uil_command_type structure whose address is the first argument to the Uil function

See the OSF/Motif Release Notes for more information about building Motif.

The following sections describe how to do each of the four steps involved in rebuilding UIL independently.

Building WML

Building Motif builds WML by default, but a developer can also build WML separately. A developer must build WML in order to build the UIL compiler or new WMD files. The WML source is located in the subdirectory tools/wml. Before WML is built, the directory should contain the following files:

Table A-1.

Imakefile

wml.h

wmlparse.y

Makefile

wmldbcreate.c

wmlresolve.c

README

wmllex.l

wmlsynbld.c

Uil.y

wmlouth.c

wmluiltok.l

UilDBDef.h

wmloutkey.c

wmlutils.c

motif.wml

wmloutmm.c

 

wml.c

wmloutp1.c

 

The files Imakefile and Makefile are used to build and run the WML facility. The README file contains instructions for building and using WML. The files Uil.y and motif.wml are the data files for the static syntax, dynamic syntax, and data type elements of UIL. The files with the wml prefix are the source files for the WML facility.

The following commands change to the directory tools/wml, build the makefile, and build WML:

cd tools/wml 
make Makefile 
make depend 
make wmltools 

The make Makefile and make depend commands build the makefile using the Imake facility. The make Makefile command produces a machine-dependent makefile. The make depend command adds include file dependencies to the new makefile.

After WML is built, the tools/wml directory should contain the following additional files:

Table A-2.

lex.yy.c

wmloutkey.o

wmlresolve.o

libwml.a

wmloutmm.o

wmlsynbld.o

wml

wmloutp1.o

wmluiltok

wml.o

wmlparse.c

wmlutils.o

wmllex.c

wmlparse.h

 

wmlouth.o

wmlparse.o

 


Running WML

Building Motif runs WML, installs the resulting files in the UIL source directory, and builds the UIL compiler. A developer who does not want to install or build UIL can also run WML separately. Running WML automatically builds the WML source files if necessary.

The make motif.wmd command from the tools/wml directory runs the WML facility. The make variable TABLE specifies the WML file to use, as in the following example:

make motif.wmd TABLE=anyfile.wml 

where anyfile.wml is a WML file in the tools/wml directory. The default WML file is motif.wml.

Running WML produces the following files:

UIL source files 


WML produces the following files, which make copy copies to the clients/uil directory to be used in building UIL:

Table A-3.

UilConst.h

UilSymArTy.h

UilSymRArg.h

UilDBDef.h

UilSymCSet.h

UilSymReas.h

UilKeyTab.h

UilSymCtl.h

UilTokName.h

UilLexPars.c

UilSymEnum.h

UilUrmClas.h

UilLexPars.h

UilSymGen.h

 

UilSymArTa.h

UilSymNam.h

 


wml.report 

This report describes the widget set supported by the newly created UIL sources. It is intended to help validate the WML source file. It is organized as follows:

  • Class names are ordered alphabetically by name.

  • Resources are ordered by ancestor, from the top down.

  • Resources are listed alphabetically within ancestor, along with data types and default values.

  • Reasons are ordered alphabetically within ancestor.

  • Controls are ordered alphabetically.

  • Automatically created children are ordered alphabetically.

wml-uil.mm 

This file contains the information in Appendix B of the OSF/Motif Programmer's Reference. This file can be processed by tbl, troff, and the mm macro package to produce three tables for each supported widget class:

  • Controls and reasons supported by the class

  • Resources for the class, including their types and default values

  • Automatically created children of the class

motif.wmd 

This is the default WMD file.

These files overwrite any existing WML output files in the tools/wml directory.

Installing UIL

A developer can use the make command from the tools/wml directory to install the UIL source files in the clients/uil directory without rebuilding UIL. The make all and make copy commands are synonyms for the make command. This command automatically builds the WML source files and runs WML if necessary. It overwrites the existing source files in the clients/uil directory.

See the previous section, Section A.1.2, "Running WML," for more information on using the make command in the tools/wml directory.

Building UIL

A developer can use the make command from the clients/uil directory to build UIL, as in the following example:

cd clients/uil 
make 

See the OSF/Motif Release Notes for more information about building UIL.