!********************** !* nlpx1/nlpx1y * !* date: 06.aug.81 * !********************* %conststring (7) vsn = "vsn001c" !! stack = 400, streams = 3 %control 1 %include "deimosperm" !stack=400, streams=1 %recordformat xf(%byteinteger unit,fsys,%byteintegerarray fname(0:5)) %begin %constinteger control ser = 1; ! on node = 11, otherwise = 1 %recordformat rjef(%byteintegerarray data(0:239)) %recordformat mef(%record(mef)%name link,%byteinteger len,type, %c %bytearray reserved(0:7), %record (rjef) rje) %recordformat pf(%byteinteger ser, reply, %c (%byte a1, a2, b1, b2, (%byte c1, c2 %or %integer c) %or %c %byte fn, s1, (%record(mef)%name mes, %byte gate port, task port %or %c %string (3) facility))) %record(pf) p %constinteger tt=0,lo=1,cr=2,lp=3,bt=7 %owninteger lp port, lp count, lp status, lp k, gport %recordformat strdf(%integer a,b,c,d,%record(xf) file,%integer e,f,g,h) %recordformat strpf(%record(strdf)%name strd) %record(strdf)%name strd %recordformat d1f(%integer x); %record(d1f) d1 %recordformat d2f(%record(strpf)%name x); %record(d2f)%name d2 %record(xf) lp base file %constbyteintegerarray spool base(0:5)='V','L','P','0','0','0' %byteintegerarrayname buff %ownstring (119) linex %owninteger lptr,line length,i %constinteger gate ser=16, buffer manager=17 %constinteger rd=0 %constinteger request buffer=0, release buffer=1 !************************************************************ !* Function Values between Upper level and Gate !************************************************************ %constinteger connect = 1 ;! start a call up %constinteger accept call = 2; ! accept a call %constinteger Disconnect = 3; ! Stop a call, or reject a connect %constinteger Enable Input = 4; ! Allow data, Gate -> Task %constinteger Put Output = 5; ! Output Block, Gate -> Task %constinteger Enable Output = 4; ! Allow Output, Task -> Gate %constinteger Input Here = 5; ! Input Block, Task -> Gate %constinteger Reset = 6; ! Reset the Virtual Circuit (!) %constinteger Expedited = 7; ! Pass 'Interrputs' %constinteger Datagram = 8; ! Send a 'datagram' %constinteger Datagram Reply = 9; ! Reply to a datagram %constinteger Enable Facility = 10; ! Claim incoming calls Task -> Gate %constinteger Disable Facility= 11; ! Stop them !************************************************************** %constinteger reject=0 %constinteger idle=0, running=1, opened=2, closed=3 %conststring(9)%array stat(0:3)= "Idle", "Running", "Enabled", "Running" %routine to tt(%integer fn) %recordformat pf(%byteinteger service,reply,%integer a1, %c %string(119)%name a2,%integer a3) %record(pf) p p_service=control ser; p_reply=id p_a1=fn!1<<8; p_a2==linex; p_a3=120 ! pon(p) %end %routine set stream(%record(xf)%name file) %constintegerarray disc(0:3)=3,3,8,14 %ownrecord (strdf) %name strd5 d1_x=k'160032'+5<<1 %if d2_x_strd == null %then d2_x_strd == strd5 strd == d2_x_strd %if file_unit=255 %start; ! dummy strd5 == strd; ! remeber its address d2_x_strd == null; ! null stream %return %finish strd_a=0; strd_b=2; strd_c=0; strd_d=id<<8!disc(file_unit) strd_file=file; strd_e=0; strd_f=0; strd_g=0; strd_h=k'172' %end %routine print count(%integer k,units) print symbol(',') write(k, 1) %and print string("k +") %if k>0 write(units, 1); print string(" chars") %end %routine print file %integer i,j %record(xf)%name file d1_x=k'160032'+5<<1 %if d2_x_strd == null %then printstring(".null ") %and %return file==d2_x_strd_file print symbol(file_unit+'0'); print symbol('.') %cycle i=0,1,5 j=file_fname(i); %exit %if j=' ' print symbol(j) %repeat print symbol('('); print symbol(file_fsys>>3+'0') print symbol(file_fsys&7+'0'); print symbol(')') %end %routine free buffer(%record(mef)%name mes) p_ser=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_ser=gate ser; p_reply=id p_fn=fn; p_mes==mes; p_S1=flag p_gate port = gport; p_task port = 1 pon(p) %end %routine from gate %integer i,j,k,l %switch sw(Connect:Disable Facility) ->sw(p_fn) sw(connect): g port = p_gate port free buffer(p_mes) %if lp status=opened %start printstring("LP: Starting ") to gate(Accept Call, null, 0) to gate(Enable Input, null, 3) lp status=running set stream(lp base file) j=lp base file_fname(5)+1 %if j>'9' %start k=lp base file_fname(4)+1 %if k>'4' %start lp base file_fsys=lp base file_fsys+1 k='0' %finish lp base file_fname(4)=k j='0' %finish lp base file_fname(5)=j lp count=0; lp k=0 print file; newline %return %finish to gate(Disconnect, null, 64) %return sw(input here): to gate(enable input,p_mes,1) select output(1) k=0; buff==p_mes_rje_data %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>=p_mes_len select output(0) free buffer(p_mes) %return sw(disconnect): l = p_s1; ! get the reason -> call aborted %if l # 0 to gate(Disconnect,null,1) 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 set stream(lp base file); ! frig to get round perm fault %return call aborted: printstring("LP:Aborted ") lp status=idle select output(1) ; close output %return %end %integerfn do lp %integer i,j %string (63) u,v %if linex -> u.("STATUS").v %start printstring("LP:"); printstring(stat(lp status)) %unless closed#lp status#running %start print count(lp k,lp count) print string(", TO "); print file %finish newline %result=1 %finish %if linex -> u.("NULL").v %start lp base file_unit = 255 %result = 1 %finish %if linex -> u.("ENABLE").v %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 d2==d1 lp base file_unit=0; lp base file_fsys=k'16' lp base file_fname(i)=spool base(i) %for i=0,1,5 i = map virt(buffer manager,5,4) i = map virt(buffer manager, 6, 5) p_ser = gate ser; p_reply = id p_fn = enable facility; p_s1 = 0 p_facility = "LP" pon(p) p_ser = gate ser; p_reply = id p_fn = enable facility; p_s1 = 0 p_facility = "PP" pon(p) to tt(rd) lp status = opened %cycle p_ser=0; poff(p) %if p_reply=gate ser %start from gate %else %if p_reply=control ser lptr=3 i = do lp to tt(rd) %if i<= 0 %then printstring("tt: invalid ") %finish %repeat %endofprogram message(tt,"invalid"); newline