home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
smart21b.zip
/
DAPIEMRG.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-09-11
|
20KB
|
577 lines
/* Rexx command to merge reports resulting from analysis using tables: */
/* W16DAPIE and DAPIE16. */
/* L.D. 8-7-95 */
/* New Feature to add headings to the original reports and re-write them */
/* L.D. 8-8-95 */
/* Load RexxUtils */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
Parse Arg help .
if help = "?" then call DisplayHelp
/* Initialize running totals for effort calculations */
Subtotal = 0
Total = 0
/* Ask all the annoying questions for report headings */
Call GetInitData
outfile = pname".dap" /* W16DAPIE and DAPIE16 merged .rpt */
/* delete existing .dap if there is one */
if (stream(pname".dap",'c','query exists') \= "") then do
say pname".dap file exists, Continue? y/n?"
say "Note: If you do continue, the existing" pname".dap file will be deleted."
Parse UPPER pull answer .
if answer = "N" then exit
call SysFileDelete pname".dap"
end /* if */
say "Saving original files with the .rpt extensions:" infile1 "and" infile2
say "Generating additional reports with headers:" tmpfile1 "and" tmpfile2
/* open the outputfiles */
lineoutResult = LINEOUT(outfile,,)
lineoutResult = LINEOUT(tmpfile1,,) /* FileName entered in GetInitData */
lineoutResult = LINEOUT(tmpfile2,,) /* FileName entered in GetInitData */
/* Write esc sequence to print landscape */
lineoutResult = LINEOUT(outfile,'1b6c'x)
lineoutResult = LINEOUT(tmpfile1,'1b6c'x)
lineoutResult = LINEOUT(tmpfile2,'1b6c'x)
/* Call function to write Page Headers for all 3 reports */
PageNum = 1
Call PageHead dateDap timeDap outfile PageNum nameDap
Call WriteSum outfile
Call PageHead date1 time1 tmpfile1 PageNum name1
Call WriteSum tmpfile1
Call PageHead date2 time2 tmpfile2 PageNum name2
Call WriteSum tmpfile2
PageNum = 2
Call PageHead dateDap timeDap outfile PageNum nameDap
Call PageHead date1 time1 tmpfile1 PageNum name1
Call PageHead date2 time2 tmpfile2 PageNum name2
LineNum = 2
/* open the input files*/
noread = LINEIN(infile1,,0)
noread = LINEIN(infile2,,0)
Say "Processing file:" tmpfile2
noread = LINEIN(infile2,,0)
/* read the entire DAPIE16 .rpt into an array */
PageNum2 = PageNum
LineNum2 = LineNum
subby = 0
do while (LINES(infile2))
if LineNum2 > 45 then do
lineoutResult = LINEOUT(tmpfile2,'0C'x)
PageNum2 = PageNum2 + 1
Call PageHead date2 time2 tmpfile2 PageNum2 name2
LineNum2 = 2
end /* if */
subby = subby+1
inline.subby = LINEIN(infile2)
/* Write the line to the report */
lineoutResult = LINEOUT(tmpfile2,inline.subby)
if lineoutResult = 1 then say "error outputting line" inline.subby "to file" infile2
if inline.subby = '0C'x then do
totalLines = subby
if LineNum2 > 3 then do
PageNum2 = PageNum2 + 1
Call PageHead date2 time2 tmpfile2 PageNum2 name2
LineNum2 = 2
end
end /* if */
else LineNum2 = LineNum2 + 1
end /* while */
Say "Processing file:" tmpfile1
/* Write headers */
Call WriteHeaders
PageNum1 = PageNum
LineNum1 = LineNum
ModuleEnd = 0
subby=1
/* parse each line of the WIN16T .rpt */
do while (LINES(infile1))
inline1 = LINEIN(infile1)
if LineNum1 > 45 then do
lineoutResult = LINEOUT(tmpfile1,'0C'x)
PageNum1 = PageNum1 + 1
Call PageHead date1 time1 tmpfile1 PageNum1 name1
LineNum1 = 2
end /* if */
/* Write the line to the report */
lineoutResult = LINEOUT(tmpfile1,inline1)
if lineoutResult = 1 then say "error outputting line" inline1 "to file" tmpfile1
PARSE VAR inline1 searchKey size1 lines1 code1 hits1 pcthits1 inst1 pctinst1 effort1 .
/* if we've reached the break character, then we are done with the DAP rpt */
if searchKey = '0c'x then do
ModuleEnd = 1
totalLines = subby
if LineNum1 > 3 then do
PageNum1 = PageNum1 + 1
Call PageHead date1 time1 tmpfile1 PageNum1 name1
LineNum1 = 2
end
end /* if */
else do
LineNum1 = LineNum1 + 1
if ModuleEnd = 0 then do
/* skip the headings */
if (searchKey \= " ") & (searchKey \= "PATH/FILENAME") & ,
(searchKey \= "____________________") then do
line2 = inline.subby
PARSE VAR line2 searchKey2 size2 lines2 code2 hits2 pcthits2 inst2 pctinst2 effort2 .
/* if this is a matching line, write the merged line */
if (searchKey = searchKey2) then do
if LineNum > 45 then do
lineoutResult = LINEOUT(outfile,'0C'x)
PageNum = PageNum + 1
Call PageHead dateDap timeDap outfile PageNum nameDap
LineNum = 2
end /* if */
if (searchKey = "*SubTotal*") then call GenSubs
else if (searchKey = "**Total**") then call GenTots
else call GenLine
end /* if */
end /* long if */
end /* if ModuleEnd...*/
end /* else */
subby = subby + 1
end /* while */
/* Cleanup and exit */
Call CleanupAndGo
/*-------------------------------------------------------------------------*/
/*Sub routines follow */
/*-------------------------------------------------------------------------*/
/* Ask analyst for info regarding the initial set of SMART reports and */
/* other interesting input about the source code being analyzed */
GetInitData:
say "Please enter a project name of 8 characters or less:"
Parse UPPER PULL pname .
say "Please enter your name:"
Parse PULL nameDap
dateDap = DATE('U')
timeDap = TIME('N')
say "Please enter the file specification for the .rpt file resulting from"
say "an analysis of the source for this project using the table W16DAPIE.TBL:"
say "The path need not be specified if the file resides in the current directory. "
parse PULL infile1
if (infile1="") then call BadFile
else do
call SysFileTree infile1, 'file1', 'F'
if file1.0 = 0 then call BadFile
end /* else */
say "Please enter the name of the person who ran the " infile1 "analysis:"
say "If you ran the" infile1 "analysis, you may leave this blank and press enter."
Parse PULL name1
if name1 = "" then name1 = nameDap
Parse Var file1.1 date1 time1 .
dot = POS(".",infile1)
tmpfile1 = SUBSTR(infile1,1,dot) || "rpd"
say "Please enter the file specification for the .rpt file resulting from"
say "an analysis of the source for this project using the table DAPIE16.TBL:"
say "The path need not be specified if the file resides in the current directory. "
parse PULL infile2
if (infile2="") then call BadFile
else do
call SysFileTree infile2, 'file2', 'F'
if file2.0 = 0 then call BadFile
end /* else */
say "Please enter the name of the person who ran the " infile2 "report:"
say "If you ran the" infile2 "analysis, you may leave this blank and press enter."
Parse PULL name2
if name2 = "" then name2 = nameDap
Parse Var file2.1 date2 time2 .
dot = POS(".",infile2)
tmpfile2 = SUBSTR(infile2,1,dot) || "rpd"
say "Were the two analyses," infile1 "and " infile2 "run with the same"
say "List-of-files and with the same EXCLUDE and IFDEF options?"
Parse PULL SameLst
say "Does this source code contain any 32 bit APIs?"
Parse PULL all16
say "Please enter any additional information about this source code, such as"
say "Libraries used, MFC, Borland Owl, etc., in 72 characters or less:"
Parse PULL Additional
say "If a source file contains mixed DAPIE and non-DAPIE code, the effort value"
say "may need to be increased for the first non-DAPIE hit to account for code re-"
say "structuring. Please enter additional effort value now or press enter to default to 0."
Parse Pull firstHit
if firstHit = "" then firstHit = 0
if DATATYPE(firstHit,'N') = 0 then firstHit = 0
say "If a source file contains mixed DAPIE and non-DAPIE code, the effort value"
say "for each subsequent non-DAPIE hit in this file will be increased by 2. To"
say "change this please enter a new value. Press enter to default to 2."
Parse Pull subsHit
if subsHit = "" then subsHit = 2
if DATATYPE(subsHit,'N') = 0 then subsHit = 2
return
/* Write the headers for the report */
WriteHeaders:
headerLine = RIGHT("WIN16",58)
headerLine = headerLine RIGHT("DAPIE",8)
headerLine = headerLine RIGHT("WIN16",8)
headerLine = headerLine RIGHT("DAPIE",8)
lineoutResult = LINEOUT(outfile,headerLine)
if lineoutResult = 1 then say "error outputting line" headerLine
headerLine = LEFT("PATH/FILENAME",20)
headerLine = headerLine RIGHT("SIZE",10)
headerLine = headerLine RIGHT("LINES",8)
headerLine = headerLine RIGHT("CODE",8)
headerLine = headerLine RIGHT("HITS",8)
headerLine = headerLine RIGHT("HITS",8)
headerLine = headerLine RIGHT("INSTS",8)
headerLine = headerLine RIGHT("INSTS",8)
headerLine = headerLine RIGHT("EFFORT",8)
lineoutResult = LINEOUT(outfile,headerLine)
if lineoutResult = 1 then say "error outputting line" headerLine
headerLine = LEFT("_",20,"_")
headerLine = headerLine RIGHT("_",10,"_")
headerLine = headerLine RIGHT("_",8,"_")
headerLine = headerLine RIGHT("_",8,"_")
headerLine = headerLine RIGHT("_",8,"_")
headerLine = headerLine RIGHT("_",8,"_")
headerLine = headerLine RIGHT("_",8,"_")
headerLine = headerLine RIGHT("_",8,"_")
headerLine = headerLine RIGHT("_",8,"_")
lineoutResult = LINEOUT(outfile,headerLine)
if lineoutResult = 1 then say "error outputting line" headerLine
headerLine = " "
lineoutResult = LINEOUT(outfile,headerLine)
if lineoutResult = 1 then say "error outputting line" headerLine
LineNum = LineNum + 4
return
/* Generate a Merged line for the report and write it. */
GenLine: