10 extend 20 ! program to handle all system indirects (max 12) & ! written very quickly and not perhaps that cleanly & ! on afternoon on 05-may-82 by Brian Nelson. & ! & ! Author: Brian Nelson & ! Computer Services & ! University of Toledo & ! 2801 West Bancroft & ! Toledo, Oh 43606 & ! & ! Language: Basic+2 and Macro-11 & ! Date: 05-may-82 & ! & ! Copyright (C) 1982 Brian Nelson & ! & ! This software is furnished under a license and may & ! be used and copied only in accordance with the & ! terms of such license and with the inclusion of & ! the above copyright notice. This software or any & ! other copies thereof may not be provided or other- & ! wise made available to any other person. No title & ! to and ownership of the software is hereby trans- & ! ferred. & ! & ! The information in this software is subject to & ! change without notice and should not be construed & ! as a commitment by the University of Toledo or by & ! the author. & ! & ! & ! & ! & ! & ! While I am most definately NOT a Basic fan, this was & ! the most convienient way to go in order to get it up & ! since this summer it will all be put into Pascal and & ! Macro to be included in the new sysman run time sys. & ! It is certainly better that trying something as & ! absurd as fortran, and infinitely inferior to PASCAL. & ! Basic+2 has pathetic control structures (like none?). & ! & 1000 on error go to 19000 & \ common (work) work%(10%) & \ common (buf) buf$ = 100% & \ common (misc) msglen%,errcode%,uuo%(30%) & \ common (jobs) jobtbl%(64%),kbs%(64%),cnt%(64%), & waiting%(64%) & \ common (chan) chanbusy%(15%) & \ common (cmds) lastcmd$(64%)=80%,lastcmdlen%(64%) & \ false% = 0% & \ true% = -1% & \ crlf$ = chr$(13%) + chr$(10%) & ! & ! buf$ current line read from current cmd file & ! msglen% length of message received from AT & ! jobtbl%() table of channel numbers indexed by job & ! kbs%() table of kb numbers & ! cnt%() table of number of lines forced & ! waiting%() table of jobs not ready for a force & ! chanbusy%() list of busy (open) input channels & ! lastcmd$() last commandline read, indexed by job & ! lastcmdlen%() length of last command line read & 1010 work%(i%) = 0% for i% = 0% to 10% & \ jobtbl%(i%) = 0% for i% = 0% to 64% & \ kbs%(i%) = 0% for i% = 0% to 64% & \ cnt%(i%) = 0% for i% = 0% to 64% & \ waiting%(i%) = false% for i% = 0% to 64% & \ chanbusy%(i%) = false% for i% = 0% to 15% & \ lastcmdlen%(i%) = false% for i% = 0% to 64% & \ long.sleeptime% = 100% & \ short.sleeptime% = 2% & & \ a$ = sys(chr$(6%)+chr$(9%)) & \ ourjob% = ascii(mid(a$,1%,1%))/2% & \ ourkbn% = ascii(mid(a$,2%,1%))/2% & \ a$ = sys(chr$(6%)+chr$(7%)) unless debug% & \ a$ = fnsend$('Detaching' + crlf$,ourkbn%) & ! & ! initialize and detach & 1020 call clrmsg by ref(errcode%) & \ call dclmsg by ref(errcode%) & \ uuo$ = sys(chr$(6%)+chr$(26%)+chr$(0%)+chr$(1%)) & \ change uuo$ to uuo% & \ s.mlst% = uuo%(29%)+swap%(uuo%(30%))+16% & \ print s.mlst% if debug% & ! & ! remove any previous msg name, and set ours to INDIRE & 1040 while true% & \ call rcvmsg by ref( buf$,100%,msglen%,errcode% ) & ! & ! message format: & ! chr$(job*2)+chr$(kb*2)+commandfilename$ & ! send id is 'INDIRE', must have temp privs to send & 1060 if errcode% = 0% & then & msg$ = left(buf$,msglen%) & \ ctl.job2% = ascii(msg$) & \ ctl.kb2% = ascii(mid(msg$,2%,1%)) & \ ctl.kb% = ctl.kb2% / 2% & \ ctl.job% = ctl.job2% / 2% & \ junk% = fnreset%(ctl.job%) if jobtbl%(ctl.job%)<>0% & \ kbs%(ctl.job%) = ctl.kb% & \ i% = 1% & & \ freechan% = 0% & \ while (i% < 13%) and (freechan% = 0%) & \ freechan% = i% if chanbusy%(i%) = false% & \ i% = i% + 1% & \ next & & \ if freechan% = 0% & then & e$ = '?No room for @ right now' + crlf$ & \ e$ = fnsend$(e$,ctl.kb%) & else & jobtbl%(ctl.job%) = freechan% & \ chanbusy%(freechan%) = true% & \ open right(msg$,3%) for input as file #freechan%, & mode 8192% + 4096% & \ print right(msg$,3%);' ';freechan%,ctl.kb2%/2% & if debug% & 1100 for nextjob% = 1% to 63% & \ if jobtbl%( nextjob% ) <> 0% & then & errcode% = 0% & \ call getlin( jobtbl%(nextjob%) ,cmd$ ,errcode% ) & unless waiting%(nextjob%) & \ lastcmd$(nextjob%) = cmd$ & unless waiting%(nextjob%) & \ lastcmdlen%(nextjob%) = len(cmd$) & unless waiting%(nextjob%) & ! please, how about begin -- end blocks some day & & \ if errcode% <> 0% & then & junk% = fnreset%( nextjob% ) & else & bp2kludge% = cnt%(nextjob%) & \ call frc by ref (lastcmd$(nextjob%), & lastcmdlen%(nextjob%), & nextjob%, & bp2kludge%, & errcode% ) & \ cnt%(nextjob%) = bp2kludge% & \ if errcode% < 0% & then & junk$ = fnsend$('Command file aborted'+crlf$, & kbs%(nextjob%) ) & \ junk% = fnreset%( nextjob% ) & else & if errcode%=1% then waiting%(nextjob%)=true% & else waiting%(nextjob%)=false% & 1200 next nextjob% & \ go to 2000 & 2000 sleeptime% = long.sleeptime% & \ i% = 0% & \ while ( i% < 64% ) and (sleeptime% = long.sleeptime%) & \ i% = i% + 1% & \ sleeptime% = short.sleeptime% if jobtbl%(i%) <> 0% & \ next & \ sleeptime% = 0% if peek(s.mlst%) <> 0% & \ sleep sleeptime% & & \next & ! & ! take a short nap if we have any active jobs & ! take no nap if a message came in during a scan & ! otherwise do not bother the RSTS scheduler too often & 15000 def fnreset%( nextjob% ) & \ j% = jobtbl%( nextjob% ) & \ close j% & \ chanbusy%( j% ) = 0% & \ kbs%( nextjob% ) = 0% & \ jobtbl%( nextjob% ) = 0% & \ cnt%(nextjob%) = 0% & \ waiting%(nextjob%) = false% & \ fnend & 15020 def fnsend$( m$,kb% ) & \ on error go to 15040 & \ fnsend$=sys(chr$(6%)+chr$(-5%)+chr$(kb%)+m$) & \ go to 15060 & 15040 resume 15060 & 15060 on error go to 19000 & \ fnend & 19000 \ el% = erl & \ er% = err & \ e$ = fnsend$('IND '+num$(el%)+num$(er%)+crlf$,0%) & \ e$ = fnsend$('IND '+num$(el%)+num$(er%)+crlf$,ourkbn%)& if ourkbn% <> 0% & \ if el% = 1060% & then & junk% = fnreset%( freechan% ) & \ e$ = 'Open failed for '+right(msg$,3%) + ' ' & + right(sys(chr$(6%)+chr$(er%)),3%) + crlf$ & \ ee$ = fnsend$(e$,ctl.kb%) & \ ee$ = fnsend$(e$,0%) & \ e$ = '' & \ ee$ = '' & \ resume 2000% & else resume 2000 & 32767 end