| 1 | DVBAUTL4 ;ALB/JLU;UTILITY ROUTINE;9/9/94 | 
|---|
| 2 | ;;2.7;AMIE;**28**;Apr 10, 1995 | 
|---|
| 3 | ; | 
|---|
| 4 | WR(TEXT) ; | 
|---|
| 5 | ;this is the main entry point for the AMIE writer | 
|---|
| 6 | ;the following is a desciption of how to set up the text string to use | 
|---|
| 7 | ;this call. | 
|---|
| 8 | ;The first uparrow piece contians the description of what to execute | 
|---|
| 9 | ;on this line.  The second peice contians the actual line of text. | 
|---|
| 10 | ;The descriptions are defined below | 
|---|
| 11 | ;1st = contains a 1 or zero 1 for beep zero no beep | 
|---|
| 12 | ;2nd = contains the number of spaces before and/or after the text 1:1 | 
|---|
| 13 | ;3rd = contains the number of tabs before and/or after the text 1:2 | 
|---|
| 14 | ;4th = contains the number of lines before and/or after the text 1:4 | 
|---|
| 15 | ;5th = contains the number of form feeds before and/or after the | 
|---|
| 16 | ;      text 1:3 | 
|---|
| 17 | ;TEXT  = contains the array that holds the text to be displayed | 
|---|
| 18 | ;        the array is to look like ARRAY(X,0)  local or global | 
|---|
| 19 | ;        The X must start at one and be in consecutive order. | 
|---|
| 20 | ;The data in each array element will look like. "0,1:1,1:2,1:4,1:3^text" | 
|---|
| 21 | ; | 
|---|
| 22 | F LP=1:1 S TEXTM=$G(@TEXT@(LP,0)) Q:TEXTM=""  DO | 
|---|
| 23 | .D SETTEXT | 
|---|
| 24 | .D SETVAR | 
|---|
| 25 | .I TEXT2="",SPACE="",TAB="",LINE="",FORM="",BEEP="" Q | 
|---|
| 26 | .I $G(IO)'="" U IO | 
|---|
| 27 | .I TEXT2="" D SHORT | 
|---|
| 28 | .I TEXT2]"" D BODY | 
|---|
| 29 | .Q | 
|---|
| 30 | D EXIT | 
|---|
| 31 | Q | 
|---|
| 32 | ; | 
|---|
| 33 | EXIT K TEXTM,TEXT1,TEXT2,SPACE,TAB,BEEP,LINE,FORM,LP | 
|---|
| 34 | Q | 
|---|
| 35 | ; | 
|---|
| 36 | SHORT ;no text available may want to just use curser control | 
|---|
| 37 | I FORM]"" D FORM(FORM,"B") | 
|---|
| 38 | I LINE]"" D LINE(LINE,"B") | 
|---|
| 39 | I TAB]"" D TAB(TAB,"B") | 
|---|
| 40 | I SPACE]"" D SPACE(SPACE,"B") | 
|---|
| 41 | I BEEP]"",BEEP>0 D BEEP | 
|---|
| 42 | Q | 
|---|
| 43 | ; | 
|---|
| 44 | BODY ;text is available will look at all | 
|---|
| 45 | I BEEP]"",BEEP>0 D BEEP | 
|---|
| 46 | I FORM]"" D FORM(FORM,"B") | 
|---|
| 47 | I LINE]"" D LINE(LINE,"B") | 
|---|
| 48 | I TAB]"" D TAB(TAB,"B") | 
|---|
| 49 | I SPACE]"" D SPACE(SPACE,"B") | 
|---|
| 50 | D TEXT(TEXT2) | 
|---|
| 51 | I SPACE]"" D SPACE(SPACE,"A") | 
|---|
| 52 | I TAB]"" D TAB(TAB,"A") | 
|---|
| 53 | I LINE]"" D LINE(LINE,"A") | 
|---|
| 54 | I FORM]"" D FORM(FORM,"A") | 
|---|
| 55 | Q | 
|---|
| 56 | ; | 
|---|
| 57 | FORM(A,B) ;issues the form feeds | 
|---|
| 58 | ; | 
|---|
| 59 | N VAR,LP | 
|---|
| 60 | S VAR=$$SET(A,B) | 
|---|
| 61 | Q:VAR="" | 
|---|
| 62 | F LP=1:1:VAR W @$S('$D(IOF):"#",IOF="":"#",1:IOF) | 
|---|
| 63 | Q | 
|---|
| 64 | ; | 
|---|
| 65 | LINE(A,B) ;issues the line feeds | 
|---|
| 66 | ; | 
|---|
| 67 | N VAR,LP | 
|---|
| 68 | S VAR=$$SET(A,B) | 
|---|
| 69 | Q:VAR="" | 
|---|
| 70 | F LP=1:1:VAR W ! | 
|---|
| 71 | Q | 
|---|
| 72 | ; | 
|---|
| 73 | TAB(A,B) ;issues the tabs | 
|---|
| 74 | ; | 
|---|
| 75 | N VAR,LP | 
|---|
| 76 | S VAR=$$SET(A,B) | 
|---|
| 77 | Q:VAR=""!(VAR=0) | 
|---|
| 78 | S DX=0,DY=$S(IOST["C-":$S($Y>IOSL:IOSL,1:$Y),1:0) | 
|---|
| 79 | X ^%ZOSF("XY") | 
|---|
| 80 | K DX,DY | 
|---|
| 81 | W ?VAR | 
|---|
| 82 | Q | 
|---|
| 83 | ; | 
|---|
| 84 | SPACE(A,B) ;issues the spaces | 
|---|
| 85 | ; | 
|---|
| 86 | N VAR,LP | 
|---|
| 87 | S VAR=$$SET(A,B) | 
|---|
| 88 | Q:VAR="" | 
|---|
| 89 | F LP=1:1:VAR W " " | 
|---|
| 90 | Q | 
|---|
| 91 | ; | 
|---|
| 92 | TEXT(A) ;writes the text | 
|---|
| 93 | ; | 
|---|
| 94 | W A | 
|---|
| 95 | Q | 
|---|
| 96 | ; | 
|---|
| 97 | SET(A,B) ;general set statement | 
|---|
| 98 | ; | 
|---|
| 99 | Q $S(B="B":+A,1:$P(A,":",2)) | 
|---|
| 100 | ; | 
|---|
| 101 | BEEP ;does a beep | 
|---|
| 102 | W *7 | 
|---|
| 103 | Q | 
|---|
| 104 | ; | 
|---|
| 105 | SETTEXT ;sets up the two parts of each string | 
|---|
| 106 | S TEXT1=$P(TEXTM,"^",1) | 
|---|
| 107 | S TEXT2=$F(TEXTM,"^") | 
|---|
| 108 | S TEXT2=$E(TEXTM,TEXT2,999) | 
|---|
| 109 | Q | 
|---|
| 110 | ; | 
|---|
| 111 | SETVAR ;sets up the necessary variables for each attribute | 
|---|
| 112 | S BEEP=$P(TEXT1,",",1) | 
|---|
| 113 | S SPACE=$P(TEXT1,",",2) | 
|---|
| 114 | S TAB=$P(TEXT1,",",3) | 
|---|
| 115 | S LINE=$P(TEXT1,",",4) | 
|---|
| 116 | S FORM=$P(TEXT1,",",5) | 
|---|
| 117 | Q | 
|---|
| 118 | ; | 
|---|
| 119 | CLEAR ;clears the screen | 
|---|
| 120 | S VAR(1,0)="0,0,0,3,1^" | 
|---|
| 121 | D WR^DVBAUTL4("VAR") | 
|---|
| 122 | K VAR | 
|---|
| 123 | Q | 
|---|