source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/ARJTXRD.m@ 841

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

initial load of WorldVistAEHR

File size: 1.7 KB
Line 
1ARJTXRD ;PUG/TOAD - Routine Directory Tools ;2/27/02 14:12
2 ;;8.0;KERNEL;;Jul 10, 1995;**LOCAL RTN: PUG/TOAD**
3 ;
4ANALYZE(ROUTINE,STATS) ; Analyze a routine in the directory
5 ; ROUTINE = name of the routine
6 ; STATS = array returned with summary info
7 ;
8 N LINE,LABEL,BODY
9 N BYTES S BYTES=0 ; size of routine
10 N CHAR S CHAR=0 ; absolute count of char position, incl. eol as $C(13)
11 N LINECHAR ; relative count of char position within each line
12 N CHECKSUM S CHECKSUM=0 ; absolute checksum of routine, incl. comments
13 N LABEL,SECTION,FROM S SECTION="[anonymous]",FROM=1
14 ;
15 N NUM F NUM=1:1 S LINE=$T(+NUM^@ROUTINE) Q:LINE="" D
16 . I $E(LINE)'=" " D ; deal with line label
17 . . S STATS(NUM,0)=LINE
18 . . S LABEL=$P($P(LINE," "),"(") ; get line label if any
19 . . Q:LABEL="" ; this should never happen, but who knows
20 . . S STATS("B",LABEL,NUM)="" ; index of labels
21 . . I NUM-FROM D ; for all but anonymous, unless it has lines
22 . . . S STATS("ALINE",FROM,NUM-1,SECTION)="" ; index lines by sec
23 . . . S STATS("ASIZE",SECTION,NUM-FROM)="" ; index sections by # lines
24 . . S SECTION=LABEL,FROM=NUM ; start next section
25 . E S LABEL="",BODY=LINE,$E(BODY)=""
26 . S BYTES=BYTES+$L(LINE)+2
27 . F LINECHAR=1:1:$L(LINE) D ; add line to cumulative absolute checksum
28 . . S CHAR=CHAR+1 ; advance absolute counter
29 . . S CHECKSUM=CHECKSUM+($A(LINE,LINECHAR)*CHAR)
30 . S CHAR=CHAR+1,CHECKSUM=CHECKSUM+(13*CHAR) ; incl. end of line
31 S STATS("ALINE",FROM,NUM-1,SECTION)="" ; index lines by sec
32 S STATS("ASIZE",SECTION,NUM-FROM)="" ; index sections by # lines
33 S STATS(2,0)=$T(+2^@ROUTINE) ; grab 2nd line
34 ;
35 N NODE0 S NODE0=ROUTINE_U_$$HTFM^XLFDT($H)_U_(NUM-1)
36 S NODE0=NODE0_U_BYTES_U_CHECKSUM
37 S STATS(0)=NODE0
38 Q
39 ;
40 ;
Note: See TracBrowser for help on using the repository browser.