home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / BONUS40.ZIP / CHAIN.ZIP / CHAIN.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-11-22  |  1.8 KB  |  56 lines

  1. {$S-,R-,I-,V-}
  2.  
  3.   {*********************************************************}
  4.   {*                    CHAIN.PAS 4.00                     *}
  5.   {*        Copyright (c) TurboPower Software 1987.        *}
  6.   {*                 All rights reserved.                  *}
  7.   {*********************************************************}
  8.  
  9. unit Chain;
  10.   {-Chaining facility for Turbo 4}
  11.  
  12. interface
  13.  
  14. const
  15.   CloseFilesBeforeChaining : Boolean = True;
  16.   {If false: no files are closed before chaining,
  17.        true: all files but StdIn, StdOut and StdErr are closed}
  18.  
  19. function Chain4(Path, CmdLine : string) : Word;
  20.   {-Chain to file named in Path
  21.     CmdLine must be no longer than 94 characters
  22.     If Chain4 returns, a DOS error code is in the result}
  23.  
  24. procedure GetMemDos(var P : Pointer; Bytes : LongInt);
  25.   {-Allocate memory from DOS, returning a pointer to the new block
  26.     Shrink Turbo allocation and relocate free list if forced to
  27.     Returns P = nil if unable to allocate space}
  28.  
  29. function Pointer2String(P : Pointer) : string;
  30.   {-Convert a pointer to a string suitable for passing on command line}
  31.  
  32. function String2Pointer(S : string) : Pointer;
  33.   {-Convert a string formatted by Pointer2String to a pointer
  34.     Returns nil if S is an invalid string}
  35.  
  36.   {==========================================================================}
  37.  
  38. implementation
  39.  
  40.   {$L CHAIN}          {Pulls in about 450 bytes of code}
  41.   {$L GETMEM}         {Pulls in about 300 bytes of code}
  42.  
  43.   function Chain4(Path, CmdLine : string) : Word;
  44.     external {CHAIN} ;
  45.  
  46.   procedure GetMemDos(var P : Pointer; Bytes : LongInt);
  47.     external {GETMEM} ;
  48.  
  49.   function Pointer2String(P : Pointer) : string;
  50.     external {GETMEM} ;
  51.  
  52.   function String2Pointer(S : string) : Pointer;
  53.     external {GETMEM} ;
  54.  
  55. end.
  56.