1 | VWBFPFND ;WV/BFP/jBell Portland, OR display labels in routine(s) May 2016
|
---|
2 | ;;**LOCAL**
|
---|
3 | ;; This program is free software: you can redistribute it and/or modify
|
---|
4 | ;; it under the terms of the GNU General Public License as published by
|
---|
5 | ;; the Free Software Foundation, either version 3 of the License, or
|
---|
6 | ;; (at your option) any later version.
|
---|
7 | ;;
|
---|
8 | ;; This program is distributed in the hope that it will be useful,
|
---|
9 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
10 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
11 | ;; GNU General Public License for more details.
|
---|
12 | ;;
|
---|
13 | ;; You should have received a copy of the GNU General Public License
|
---|
14 | ;; along with this program. If not, see <http://www.gnu.org/licenses>
|
---|
15 | Q
|
---|
16 | ;
|
---|
17 | LL ;Find labels or strings
|
---|
18 | ;***********************************************************
|
---|
19 | ;*For gtm environs *
|
---|
20 | ;* After driving myself to Van Gogh level insanity trying *
|
---|
21 | ;* to remember line labels in only MY routines, or using *
|
---|
22 | ;* %RSE for string find and getting some several thousand *
|
---|
23 | ;* routine names AND being in a non-connective locale *
|
---|
24 | ;* (idyll fingers, etc, etc...) I finally did this routine *
|
---|
25 | ;* that will only list the targeted item in the routine *
|
---|
26 | ;* set. The immediate benefit: I still have 2 ears. *
|
---|
27 | ;***********************************************************
|
---|
28 | ;
|
---|
29 | Q
|
---|
30 | ;
|
---|
31 | X W !?5 F I=1:1:10 W !,$T(LL+I^VWBFPFND)
|
---|
32 | W !
|
---|
33 | Q
|
---|
34 | ;
|
---|
35 | C R !,"String: ",MATCH:30
|
---|
36 | I '$L(MATCH) Q
|
---|
37 | E W !?10,"Searching for ",$S(WHAT="L":"LABEL ",1:"STRING "),""""_MATCH_"""" G @WHERE
|
---|
38 | ;
|
---|
39 | A G @WHERE
|
---|
40 | ;
|
---|
41 | ASK N WHAT,WHERE,ANS,R,X,I,J
|
---|
42 | D X
|
---|
43 | A2 K %ZR S ANS=""
|
---|
44 | W !!,"(L)abel only, (S)tring match in routine set?: " R WHAT:30 Q:'$L(WHAT)
|
---|
45 | S WHAT=$E($$UP^XLFSTR(WHAT),1)
|
---|
46 | S WHERE=$S(WHAT="L":"LAB",WHAT="S":"STR",WHAT="H":"HELP",1:"LAB")
|
---|
47 | S ANS="C"
|
---|
48 | S ANS=$E($$UP^XLFSTR(ANS),1)
|
---|
49 | A3 D @ANS
|
---|
50 | G A2
|
---|
51 | ;
|
---|
52 | LAB D ^%RSEL
|
---|
53 | Q:$D(%ZR)#11 ;No selection array
|
---|
54 | D ^%ZIS U IO
|
---|
55 | S R="" F S R=$O(%ZR(R)) Q:R="" D
|
---|
56 | . S MATCH=$S('$L($G(MATCH)):"",1:MATCH)
|
---|
57 | . F I=1:1 S X=$T(@R+I^@R) Q:X="" S LABEL=$P(X," ") I $L(LABEL) D
|
---|
58 | .. I ANS="A",MATCH="" S %ZR(R,$O(%ZR(R," "),-1)+1)=X Q
|
---|
59 | .. I ANS="C",X[MATCH S %ZR(R,$O(%ZR(R," "),-1)+1)=X Q
|
---|
60 | .. I ANS="E",X=MATCH S %ZR(R,$O(%ZR(R," "),-1)+1)=X Q
|
---|
61 | D WR,^%ZISC
|
---|
62 | Q
|
---|
63 | ;
|
---|
64 | STR ;Strings in the code
|
---|
65 | I '$L(MATCH) W !?4,"Dude! No info!" Q
|
---|
66 | D ^%RSEL
|
---|
67 | Q:$D(%ZR)#11 ;No selection array
|
---|
68 | D ^%ZIS U IO
|
---|
69 | S R="" F S R=$O(%ZR(R)) Q:R="" D
|
---|
70 | . F I=1:1 S X=$T(@R+I^@R) Q:X="" D
|
---|
71 | .. F J=1:1:$L(X,MATCH) I X[MATCH S %ZR(R,$O(%ZR(" "),-1)+1)="+"_I_" ->"_X
|
---|
72 | D WR,^%ZISC
|
---|
73 | Q
|
---|
74 | ;
|
---|
75 | WR ;Go through %ZR array and only print path/routine name
|
---|
76 | ; target...
|
---|
77 | W !,"Searching for ",MATCH
|
---|
78 | S R="" F S R=$O(%ZR(R)) Q:R="" D:$O(%ZR(R,0))
|
---|
79 | . W !,%ZR(R)_R
|
---|
80 | . S N=0 F S N=$O(%ZR(R,N)) Q:'+N W !?4,%ZR(R,N)
|
---|
81 | Q
|
---|
82 | ;
|
---|
83 | ;fini
|
---|