Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - stanford/ftp/ftplud.mac
There are no other files named ftplud.mac in the archive.
	SEARCH FTPDEF
	TTITLE (FTPLUD, -- Postlude module for PUPFSV and FTP)
	SUBTTL Kirk Lougheed / April 1982

	;; Copyright (C) 1984 Board of Trustees, Stanford University
	;; The information in this software is subject to change without
	;; notice and should not be construed as a commitment by Stanford
	;; University.  Stanford assumes no responsibility for the use or
	;; reliability of this software.

	EXTERN EVEC,EVECL,SAVNAM,VERDAT,VERWHO,VERHST,$GTLCL,$RMREL
	EXTERN STKLEN,STACK

; Macro for space printouts

DEFINE PRPSC($PSECT,$NEXT,$LIMIT)<
	XLIST			;; Pretty listings
	EXTN B'$PSECT		;; Make sure psect start is defined
	HRROI A,[ASCIZ \
$PSECT\]
	PSOUT%			;; Start line by typing PS name
	MOVEI B,B'$PSECT	;; Get start address
	CALL OCTOUC		;; Type it
	MOVEI B,Z'$PSECT	;; Get end address
	CALL OCTOUC		;; Type that too
	MOVEI B,1+<Z'$PSECT>-<B'$PSECT>	;; Get space used in PSECT
	CALL OCTOUC		;; Type space used
IFB <$LIMIT>,<EXTN B'$NEXT	;; Beginning is defined elsewhere
	MOVEI B,-1+<B'$NEXT>>	;; Get address of next PSECT
IFNB <$LIMIT>,<MOVEI B,$LIMIT>
	SUBI B,Z'$PSECT		;; Subtrace from PSECT end to find space left
	CALL OCTOUC		;; Type space left
IFNB <$LIMIT>,<HRROI A,[ASCIZ \	$LIMIT\]
	PSOUT%>			;; Type limit
	HRROI A,[ASCIZ \	<= Overflow\] ;>
	SKIPGE B
	 PSOUT%			;; Warn about possible overflow
	ASH B,-^D9
	ADDI FX,(B)		;; Count pages
	LIST
>;DEFINE PRPSC
;Start here to print out a PSECT map of the program, reset the entry vector,
;And save as whatever we find in SAVNAM

FTPINI:	RESET%			; Init the world
	MOVE P,[IOWD STKLEN,STACK] ; Setup stack
	GTAD%
	MOVEM A,VERDAT		; Set time and date compiled
	GJINF%
	MOVE B,A		; Get user number of user running us
	HRROI A,VERWHO		; Into string space for user who compiled
	DIRST%			; Copy user name
	 SETZM VERWHO		; Failed, clear out
	HRROI A,VERHST		; Into host name of compiler
	CALL $GTLCL		; Get local host name
	 SETZM VERHST		; If couldn't, clear it out
	HRROI A,VERHST		; Point to name again
	CALL $RMREL		; Remove ugly # domains
	SETZ FX,		; Initialize free pages
	TYPE <
Address Space:

PSECT	  Start	   End	 Length	  Free	Limit
>
	PRPSC (CODE,GDATA)
	PRPSC (GDATA,DATA)
	PRPSC (DATA,DATPAG)
	MOVE B,FX
	PRPSC (DATPAG,,777777)
	TYPE <

There are %2O (octal) free pages.
Saving as >

	PCLEAR (DATA,[.FHSLF])	; Clear local word storage.
	PCLEAR (GDATA,[.FHSLF])	; Clear global word storage.
	PCLEAR (DATPAG,[.FHSLF]) ; Clear local page storage.

	MOVEI A,.FHSLF		; On ourself
	MOVE B,[XWD EVECL,EVEC]
	SEVEC%			; Set entry vector
	MOVX A,GJ%FOU+GJ%SHT	; Get next version of file to save
	HRROI B,SAVNAM		; Get name to save as from main module
	GTJFN%			; Get JFN on it
	 0			; Error -- handle right one of these days
	MOVE B,A		; Copy JFN for JFNS
	MOVEI A,.PRIOU		; To terminal
	SETZ C,			; Standard format
	JFNS%			; Type name of file we're saving in
	MOVE A,B		; With the JFN
	HRLI A,.FHSLF		; From ourself
	MOVX B,FLD(-777,SS%NNP)!SS%RD!SS%WR!SS%EXE
	SETZ C,
	SSAVE%			; Save image
	TYPE < [OK]
>				; Finish message
	HALTF%			; All done
	JRST .-1


;Octal number printing routine

OCTOUC:	TYPE <	>		; Tab after last field
	MOVX C,NO%LFL!FLD(7,NO%COL)!FLD(8,NO%RDX)
	MOVEI A,.PRIOU		; Primary output
	NOUT%			; Send it off
	 JFCL
	RET

;Get final values for PSECT locations

	LIT			; Dump literals first
	PEND <CODE,DATA,DATPAG,GDATA>

	END