source: IHS-VA_UTILITIES-XB/XBHFMAN1.m@ 641

Last change on this file since 641 was 641, checked in by Sam Habiel, 15 years ago

Initial commit of XB, move away from sf.net.
Includes kids file and documentation.

File size: 4.1 KB
Line 
1XBHFMAN1 ; IHS/ADC/GTH - HELP FRAME MANUAL (2/2) ; [ 02/07/97 3:02 PM ]
2 ;;4.0;XB;;Jul 20, 2009;Build 2
3 ;
4 ; ----- Print Title and Preface page.
5 ;
6 ;
7 S X=XBNS_"HFMN"
8 X ^%ZOSF("TEST")
9 E G MAIN
10 S XBNOHDR=1
11 NEW A,B
12 F A="TITLE","PREFACE" Q:$D(DIRUT) D ^DIWW,TOF F B=1:1 S X=$T(@A+B^@(XBNS_"UMAN")) Q:$L($P(X,";",1))>1 D PR($P(X,";",3)) Q:$D(DIRUT)
13 ;
14 I $D(DIRUT) G HATOUT
15 D ^DIWW
16 ;
17MAIN ; ----- $ORDER thru the list of OPTIONS, and print them.
18 S (XBNAME,XBNOHDR)=0
19 F S XBNAME=$O(^TMP("XBHFMAN",$J,XBNAME)) Q:'XBNAME D MAKEHDRS,TOF Q:$D(DIRUT) D HDR(XBNAME),DESC(+^TMP("XBHFMAN",$J,XBNAME)),HF($P($G(^DIC(19,+^TMP("XBHFMAN",$J,XBNAME),0)),U,7)),^DIWW
20 I $D(DIRUT) G HATOUT
21 ;
22INDEX ; ----- Print the index.
23 S XBHDR="Index"
24 D TOF
25 I $D(DIRUT) G HATOUT
26 W !!!
27 S X="|NOWRAP||SETTAB(""C"")||TAB|INDEX"
28 D ^DIWP,^DIWW
29 W !!!
30 D CONT("INDEX^^"_XBPG)
31 S (XB,XBCONT)="",$P(XBCONT,".",81)=""
32 F S XB=$O(^TMP("XBHFMAN-INDEX",$J,XB)) Q:XB="" S X="" D Q:$D(DIRUT)
33 .F XBX=0:0 S XBX=$O(^TMP("XBHFMAN-INDEX",$J,XB,XBX)) S X=X_XBX_"," I '$O(^(XBX)) D Q
34 ..S X=XB_"..."_$E(XBCONT,1,DIWR-DIWL-$L(XB)-3-$L(X))_$E(X,1,$L(X)-1)
35 ..S XBSAVX=X
36 ..F S X=$E(XBSAVX,1,DIWR-DIWL),XBSAVX=$E(XBSAVX,DIWR-DIWL+1,$L(XBSAVX)) Q:'$L(X) D TOF:$Y>XBBM Q:$D(DIRUT) D ^DIWP
37 ..Q
38 .Q
39 I $D(DIRUT) G HATOUT
40 D ^DIWW,RTRN^XBHFMAN
41 I $D(DIRUT) G HATOUT
42 ;
43CONTENTS ; ----- Print the table of Contents.
44 S XBNOHDR=1
45 W @IOF,!!!!!
46 S X="|SETTAB(""C"")||TAB|CONTENTS"
47 D ^DIWP,^DIWW
48 W !!
49 S XB=0
50 F S XB=$O(^TMP("XBHFMAN-CONTENTS",$J,XB)) Q:'+XB S X=^(XB),X=$P(X,U)_" "_$P(X,U,2)_$E(XBCONT,1,DIWR-DIWL-$L(X)+1)_$P(X,U,3) D TOF:$Y>XBBM Q:$D(DIRUT) D ^DIWP
51 I $D(DIRUT) G HATOUT
52 D ^DIWW,RTRN^XBHFMAN
53 I $D(DIRUT) G HATOUT
54END ;EP - Paginate, close, kill, quit.
55 W @IOF
56HATOUT ;
57 D ^%ZISC
58 KILL ^TMP("XBHFMAN",$J),XB,XBBM,XBCHAP,XBCONT,XBODD,XBHDR,XBIEN,XBPARA,XBPG,XBROOT,XBTITL,XBTM,XBX,XBY,DIC,DIWF,DIWL,DIWR
59 Q
60 ;
61PR(X) ;EP - Process one line of text.
62 NEW A,B,I,N,Y
63 I X="|TOP|" D TOF Q
64 D INDX(X),^DIWP,TOF:$Y>XBBM
65 Q
66 ;
67INDX(X) ; ----- Parse/capitalize one line of text. Check for indexed words.
68 Q:'$D(XBPG)
69 NEW Y,Z
70 S X=$TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
71 S X=$TR(X,"~`!@#$%^&*()_-+=|\{[}]:;""""'<,>.?/"," ")
72 X XBSTRIP
73 F S %=$F(X," ") Q:'% S X=$E(X,1,%-2)_$E(X,%,$L(X))
74 F %=1:1 S Y=$P(X," ",%) Q:Y="" I $D(^TMP("XBHFMAN-I",$J,Y)) S ^TMP("XBHFMAN-INDEX",$J,Y,XBPG)=""
75 Q
76 ;
77HDR(XB) ; ----- Print a chapter heading.
78 S %=$P(^TMP("XBHFMAN",$J,XB),U,2),XB=%_U_$P($G(^DIC(19,+^TMP("XBHFMAN",$J,XB),0)),U,2)
79 F X="|SETTAB(""C"")||TAB|Chapter "_$P(XB,U),"|SETTAB(""C"")||TAB|"_$P(XB,U,2) D ^DIWP
80 W !!
81 D CONT($P(XB,U)_U_$P(XB,U,2)_U_XBPG)
82 Q
83 ;
84TOF ;EP ----- Move to bottom of page, print footer, paginate, print header.
85 I XBNOHDR D RTRN^XBHFMAN Q:$D(DIRUT) W @IOF Q
86 F Q:$Y>XBBM W !
87 I XBPG W !?(DIWL-1),XBDASH,!,?$S(XBODD:DIWR-$L(XBTITL),1:DIWL-1),XBTITL
88 D RTRN^XBHFMAN
89 I $D(DIRUT) Q
90 W @IOF
91 S XBPG=XBPG+1,XBODD=XBPG#2
92 F Q:$Y=(XBTM-2) W !
93 W ?$S(XBODD:DIWR-$L("Page "_XBPG),1:DIWL-1),"Page ",XBPG
94 I '(XBHDR="Index") W !?DIWL-1,$S(XBODD:XBHDRO,1:XBHDRE)
95 W !?(DIWL-1),XBDASH,!!
96 Q
97 ;
98MAKEHDRS ; ----- Make headers for odd and even pages.
99 S (XBHDRE,XBHDRO)=$P($G(^DIC(19,+^TMP("XBHFMAN",$J,XBNAME),0)),U,2)
100 S XBCHAP=$P(^TMP("XBHFMAN",$J,XBNAME),U,2)
101 F %=1:1 I '$P(XBCHAP,".",%) S XBCHAP=$P(XBCHAP,".",1,%-1) Q
102 S XBHDRO=XBHDRO_$J("",DIWR-DIWL-$L(XBHDRO)-$L("Chapter "_XBCHAP)+1)_"Chapter "_XBCHAP
103 S XBHDRE="Chapter "_XBCHAP_$J("",DIWR-DIWL-$L(XBHDRE)-$L("Chapter "_XBCHAP)+1)_XBHDRE
104 Q
105 ;
106CONT(X) ; ----- Add chapter number, title, and page number to list.
107 S XBCONT=XBCONT+1,^TMP("XBHFMAN-CONTENTS",$J,XBCONT)=X
108 Q
109 ;
110DESC(A) ; ----- Print descriptions of the OPTIONs as the first of the chapter.
111 NEW B,I,N,Y
112 I '$D(^DIC(19,A,1)) D PR("<NO DESCRIPTION>") Q
113 S B=0
114 F S B=$O(^DIC(19,A,1,B)) Q:'B D PR(^(B,0)) Q:$D(DIRUT)
115 Q
116 ;
117HF(A) ; ----- Print the HELP FRAME text.
118 I 'A D PR("<NO HELP FRAME>") Q
119 I '$D(^DIC(9.2,A,1)) D PR("<NO HELP FRAME TEXT>") Q
120 NEW B,I,N,Y
121 S B=0
122 F S B=$O(^DIC(9.2,A,1,B)) Q:'B D PR(^(B,0)) Q:$D(DIRUT)
123 ; ----- Print any tied HELP FRAMEs.
124 I $O(^DIC(9.2,A,2,0)) S B=0 F S B=$O(^DIC(9.2,A,2,B)) Q:'B D HF($P($G(^(B,0)),U,2)) Q:$D(DIRUT)
125 Q
126 ;
Note: See TracBrowser for help on using the repository browser.