XQH ;LL/THM,SEA/AMF,JLI - HELP PROCESSOR ;2/15/96  08:55
 ;;8.0;KERNEL;**20**;Jul 10, 1995
 I $D(XQH),XQH=-1 K XQH
 I $D(XQH),XQH'="" G EN
LP D GET^XQH0 D:Y>0 EACH G:XQHY>0 LP D OUT^XQH1 Q
ENL D GET^XQH0 D:XQHY>0 EACH D OUT^XQH1 Q
EN1 S XQHSL=0 S DIR(0)="E" D ^DIR Q:$D(DIRUT)
EN S XQHSL=1 D START K XQH Q
START N DA,DIC,DIE,DR,D,DIFLD,DP,DQ,DU,DZ,DO,X,Y ;Don't step on FM
 D INIT^XQH1 I XQH=+XQH S:'$D(^DIC(9.2,XQH,0)) XQH=-1 S XQHY=XQH D:XQHY>0 EACH D OUT^XQH1 Q
 S X=XQH,Y=-1 S:$D(^DIC(9.2,"B",X)) Y=$O(^(X,0)) I Y'>0 S X=$O(^DIC(9.2,"B",X)) I $E(X,1,$L(XQH))=XQH,$E($O(^(X)),1,$L(XQH))'=XQH S Y=$O(^(X,0))
 S XQHY=Y S:Y'>0 XQH=-1 D:XQHY>0 EACH D OUT^XQH1 Q
 ;
EACH S (XQHL,XQHN)=0 K XQHS,XQHR,XQHX
INT Q:'$D(^DIC(9.2,+XQHY,0))  S XQHY(0)=^(0),XQHY=XQHY_"^"_$P(XQHY(0),U,1) D:'$D(IOF) HOME^%ZIS W @IOF
 S XQAU=$S($D(^XUSEC("XUAUTHOR",DUZ)):1,$P(^DIC(9.2,+XQHY,0),U,4)=DUZ:1,1:$D(^DIC(9.2,+XQHY,4,"AB",DUZ)))
 S:'$D(X) X="" S XQHF=$P(XQHY(0),U,2),XQHS(+XQHY)="",XQHX=X,X=$O(^DIC(9.2,+XQHY,1,0))
GL3 D:XQHSL HDR^XQH1 W:'XQHSL ! S XQH2=.002
 S XQHY=+XQHY,XQDONE=""
 S XQHON=0 F XQH1=1:1 S XQH2=$O(^DIC(9.2,XQHY,1,XQH2)) Q:XQH2=""  D:$Y+3>IOSL WAIT^XQH1 Q:XQDONE  S X1=^DIC(9.2,XQHY,1,XQH2,0) W ! D G4
 K XQHON,XQHNXT,XQHTXT Q:XQDONE  S XQBL=1 I $D(^DIC(9.2,XQHY,2)) S XQBL='$P(^(2,0),U,4)
 S XQ3=0 I 'XQHSL S XQ3=XQBL I XQBL S XQ3=(I>15)+1
 I 'XQBL G:$Y<(IOSL-7-($P(^DIC(9.2,XQHY,2,0),U,3))) REL1^XQH0
BOT1 Q:(XQ3=1)  I XQ3=2 W !!,"Press RETURN to continue. " R X:DTIME Q
 W !!,"Select HELP SYSTEM action or <return>: "
 S X=IOM X ^%ZOSF("RM") 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^XQH0 G INT
 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 GL3 S:"^Q"[X XQDONE=1 Q:XQDONE  G:"^T"[X&'XQBL REL^XQH0 D:"^O"[X HILITE^XQH2 D:"^H"[X HOW^XQH2 G:"^O"[X!("^H"[X) BOT1 I "^E"[$E(X,1,2)&XQAU D EDIT^XQH2 G BOT1
 I X["?" S %XQI=1 D HELP^XQH2 G BOT1
 I XQBL W " ??",*7 G BOT1
 S XQHX=X D CHK^XQH0 I Y<0 W " ??",*7 G BOT1
 S X=$P(Y(0),U,2) W:'$L(X) !,"No help frame exists" G:'$L(X) BOT1 S XQHN=0,XQHS(X)="" D PSH^XQH0 S XQHY=X D INT Q:XQDONE  D POP^XQH0 G GL3
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
