📄 455-457.html
字号:
<HTML>
<HEAD>
<TITLE>Linux Configuration and Installation:Programming in Linux</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=1558285660//-->
<!--TITLE=Linux Configuration and Installation//-->
<!--AUTHOR=Patrick Volkerding//-->
<!--AUTHOR=Kevin Reichard//-->
<!--AUTHOR=Eric Foster//-->
<!--PUBLISHER=IDG Books Worldwide, Inc.//-->
<!--IMPRINT=M & T Books//-->
<!--CHAPTER=10//-->
<!--PAGES=455-457//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="452-455.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="457-460.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading11"></A><FONT COLOR="#000077">XForms</FONT></H4>
<P>XForms is a C library designed to dramatically simplify the creation of X programs. The basic task in XForms is creating <I>forms</I>, 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.</P>
<P>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 Motif’s 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.</P>
<P>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.</P>
<P>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.</P>
<P>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.</P>
<P>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 don’t interact the same as menus in most toolkits, and they take some getting used to.</P>
<P>On the plus side, XForms supports a number of text styles and fonts, which is great for those who don’t 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.</P>
<P>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.</P>
<P>We’ve included XForms in a binary version on the second CD-ROM. XForms is a copyrighted product that is freely available for <I>noncommercial use only</I>. For commercial use, you need to contact the XForms authors at <I>xforms@world.std.com</I>. We cannot stress enough the importance of following this guideline.</P>
<P>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: <A HREF="bloch.phys.uwm.edu">bloch.phys.uwm.edu</A> in the <B>pub/xforms</B> directory, <A HREF="ftp.cs.ruu.nl">ftp.cs.ruu.nl</A> in the <B>pub/XFORMS</B> directory, and <A HREF="imageek.york.cuny.edu">imageek.york.cuny.edu</A> in the <B>xforms</B> directory. On the Web, see <A HREF="http://bragg.phys.uwm.edu/xforms">http://bragg.phys.uwm.edu/xforms</A>.</P>
<H3><A NAME="Heading12"></A><FONT COLOR="#000077">Programmer’s Tools</FONT></H3>
<P>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 <B>make</B>.</P>
<H4 ALIGN="LEFT"><A NAME="Heading13"></A><FONT COLOR="#000077">Building Programs with Make</FONT></H4>
<P>Most C programs require more than one <I>.c</I> 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 don’t want to recompile all the files if just one changed. Furthermore, these lazy programmers don’t want to have to keep track of all the files that changed. This is where the tool called <B>make</B> comes in.</P>
<P><B>Make</B> is a command that helps build or “make” UNIX programs from the C language source code files. <B>make</B> uses a set of rules, stored in a file called <B>Makefile</B>, to tell it the most efficient way to rebuild a program. You keep a <B>Makefile</B> in each directory where you develop C programs.</P>
<P>The <B>Makefile</B> 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, <B>make</B> determines what has changed (based on the file modified date) and what other things depend on the file or files that changed. Then <B>make</B> executes the commands in the <B>Makefile</B> to build each thing that needs to be rebuilt.</P>
<P>The basic <B>Makefile</B> syntax is deceptively simple. (Linux includes the GNU <B>make</B> program, which accepts a number of rule shortcuts. For this chapter, we’ll just cover the basics. Use the <B>man make</B> command to find out more about <B>make</B>.)</P>
<P>You start out with a so-called target. The target is something you want to build, such as our program <B>chap10</B> from the earlier example.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="452-455.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="457-460.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -