source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LAPORTXX.m@ 724

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

initial load of WorldVistAEHR

File size: 2.2 KB
Line 
1LAPORTXX ;SLC/DLG - AUTOMATED SINGLE INSTRUMENT LAB INTERFACE ;8/16/90 14:22 ;
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
3 ;THIS ROUTINE IS STARTED TO RUN AN INSTRUMENT DIRECT TO A CPU
4 ;RATHER THAN THRU THE LSI. IT IS A CONSTANT BACKGROUND JOB
5 ;THAT ONLY STOPS WHEN SYSTEM IS TAKEN DOWN OR THE JOB IS STOPPED BY
6 ;SETTING THE ^LA("STOP",INST#)=""
7 ;THE CODE HAS A DATA TRAP CAPABILITY TO TRAP ALL DATA GOING THRU
8 ;THIS ROUTINE. S ^LA("D"_T,0)=0 WHERE T IS THE AUTOINSTRUMENT
9 ;ENTRY NUMBER WILL TURN THE TRAP ON. K ^LA("D"_T) WILL TURN THE
10 ;TRAP OFF AND KILL ALL THE DATA.
11 S:$D(ZTQUEUED) ZTREQ="@"
12 S LANM=$T(+0),(HOME,T)=+$E(LANM,7,8) Q:+T<1 Q:$D(^LA("LOCK",T))
13 S DEB="D"_T,PAR=$S($D(^LAB(62.4,T,.5))#2:^(.5),1:""),OUT="",BASE=0,TOUT=5,U="^",IOP=^LAB(62.4,HOME,.75) G:IOP="" H^XUS
14 S IOP=IOP_";255",%ZIS="" D ^%ZIS G:POP H^XUS U IO X ^%ZOSF("TYPE-AHEAD"),^%ZOSF("LABOFF")
15 C:IO(0)'=IO IO(0) S X="TRAP^"_LANM,@^%ZOSF("TRAP"),DUZ=.5
16 S ^LA("LOCK",T)=$J
17 R X:1,X:1 ;ALLOW BREAK AND FLUSH BUFFER
18LA2 S:'$D(^LA(T,"Q")) ^LA(T,"Q")=0 S:(OUT]""&$D(^LA(DEB,0))) (Q,^LA(DEB,0))=^LA(DEB,0)+1,^(Q)="OUT: "_OUT_"%^%"_$H W:OUT]"" OUT,! S TRY=0,(OUT,IN)=""
19RD R IN:TOUT G TOUT:'$T S:$D(^LA(DEB,0)) (Q,^LA(DEB,0))=^LA(DEB,0)+1,^(Q)="IN: "_IN_"%^%"_$H S:$E(IN,1)=$C(1) IN=$E(IN,2,999)
20IO1 S TOUT=5 IF T=HOME S RT=$H,ASK=-2
21IO2 D SET
22 L ^LA(T) G IO2:'$D(^LA(T,"I"))#2 S CNT=^LA(T,"I")+1,^("I")=CNT,^("I",CNT)=IN L
23 I PAR]"" S OUT="" X PAR I OUT]"" S T=T+BASE G LA2
24W S:'$D(^LA(T,"Q")) ^("Q")=0 IF $D(^LA("STOP",HOME)) K ^LA("LOCK",HOME),^LA("STOP",HOME) G H^XUS
25 S OUT="" G LA2:^LA("Q")'>^LA(HOME,"Q") L ^LA("Q") S Q=0
26 F I=0:0 S Q=$O(^LA("Q",Q)) Q:Q<1 Q:^(Q)=T
27 L K:Q>0 ^LA("Q",Q) G LA2:Q<1
28 I $D(^LA(T,"O",0)) S CNT=^LA(T,"O",0)+1 IF $D(^(CNT)) S ^(0)=CNT,OUT=^(CNT)
29 S TOUT=5 G LA2
30 ;
31SET S:'$D(^LA(T,"I"))#2 ^LA(T,"I")=0,^("I",0)=0 S:'$D(^LA(T,"O"))#2 ^LA(T,"O")=0,^("O",0)=0,^LA(T,"Q")=0 Q:$D(^LA(T,"ENV")) D GETENV^%ZOSV S ^LA(T,"ENV")=Y Q
32 ;
33TOUT S TOUT=$S(TOUT<15:TOUT+1,1:5) S OUT="" I $D(^LA(T,"O",0)),(^LA(T,"O")>^LA(T,"O",0)) G W
34 G RD Q
35OUT S CNT=^LA(T,"O")+1,^("O")=CNT,^("O",CNT)=OUT
36 LOCK ^LA("Q") S Q=^LA("Q")+1,^("Q")=Q,^("Q",Q)=T LOCK
37 Q
38DQ K ^LA("LOCK",T) I $D(^LA("Q")),$O(^LA("Q"))="" K ^LA("Q")
39 G LAPORTXX
40TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM)
Note: See TracBrowser for help on using the repository browser.