Merge lp:~jontai/openvista-gtm-integration/additional-routines into lp:openvista-gtm-integration
- additional-routines
- Merge into mainline
Proposed by
Jon Tai
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~jontai/openvista-gtm-integration/additional-routines |
Merge into: | lp:openvista-gtm-integration |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~jontai/openvista-gtm-integration/additional-routines |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
jeff.apple | Needs Fixing | ||
JSHER | Approve | ||
Review via email: mp+6094@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
JSHER (joel-sher) : | # |
review:
Approve
- 44. By Jon Tai <jon@interceptor>
-
new version of ZSTART (named ZSTARTGUX; the KIDS build will rename it to ZSTART during installation)
- 45. By Jon Tai <jon@interceptor>
-
this should be named ZTER
- 46. By Jon Tai <jon@interceptor>
-
take Joel's version of ZTER
- 47. By Jon Tai <jon@interceptor>
-
give credit back to Robert Larson
- 48. By Jon Tai <jon@interceptor>
-
take Joel's version of ZTMGRSET
- 49. By Jon Tai <jon@interceptor>
-
update ZCD from Joel
- 50. By Jon Tai <jon@interceptor>
-
change ZSTOP to be like ZSTART
- 51. By Jon Tai <jon@interceptor>
-
one last missing routine
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'mumps/MSCGUX53.m' |
2 | --- mumps/MSCGUX53.m 1970-01-01 00:00:00 +0000 |
3 | +++ mumps/MSCGUX53.m 2009-04-30 17:33:21 +0000 |
4 | @@ -0,0 +1,7 @@ |
5 | +MSCGUX53 ;MSC/JDS - ENVIRONMENT CHECK ; ; 29 Apr 2009 1:47 PM |
6 | + ;;**MSC**; |
7 | + I $G(^%ZOSF("OS"))'["GT.M" Q ;Not GTM |
8 | + I $P($ZV,"V",2)<5.3 D MESS^XPDUL("GT.M version must be 5.3 or Greater") S XPDABORT=2 |
9 | + |
10 | + |
11 | + |
12 | |
13 | === added file 'mumps/MSCXUS3A.m' |
14 | --- mumps/MSCXUS3A.m 1970-01-01 00:00:00 +0000 |
15 | +++ mumps/MSCXUS3A.m 2009-04-30 17:33:05 +0000 |
16 | @@ -0,0 +1,59 @@ |
17 | +MSCXUS3A ;SF-ISC/STAFF MSC/JDS - CHANGE UCI'S ;24DEC2004 |
18 | + ;;8.0;KERNEL;**13,282,MSC**;Jul 10, 1995 |
19 | + Q |
20 | + ;PICK A UCI TO SWITCH TO |
21 | +SWITCH ;Allow users that have the UCI fIeld In there NP fIle to swItch UCI's. |
22 | + W !!,"Switch UCI's optIon.",! |
23 | + ;I $$PROGMODE^%ZOSV() W !,$C(7),"No switching UCI's In Programmer Mode." Q |
24 | + N DIR,X,Y,PGM,%UCI,DEF,L,USERNAME |
25 | + S DEF="ZU" ;DEF is default routine to swItch to. |
26 | +UCI Q:'$G(DUZ) S USERNAME=$P($G(^VA(200,DUZ,0)),U) Q:USERNAME="" |
27 | + S DIR(0)="S^"_$$NSP(USERNAME) I DIR(0)'[";" W "YOU AREN'T A USER IN ANY OTHER NAMESPACE" Q |
28 | + S DIR("A")="Select NAMESPACE" |
29 | + D ^DIR K DIR I $D(DUOUT)!$D(DTOUT)!(U[X) Q |
30 | +SAME I X="" Q ;Didn't select anythIng. |
31 | + ;D PM |
32 | + S (X,%UCI)=Y(0) X ^%ZOSF("UCICHECK") I 0[Y G BAD |
33 | + K XQY0 S Y=$O(^[%UCI]VA(200,"B",USERNAME,0)) |
34 | + I Y S DIR=$P($G(^[%UCI]VA(200,Y,201)),U) |
35 | + I DIR,$P($G(^[%UCI]DIC(19,DIR,0)),U,4)="M" S DUZ=Y,XQY=DIR,(DEF,PGM)="%MSCXUCI" G NXT |
36 | +BAD W !,"UCI not found!" D SHOW G UCI |
37 | + ; |
38 | +NXT ;Here we go. |
39 | + D C^XUSCLEAN K ^XUTL("XQ",$J),^XUTL($J),^TMP($J),^UTILITY($J) |
40 | + K DA G GO^%MSCXUCI |
41 | + ; |
42 | + ; |
43 | +SHOW W ! S I=0,UC="",X=$S($D(^VA(200,DUZ,201)):+^(201),1:0) |
44 | + W !,"Enter ^ to return to your current menu, or select from:" |
45 | + F I=0:0 S I=$O(^VA(200,DUZ,.2,I)) Q:I'>0 D |
46 | + . W !,?5 S UC=$G(^VA(200,DUZ,.2,I,0)),X=$P(UC,U,1),UC=$P(UC,U,2,99) |
47 | + . I UC'[":" W I |
48 | + . D PM W ?10,X X ^%ZOSF("UCICHECK") I 0[Y W " -- Not currently a valId UCI!",$C(7) Q |
49 | + . W:UC]"" ":"_UC |
50 | + . Q |
51 | + Q |
52 | + ; |
53 | +PM I X="PROD"!(X="MGR") S X=^%ZOSF(X) |
54 | + Q |
55 | + ; |
56 | + ; |
57 | + ; |
58 | +NSP(USERNAME) ;LIST OTHER NAMESPACES WHERE THIS USER IS |
59 | + N X,L,I,Y |
60 | + X ^%ZOSF("UCI") S Y=$P(Y,",") I ^%ZOSF("OS")["GT.M" G GTMNSP |
61 | + f I=1:1:$zu(90,0) s L($zu(90,2,0,I))="" ;***CACHE-SPECIFIC FROM %NSP |
62 | + S (I,L,X)="" F S I=$O(L(I)) Q:I="" I I'=Y D ;NOT THE CURRENT ONE |
63 | + .N DUZ S DUZ=$O(^[I]VA(200,"B",USERNAME,0)) Q:'DUZ |
64 | + .I $P($G(^[I]VA(200,DUZ,0)),U,3)=""!'$G(^(201)) Q ;THEY MUST HAVE ACCESS CODE AND PRIMARY MENU OPTION OVER THERE |
65 | + .S L=L+1,X=X_L_":"_I_";" |
66 | + Q X |
67 | +GTMNSP ; |
68 | + N CURRENT S CURRENT=Y |
69 | + D LIST^ZCD() |
70 | + S (I,L,X)="" F S I=$O(Y(I)) Q:'I S A=Y(I) I A'=CURRENT D ;NOT THE CURRENT ONE |
71 | + .S A=$P($ZG,"/"_$$CURRENT^ZCD_"/")_"/"_A_"/"_$P($ZG,"/"_$$CURRENT^ZCD_"/",2) |
72 | + .N DUZ S DUZ=$O(^[A]VA(200,"B",USERNAME,0)) Q:'DUZ |
73 | + .I $P($G(^[A]VA(200,DUZ,0)),U,3)=""!'$G(^(201)) Q ;THEY MUST HAVE ACCESS CODE AND PRIMARY MENU OPTION OVER THERE |
74 | + .S L=L+1,X=X_L_":"_A_";" |
75 | + Q X |
76 | |
77 | === added file 'mumps/RORHL7A.m' |
78 | --- mumps/RORHL7A.m 1970-01-01 00:00:00 +0000 |
79 | +++ mumps/RORHL7A.m 2009-04-30 17:33:05 +0000 |
80 | @@ -0,0 +1,250 @@ |
81 | +RORHL7A ;HCIOFO/SG MSC/JDS- HL7 UTILITIES ; 7/29/05 1:35pm |
82 | + ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006 |
83 | + ; |
84 | + Q |
85 | + ; |
86 | + ;***** ADDS THE SEGMENT TO THE HL7 MESSAGE BUFFER |
87 | + ; |
88 | + ; SEG Complete HL7 segment |
89 | + ; |
90 | + ; The ADDSEGC^RORHL7A procedure adds the HL7 segment to the HL7 |
91 | + ; message buffer defined by the ROREXT("HL7BUF") parameter |
92 | + ; (the ^TMP("HLS",$J), by default). The <TAB>, <CR> and <LF> |
93 | + ; characters are replaced with spaces. Long segments are split |
94 | + ; among sub-nodes of the main segment node in the destination |
95 | + ; buffer. |
96 | + ; |
97 | + ; The RORHL array and some nodes of the ROREXT array must be |
98 | + ; initialized (either by the $$INIT^RORHL7 or manually) before |
99 | + ; calling this procedure. |
100 | + ; |
101 | +ADDSEGC(SEG) ; |
102 | + N I1,I2,MAXLEN,NODE,PTR,PTR1,SID,SL |
103 | + S NODE=ROREXT("HL7BUF"),PTR=$G(ROREXT("HL7PTR"))+1 |
104 | + S HLFS=RORHL("FS"),HLECH=RORHL("ECH") |
105 | + Q:$P(SEG,HLFS)="" ; Segment Name |
106 | + ;--- Assign the Set ID if necessary |
107 | + S SID=$$SETID($P(SEG,HLFS)) |
108 | + S:SID>0 $P(SEG,HLFS,2)=SID |
109 | + ;--- Remove empty trailing fields |
110 | + S I2=$L(SEG,HLFS) |
111 | + F I1=I2:-1:1 Q:$TR($P(SEG,HLFS,I1),HLECH)'="" |
112 | + S:I1<I2 $P(SEG,HLFS,I1+1,I2)="" |
113 | + ;--- Store the segment |
114 | + S SL=$L(SEG),MAXLEN=245 K @NODE@(PTR) |
115 | + S @NODE@(PTR)=$TR($E(SEG,1,MAXLEN),$C(9,10,13)," ") |
116 | + S ROREXT("HL7SIZE")=$G(ROREXT("HL7SIZE"))+SL+1 |
117 | + ;--- Split the segment into sub-nodes if necessary |
118 | + D:SL>MAXLEN |
119 | + . S I2=MAXLEN |
120 | + . F PTR1=1:1 S I1=I2+1,I2=I1+MAXLEN-1 Q:I1>SL D |
121 | + . . S @NODE@(PTR,PTR1)=$TR($E(SEG,I1,I2),$C(9,10,13)," ") |
122 | + ;--- Save the pointer |
123 | + S ROREXT("HL7PTR")=PTR |
124 | + Q |
125 | + ; |
126 | + ;***** ASSEMBLES THE SEGMENT AND ADDS IT TO THE HL7 MESSAGE BUFFER |
127 | + ; |
128 | + ; .FIELDS Reference to a local variable where the HL7 |
129 | + ; fields are stored |
130 | + ; |
131 | + ; FIELDS( |
132 | + ; 0) Segment name |
133 | + ; I, Field value |
134 | + ; i) Continuation of the value if it is |
135 | + ; ... longer than than 245 characters |
136 | + ; |
137 | + ; The ADDSEGF^RORHL7A procedure assembles the HL7 segment from |
138 | + ; provided field values and adds it to the HL7 message buffer |
139 | + ; defined by the ROREXT("HL7BUF") node (the ^TMP("HLS",$J), by |
140 | + ; default). The <TAB>, <CR> and <LF> characters are replaced with |
141 | + ; spaces. Long segments are split among sub-nodes of the main |
142 | + ; segment node in the destination buffer. |
143 | + ; |
144 | + ; The RORHL array and some nodes of the ROREXT array must be |
145 | + ; initialized (either by the $$INIT^RORHL7 or manually) before |
146 | + ; calling this procedure. |
147 | + ; |
148 | +ADDSEGF(FIELDS) ; |
149 | + ; RORBUF Temporary buffer for the segment construction |
150 | + ; RORIS Current continuation subscript in the HL7 buffer |
151 | + ; RORNODE Closed root of the HL7 message buffer |
152 | + ; RORPTR Current subscript in the HL7 message buffer |
153 | + ; RORSL Number of characters that can be appended to the |
154 | + ; RORBUF before it has to be emptied into the HL7 |
155 | + ; message buffer |
156 | + ; |
157 | + N FLD,I,LASTFLD,RORBUF,RORIS,RORNODE,RORPTR,RORSL |
158 | + Q:$G(FIELDS(0))="" ; Segment Name |
159 | + S RORNODE=ROREXT("HL7BUF"),RORPTR=$G(ROREXT("HL7PTR"))+1 |
160 | + S HLFS=RORHL("FS"),HLECH=RORHL("ECH") |
161 | + ;--- Assign the Set ID if necessary |
162 | + S I=$$SETID(FIELDS(0)) |
163 | + S:I>0 FIELDS(1)=I |
164 | + ;--- Remove empty trailing fields |
165 | + S I=$NA(FIELDS) |
166 | + N A,CNT F S I=$Q(@I) Q:I="" S CNT=$G(CNT)+1,A(CNT)=I I $TR(@I,HLECH)'="" K A,CNT |
167 | + F I=1:1 Q:'$D(A(I)) K @A(I) |
168 | + ;--- Initialize construction variables |
169 | + S RORBUF=FIELDS(0),I=$L(RORBUF) |
170 | + S ROREXT("HL7SIZE")=$G(ROREXT("HL7SIZE"))+I+1 |
171 | + S RORIS=0,RORSL=245-I |
172 | + ;--- Append the fields and store the segment |
173 | + S LASTFLD=+$O(FIELDS(" "),-1) |
174 | + F FLD=1:1:LASTFLD D |
175 | + . D APPEND(HLFS_$G(FIELDS(FLD))) |
176 | + . ;--- Process the field continuation nodes |
177 | + . S I="" |
178 | + . F S I=$O(FIELDS(FLD,I)) Q:I="" D APPEND(FIELDS(FLD,I)) |
179 | + ;--- Flush the buffer if necessary |
180 | + D:RORBUF'="" |
181 | + . I 'RORIS S @RORNODE@(RORPTR)=RORBUF Q |
182 | + . S @RORNODE@(RORPTR,RORIS)=RORBUF |
183 | + S ROREXT("HL7PTR")=RORPTR |
184 | + Q |
185 | + ; |
186 | + ;***** APPENDS THE FIELD VALUE TO THE HL7 SEGMENT |
187 | + ; |
188 | + ; VAL Value of the field (or its part) |
189 | + ; |
190 | + ; This is an internal function. Do not call it directly. |
191 | + ; |
192 | +APPEND(VAL) ; |
193 | + N BASE,L |
194 | + S VAL=$TR(VAL,$C(9,10,13)," "),L=$L(VAL) |
195 | + S ROREXT("HL7SIZE")=$G(ROREXT("HL7SIZE"))+L |
196 | + I L'>RORSL S RORBUF=RORBUF_VAL,RORSL=RORSL-L Q |
197 | + ;--- |
198 | + S RORBUF=RORBUF_$E(VAL,1,RORSL),L=L-RORSL |
199 | + S BASE=1 |
200 | + F D Q:L'>0 |
201 | + . I 'RORIS S @RORNODE@(RORPTR)=RORBUF |
202 | + . E S @RORNODE@(RORPTR,RORIS)=RORBUF |
203 | + . S BASE=BASE+RORSL,RORIS=RORIS+1,RORSL=245 |
204 | + . S RORBUF=$E(VAL,BASE,BASE+RORSL-1),L=L-RORSL |
205 | + S RORSL=-L |
206 | + Q |
207 | + ; |
208 | + ;***** RETURNS THE BHS SEGMENT |
209 | + ; |
210 | + ; BID Batch message ID |
211 | + ; |
212 | + ; [BDT] Batch message creation time in internal FileMan |
213 | + ; format (NOW by default) |
214 | + ; |
215 | + ; [COMMENT] Optional comment |
216 | + ; |
217 | + ; The RORHL local variable must be initialized by the $$INIT^RORHL7 |
218 | + ; function before calling this entry point. |
219 | + ; |
220 | +BHS(BID,BDT,COMMENT) ; |
221 | + N CS,SEG,TMP |
222 | + D BHS^HLFNC3(.RORHL,BID,.SEG) |
223 | + Q:$G(SEG)="" "" |
224 | + S HLFS=RORHL("FS"),HLECH=RORHL("ECH"),CS=$E(HLECH,1) |
225 | + ;--- Post-processing |
226 | + S SEG=SEG_$G(SEG(1)) |
227 | + S:$G(BDT)'>0 BDT=$$NOW^XLFDT |
228 | + S TMP=$E($P($$SITE^VASITE,U,3),1,3) |
229 | + S $P(SEG,HLFS,4)=TMP_CS_$G(^XMB("NETNAME"))_CS_"DNS" |
230 | + S $P(SEG,HLFS,5)="ROR AAC" |
231 | + S $P(SEG,HLFS,7)=$$FMTHL7^XLFDT(BDT) |
232 | + S TMP=$P(SEG,HLFS,9) |
233 | + S $P(TMP,CS,3)=$P(TMP,CS,3)_$E(HLECH,2)_$G(RORHL("ETN")) |
234 | + S $P(SEG,HLFS,9)=TMP |
235 | + S $P(SEG,HLFS,10)=$G(COMMENT) |
236 | + Q SEG |
237 | + ; |
238 | + ;***** RETURNS BTS SEGMENT |
239 | + ; |
240 | + ; MSGCNT Batch message count |
241 | + ; [COMMENT] Batch comment |
242 | + ; |
243 | + ; The RORHL variable must be initialized by the INIT^HLFNC2 before |
244 | + ; calling this entry point |
245 | + ; |
246 | +BTS(MSGCNT,COMMENT) ; |
247 | + Q "BTS"_RORHL("FS")_MSGCNT_RORHL("FS")_$G(COMMENT) |
248 | + ; |
249 | + ;***** LOADS THE HL7 FIELD (OR ITS PART) TO THE BUFFER |
250 | + ; |
251 | + ; VAL Value of the field (or its part) |
252 | + ; |
253 | + ; FLD Number of the field in the segment (piece number) |
254 | + ; |
255 | +FIELD(VAL,FLD) ; |
256 | + N BASE,L |
257 | + S:FLD>RORFLD RORFLD=FLD,RORIS=0,RORSL=245 |
258 | + S L=$L(VAL),BASE=1 |
259 | + F RORIS=RORIS:1 D Q:L'>0 |
260 | + . I 'RORIS S RORSEG(RORFLD)=$G(RORSEG(RORFLD))_$E(VAL,BASE,BASE+RORSL-1) |
261 | + . E S RORSEG(RORFLD,RORIS)=$G(RORSEG(RORFLD,RORIS))_$E(VAL,BASE,BASE+RORSL-1) |
262 | + . S BASE=BASE+RORSL,L=L-RORSL,RORSL=245 |
263 | + S RORSL=-L |
264 | + Q |
265 | + ; |
266 | + ;***** LOADS THE HL7 SEGMENT INTO THE RPOVIDED BUFFER |
267 | + ; |
268 | + ; .RORSEG Reference to a local variable where the HL7 |
269 | + ; fields will be stored. The fields are stored |
270 | + ; in the following format: |
271 | + ; |
272 | + ; RORSEG(FldNum)=FldVal |
273 | + ; |
274 | + ; If the value is longer that 245 characters then |
275 | + ; the continuation nodes are created: |
276 | + ; |
277 | + ; RORSEG(FldNum,#)=FldValCont |
278 | + ; |
279 | + ; ROR8SRC Closed root of the source buffer containing |
280 | + ; the HL7 segment |
281 | + ; |
282 | +LOADSEG(RORSEG,ROR8SRC) ; |
283 | + N BUF,FLD,I,IFL,NFL,RORFLD,RORIS,RORSL |
284 | + S HLFS=RORHL("FS") K RORSEG |
285 | + ;--- Process the main segment |
286 | + S BUF=$G(@ROR8SRC),NFL=$L(BUF,HLFS) |
287 | + F IFL=1:1:NFL S RORSEG(IFL-1)=$P(BUF,HLFS,IFL) |
288 | + Q:$D(@ROR8SRC)<10 |
289 | + ;--- Process the sub-segments |
290 | + S (FLD,RORFLD)=NFL-1,RORIS=0,RORSL=245-$L(RORSEG(FLD)) |
291 | + S I="" |
292 | + F S I=$O(@ROR8SRC@(I)) Q:I="" D |
293 | + . S BUF=@ROR8SRC@(I),NFL=$L(BUF,HLFS) |
294 | + . D FIELD($P(BUF,HLFS),FLD) |
295 | + . F IFL=2:1:NFL S FLD=FLD+1 D FIELD($P(BUF,HLFS,IFL),FLD) |
296 | + Q |
297 | + ; |
298 | + ;***** RETURNS TEXT EXPLANATIONS OF THE HL7 MESSAGE STATUS |
299 | + ; |
300 | + ; MSGST Status value returned by the $$MSGSTAT^HLUTIL |
301 | + ; |
302 | +MSGSTXT(MSGST) ; |
303 | + N ST S ST=+MSGST |
304 | + Q:'ST "Message does not exist" |
305 | + Q:ST=1 "Waiting in queue" |
306 | + Q:ST=1.5 "Opening connection" |
307 | + Q:ST=1.7 "Awaiting response" |
308 | + Q:ST=2 "Awaiting application ack" |
309 | + Q:ST=3 "Successfully completed" |
310 | + Q:ST=4 "Error" |
311 | + Q:ST=8 "Being generated" |
312 | + Q:ST=9 "Awaiting processing" |
313 | + Q "Unknown" |
314 | + ; |
315 | + ;***** ASSIGNS THE 'SET ID' |
316 | + ; |
317 | + ; SEGNAME Name of the HL7 segment |
318 | + ; [DISINC] Disable increment of the Set ID |
319 | + ; |
320 | + ; Return Values: |
321 | + ; "" Not required for this segment |
322 | + ; >0 Value for the Set ID field |
323 | + ; |
324 | +SETID(SEGNAME,DISINC) ; |
325 | + N SETID |
326 | + Q:$G(SEGNAME)="" "" |
327 | + S SETID=+$G(ROREXT("HL7SID",SEGNAME)) |
328 | + Q:SETID'>0 "" |
329 | + S:'$G(DISINC) ROREXT("HL7SID",SEGNAME)=SETID+1 |
330 | + Q SETID |
331 | |
332 | === added file 'mumps/ZCD.m' |
333 | --- mumps/ZCD.m 1970-01-01 00:00:00 +0000 |
334 | +++ mumps/ZCD.m 2009-05-01 17:29:59 +0000 |
335 | @@ -0,0 +1,172 @@ |
336 | +ZCD ; MSC/JKT,JDS ; "Namespace" utilities for GT.M/Unix ; 01/30/2009 |
337 | + ;;8.0;KERNEL;**MSC**;April 21 2009 |
338 | + ; This routine assumes that your global directory file exists one |
339 | + ; directory below the root of the instance, e.g., |
340 | + ; |
341 | + ; /opt/openvista/instance/globals/mumps.gld |
342 | + ; |
343 | + ; or |
344 | + ; |
345 | + ; /home/vista/instance/g/default.gld |
346 | + ; |
347 | + ; The actual file name of the global directory file and the actual name |
348 | + ; of the parent directory are never checked, so their names do not |
349 | + ; matter. |
350 | + G CD |
351 | + ; |
352 | +CURRENT() |
353 | + ; return the name of the current OpenVista instance |
354 | + Q $P($ZG,"/",$L($ZG,"/")-2) |
355 | + ; |
356 | +PATH() |
357 | + ; return the path to the current OpenVista instance |
358 | + N I,X S X="" |
359 | + S X=$P($ZG,"/",1,$L($ZG,"/")-2) |
360 | + Q X |
361 | + ; |
362 | +ROOT() |
363 | + ; return the path where all OpenVista instances live |
364 | + N I,X S X="" |
365 | + S X=$P($ZG,"/",1,$L($ZG,"/")-3) |
366 | + Q X |
367 | + ; |
368 | +LIST() |
369 | + ; returns an array (Y) of OpenVista instances on this system |
370 | + ; |
371 | + ; FIXME: a "user friendly" version of this list should screen out the |
372 | + ; current instance name and any instances that the current user |
373 | + ; should not be allowed to switch to (they must have access |
374 | + ; code and primary menu option in the target instance to switch) |
375 | + ; |
376 | + ; FIXME: this routine currently requires GT.M V5.3003 because it uses |
377 | + ; PIPE I/O. We many want to make it compatible with older |
378 | + ; versions of GT.M by falling back to using temporary files, |
379 | + ; but on versions of GT.M V5.3003 and later, we definitely want |
380 | + ; to use PIPEs to avoid temporary files moving forward. |
381 | + N P,I,X |
382 | + S P="ls" |
383 | + O P:(COMMAND="ls --color=none -1 "_$$ROOT():READONLY)::"PIPE" |
384 | + U P |
385 | + F I=1:1 R X Q:X="" S Y(I)=X,Y("B",X)="" |
386 | + U $P |
387 | + C P |
388 | + Q |
389 | + ; |
390 | +GTMPATH(INSTANCE) |
391 | + ; return the path to the version of GT.M this instance uses |
392 | + ; |
393 | + ; FIXME: handle the case when INSTANCE is bogus |
394 | + ; |
395 | + N P,X |
396 | + S P="readlink" |
397 | + O P:(COMMAND="readlink "_$$ROOT()_"/"_INSTANCE_"/gtm":READONLY)::"PIPE" |
398 | + U P |
399 | + R X |
400 | + U $P |
401 | + C P |
402 | + Q X |
403 | + ; |
404 | +SWITCH(INSTANCE) |
405 | + ; switch to another OpenVista instance by setting $ZG and $ZRO |
406 | + ; |
407 | + ; there are several ways to do this; try them in order until |
408 | + ; one succeeds |
409 | + ; |
410 | + ; FIXME: we may want to allow this entry point to be called using DO |
411 | + Q:$$SWITCH1(INSTANCE) 1 |
412 | + Q:$$SWITCH2(INSTANCE) 1 |
413 | + Q:$$SWITCH3(INSTANCE) 1 |
414 | + Q 0 |
415 | + ; |
416 | +SWITCH1(INSTANCE) |
417 | + ; private entry point |
418 | + ; |
419 | + ; look for new values of $ZG and $ZRO in env directory of |
420 | + ; target instance |
421 | + N ZG,ZRO,G,RO |
422 | + ; |
423 | + ; FIXME: if file does not exist or is unreadable (permission |
424 | + ; denied), Q 0 |
425 | + ;S G=$$ROOT()_"/"_INSTANCE_"/env/gtmgbldir" |
426 | + ;O G:READONLY U G R ZG U $P C G |
427 | + N I,A S A="/"_$$CURRENT()_"/",ZG="" |
428 | + F I=1:1:$L($ZG,A) S ZG=ZG_$P($ZG,A,I)_$S(I=$L($ZG,A):"",1:"/"_INSTANCE_"/") |
429 | + ; |
430 | + ; FIXME: if file does not exist or is unreadable (permission |
431 | + ; denied), Q 0 |
432 | + ;S RO=$$ROOT()_"/"_INSTANCE_"/env/gtmroutines" |
433 | + ;O RO:READONLY U RO R ZRO U $P C RO |
434 | + S ZRO="" |
435 | + F I=1:1:$L($ZRO,A) S ZRO=ZRO_$P($ZRO,A,I)_$S(I=$L($ZRO,A):"",1:"/"_INSTANCE_"/") |
436 | + ; |
437 | + S $ZG=ZG,$ZRO=ZRO |
438 | + ; |
439 | + ;zlink the buffer |
440 | + X "Q" |
441 | + N I |
442 | + S I=$view("rtnnext","") |
443 | +NEXT F S I=$VIEW("rtnnext",I) Q:I="" I I'="GTM$DMOD" D |
444 | + .I I="ZCD" Q |
445 | + .I $E(I)="%" Q:($E(I,2)'="Z") |
446 | + .K %ZR D SILENT^%RSEL(I) I $D(%ZR(I)) S A=$TR(I,"%","_") N $ET S $ET="G NEXT^ZCD" ZLINK A_".m" Q |
447 | + .N DIE,X,B S X=I,B(1,0)=I_" ;",B(2,0)=" ZMESSAGE 150374338:$PIECE($ZPOSITION,""^"",2)",B(3,0)=" QUIT" |
448 | + .S DIE="B(",XCN=0 N I D SAVE(X) |
449 | + ; FIXME: do we need to set $ZINTERRUPT and $PATH? |
450 | + Q 1 |
451 | + ; |
452 | +SWITCH2(INSTANCE) |
453 | + ; private entry point |
454 | + ; |
455 | + ; look for new values of $ZG and $ZRO in env file of target instance |
456 | + ; |
457 | + ; if the env file does not exist or is unreadable (permission denied) |
458 | + ; or unparsable, Q 0 without setting $ZG and $ZRO |
459 | + ; |
460 | + ; FIXME: implement this |
461 | + ; |
462 | + ; FIXME: do we need to set $ZINTERRUPT and $PATH? |
463 | + Q 0 |
464 | + ; |
465 | +SWITCH3(INSTANCE) |
466 | + ; private entry point |
467 | + ; |
468 | + ; get new values of $ZG and $ZRO by replacing $$PATH() with |
469 | + ; $$ROOT()_"/"_INSTANCE. Q 0 without setting $ZG and $ZRO if the |
470 | + ; resulting paths don't actually exist or we do not have permission to |
471 | + ; access them |
472 | + ; |
473 | + ; FIXME: implement this |
474 | + ; |
475 | + ; FIXME: do we need to set $ZINTERRUPT and $PATH? |
476 | + Q 0 |
477 | + ; |
478 | +CD ;Interactive |
479 | + N Y,DIR |
480 | + R !,"Namespace: ",DIR |
481 | + I DIR["^"!(DIR="") Q |
482 | + D LIST() |
483 | + I DIR["?" G HELP |
484 | + I '$D(Y("B",DIR)) W !,"Invalid Namespace" G CD |
485 | + I $$GTMPATH($$CURRENT())'=$$GTMPATH(DIR) W !,"Inconsistent GTM versions",! G CD |
486 | + S $ZPROMPT=DIR_">" |
487 | + S A=$$SWITCH1(DIR) |
488 | + Q |
489 | +HELP N A S A="" |
490 | + F S A=$O(Y("B",A)) Q:A="" W !,A |
491 | + W ! G CD |
492 | + Q |
493 | +SAVE(RN) ;Save a routine |
494 | + N %,%F,%I,%N,SP,$ETRAP |
495 | + S $ETRAP="S $ECODE="""" Q" |
496 | + S %I=$I,SP=" ",%F="/tmp/"_$J_"/"_RN_".m" |
497 | + ZSYSTEM "mkdir /tmp/"_$J |
498 | + O %F:(newversion:noreadonly:blocksize=2048:recordsize=2044) U %F |
499 | + F S XCN=$O(@(DIE_XCN_")")) Q:XCN'>0 S %=@(DIE_XCN_",0)") Q:$E(%,1)="$" I $E(%)'=";" W $P(%,SP)_$C(9)_$P(%,SP,2,99999),! |
500 | + C %F ;S %N=$$NULL |
501 | + S ZR=$ZRO,$ZRO=$ZRO_" /tmp/"_$J_"/" |
502 | + ZLINK RN |
503 | + ZSYSTEM "rm -r /tmp/"_$J |
504 | + S $ZRO=ZR |
505 | + ;C %N |
506 | + U %I |
507 | + Q |
508 | |
509 | === added file 'mumps/ZISHGUX.m' |
510 | --- mumps/ZISHGUX.m 1970-01-01 00:00:00 +0000 |
511 | +++ mumps/ZISHGUX.m 2009-04-30 17:33:05 +0000 |
512 | @@ -0,0 +1,230 @@ |
513 | +%ZISH ;ISF/AC,RWF MSC/JDS- GT.M for UNIX Host file Control ;01/04/2005 08:13 |
514 | + ;;8.0;KERNEL;**275,306,MSC**;Jul 10, 1995; |
515 | + ; for GT.M for Unix/VMS, version 4.3 |
516 | + ; |
517 | +OPENERR ; |
518 | + Q 0 |
519 | + ; |
520 | +OPEN(X1,X2,X3,X4,X5,X6) ;SR. Open file |
521 | + ;D OPEN^%ZISH([handlename],[directory],filename,[accessmode],[recsize]) |
522 | + ;X1=handle name |
523 | + ;X2=directory, X3=filename, X4=access mode |
524 | + ;X5=new file max record size, X6=Subtype |
525 | + ; |
526 | + N %,%1,%2,%IO,%I2,%P,%T,X,Y,$ETRAP |
527 | + S $ETRAP="D OPNERR^%ZISH" |
528 | + S U="^",X2=$$DEFDIR($G(X2)),X4=$$UP^XLFSTR(X4) |
529 | + S Y=$S(X4["A":"append",X4["R":"readonly",X4["W":"newversion",1:"readonly") |
530 | + S Y=Y_$S(X4["B":":fixed:nowrap:recordsize=512",$G(X5)&(X4["W"):":WIDTH="_+X5,1:"") |
531 | + S:$E(Y)=":" Y=$E(Y,2,999) S %IO=X2_X3,%I2="%IO:"_$S($L(Y):"("_Y_")",1:"")_":3" |
532 | + O @%I2 S %T=$T |
533 | + I '%T S POP=1 Q |
534 | + S IO=%IO,IO(1,IO)="",IOT="HFS",POP=0 D SUBTYPE^%ZIS3($G(X6)) |
535 | + I $G(X1)]"" D SAVDEV^%ZISUTL(X1) |
536 | + U IO U $P ;Enable use of $ZA to test EOF condition. |
537 | + Q |
538 | +OPNERR ;error on open |
539 | + S POP=1,$ECODE="" |
540 | + U:$G(%P)]"" %P |
541 | + Q |
542 | + ; |
543 | +CLOSE(X) ;SR. Close HFS device not opened by %ZIS. |
544 | + ;X1=Handle name, IO=device |
545 | + I IO]"" C IO K IO(1,IO) |
546 | + I $G(X)]"" D RMDEV^%ZISUTL(X) |
547 | + D HOME^%ZIS |
548 | + Q |
549 | +DEL(%ZX1,%ZX2) ;ef,SR. Del fl(s) |
550 | + ;S Y=$$DEL^%ZISH("dir path",$NA(array)) |
551 | + N %ZISH,%ZISHLGR,%ZX,X,%ZXDEL |
552 | + S %ZX1=$$DEFDIR($G(%ZX1)),%ZXDEL=1,%ZISH="" |
553 | + F S %ZISH=$O(@%ZX2@(%ZISH)) Q:%ZISH="" D |
554 | + . N $ETRAP,$ESTACK S $ETRAP="D DELERR^%ZISH" |
555 | + . I %ZISH["*" S %ZXDEL=0 Q ; Wild card not allowed. |
556 | + . S %ZX=$ZSEARCH(%ZX1_%ZISH) |
557 | + . Q:%ZX']"" ; File doesn't exist - not an error, just quit. |
558 | + . O %ZX:READONLY:0 |
559 | + . I '$T S %ZXDEL=0 Q ; Can't open it. |
560 | + . C %ZX:DELETE |
561 | + . I $ZSEARCH(%ZX)]"" S %ZXDEL=0 ; Delete was not successful. |
562 | + Q %ZXDEL |
563 | +DELERR ;Trap any $ETRAP error, unwind and return. |
564 | + S $ETRAP="D UNWIND^%ZTER" |
565 | + S %ZXDEL=0 |
566 | + D UNWIND^%ZTER |
567 | + Q |
568 | + ; |
569 | +LIST(DIR,LIST,RETURN) ;ef,SR. Set local array holding fl names |
570 | + ;S Y=$$LIST^ZISH("/dir/","list_root","return_root") |
571 | + ;list_root can have XX("A*"), XX("test.com")... |
572 | + ;Both arrays passed as $NA values (closed roots). |
573 | + ;N %IO,%X,%ZISH,%ZISH1,%ZISHIO,%ZX,POP,X,%ZISHDL1,%ZISHDL2,%ZISHDN1,%ZISHDN2 |
574 | + ;N $ETRAP,$ESTACK S $ETRAP="G LSTEOF^%ZISH",%ZX1=$$DEFDIR($G(%ZX1)) |
575 | + ;S %IO=$I,%ZISHDN1="_ZISH"_$J_".TMPA",%ZISHDN2="ZISH"_$J_".TMPB" |
576 | + ;%ZISHDL1=%ZX1_%ZISHDN1,%ZISHDL2=%ZX1_%ZISHDN2 |
577 | + ;S $ZT="G SPAWNERR^%ZISH" |
578 | + ;Init %ZISHDL1, %ZISHDL2 by deleteing them |
579 | + ;I $ZSEARCH(%ZISHDL1)["ZISH" ZSYSTEM "rm "_%ZISHDL1 |
580 | + ;I $ZSEARCH(%ZISHDL2)["ZISH" ZSYSTEM "rm "_%ZISHDL2_";*" |
581 | + ;Get fls, Build listing in %ZISHDL1 with ls |
582 | + S %ZISH1=0,%ZISH="" |
583 | + N WANT,GLOB,NAME S WANT="",DIR=$$DEFDIR($G(DIR)) F S WANT=$O(@LIST@(WANT)) Q:WANT="" D |
584 | + . S GLOB=DIR_WANT,NAME="" |
585 | + . F S NAME=$ZSEARCH(GLOB) Q:NAME="" S @RETURN@($P(NAME,DIR,2))="" |
586 | + Q $Q(@RETURN)]"" |
587 | +LSTEOF S $ZT="" |
588 | + I $L(%IO) U:$D(IO(1,%IO)) IO |
589 | + ;C %ZISHDL1 ;:DELETE |
590 | + ;I $L($ZSEARCH(%ZISHDL2)) ZSYSTEM "DEL "_%ZISHDL2 |
591 | + ;I $L($ZSEARCH(%ZISHDL1)) ZSYSTEM "DEL "_%ZISHDL1_";*" |
592 | + S $ECODE="" |
593 | + Q ($Q(@%ZX3)]"") |
594 | + ; |
595 | +LIST1(%ZX,%ZD) ;Get one part of the list |
596 | + N $ET,$ES S $ET="D LSTERR^%ZISH" |
597 | + ;ZSYSTEM "ls -1 "_%ZX_" > "_%ZISHDL1 |
598 | + ;O %ZISHDL1:readonly:1 U %ZISHDL1 |
599 | + ;F R %X:1 Q:$ZEOF S @%ZX3@(%X)="" |
600 | + ;C %ZISHDL1:DELETE |
601 | + N %ZY,%ZI,%ZJ |
602 | + S %ZY=$ZSEARCH("*.X") ;Clear vector |
603 | + S %ZY=$P(%ZX,"*") |
604 | + F S %ZI=$ZSEARCH(%ZX) Q:'$L(%ZI)!(%ZI'[%ZY) S %ZJ=$P(%ZI,%ZD,2),@%ZX3@(%ZJ)="" |
605 | + Q 1 |
606 | +LSTERR ;Error in list |
607 | + I $ZSEARCH(%ZISHDL2)["ZISH" ZSYSTEM "DEL "_%ZISHDL2_";*" |
608 | + Q 0 |
609 | + ; |
610 | +SPAWNERR ;TRAP ERROR OF SPAWN |
611 | + O %ZISHDL1:READONLY:1 I $T C %ZISHDL1:DELETE |
612 | + S $ECODE="" |
613 | + Q 0 |
614 | + ; |
615 | +MV(X1,X2,Y1,Y2) ;ef,SR. Rename a fl |
616 | + ;S Y=$$MV^ZISH("/dir/","fl","/dir/","fl") |
617 | + N X,Y,%ZISHDL1 |
618 | + S %ZISHDL1="ZISH"_$J_".TMPA",X1=$$DEFDIR($G(X1)),Y1=$$DEFDIR($G(Y1)) |
619 | + S $ZT="SPAWNERR^%ZISH" |
620 | + ;Pbv or qit |
621 | + I (X2="")!(Y2="") Q 0 |
622 | + ZSYSTEM "mv "_X1_X2_" "_Y1_Y2 ;Use system command |
623 | + S Y=$ZSEARCH(Y1_Y2) |
624 | + Q $L(Y)>0 |
625 | + ; |
626 | +PWD() ;ef,SR. Print working directory |
627 | + N Y |
628 | + S Y=$$DEFDIR("") |
629 | + S:Y="" Y=$ZDIR |
630 | + Q Y |
631 | + ; |
632 | +DEFDIR(DF) ;ef. Default Dir and frmt |
633 | + S DF=$G(DF) Q:DF="." "" ;Special way to get current dir. |
634 | + S:DF="" DF=$G(^XTV(8989.3,1,"DEV")) |
635 | + ;Check syntax, VMS needs : or [ ] |
636 | + I ^%ZOSF("OS")["VMS" D Q DF ;***EXIT FOR VMS/GTM |
637 | + . N P1,P2 |
638 | + . I DF[":" S P1=$P(DF,":")_":",P2=$P(DF,":",2) |
639 | + . E S P1="",P2=DF |
640 | + . I P1="",P2["$" S DF=P2 Q ;Assume a logical |
641 | + . I $L(P2) S:P2'["[" P2="["_P2 S:P2'["]" P2=P2_"]" |
642 | + . S DF=P1_P2 |
643 | + . Q |
644 | + ; |
645 | + ;Check syntax, Unix check leading & trailing "/" |
646 | + I "./"'[$E(DF) S DF="/"_DF |
647 | + I $E(DF,$L(DF))'="/" S DF=DF_"/" |
648 | + Q DF |
649 | +STATUS() ;ef,SR. Return EOF status |
650 | + U $I |
651 | + Q $ZEOF |
652 | + ; |
653 | +EOF(X) ;Eof flag, Pass in $ZA |
654 | + Q X |
655 | +QL(X) ;Qlfrs |
656 | + Q:X="" |
657 | + S:$E(X)'="-" X="-"_X |
658 | + Q |
659 | +FL(X) ;Fl len |
660 | + N ZOSHP1,ZOSHP2 |
661 | + S ZOSHP1=$P(X,"."),ZOSHP2=$P(X,".",2) |
662 | + I $L(ZOSHP1)>14 S X=4 Q |
663 | + I $L(ZOSHP2)>8 S X=4 Q |
664 | + Q |
665 | + ; |
666 | +MAKEREF(HF,IX,OVF) ;Internal call to rebuild global ref. |
667 | + ;Return %ZISHF,%ZISHO,%ZISHI,%ZISUB |
668 | + N I,F,MX |
669 | + S OVF=$G(OVF,"%ZISHOF") |
670 | + S %ZISHI=$$QS^DDBRAP(HF,IX),MX=$$QL^DDBRAP(HF) ; |
671 | + S F=$NA(@HF,IX-1) ;Get first part |
672 | + I IX=1 S %ZISHF=F_"(%ZISHI" ;Build root, IX=1 |
673 | + I IX>1 S %ZISHF=$E(F,1,$L(F)-1)_",%ZISHI" ;Build root |
674 | + S %ZISHO=%ZISHF_","_OVF_",%OVFCNT)" ;Make overflow |
675 | + F I=IX+1:1:MX S %ZISHF=%ZISHF_",%ZISUB("_I_")",%ZISUB(I)=$$QS^DDBRAP(HF,I) |
676 | + S %ZISHF=%ZISHF_")" |
677 | + Q |
678 | +FTG(%ZX1,%ZX2,%ZX3,%ZX4,%ZX5) ;ef,SR. Unload contents of host file into global |
679 | + ;p1=host file directory |
680 | + ;p2=host file name |
681 | + ;p3= $NAME REFERENCE INCLUDING STARTING SUBSCRIPT |
682 | + ;p4=INCREMENT SUBSCRIPT |
683 | + ;p5=Overflow subscript, defaults to "OVF" |
684 | + N %ZA,%ZB,%ZC,%ZL,X,%OVFCNT,%CONT |
685 | + N I,%ZISH,%ZISH1,%ZISHI,%ZISHL,%ZISHLGR,%ZISHOF,%ZISHOX,%ZISHS,%ZX,%ZISHY,POP,%ZISUB,%EXIT |
686 | + S %ZX1=$$DEFDIR($G(%ZX1)),%ZISHOF=$G(%ZX5,"OVF") |
687 | + D MAKEREF(%ZX3,%ZX4,"%ZISHOF") |
688 | + D OPEN^%ZISH(,%ZX1,%ZX2,"R") |
689 | + I POP Q 0 |
690 | + N $ETRAP S %EXIT=0,$ETRAP="S %ZA=1,%EXIT=1,$ECODE="""" Q" |
691 | + U IO F K %XX D READNXT(.%XX) Q:$$EOF(%ZA) D |
692 | + . S @%ZISHF=%XX |
693 | + . I $D(%XX)>2 F %OVFCNT=1:1 Q:'$D(%XX(%OVFCNT)) S @%ZISHO=%XX(%OVFCNT) |
694 | + . S %ZISHI=%ZISHI+1 |
695 | + . Q |
696 | + D CLOSE() ;Normal exit |
697 | + Q '%EXIT |
698 | + ; |
699 | +ERREOF D CLOSE() ;Got error Reading file |
700 | + Q 0 |
701 | + ; |
702 | +READNXT(REC) ; |
703 | + N T,I,X,% |
704 | + U IO R X:2 S %ZA=$ZEOF,REC=$E(X,1,255) |
705 | + Q:$L(X)<256 |
706 | + S %=256 F I=1:1 Q:$L(X)<% S REC(I)=$E(X,%,%+254),%=%+255 |
707 | + Q |
708 | +GTF(%ZX1,%ZX2,%ZX3,%ZX4) ;ef,SR. Load contents of global to host file. |
709 | + ;Previously name LOAD |
710 | + ;p1=$NAME of global reference |
711 | + ;p2=incrementing subscript |
712 | + ;p3=host file directory |
713 | + ;p4=host file name |
714 | + N %ZISHY,%ZISHLGR,%ZISHOX |
715 | + S %ZISHY=$$MGTF(%ZX1,%ZX2,$G(%ZX3),%ZX4,"W") |
716 | + Q %ZISHY |
717 | + ; |
718 | +GATF(%ZX1,%ZX2,%ZX3,%ZX4) ;ef,SR. Append to host file. |
719 | + ; |
720 | + ;p1=$NAME of global reference |
721 | + ;p2=incrementing subscript |
722 | + ;p3=host file directory |
723 | + ;p4=host file name |
724 | + N %ZISHY |
725 | + S %ZISHY=$$MGTF(%ZX1,%ZX2,$G(%ZX3),%ZX4,"A") |
726 | + Q %ZISHY |
727 | + ; |
728 | +MGTF(%ZX1,%ZX2,%ZX3,%ZX4,%ZX5) ; |
729 | + ;p1=$NAME of global reference |
730 | + ;p2=incrementing subscript |
731 | + ;p3=host file directory |
732 | + ;p4=host file name |
733 | + N %ZISH,%ZISH1,%ZISHI,%ZISHL,%ZISHLGR,%ZISHS,%ZISHOX,IO,%ZX,Y |
734 | + D MAKEREF(%ZX1,%ZX2) |
735 | + D OPEN^%ZISH(,%ZX3,%ZX4,%ZX5) ;Default dir set in open |
736 | + I POP Q 0 |
737 | + N X |
738 | + N $ETRAP S $ETRAP="",X="ERREOF^%ZISH",@^%ZOSF("TRAP") |
739 | + F Q:'($D(@%ZISHF)#2) S %ZX=@%ZISHF,%ZISHI=%ZISHI+1 U IO W %ZX,! |
740 | + D CLOSE() ;Normal Exit |
741 | + Q 1 |
742 | + ; |
743 | |
744 | === added file 'mumps/ZOSFGUX.m' |
745 | --- mumps/ZOSFGUX.m 1970-01-01 00:00:00 +0000 |
746 | +++ mumps/ZOSFGUX.m 2009-04-30 17:33:05 +0000 |
747 | @@ -0,0 +1,135 @@ |
748 | +ZOSFGUX ;SFISC/MVB,PUG/TOAD MSC/JDS- ZOSF Table for GT.M for Unix ;10 Feb 2003 6:37 pm |
749 | + ;;8.0;KERNEL;**275,MSC**;Jul 10, 1995 |
750 | + ;; for GT.M for Unix, version 4.3 |
751 | + ; |
752 | + S %Y=1,DTIME=$G(DTIME,600) |
753 | + K ^%ZOSF("MASTER"),^%ZOSF("SIGNOFF") |
754 | + I '$D(^%ZOSF("VOL")) S ^%ZOSF("VOL")="ROU" |
755 | + K ZO F I="MGR","PROD","VOL","TMP" S:$D(^%ZOSF(I)) ZO(I)=^%ZOSF(I) |
756 | + F I=1:2 S Z=$P($T(Z+I),";;",2) Q:Z="" S X=$P($T(Z+1+I),";;",2,99) S:Z="OS" $P(^%ZOSF(Z),"^")=X I Z'="OS" S ^%ZOSF(Z)=$S($D(ZO(Z)):ZO(Z),1:X) |
757 | + ; |
758 | +OS S ^%ZOSF("OS")="GT.M (Unix)^19" |
759 | + ; |
760 | +MGR W !,"NAME OF MANAGER'S UCI,VOLUME SET: "_^%ZOSF("MGR")_"// " R X:DTIME I X]"" X ^("UCICHECK") G MGR:0[Y S ^%ZOSF("MGR")=X |
761 | +PROD ; |
762 | + W !,"The value of PRODUCTION will be used in the GETENV api." |
763 | + W !,"PRODUCTION (SIGN-ON) UCI,VOLUME SET: "_^%ZOSF("PROD")_"// " R X:DTIME I X]"" X ^("UCICHECK") G PROD:0[Y S ^%ZOSF("PROD")=X |
764 | + ;See that VOL and PROD agree. |
765 | + I ^%ZOSF("PROD")'[^%ZOSF("VOL") S ^%ZOSF("VOL")=$P(^%ZOSF("PROD"),",",2) |
766 | +VOL W !,"The VOLUME name must match the one in PRODUCTION." |
767 | + W !,"NAME OF VOLUME SET: "_^%ZOSF("VOL")_"//" R X:DTIME |
768 | + I X]"" D I X'?3U W "MUST BE 3 Upper case." G VOL |
769 | + . I ^%ZOSF("PROD")'[X W !,"Must match PRODUCTION" |
770 | + . S:X?3U ^%ZOSF("VOL")=X |
771 | +TMP ;Get the temp directory |
772 | + W !,"The temp directory for the system: '"_^%ZOSF("TMP")_"'//" |
773 | + R X:DTIME I $L(X),X'?1"/".E G TMP |
774 | + I $L(X) S ^%ZOSF("TMP")=X |
775 | + W !,"^%ZOSF setup" |
776 | + Q |
777 | + ; |
778 | +Z ; |
779 | + ;;ACTJ |
780 | + ;;S Y=$$ACTJ^%ZOSV() |
781 | + ;;AVJ |
782 | + ;;S Y=$$AVJ^%ZOSV() |
783 | + ;;BRK |
784 | + ;;U $I:(CENABLE) |
785 | + ;;DEL |
786 | + ;;N %RD,%OD S %RD=$P($S($ZRO["(":$P($P($ZRO,"(",2),")"),1:$ZRO)," ")_"/",%OD=$S($ZRO["(":$P($ZRO,"(",1)_"/",1:%RD) ZSYSTEM "rm -f "_%RD_X_".m" ZSYSTEM "rm -f "_%OD_X_".o" |
787 | + ;;EOFF |
788 | + ;;U $I:(NOECHO) |
789 | + ;;EON |
790 | + ;;U $I:(ECHO) |
791 | + ;;EOT |
792 | + ;;S Y=$ZA\1024#2 ; <===== |
793 | + ;;ERRTN |
794 | + ;;^%ZTER |
795 | + ;;ETRP |
796 | + ;;Q |
797 | + ;;GD |
798 | + ;;G ^%GD |
799 | + ;;$INC |
800 | + ;;0 |
801 | + ;;JOBPARAM |
802 | + ;;G JOBPAR^%ZOSV |
803 | + ;;LABOFF |
804 | + ;;U IO:(NOECHO) ; <===== |
805 | + ;;LOAD |
806 | + ;;D LOAD^%ZOSV2(X) ;S %N=0 F XCNP=XCNP+1:1 S %N=%N+1,%=$T(+%N^@X) Q:$L(%)=0 S @(DIF_XCNP_",0)")=% |
807 | + ;;LPC |
808 | + ;;S Y="" ; <===== |
809 | + ;;MAGTAPE |
810 | + ;;S %MT("BS")="*1",%MT("FS")="*2",%MT("WTM")="*3",%MT("WB")="*4",%MT("REW")="*5",%MT("RB")="*6",%MT("REL")="*7",%MT("WHL")="*8",%MT("WEL")="*9" ; <===== |
811 | + ;;MAXSIZ |
812 | + ;;Q |
813 | + ;;MGR |
814 | + ;;VAH,ROU |
815 | + ;;MTBOT |
816 | + ;;S Y=$ZA\32#2 ; <===== |
817 | + ;;MTERR |
818 | + ;;S Y=$ZA\32768#2 ; <===== |
819 | + ;;MTONLINE |
820 | + ;;S Y=$ZA\64#2 ; <===== |
821 | + ;;MTWPROT |
822 | + ;;S Y=$ZA\4#2 ; <===== |
823 | + ;;NBRK |
824 | + ;;U $I:(NOCENABLE) |
825 | + ;;NO-PASSALL |
826 | + ;;U $I:(NOPASSTHRU) |
827 | + ;;NO-TYPE-AHEAD |
828 | + ;;U $I:(NOTYPEAHEAD) |
829 | + ;;PASSALL |
830 | + ;;U $I:(PASSTHRU) |
831 | + ;;PRIINQ |
832 | + ;;S Y=$$PRIINQ^%ZOSV() |
833 | + ;;PRIORITY |
834 | + ;;Q ;G PRIORITY^%ZOSV |
835 | + ;;PROD |
836 | + ;;VAH,ROU |
837 | + ;;PROGMODE |
838 | + ;;S Y=$$PROGMODE^%ZOSV() |
839 | + ;;RD |
840 | + ;;G ^%RD |
841 | + ;;RESJOB |
842 | + ;;Q:'$D(DUZ) Q:'$D(^XUSEC("XUMGR",+DUZ)) N XQZ S XQZ="^FORCEX[MGR]" D DO^%XUCI ; <===== |
843 | + ;;RM |
844 | + ;;U $I:WIDTH=$S(X<256:X,1:0) |
845 | + ;;RSEL |
846 | + ;;K ^UTILITY($J) D ^%RSEL S X="" X "F S X=$O(%ZR(X)) Q:X="""" S ^UTILITY($J,X)=""""" K %ZR |
847 | + ;;RSUM |
848 | + ;;S Y=0 F %=1,3:1 S %1=$T(+%^@X),%3=$F(%1," ") Q:'%3 S %3=$S($E(%1,%3)'=";":$L(%1),$E(%1,%3+1)=";":$L(%1),1:%3-2) F %2=1:1:%3 S Y=$A(%1,%2)*%2+Y |
849 | + ;;SS |
850 | + ;;D ^MSCZJOB |
851 | + ;;SAVE |
852 | + ;;D SAVE^%ZOSV2(X) ;N %I,%F S %I=$I,%F=$P($S($ZRO["(":$P($P($ZRO,"(",2),")"),1:$ZRO)," ")_"/"_X_".m" O %F:(NEWVERSION) U %F X "F S XCN=$O(@(DIE_XCN_"")"")) Q:+XCN'=XCN S %=@(DIE_XCN_"",0)"") Q:$E(%,1)=""$"" I $E(%)'="";"" W %,!" C %F U %I |
853 | + ;;SIZE |
854 | + ;;S Y=0 F I=1:1 S %=$T(+I) Q:%="" S Y=Y+$L(%)+2 ; <===== |
855 | + ;;TEST |
856 | + ;;I X]"",$T(^@X)]"" |
857 | + ;;TMK |
858 | + ;;S Y=$ZA\16384#2 |
859 | + ;;TMP |
860 | + ;;/tmp/ |
861 | + ;;TRAP |
862 | + ;;$ZT="G "_X |
863 | + ;;TRMOFF |
864 | + ;;U $I:(TERMINATOR="") |
865 | + ;;TRMON |
866 | + ;;U $I:(TERMINATOR=$C(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127)) |
867 | + ;;TRMRD |
868 | + ;;S Y=$A($ZB) |
869 | + ;;TYPE-AHEAD |
870 | + ;;U $I:(TYPEAHEAD) |
871 | + ;;UCI |
872 | + ;;S Y=^%ZOSF("PROD") |
873 | + ;;UCICHECK |
874 | + ;;S Y=1 |
875 | + ;;UPPERCASE |
876 | + ;;S Y=$TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ") |
877 | + ;;XY |
878 | + ;;S $X=DX,$Y=DY ; <===== |
879 | + ;;VOL |
880 | + ;;ROU |
881 | + ;;ZD |
882 | + ;;S Y=$$HTE^XLFDT(X,2) I $L($P(Y,"/"))=1 S Y=0_Y |
883 | |
884 | === added file 'mumps/ZU.m' |
885 | --- mumps/ZU.m 1970-01-01 00:00:00 +0000 |
886 | +++ mumps/ZU.m 2009-04-30 17:33:05 +0000 |
887 | @@ -0,0 +1,87 @@ |
888 | +ZU ;SF/JLI,RWF MSC/JDS- For GT.M, TIE ALL TERMINALS TO THIS ROUTINE!! ;11/24/2003 11:34 |
889 | + ;;8.0;KERNEL;**275,MSC**;Jul 10, 1995 |
890 | + ; for GT.M for VMS & Unix, version 4.3 |
891 | + ; |
892 | + ;The env var ZINTRRUPT should be set to catch all interrupts. |
893 | +EN ;See that escape processing is off, Conflict with Screenman |
894 | + U $P:(NOCENABLE:NOESCAPE) |
895 | + D:+$G(^%ZTSCH("LOGRSRC")) LOGRSRC^%ZOSV("$LOGIN$") |
896 | + N $ESTACK,$ETRAP S $ETRAP="D ERR^ZU Q:$QUIT -9 Q" |
897 | + S $ZINTERRUPT="I $$JOBEXAM^ZU($ZPOSITION)" |
898 | + D COUNT^XUSCNT(1) |
899 | + G ^XUS |
900 | + ; |
901 | +G ;Entry point for GUI device. |
902 | + Q |
903 | + ; |
904 | +ERR ;Come here on error |
905 | + ; handle stack overflow errors specially |
906 | + I $P($ZS,",",3)["STACKOFLOW" S $ET="Q:$ST>"_($ST-8)_" D ERR2^ZU" Q |
907 | + ; |
908 | +ERR2 S $ETRAP="D UNWIND^ZU" L U $P:NOCENABLE |
909 | + ; |
910 | + Q:$ECODE["<PROG>" |
911 | + I $P($ZS,",",2,3)["^XUS1A:2, %GTM-E-IOWRITERR" G HALT |
912 | + ; |
913 | + I $G(IO)]"",$D(IO(1,IO)),$E($G(IOST))="P" D |
914 | + . U IO |
915 | + . W @$S($D(IOF):IOF,1:"#") |
916 | + I $G(IO(0))]"" D |
917 | + . U IO(0) |
918 | + . W !!,"RECORDING THAT AN ERROR OCCURRED ---" |
919 | + . W !!?15,"Sorry 'bout that" |
920 | + . W !,*7 |
921 | + . W !?10,"$STACK=",$STACK," $ECODE=",$ECODE |
922 | + . W !?10,"$ZSTATUS=",$ZSTATUS |
923 | + ; |
924 | + D ^%ZTER K %ZT S XUERF="" ; Capture symbol table first! |
925 | + ; |
926 | + I $G(DUZ)'>0 G HALT |
927 | + ; |
928 | +CTRLC I $D(IO)=11 U IO(0) C:IO'=IO(0) IO S IO=IO(0) |
929 | + W:$P($ZS,",",3)["-CTRLC" !,"--Interrupt Acknowledged",! |
930 | + D KILL1^XUSCLEAN ;Clean up symbol table |
931 | + S $ECODE=",<<POP>>," |
932 | + Q |
933 | + ; |
934 | +UNWIND ;Unwind the stack |
935 | + Q:$ESTACK>1 G CONT:$ECODE["<<HALT>>",CTRLC2:$ECODE["<<POP>>" |
936 | + S $ECODE="" |
937 | + Q |
938 | + ; |
939 | +CTRLC2 S $ECODE="" G:$G(^XUTL("XQ",$J,"T"))<2 ^XUSCLEAN |
940 | + S ^XUTL("XQ",$J,"T")=1,XQY=$G(^(1)),XQY0=$P(XQY,"^",2,99) |
941 | + G:$P(XQY0,"^",4)'="M" CTRLC2 |
942 | + S XQPSM=$P(XQY,"^",1),XQY=+XQPSM,XQPSM=$P(XQPSM,XQY,2,3) |
943 | + G:'XQY ^XUSCLEAN |
944 | + S $ECODE="",$ETRAP="D ERR^ZU Q:$QUIT 0 Q" |
945 | + U $P:NOESCAPE G M1^XQ |
946 | + ; |
947 | +HALT I $D(^XUTL("XQ",$J)) D:$G(DUZ)>0 BYE^XUSCLEAN |
948 | + D COUNT^XUSCNT(-1) |
949 | + I '$ESTACK G CONT |
950 | + S $ETRAP="D UNWIND^ZU" ;Set new trap |
951 | + S $ECODE=",<<HALT>>," ;Cause error to unwind stack |
952 | + D:+$G(^%ZTSCH("LOGRSRC")) LOGRSRC^%ZOSV("$LOGOUT$") |
953 | + Q |
954 | +CONT ; |
955 | + S $ECODE="",$ETRAP="" |
956 | + D:+$G(^%ZTSCH("LOGRSRC")) LOGRSRC^%ZOSV("$LOGOUT$") |
957 | + I $D(XQXFLG("HALT")) HALT |
958 | + I ($PRINCIPAL["_TNA") HALT ;Check for TelNet |
959 | + S X="Waiting "_($J#1000000) D SETENV^%ZOSV ;Change VMS name |
960 | + ;For sites that want to retain the connection, uncomment the next line |
961 | + ;U $P:NOCENABLE R !,"Enter return to continue: ",X:600 S:'$T X="^" G:X'="^" ^ZU |
962 | + HALT |
963 | + ; |
964 | +JOBEXAM(%ZPOS) ; |
965 | + N %reference S %reference=$REFERENCE |
966 | + S ^XUTL("XUSYS",$J,0)=$H,^XUTL("XUSYS",$J,"INTERRUPT")=$G(%ZPOS) |
967 | + ;I %ZPOS["^" S ^XUTL("XUSYS",$J,"codeline")=$T(@%ZPOS) |
968 | + K ^XUTL("XUSYS",$J,"JE") |
969 | + I $G(^XUTL("XUSYS","COMMAND"))'="EXAM" ZSHOW "SD":^XUTL("XUSYS",$J,"JE") |
970 | + I $G(^XUTL("XUSYS","COMMAND"))="EXAM" ZSHOW "*":^XUTL("XUSYS",$J,"JE") |
971 | + I $G(^XUTL("XUSYS",$J,"CMD"))="HALT" ;To do. |
972 | + ZSHOW "*":^TMP("MSCZJOB",$J) |
973 | + Q 1 |
974 | + ; |
RORHL7A, Rev 41
Can't we just remove the -1 from the $Q and be done with it? It's just being used as an iterator, and that will work even if we K the current item. The "K A,CNT" looks like a problem to me since A's content gets wiped out and we only do one K on the FIELDS.
ZISHGUX.m, Rev 41
Can't we remove the commented-out lines under LIST()?
ZU.m XUSYS", $J,"codeline" )=$T(@% ZPOS)?
Why are we removing I %ZPOS["^" S ^XUTL("
Also, either remove it or not, but don't comment it out.