Contents of the SWAPPER.TXT file
(C) Copyright 1988 GWBeckwith. All rights reserved.
26 Selfridge Rd, Bedford, MA 01730
SWAPPER frees memory for programs
executed with the dBase 'RUN' command
SWAPPER and SWAP2 are user supported products. They are not public domain,
and they are not free software. You are granted a limited license to use
these products on a trial basis. If you wish to continue using these
products after you have evaluated them, you must register by sending: $10
for registration (no disk) or $20 for registration and the latest version
SWAPPER is a memory management utility that allows any program, regardless
of size, to be 'RUN' inside any dBase application. It is compatible with
both the dBase III+ interpreter and the Clipper compiler.
When SWAPPER is activated, it will unload a dBase application program,
execute ANY other program as if it were a subroutine call, and then return
to the original dBase program and execute the very next instruction.
SWAPPER frees up memory so that the programs executed with the dBase 'RUN'
command can use all of your available memory.
The dBase 'RUN' command provides a convient way to execute another program
from within a dBase program, much like a subroutine call. As long as you
have enough memory to load the interpreter and the extra program
simultaneously everything works fine. Dbase III+ will run in 256k, and
lots of word processors will also run in 256k. So if you've got 640k of
memory and want to call your word processor from a dBase application,
you're all set. But what happens when you want to call a program that
needs more than 256k, or when you compile the same application with
Clipper? Does the phrase: "Unable to load WORD: insufficient memory"
SWAPPER was designed specifically to solve the "insufficient memory"
problems we encountered when our word processor wouldn't work after we
compiled our dBase applications. As it turns out, SWAPPER works equally
well with the dBase III+ interpreter, and it doesn't care what kind of
program is run. It will even run memory hungry Windows applications like
Excel from within a compiled dBase application!
SWAPPER works in conjunction with another program called SWAP2. You start
your database application by using SWAPPER, and insert "SWAP2" into your
dBase RUN statement. For example, to start a dBase III+ program, at the
DOS prompt you would type in: "SWAPPER DBASE PROGRAM".
In your dBase source code file PROGRAM.PRG you code "RUN SWAP2 WORD"
instead of "RUN WORD".
That's all you have to do. SWAPPER will find the application program you
specified and execute it. Any command line parameters you type in after
the application program name will be passed along to the program.
When your program executes the 'RUN' statement, SWAP2 runs and almost
immediately transfers control back to SWAPPER. SWAPPER unloads the entire
dBase application by saving all of the memory it was using in a temporary
file on disk. SWAPPER then finds the second program and executes it. By
completely unloading the original dBase program, SWAPPER gives the second
program all of your available memory to run in!
When the second program terminates, SWAPPER gets control back again. It
restores the first program from the disk file, and restarts it exactly
where it left off.
The syntax of the SWAPPER command line is as follows:
swapper [/C][d:][directory] [/F=swapfile] filename [arguments]
"Filename" is the file specification for your initial database application
program. It can be a full DOS file name including drive and/or path
specifications. If a file name with path is specified, SWAPPER searches
for the file only in the specified directory. If a drive and file name are
specified without a path, SWAPPER will search only the logged directory on
the specified drive. If just a filename is specified, SWAPPER will search
the present directory on the currently logged drive and then search all
directories listed in the DOS PATH environment variable.
The "arguments" are the command line parameters needed by your application
program. They are passed along to your program just as they are.
Including the switch /C will cause SWAPPER to change to whatever directory
the executable file is in before starting the program.
The switch /F=swapfile allows you to specify the filename that SWAPPER will
use to save the memory image of the first application program. If you
include a drive specification in the file name, this option allows you to
use a RAM disk as the storage media for SWAPPER's temporary file.
If you intend to use a RAM disk to hold the swap file, remember that the
RAM disk has to have enough free space to hold a copy of the memory image
used by your application program. The amount of storage space required
will vary for different applications; for some of the compiled dBase
applications we have developed, 300k to 400k bytes of disk space are
required for the swap file. We strongly suggest that if you plan to use
this option, your RAM disk should use expanded or extended memory.
The syntax for SWAP2 is shown below. Note that SWAP2 must be executed
using the dBase 'RUN' command.
RUN swap2 [/C][d:][directory] filename [arguments]
The syntax of SWAP2 is nearly identical to the syntax of SWAPPER. The same
rules for locating the second program file to execute are applied by SWAP2.
The /C switch will cause SWAPPER to set the default directory to the
directory containing the second program file before it is executed. This
option is useful for swapping to programs like Wordstar that have to be
started in the directory where the program files are located.