source: LSFind/tag/1.0/VWBFPFND.m@ 1803

Last change on this file since 1803 was 1803, checked in by Jim B., 6 years ago
File size: 3.2 KB
Line 
1VWBFPFND ;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 ;
17LL ;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 G ASK
31 ;
32X W !?5 F I=1:1:10 W !,$T(LL+I^VWBFPFND)
33 W !
34 Q
35 ;
36C R !,"String: ",MATCH:30
37 I WHERE="G1" G @WHERE
38 I '$L(MATCH) Q
39 E W !?10,"Searching for ",$S(WHAT="L":"LABEL ",1:"STRING "),""""_MATCH_"""" G @WHERE
40 ;
41A G @WHERE
42 ;
43ASK N WHAT,WHERE,ANS,R,X,I,J
44 ;D X
45A2 K %ZR,%ZG S ANS=""
46 W !,"Search in (G)lobal or (R)outine: R// " R WHICH:120 I WHICH="G" G GSRCH
47 W !!,"(L)abel only, (S)tring match in routine set?: " R WHAT:30 Q:'$L(WHAT)
48 S WHAT=$E($$UP^XLFSTR(WHAT),1)
49 S WHERE=$S(WHAT="L":"LAB",WHAT="S":"STR",WHAT="H":"HELP",1:"LAB")
50 S ANS="C"
51 S ANS=$E($$UP^XLFSTR(ANS),1)
52A3 D @ANS
53 G A2
54 ;
55LAB D ^%RSEL
56 Q:$D(%ZR)#11 ;No selection array
57 D ^%ZIS U IO
58 S R="" F S R=$O(%ZR(R)) Q:R="" D
59 . S MATCH=$S('$L($G(MATCH)):"",1:MATCH)
60 . F I=1:1 S X=$T(@R+I^@R) Q:X="" S LABEL=$P(X," ") I $L(LABEL) D
61 .. I ANS="A",MATCH="" S %ZR(R,$O(%ZR(R," "),-1)+1)=X Q
62 .. I ANS="C",X[MATCH S %ZR(R,$O(%ZR(R," "),-1)+1)=X Q
63 .. I ANS="E",X=MATCH S %ZR(R,$O(%ZR(R," "),-1)+1)=X Q
64 D WR,^%ZISC
65 Q
66 ;
67STR ;Strings in the code
68 I '$L(MATCH) W !?4,"Dude! No info!" Q
69 D ^%RSEL
70 Q:$D(%ZR)#11 ;No selection array
71 D ^%ZIS U IO
72 S R="" F S R=$O(%ZR(R)) Q:R="" D
73 . F I=1:1 S X=$T(@R+I^@R) Q:X="" D
74 .. F J=1:1:$L(X,MATCH) I X[MATCH S %ZR(R,$O(%ZR(" "),-1)+1)="+"_I_" ->"_X
75 D WR,^%ZISC
76 Q
77 ;
78WR ;Go through %ZR array and only print path/routine name
79 ; target...
80 W !,"Searching for ",MATCH
81 S R="" F S R=$O(%ZR(R)) Q:R="" D:$O(%ZR(R,0))
82 . W !,%ZR(R)_R
83 . S N=0 F S N=$O(%ZR(R,N)) Q:'+N W !?4,%ZR(R,N)
84 Q
85 ;
86 ;ROUTINE fini
87 ;
88GSRCH ;Global search for string
89 W !,"Search string in Globals"
90 R !,"Search for string: ",MATCH:30 Q:'$L(MATCH)
91 D CALL^%GSEL Q:$D(%ZG)#11
92G1 W !,"Searching for ",MATCH,"...working...."
93 S N="" F S N=$O(%ZG(N)) Q:N="" S X=N W "." D
94 . F S X=$Q(@X) Q:X="" I X[MATCH!(@X[MATCH) W !,X,"->",@X
95 . K %ZG(N)
96 K WHERE,N,X,%ZG,MATCH
97 Q
98 ;Global fini
99 ;
Note: See TracBrowser for help on using the repository browser.