source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DDBRAP.m@ 949

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

initial load of WorldVistAEHR

File size: 4.5 KB
RevLine 
[613]1DDBRAP ;SFISC/DCL-BROWSER WP ANCHOR PROCESSOR ;NOV 04, 1996@13:53
2 ;;22.0;VA FileMan;;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5WP(DDBROOT,DDBRFLG,DDBRTLE) ;
6 ;Pass existing wp root, flag=c/clear all -indexes, title
7 I $G(DDBROOT)="" Q
8 I '$D(@DDBROOT) Q
9 S DDBROOT=$NA(@DDBROOT),DDBRFLG=$G(DDBRFLG),DDBRTLE=$G(DDBRTLE)
10 N DDBRINDX,DDBRSUB,DDBRSUBL,DDBNROOT,DDBSROOT,DDBAXRT,DDBRCHK,DDBRCHK1
11 N DDBRSX,DDBRSXL,DDBRI,DDBRSXP,DDBRX,DDBRTLER
12 S DDBRINDX=0,DDBNROOT=$$NROOT(DDBROOT),DDBAXRT=$NA(@DDBNROOT@("A")),DDBRCHK1=0
13 Q:DDBNROOT=""!(DDBAXRT="")
14 K @DDBAXRT
15 F S DDBRINDX=$O(@DDBROOT@(DDBRINDX)),DDBRCHK=1 Q:DDBRINDX'>0 D:$L($G(@DDBROOT@(DDBRINDX,0)),"$.$")>1 I DDBRCHK,$L($G(@DDBROOT@(DDBRINDX)),"$.$")>1 S DDBRCHK1=1 D
16 .S DDBRCHK=0
17 .I DDBRCHK1 S DDBRSX=@DDBROOT@(DDBRINDX),DDBRSXL=$L(DDBRSX,"$.$")
18 .E S DDBRSX=@DDBROOT@(DDBRINDX,0),DDBRSXL=$L(DDBRSX,"$.$")
19 .F DDBRI=2:2:DDBRSXL S DDBRSXP=$P(DDBRSX,"$.$",DDBRI) S:'$D(@DDBAXRT@(DDBRSXP)) @DDBAXRT@(DDBRSXP)=DDBRINDX
20 .Q
21 S DDBRX=""
22 I DDBRTLE]"" D
23 .I '$D(@DDBNROOT@("TITLE")) S @DDBNROOT@("TITLE")=DDBRTLE
24 .Q
25 I $G(@DDBNROOT@("TITLE"))']"" D
26 .Q:$$QL(DDBROOT)'>1
27 .S DDBRTLER=$NA(@DDBROOT,$$QL(DDBROOT)-1)
28 .S DDBRTLE=$P($G(@DDBRTLER@(0)),"^")
29 .I DDBRTLE]"" S @DDBNROOT@("TITLE")=DDBRTLE Q
30 .Q
31 S @DDBNROOT@("DATE")=$H
32 Q
33 ;
34NROOT(DDBROOT) ; *FUNCTION* return new (negative) root for wp field X-REF
35 ;Q $NA(@DDBROOT@(.001)) ;tested ok
36 Q $NA(@DDBROOT@(-1)) ;tested ok and in use
37 ;Q $NA(@DDBROOT@(0,0)) ;tested ok
38 ;
39BINDEX(DDBROOT,DDBRNR,DDBRNRN) ; *FUNCTION* return "B" index root
40 N DDBRSUBL,DDBSROOT
41 S DDBRSUBL=$$QL(DDBROOT)
42 Q:DDBRSUBL'>1 ""
43 S DDBSROOT=$NA(@DDBROOT,(DDBRSUBL-2))
44 S DDBRNR=DDBSROOT,DDBRNRN=$$QS(DDBROOT,DDBRSUBL)
45 Q $NA(@DDBSROOT@("B"))
46 ;
47IENROOT(DDBROOT,DDBRLEV) ;pass root,.variable~by reference to return
48 ; $qs(ddbroot,$ql(ddbroot))~
49 N DDBRSUBL,DDBSROOT
50 S DDBRSUBL=$$QL(DDBROOT)
51 Q:DDBRSUBL'>1 ""
52 S DDBRLEV=$$QS(DDBROOT,DDBRSUBL)
53 Q $NA(@DDBROOT,(DDBRSUBL-2))
54 ;
55EN ;create anchors and jumps on existing wp entry
56 N DDBC,DDBFLG,DDBL,DDBPMSG,DDBSA,DDBX,IOTM,IOBM
57 I '$$TEST^DDBRT W $C(7),!!,"This terminal does not support scroll region or reverse index",!! Q
58 D LIST^DDBR3(.DDBX)
59 I DDBX'>0 W:DDBX=0 $C(7),!!,"No Text",!! Q
60 S DDBSA=DDBX(6)
61 S DDBFLG=DDBX(4)
62 S DDBPMSG=DDBX(5)
63 W !,"...compiling anchors and hypertext jumps..."
64 D WP(DDBSA,$G(DDBRFLG),DDBPMSG)
65 W !,"done!",!
66 Q
67 ;
68ENP ;create anchors & jumps and 'P'urge non-referenced jumps
69 N DDBRFLG
70 S DDBRFLG="P"
71 G EN
72 ;
73ENC ;create anchors and jumps and "C"lear out all jumps prior to building
74 N DDBRFLG
75 S DDBRFLG="C"
76 G EN
77 ;
78 ; THE FOLLOWING CODE WAS COPIED FROM KERNEL'S XLFUTL ROUTINE
79QL(X) ;$QLENGTH OF GLOBAL STRING
80 N %,%1
81 S %1="" F %=0:1 Q:%1=$NA(@X,%) S %1=$NA(@X,%)
82 Q %-1
83 ;
84QS(X1,X2) ;$QSUBSCRIPT OF GLOBAL STRING
85 N %,%1,Y
86 I X2=-1,X1?1"^"1"[".E1"]".E Q $TR($P($P($NA(@X1,0),"]"),"[",2),"""")
87 I X2=-1,X1?1"^"1"|".E1"|".E Q $TR($P($NA(@X1,0),"|",2,$L($NA(@X1,0),"|")-1),"""")
88 I X2=0,(X1'?1"^"1"[".E)&(X1'?1"^"1"|".E) Q $NA(@X1,X2)
89 I X2=0,X1?1"^"1"[".E1"]".E Q "^"_$P($NA(@X1,X2),"]",2,999)
90 I X2=0,X1?1"^"1"|".E Q "^"_$P($NA(@X1,X2),"|",$L($NA(@X1,X2),"|"))
91 S %1=$NA(@X1,X2-1)
92 I $E(%1,$L(%1))=")" S %1=$E(%1,1,$L(%1)-1)
93 S Y=$P($NA(@X1,X2),%1,2,999),Y=$E(Y,1,$L(Y)-1)
94 I X2=1,$E(Y)="(" S Y=$E(Y,2,999)
95 I X2>1,$E(Y)="," S Y=$E(Y,2,999)
96 I $A(Y)=34,$A(Y,$L(Y))=34 S Y=$E(Y,2,$L(Y)-1)
97 Q Y
98 ;
99GETR(DDBRWPDD,DDBRENS,DDBRFLG) ;return root
100 ;pass Word-processing DD#, entries (external format)[separated by(:)]
101 ;ie.999008.02,ENTRYONE:SUBENTRY)
102 ;
103 N DDBRA,DDBROOT,DDBREL,DDBRLVLS,DDBRI,DDBREN,DDBRIEN,DDBRDA,DDBRX,DDBRDD,DDBREEN,X,Y
104 Q:'$$UP^DIQGU(DDBRWPDD,.DDBRA)
105 S DDBREL=$L(DDBRENS,":"),DDBRLVLS=$O(DDBRA("")),DDBREN=1,DDBRIEN=","
106 I $G(DDBRFLG)'["I",$G(DUZ(0))'="@" D Q:$G(DIERR) ""
107 .N DIFILE,DIAC,%
108 .S DIFILE=+DDBRA(DDBRLVLS),DIAC="RD"
109 .D ^DIAC
110 .Q:%
111 .D ERR("Read access denied, for file #"_DIFILE)
112 .Q
113 I ("-"_DDBREL)'=DDBRLVLS Q ""
114 F DDBRI=DDBRLVLS:1:-1 D Q:$G(DIERR)
115 .S DDBRDD=+DDBRA(DDBRI),DDBREEN=$P(DDBRENS,":",DDBREN),DDBREN=DDBREN+1
116 .D DA^DILF(DDBRIEN,.DDBRDA)
117 .S DDBRIEN=","_+$$DIC($$ROOT^DILFD(DDBRDD,DDBRIEN),DDBREEN,.DDBRDA)_DDBRIEN
118 .Q
119 I $G(DIERR) K DIERR,^TMP("DIERR",$J) Q ""
120 S DDBRX=$$GET^DIQG(+DDBRA(-1),$P(DDBRIEN,",",2,99),$O(^DD(+DDBRA(-1),"SB",+DDBRA(0),"")),"B")
121 I $G(DIERR) K DIERR,^TMP("DIERR",$J) Q ""
122 Q $P(DDBRX,"$CREF$",2)
123 ;
124DIC(DIC,X,DA) ;dic call for exaxt match
125 Q:DIC=""!(X="") ""
126 S DIC(0)="X" S:$E(X)="`" DIC(0)="N"
127 D ^DIC
128 Q $G(Y)
129 ;
130ERR(DDBERR) N P S P(1)=DDBERR
131 I $G(U)="^" N U S U="^"
132 D BLD^DIALOG(1700,.P)
133 Q
Note: See TracBrowser for help on using the repository browser.