Chapter X9. Developing OSF/Motif applications in C and C++
 
Goals for this chapter: rpm packages covered in this chapter: 
  • XFree86 (X)
  • OpenMotif 2.2
 
 
What can Sun users learn from the battle between VHS and Betamax ?
 - UNIX World Magazine Advertising
- pag 44-45 - Vol X N. 1 - Jan 1993

The OSF/Motif Widget Set

OSF/Motif today OpenMotif offers a complete set of widgets, from the simple label ... up to the notebook widget.

Like a "Chef" select the ingredients to create a particular food, in the same mode, you need to "cook" the graphical application selecting the containers, the display widgets, fixing colors, fonts and other resources.

From a mask or dialog written on "paper" we can create "beautiful" applications.

Motif widget may classified as follows:

Therefore formerly Display Widgets are:
 
XmArrowButton
XmList
XmSeparator
XmScale
XmDrawButton
XmPushButton
XmText
XmCascadeButton
XmLabel
XmScrollBar
XmToggleButton
XmTextField

 
The ArrowButton
Check: arrow.c
The List
Check: list.c
The drawbutton
Check: drawn.c
The PushButton
Check: hello.c
The Label and Text
Check: formedit.c

Other widget may be visualized in Periodic Motif Widget table.

The Motif Container Widgets are:
 

XmDrawingArea
XmRowColumn
XmPanedWindow
XmFrame
XmForm
XmBulletinBoard
XmMainWindow
XmScrolledWindow

The following application uses a form and a RowColumn widget to set the layout.

The Dialog Widgets

Motif offers a complete set of dialog. A dialog is a widget that support User interaction.

This may be a simple button (like a message to inform the user), a triple button like "OK, Cancel, Help" to request a user decision, or more complex dialog where the user.
 

BulletingBoardDialog
MessageDialog
SelectDialog
FormDialog
ErrorDialog
PromptDialog
WarningDialog
InformationDialog
FileSelectionDialog
QuestionDialog
WorkingDialog

We present here two common dialogs:
 

We now have Menu Widget:

Motif supports also Menus. Netscape is a classical example about Motif programming.  There are basically three menu types:
 
 

XmCreatePopupMenu XmCreatePulldownMenu XmCreateOptionMenu

We present here an example with menus and cascade menu (submenus).
 
 

Gadgets

Motif support also Gadgets. Gadget are no Widget, but a different graphical object. Gadget are nearly the same as widget, except that they have no windows of their own.
 

XmArrowButtonGadget
XmSeparatorGadget
XmPushButtonGadget
XmCascadeButtonGadget
XmLabelGadget
XmToggleButtonGadget

Gadget requerie less memory, than the widget and are used in some cases.

Graphically Gadget are widget are the same, declarations are different, as we can note from the previous table.
 

The "periodic" Table of the OSF

The Motif tape (actual) for free under the name OpenMotif, includes a program called "Periodic" where the most important are listed.

We present here two important generation of Motif 1.2 and 2.2. I work with Motif 1.0, in 1989, and with Motif 1.1 in 1991. Only in 1998 was released Motif 1.2. Then was 2.0, 2.1 and 2.2 in Feb 2002.

There are planned released of Motif 2.3 and 3.0 on MotifZone.org.

We note in these programs combobox, menus, pushbutton ... and in Motif 2.2 also the Notebook widget.
 

Periodic table for OSF/Motif 1.2
Periodic table for OSF/Motif 2.2

Click to enlarge

The OpenMotif Source Tree

Thanks to the OpenGroup Motif free release, under the name OpenMotif, everyone may take full advantage of Motif. Motif is a standard graphical library for UNIX systems. CDE instead is the standard Graphical User Interface (GUI), that complete the standardization.

The latest OpenMotif version is 2.2.1, offers the following release.

[root@ftosx1 openMotif-2.2.1]# ls -F
acinclude.m4  CLOSEDBUGS      config.sub*      Imakefile          libtool*     Makefile.imake-pure  RELEASE
aclocal.m4    config/         configure*       include/           LICENSE      Makefile.in          RELNOTES
bindings/     config.cache    configure.in     INSTALL.configure  localized/   missing*             themes/
bitmaps/      config.guess*   COPYRIGHT.MOTIF  INSTALL.imake      ltmain.sh    mkinstalldirs*       tools/
BUGREPORT     config.log      demos/           install-sh*        Makefile     OPENBUGS             xmthemes/
clients/      config.status*  doc/             lib/               Makefile.am  README
[root@ftosx1 openMotif-2.2.1]#

