Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-11 - 43,50531/pasult.mac
There are 2 other files named pasult.mac in the archive. Click here to see a list.
	title PASCAL interface to Ultimate command scanner
	subttl	By Bill Westfield    Sept 16,1980
	internal CLREOL
	extern	SUBCMD,getcmd,tPUTCH

	entry	PASULT

	search	UTILS
	%NEAT
	%INIT
	%EST

comment ~
	This inteface allows the Ultamate command scanner (ULTCMD) to
	be called from Pascal, as in :

-------------------------------------------------------------------------------
	program	test;

var	I : integer;
	CEOL : packed array[0..1] of char;

function PASULT(num_of_strings : integer ; CLREOL,PROMPT : string ;
		a,b,c,d,e,f,g,h,j,k,l : string ) : integer; extern;


begin
	CEOL[0] := chr(16);
	CEOL[1] := chr(28);	{ gp-100 Clear to EOL codes }
	while TRUE do begin
	I := PASULT (11,CEOL,'% ','read','rename','renumber','request',
		'require','delete','offer','open','optimize','munge','mangle');
	writeln(tty);
	writeln(tty,'Index : ',I:0)
	end
end.
-------------------------------------------------------------------------------

	The value returned is the relative command number eg an integer
	between 1 and num_of_strings.

~
PASULT:	move	13,[point 7,STRSTG]	;string storage area
	movei	7,3			;where to start getting strings
	movnm	2,TABLE			;put the -arg count into the table
	addi	2,1			;get all strings + prompt
	setz	14,
	call	GETSTR			;get CLREOL string
	hrlm	1,TABLE(14)		;returns address of string in ac1
	caige	14,-1(2)
	aoja	14,ARGLP
	movei	1,TABLE			;standard calling sequence for ULTCMD
	call	GETCMD			;call command subroutine
	subi	1,TABLE			;compute the relative command Number
	movem	1,1(P)			;and return it to Pascal
	return

getstr:	caig	7,20				;are we past acs yet ?
	caig	7,6				;have we exceeded ac6 ?
	jrst	OK
	  movei	7,1(P)			;set up adlress so we get the rest
	  addi	2,(2)			;of the arguments from the satck
	  sub	7,2
	  idivi	2,2			;put 2 back where it was
OK:	hrli	10,(point 7,0)		;make a byte pointer
	hrr	10,(7)			;to the string
	movei	1,(13)			;and to a temporary storage area
	move	11,1(7)				;get the length
STRLP:	ildb	12,10			;and copy it all, since we can't
	idpb	12,13			;count on Pascal giving us ASCIZ
	sojg	11,STRLP
	setz	12,			;make sure we create asciz
	idpb	12,13
	addi	13,1				;ready for next word
	hrli	13,(point 7,)
	addi	7,2
	return

TABLE:	block 30			;up to 29 commands, easilly changeable

CLREOL:					;clreol string is the first item in
STRSTG:	block 200			;the string storage area. size variable


glop:	tputch

	end