CHAA006@vaxa.rhbnc.ac.UK (06/18/87)
I couldn't find a FORTRAN example, but here's a MACRO-32 one (for those, like me, who aren't familiar with 'C') .title arc$time_slot ; ; Based on an original idea by ; ; Sanford L. Berger ; Marquette University ; Computer Services Division ; Technical Services ; Milwaukee, WI ; ; and modified 3-Feb-1987 17:25:52 by ; ; Philip Taylor ; Royal Holloway and Bedford New College ; University of London ; Egham Hill, Egham ; Surrey, U.K. ; ; usage: time_slot := arc$time_slot (time, username) ; result: 0 => error, 1 => prime time, 2 => off-peak time ; errors: signalled ; ; Assumptions: SYSGEN parameter USERD1 is a bit-mask, with one bit set ; for each primary hour (bit 0 for 00:00 - 01:00, etc.) ; time = 4 user = 8 $rmsdef $syidef $uaidef .macro $abort, p1 pushl p1 calls #1, G^Lib$Signal pushl #0 ret .endm .macro if_ok, ?L1 blbs R0, L1 $abort R0 L1: .endm .macro $return, P1 movl P1, R0 ret .endm .macro .zero .long 0 .endm .psect code,long,nowrt,exe .entry arc$time_slot, ^M<> cmpl (AP), #2 bgeq 10$ $abort #ss$_insfarg ; At the 'Case' statement of the following code, ; R0 will contain the current "day type"; ; 0 => default, 1 => primary, 2 => secondary; ; Despatch as follows :- ; If secondary, return immediately: no more to do; ; If primary, compare time with 'prime time', and return appropriately; ; If default, look up user in UAF, ask the system for the day of the week ; corresponding to <time>, ascertain what sort of day that is for ; <user>, then proceed as above. 10$: movzbl #0, R0 bbc #exe$v_explicits,exe$gl_flags,def bbc #exe$v_explicitp,exe$gl_flags,pri sec: incl R0 pri: incl R0 def: casel R0, #0, #2 base: .word default-base .word primary-base .word secondary-base $abort #arc$_codingerr default: $getuai_s usrnam=@user(ap),- itmlst=uai.data cmpl #rms$_rnf, R0 bnequ 10$ $getuai_s usrnam=defuser,- itmlst=uai.data 10$: if_ok pushal day.nmbr pushal @time(ap) calls #2, G^Lib$Day_of_week if_ok moval day.tble, R0 subl3 #1, day.nmbr, R1 ; 0 <= R1 <= 6 movl (R0)[R1], R1 bbs R1, uai.buff, secondary primary: $getsyiw_s itmlst=syi.data if_ok $numtim_s timbuf=tim.buff,- timadr=@time(ap) if_ok movzwl tim.hour, R0 bbc R0, syi.buff, secondary $return #1 secondary: $return #2 .psect data, wrt, noexe day.nmbr: .blkl 1 day.tble: .long uai$v_monday .long uai$v_tuesday .long uai$v_wednesday .long uai$v_thursday .long uai$v_friday .long uai$v_saturday .long uai$v_sunday defuser: .ascid 'DEFAULT' syi.blen = 4 syi.data: .word syi.blen .word syi$_userd1 .address syi.buff .address syi.rlen .zero syi.buff: .blkb syi.blen syi.rlen: .blkl 1 tim.buff: .blkw 1 .blkw 1 .blkw 1 tim.hour: .blkw 1 .blkw 1 .blkw 1 .blkw 1 uai.blen = 4 uai.data: .word uai.blen .word uai$_primedays .address uai.buff .address uai.rlen .zero uai.buff: .blkb uai.blen uai.rlen: .blkl 1 .end