The Motif three moves from "make world" based on a "xmkmf" approach to a "configure" GNU approach.

Motif is excellent ... but it closed behaviour probably will sign Motif for ever. Is clear that efforts must be payed, and Motif is a great effort, incredible. New customers and programmers suppose that Motif is "another" window manager or another GUI. No, Motif is the standard development toolkit and CDE it GUI.

As we tell before, probably the years that Motif was closed, not public, delay the final release and development to choose a Graphical GUI. The Troll Qt was available under payment for MS Windows/UNIX, but  free for X 11 Development, if the developed source will continue to be free.

Request money for great software, is obvious, but sometimes may destroy completely the excellent effort. Actually the latest update on Motif Themes that was introduced with Qt

This is a clear example because OpenSource is probably the 'only' mode for software sucess. Another two components are clear: Innovation and Quality. Is also important to fix clear rules without to re-invent the wheel. NeXT is another of this examples of expensive software without results.

Motif 2.2.1, presents the following hierarchy:

[root@ftosx1 root]# cd openMotif-2.2.1/
[root@ftosx1 openMotif-2.2.1]# ls -F
acinclude.m4  BUGREPORT   config.cache    config.sub*      demos/     INSTALL.configure  libtool*    Makefile             missing*        RELEASE   xmthemes/
aclocal.m4    clients/    config.guess*   configure*       doc/       INSTALL.imake      LICENSE     Makefile.am          mkinstalldirs*  RELNOTES
bindings/     CLOSEDBUGS  config.log      configure.in     Imakefile  install-sh*        localized/  Makefile.imake-pure  OPENBUGS        themes/
bitmaps/      config/     config.status*  COPYRIGHT.MOTIF  include/   lib/               ltmain.sh   Makefile.in          README          tools/
[root@ftosx1 openMotif-2.2.1]#

Basically, Motif 2.2.1, is an updated version of the 2.1. The Motif version 2.1, was the major update in ten years.

Motif source tree includes three important components:






Motif supports also Themes, available originally in KDE, and then in GNOME. Here, in Motif the approach to develop themes, is using the Pixmap. However, the project actually is stopped at March 2001. Here we present the Acqua Motif theme on Periodic.

