home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG086.ARC
/
START2.LBR
/
START2.PZS
/
START2.PAS
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
4KB
|
143 lines
program ST;
CONST
version = 2.0; {Mar '88}
{****************************************************************************}
{Program to load turbo pascal files saved as .CHN
Turbo Pascal saves its library of routines with every .COM file.
Therefore the smallest .COM file is about 10k. If you have a lot
of small utility programs on a disk, a lot of room is taken up with
each program storing the TP runtime library.
If a program is compiled with the .CHN option instead, only the
program code and data is saved . Making small files instead, and
freeing up a lot of disk space.
Now all that is needed is a program to load the .CHN files.
Enter ST. All it basically does is to load the TP runtime library
into memory, take the first argument on the commandline after ST as
the program to chain to and stuff any further arguments back into a
new commandline.
This program works with CP/M and PC/MS DOS ,only the declaration of
the variable cmdline alters - see the code.
When compiling ST to a .COM file (PC/MS DOS only) set the min code
and data values to the biggest .CHN file you will be loading. (Found
when you compile the .CHN file)
****
Version 1.0 of START only ran under TURBO v3 as the functions
paramcount and paramstr are not predefined in TURBO v2.
This version defines these functions to hopefully work the same
as TURBO v3, therefore working under TURBO v2.
I have preceded the names with the _ so as to differentiate them
from the predefined ones in TURBO v3.
Type styp has also been renamed to STRING127 to be more descriptive.
****
USAGE
ST programname [optional programname arguments]
St by itself displays a usage message.
Rex Foord (052 513131) Sept '87
}
{****************************************************************************}
type
STRING127 = string[127];
var
program_name : STRING127;
n : byte;
{****************************************************************************}
{$I paramstr.i} {include functions}
{$I paramcnt.i}
{****************************************************************************}
procedure help_message;
begin
writeln;
writeln('ST v',version:3:1);
writeln('Program to start chain files');
writeln;
writeln('Usage : ST programname [optional arguments for programname]');
writeln;
end;
{****************************************************************************}
procedure recreate_command_line (n:byte);
{put rest of command line arguments back into a new commandline}
var
i : byte;
s : STRING127;
{ cmdline : STRING127 absolute cseg:$80; (*for MSDOS*)}
cmdline : STRING127 absolute $80; (*for CP/M *)
begin
if n > 1 then
begin
s := '';
for i := 2 to n do
begin
s := s + _paramstr(i);
if i < n then s := s + ' ';
end;
cmdline := s;
end
else {no further arguments on line}
cmdline[0] := chr(0); {put in a blank string}
end;
{****************************************************************************}
procedure start_program (program_name : STRING127);
var
f : file;
i : integer;
begin
if pos('.',program_name) = 0 then
program_name := program_name + '.CHN'; {check for extension}
assign(f,program_name);
{$i-}
chain(f);
{$i+}
if ioresult <> 0 then
writeln('? Unable to chain to program ',program_name);
end;
{****************************************************************************}
begin {main}
n := _paramcount; {no of parameters initially on command line}
if n = 0 then
help_message
else
begin
program_name := _paramstr(1); {take first parameter as the program name}
recreate_command_line (n);
start_program (program_name);
end;
end.