-->
Previous Table of Contents Next


Installing FlagShip

Most people obtain FlagShip from a CD-ROM collection, a Web site, or an FTP archive. In most cases, there are two versions of FlagShip 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 fsdemo.tar (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 aout (for a.out) 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.

Once you have the fsdemo.tar file on your Linux system in a suitable (preferably new and empty other than the fsdemo file) directory, you need to unpack the tar file with the command:


tar xvf fsdemo.tar

This creates a number of files, two of which are usually called FSinstall.set and FSinstall. The FSinstall.set file sets environment variables for the installation routine and should be run first by simply typing its name at the command line. You won’t see anything when you do this. After running the .set file, type the FSinstall filename and let it install FlagShip for you.

If the installation process loads properly, you are asked if there is enough room on your filesystem, as shown in Figure 62.1.


Figure 62.1.  The FlagShip installation routine checks that you have enough room on your hard drive.

You are then asked where you want the FlagShip program to be stored, and in most cases you should accept the default values suggested by the installation routine. If you want to change the defaults, a menu prompt lets you, and then enter the new values, as shown in Figure 62.2. Once the installation routine has finished, you are returned to the shell prompt. FlagShip is now ready to be used.


Figure 62.2.  You can override the default FlagShip installation settings if you want.

Using FlagShip

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 using FlagShip is otherwise 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.

Once you have your .prg source files ready to go, you can invoke the FlagShip compiler. In general, the command line is like this…


FlagShip app_name.prg -ocompiled_name -Mstart

…where app_name.prg is the name of the main program file (that calls all the others) and compiler_name is the name of the compiled executable (C defaults to a.out 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.

Once compiled, the application runs as though it were on DOS or any other operating system. For example, Figure 62.3 shows a DOS application that has been ported to Linux and recompiled with FlagShip, and 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.


Figure 62.3.  A FlagShip-compiled application runs under Linux just as it would under DOS.

Porting Existing Applications

What do you have to worry about if you have some existing dBASE or Clipper code that you want to run under Linux? To start with, you need the .prg (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 may seem trivial but isn’t. Since 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.

There are complete instructions on modifying code to run cleanly under FlagShip included with the software (or available through the FlagShip Web page), but essentially most application can run straight away.

FlagShip converts dBASE code into C source code and then compiles it with a C compiler. That means you will 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 end of this book). The procedure FlagShip goes through to run an application is straightforward:

1.  Preprocess the code to make sure there are no syntax errors or other common errors. If there are errors, issue error messages and terminate the compilation.
2.  Convert to C code.
3.  Compile with the system’s C compiler to produce an object file.
4.  Link the object file with FlagShip’s libraries and produce an executable.

The executable thus produced can be run at the Linux command line prompt.

A quick word for dBASE and Clipper veterans: you needn’t bother with overlays because UNIX has no need for them. Linux uses the virtual memory on your system to enable 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.


Previous Table of Contents Next