-->
Previous | Table of Contents | Next |
XForms is a C library designed to dramatically simplify the creation of X programs. The basic task in XForms is creating forms, XForms terminology for panels, windows, or dialogs. A form is really a top-level window containing a number of widgets. By simplifying the options and coming up with a good set of default values, XForms reduces much of the complexity in creating X applications. You do pay a price in reduced flexibility, but for many application needs, XForms will be the right fit.
One of the areas of reduced freedom and complexity is widget layout. All widgets are placed in an exact position, be it in pixels, millimeters, or points (1/72 of an inch). Other widget sets, like Motif, provide an extensive set of widgets that control the layout of other widgets. Of course, widget layout is one of Motifs most troublesome aspects for developers new to the library. XForms, on the other hand, eliminates most of these options and confusion by placing widgets directly.
XForms allows you to populate your forms with widgets such as buttons, sliders, and text-entry fields. Some of the more innovative widgets include dials, clocks, and X-Y data plots. The X-Y data plots will appeal to those in the academic community who want to display data graphically.
Should the XForms base widget set be too confining for your needs, you can create free objects, something like the Motif drawing area widget, where your application gets a blank canvas to draw in and callbacks to handle all events. This allows a way to extend the base widget set. XForms includes an extensive API for adding new widgets.
The look and feel of XForms applications varies. You can create a variety of push-button styles, including beveled push-buttons and rounded-corner buttons, so your interface can look like Motif, Open Look, or just about anything else.
A lot of the look seems to come from older Silicon Graphics applications. Many of the widgets support neat border styles, but the menus look strange. It took us a long time to get used to the menus in XForms; they dont interact the same as menus in most toolkits, and they take some getting used to.
On the plus side, XForms supports a number of text styles and fonts, which is great for those who dont know much about the long X font names. With smart use of the font styles, your XForms programs will look much better than most Motif programs, with much less coding.
Coding is one area where XForms excels. You can generally create a working application in a very short amount of time, with very little code.
Weve included XForms in a binary version on the second CD-ROM. XForms is a copyrighted product that is freely available for noncommercial use only. For commercial use, you need to contact the XForms authors at [email protected]. We cannot stress enough the importance of following this guideline.
To acquire XForms via the Internet (there may be an updated version by the time you read this), you can FTP to one of the following sites: bloch.phys.uwm.edu in the pub/xforms directory, ftp.cs.ruu.nl in the pub/XFORMS directory, and imageek.york.cuny.edu in the xforms directory. On the Web, see http://bragg.phys.uwm.edu/xforms.
In addition to the basic compiler, Linux comes with many utility programs and tools to make programming easier. The first and foremost tool is a program called make.
Most C programs require more than one .c file of source code. When one of these files changes, at least one (and maybe more) of the files must get recompiled to have the executable program reflect the changes. Tending to be lazy, programmers dont want to recompile all the files if just one changed. Furthermore, these lazy programmers dont want to have to keep track of all the files that changed. This is where the tool called make comes in.
Make is a command that helps build or make UNIX programs from the C language source code files. make uses a set of rules, stored in a file called Makefile, to tell it the most efficient way to rebuild a program. You keep a Makefile in each directory where you develop C programs.
The Makefile contains a set of rules, using a rigid syntax, that describe how to build the program. Most of the rules declare which parts of the program depend on other parts. Using these dependency rules, make determines what has changed (based on the file modified date) and what other things depend on the file or files that changed. Then make executes the commands in the Makefile to build each thing that needs to be rebuilt.
The basic Makefile syntax is deceptively simple. (Linux includes the GNU make program, which accepts a number of rule shortcuts. For this chapter, well just cover the basics. Use the man make command to find out more about make.)
You start out with a so-called target. The target is something you want to build, such as our program chap10 from the earlier example.
Previous | Table of Contents | Next |