Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>the swap package</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
The Swap package

   The Swap package  allows programs that use the spawn() or system()
   functions to temporarily remove themselves from memory so that the
   spawned program can execute with the maximum possible memory available.
   It does this by swapping the programs memory image out to a temporary
   disk file.  Facilities are provided for piping the spawned program s
   standard output to a disk file or screen area (window),

   The Swap package allows programs that use the spawn() or system()

   functions to temporarily remove themselves from memory so that the
   spawned program can execute with the maximum possible memory  available.
   It does this by swapping the programs memory image out to a  temporary
   disk file. In order to use the Swap package, the appropriate  _swapx.obj
   file must be linked with your program, normally as the first  object in
   the linker command line.

   The Swap package is for real mode MS-DOS applications only and supports
   the C (compact), L (Large) and V(Virtual) memory models. Use the object
   files _swapc.obj, _swapl.obj and _swapv.obj respectively.

   The position of the _SWAPX module in the executable determines how  much
   of the program will be "swapped out" to disk. For example, if  _SWAPX is
   the first object file in the linker s parameter list, then the  entire
   executable will be swapped to disk, with the exception of the Swap
   kernel required to control windowing, piping, and reloading. You can get
   Swap to leave more of the program in memory by positioning it in the
   linker object file list after the object files you want to remain in
   memory.  For instance, your programs critical error handler or some other
   interrupt  service routine. Any interrupt service routine left in memory

   and active  while the rest of the program is "swapped out" must not
   access any global  data as this is likely to have been "swapped out" with
   the rest of the  program.

   Swap has default settings that enable it to be used in an application
   without changes to the source code. Additional facilities are available
   to  the programmer if required.

Additional Facilities

   Swap has the ability to capture program output through stdout and
   redirect it to a file or a screen area (window) of specific dimensions.
   The  function swap_pipe() controls capture to a file, while swap_window()
   controls capture to a window. Both facilities can be used simultaneously,
   output can be displayed in a window and captured to a file at the same
   time. It is also possible to control the amount of memory allocated to
   the  child process, to enable and disable Swap under program control and
   to  control the location of the swap file. Access to these facilities are
   described  in the function descriptions that follow.


Swap Defaults

   The default settings for Swap are:

   1.  Swapping is ON
   2.  Windowing is OFF
   3.  Piping is OFF
   4.  Free paragraphs is OFF
   5.  Swaps to the directory specified by the TEMP or TMP environment
       variable, or to the current directory if TEMP or TMP is not defined.

Constants Defined by swap.h

   The header file swap.h prototypes the Swap functions. It also contains
   definitions of error return codes that can be tested by applications
   which  use Swap.

   SWAP_FREEMEMERROR the primary memory block allocated for the program.

   SWAP_NOVMSPACE   disk drive to write the image of the program. Generally

                    occurs when the user  has defined TEMP or TMP to point a
                    small RAM drive.

   If the latter error is obtained while spawning a child process, The
                    application can use swap_tempcheckoff() to prevent use
                    of the TEMP  path and reinvoke the command so that the
                    current working directory is  used instead.

   The following functions constitute the Swap package:

   swap_clearkeyboardoff

   swap_clearkeyboardon

   swap_freeparagraphs

   swap_freeparagraphsoff

   swap_freeparagraphson


   swap_isclearkeyboardon

   swap_isfreeparagraphson

   swap_ison

   swap_ispipeon

   swap_istempcheckon

   swap_istrapcbreakon

   swap_iswindowon

   swap_off

   swap_on

   swap_pipe


   swap_pipeoff

   swap_pipeon

   swap_tempcheckoff

   swap_tempcheckon

   swap_trapcbreakoff

   swap_trapcbreakon

   swap_window

   swap_windowoff

   swap_windowon





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson