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

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

initial load of WorldVistAEHR

File size: 5.5 KB
Line 
1XQ73 ;SEA/MJM - Rubber Band Jump ("^^") Processor ;05/08/98 10:10
2 ;;8.0;KERNEL;**46**;Jul 10, 1995
3 ;Entry from XQ
4 ;With +XQY: target opt, XQY0: 0th node
5 ;with a pathway; XQ(XQ) array of alternate pathways, if any; XQDIC:
6 ;P-tree of target option; XQPSM: XQDIC or mutiple trees (U66,P258)
7 ;XQSV: XQY^XQDIC^XQY0 of origin (previous) option.
8 ;
9 ;Set the jump flag to indicate that this is a jump process
10 S XQJMP=1
11 ;
12 ;Set XQMA to the option from whence we came. XQNMB is set to a high
13 ;number which will count down and be used to save Exit Actions and
14 ;headers that are stored in ^XUTL("XQ", $J,"RBX")
15 ;
16 S XQMA=$P(XQSV,U,2),XQNMB=999
17 ;
18 ;If the "RBX" nodes already exist we know that we are already in a
19 ;rubber band jump. Set the flag XQFLG and save in XASAV the current
20 ;option, load the original rubberband jump, do RBX^XQ73 to execute
21 ;the stored exit actions and headers.
22 ;
23 I $D(^XUTL("XQ",$J,"RBX")) S XQFLG=1,XQSAV=XQY_U_XQPSM_U_XQY0,XQY=+^("RBX"),XQY0=$P(^("RBX"),U,2,99) D RBX S XQY=+XQSAV,XQPSM=$P(XQSAV,U,2),XQY0=$P(XQSAV,U,3,99) K XQFLG,XQSAV
24 ;
25 ;If the target option XQY is a sibling of XQMA then it's not really
26 ;a jump, so load it and return to XQ.
27 ;
28 I $D(^XUTL("XQO",XQMA,"^",+XQY)),($P(^(+XQY),U,6)=+XQY!($P(^(+XQY),U,6)="")) S XQY0=$P(^(+XQY),U,2,99) G M^XQ
29 ;
30 ;Set XQTT to the stack pointer and point XQST to the primary menu.
31 ;Set XQSM to 1 as a flag if this is a jump to a secondary menu.
32 ;Collect the current stack IEN's in XQSTK separated by commas.
33 ;
34 S XQTT=^XUTL("XQ",$J,"T"),XQST=1,XQSTK="",XQSM=$S($P(^(XQTT),U)["U":1,1:0) F XQI=1:1:XQTT S %=+^XUTL("XQ",$J,XQI),XQSTK=XQSTK_%_","
35 ;
36 ;If XQY, the target option, is already on the stack then back down
37 ;to it if we are not already in a RB jump.
38 ;
39 I (","_XQSTK)[(","_XQY_",") G:'$D(XQRB) NOJ^XQ72A
40 ;
41 ;Using XQFLAG as a flag, find XQDIC (the parent of the jump tree)
42 ;if there is a "U" then it must be a common option or a secondary
43 ;menu tree.
44 ;
45 S XQFLAG=0 I XQPSM["U" S XQFLAG=1,XQST=XQTT I XQPSM["," S XQDIC=$P(XQPSM,",",2)
46 ;
47 ;If there are multiple pathways find the shortest. If XQ comes back as
48 ;0, you can't get there from here.
49 ;
50 I $D(XQ),XQ>0 D MPW^XQ72 G:XQ<0 OUT
51 ;
52 ;Get the jump path in XQJP and set XQI to the stack pointer as it is
53 ;or was before the jump. Set XQI to the original stack pointer.
54 ;
55 S XQJP=$P(XQY0,U,5) S XQI=XQTT
56 ;
57 ;If this is a secondary menu jump put the parent option on the
58 ;beginning of the jump path.
59 ;
60 I XQPSM["," S XQJP=$P(XQPSM,"P",2)_","_XQJP ;Secondary menu tree
61 ;
62 ;If this is a common option put XUCOMMAND on the front of the jump
63 ;path.
64 ;
65 I XQPSM="PXU" S XQJP=$O(^DIC(19,"B","XUCOMMAND",0))_","_XQJP ;Common options
66 ;If we are jumping within the same tree, get the modified path (just
67 ;those options not already executed.
68 ;
69 ;I $D(^XUTL("XQO",XQDIC,U,XQY)) D SAMTREE^XQ72 S XQJP=$P(XQNP,U,2),XQY1=+XQNP
70 ;
71FND ;Pop to next Menu-type option, if in path remove options below it
72 S XQJP1=XQJP,XQI=XQTT+1,XQNP=$S($D(XQNP):XQNP,1:0)
73 F XQII=0:0 Q:+XQNP>0 S XQI=XQI-1 S XQY1=^XUTL("XQ",$J,XQI),XQT=$P(XQY1,U,5) Q:XQI=1 I "M"[XQT F XQJ=1:1:$L(XQJP,",")-1 I $P(XQJP,",",XQJ)=+XQY1 S XQNP=XQI_U_$P($E(XQJP,$F(XQJP,+XQY1),99),",",2,99) Q
74 ;
75 I +XQNP>0 D
76 .N XQSTP,XQJP2,XQDAD,XQI
77 .S XQSTP=+XQNP,XQJP2=$P(XQNP,U,2),XQDAD=+XQY1
78 .F XQI=XQTT:-1:XQSTP D
79 ..S %=+^XUTL("XQ",$J,XQI)
80 ..I $D(^DIC(19,%,26)),$L(^(26)) X ^(26) ;W " ==> FND^XQ73"
81 ..Q
82 .S XQJP=XQJP2
83 .Q
84 I '$L(XQJP) G M^XQ
85 F XQI=1:1 S XQYY=$P(XQJP,",",XQI) Q:XQYY=XQY!(XQYY="") S XQJ=^XUTL("XQO",XQDIC,"^",XQYY) D ACT Q:$D(XQUIT)
86 I '$D(XQUIT) S ^XUTL("XQ",$J,XQTT+1)=-1,^("T")=XQTT+1,^("RBX")=XQY_U_XQY0
87OUT ;Exit here
88 S:$D(XQ(XQY)) XQPSM=$P(XQ(XQY),U,3)
89 K %,X,XQ,XQA,XQAL,XQCH,XQFLAG,XQHD,XQI,XQII,XQJ,XQJP,XQJMP,XQJP1,XQL,XQK,XQMA,XQNO,XQNMB,XQNP,XQSM,XQST,XQSTK,XQT,XQTT,XQYY,XQY1,Y
90 ;K '$D(XQUIT) XQRB
91 ;Q:'$D(XQXFLG("GUI"))
92 I $D(XQUIT) K XQUIT G M1^XQ
93 G M^XQ
94 Q
95ACT ;Execute headers & entry actions, store headers & exit actions
96 I $P(XQJ,U,15),$D(^DIC(19,XQYY,20)),$L(^(20)) X ^(20) ;W " ==> ACT^XQ73"
97 I $D(XQUIT) D RB^XQUIT Q:$D(XQUIT)
98 S XQHD=0 I $P(XQJ,U,18),$D(^DIC(19,XQYY,26)),$L(^(26)) X ^(26) S XQHD=1 ;W " ==> ACT^XQ73" ;^XUTL("XQ",$J,"RBX",XQNMB)=^(26),XQNMB=XQNMB-1
99 I $P(XQJ,U,16),$D(^DIC(19,XQYY,15)),$L(^(15)) S ^XUTL("XQ",$J,"RBX",XQNMB)=^(15),XQNMB=XQNMB-1
100 I XQHD S ^XUTL("XQ",$J,"RBX",XQNMB)=^DIC(19,XQYY,26),XQNMB=XQNMB-1
101 Q
102 ;
103R ;Reset XUTL("XQ") stack pointer ^("T") to 1 (primary menu) 'GO HOME'
104 ;I $S('$D(^XUTL("XQ",$J,"XQM")):1,XQY=^("XQM"):1,1:0) G OUT
105 I ^XUTL("XQ",$J,"T")>1 F XQI=^("T"):-1:1 D
106 .S XQY=^XUTL("XQ",$J,XQI) D:+XQY<1 RBX S XQY0=$P(XQY,U,2,99) I XQI>1,$P(XQY0,U,15),$D(^DIC(19,+XQY,15)),$L(^(15)) X ^(15) ;W " ==> R+3^XQ73"
107 .S %=^XUTL("XQ",$J,XQI-1) I (XQI-1)>1,$P(%,U,18),$D(^DIC(19,+%,26)),$L(^(26)) X ^(26)
108 S (XQY,XQDIC)=^XUTL("XQ",$J,"XQM"),XQY0=$P(^(1),U,2,99),^("T")=1
109 S XQT=$P(XQY0,U,4)
110 K XQI,XQUR S XQM3=1
111 ;Q:$D(XQXFLG("GUI"))
112 G M^XQ
113 Q
114 ;
115RBX ;Execute stored exit actions to return from RB jump
116 I $P(XQY0,U,15),$D(^DIC(19,XQY,15)),$L(^(15)) X ^(15) ;W " ==> RBX+1^XQ73"
117 S XQN="" F XQJ=0:0 S XQN=$O(^XUTL("XQ",$J,"RBX",XQN)) Q:XQN="" X ^(XQN) ;W " ==> RBX^XQ73"
118 ;S ^("T")=^XUTL("XQ",$J,"T")-1,XQY=^(^("T")),XQY0=$P(XQY,U,2,99),XQDIC=$P(XQY,+XQY,2),XQY=+XQY
119 F XQJ=^XUTL("XQ",$J,"T"):-1:1 Q:^(XQJ)=-1
120 S ^XUTL("XQ",$J,"T")=$S(XQJ-1>0:XQJ-1,1:1) S:'$D(XQFLG) %=^(^("T")),XQY=+%,XQY0=$P(%,U,2,99),XQPSM=$P($P(%,+XQY,2,99),U),XQDIC=$S((XQPSM[","):$P(XQPSM,",",2),1:XQPSM)
121 I $P(XQY0,U,17),$D(^DIC(19,XQY,26)),$L(^(26)) X ^(26) ;W " ==> RBX^XQ73"
122 K ^XUTL("XQ",$J,"RBX"),%,XQJ,XQN,XQRB
123 G:'$D(XQFLG) M1^XQ
124 Q
Note: See TracBrowser for help on using the repository browser.