Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - utilities/jsys.fai
There are no other files named jsys.fai in the archive.
	title jsys: jsys documentation program by andrew knutsen
	search monsym, macsym
	asuppress

define bakchr (str)
<..tmp= .
	call bakcha
	for xx in (str)
<	cain 2, xx
	 jrst ..tmp
>>

p=17
rsclen== 3
bufsiz== 20
pdllen== 20

start:	RESET%
	move p,[iowd pdllen,pdl]
	movei 15, .priou
	skipn iniflg
	 jrst dosrch
	movsi 1,(gj%old!gj%sht)
	hrroi 2, filest
	gtjfn
	 erjmp dosrch
	hrrzs 1
	movei 2, of%rd
	openf
	 ercal fatal
	hrlzs 1
	move 2,[.fhslf,,15]
	move 3,[pm%cnt+pm%rd+762]
	pmap
	setzb 1,inbuff
	rscan
	 ercal warn
	jumpe 1,srchdn
	movei 1,.priin
rs1:	bin
	cain 2,12
	 jrst rs2
	caie 2,40
	 jrst rs1
	hrroi 2,inbuff
	movei 3,rsclen*5-1
	movei 4,12
	sin
	setz 4,
	dpb 4,2
rs2:	move 1, inbuff
	jumpn 1, gotjs
srchdn:	hrroi 1,[asciz "jsys? "]
	move 3,1
	psout
	hrroi 1,inbuff
	move 2,[rd%bel!rd%crf!100]
	rdtty
	 ercal warn
	setz 2,
	dpb 2,1
	move 1, inbuff
gotjs:	andcm 1,[201004020100]
	movm 2,1
	idivi 2,2000
	imuli 3,3
hloop:	skipn 4,3000(3)
	 jrst [ tmsg <couldnt find it>
		jrst stop]
	camn 1,4
	 jrst gotit
	movei 3,3(3)
	jrst hloop
gotit:	movei 4, (3)
	hrrz 1,15
	hrroi 2,[asciz \
\]
	setz 3,
	sout
	move 12,3001(4)		;byte pointer
	movn 13,3002(4)		;total char count
newbuf:	hrrei 4, -bufsiz*5+1	;counter for this buffer
	move 5, [point 7, buffer]
bytelp:	ildb 1, 12
	aojg 13, prdun
	cain 1,"_"
	 jrst bytelp
	caie 1, 14
	 jrst notopg
	movei 6, 2
skpllp:	ildb 1, 12
	aojg 13, prdun
	caie 1, 12
	 jrst skpllp
	sojg 6, skpllp
	ildb 1, 12
	aojg 13, prdun
notopg:	idpb 1, 5
	aojn 4, bytelp
	setz 1,
	idpb 1,5
	hrrz 1,15
	hrroi 2,buffer
	setz 3,
	sout
	jrst newbuf
prdun:	setz 1,
	idpb 1,5
	hrrz 1,15
	hrroi 2,buffer
	setz 3,
	sout
stop:	haltf
	jrst start

dosrch:	setom iniflg
open1:	tmsg <must hash... where is the jsys manual? >
	movei 1,[gj%old!gj%msg!gj%cfm!gj%xtn
		.priin,,.priou
		[asciz /ps/]
		[asciz /manuals/]
		[asciz /4-jsys/]
		[asciz /manual/]
		0
		0
		0
		0,,3
		0
		0
		-1,,[asciz \must hash... where is the jsys manual? \]]
	setz 2,
	gtjfn
	 erjmp [ call warn
		 jrst open1]
	move 3,1
	hrrzs 1
	move 2,[7b5+of%rd]
	openf
	 erjmp [ call warn
		 jrst open1]
	move 2,[1,,11]
	movei 3,4
	gtfdb
	sizef
	 ercal fatal
	tlnn 4,300
	 imuli 2,5
	adjbp 2, [point 7, 15000]
	move 16, 2
	hrlz 1, 1
	move 2,[.fhslf,,15]
	hrli 3,(pm%cnt+pm%rd)
	pmap
	hlrz 2, 1
	hrroi 1, filest
	move 3,[1b2+1b5+1b8+1b11+1b35]
	jfns
	move 7, [point 7, 15000]
