	.TITLE	CALLTPU

;This program is used to debug EDX_CALLUSER routines.  When compiled
;/DEBUG via @BLDDBGEDX.COM, it is run as a program ($ RUN CALLTPU) which in
;turn calls the EDX editor.  Once in the VMS debugger, breakpoints may be
;set anywhere within module EDX_CALLUSER.
;
;EDX (as any TPU based editor) may be called from a program, although this
;program demonstrates the more complicated way of doing it.  Here's an easier
;way to call EDX from within a FORTRAN program:
;
;         STATUS = TPU$TPU( 'TPU/SECTION=SYS$LIBRARY:EDTSCNSEC ' )
;


	.PSECT	$PLIT$,NOWRT,NOEXE
P.AAA:	.ADDRESS  INITIALIZE
	.LONG	0
P.AAB:	.ASCID	/VAXTPU is being called from a Macro program./
P.AAC:	.LONG	<TPU$M_RESET_TERMINAL+ -
		 TPU$M_KILL_PROCESSES+ -
		 TPU$M_DELETE_EXITH+ -
		 TPU$M_LAST_TIME>
P.AAF:	.LONG	<TPU$M_DISPLAY+ -
		 TPU$M_JOURNAL+ -
		 TPU$M_SECTION+ -
		 TPU$M_COMMAND+ -
		 TPU$M_CREATE+ -
		 TPU$M_OUTPUT>
P.AAG:	.ADDRESS TPU$FILEIO
	.LONG	0
P.AAH:	.ADDRESS TPU$CALLUSER
	.LONG	0
P.AAI:	.ASCII	/TPU$SECTION/<0>
PAAIL=.-P.AAI

P.AAJ:	.ASCII  /TPUINI/<0>
PAAJL=.-P.AAJ

P.AAK:	.ASCII	/INFILE/<0>
PAAKL=.-P.AAK

P.AAL:	.ASCII	/OUTFILE/<0>
PAALL=.-P.AAL

P.AAE:	.WORD	4
	.WORD	TPU$K_OPTIONS
	.ADDRESS P.AAF
	.LONG	0

	.WORD	4
	.WORD	TPU$K_FILEIO
	.ADDRESS P.AAG
	.LONG	0

	.WORD	4
	.WORD	TPU$K_CALLUSER
	.ADDRESS P.AAH
	.LONG	0

	.WORD	PAAIL
	.WORD	TPU$K_SECTIONFILE
	.ADDRESS P.AAI
	.LONG	0

;	.WORD	PAAJL			;Uncomment if TPUINI is logical name defined
;	.WORD	TPU$K_COMMANDFILE	;pointing to TPU initialization file
;	.ADDRESS P.AAJ			;e.g. EDIT/TPU/COMMAND=tpuini
;	.LONG	0

;	.WORD	PAAKL			;Uncomment if INFILE is logical name defined
;	.WORD	TPU$K_FILENAME		;pointing to input file name to be edited
;	.ADDRESS P.AAK			;e.g. $ EDIT/TPU infile
;	.LONG	0

;	.WORD	PAALL			;Uncomment if OUTFILE is logical name defined
;	.WORD	TPU$K_OUTPUTFILE	;as output file name.
;	.ADDRESS P.AAL			;e.g. $ EDIT/TPU/OUTPUT=outfile
;	.LONG	0

	.LONG	0			;END OF ITEMLIST.  (Do not comment out!)

	.PSECT	$CODE$,NOWRT
	.ENTRY	MAIN,^M<>
	MOVAL	G^TPU$HANDLER,(FP)	;Establish hander
	PUSHAQ	P.AAA			;Call tpu$initialize
	CALLS	#1,G^TPU$INITIALIZE	;clears screen
	CALLS	#0,G^TPU$EXECUTE_INIFILE;Execute procedure TPU$INIT_PROCEDURE
;	PUSHAQ	P.AAB			;Print message 'VAXTPU is being called from a Macro program.'
;	CALLS	#1,G^TPU$MESSAGE	;in message_buffer.
	CALLS	#0,G^TPU$CONTROL	;Give control over to VAXTPU.  We're now in the editor
	PUSHAL	P.AAE			;Upon exiting the editor
	CALLS	#1,G^TPU$CLEANUP	;cleanup
	RET				;and finish.

	.ENTRY	INITIALIZE, ^M<>
	MOVAL	P.AAE,R0
	RET

	.END	MAIN
