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_0501.BAS
< prev
next >
Wrap
BASIC Source File
|
1991-04-09
|
2KB
|
104 lines
' Program EX_0501.BAS
' Listing 9B - see documentation in TUTOR.SSS
const ARRIVL = 1, STARTA = 2, ENDACT = 3, NEXTAC = 4
const STRTDY = 5
const CLOSES = 0, WATCH = 1
const FALSE = 0, TRUE = noT FALSE
common shared ecode, opens, repars
common shared inter, rept
declare sub prime ()
declare sub clshop ()
declare sub newday ()
rem $include: 'SSSB.H'
call prime
do
ecode = NEXTEV
if ecode > 0 then
select case ecode
case ARRIVL
if IDE = WATCH then
CREATE EX(inter), WATCH
SETA 1, T
SCHED 0, NEXTAC, WATCH
else
SCHED .5, STRTDY, CLOSES
clshop
end if
case NEXTAC
if opens then
if repars then
QUEUE 2, 0
else
SCHED 0, STARTA, IDE
end if
else
QUEUE 1, 0
end if
case STARTA
SCHED EX(rept), ENDACT, 0
repars = TRUE
case ENDACT
QUEUE 3, 0
if NQ(2) > 0 then
REMVFQ 2, 1
SCHED 0, STARTA, 0
else
repars = FALSE
end if
case STRTDY
newday
end select
end if
loop while ecode > 0
title$ = " "
SUMRY sadd(title$)
sub clshop
opens = FALSE
do while NQ(3) > 0
REMVFQ 3, 1
TALLY 1, T - A(1)
DISPOS
loop
end sub
sub newday
CREATE .5, CLOSES
DISPOS
opens = TRUE
repars = FALSE
do while (NQ(1))
REMVFQ 1, 1
QUEUE 2, 0
loop
end sub
sub prime
INIQUE 3, 1, 1
title$ = "Sojourn time "
INISTA 1, sadd(title$), 0, 10, 0, .2
CREATE 0, WATCH
CREATE .5, CLOSES
SIMEND 10
opens = TRUE
repars = FALSE
inter = 7 / 25
rept = 2 / 24
end sub