Trailing-Edge - PDP-10 Archives - steco_19840320_1er_E35 - 10,5676/teco/macros/systec.tco
There is 1 other file named systec.tco in the archive. Click here to see a list.
!;  Stack the Q-regs we will need!  [F[K[O[A[B[C[D[J[N[P[S[T[Y[1[M
!;  Save old EO level and set EO level to 3!  EOU1 0EO EO-4"EEVMODE$UM EVOFF$' 3EO
!;  Skip help text! OSTART$
!TYPE!^Aelp for SYSTAT TECO macro, type one of the following:
<CR>	Only non-OPR jobs
O<CR>	All jobs
NN<CR>	Only job number NN
H	Type this help text
!;  Come here to get command!
!;  Preload K with [1,2]! ^O1000002UK
!;  Prompt for command! ^AYes master? ^A
!;  Clear O to use for command parsing! 0UO
!;  Loop getting characters for command! <
!;  Get a character into A! ^TUA
!;  Check for "H", if we got it store 99999 into A and exit loop! QA-^^H"E99999UA0;'
!;  Check for <CR>. If we get one, get the line feed also and exit! QA-13"E^TUA0;'
!;  Check for "O". If so, store 1,2 in O and 0 in K! ^^O-QA"E^O1000002UO0UK'
!;  Nothing matched so far, assume we have a number! QA-^^0UA
!;  If it is really a number, total up the digits in O and clear K! QA-10"LQO*10+QAUO0UK'
!;  End of input loop! >
!;  If we had a "H" go type the text and prompt again! QA-99999"EOTYPE$'
!;  Insert routine to type sixbit word into Q-reg T!
!;  First save the pointer in J! .UPJ
!;  Insert the text (allow control chars) !I^T
!;  This routine will type the sixbit word from Q-reg S!
!;  First store the value without the sign bit in A!QS&^O377777777777UA
!;  Repeat once for each of the last five chars! 5<
!;  Store the character in B and push B on the stack! QA&^O77UB [B
!;  Divide to get to next character and store back in A! QA/^O100UA
!;  End of per char loop! >
!;  Now check if original word had the sign bit on. If it did, turn on the bit
in A so the value is correct! QS"L QA#^O40UA'
!;  Push this char on the stack also! [A
!;  Loop once for each character (total of 6 times)! 6<
!;  Pop off the character, convert to ascii and type it! ]B:QB+^O40,1^R^T
!;  End of loop! >
!;  End the insert string and put into Q-reg T! $0,.XT0,.K
!;  Insert routine to type the time into Q-reg N! I^T
!;  This routine will type out a time from Q-reg A (in seconds)!
!;  Divide by 3600 to get number of hours into Q-reg B! QA/3600UB
!;  Check if we need a leading space to pad the hours! QB-10"L^A ^A'
!;  If no hours at all type two more spaces! QB"E^A  ^A'
!;  Clear C for a flag! 0UC
!;  If we have a number of hours, type the number then a colon! QB"N1UC^^:,QB='
!;  Store number of seconds into B then push it! QA-(QA/60*60)UB[B
!;  Make A the total number of minutes!
!;  Put the number of minutes into B! QA-(QA/60*60)UB
!;  Check if we had some hours! QC"N
!;  Flag we had some minutes also! 2UC
!;  Check if we need to pad the minutes field with a zero! QB-10"L0,0='
!; Type out the minutes then a colon! ^^:,QB='
!; Check if anything typed yet! QC"E
!; Check if minutes needs a leading space! QB-10"L^A ^A'
!; Or is zero and shouldn't be typed! QB"E^A  ^A'
!; If non-zero type it and a colon! QB"N^^:,QB=
!; and flag we did! 2UC''
!; Pop off the seconds and check if anything typed yet! ]B QC-2"E
!; Something typed, check if need a leading zero! QB-10"L0,0='
!; Type the seconds! 0,QB='
!; Check if typed yet! QC-2"N
!; Nothing typed, check for leading space! QB-10"L^A ^A'
!; And type last digit! 0,QB='
!; End the insert string and store into Q-reg N! $0,.XN 0,.K
!; Get the PTY offset for 'CTY and 'PTY into F!  18,9^G/^O1000000UF
!; Check if we want the header printed ! QO-^O1000002&QO"E
!; Clear O to say we want all jobs if it was 1,2!  QO-^O1000002"E0UO'
!; Start the header! ^AStatus of ^A
!; Clear A and loop once for each word of the system name! 0UA 5<
!; Get this word of the name into S! QA,9^GUS
!; Put the value shifted by -1 bit into B! QS&^O377777777777/2UB
!; Loop for the last 4 chars! 4<
!; Divide off a character into C and push it! QB-(QB/^O200*^O200)UC [C
!; Put remaining characters back in B! QB/^O200UB
!; End of per character loop! >
!; Check if sign bit was on in original word.!
!; If so, turn on the bit in the character.! QS"LQB#^O100UB'
!; Push the character and loop for all 5 chars! [B5<
!; Pop off a character and type it if not a null! ]B QB"N :QB,1^T'
!; End of per char loop! >
!; End of per word loop, increment the counter! %A>
!; continue the header ! ^A at ^A
!; Get the time and type it! ^H/60UA MN
!; Continue! ^A on ^A
!; Set up to figure the day of the week!
JIWednesday,Thursday, Friday,   Saturday, Sunday,   Monday,   Tuesday,
!; Get the date portion of the UDT into A! ^O53,9^G/^O1000000UA
!; Find the correct day of the week!  QA-(QA/7*7)*10UA QAJ
!; Save the start and find the end of the day! :S,$
!; Type the day and a space! QA,.T^A ^A
!; Delete the line of day names! JK
!; Get the day of the month and type it! ^O60,9^GUA ^^-,QA=
!; Put in the month names! JIJanFebMarAprMayJunJulAugSepOctNovDec$
!; Type the correct one and delete the names! ^O57,9^G-1*3J .,.+3T J 36D ^A-^A
!; Type the year! ^O56,9^G-1900US QS=
!; Type the uptime! ^AUptime: ^A 13,10^G/60UA MN
!; Type LOGNUM, etc.! ^A, ^A ^O54,9^GUA 32,QA=
^Ajobs logged in out of ^A 13,9^GUA ^^.,QA&^O777777-1= ^A
!; Clear J to run through jobs!  0UJ
!; Print the header!
^AJob      PPN      Where   What   State      Who       Runtime
^A' !; (end of conditional for header)!
!; Insert loop into Q-reg M!   JI^T
!; Loop for each job till highest logged in! 16,10^G<
!; If only one job wanted, force J to be correct!QO"GQO-1UJ'
!; Bump the job number and check if logged in!  %J,0^G&^O4000000"N
!; It's logged in, make sure it matches what we want!  QJ,2^G-QK"N
!; Need to do this one, type the job number!
!; checking for leading spaces!   QJ-100"L ^A ^A' QJ-10"L ^A ^A' 32,QJ=
!; Now the PPN (also padded)!
  QJ,2^GUS QS/^O1000000UB ^O100000UC
5<QB-QC"L ^A ^A' QC/^O10UC>
^^,,QB== 0,QS&^O777777== ^O100000UC
!; Pad after programmer! 5<QS&^O777777-QC"L ^A ^A' QC/^O10UC>
!; Print the terminal name! ^A ^A QJ^FUA QA"E ^Adet    ^A'
!; If attached keep only last 3 digits! QA"N  QA&^O777UA
!; Check if really the CTY! QF-1-QA"E^ACTY    ^A'
!; or just normal TTY! QF-1-QA"N QA-QF"L ^ATTY^A'
!; Or really a PTY! QA-QF+1"G QA-QFUA ^APTY^A'
!; Type the number and pad it! 32,QA== QA-^O100"L ^A ^A' QA-8"L ^A ^A'''
!; Print the program name!  QJ,3^GUS MT ^A  ^A
!; and the state! QJ,0^G&^O377777777/^O10000000UA
QA"E QJ,0^G"G ^A^C^A ONO^R$'' QA/3,21^GUB
QA-(QA/3*3)UA QA-2"E QB&^O7777UB' QA-1"E QB&^O77777777/^O10000UB' QA"E
:32+(QB/^O100),1^R^T :32+(QB-(QB/^O100*^O100)),1^R^T
!NO! QJ,12^G"L ^A+^A OST^R$' ^A ^A!ST!
!; Check it swapped! QJ,0^G&^O2000000000UA QA"E ^A    ^A' QA"N ^ASW  ^A'
!; Type the name!  QJ,^O31^GUS MT QJ,^O32^GUS MT
! and finally the runtime!  ^A ^A QJ,4^G/60UA MN ^A
!; Check for only one job and exit ! QO"G0;'
!; End of loop! >
!; Store in Q-reg Y kill from buffer and execute it! $ 0,.XY 0,.K MY
!; Reset the pointer! QPJ
!; Reset the EO level! 0EO EO-4"E QM"NEVON$'' Q1EO
!; and restore the Q-registers!  ]M]1]Y]T]S]P]N]J]D]C]B ]A]O]K]F
!; All done!