XQH0 ;LL/THM,SEA/AMF,JLI - HELP PROCESSOR ;12/08/2004  11:57
 ;;8.0;KERNEL;**372**;Jul 10, 1995;Build 3
G4 ;
 I XQHON W @IORV
G4A I XQHON W:X1="" @IORVX Q:X1=""  S XQHTXT=$P(X1,"]"),X1=$P(X1,"]",2,99),XQHNXT=$E(X1) S:XQHNXT="]" XQHTXT=XQHTXT_"]",X1=$E(X1,2,200) W XQHTXT G:XQHNXT="]" G4A W @IORVX S XQHON=0 G G4A
 Q:X1=""  S XQHTXT=$P(X1,"["),X1=$P(X1,"[",2,99),XQHNXT=$E(X1) S:XQHNXT="[" XQHTXT=XQHTXT_"[",X1=$E(X1,2,200) I XQHTXT["]" S XQHTXT=$P(XQHTXT,"]")_$P(XQHTXT,"]",2,99)
 W XQHTXT G:XQHNXT="["!(XQHNXT="") G4A W @IORV S XQHON=1 G G4A
 Q
REL D HDR^XQH1
REL1 W !!,?6,"RELATED HELP FRAME",?59,"KEYWORD",!?6,$E(XQDSH,1,18),?59,$E(XQDSH,1,7)
 S (X,K)=0
 F I=1:1 S X=$O(^DIC(9.2,XQHY,2,X)) Q:X'=+X  S X1=^(X,0) S:'$L(X1) I=I-1 I $L(X1) S XQKY=$P(X1,U,1),X1=$P(X1,U,2),XQHX(I)=X1 D REL1W S K=K+1
 W !!,"* - Recently viewed help frame"
BOT2 W !!,"Select HELP SYSTEM action or <return>: "
 R X:DTIME X:$D(^DIC(9.2,+XQHY,10.2)) ^(10.2) I '$T!'$L(X) S:'XQHL XQDONE=1 Q:XQDONE  D POP G GL3^XQH
 S:X="^" X="^Q" S %XQK=X,X="" F %XQJ=1:1:$L(%XQK) S X=X_$S(($E(%XQK,%XQJ)?1L):$C($A($E(%XQK,%XQJ))-32),1:$E(%XQK,%XQJ))
 I $E(X,1)="^" G:"^R"[X REL S:"^Q"[X XQDONE=1 Q:XQDONE  G:"^T"[X GL3^XQH D:"^O"[X HILITE^XQH2 D:"^H"[X HOW^XQH2 G:"^H"[X!("^O"[X) BOT2 I "^E"[$E(X,1,2)&XQAU D EDIT^XQH2 G BOT2
 I X["?" S %XQI=2 D HELP^XQH2 G BOT2
 I +X=X,$D(XQHX(+X)) S X=XQHX(X) W:'$L(X) !,"No help frame exists" G:'$L(X) BOT2 S XQHN=0,XQHS(X)="" D PSH S XQHY=X D INT^XQH Q:XQDONE  D POP G GL3^XQH
 S XQHX=X D CHK I Y<0 W " ??",*7 G BOT2
 S X=$P(Y(0),U,2) W:'$L(X) !,"No help frame exists" G:'$L(X) BOT2 S XQHN=0,XQHS(X)="" D PSH S XQHY=X D INT^XQH Q:XQDONE  D POP G GL3^XQH
 Q
REL1W W !,$S('$L(X1):"",$D(XQHS(X1)):"*",1:""),?2,I,?6,$S('$L(X1):"[No help frame exists]",'$D(^DIC(9.2,X1,0)):"",1:$P(^DIC(9.2,X1,0),U,2)) W ?(54+(15-$L(XQKY)\2)),@IORV,XQKY,@IORVX Q
PSH S XQHR(XQHL,1)=XQHF,XQHR(XQHL,2)=XQHY,XQHR(XQHL,3)=XQHN,XQHL=XQHL+1 Q
POP S XQHL=XQHL-1,XQHF=XQHR(XQHL,1),XQHY=+XQHR(XQHL,2),XQHN=XQHR(XQHL,3) K XQHR(XQHL) Q
 ;
GET ;
 S XQHSL=1 D INIT^XQH1 S DIC(0)="AEQMZL",DLAYGO=9.2,DIC="^DIC(9.2," D ^DIC S XQHY=Y K DLAYGO,DIC(0) I Y>0,$P(Y,U,3) S DA=+Y,DR="6////"_DUZ_";4///T",DIE=DIC D ^DIE
 S:XQHY<0 XQH=-1 S Y=XQHY
 Q
 ;
CHK S XQHX=$E(XQHX,1,30),XQHX2=$E(XQHX,1,$L(XQHX)-1)_$C($A($E(XQHX,$L(XQHX)))-1)_"z" F XQHJ=0:0 S XQHX2=$O(^DIC(9.2,XQHY,2,"B",XQHX2)) Q:$E(XQHX2,1,$L(XQHX))'=XQHX  S XQHJ=XQHJ+1,XQHJ(XQHJ)=$O(^(XQHX2,0))_U_XQHX2
 S:XQHJ=1 XQHI=1 I XQHJ'>0 W $C(7),"  ??" S XQHI=0
CHKASK ;
 I XQHJ>1 W ! F XQHI=1:1:XQHJ W !?5,$J(XQHI,3),".  ",$P(XQHJ(XQHI),U,2)
 I XQHJ>1 W !!?10,"Select from (1 to ",XQHJ,") : " R XQHI:DTIME S:'$T!(XQHI[U) XQDONE=1,XQHI=0 S:XQHI="" XQHI=0 I +XQHI'=XQHI!(XQHI<0)!(XQHI>XQHJ) W $C(7),"  ??",! G CHKASK
 S Y=$S(XQHI=0:-1,1:XQHJ(XQHI)) S:Y>0 Y(0)=^DIC(9.2,XQHY,2,+Y,0)
 K XQHI,XQHJ,XQHX2
 Q
