home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_300
/
349_01
/
sss.arc
/
EX_0401.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-04-11
|
1KB
|
78 lines
Program EX_0401;
{Listing 6P - see documentation in TUTOR.SSS}
uses SSS;
{ For Pascal other than Turbo/Quick erase above line }
const
ARRIVL = 1;
TRYBUY = 2;
REPLNS = 3;
CUSTMR = 0;
GOODS = 1;
{ For MS Pascal $include:'SSSP1.H' }
var
c, ecode : integer;
{ For MS Pascal $include:'SSSP2.H' }
procedure prime;
begin
INIQUE(0,0,2);
INISTA(1,'Out of stock',0,0,0,0);
INISTA(2,'Ave stock',1,0,0,0);
SIMEND(40.0);
CREATE(EX(2.0), CUSTMR);
c := 15;
TALLY(2,c);
end;
procedure buying;
begin
if c = 4 then CREATE(TR(5.0,7.0,9.0), GOODS);
if c > 0 then c := c - 1 else TALLY(1,1);
TALLY(2,c);
DISPOS;
end;
procedure order;
begin
c := c + 12;
TALLY(2,c);
DISPOS;
end;
begin
prime;
repeat
ecode := NEXTEV;
if ecode > 0 then
begin
case ecode of
ARRIVL: if IDE = CUSTMR then
begin
CREATE(EX(2.0), CUSTMR);
SCHED(0, TRYBUY, IDE);
end else
SCHED(0, REPLNS, IDE);
TRYBUY: buying;
REPLNS: order;
end;
end;
until ecode = 0;
SUMRY('');
end.