📄 ch66.htm
字号:
on disk. This makes it easy to incorporate programming examples in the manual into
whatever program you are working on. Of course, you could also use the mouse to copy
text from fsman into your program by cutting and pasting between windows.</P>
<P>FlagShip isn't just a port of a DOS-based compiler. It has been designed to provide
full functionality under UNIX. Source code runs faster under Linux than under DOS
(compiler with Clipper, for example) because of the better operating system design
of Linux. FlagShip also removes many of the limitations of DOS- and Windows-based
xBase applications.</P>
<P>If you have any requirement to port dBASE or Clipper applications to Linux, or
if you are looking for a simple relational database system, FlagShip is an excellent
choice.
<H3 ALIGN="CENTER"><A NAME="Heading7<FONT COLOR="#000077">Installing FlagShip</FONT></H3>
<P>Most people obtain FlagShip from a CD-ROM collection, a Web site, or an FTP archive.
In most cases, two versions of FlagShip will be available, and the choice of the
correct one for your system depends on the version of Linux you are running. Typically,
the files are contained in a tar archive called <TT>fsdemo.tar</TT> (if you are obtaining
the restricted demo version). One version is optimized for more recent releases of
Linux and uses ELF. An older version, usually designated with the name <TT>aout</TT>
(for <TT>a.out</TT>) at the end of the filename, works on any Linux system. The ELF
version is much more flexible and powerful, but in most cases the demo files are
the older version.</P>
<P>After you have the <TT>fsdemo.tar</TT> file on your Linux system in a suitable
(preferably new and empty other than the <TT>fsdemo</TT> file) directory, you need
to unpack the tar file with this command:</P>
<PRE><FONT COLOR="#0066FF">tar xvf fsdemo.tar
</FONT></PRE>
<P>This command creates several files, two of which are usually called <TT>FSinstall.set</TT>
and <TT>FSinstall</TT>. The <TT>FSinstall.set</TT> file sets environment variables
for the installation routine. You should run it first by typing its name at the command
line. You won't see anything when you do this. After running the <TT>.set</TT> file,
type the <TT>FSinstall</TT> filename and let it install FlagShip for you.</P>
<P>If the installation process loads properly, you will probably be asked whether
there is enough room on your file system, as shown in Figure 66.1.
<H6></H6>
<P><A NAME="Heading8<A HREF="../art/66/66lnx01.jpg"><FONT COLOR="#000077">FIGURE
66.1.</FONT></A><FONT COLOR="#000077"> </FONT><I>The FlagShip installation routine
checks whether you have enough room on your hard drive. </I><BR>
<BR>
You are asked where you want to FlagShip program to be stored, and you should in
most cases accept the default values suggested by the installation routine. If you
want to change the defaults, a menu prompt lets you do so and then enter the new
values, as shown in Figure 66.2. After the installation routine has finished, you
are returned to the shell prompt. FlagShip is now ready to be used.<BR>
<BR>
<A NAME="Heading9<A HREF="../art/66/66lnx02.jpg"><FONT COLOR="#000077">FIGURE
66.2.</FONT></A><FONT COLOR="#000077"> </FONT><I>You can override the default FlagShip
installation settings if you want to.</I>
<H3 ALIGN="CENTER"><A NAME="Heading10<FONT COLOR="#000077">Using FlagShip</FONT></H3>
<P>If you have used Clipper or one of the other xBase compilers, you will know most
of the commands you need for FlagShip. A few modifications have been made because
of the UNIX environment, but otherwise, using FlagShip is pretty simple. Keep in
mind that FlagShip is not an interactive development product: it doesn't help you
design your code. FlagShip is a compiler. You can use it to develop applications
if you are familiar with the dBASE language, but FlagShip is not designed to teach
you dBASE, or to help you develop applications.</P>
<P>After you have your <TT>.prg</TT> source files ready to go, you can invoke the
FlagShip compiler. In general, the command line looks like</P>
<PRE><FONT COLOR="#0066FF">FlagShip app_name.prg -ocompiled_name -Mstart
</FONT></PRE>
<P>where app_name.prg is the name of the main program file (which calls all the others)
and compiled_name is the name of the compiled executable (C defaults to <TT>a.out</TT>
as the compiled executable name). If your main program file doesn't call all the
other program files that need to be linked together, you will have to compile them
separately and link them together.</P>
<P>When compiled, the application runs as though it were on DOS or any other operating
system. For example, Figure 66.3 shows a DOS application that has been ported to
Linux and recompiled with FlagShip, then executed. The only changes necessary to
the source code were changes in path names from DOS's structure to Linux's. As you
can see, even the fundamental ASCII graphics are retained and can be used on any
terminal supported by Linux.
<H6></H6>
<P><A NAME="Heading11<A HREF="../art/66/66lnx03.jpg"><FONT COLOR="#000077">FIGURE
66.3.</FONT></A><FONT COLOR="#000077"> </FONT><I>A FlagShip-compiled application
runs under Linux just as it would under DOS.</I>
<H3 ALIGN="CENTER"><A NAME="Heading12<FONT COLOR="#000077">Porting Existing
Applications</FONT></H3>
<P>What do you have to worry about if you have some existing dBASE or Clipper code
you want to run under Linux? To start with, you need the <TT>.prg</TT> (program)
source code. Move those files to Linux using any means you want, such as a network
connection or floppy disk. FlagShip is clever enough to ignore case, which might
seem trivial but isn't. Because most DOS programmers write in mixed case, converting
applications to run under UNIX's case-significant environment is a major problem
with other dBASE tools.</P>
<P>Complete instructions on modifying code to run cleanly under FlagShip are included
with the software (or available through the FlagShip Web page), but essentially,
most applications can run straightaway.</P>
<P>FlagShip converts dBASE code into C source code and then compiles it with a C
compiler. That means you need a C compiler, which luckily is part of almost every
UNIX and Linux system available. If you want to use FlagShip and haven't installed
the C development system from the CD-ROM, you should do so; otherwise, you will see
error messages from FlagShip. You don't need C++, only the standard C compilers that
are on the CD-ROM (including the one at the back of this book). The procedure FlagShip
goes through to run an application is straightforward:
<DL>
<DD><B>1.</B> Preprocesses the code to ensure that no syntax errors or other common
errors are present. If there are errors, it issues error messages and terminates
the compilation.<BR>
<B><BR>
2.</B> Converts to C code.<BR>
<B><BR>
3.</B> Compiles with the system's C compiler to produce an object file.<BR>
<B><BR>
4.</B> Links the object file with FlagShip's libraries and produces an executable.
</DL>
<P>The executable thus produced can be run at the Linux command-line prompt.</P>
<P>A quick word for dBASE and Clipper veterans: You needn't bother with overlays,
because UNIX has no need of them. Linux uses the virtual memory on your system to
allow you to load any size application (although there are limits, they can be changed).
Therefore, don't bother with overlays as you would with Clipper or other xBase compilers,
and instead link your code into a single, large executable. Let Linux worry about
loading it.
<H3 ALIGN="CENTER"><A NAME="Heading13<FONT COLOR="#000077">dbMan</FONT></H3>
<P>The dbMan program is an interpreter. When you start dbMan, you get a <TT>CMD:</TT>
prompt. This is where you enter all your commands to dbMan. You can think of this
as a <TT>.</TT> prompt in dBASE. For starters, you can type <TT>ASSIST</TT> at the
<TT>CMD:</TT> prompt. <TT>ASSIST</TT> starts a menu-driven interface similar to those
available with FoxPro or dBASE.</P>
<P>The menu-driven interface is not very elaborate. <TT>ASSIST</TT> enables only
one file to be open at a time. This means that it is not possible to set up relations.
It is possible to start a simple program generator from <TT>ASSIST</TT>. Again, it
has a single-file limitation.</P>
<P>You can compile programs in dbMan. Compiling a program does not produce an executable
binary. It produces a <TT>.run</TT> file, which still requires dbMan to execute it.
It is also possible to enter <TT>CREATE REPORT</TT> or <TT>MODIFY REPORT</TT> at
the <TT>CMD:</TT> prompt. This puts you in dbMan's report writer. The report writer
enables display of data by using the relational operators. dbMan provides a function
called <TT>PMENU()</TT> to create pull-down menus. <TT>PMENU</TT> doesn't have any
mechanism for temporarily disabling a menu choice.</P>
<P>dbMan handles windows differently from other xBase products. Before defining a
window, you call <TT>PUSHWIND()</TT> to push the current window onto a stack. When
a program is in its initial state, the entire screen is considered to be a window.
You then call <TT>WINDOW()</TT> to create the window. When you are finished with
it, you call <TT>POPWIND()</TT>, which removes the window and makes the previous
window active.</P>
<P>dbMan enables you to define only one hot key. You do so by invoking the <TT>ONKEY()</TT>
function. This has no effect until you execute the <TT>ON KEY</TT> statement. The
statement normally is <TT>DO </TT>hot-key-handler.</P>
<P>The <TT>BROWSE</TT> command has a long list of options. You can browse only specified
fields, and you can specify the width of each field and whether it is editable. The
list of fields can include fields in other files, which is great if you have relationships
set up.</P>
<P>dbMan does not use either <TT>termcap</TT> or <TT>terminfo</TT>. Instead, it includes
a file named <TT>dbmterm.dbm</TT>. This file looks similar to <TT>termcap</TT>. There
are no entries for either xterm or console. You have to create your own entries using
the existing entries.</P>
<P>dbMan has no facility for executing functions written in C or assembler, so you
have to use what they offer. A couple of nasty bugs were in the version of dbMan
I evaluated, which was version 5.32. The main bug I found was that procedure files
simply didn't work if the procedure file was a <TT>.prg</TT>. When I compiled the
procedure file into a <TT>.run</TT> file, it worked OK.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading14<FONT COLOR="#000077"><B>NOTE:</B> </FONT>You can get dbMan
from the following source: VERSASOFT Corp. 4340 Alamaden Expressway, #110 San Jose,
CA 95118 (408) 268-8396
<HR>
</DL>
<H3 ALIGN="CENTER"><A NAME="Heading15<FONT COLOR="#000077">LINCKS</FONT></H3>
<P>LINCKS is an object-oriented database management system. LINCKS is a good system
if you intend to use it on a network and share data via RPC calls. You need to have
some experience with networks, as well as an existing network, to fully benefit from
this package. This package is not for a single-node system just because it would
be overkill for such a platform.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading16<FONT COLOR="#000077"><B>NOTE:</B> </FONT>You can get LINCKS
from <TT>sunsite.unc.edu</TT> in the <TT>/pub/linux/apps/database/lincks</TT> directory.
<HR>
</DL>
<P>LINCKS is based on an append-only object-oriented structure. Objects are derived
from other objects. Links can be set between objects to define relationships. You
define views to an object. A view is used to specify how the data in the object is
presented to a user. Multiple views can exist for the same object. Views can be inherited.</P>
<P>The main interface is the xlincks program. Using commands similar to those in
emacs, you can interactively browse through databases. The interface resembles the
hypertext functions of a Web page. You click on a highlighted item, and the program
leads to a page with more information about the topic.</P>
<P>Help is available in two forms: context sensitive or as a browsable database.
The help file is always a button away--to access help, simply press the Help button.
The contents of the help file are well organized and are a good starting place to
learn about LINCKS. The manual is also available in PostScript for the sunsite archives.</P>
<P>LINCKS comes with a few programs in its distribution package. You can create new
databases using the <TT>dbroot</TT> command. To prune databases of unreferenced objects,
use the <TT>cutoff</TT> command. The main server for the application is the netserv
program, which fires off a dbs process for each connected client.
<H3 ALIGN="CENTER"><A NAME="Heading17<FONT COLOR="#000077">Other Database Products</FONT></H3>
<P>Of course, the xBase tools we've looked at are not the only databases available
for Linux. Many non-dBASE-compatible tools are out there. Following is a quick overview
of some other database management systems for Linux. Most of these are free and can
be found on the Internet. mbase v5.0 is a relational database system originally written
for the Amiga and ported to other platforms. It uses a language format similar to
C to do the database programming. To compile using mbase, you need ncurses and time.
There are several problems with the makefile that might require manual editing on
your part. If you really want cheap, C-like access to a DBMS, you can use this package.
Otherwise, get FlagShip or dbMan because they are more stable and mature.</P>
<P>onyx is a database prototype program based on a language format like C. The <TT>make
config</TT> command starts the process, and a series of questions pops up. Answering
all these questions results in configuring the database properly for Linux.</P>
<P>DBF is an xBase manipulation package and is a collection of utility programs that
manipulate <TT>.dbf</TT> files. Some of the utilities, such as dbfadd, add a record
or layer of information in the database. dbflist lists the records in the database,
and dbft lists the structure of each database and its items.
<BLOCKQUOTE>
<P>typhoon is yet another RDBMS. The most notable feature of this RDBMS (depending
on your point of view) is that it's entirely like C. The problem is that the product
still has to mature before being considered a viable RDBMS.
</BLOCKQUOTE>
<H3 ALIGN="CENTER"><A NAME="Heading18<FONT COLOR="#000077">Summary</FONT></H3>
<P>FlagShip and dbMan are excellent means of porting existing dBASE and dBASE-compatible
programs to Linux, where they run without modification in most cases, and a lot faster
in almost all cases. A version of FlagShip is being developed for X to run under
XFree86 or other Linux-based X versions, and that should be available in 1997. For
now, though, the demo version of FlagShip lets xBase developers continue to work
with their database system under Linux. The commercial product, with its hefty documentation,
is $199 and well worth it for developers. dbMan is a logical alternative for those
who don't need FlagShip's compiler features and extended capabilities.
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -