1 | %ZIS1 ;SFISC/AC,RWF -- DEVICE HANDLER (DEVICE INPUT) 9DEC2008
|
---|
2 | ;;8.0;KERNEL;**18,49,69,104,112,199**;JUL 10, 1995
|
---|
3 | MAIN ;Called from %ZIS with a GO
|
---|
4 | I '$D(IOP),$D(^%ZIS(1,%E,0)),'$P(^(0),"^",3) S %A=%H,%Z=^(0) D L2^%ZIS2 G EXIT
|
---|
5 | L1 ;Main Loop
|
---|
6 | I '$D(IOP),$D(IO("Q")),POP D AQUE^%ZIS3 K:%=2 IO("Q") S:%=2 %ZISB=$S(%IS'["N":2,1:0) I %=-1 S POP=1 G EXIT
|
---|
7 | S %E=%H,POP=0,%IS=%ZIS ;Reset %IS from %ZIS
|
---|
8 | I %IS'["Q",$D(XQNOGO) S POP=1 W:'$D(IOP) !,*7,"OUTPUT IS NEVER ALLOWED FOR THIS OPTION" G EXIT
|
---|
9 | D IOP:$D(IOP),R:'$D(IOP)
|
---|
10 | G EXIT:$D(DTOUT)!$D(DUOUT)!(POP&$D(IOP)),L1:POP&'$D(IOP)
|
---|
11 | D LKUP I %A'>0 S POP=1 D:'$D(DUOUT) MSG1 K DUOUT
|
---|
12 | I POP G EXIT:$D(IOP),L1:'$D(IOP)
|
---|
13 | I '$D(^%ZIS(1,%A,0)) D MSG1 K %ZISIOS S POP=1
|
---|
14 | I POP G EXIT:$D(IOP),L1:'$D(IOP)
|
---|
15 | S %E=%A,%Z=^%ZIS(1,%A,0),%Z1=$G(^(1))
|
---|
16 | I $D(%ZIS("S")) N Y S Y=%E D XS^ZISX S:'$T POP=1 G G:POP
|
---|
17 | W:'$D(IOP)&($P(%Z,"^",2)'=$I)&($P(%Z1,"^")]"") " ",$P(%Z1,"^")
|
---|
18 | D L2^%ZIS2
|
---|
19 | G G L1:POP&'$D(IOP)&'($D(DTOUT)!$D(DUOUT)) ;Didn't get it
|
---|
20 | ;For type[TRM reset $X & $Y
|
---|
21 | I 'POP,%ZTYPE["TRM",IO]"",$D(IO(1,IO)) U IO S:'(IO=IO(0)&'$D(IO("S"))&'$D(ZTQUEUED)) $X=0,$Y=0
|
---|
22 | ;
|
---|
23 | EXIT I $D(IO)#2,IO]"",$D(IO(1,IO))#2,$D(%Z1),$P(%Z1,"^",11) S IO(1,IO,"NOFF")=1
|
---|
24 | I 'POP,%ZIS["H" S IO(0)=IO,IO("HOME")=%ZISIOS_"^"_IO ;Make home device
|
---|
25 | I %IS'[0,$G(IO(0))]"" U IO(0) ;Make sure return with home active
|
---|
26 | G SETVAR:'POP!(%IS["T"),KILVAR
|
---|
27 | ;
|
---|
28 | IOP ;Request with IOP set
|
---|
29 | S (%ZISVT,%X)=IOP S:%X'?1.UNP %X=$$UP(%X) I %X'="Q" D SETQ Q
|
---|
30 | S %IS=%IS_%X K IOP W %X D SETQ Q
|
---|
31 | ;Get ready to ask user for device
|
---|
32 | R I %IS["Q",$D(XQNOGO) W !,*7,"AT THIS TIME, OUTPUT MUST BE QUEUED"
|
---|
33 | S %A=$S($D(%IS("B")):%IS("B"),1:"HOME") ;Setup default
|
---|
34 | I %IS["P",%A="HOME",$D(^%ZIS(1,%E,99)),$D(^%ZIS(1,+^(99),0)) S %A=$P(^(0),"^",1)
|
---|
35 | RD W !,$S($D(%IS("A")):%IS("A"),1:"DEVICE: ") W:%A]"" %A,"// " D SBR S:%X="" %X=%A S %ZISVT=%X
|
---|
36 | I %X?2"?".E D EN2^%ZIS7 G R
|
---|
37 | I %X?1"?".E D EN1^%ZIS7 G R
|
---|
38 | I $D(DTOUT)!$D(DUOUT)!(%X'?.ANP)!($L($P(%X,";"))>31) S:%IS["T" IO="" S POP=1 Q
|
---|
39 | S:%X'?1.UNP %X=$$UP(%X) D SETQ G R:$T Q
|
---|
40 | SETQ S %Y=$P(%X,";",2,9),%X=$P(%X,";",1) S:$L(";"_%Y,";/")=2 IO("P")=$P(";"_%Y,";/",2)
|
---|
41 | I %IS["Q",%X="Q" S %X=%Y,%ZISVT=$P(%ZISVT,";",2,9),%ZISB=0,IO("Q")=1,%IS("A")="DEVICE: " S:$D(IOP) %Y=$P(%X,";",2,9),%X=$P(%X,";",1)
|
---|
42 | I $T,'$D(IOP) W "UEUE TO PRINT ON" Q ; Return $T value
|
---|
43 | Q
|
---|
44 | LKUP S %ZISMY=$P(%ZISVT,";",2,999),%ZISVT=$P(%ZISVT,";")
|
---|
45 | I %X="H" W:'$D(IOP) "ome" S %X=0
|
---|
46 | I 0[%X!(%X="HOME")!(%X=$I) S %A=%H Q
|
---|
47 | I $E(%ZISVT)="`" S %A=+$E(%ZISVT,2,999) I $G(^%ZIS(1,%A,0))]"" Q ;,$D(IOP)
|
---|
48 | S %A=0 I "P"[%X Q:$D(IOP)&('$D(^%ZIS(1,%E,99))) I $D(^%ZIS(1,%E,99)) S %A=+^(99) Q
|
---|
49 | I %X=" ",$D(DUZ)#2,$D(^DISV(+DUZ,"^%ZIS(1,")) S %A=^("^%ZIS(1,") Q
|
---|
50 | S %A=+$O(^%ZIS(1,"B",%ZISVT,0)) Q:%A>0 ;mixed case lookup
|
---|
51 | I %X'=%ZISVT S %A=+$O(^%ZIS(1,"B",%X,0)) Q:%A>0 ;uppercase lookup
|
---|
52 | D VTLKUP^%ZIS S %A=%E Q:%A>0 ;mixed case lookup
|
---|
53 | I %X'=%ZISVT S %ZISVT=%X D VTLKUP^%ZIS S %A=%E Q:%A>0 ;uppercase lookup
|
---|
54 | N %XX,%YY S %XX=%X D 1^%ZIS5 S %A=+%YY Q
|
---|
55 | SBR K DFOUT,DTOUT,DUOUT R %X:$S($D(DTIME)#2:DTIME,1:300) E W *7 S DTOUT=1 Q
|
---|
56 | S:%X="."!(%X="^") DUOUT=1,%X="" Q
|
---|
57 | LC S %X=$$UP(%X)
|
---|
58 | Q
|
---|
59 | LOW(%) Q $TR(%,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
|
---|
60 | UP(%) Q $TR(%,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
---|
61 | YN W "? ",$P("YES// ^NO// ",U,%)
|
---|
62 | RYN R %X:$S($D(DTIME):DTIME,$D(%ZISDTIM):%ZISDTIM,1:300) E S DTOUT=1,%X=U W *7
|
---|
63 | S:%X]""!'% %=$A(%X),%=$S(%=89:1,%=121:1,%=78:2,%=110:2,%=94:-1,1:0)
|
---|
64 | I '%,%X'?."?" W *7,"??",!?4,"ANSWER 'YES' OR 'NO': " G RYN
|
---|
65 | W:$X>73 ! W $P(" (YES)^ (NO)",U,%) Q
|
---|
66 | MSG1 I '$D(IOP) W ?20,*7," [DEVICE DOES NOT EXIST]"
|
---|
67 | Q
|
---|
68 | SETVAR ;Come here to setup the variables for the selected device
|
---|
69 | S:$D(IO)[0 IO="" G KILVAR:%IS["T"&(IO="")
|
---|
70 | I $G(%Z)="" S ION="Unknown device",POP=1 G KILVAR
|
---|
71 | AUTOMARG I IO=IO(0) D:$T(AUTOMARG^%ZIS3)]""
|
---|
72 | .N %Y S %Y=$$AUTOMARG^%ZIS3 I $G(%Y) S $P(%Z91,"^")=+%Y,$P(%Z91,"^",3)=$P(%Y,"^",2)
|
---|
73 | E S:$G(DUZ) ^DISV(+DUZ,"^%ZIS(1,")=%E
|
---|
74 | S ION=$P(%Z,"^",1),IOM=+%Z91,IOF=$P(%Z91,"^",2),IOSL=$P(%Z91,"^",3),IOBS=$P(%Z91,"^",4),IOXY=$P(%Z91,"^",5)
|
---|
75 | S IOT=%ZTYPE,IOST(0)=%ZISIOST(0),IOST=%ZISIOST,IOPAR=%ZISOPAR,IOUPAR=%ZISUPAR,IOHG=%ZISHG
|
---|
76 | S:IOF="" IOF="#" ;See that IOF has something
|
---|
77 | K IOCPU S:$D(%ZISCPU) IOCPU=%ZISCPU G KIL
|
---|
78 | ;
|
---|
79 | KILVAR ;Come here to restore the calling variables
|
---|
80 | D SYMBOL^%ZISUTL(1,"%ZISOLD")
|
---|
81 | S:'$L($G(IOF)) IOF="#" S:'$D(IOST(0)) IOST(0)=0
|
---|
82 | ;See that all standard variables are defined
|
---|
83 | F %I="IO","ION","IOM","IOBS","IOSL","IOST" S:$D(@%I)[0 @%I=""
|
---|
84 | K IO("HFSIO"),IO("OPEN") I $D(%ZISCPU) S:'$D(IOCPU) IOCPU=%ZISCPU
|
---|
85 | KIL ;Final exit cleanup
|
---|
86 | S:'POP IOS=%ZISIOS I POP K:%IS'["T" %ZISIOS I %IS["T" K IOS S:$D(%ZISIOS) IOS=%ZISIOS
|
---|
87 | S:%IS["T" IO("T")=1 K %ZIS,%IS,%A,%E,%H,%ZISOS,%ZISV,IOP
|
---|
88 | K2 K %I,%X,%Y,%Z,%Z1,%Z91,%Z95,%ZTYPE,%ZTIME
|
---|
89 | K %ZISCHK,%ZISCPU,%ZISI,%ZISR,%ZISVT,%ZISB,%ZISX,ZISI,%ZISHGL,%ZISHP,%ZISIO,%ZISIOS,%ZISIOM,%ZISIOF,%ZISIOSL,%ZISIOBS,%ZISIOST,%ZISIOST(0),%ZISTO,%ZISTP,%ZISHG,%ZISSIO,%ZISOPEN,%ZISOPAR,%ZISUPAR
|
---|
90 | K %ZISMY,%ZISQUIT
|
---|
91 | Q
|
---|