.title stream subroutine .ident /21OCT81/ .psect syntax_table_driver,shr,wrt,long .sbttl stream subroutine .external contin,error,stopsh,stop,synvec ; ; stream: ; stype+d.a=0 ; loop: ; if(no more characters) ; then exit with runout ; get next character ; look up table entry ; add increment counter to pointer ; set new table pointer ; if(putvalue!=0) then stype=putvalue ; brb loop ; .entry stream,^m ; movl 4(ap),r3 ; table address movl 4(ap),r0 ; table address movl 8(ap),r4 ; descr of string movl 12(ap),r6 ; result descr clrl stype+d.a addl3 d.a(r4),s.o(r4),r2 ; char ptr movl s.l(r4),r5 ; string length 10$: tstl r5 ; runout? beql 93$ ; brifso movl r0,r3 movzbl (r2),r1 ; get the character to look at movzbl (r0)[r1],r0 ; get offset byte from table movq synvec[r0],r0 ; get vector pool entry ; r0=table address ; r1= putvalue cmpl #stopsh,r0 ; test for stopsh beql 20$ ; brifso incl r2 decl r5 20$: cmpl #error,r0 ; error? beql 92$ ; brifso tstl r1 ; putvalue=0? beql 30$ ; brifso movl r1,stype+d.a ; stype=putvalue 30$: cmpl #stop,r0 ; stop/stopsh? beql 91$ ; brifso cmpl #stopsh,r0 ; stop/stopsh? beql 91$ ; brifso tstl r0 ; is there a new table name? bneq 10$ ; brifso movl r3,r0 ; was continue, use saved table name brb 10$ ; gofer more 93$: movl #2,r0 ; runout return code movq (r4),(r6) movq s.o(r4),s.o(r6) movl r5,s.l(r4) subl2 r5,s.l(r6) addl2 s.l(r6),s.o(r4) brb 99$ ;<<<<<<<<<<<<<<<<< movq (r4),(r6) movq s.o(r4),s.o(r6) clrl s.l(r6) brb 99$ 92$: movl #1,r0 ; error return code movq (r4),(r6) movq s.o(r4),s.o(r6) clrl stype+d.a brb 99$ 91$: movl #0,r0 ; stop/stopsh return code movq (r4),(r6) movq s.o(r4),s.o(r6) movl r5,s.l(r4) subl2 r5,s.l(r6) addl2 s.l(r6),s.o(r4) 99$: ret .end