source: WorldVistAEHR/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XTSUMBLD.m@ 1259

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

initial load of WorldVistAEHR

File size: 5.0 KB
Line 
1XTSUMBLD ;SF/RWF - BUILD PACKAGE INTEG ROUTINE ; 3/21/06 2:50MP
2 ;;7.3;TOOLKIT;**11,20,66,70,94,100**;Apr 25, 1995;Build 4
3A ;
4 K ^UTILITY($J),DIR D MSG
5 S DIR(0)="SM^P:Package;B:Build",DIR("A")="Build from" D ^DIR K DIR Q:X[U
6 G PKG:Y="P",BUILD:Y="B" Q
7PKG W !!,"This will build a checksum routine for a package from the package file",!
8 S DIC=9.4,DIC(0)="AEMQZ" D ^DIC G EXIT:Y'>0
9 D NAME($P(Y(0),U,2)) G EXIT:'$D(XTRNAME)
10 X ^%ZOSF("RSEL") G EXIT:$O(^UTILITY($J,""))=""
11 G BLD
12 ;
13BUILD W !!,"This will build a checksum routine from the BUILD file."
14 S DIC="^XPD(9.6,",DIC(0)="AEMQZ" D ^DIC G EXIT:Y'>0 S BLDA=+Y
15 I $P(Y(0),U,2)'>0 W !!,"There isn't a package file pointer." G EXIT
16 S X=$P(^DIC(9.4,+$P(Y(0),U,2),0),U,2) D NAME(X) G EXIT:'$D(XTRNAME)
17 F IX=0:0 S IX=$O(^XPD(9.6,BLDA,"KRN",9.8,"NM",IX)) Q:IX'>0 S X=^(IX,0) S:'$P(X,U,3) ^UTILITY($J,$P(X,U))=""
18 F IX="INI","INIT","PRE" S X=$G(^XPD(9.6,BLDA,IX)) I X]"" S ^UTILITY($J,$S(X[U:$P(X,U,2),1:X))=""
19 G EXIT:$O(^UTILITY($J,""))=""
20 G BLD
21 ;
22NAME(Y) S XTRNAME=Y_"NTEG" W !,"I will create a routine ",XTRNAME
23 S X=XTRNAME X ^%ZOSF("TEST") I $T S DIR(0)="YA",DIR("A")="But you already have one on file! OK to replace? ",DIR("B")="NO" D ^DIR I Y'=1 K XTRNAME
24 Q
25 ;
26BLD S X=XTRNAME F I=0:0 K ^UTILITY($J,X) S X=$O(^UTILITY($J,X)) Q:X'[XTRNAME
27 I $O(^UTILITY($J,""))="" W !,"Routine list is empty" G EXIT
28 W !,"Calculating check-sums" S XTDT=$$NOW^XLFDT()
29 S X=" " F I=0:0 S X=$O(^UTILITY($J,X)) Q:X="" D
30 . W !,X X ^%ZOSF("TEST") I '$T W ?10,"Routine not in this UCI." Q
31 . X ^%ZOSF("RSUM") S ^UTILITY($J,X)=Y Q
32 W !,"Building routine" S RN=" ",XTRNCNT=0
33B K ^UTILITY($J,0) S XTSIZE=0,XCN=0,DIE="^UTILITY($J,0,",XTRNEXT=$E(XTRNAME,1,7)_XTRNCNT,XTRNCNT=XTRNCNT+1
34 F I=1:1 S XT=$P($T(ROU+I),";;",2,99) D ADD Q:$E(XT,1,3)="ROU"
35 S @(DIE_"1,0)")=XTRNAME_$P($T(ROU+1),";;",2)_XTDT,@(DIE_"3,0)")=" ;;"_$P($T(+2),";",3)_";"_XTDT
36 F I=0:0 S RN=$O(^UTILITY($J,RN)) Q:RN="" S %=^(RN),XT=RN_" ;;"_% D ADD Q:XTSIZE>3700
37 I RN]"" S @(DIE_"6,0)")=" G CONT^"_XTRNEXT
38 S XCN=0,X=XTRNAME W !!,"Filing routine ",XTRNAME X ^%ZOSF("SAVE") S XTRNAME=XTRNEXT G:RN]"" B
39 W !," DONE",!
40EXIT K ^UTILITY($J),DIC,DIR,XCN,XTRNAME,XTRNCNT,XU1,XTSIZE,XTDT,DIE,XTRNEXT,XT,X,Y
41 Q
42ADD S XCN=XCN+1,XTSIZE=XTSIZE+$L(XT)+2,@(DIE_XCN_",0)")=XT Q
43 Q
44CHECK ;Print the values of a set of routines.
45 N XPCH,X,DIR D MSG
46 S DIR(0)="SM^P:Package;B:Build",DIR("A")="Build from" D ^DIR K DIR Q:X[U
47 G CHKPKG:Y="P",CHKBLD:Y="B" Q
48CHKPKG W !! K ^UTILITY($J) X ^%ZOSF("RSEL") I $O(^UTILITY($J,0))']"" W !!,"NO SELECTED ROUTINES" G EXIT
49CHK2 S X=" " F XU1=0:0 S X=$O(^UTILITY($J,X)) Q:X']"" D
50 . W !,X,?10 X ^%ZOSF("TEST") I '$T W "Routine not in this UCI." Q
51 . I $G(XUCHFLG)=1 X ^%ZOSF("RSUM1") W "value = ",Y
52 . E X ^%ZOSF("RSUM") W "value = ",Y
53 . I $D(XPCH) X XPCH
54 . Q
55 W !,"done" G EXIT
56CHKBLD W !!,"This will check the routines from a BUILD file."
57 S DIC="^XPD(9.6,",DIC(0)="AEMQZ" D ^DIC G EXIT:Y'>0
58 S BLDA=+Y,X=$P(Y,"^",2)
59 I X["*" S XPCH="S L=$T(+2^@X) I $P(L,"";"",5)'?.E1P1"""_$P(X,"*",3)_"""1P.E W ?30,""Missing patch number"""
60 F IX=0:0 S IX=$O(^XPD(9.6,BLDA,"KRN",9.8,"NM",IX)) Q:IX'>0 S X=^(IX,0) S:'$P(X,U,3) ^UTILITY($J,$P(X,U))=""
61 F IX="INI","INIT","PRE" S X=$G(^XPD(9.6,BLDA,IX)) I X]"" S ^UTILITY($J,$S(X[U:$P(X,U,2),1:X))=""
62 G EXIT:$O(^UTILITY($J,""))=""
63 G CHK2
64 ;
65MSG W !!,"This option determines the current checksum of selected routine(s)."
66 W !,"The Checksum of the routine is determined as follows:",!
67 W !,"1. Any comment line with a single semi-colon is presumed to be"
68 W !," followed by comments and only the line tag will be included."
69 W !!,"2. Line 2 will be excluded from the count.",!
70 W !,"3. The total value of the routine is determined (excluding"
71 W !," exceptions noted above) by multiplying the ASCII value of each"
72 W !," character by its position on the line "
73 I $G(XUCHFLG)=1 W "and position of the line in ",!," the routine "
74 W "being checked."
75 Q
76 ;
77CHECK1 ;New CheckSum logic
78 W !,"New CheckSum CHECK1^XTSUMBLD:"
79 N XUCHFLG S XUCHFLG=1 D CHECK
80 Q
81 ;
82CHCKSUM ;
83 W !,"This option determines the current Old (CHECK^XTSUMBLD) or New (CHECK1^XTSUMBLD) logic checksum of selected routine(s)."
84 N OON
85 S OON=$$ASKOON Q:OON<1 ;Return 1 or 2
86 I OON=1 D CHECK
87 I OON=2 D CHECK1
88 Q
89 ;
90ASKOON() ;
91 ;Ask if user wants old/new checksum
92 ;Return 1 or 2.
93 N DIR,DIOUT
94 S DIR(0)="S^1:Old;2:New",DIR("A")="New or Old Checksums",DIR("B")="New"
95 D ^DIR
96 I $D(DIRUT) S Y=-1
97 Q Y
98ROU ;;
99 ;; ;ISC/XTSUMBLD KERNEL - Package checksum checker ;
100 ;; ;;0.0;
101 ;; ;;7.3;10/1/94
102 ;; S XT4="I 1",X=$T(+3) W !!,"Checksum routine created on ",$P(X,";",4)," by KERNEL V",$P(X,";",3),!
103 ;;CONT F XT1=1:1 S XT2=$T(ROU+XT1) Q:XT2="" S X=$P(XT2," ",1),XT3=$P(XT2,";",3) X XT4 I $T W !,X X ^%ZOSF("TEST") S:'$T XT3=0 X:XT3 ^%ZOSF("RSUM") W ?10,$S('XT3:"Routine not in UCI",XT3'=Y:"Calculated "_$C(7)_Y_", off by "_(Y-XT3),1:"ok")
104 ;; ;
105 ;; K %1,%2,%3,X,Y,XT1,XT2,XT3,XT4 Q
106 ;;ONE S XT4="I $D(^UTILITY($J,X))",X=$T(+3) W !!,"Checksum routine created on ",$P(X,";",4)," by KERNEL V",$P(X,";",3),!
107 ;; W !,"Check a subset of routines:" K ^UTILITY($J) X ^%ZOSF("RSEL")
108 ;; W ! G CONT
109 ;;ROU ;;
Note: See TracBrowser for help on using the repository browser.