cinit:	move 1, 7
	call search
	 jrst [ tmsg <is that really the jsys manual? >
		jrst dosrch]
	move 7, 1
	movei 3, 10
	nin
	 jrst cinit
jloop:	move 1, 7
	bakchr <40>
	call bakalp
	bakchr <40>
	call bakalp
	move 2, 1
	move 10, 2
	bakchr <40, 11>
	exch 10, 1
	move 2, 1
	move 4, [point 7, 11]
	setz 11,
chrlup:	ildb 1, 2
	trz 1, 40
	pbout
	idpb 1,4
	jumpn 1, chrlup
	movei 1, 40
	pbout
	movm 12, 11
	idivi 12,2000
	imuli 13,3
getpla:	skipn 3000(13)
	 jrst gotpla
	movei 13, 3(13)
	jrst getpla
gotpla:	move 1, 7
	call search
	 jrst finish
	move 7, 1
	call bakalp
	bakchr <40>
	call bakalp
	bakchr <40, 11, 12, 15>
	hrrz 6, 1
	hrrz 5, 10
	sub 6, 5
	imuli 6, 5
	hlrz 5, 10
	lsh 5, -=12
	hlrz 4, 1
	lsh 4, -=12
	sub 4, 5
	idivi 4, 7
	add 6, 4
	movem 11,3000(13)
	movem 10,3001(13)
	movem 6,3002(13)
	jrst jloop
finish:	movem 11,3000(13)
	movem 10,3001(13)
	movei 1, 1000
	movem 1, 3002(13)
	movei 1,.fhslf
	seto 3,
	epcap
	tmsg <
>
open2:	tmsg <where should the program go? >
	movei 1,[gj%fou!gj%msg!gj%cfm!gj%xtn
		.priin,,.priou
		0
		0
		[asciz/jsys/]
		[asciz/exe/]
		0
		0
		0
		0,,3
		0
		0
		-1,,[asciz \where should the program go? \]]
	setz 2,
	gtjfn
	 erjmp [ call warn
		 jrst open2]
	hrli 1,.fhslf
	move 2,[14760,,20]
	save
	jrst srchdn

srchl2:	move 1, 5
search:	move 2, [point 7, jswrd]
	ildb 3,2
srchlp:	camn 1, 16
	 jrst toend
	ildb 4, 1
	caie 3, (4)
	 jrst srchlp
	move 5, 1
srchl1:	ildb 3,2
	jumpe 3, got.it
	ildb 4, 1
	caie 3, (4)
	 jrst srchl2
	jrst srchl1

got.it:	aos (p)
toend:	ret

bakalp: call bakcha
	trz 2, 40
	caig 2, 100
	 jrst toend
	caig 2, 132
	 jrst bakalp
	ret

bakcha:	seto 2,
	adjbp 2, 1
	move 1, 2
	ldb 2, 1
	ret

fatal:	hrroi 1,[asciz /
?pc /]
	hrrz 2,(p)
	call error
	jrst stop

warn:	push p,1
	push p,2
	push p,3
	hrroi 1,[asciz /
%pc /]
	hrrz 2,-3(p)
	call error
	pop p,3
	pop p,2
	pop p,1
	ret

error:	psout
	subi 2,2
	movei 1,.priou
	movei 3,10
	nout
	jfcl
	hrroi 1,[asciz/: /]
	psout
	movei 1,.priou
	hrloi 2,.fhslf
	setz 3,
	erstr
	jfcl
	jfcl
	tmsg <
>
	ret

inbuff:	block rsclen
jswrd:	asciz/     JSYS /
buffer: block bufsiz
iniflg:	0
filest:	block 10
pdl:	block pdllen

end start