home *** CD-ROM | disk | FTP | other *** search
- {$S-,R-,I-,V-}
-
- {*********************************************************}
- {* CHAIN.PAS 4.00 *}
- {* Copyright (c) TurboPower Software 1987. *}
- {* All rights reserved. *}
- {*********************************************************}
-
- unit Chain;
- {-Chaining facility for Turbo 4}
-
- interface
-
- const
- CloseFilesBeforeChaining : Boolean = True;
- {If false: no files are closed before chaining,
- true: all files but StdIn, StdOut and StdErr are closed}
-
- function Chain4(Path, CmdLine : string) : Word;
- {-Chain to file named in Path
- CmdLine must be no longer than 94 characters
- If Chain4 returns, a DOS error code is in the result}
-
- procedure GetMemDos(var P : Pointer; Bytes : LongInt);
- {-Allocate memory from DOS, returning a pointer to the new block
- Shrink Turbo allocation and relocate free list if forced to
- Returns P = nil if unable to allocate space}
-
- function Pointer2String(P : Pointer) : string;
- {-Convert a pointer to a string suitable for passing on command line}
-
- function String2Pointer(S : string) : Pointer;
- {-Convert a string formatted by Pointer2String to a pointer
- Returns nil if S is an invalid string}
-
- {==========================================================================}
-
- implementation
-
- {$L CHAIN} {Pulls in about 450 bytes of code}
- {$L GETMEM} {Pulls in about 300 bytes of code}
-
- function Chain4(Path, CmdLine : string) : Word;
- external {CHAIN} ;
-
- procedure GetMemDos(var P : Pointer; Bytes : LongInt);
- external {GETMEM} ;
-
- function Pointer2String(P : Pointer) : string;
- external {GETMEM} ;
-
- function String2Pointer(S : string) : Pointer;
- external {GETMEM} ;
-
- end.