source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/_ZIS1.m@ 1270

Last change on this file since 1270 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 4.9 KB
Line 
1%ZIS1 ;SFISC/AC,RWF -- DEVICE HANDLER (DEVICE INPUT) ;07/07/2005 15:48
2 ;;8.0;KERNEL;**18,49,69,104,112,199,391**;JUL 10, 1995
3MAIN ;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
5L1 ;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
19G 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 ;
23EXIT I $D(IO)#2,IO]"",$D(IO(1,IO))#2,$D(%Z1),$P(%Z1,"^",11) S IO(1,IO,"NOFF")=1
24 ;Do count of number of times device opened. Field 51.
25 I $L($G(IO)),$D(IO(1,IO))#2,'POP,$G(%ZISIOS) D
26 . S $P(^(5),"^",1)=$P($G(^%ZIS(1,%ZISIOS,5)),"^",1)+1
27 I 'POP,%ZIS["H" S IO(0)=IO,IO("HOME")=%ZISIOS_"^"_IO ;Make home device
28 I %IS'[0,$G(IO(0))]"" U IO(0) ;Make sure return with home active
29 G SETVAR:'POP!(%IS["T"),KILVAR
30 ;
31IOP ;Request with IOP set
32 S (%ZISVT,%X)=IOP S:%X'?1.UNP %X=$$UP(%X) I %X'="Q" D SETQ Q
33 S %IS=%IS_%X K IOP W %X D SETQ Q
34 ;Get ready to ask user for device
35R I %IS["Q",$D(XQNOGO) W !,*7,"AT THIS TIME, OUTPUT MUST BE QUEUED"
36 S %A=$S($D(%IS("B")):%IS("B"),1:"HOME") ;Setup default
37 I %IS["P",%A="HOME",$D(^%ZIS(1,%E,99)),$D(^%ZIS(1,+^(99),0)) S %A=$P(^(0),"^",1)
38RD W !,$S($D(%IS("A")):%IS("A"),1:"DEVICE: ") W:%A]"" %A,"// " D SBR S:%X="" %X=%A S %ZISVT=%X
39 I %X?2"?".E D EN2^%ZIS7 G R
40 I %X?1"?".E D EN1^%ZIS7 G R
41 I $D(DTOUT)!$D(DUOUT)!(%X'?.ANP)!($L($P(%X,";"))>31) S:%IS["T" IO="" S POP=1 Q
42 S:%X'?1.UNP %X=$$UP(%X) D SETQ G R:$T Q
43SETQ S %Y=$P(%X,";",2,9),%X=$P(%X,";",1) S:$L(";"_%Y,";/")=2 IO("P")=$P(";"_%Y,";/",2)
44 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)
45 I $T,'$D(IOP) W "UEUE TO PRINT ON" Q ; Return $T value
46 Q
47LKUP S %ZISMY=$P(%ZISVT,";",2,999),%ZISVT=$P(%ZISVT,";")
48 I %X="H" W:'$D(IOP) "ome" S %X=0
49 I 0[%X!(%X="HOME")!(%X=$I) S %A=%H Q
50 I $E(%ZISVT)="`",$D(IOP) S %A=+$E(%ZISVT,2,999) I $G(^%ZIS(1,%A,0))]"" Q
51 S %A=0 I "P"[%X Q:$D(IOP)&('$D(^%ZIS(1,%E,99))) I $D(^%ZIS(1,%E,99)) S %A=+^(99) Q
52 I %X=" ",$D(DUZ)#2,$D(^DISV(+DUZ,"^%ZIS(1,")) S %A=^("^%ZIS(1,") Q
53 S %A=+$O(^%ZIS(1,"B",%ZISVT,0)) Q:%A>0 ;mixed case lookup
54 I %X'=%ZISVT S %A=+$O(^%ZIS(1,"B",%X,0)) Q:%A>0 ;uppercase lookup
55 D VTLKUP^%ZIS S %A=%E Q:%A>0 ;mixed case lookup
56 I %X'=%ZISVT S %ZISVT=%X D VTLKUP^%ZIS S %A=%E Q:%A>0 ;uppercase lookup
57 N %XX,%YY S %XX=%X D 1^%ZIS5 S %A=+%YY Q
58SBR K DFOUT,DTOUT,DUOUT R %X:$S($D(DTIME)#2:DTIME,1:300) E W *7 S DTOUT=1 Q
59 S:%X="."!(%X="^") DUOUT=1,%X="" Q
60LC S %X=$$UP(%X)
61 Q
62LOW(%) Q $TR(%,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
63UP(%) Q $TR(%,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
64YN W "? ",$P("YES// ^NO// ",U,%)
65RYN R %X:$S($D(DTIME):DTIME,$D(%ZISDTIM):%ZISDTIM,1:300) E S DTOUT=1,%X=U W *7
66 S:%X]""!'% %=$A(%X),%=$S(%=89:1,%=121:1,%=78:2,%=110:2,%=94:-1,1:0)
67 I '%,%X'?."?" W *7,"??",!?4,"ANSWER 'YES' OR 'NO': " G RYN
68 W:$X>73 ! W $P(" (YES)^ (NO)",U,%) Q
69MSG1 I '$D(IOP) W ?20,*7," [DEVICE DOES NOT EXIST]"
70 Q
71SETVAR ;Come here to setup the variables for the selected device
72 S:$D(IO)[0 IO="" G KILVAR:%IS["T"&(IO="")
73 I $G(%Z)="" S ION="Unknown device",POP=1 G KILVAR
74 S:IO'=IO(0)&($D(DUZ)#2) ^DISV(+DUZ,"^%ZIS(1,")=%E
75 S ION=$P(%Z,"^",1),IOM=+%Z91,IOF=$P(%Z91,"^",2),IOSL=$P(%Z91,"^",3),IOBS=$P(%Z91,"^",4),IOXY=$P(%Z91,"^",5)
76 I IOSL>65530 S IOSL=65530 ;Cache rolls $Y at 65535
77 S IOT=%ZTYPE,IOST(0)=%ZISIOST(0),IOST=%ZISIOST,IOPAR=%ZISOPAR,IOUPAR=%ZISUPAR,IOHG=%ZISHG
78 S:IOF="" IOF="#" ;See that IOF has something
79 K IOCPU S:$D(%ZISCPU) IOCPU=%ZISCPU G KIL
80 ;
81KILVAR ;Come here to restore the calling variables
82 D SYMBOL^%ZISUTL(1,"%ZISOLD")
83 S:'$L($G(IOF)) IOF="#" S:'$D(IOST(0)) IOST(0)=0
84 ;See that all standard variables are defined
85 F %I="IO","ION","IOM","IOBS","IOSL","IOST" S:$D(@%I)[0 @%I=""
86 K IO("HFSIO"),IO("OPEN") I $D(%ZISCPU) S:'$D(IOCPU) IOCPU=%ZISCPU
87KIL ;Final exit cleanup
88 S:'POP IOS=%ZISIOS I POP K:%IS'["T" %ZISIOS I %IS["T" K IOS S:$D(%ZISIOS) IOS=%ZISIOS
89 S:%IS["T" IO("T")=1 K %ZIS,%IS,%A,%E,%H,%ZISOS,%ZISV,IOP
90K2 K %I,%X,%Y,%Z,%Z1,%Z91,%Z95,%ZTYPE,%ZTIME
91 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
92 K %ZISMY,%ZISQUIT
93 Q
Note: See TracBrowser for help on using the repository browser.