Trailing-Edge
-
PDP-10 Archives
-
tops10_tools_bb-fp64b-sb
-
10,7/who/whostr.mac
There are 3 other files named whostr.mac in the archive. Click here to see a list.
TITLE STRSCN - STRUCTURE mode scan defaulting for WHO
SEARCH WHOMAC
$SETUP (STRSCN)
Comment |
This module provides the STRUCTURE mode specific scan defaulting code. Its
only entry point is STRSCN.
|
; TABLE OF CONTENTS FOR STRSCN
;
;
; SECTION PAGE
; 1. STRSCN - Apply STRUCTURE mode specific scan input defaults 3
; 2. Storage................................................... 4
SUBTTL STRSCN - Apply STRUCTURE mode specific scan input defaults
;This routine applies the following defaults to the command line
;
STRSCN::SKIPE .FXEXT(I) ;INSURE NO EXTENSION
$FATAL (EIC,<Extension illegal in this context>)
; Check for STR:
MOVX T1,FX.NDV ;AND THE NULL DEVICE BIT
TDNE T1,.FXMOD(I) ;DEVICE SPECIFIED?
JRST STRSC1 ;NO
SKIPE .FXNAM(I) ;IS THE FILENAME WORD NON-ZERO?
$FATAL (MSG,<Multiple structure names given>)
MOVE T1,.FXDEV(I) ;GET DEVICE NAME
PUSHJ P,STRMSK ;GENERATE A MASK
JRST STRSC4 ;ENTER COMMON CODE
; Check for STR or #nn
STRSC1: SKIPN T1,.FXNAM(I) ;GET STR NAME FROM FILE NAME WORD
JRST STRSC3 ;THERE ISN'T ONE
TLNE T1,(77B5) ;AND IS THE FIRST CHARACTER BLANK?
JRST STRSC2 ;NO--GO CHECK OUT THE MASK
MOVSS T1 ;POSITION STRUCTURE NUMBER
PUSHJ P,STRFSN## ;CONVERT TO STR NAME
$FATAL (ISN,<Illegal structure number>)
MOVEM T1,.FXNAM(I) ;UPDATE NAME
SETOM .FXNMM(I) ;NO WILDCARDS, IMPLIED OR EXPLICITE
JRST STRSC4 ;FINISH UP
STRSC2: MOVE T2,.FXNMM(I) ;GET MASK
CAMN T2,[EXP -1] ;NEED TO FIX IT UP?
PUSHJ P,STRMSK ;YES--GENERATE NEW MASK
JRST STRSC4 ;ONWARD
; Check for /STRUCTURE
STRSC3: SKIPN T1,.FZSTN##(I) ;GET NAME FROM SWITCH ARGUMENT
JRST STRSC4 ;NONE GIVEN
MOVE T2,.FZSTM##(I) ;GET MASK
MOVEM T2,.FXNMM(I) ;STORE
CAMN T2,[EXP -1] ;WILDCARDS SPECIFIED?
PUSHJ P,STRMSK ;GENERATE A MASK
; Here to check for conflicts
STRSC4: CHKSWT (STN,STRUCTURE) ;CHECK FOR CONFLICTS
MOVE T1,.FXNMM(I) ;GET NAME MASK
MOVEM T1,.FZSTM##(I) ;STORE AS STRUCTURE MASK
POPJ P, ;AND RETURN
; Here to generate a mask based on the structure name
STRMSK: MOVEM T1,.FXNAM(I) ;UPDATE STR NAME
SETZ T2, ;CLEAR NEW MASK
EXCH T1,T2 ;GET STR NAME
MOVEI T3,6 ;LOOP FOR 6 CHARACTERS
STRMS1: LSHC T1,6 ;SHIFT IN A CHARACTER
TRON T1,77 ;MASK CHARACTER
TRZ T1,77 ;ELSE MAKE IT LOOK WILD
SOJG T3,STRMS1 ;LOOP
MOVEM T1,.FXNMM(I) ;STORE IT
MOVE T1,.FXNAM(I) ;RELOAD THE NAME
POPJ P, ;RETURN
SUBTTL Storage
$LOW
PRGEND
TITLE STRGET - Get STRUCTURE information
SEARCH WHOMAC
$SETUP (STRGET)
; TABLE OF CONTENTS FOR STRGET
;
;
; SECTION PAGE
; 1. Main STRUCTURE routines
; 1.1 STRNXT - Get the next structure................... 3
; 1.2 STRSET - Setup for a new structure................ 4
; 1.3 STRINC - Handle incremental statistics............ 5
; 1.4 STRSRT - Handle structure sorting................. 6
; 2. STRUCTURE tables
; 2.1 Define all structure subfields.................... 7
; 3. DATA STORAGE.............................................. 12
SUBTTL Main STRUCTURE routines -- STRNXT - Get the next structure
STRNXT::JUMPL O,STRNX1 ;JUMP IF THE FIRST TIME
SKIPL S.SORT## ;SEE IF /SORT
JRST SRTNXT ;YES--GET NEXT STR
ADDI O,1 ;NO--BUMP TO NEXT
CAMLE O,MAXSTR ;SEE IF PAST END
POPJ P, ;YES--RETURN
JRST STRNX2 ;NO--SETUP FOR THIS STR
STRNX1: MOVEI T1,^D36 ;MAX STRUCTURE NUMBER
MOVEM T1,MAXSTR ;SAVE
MOVEI T1,^D10 ;SET A HASH TABLE LENGTH
MOVEI T2,^D2 ;AND SIZE OF ENTRY
PUSHJ P,.HASHI## ;INIT IT
MOVEI O,1 ;START WITH STRCTURE 1
SKIPL T1,S.SORT## ;GET /SORT
JRST STRSRT ;GO PROCESS IF GIVEN
STRNX2: PUSHJ P,STRSET ;SETUP FOR THIS STRUCTURE
JRST STRNXT ;NOT ASSIGNED
JRST .POPJ1## ;AND RETURN
SUBTTL Main STRUCTURE routines -- STRSET - Setup for a new structure
STRSET::SKIPE JP,STRCOR ;SEE IF CORE ALLOCATED YET
JRST STRS.C ;YES
MOVEI T1,.SBLEN ;NO--GET SIZE
PUSHJ P,M$ALLOC## ;GET CORE
MOVEM T1,STRCOR ;SAVE STARTING ADDRESS
MOVEI JP,(T1) ;AND INTO JP
STRS.C: HRLI T1,(JP) ;GET STARTING ADDRESS
HRRI T1,1(JP) ;ENDING ADDRESS
SETOM (JP) ;SET FIRST WORD TO -1
BLT T1,.SBLEN-1(JP) ;AND SET THEM ALL TO -1
MOVEI T1,(O) ;GET STRUCTURE
PJRST STRFSN## ;CONVERT FS NUM TO STR NAME AND RETURN
SUBTTL Main STRUCTURE routines -- STRINC - Handle incremental statistics
STRINC::
STRINJ: POPJ P, ;NONE FOR NOW
SUBTTL Main STRUCTURE routines -- STRSRT - Handle structure sorting
STRSRT: PUSHJ P,.SAVE1## ;SAVE P1
MOVEI P1,(T1) ;SAVE SORT INDEX
MOVE T1,MAXSTR ;GET MAX STRS
IMULI T1,2 ;2 WORD TABLE
MOVN T2,T1 ;NEGATE INTO T2
HRLZM T2,SRTTAB ;SAVE -N,,0
PUSHJ P,I$ALLOC## ;GET THE CORE
HRRM T1,SRTTAB ;SAVE START
SRTJ.1: PUSHJ P,STRSET ;SETUP FOR THIS STRUCTURE
JRST SRTJ.2 ;NOT ASSIGNED
PUSHJ P,@SUMLOD##(P1) ;GET SORT KEY
MOVEI T2,-1(O) ;GET STRUCTURE
IMULI T2,2 ;DOUBLE
ADD T2,SRTTAB ;PLUS START OF TABLE
MOVEM T1,(T2) ;SAVE SORT KEY FIELD
MOVEM O,1(T2) ;SAVE STRUCTURE NUMBER
SRTJ.2: ADDI O,1 ;BUMP TO NEXT STRUCTURE
CAMG O,MAXSTR ;ALL DONE?
JRST SRTJ.1 ;NO--ADVANCE TO NEXT
MOVE T1,SRTTAB ;GET AOBJN WORD
MOVE T2,[400000,,2] ;UNSIGNED AND STRAIGHT SORT
SKIPLE S.SORT##+1 ;SEE IF DESCENDING
TLO T2,200000 ;YES-SET FLAG
PUSHJ P,.SORT2## ;SORT THE LIST
MOVE T1,SRTTAB ;GET AOBJN
MOVEM T1,SRTPTR ;SAVE
SETZM SRTCNT ;NO STRUCTURES YET
JRST STRNXT ;AND BACK TO THE TOP
SRTNXT: SKIPL T1,SRTPTR ;GET POINTER
POPJ P, ;ALL DONE
SKIPN O,1(T1) ;GET STR NUMBER
JRST STRS.1 ;NONE
PUSHJ P,STRSET ;SETUP FOR THIS STRUCTURE
JRST STRS.1 ;NOT ASSIGNED NOW?
AOS T1,SRTCNT ;COUNT THE STRUCTURES
CAMLE T1,S.SORT##+2 ;IN RANGE?
POPJ P, ;NO--STOP NOW
MOVE T1,[2,,2] ;ADVANCE POINTER
ADDM T1,SRTPTR ;TO NEXT PAIR
JRST .POPJ1## ;AND USE THAT J
STRS.1: MOVE T1,[2,,2] ;ADVANCE POINTER
ADDM T1,SRTPTR ;TO NEXT PAIR
JRST SRTNXT ;AND GET NEXT
SUBTTL STRUCTURE tables -- Define all structure subfields
; This macro fetches a sub-field about the structure. If the field has been
; gotten before, it simply returns the known field. If the field has
; not been gotten before, it it derived/computed, stored for later
; use, and returned.
;
; In all cases, the field will be returned in T1, and set in table
; .SBxxx (flag SB%xxx indicates if the field has been gotten)
DEFINE SB$(X,N<1>),<
XLIST
SB%'X==.SBLEN ;;FLAG WORD
.SB'X==.SBLEN+1 ;;DATA WORD
.SBLEN==.SBLEN+2
IFG N-1,.SBLEN==.SBLEN+N
SB$'X:: AOSN SB%'X(JP) ;;DO WE HAVE THE INFO?
JRST SB1'X ;;NO--GO GET IT
MOVE T1,.SB'X(JP) ;;YES--JUST GET IT NOW
POPJ P, ;;AND RETURN
SB1'X: ;;(HERE TO GET INFO)
DEFINE END$,<
XLIST
MOVEM T1,.SB'X(JP) ;STORE
POPJ P, ;AND RETURN
LIST
>
LIST
>;END DEFINE
.SBLEN==0
SB$(STN) ;STRUCTURE NAME
MOVEI T1,(O) ;GET FS NUMBER
PUSHJ P,STRFSN## ;CONVERT TO STR NAME
MOVEI T1,0 ;NO SUCH STR
END$
SB$(FSN) ;FILE STRUCTURE NUMBER
MOVEI T1,(O) ;GET FS NUMBER
END$
SB$(MTC) ;MOUNT COUNT
PUSHJ P,SB$DCH ;GET DISK CHARACTERISTICS
MOVE T1,.DCSMT(T1) ;GET MOUNT COUNT
END$
SB$(SAJ) ;SINGLE ACCESS JOB NUMBER
PUSHJ P,SB$DCH ;GET DISK CHARACTERISTICS
SKIPG T1,.DCSAJ(T1) ;GET SINGLE ACCESS JOB NUMBER
MOVEI T1,0 ;NOT SINGLE ACCESS
END$
SB$(FRE) ;FIRST-COME, FIRST-SERVED BLOCKS AVAILABLE TO ALL USERS
PUSHJ P,SB$DCH ;GET DISK CHARACTERISTICS
MOVE T1,.DCFCT(T1) ;GET BLOCKS FREE
END$
SB$(OWN) ;OWNER PPN
PUSHJ P,SB$DCH ;GET DISK CHARACTERISTICS
MOVE T1,.DCOWN(T1) ;GET OWNER PPN
END$
SB$(DCH,.DCMAX+2) ;DISK CHARACTERISTICS BLOCK
PUSHJ P,SB$STN ;GET STR NAME
MOVEM T1,.SBDCH+2+.DCNAM(JP) ;SAVE IN ARG BLOCK
MOVSI T1,.DCMAX ;ARG BLOCK LENGTH
HRRI T1,.SBDCH+2(JP) ;ARG BLOCK ADDRESS
PUSHJ P,UDSKCHR## ;GET DISK CHARACTERISTICS
TDZA T1,T1 ;FAILED FOR SOME REASON
MOVEM T1,.SBDCH+1(JP) ;SAVE STUFF RETURNED IN THE AC
MOVEI T1,.SBDCH+2(JP) ;POINT TO DSKCHR BLOCK
END$
SUBTTL DATA STORAGE
$LOW
STRCOR::BLOCK 1
MAXSTR: BLOCK 1
SRTTAB: BLOCK 1
SRTPTR: BLOCK 1
SRTCNT: BLOCK 1
END