1 | XUDHGUI ;ISF/STAFF,SLC/KCM - Device Utilites for Windows Calls ;07/09/2002 14:28
|
---|
2 | ;;8.0;KERNEL;**220**;Jul 10, 1995
|
---|
3 | ;
|
---|
4 | DEVICE(LST,FROM,DIR,RMAR) ; Return a subset of entries from the Device file
|
---|
5 | ; Return up to 20 entries.
|
---|
6 | ; .LST(n)=IEN^Name^DisplayName^Location^RMar^PLen
|
---|
7 | ; FROM=text to $O from. Allow the DisplayName to be used.
|
---|
8 | ; Allow "NAME*" to get count limit from that starting point.
|
---|
9 | ; DIR=$O direction
|
---|
10 | ; [RMAR]=min RM value or min-max value (Default to 80).
|
---|
11 | N I,IEN,CNT,FR,SHOW,X,RML,RMH
|
---|
12 | S I=0,CNT=$G(CNT,20),RMAR=$G(RMAR,80)
|
---|
13 | I '$G(DIR) S DIR=1
|
---|
14 | S RML=+RMAR,RMH=$S(RMAR["-":$P(RMAR,"-",2),1:99999)
|
---|
15 | ;Allow the DisplayName to be used.
|
---|
16 | I FROM[" <" S FROM=$RE($P($RE(FROM),"< ",2))
|
---|
17 | S FR=FROM I FROM["*" S FROM=$P(FROM,"*",1),FR=""
|
---|
18 | F Q:I'<CNT S FROM=$O(^%ZIS(1,"B",FROM),DIR) Q:(FROM="") D
|
---|
19 | . I $L(FR),($E(FROM,1,$L(FR))'=FR) Q
|
---|
20 | . S IEN=0 F S IEN=$O(^%ZIS(1,"B",FROM,IEN)) Q:'IEN D
|
---|
21 | .. N X0,X1,X90,X91,X95,XTYPE,XSTYPE,XTIME,%A,%C,%H,%L,%X,EXT
|
---|
22 | .. Q:'$D(^%ZIS(1,IEN,0)) S X0=^(0),X1=$G(^(1)),X90=$G(^(90)),X91=$G(^(91)),X95=$G(^(95)),XSTYPE=$G(^("SUBTYPE")),XTIME=$G(^("TIME")),XTYPE=$G(^("TYPE"))
|
---|
23 | .. I $E($G(^%ZIS(2,+XSTYPE,0)))'="P" Q ;Printers only
|
---|
24 | .. S X=$P(XTYPE,"^") I X'="TRM",X'="HG",X'="HFS",X'="CHAN" Q ;Device Types
|
---|
25 | .. I ($P(X0,U,2)="0")!($P(X0,U,12)=2) Q ;Queuing allowed
|
---|
26 | .. S X=+X90 I X,(X'>DT) Q ;Out of Service
|
---|
27 | .. ;%C is current time, %L is lower limit, %H is upper limit
|
---|
28 | .. S %A=$P(XTIME,"^") I $L(%A) S %C=$P($H,",",2),%C=%C\60#60+(%C\3600*100),%H=$P(%A,"-",2),%L=+%A I $S(%H'<%L:(%C'>%H&(%C'<%L)),1:(%C'<%L!(%C'>%H))) Q ;Prohibited Times
|
---|
29 | .. S EXT=0
|
---|
30 | .. I X95]"" S %X=$G(DUZ(0)) I %X'="@" S EXT=1 F %A=1:1:$L(%X) I X95[$E(%X,%A) S EXT=0 Q
|
---|
31 | .. Q:EXT ;Security check
|
---|
32 | .. I '+X91 S X91=^%ZIS(2,+XSTYPE,1) ;Get default width & page length
|
---|
33 | .. I RML>0,(+X91<RML)!(+X91>RMH) Q
|
---|
34 | .. S SHOW=$P(X0,U) I SHOW'=FROM S SHOW=FROM_" <"_SHOW_">"
|
---|
35 | .. S I=I+1,LST(I)=IEN_U_$P(X0,U)_U_SHOW_U_$P(X1,U)_U_$P(X91,U)_U_$P(X91,U,3)
|
---|
36 | Q
|
---|
37 |
|
---|