source: FOIAVistA/tag/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/ZINDX8.m@ 1039

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

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1%INDX8 ;ISC/GRK - STRUCTURED INDEX ;02/07/95 13:18
2 ;;7.3;TOOLKIT;;Apr 25, 1995
3 W #!,RTN," ",+^UTILITY($J,1,RTN,0)," printed ",INDXDT,!! S Q="""",(DDOT,LO)=0
4 F LC=1:1 Q:'$D(^UTILITY($J,1,RTN,0,LC)) S LIN=^(LC,0),ML="",IDT=10 D CD
5 K AGR,EOC,IDT,JJ,LO,ML,OLD,SAV,TY
6 Q
7CD S LAB=$P(LIN," ",1),LIN=$P(LIN," ",2,999),LO=$S(LAB="":LO+1,1:0)
8 W $S(LAB'="":LAB,1:" +"_LO)
9 G:LIN'[";" EE S STR=1,L=";",ARG=LIN D LOOP I CH'=";" G EE
10 W ?10,$E(LIN,I,999),! Q:I<2 S LIN=$E(LIN,1,I-2)
11EE I LIN="" Q
12 S COM=$E(LIN,1),EOC=0 I COM=" " S LIN=$E(LIN,2,9999) G EE
13 I "BCDEFGHIKLNOPQRSUVWXZ"'[COM G ERR
14 D SEP I ARG[":" S OLD=$P(ARG,":",1),COM="IF",ARG=$P(ARG,":",2) D GRB S IDT=IDT+4,ARG=OLD,EOC=4
15 S COM=ARG I $L(COM)>1,$E(COM,1)'="Z",$P($T(CMD),";",2,999)'[(","_COM_",") G ERR
16 I $E(COM,1)="Z" S X=COM
17 E S COM=$E(COM,1) F I=2:1 S X=$P($T(CMD),",",I) Q:X="" Q:$E(X,1)=COM
18 S:COM="H"&(ARG'="") X="HANG" S COM=X,X=$E(X,1)
19 D SEP D GRB:"BCHKLNOPQRUVWZ"[X,SET:X="S",DGX:"DGX"[X,IFE:"IE"[X,FOR:X="F" S:EOC IDT=IDT-EOC G EE
20GRB I ARG["$" F I=1:1 S CH=$E(ARG,I) Q:CH="" D QUOTE:CH=Q I CH="$" D FUN
21 W ?IDT," ",$S(ML=0:"...",1:COM)," ",ARG,! S ML="" Q
22FUN I $E(ARG,I,I+1)="$$" D S I=J-1 Q ;Handle Extrinsics
23 . F J=I+2:1 Q:"(,"[$E(ARG,J)
24 . Q
25 F J=I+1:1 Q:$E(ARG,J)'?1U
26 S X=$E(ARG,I+1,J-1),L=$L(X),CH=$E(ARG,I+1),TY=$S($E(ARG,J)="(":$T(FNC),1:$T(SPC))
27 Q:CH="Z" S %=0 F PC=2:1 S JJ=$P(TY,",",PC) Q:JJ="" S %=($P(JJ,":")_":")[(X_":") S:% X=$P(JJ,":",2) I (":"_$P(JJ,":",2))[(":"_X) S %=PC Q
28 G:'% ERR
29 Q:L=$L(X) D:$L(ARG)>245 LEN S ARG=$E(ARG,1,I)_X_$E(ARG,J,999),I=I+$L(X)-L Q
30ERR W !,"*** ERROR ***",! Q
31IFE I ARG=""!(X="E") W ?IDT,"IF " W:X="E" "'" W "$TEST",! S IDT=IDT+4 Q
32SET S STR=1,L="," D LOOP S SAV=ARG,ARG=$E(ARG,1,I-1),IP=I+1
33 D GRB S ARG=$E(SAV,IP,999) S:COM="IF" IDT=IDT+4 Q:ARG="" G SET
34FOR D GRB S IDT=IDT+4 Q
35DGX I ARG="",$E(COM)="D" D DDOT Q
36 S STR=1,L=":," D LOOP I CH="" G GRB
37 I CH="," S SAV=ARG,ARG=$E(ARG,1,I-1),IP=I+1 D GRB G D1
38 S SAV=ARG,STR=I+1,L="," D LOOP S IP=I+1
39 S OLD=COM,ARG=$E(ARG,STR,I-1),COM="IF" D GRB
40 S IDT=IDT+4,ARG=$E(SAV,1,STR-2),COM=OLD D GRB S IDT=IDT-4
41D1 S ARG=$E(SAV,IP,999) Q:ARG="" G DGX
42DDOT S DDOT=DDOT+1 W ?IDT," Begin DoDot",DDOT,! S IDT=IDT+4
43 N LIN,I,COM,EOC
44 F LC=LC+1:1 S LIN=$G(^UTILITY($J,1,RTN,0,LC,0)) Q:LIN="" D Q:X<DDOT D CD
45 . F I=1:1:254 Q:". "'[$E(LIN,I)
46 . S X=$L($E(LIN,1,I),".")-1,LIN=" "_$E(LIN,I,999)
47 S IDT=IDT-4,LC=LC-1 W ?IDT," End DoDot",DDOT,! S DDOT=DDOT-1
48 Q
49LOOP F I=STR:1 S CH=$E(ARG,I) D QUOTE:CH=Q,PAREN:CH="(" Q:L[CH
50 Q
51PAREN S PC=1
52 F I=I+1:1 S CH=$E(ARG,I) Q:PC=0!(CH="") I "()"""[CH D QUOTE:CH=Q S:"()"[CH PC=PC+$S(CH="(":1,1:-1)
53 Q
54QUOTE F I=I+1:1 S CH=$E(ARG,I) Q:CH=""!(CH=Q)
55 Q
56SEP F I=1:1 S CH=$E(LIN,I) D SEPQ:CH=Q Q:"; "[CH
57 S ARG=$E(LIN,1,I-1) S:CH=" " I=I+1 S LIN=$E(LIN,I,999) Q
58SEPQ S I=I+1,CH=$E(LIN,I) I CH="" G ERR Q
59 G SEPQ:CH'=Q S I=I+1,CH=$E(LIN,I) G:CH=Q SEPQ Q
60LEN S AGR=$E(ARG,1,I-1) W ?IDT,COM," ",AGR_"...",! S ARG=$E(ARG,I)_$E(ARG,J-1,999),I=1,J=3,ML=0 K AGR
61 Q
62CMD ;,BREAK,CLOSE,DO,ELSE,FOR,GOTO,HALT,HANG,IF,KILL,LOCK,NEW,OPEN,PRINT,QUIT,READ,SET,USE,VIEW,WRITE,XECUTE,
63 ;Put 2 char codes after 1 char to keep N: from finding FN:
64FNC ;,A:ASCII,C:CHAR,D:DATA,E:EXTRACT,F:FIND,G:GET,J:JUSTIFY,L:LENGTH,N:NEXT,O:ORDER,P:PIECE,Q:QUERY,R:RANDOM,S:SELECT,T:TEXT,V:VIEW,FN:FNUMBER,TR:TRANSLATE
65SPC ;,H:HOROLOG,I:IO,J:JOB,S:STORAGE,T:TEST,X:X,Y:Y,
66 ;
67XCR ;Option entry point
68 K ^UTILITY($J) D ASKRTN^%INDX6 G EXIT:NRO<1 S %ZIS="M" D ^%ZIS Q:POP U IO(0)
69 I $D(IO("Q")) S ZTRTN="XC2^%INDX8",ZTSAVE("^UTILITY($J,")="",ZTDESC="Structured print" D ^%ZTLOAD G EXIT
70XC2 U IO I '$D(INDXDT) D NOW^%DTC S INDXDT=$E(%,2,3)_"/"_$E(4,5)_"/"_$E(%,6,7)
71 S RTN="" F S RTN=$O(^UTILITY($J,RTN)) Q:RTN="" D D %INDX8
72 . D LOAD^%INDEX
73 . S CCN=0 F I=1:1:+^UTILITY($J,1,RTN,0,0) S CCN=CCN+$L(^UTILITY($J,1,RTN,0,I,0))+2
74 . S ^UTILITY($J,1,RTN,0)=CCN
75 . Q
76EXIT D ^%ZISC K ^UTILITY($J),RTN,T,CCN,I
Note: See TracBrowser for help on using the repository browser.