Motif does not support PNG format image format. This will be supported only on Motif 2.3 (please check: http://www.openmotif.org/openmotif/?cont=timeline). Next year First Quater (Q1) 2003, is planned the release of Motif 2.4 including a support for antialias. Motif 2.5, Q3 2003, is planned to support also C++ binding.

How to develop a Motif Application: A verbal Flowchart

Now, that we know what are the Motif components and in particular the container widgets, the dialog widgets, the display widgets and other, we get an idea about Motif and Motif development.

There are basically two methods for development. One is start a project from scratch and the second is modify or update a "similar" project to get the expected result.

Here we will introduce both methods.
 

Create a Motif from "scratch"

This method is a little more complex and is used by "expert" Motif programmers.

The first step is to setup the goal.

We will develop a program that create a Notebook, using the Motif Notebook widget.

We will write the Imakefile from the Makefile:

[root@ftosx1 scratch]# more Imakefile
SYS_LIBRARIES = -lXm -lXt -lSM -lICE -lX11

AllTarget(scratch)

NormalProgramTarget(scratch,scratch.o,,,)
[root@ftosx1 scratch]#

A motif source basically start with program description and includes files.

Therefore, on a primary analysis we will have:

[root@ftosx1 scratch]# more scratch.c

//
// Program:    A simple project to use the Notebook Widget
//
// Author:     Dr. Giovanni A. Orlando
// Data:       2002-05-14

#include <Xm/Xm.h>
#include <Xm/Notebook.h>

main (int argc, char **argv)
{

   Widget           toplevel, notebook;
   XtAppContext     app;

   toplevel = XtVaOpenApplication (&app, "scratch", NULL, 0, &argc, argv,
                                           NULL, sessionShellWidgetClass, NULL);

   // Now we create the Notebook
   notebook = XmCreateNotebook (toplevel, "notebook", NULL, 0);
 
 
 

   // The standard functions to release the program
   XtManageChild (notebook);
   XtRealizeWidget (toplevel);
   XtAppMainLoop (app);

}
[root@ftosx1 scratch]#

Compiling this code, we get the following result.

Now, we will add the pages, that will be displayed on the program:

In this program we will includes "fixed" data, however, the program may be updated to display for example the processes on the local network, the week appointment, etc.
 

#include <Xm/Xm.h>
#include <Xm/Notebook.h>
#include <Xm/RowColumn.h>
#include <Xm/Label.h>

/* Arbitrary data for the first "page" */
char *base_chapters[] =
{
           "Introduction",
           "",
           "B0 - What is Linux ?",
           "B1 - Installing FTOSX 2002",
           "B2 - The X-Window Universe",
           "B3 - The FTGUIX",
           "B4 - FTGUIX Development Guidelines",
           "B5 - Running GNOME on FTGUIX",
           "B6 - Runnung Motif on FTGUIX",
           "B7 - The Multi-User Philosophy",
           "B8 - Browsing FTOSX File System",
           "B9 - A Linux tutorial session",
           "B10 - DOS-Linux Integration",
           "B11 - The Local Network",
           "B12 - The World Wide Web",
           "B13 - The Linux Editors",
           "B14 - Filters and Shell Programming",
           "B15 - An Introduction to Linux Programming",
           "B16 - Printing on Linux",
           "B17 - Text Processing on Linux",
           "B18 - An Introduction to Graphics on Linux",
           "B19 - The Hardware Configuration on Linux",
           "B20 - Media",
           "B21 - The Linux Kernel",
           "B22 - Boot and Shutdown",
           "B23 - System Administration",
           "B24 - Integrating Linux with MSWindows and the MacOS",
           "B25 - Linux Security",
           "B26 - The Fax configuration under Linux",
           "B27 - Scanner under Linux",
           "B28 - Linux multimedia",
           "B29 - A tour on Linux DataBase ",
           "B30 - Scientific Applications on Linux",
           (char *) 0
};

/* Arbitrary data for the second "page" */
char *webmaster_chapters[] =
{
           "An historical introduction",
           "",
           "W1 - An Introduction to Internet: A dialogue between friends",
           "W2. The Internet connection",
           "W3. Using Netscape Communicator",
           "W4. An Internet session",
           "W5. HTML Editing",
           "W6. Images and Sound",
           "W7. Forms",
           "W8. Web Site Design",
           "W9. Using Styles Sheets",
           "W10. An Introduction to XML",
           "W11. CGI Programming",
           "W12. Java Applets in HTML pages",
           "W13. Programming with PERL",
           "W14. MySQL Programming",
           "W15. PHP Programming",
           "W16. Web Server Installation",
           "W17. Apache configuration",
           "W18. Settining up DNS",
           "W19. Configuring Sendmail",
           "W20. Internet security",
           "W21. WebSite Setup",
           "W22. E-commerce",
           (char *) 0
};

/* Arbitrary data for the third "page" */
char *x_chapters[] =
{
          "Introduction",
           "",
           "X1 - An Introduction to the X-Window System",
           "X2 - Customizing the X-Window System",
           "X3 - The resources of an X application",
           "X4 - The Common Desktop Enviroment: CDE",
           "X5 - The KDE",
           "X6 - GNOME",
           "X7 - An Introduction to X-Window Programming",
           "X8 - Developing applications with Xt Intrinsic using C",
           "X9 - Developing OSF/Motif applications in C and C++",
           "X10 - Developing applications for CDE",
           "X11 - Developing KDE applications with Qt",
           "X12 - KDE Rapid Application Development",
           "X13 - Using the Gtk Toolkit",
           "X14 - Developing applications with Tcl/Tk",
           "X15 - Graphical Scripts in Linux",
           "X16 - An Introduction to Java XWT",
           (char *) 0
};

/* Arbitrary data for the fourth "page" */
char *prog_chapters[] =
{
           "Introduction to Linux Programming",
           "",
           "P1 - So you want to program ?",
           "P2 - The C Language",
           "P3 - The function of the \"libc\" library",
           "P4 - Advanced C and programming techniques",
           "P5 - The debugging of C programs",
           "P6 - The C++ Language",
           "P7 - The \"make\" program",
           "P8 - Process management",
           "P9 - How to program the shared memory",
           "P10 - Network programming",
           "P11 - An overview on Python",
           "P12 - Built your RPM package",
           (char *) 0
};

/* Arbitrary data for the fifth "page" */
char *net_chapters[] =
{
         "Introduction",
           "",
           "N1 - An Introduction to System Integration",
           "N2 - The TCP/IP protocol between UNIX machines",
           "N3 - Integrating Linux with MS-Windows",
           "N4 - Using SAMBA to integrate Linux and MS-Windows systems",
           "N5 - Integrating Linux with Novell Netware",
           "N6 - Integrating Linux on AppleTalk",
           "N7 - AS/400 and Linux Integration",
           "N8 - The X-Terminal",
           "N9 - How to setup an Intranet",
           "N10 - An Introduction to CORBA",
           (char *) 0
};

/* Arbitrary data for the fifth "page" */
char *sysadm_chapters[] =
{
         "Introduction",
         "",
         "S1 - The System Administrator's Tasks",
         "S2 - Users and their Priorities",
         "S3 - Time services",
         "S4 - A course in Shell Programming",
         "S5 - An Introduction to the Expect language",
         "S6 - The boot service: \"init\" and rc files",
         "S7 - The Linux Kernel",
         "S8 - Compiling the Kernel",
         "S9 - The Development of Kernel Modules",
         "S10 - Create your Linux CD",
         (char *) 0
};

/* A pointer to all the "page" data */
char **courses[] =
{
           base_chapters,
           webmaster_chapters,
           x_chapters,
           prog_chapters,
           net_chapters,
           sysadm_chapters,
           (char **) 0
};

void main (int argc, char **argv)
{
           Widget           toplevel, notebook, page, label;
           XtAppContext     app;
           Arg              args[4];
           XmString         xms;
           int              i, j, n;

           XtSetLanguageProc (NULL, NULL, NULL);
           toplevel = XtVaOpenApplication (&app, "scratch", NULL, 0, &argc, argv,
                                           NULL, sessionShellWidgetClass, NULL);

           /* Create the Notebook */
           notebook = XmCreateNotebook (toplevel, "notebook", NULL, 0);

           /* Create the "pages" */
           for (i = 0; courses[i] != (char **) 0; i++) {
               page = XmCreateRowColumn (notebook, "page", NULL, 0);

               for (j = 0; courses[i][j] != (char *) 0; j++) {
                    xms = XmStringGenerate (courses[i][j], XmFONTLIST_DEFAULT_TAG,
                                       XmCHARSET_TEXT, NULL);

                    n = 0;
                    XtSetArg (args[n], XmNlabelString, xms); n++;
                    label = XmCreateLabel (page, "label", args, n);
                    XtManageChild (label);
                    XmStringFree (xms);
               }
               XtManageChild (page);
           }

           XtManageChild (notebook);
           XtRealizeWidget (toplevel);
           XtAppMainLoop (app);
}


 
 
Compiling this second complete release we get the following figure:


Here are displayed all the FTLinuxCourse Complete chapters.

The previous is a modified version from an example included in Notebook chapter in Volume 6A.

Adapting an existing project

Here instead we will get an existing project, where are used different set of fonts and modify it to use only one font.

The original source is the following:

[root@ftosx1 multi_font2]# more multi_font.c
/* multi_font.c -- create three compound strings using 12, 14 and 18
** point fonts. The user can specify resources so that each of the strings
** use different fonts by setting resources similar to that shown
** by the fallback resources.
*/

#include <Xm/Label.h>

String fallbacks[] =
{
        "*.renderTable: TAG1, TAG2, TAG3",
        "*.fontType: FONT_IS_FONT",
        "*TAG1.fontName: -*-courier-*-r-*--*-120-*",
        "*TAG2.fontName: -*-courier-bold-o-*--*-140-*",
        "*TAG3.fontName: -*-courier-medium-r-*--*-180-*",
        NULL
};

main (int argc, char *argv[])
{
        Widget       toplevel, label;
        XtAppContext app;
        XmString     s1, s2, s3, text, tmp;
        Arg          args[2];
        String string1 = "This is a string ",
               string2 = "that contains three ",
               string3 = "separate fonts.";

        XtSetLanguageProc (NULL, NULL, NULL);
        toplevel = XtVaOpenApplication (&app, "Demo", NULL, 0, &argc, argv, fallbacks,
                                        sessionShellWidgetClass, NULL);

        s1 = XmStringGenerate ((XtPointer) string1, NULL, XmCHARSET_TEXT, "TAG1");
        s2 = XmStringGenerate ((XtPointer) string2, NULL, XmCHARSET_TEXT, "TAG2");
        s3 = XmStringGenerate ((XtPointer) string3, NULL, XmCHARSET_TEXT, "TAG3");

        /* concatenate the 3 strings on top of each other, but we can only
        ** do two at a time. So do s1 and s2 onto tmp and then do s3.
        */
        tmp = XmStringConcatAndFree (s1, s2);
        text = XmStringConcatAndFree (tmp, s3);
        XtSetArg (args[0], XmNlabelString, text);
        label = XmCreateLabel (toplevel, "widget_name", args, 1);
        XtManageChild (label);

        XmStringFree (text);
        XtRealizeWidget (toplevel);
        XtAppMainLoop (app);
}
[root@ftosx1 multi_font2]#
 

Now, we want to remove the multiple fonts and use only one. In about three minutes we will have:

[root@ftosx1 multi_font2]# more multi_font2.c
/* multi_font.c -- create three compound strings using 12, 14 and 18
** point fonts. The user can specify resources so that each of the strings
** use different fonts by setting resources similar to that shown
** by the fallback resources.
*/

#include <Xm/Label.h>
#include <Xm/PushB.h>

String fallbacks[] =
{
        "*.renderTable: TAG1, TAG2, TAG3",
        "*.fontType: FONT_IS_FONT",
        "*TAG1.fontName: -*-helvetica-*-r-*--*-120-*",
        "*TAG2.fontName: -*-helvetica-bold-o-*--*-140-*",
        "*TAG3.fontName: -*-helvetica-bold-r-*--*-180-*",
        NULL
};

main (int argc, char *argv[])
{
        Widget       toplevel, button;
        XtAppContext app;
        XmString     s1, s2, s3, text, tmp;
        Arg          args[2];
        String string1 = "Next",
               string2 = "-",
               string3 = ">";

        XtSetLanguageProc (NULL, NULL, NULL);
        toplevel = XtVaOpenApplication (&app, "Demo", NULL, 0, &argc, argv, fallbacks,
                                        sessionShellWidgetClass, NULL);

        s1 = XmStringGenerate ((XtPointer) string1, NULL, XmCHARSET_TEXT, "TAG1");
        s2 = XmStringGenerate ((XtPointer) string2, NULL, XmCHARSET_TEXT, "TAG2");
        s3 = XmStringGenerate ((XtPointer) string3, NULL, XmCHARSET_TEXT, "TAG3");

        /* concatenate the 3 strings on top of each other, but we can only
        ** do two at a time. So do s1 and s2 onto tmp and then do s3.
        */
        tmp = XmStringConcatAndFree (s1, s2);
        text = XmStringConcatAndFree (tmp, s3);
        XtSetArg (args[0], XmNlabelString, text);
        //label = XmCreateLabel (toplevel, "widget_name", args, 1);
        button = XmCreatePushButton (toplevel, "button", args, 1);
        XtManageChild (button);

        XmStringFree (text);
        XtRealizeWidget (toplevel);
        XtAppMainLoop (app);
}

Note that we change the string2 and string3 and also use another sense in the tmp string construction.

We present here both sources:
 

In this case is a simplification. Changes or updates may be possible changing variable names, variable content, etc.
 

The UIL

Motif programming may be repetitive or also may become simple for large ammount of source. An first level of abstraction is possible using the OSF UIL. UIL stand for User Interface Language compiler, and "again" is a standard mode to develop a graphical interface using meta-languages.

Browsing the openmotif 2.2.1, we get:

[root@ftosx1 root]# cd openMotif-2.2.1/
[root@ftosx1 openMotif-2.2.1]# ls
acinclude.m4  CLOSEDBUGS     config.sub       Imakefile          libtool      Makefile.imake-pure  RELEASE
aclocal.m4    config         configure        include            LICENSE      Makefile.in          RELNOTES
bindings      config.cache   configure.in     INSTALL.configure  localized    missing              themes
bitmaps       config.guess   COPYRIGHT.MOTIF  INSTALL.imake      ltmain.sh    mkinstalldirs        tools
BUGREPORT     config.log     demos            install-sh         Makefile     OPENBUGS             xmthemes
clients       config.status  doc              lib                Makefile.am  README
[root@ftosx1 openMotif-2.2.1]# cd demos/
[root@ftosx1 demos]# ls
Imakefile  lib  Makefile  Makefile.am  Makefile.in  programs  unsupported
[root@ftosx1 demos]#

Going to periodic directory we will have:

[root@ftosx1 periodic]# ls -al
total 166
drwxrwxrwx    2 7560     200           344 May 14 21:18 .
drwxrwxrwx   35 7560     200          1040 Apr 19 10:16 ..
-rw-rw-r--    1 root     root         2167 Jan  4 23:24 Imakefile
-rw-r--r--    1 root     root        10138 Apr 19 10:16 Makefile
-rw-rw-r--    1 root     root          518 Jan 29 19:38 Makefile.am
-rw-rw-r--    1 root     root        10069 Jan 29 21:03 Makefile.in
-rw-rw-r--    1 root     root        23974 Jan  9 04:19 periodic.c
-rw-rw-r--    1 root     root        25619 Apr 19 11:14 periodic_l.uil
-rw-rw-r--    1 root     root        69427 Apr 19 11:02 periodic.uil
-rw-rw-r--    1 root     root          962 Jan  4 23:24 README
-rw-r--r--    1 root     root         3741 Apr 19 11:33 XmdPeriodic.ad
 

Compiling we get:
 

[root@ftosx1 periodic]# make
gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I./../../../lib -I/usr/X11R6/include     -g -O2 -Wall -Wno-unused -Wno-comment -c periodic.c
/bin/sh ../../../libtool --mode=link gcc  -g -O2 -Wall -Wno-unused -Wno-comment  -o periodic  periodic.o ../../../lib/Xm/libXm.la ../../../lib/Mrm/libMrm.la
mkdir .libs
gcc -g -O2 -Wall -Wno-unused -Wno-comment -o .libs/periodic periodic.o  ../../../lib/Xm/.libs/libXm.so -L/usr/X11R6/lib ../../../lib/Mrm/.libs/libMrm.so /root/openMotif-2.2.1/lib/Xm/.libs/libXm.so -lXmu -lXext -lXp -lXt -lSM -lICE -lX11 -Wl,--rpath -Wl,/usr/X11R6/lib
creating periodic
../../../clients/uil/uil -o periodic.uid periodic.uil -I./../../../clients/uil -I../../../clients/uil
[root@ftosx1 periodic]#

Therefore, is created a shared library, and then used in combination of the UIL source to create the binary.

The UIL manual explain these matter. In fact, running the command:

[root@ftosx1 root]# man uil

we get:

uil(user cmd)                                       uil(user cmd)

NAME
       uil -- The user interface language compiler

SYNOPSIS
       uil [options ]  [file]

DESCRIPTION
       The  uil  command  invokes the UIL compiler. The User Interface Language (UIL) is a specification
       language for describing the initial state of a user interface for a Motif application. The speci­
       fication describes the objects (menus, dialog boxes, labels, push buttons, and so on) used in the
       interface and specifies the routines to be called when the interface changes state as a result of
       user interaction.

       file      Specifies the file to be compiled through the UIL compiler.

       options   Specifies one or more of the following options:

                 -Ipathname
                           This  option  causes  the compiler to look for include files in the directory
                           specified if the include files have not been found in the paths that  already
                           were searched.  Specify this option followed by a pathname, with no interven­
                           ing spaces.

                 -m        Machine code is listed. This directs the compiler to  place  in  the  listing
                           file  a  description  of  the  records  that  it  added to the User Interface
                           Database (UID). This helps you isolate errors.  The  default  is  no  machine
                           code.

                 -o file

                           Directs  the  compiler  to produce a UID.  By default, UIL creates a UID with
                           the name a.uid.  The file specifies the filename for the UID.  No UID is pro­
                           duced  if the compiler issues any diagnostics categorized as error or severe.
                           UIDs are portable only across same-size machine architectures.

                 -s        Directs the compiler to set the  locale  before  compiling  any  files.   The
                           locale  is  set  in an implementation-dependent manner.  On ANSI C-based sys­
                           tems, the locale is usually set by calling setlocale(LC_ALL,  "").   If  this
                           option is not specified, the compiler does not set the locale.

                 -v file   Directs  the compiler to generate a listing.  The file specifies the filename
                           for the listing.  If the -v option is not present, no listing is generated by
                           the compiler.  The default is no listing.

                 -w        Specifies  that the compiler suppress all warning and informational messages.
                           If this option is not present, all messages are generated, regardless of  the
                           severity.

                 -wmd file Specifies  a binary widget meta-language description file to be used in place
                           of the default WML description.

RELATED INFORMATION
       X(1) and Uil(3).

                                                    uil(user cmd)
(END)
 

UIL is the right choice for large volumes of source. OSF includes a specific manual for this purpose. If you are evaluating the right choice for X Window Development, please read the Conclusion at the end of the course.
 

A short Story of Motif Builders


The author start to work with UNIX as a Motif and X Windows programmer, in 1989. In those days a builder, specially for a company that needs to develop grafical interface motif based, were fundamental.

Can you imagine ten programmers working everyday to develop masks ... manually ?

The MS-Windows equivalent, was called "dialog" that generate a ".rc" (resouce file) to create the masks and the exe. Under the UNIX side, first builders start to cost US$ 5,000.

Also, actually we have builders used on Motif, that generate Motif code.
 

The ICS BX Pro

ICS or Integrated Computer Solution Incorporated offers, probably the better builder available. Also the OpenGroup includes this builder in demo version, where we present here some screenshoots.
 
 

Note how the container are visible and available in a clear form. Using Drag-and-drop techniques is possible to create applications in a fly. The same is valid for other widgets

The CDE dtbuilder

Xi Graphics continue to offer the CDE builder, inside it DeXtop GUI. We will cover the Xi Graphics CDE for Linux (not available anymore), in the next chapter.

The MotifTool: Xmt

The X Builders solve all problems. However there are available also other methods.

One of this methods regards another mode, similar (and probably more easy than UIL).  This method is called "Xmt".

Originally Xmt was supported O'Reilly in a book called "Motif Tools". This book is actually Out-of-Print (OOP). However, there are new releases available from: http://www.motiftools.org/

We cover here the version Xmt 4.00

After download the version we will have:

[root@ftosx1 xmt400]# pwd
/root/xmt400
[root@ftosx1 xmt400]# ls -F
AUTHOR           clients/   DEVELOPMENT-TEAM  Imakefile     LICENSE   NEW-FILE-TEMPLATE  PLATFORMS            README         tests/   Xmt/
CHANGE-LOG       contrib/   examples/         INSTALLATION  Makefile  NO_WARRANTY        PROBLEM-REPORT-FORM  README.210     THANKS   Xmt.tmpl
CHANGES-HISTORY  COPYRIGHT  FAQ               KNOWNBUGS     man/      OVERVIEW           QUICK-START-ME       RELEASE-NOTES  VERSION
[root@ftosx1 xmt400]#

After the classical commands, we will get great results with few efforts:

[root@ftosx1 xmt400]# xmkmf
[root@ftosx1 xmt400]# make Makefiles
[root@ftosx1 xmt400]# make
[root@ftosx1 xmt400]# make install

After the installation procedure we may run the test (there are also examples), and get the following result:

[root@ftosx1 ProgressWidget]# mockup progress1
 
 

The Official Motif Documentation

OSF (the Open Software Foundation) release together with Motif a complete set of source. The manuals was available also on Prentice-Hall .

These manuals are also included The Single UNIX Specification - v3 - Jan 2002 and are the following:

We have:


Exercises

  1. Write three examples using Motif.
  2. Please read the book and check the source in the following order:


Test

  1. How may be classified the Motif widget set ?
  2. What is a Gadget ?
  3. What is a dialog ?
  4. What is the Periodic Table of Widget ?
  5. Comparing Periodic for Motif 1.2 and 2.2, and list all the widgets displayed as well new widgets.
  6. How is developed this program (Periodic) ?
  7. What is the better language to develop Motif applications ?
  8. What is UIL ?
  9. What program is necessary to launch to "compile" UIL code ?
  10. What is the latest Motif version ?
  11. List three "standard" programs that are included in the OpenMotif tarball ?
  12. Is Motif for free ?
  13. List the Motif Manuals.
  14. List three Motif Builders.
  15. What is Xmt ? What is possible to do with it ?
  16. Is possible to develop "script" based Motif programs ?
  17. Would Motif support Drag-and-drop  ?
  18. Are PNG image format supported by Motif ?
  19. Is planned an OpenMotif 2.4 release ?
  20. List ten Motif widgets and three widgets in the latest Motif generations after 2.1.

  21.  
Consult the answers

Check the Interactive Exam Cram X Window: Try the interactive cram ...

Internet Resources for this Chapter.