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/ZIS3GTM.m@ 1582

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

initial load of WorldVistAEHR

File size: 3.6 KB
RevLine 
[613]1%ZIS3 ;SFISC/AC,RWF/GFT -- DEVICE HANDLER(DEVICE TYPES & PARAMETERS) ;8DEC2008
2 ;;8.0;KERNEL;**18,36,69,104,GTM**;JUL 10, 1995
3 I %ZIS'["T",$G(^%ZIS(1,+%E,"POX"))]"" D XPOX^ZISX(%E)
4 I $D(%ZISQUIT) S POP=1 K %ZISQUIT
5 S %ZISCHK=1
6 I 'POP&(%ZISB)&(%ZTYPE'="RES")&(%ZTYPE'="OTH")&(%ZTYPE'="SDP")&(IO'["::") D DEVOK
7 G Q:POP
8 G @%ZTYPE:(%ZTYPE["TRM") G @(%ZTYPE_"^%ZIS6") ;Jump to next part
9 ;
10Q I $D(%ZISUOUT) K %ZISUOUT,%ZISHP,%ZISHPOP Q
11 I $D(%ZISHPOP)&$S(IO="":1,1:'$D(IO(1,IO))) D HGBSY^%ZIS2 Q
12 I POP S:%IS'["T" IO="" I $D(%ZISHG(0)),%IS'["D",'$D(%ZISHPOP) G HUNT^%ZIS2
13 Q
14VTRM ;Virtual terminal type
15TRM D OPEN^%ZIS4:'POP&(%ZISB&(%IS'["T")),MARGN:'POP,SETPAR:'POP ;Terminal type
16 I 'POP,%IS'["T",%ZISB=1,'$D(IOP),IO'=IO(0),'$D(IO("Q")),%IS["Q" D AQUE
17 W:'$D(IOP) ! I '$D(IO("Q")) D O^%ZIS4:'POP&(%ZISB&(%IS'["T"))
18 G Q
19DEVOK N X,Y,X1
20 S X=IO,X1=%ZTYPE
21 D DEVOK^%ZOSV I Y=-99!(Y=0)!(Y=$J) Q
22 I Y>0 S POP=1 W:'$D(IOP)&('$D(%ZISHG(0))!(%IS["D")) !,*7,"[Device Unavailable]" Q
23 I Y=-1 S IO="",POP=1 W:'$D(IOP)&('$D(ZISHG(0))!(%IS["D")) !,*7,"[Device does not Exist or Unavailable]" Q
24 Q
25 ;
26 ;
27 ;
28MARGN I %Y="",'$D(IOP),$G(%ZISIOS),%ZISIOS=+$G(IO("HOME")) S %Y=$$AUTOMARG I $G(%Y) W " (",+%Y,"x",$P(%Y,"^",2),")" S $P(%Z91,"^")=+%Y,$P(%Z91,"^",3)=$P(%Y,"^",2) Q
29M S %A=$P(%Y,";")
30 I %A?1A.ANP D SUBIEN(.%A,1) I $D(^%ZIS(2,%A,1)) K %Z91 D ST(1) S %Y=$P(%Y,";",2,9),%ZISMY=$P(%ZISMY,";",2,9) G M ;**GFT
31 S:$P(%Y,";",2) $P(%Z91,"^",3)=+$P(%Y,";",2) I %A>3 S $P(%Z91,"^")=$S(%A>511:511,1:+%A)
32ALTP I '$D(IO("P")) Q:%A>3 G ASKMAR:%ZTYPE["TRM" Q
33 S %X=$F(IO("P"),"M") I %X S %A=+$E(IO("P"),%X,99),$P(%Z91,"^")=$S(%A>255:255,1:%A)
34 S %X=$F(IO("P"),"L") I %X S $P(%Z91,"^",3)=+$E(IO("P"),%X,99)
35 Q:%A>3!(%ZTYPE'["TRM")
36ASKMAR I %IS["M",'$D(IOP),$S(%E=%H:+$P(%Z,"^",3),1:1),$P(%Z,"^",4) W " Right Margin: " W:$P(%Z91,"^")]"" +%Z91,"// "
37 E Q
38 D SBR^%ZIS1 I '$D(DTOUT)&'$D(DUOUT) S:%X=""&($P(%Z91,"^")]"") %X=+%Z91 G ASKMAR:%X'?1.N S $P(%Z91,"^")=$S(%X>511:511,1:%X) Q
39 S POP=1 I %ZISB&(%ZTYPE["TRM")&(IO'=IO(0)) C IO K IO(1,IO) Q
40 Q
41 ;
42 ;
43AUTOMARG(X) ;RETURNS X=IOM^IOSL IF IT CAN --GTM
44 N %I,%T,ESC,DIM S %I=$I,%T=$T D
45 . ; resize terminal to match actual dimensions
46 . S ESC=$C(27)
47 . W ESC,"7",ESC,"[r",ESC,"[999;999H",ESC,"[6n"
48 . U $P:(TERM="R":NOECHO) R DIM:1 E Q
49 . W ESC,"8"
50 . I DIM?.APC U $P:(TERM="":ECHO) Q
51 . S DIM=+$P(DIM,";",2)_"^"_+$P(DIM,"[",2)
52 . U $P:(TERM="":ECHO:WIDTH=+$P(DIM,";",2):LENGTH=+$P(DIM,"[",2))
53 ; restore state
54 U %I I %T
55 Q $S(DIM:DIM,1:"")
56 ;
57 ;
58 ;
59 ;
60SETPAR S:%ZISOPAR]""&($A(%ZISOPAR)-40) %ZISOPAR="("_%ZISOPAR_")"
61 Q
62AQUE W ! S %=$S($D(IO("Q")):1,1:2),U="^",%ZISDTIM=60
63 I $D(IO("Q")) W !,"Previously, you have selected queueing."
64 W !,"Do you "_$S($D(IO("Q")):"STILL ",1:"")_"want your output QUEUED"
65 D YN^%ZIS1 K %ZISDTIM G AQUE:%=0 Q:$D(IO("Q"))
66 I %=-1 S POP=1,%ZISHPOP=1,%ZISUOUT=1 C IO K IO(1,IO) Q
67 I %=1 S IO("Q")=1 C IO K IO(1,IO) Q
68 Q
69ST(%ZISTP) ;
70 S %ZISIOST(0)=%A,%ZISIOST=$P($G(^%ZIS(2,%A,0)),"^")
71 S:'$D(%Z91) %Z91=$P($G(^%ZIS(2,%A,1),"132^#^60^$C(8)"),"^",1,4),$P(%Z91,"^",5)=$G(^("XY"))
72 Q:%ZISTP
73STP N %B ;%E is a pointer to the Device file
74 S %B=$G(^%ZIS(1,%E,91))
75 S:$P(%B,"^")]"" $P(%Z91,"^")=+%B S:$P(%B,"^",3)]"" $P(%Z91,"^",3)=$P(%B,"^",3) ;S $P(%Z91,"^",5)=$G(^%ZIS(2,%ZISIOST(0),"XY"))
76 Q
77SUBIEN(%1,%) ;Return Subtype ien.
78 N %XX,%YY
79 I $D(^%ZIS(2,"B",%1))>9 S %1=+$O(^%ZIS(2,"B",%1,0)) Q
80 I '$G(%) S X="" Q
81 S %XX=%1 D 2^%ZIS5 S %1=+%YY
82 Q
83SUBTYPE(%A) ;Called from %ZISH
84 N %ZISIOST,%Z91
85 S:$G(%A)="" %A="P-OTHER"
86 D SUBIEN(.%A),ST(1)
87 S IOM=$P(%Z91,U,1),IOF=$P(%Z91,U,2),IOSL=$P(%Z91,U,3),IOST=%ZISIOST,IOST(0)=%ZISIOST(0),IOBS="$C(8)"
88 S:IOST="" IOST="P-OTHER",IOST(0)=0
89 Q
90
Note: See TracBrowser for help on using the repository browser.