source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/ZTP1.m@ 1336

Last change on this file since 1336 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1%ZTP1 ;SF/RWF - PRINTS 1ST LINES IN SIZE OR DATE ORDER ;04/12/2007
2 ;;7.3;TOOLKIT;**20,70,91,105**;Apr 25, 1995;Build 2
3A W !!,"PRINTS FIRST LINES",!!
4 K ^UTILITY($J) S DTIME=$G(DTIME,300)
5 X ^%ZOSF("RSEL") G KIL:$O(^UTILITY($J,0))=""
6A1 ;
7 N ZTP1,Z2,X
8A2 R !,"(A)lpha, (D)ate ,(P)atched, OR (S)ize ORDER: A//",ZTP1:DTIME
9 S:ZTP1="" ZTP1="A" S ZTP1=$E(ZTP1,1) G KIL:ZTP1="^",A2:"ADPS"'[ZTP1
10 S Z2=$S(ZTP1="P":"2",1:"None")
11A3 W !,"Include line (2), Include lines 2&(3), (N)one: ",Z2,"//" R X:DTIME
12 S X=$TR(X,"n","N")
13 G KIL:X["^"!('$T) S:X="" X=Z2 G A3:"23N"'[$E(X) S Z2=+X
14 S %ZIS="QM" D ^%ZIS G KIL:POP
15 I $D(IO("Q")) D D ^%ZISC Q
16 . K IO("Q") S ZTRTN="B^%ZTP1",ZTSAVE("ZTP1")="",ZTSAVE("^UTILITY($J,")="",ZTSAVE("Z2")="",ZTDESC="FIRST LINES PRINT"
17 . D ^%ZTLOAD K ZTSK Q
18 ;Set RN for all loops
19B ;Taskman entry point
20 N %L,%R,%ZN,A,B,C,HED,JR,S,X,Y,ZTP,ZP,RN
21 S RN=2 G DATE:ZTP1="D",SIZE:ZTP1="S",PATCH:ZTP1="P"
22 ;
23ALPHA F JP=1:1 S RN=$O(^UTILITY($J,RN)) Q:RN="" S ^UTILITY($J,1,JP,RN)=0
24 S HED=" FIRST LINE LIST:"
25 G LIST
26 ;
27SIZE ;Sort by routine size
28 F JR=1:1 S RN=$O(^UTILITY($J,RN)) Q:RN="" D
29 . D LOAD(RN)
30 . S Y=$$SIZE2 W RN," ",Y,?$X\19+1*19
31 . D KEEP(Y,RN) W:$X>66 !
32 S HED=" SIZE RANKING:"
33 G LIST
34 ;
35LOAD(X,R) ;Load routine
36 N DIF,XCNP K ^TMP($J)
37 S DIF="^TMP($J,",XCNP=0 X ^%ZOSF("LOAD")
38 I $D(R) S R(1)=$G(^TMP($J,1,0)),R(2)=$G(^TMP($J,2,0)),R(3)=$G(^TMP($J,3,0))
39 Q
40 ;
41KEEP(IX1,IX2) ;
42 S ^UTILITY($J,1,IX1,IX2)=2
43 S ^UTILITY($J,1,IX1,IX2,1)=^TMP($J,1,0),^UTILITY($J,1,IX1,IX2,2)=^TMP($J,2,0),^UTILITY($J,1,IX1,IX2,3)=$G(^TMP($J,3,0))
44 Q
45 ;
46LIST ;All 3 sorts come here to print the list.
47 N %X,QUIT,L,L1,L2,S,PL,X
48 S PL=IOSL-3-Z2,X=$H X ^%ZOSF("ZD")
49 S HED=Y_" "_HED X ^%ZOSF("UCI") S HED=Y_" "_HED
50 U IO D HED
51 S ZP=0,X=0,QUIT=0,S=0
52 F S S=$O(^UTILITY($J,1,S)),RN="" Q:(S'>0)!(QUIT) D
53 . F S RN=$O(^UTILITY($J,1,S,RN)) Q:'$L(RN)!QUIT D
54 . . D:$Y>PL WAIT I X["^" S RN="zz",QUIT=1,S=" " Q
55 . . S ZP=ZP+1 D L2
56 I 'QUIT W !!?14,ZP," ROUTINES",!
57KIL D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
58 K ^UTILITY($J)
59 Q
60 ;
61L2 ;Write one
62 N LI
63 I ^UTILITY($J,1,S,RN) S LI(1)=^(RN,1),LI(2)=^(2),LI(3)=^(3)
64 I '$T S LI=0 D LOAD(RN,.LI) S LI(1)=$P(LI(1)," ",2,999)
65 W RN,?10 W:ZTP1="S" $J(S,4)," - " S %X=$X-1 D WR(LI(1))
66 I Z2 W ?%X D WR(LI(2)) I Z2>2 W ?%X D WR(LI(3)):Z2>2
67 Q
68 ;
69WR(STR) ;Write line w/ wrap
70 N %1,%2
71 S %1=$X+1,%2=IOM-1-%1
72 F W $E(STR,1,%2) S STR=$E(STR,%2+1,9999) Q:'$L(STR) W !,?%1
73 W:$X>0 !
74 Q
75 ;
76WAIT ;Wait at end of page
77 I IOST["C-" R !,"Enter Return to continue ",X:DTIME Q:X["^"
78HED W @IOF,!?8,HED,! Q
79 ;
80DATE ;Sort by date
81 F JR=1:1 S RN=$O(^UTILITY($J,RN)) Q:RN="" D
82 . N L S L=0 D LOAD(RN,.L)
83 . S X=$$DTF(L(1)) D KEEP(9999999-X,RN)
84 . W RN," ",Y,?$X\19+1*19 W:$X>66 !
85 . Q
86 S HED=" REVERSE DATE ORDER:"
87 G LIST
88DTF(L) ;Find the date
89 N %,PC,%DT,B,S
90 F PC=2:1:$L(L,";") S B=1,X=$P(L,";",PC) D Q:Y>0
91 . S Y=-1,%DT="T"
92 . S:X?.E1"["1.2N1"/"1.2N1"/"2N1" "1.2N1":"1.2N.E1"] ".E X=$P($P(X,"[",2),"]",1)
93 . F %=1:1:$L(X) D Q:Y>0
94 . . S S=$E(X,%)?1P S:B&S X=$E(X,1,%-1)_$E(X,%+1,999),%=%-1
95 . . S:'S B=0 S:$E(X,%+1,999)?1N.N1":".E X=$E(X,1,%-1)_"@"_$E(X,%+1,999),%=999
96 . . I %>$L(X) N % D ^%DT
97 . . Q
98 . Q
99 Q Y
100 ;,X=$P(ZTP,"" ;"",3) X A(1) S B=1,X=$P(ZTP,"";"",4) X:Y<0 A(1)
101 ;
102PATCH ;Sort by first patch number
103 N S2
104 F S2=0:0 S RN=$O(^UTILITY($J,RN)) Q:RN="" D
105 . N L S L=0 D LOAD(RN,.L)
106 . S X=$P(L(2),";",5) I X]"" S S=+$P(X,"**",2) D KEEP(S,RN)
107 S HED=" Patched routines"
108 G LIST
109 ;
110SIZE2() ; Return size in bytes of routine in ^TMP($J)
111 N NUM,LINE,SIZE ; line number, line text, size
112 S SIZE=0
113 F NUM=1:1 S LINE=$G(^TMP($J,NUM,0)) Q:LINE="" S SIZE=SIZE+$L(LINE)+2
114 Q SIZE
115 ;
116BUILD ;
117 N Y,BLDA,%N,S2
118 I '$D(^XPD(9.6,0)) W !,"No BUILD file to work from." Q
119 S Y=$$BUILD^XTRUTL1 G KIL:Y'>0 S BLDA=+Y
120 D RTN^XTRUTL1(BLDA)
121 I '$D(^UTILITY($J)) W !,"No routines in this build." G KIL
122 G A1
123 ;
124POST ;POST-INIT
125 N %D,%S,I,SCR,ZTOS,ZTMODE
126 S ZTMODE=2,ZTOS=$$OS^ZTMGRSET()
127 S %S="ZTP1",%D="%ZTP1",SCR="I 1" D MOVE^ZTMGRSET
128 Q
Note: See TracBrowser for help on using the repository browser.