!********************** !* nlps/nlpy * !* nb: Uses New Compiler !* date: 26.jul.80 * !********************* %conststring (15) vsn = "nlps...vsn3a " !! stack = 400, streams = 3 %recordformat xf(%byteinteger unit,fsys,%byteintegerarray fname(0:5)) %include "b_deimosspecs" %begin %externalroutinespec open output(%integer str, %string (255) s) %constinteger control ser = 11 %recordformat rjef(%byteintegerarray data(0:239)) %recordformat nsi1f(%byteinteger fn,sufl,st,ss,flag,uflag, %c %record(rjef) rje) %recordformat mef(%record(mef)%name link,%byteinteger len,type, %c %record(nsi1f) nsl) %recordformat pf(%byte service,reply, (%byte fn,port, %c %record(mef)%name mes,%byteinteger len,s1 %or %c %byte a1, a2, b1, b2, c1, c2)) %record(pf) p %constinteger tt=0,lo=1,cr=2,lp=3,bt=7 %owninteger lp port, lp count, lp status, lp k %recordformat strdf(%integer a,b,c,d,%record(xf) file,%integer e,f,g,h) %ownstring (7) lp file name = "VLP000" %byteintegerarrayname buff %ownbyteintegerarray line(0:119) %owninteger i, aborted %constinteger gate ser=16, buffer manager=17 %constinteger rd=0 %constinteger request buffer=0, release buffer=1 %constinteger enable facility=1, call reply=3 %constinteger enable input=4, close call=6 %constinteger abort call=7 %constinteger open call reply=1, incoming call=2, input recd=3 %constinteger call closed=5, call aborted=6 %constinteger reject=0 %constinteger idle=0, running=1, opened=2, closed=3 %conststring(9)%array stat(0:3)= "Idle", "Running", "Enabled", "Running" %ownstring (255) %name linex %ownstring (25) st %routinespec to gate(%integer fn,%record (mef) %name mes, %integer flag) %on 9 %start; ! fault 9 select output(0); printstring("**** Disc/Directory FULL ") to gate(abort call, null, 0) aborted = 1 -> back in %finish %routine to tt(%integer fn) %recordformat pf(%byteinteger service,reply,%integer a1, %c %byteintegerarrayname a2,%integer a3) %record(pf) p p_service=control ser; p_reply=id p_a1=fn!1<<8; p_a2==line; p_a3=120 pon(p) %end %routine print count(%integer k,units) print symbol(',') write(k,0) %and print string("k +") %if k>0 write(units,0); print string(" chars") %end %routine free buffer(%record(mef)%name mes) p_service=buffer manager; p_reply=id p_fn=release buffer; p_mes==mes pon(p) %end %routine to gate(%integer fn,%record(mef)%name mes,%integer flag) p_service=gate ser; p_reply=id p_fn=fn; p_mes==mes; p_s1=flag pon(p) %end %routine from gate %integer i,j,k,l %switch sw(open call reply:call aborted) ->sw(p_fn) sw(incoming call): %if lp status=opened %start aborted = 0; ! flagto say i aborted printstring("LP: Starting ") p_len=16 %if p_len=0 to gate(call reply,null,p_len) lp status=running j=charno(lp file name, 6)+1 %if j>'9' %start k=charno(lp file name, 5)+1 charno(lp file name, 5)=k j='0' %finish charno(lp file name, 6)=j open output(1, lp file name) select output(0) lp count=0; lp k=0 printstring(lp file name); newline %return %finish to gate(call reply,null,reject) %return sw(input recd): to gate(enable input,p_mes,0) %unless p_mes_nsl_flag&128#0 select output(1) k=0; buff==p_mes_nsl_rje_data l=p_mes_nsl_uflag %cycle %if buff(k)>127 %then k=k+1 j=buff(k) %cycle k=k+1,1,k+j print symbol(buff(k)) %repeat j=j+lp count j=j-1024 %and lp k=lp k+1 %if %c j>=1024 lp count=j k=k+1 %repeat %until k+6 > p_mes_len select output(0) free buffer(p_mes) %return sw(call closed): to gate(close call,null,0) printstring("LP:Finished") print count(lp k,lp count) newline %if lp status=closed %then lp status=idle %c %else lp status=opened select output(1); close output %return sw(call aborted): to gate(abort call,null,0) %unless aborted # 0 printstring("LP:Aborted ") lp status=idle select output(1) ; close output %return %end %integerfn do lp %if linex -> st.("STATUS").linex %start printstring("LP:"); PRINTSTRING(STAT(LP STATUS)) %unless closed#lp status#running %start print count(lp k,lp count) print string(", TO "); printstring(lp file name) %finish newline %result=1 %finish %if linex -> st.("NULL").linex %start lp file name = ".NULL" %result = 1 %finish %if linex -> st.("ENABLE").linex %start %if lp status=idle %or lp status=closed %start printstring("LP:Enabled") %if lp status=idle %then lp status=opened %else lp status=running %else printstring("LP:Disabled") %if lp status=running %then lp status=closed %else lp status=idle %finish newline %result=1 %finish %result=0 %end i = map virt(buffer manager,5,4) i = map virt(buffer manager, 6, 5) to gate(enable facility, null, 4) to gate(enable facility, null, 6) linex == string(addr(line(0))) to tt(rd) lp status = opened %cycle back in: p_service=0; poff(p) %if p_reply=gate ser %start from gate %finish %else %if p_reply=control ser %start i = do lp to tt(rd) %if i<= 0 %then printstring("tt: invalid ") %finish %repeat %endofprogram message(tt,'invalid'); newline