利用Source Monitor分析代碼複雜度

最近利用SourceMonitor+ ASP+BAT來分析代碼並生成靜態分析文件:
1. 利用shell從CVS check out code:

運行此程序; ./ auto_checkout.sh page. page” 對應page_cfg.sh

a) Auto_checkout.sh

#!/bin/bash

#function log_time() {
# echo `$DT_FORMAT` ": $1 " 
# echo `$DT_FORMAT` ": $1 " >> $TIMELOG 
#}

GOAL=$1

CFG_FILE="${GOAL}_cfg.sh"
#Get configuration from cfg.sh
source ${CFG_FILE}

#DT_STAMP=`date +%Y%m%d_%H%M%S`
#DT_FORMAT="date -R"

WORKDIR=/sourcemonitor
#WORKDIR=/cvstest/builds/all
WORKDIR_REPO=${WORKDIR}/${REPONAME}

mkdir -p $WORKDIR_REPO
##################################################################
# Check out cvs log from every modules
##################################################################
cd $WORKDIR_REPO

echo "=========ALL_MODS:$ALL_MODS=========="
for MOD in $ALL_MODS; do
echo "=========WORKDIR:$WORKDIR=========="
echo "=========MOD:$MOD=========="

if [ "$BRANCH" = "HEAD" ]; then
  cvs -z9 co $MOD
else
  cvs -z9 co -r $BRANCH $MOD
fi  
done

b) Page_cfg.sh

export CVSROOT=:pserver:[email protected]:/cvs/webapps
export REPONAME=webapps
export ALL_MODS="meetingcenter trainingcenter siteadmin branding urlapi reminder waf svccomponents mywebex nbr dispatcher npp logadmin apidispatcher webcomponents webacd"
export BRANCH=HEAD

c). SourceMonitor optional file: Baseline.xml

 <?xml version="1.0" encoding="UTF-8" ?>

<!-- =======================================================================
 Examples of typical SourceMonitor command line script commands.
======================================================================== -->

<sourcemonitor_commands>

    <!-- ===================================================================
     The write_log element value is used for execution of commands in this
     file, not the log errors flag set in SourceMonitor's options dialog.
     If this element is missing, command progress and errors will be written
     to the SourceMonitor log file.
     =================================================================== -->

    <write_log>true</write_log>

    <!-- ===============================================================
      This command is typical for a project that does not yet exist.
      The file name becomes the project name of the new project.
    ================================================================ -->

    <command>

        <project_file>D:/CVS/SM/AllC++.smp</project_file>

        <!-- ===============================================================
         For a new project, you must specify the language and the location
         of the source code.
        ================================================================ -->

        <project_language>C++</project_language>
        <source_directory>H:/</source_directory>
        <checkpoint_name>BaselineC++</checkpoint_name>
        <checkpoint_date>2007-05-17T16:00:00</checkpoint_date>

        <!-- ===============================================================
         For either a new or existing project, you can override the default
         or current file extensions (set in the Options dialog) for source
         files to be included in a new checkpoint. All files with the
         extensions you specify here will be included in the new checkpoint.
        ================================================================ -->

        <file_extensions>*.cpp;*.h;*.hpp</file_extensions>
        <include_subdirectories>true</include_subdirectories>
        <ignore_headers_footers>true</ignore_headers_footers>

        <!-- ===============================================================
         Export of metrics data is supported for a single checkpoint per
         command (the one identified in the <checkpoint_name> tag or one that
         is automatically created as explained below). Exported metrics data
         is specified by the export type: "1" for the project summary as XML,
         "2" for checkpoint details as XML, or "3" project details as CSV.
         You specify the type with a number 1, 2 or 3 in the element's
         contents. All other text is ignored. The following examples are
         all valid specification of export type 2:
           <export_type>2 (project details as XML)</export_type>
           <export_type>Project details as XML: 2</export_type>
           <export_type>2</export_type>
        ================================================================ -->

        <export>
            <export_file>D:/CVS/SM/dumpCAA.csv</export_file>
            <export_type>3 (project summary as CSV)</export_type>
        </export>

        <!-- ===============================================================
         When the </command> tag is encountered, the command specified above
         is executed. In this sample command, the project and checkpoint are
         created and the XML export file is generated.
        ================================================================ -->

    </command>

    <command>
        <project_file>D:/CVS/SM/AllJava.smp</project_file>
        <project_language>Java</project_language>
        <source_directory>H:/</source_directory>
        <checkpoint_name>BaselineJava</checkpoint_name>
        <checkpoint_date>2007-05-17T16:00:00</checkpoint_date>
        <file_extensions>*.java</file_extensions>
        <include_subdirectories>true</include_subdirectories>
        <ignore_headers_footers>true</ignore_headers_footers>
        <export>
            <export_file>D:/CVS/SM/dumpJava.csv</export_file>
            <export_type>3 (project summary as CSV)</export_type>
        </export>       
    </command>
   
    <command>
        <project_file>D:/CVS/SM/AllC.smp</project_file>
        <project_language>C</project_language>
        <source_directory>H:/</source_directory>
        <checkpoint_name>BaselineC</checkpoint_name>
        <checkpoint_date>2007-05-17T16:00:00</checkpoint_date>
        <file_extensions>*.c</file_extensions>
        <include_subdirectories>true</include_subdirectories>
        <ignore_headers_footers>true</ignore_headers_footers>
        <export>
            <export_file>D:/CVS/SM/dumpC.csv</export_file>
            <export_type>3 (project summary as CSV)</export_type>
        </export>       
    </command>
   
</sourcemonitor_commands>

c). Analysis: Combine.asp

<%@LANGUAGE="VBSCRIPT"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
function show(uid)
{
window.open(uid,'_blank','left=100,top=20,width=400,height=300');
}
</script>
</head>
<%
Function IIf(condition,value1,value2)
 If condition Then IIf = value1 Else IIf = value2
End Function
%>
<body>

<%
'連接數據庫mdb
Dim cn,oConn,connstr

'打開MDB.
connstr="DBQ="+server.MapPath("SM.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set oConn=server.CreateObject("ADODB.Connection")
oConn.open connstr

'連接csv
Dim conStr,conn
'conStr="Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=D:/CVS/SM/;Extensions=asc,csv,tab,txt;"
conStr="Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq="+server.MapPath("./")+";Extensions=csv;"
set conn = Server.CreateObject("Adodb.Connection")
conn.ConnectionString=conStr
conn.Open

'讀取數據.
Dim rstTemp,rstCAA,rstJava
Dim rstTemp_numRows

'read c
Set rstTemp= Server.CreateObject("ADODB.Recordset")
rstTemp.ActiveConnection = conn
rstTemp.Source = "SELECT * FROM dumpC.csv"
rstTemp.CursorType = 0
rstTemp.CursorLocation = 2
rstTemp.LockType = 1
rstTemp.Open()

'set rsRead=server.CreateObject("ADODB.Recordset")
'rsRead.Open "select * from [Sheet1$]",cn,1,1

'rstTemp.Fields.Item("File Name").Value
'rstTemp.Fields.Item("Complexity of Most Complex Function").Value
'rstTemp.Fields.Item("Maximum Block Depth").Value
Dim strTmp, strFile, dblLine, intStatement, intPBranch, intPComment,intComplex,intDepth,intAvgDept,strProject

strFile=""
dblLine=0
intStatement=0
intPBranch=0
intPComment=0
intComplex=0
intDepth=0
intAvgDept=0
strProject=""

While (NOT rstTemp.EOF)
 If isnull(rstTemp.Fields("File Name")) Then strfile="" Else strfile=rstTemp.Fields("File Name") 
 If isnull(rstTemp.Fields("Lines")) Then dblLine=0 Else dblLine=rstTemp.Fields("Lines") 
 If isnull(rstTemp.Fields("Statements")) Then intStatement=0 Else intStatement=rstTemp.Fields("Statements") 
 If isnull(rstTemp.Fields("Percent Branch Statements")) Then intPBranch=0 Else intPBranch=rstTemp.Fields("Percent Branch Statements") 
 If isnull(rstTemp.Fields("Percent Lines with Comments")) Then intPComment=0 Else intPComment=rstTemp.Fields("Percent Lines with Comments") 
 If isnull(rstTemp.Fields("Complexity of Most Complex Function")) Then intComplex=0 Else intComplex=rstTemp.Fields("Complexity of Most Complex Function") 
 If isnull(rstTemp.Fields("Maximum Block Depth")) Then intDepth=0 Else intDepth=rstTemp.Fields("Maximum Block Depth") 
 If isnull(rstTemp.Fields("Average Block Depth")) Then intAvgDept=0 Else intAvgDept=rstTemp.Fields("Average Block Depth") 
 If isnull(rstTemp.Fields("Project Name")) Then strProject="" Else strProject=rstTemp.Fields("Project Name") 
 
 strTmp="Insert into dump(File,Line,Statement,PercentBranch,PercentComment,MaxComplexity,MaxDepth,AvgDepth,Project)Values('"& _
  strfile&"'," & cstr(dblLine) & "," & cstr(intStatement) & "," & _
  cstr(intPBranch) & "," & cstr(intPComment)  & ","& _  
  cstr(intComplex) & "," &cstr(intDepth)  & ","& _
  cstr(intAvgDept)&",'"&strProject & "')"

 oConn.Execute(strTmp )
 rstTemp.MoveNext()
Wend

'read c++
Set rstCAA= Server.CreateObject("ADODB.Recordset")
rstCAA.ActiveConnection = conn
rstCAA.Source = "SELECT * FROM dumpCAA.csv"
rstCAA.CursorType = 0
rstCAA.CursorLocation = 2
rstCAA.LockType = 1
rstCAA.Open()

While (NOT rstCAA.EOF)
 If isnull(rstCAA.Fields("File Name")) Then strfile="" Else strfile=rstCAA.Fields("File Name") 
 If isnull(rstCAA.Fields("Lines")) Then dblLine=0 Else dblLine=rstCAA.Fields("Lines") 
 If isnull(rstCAA.Fields("Statements")) Then intStatement=0 Else intStatement=rstCAA.Fields("Statements") 
 If isnull(rstCAA.Fields("Percent Branch Statements")) Then intPBranch=0 Else intPBranch=rstCAA.Fields("Percent Branch Statements") 
 If isnull(rstCAA.Fields("Percent Lines with Comments")) Then intPComment=0 Else intPComment=rstCAA.Fields("Percent Lines with Comments") 
 If isnull(rstCAA.Fields("Maximum Complexity")) Then intComplex=0 Else intComplex=rstCAA.Fields("Maximum Complexity") 
 If isnull(rstCAA.Fields("Maximum Block Depth")) Then intDepth=0 Else intDepth=rstCAA.Fields("Maximum Block Depth") 
 If isnull(rstCAA.Fields("Average Block Depth")) Then intAvgDept=0 Else intAvgDept=rstCAA.Fields("Average Block Depth") 
 If isnull(rstCAA.Fields("Project Name")) Then strProject="" Else strProject=rstCAA.Fields("Project Name") 
 
 strTmp="Insert into dump(File,Line,Statement,PercentBranch,PercentComment,MaxComplexity,MaxDepth,AvgDepth,Project)Values('"& _
  strfile&"'," & cstr(dblLine) & "," & cstr(intStatement) & "," & _
  cstr(intPBranch) & "," & cstr(intPComment)  & ","& _  
  cstr(intComplex) & "," &cstr(intDepth)  & ","& _
  cstr(intAvgDept)&",'"&strProject & "')"
  
 oConn.Execute(strTmp )
 rstCAA.MoveNext()
Wend

'read java
Set rstJava= Server.CreateObject("ADODB.Recordset")
rstJava.ActiveConnection = conn
rstJava.Source = "SELECT * FROM dumpJava.csv"
rstJava.CursorType = 0
rstJava.CursorLocation = 2
rstJava.LockType = 1
rstJava.Open()

While (NOT rstJava.EOF)
 If isnull(rstJava.Fields("File Name")) Then strfile="" Else strfile=rstJava.Fields("File Name") 
 If isnull(rstJava.Fields("Lines")) Then dblLine=0 Else dblLine=rstJava.Fields("Lines") 
 If isnull(rstJava.Fields("Statements")) Then intStatement=0 Else intStatement=rstJava.Fields("Statements") 
 If isnull(rstJava.Fields("Percent Branch Statements")) Then intPBranch=0 Else intPBranch=rstJava.Fields("Percent Branch Statements") 
 If isnull(rstJava.Fields("Percent Lines with Comments")) Then intPComment=0 Else intPComment=rstJava.Fields("Percent Lines with Comments") 
 If isnull(rstJava.Fields("Maximum Complexity")) Then intComplex=0 Else intComplex=rstJava.Fields("Maximum Complexity") 
 If isnull(rstJava.Fields("Maximum Block Depth")) Then intDepth=0 Else intDepth=rstJava.Fields("Maximum Block Depth") 
 If isnull(rstJava.Fields("Average Block Depth")) Then intAvgDept=0 Else intAvgDept=rstJava.Fields("Average Block Depth") 
 If isnull(rstJava.Fields("Project Name")) Then strProject="" Else strProject=rstJava.Fields("Project Name") 
 
 strTmp="Insert into dump(File,Line,Statement,PercentBranch,PercentComment,MaxComplexity,MaxDepth,AvgDepth,Project)Values('"& _
  strfile&"'," & cstr(dblLine) & "," & cstr(intStatement) & "," & _
  cstr(intPBranch) & "," & cstr(intPComment)  & ","& _  
  cstr(intComplex) & "," &cstr(intDepth)  & ","& _
  cstr(intAvgDept)&",'"&strProject & "')"

 oConn.Execute(strTmp )
 rstJava.MoveNext()
Wend%>
<%=" Data Imported to database finished!!!!!!!!!!!!!!!!!!!"
%>
<%
'**************************************************************************************
'                                                               produce the statistic page
'**************************************************************************************
'Get Baseline data
Dim rstBaseline,rstDaily
Set rstBaseline= Server.CreateObject("ADODB.Recordset")
rstBaseline.ActiveConnection = oConn
rstBaseline.Source = "SELECT * FROM ListBaseline"
rstBaseline.CursorType = 0
rstBaseline.CursorLocation = 2
rstBaseline.LockType = 1
rstBaseline.Open()

'Get Daily data
Set rstDaily= Server.CreateObject("ADODB.Recordset")
rstDaily.ActiveConnection = oConn
rstDaily.Source = "SELECT * FROM ListDaily"
rstDaily.CursorType = 0
rstDaily.CursorLocation = 2
rstDaily.LockType = 1
rstDaily.Open()

'Get Service data
Dim arrService ,rstService,strService
Set rstService= Server.CreateObject("ADODB.Recordset")
rstService.ActiveConnection = oConn
rstService.Source = "SELECT * FROM ListService"
rstService.CursorType = 0
rstService.CursorLocation = 2
rstService.LockType = 1
rstService.Open()

arrService=rstService.getrows()

'Generate Result page
Dim strFilename, FSO, FileTmp,strFontS, strFontE

strFontS=""
strFontE=""
strFilename=server.MapPath("result.html")
set FSO= server.createobject("Scripting.FileSystemObject")
set FileTmp=FSO.CreateTextFile(strFilename,true)  

 'FileTmp.writeline   "<!-- #include file=""Head.inc"" -->"
 FileTmp.writeline   "<html><head>"  
 FileTmp.writeline   "<title>Daily Complexity and Depth Track Page</title>"
 FileTmp.writeline   "<style type=""text/css"">"
 FileTmp.writeline   "body {font:11px Arial, Helvetica, sans-serif}"
 FileTmp.writeline   ".mainmenu{"
 FileTmp.writeline   "background-color:#EEE;"
 FileTmp.writeline   "padding:1px 0 1px 5px;"
 FileTmp.writeline   "color:#06C;"
 'FileTmp.writeline   "font-weight:bold;"
 FileTmp.writeline   "word-break:break-all;"
 FileTmp.writeline   "word-warp:warp;"
 FileTmp.writeline   "cursor:pointer"
 FileTmp.writeline   "}"
 FileTmp.writeline   "</style>"
 FileTmp.writeline   "<script language=""JavaScript"">"
 FileTmp.writeline   "function Display(ID)"
 FileTmp.writeline   "{"
 FileTmp.writeline   "if(ID.style.display == ""none"")"
 FileTmp.writeline   "{"
 FileTmp.writeline   "ID.style.display = """";"
 FileTmp.writeline   "}"
 FileTmp.writeline   "else "
 FileTmp.writeline   "{"
 FileTmp.writeline   "ID.style.display = ""none"";"
 FileTmp.writeline   "}"
 FileTmp.writeline   "}"
 FileTmp.writeline   "</script>"
 FileTmp.writeline   "</head><body>"  
 FileTmp.writeline   "<a name=""Top""></a>"
 FileTmp.writeline   "<b><font face=""Verdana"">Code complexity and depth daily track: &nbsp;&nbsp;&nbsp;&nbsp; </font></b>"
 FileTmp.writeline   "<font face=""Verdana"">Track all files with complexity&gt;=50 or depth&gt;=7&nbsp;&nbsp;&nbsp;</font>"
 'FileTmp.writeline   "<p><font size=""3"">| <a href=""#Top"">Client</a> | <a href=""#Platform"">Platform</a> |<a href=""#TEO""> TEO</a> | <a href=""#Web"">Web</a> |</font></p>
 
 FileTmp.writeline   "<p><font size=""3"">| <a href=""#Top"">"
 'FileTmp.writeline   "UBound(arrService,1)=" & UBound(arrService,1)
 'FileTmp.writeline   "arrService(0,0)=" & arrService(0,0)
 'FileTmp.writeline   "arrService(0,1)=" & arrService(0,1)
 
 For intI =0 to UBound(arrService,2)
  If intI = 0 Then
   FileTmp.writeline   arrService(0,intI) & "</a>&nbsp; |"
  Else
   FileTmp.writeline   "&nbsp;<a href=""#" & arrService(0,intI) & """>"&arrService(0,intI) &"</a>&nbsp; |"
  End if
 Next
 FileTmp.writeline   "</font></p>"
 
 '************************************
 '依次輸出Client, Platform, TEO, Web的代碼分析數據
 '************************************
 For intI =0 to UBound(arrService,2)
  'Out put navigation link
  strService = arrService(0,intI)  
  
  if intI<>0 then    
   FileTmp.writeline   "<a name=""" & strService & """></a>"
   FileTmp.writeline  "<p><font color=""#0066CC""><span style=""font-size: 13pt; font-weight: 700"">" & strService &"</span></font>"
   FileTmp.writeline   "&nbsp;&nbsp;&nbsp;&nbsp; <a href=""#Top"">TOP↑<font size=""3""></font></a>"'</p>"
  Else
   FileTmp.writeline  "<font color=""#0066CC""><span style=""font-size: 13pt; font-weight: 700"">" & strService &"</span></font>"
  End if  
  
  'out put table information
  'out put daily data 
  'FileTmp.writeline   "<!-- #include file=""Middle.inc"" -->"    
   FileTmp.writeline   "<table border=""1"" width=""100%"" style=""float:left;font:12px Arial, Helvetica, sans-serif"" cellspacing=""0"" bordercolor=""#C0C0C0"" cellpadding=""0"">"
  FileTmp.writeline   "<tr>"
  FileTmp.writeline   "<td height=""23"" bordercolor=""#008080"" colspan=""5"">"
  FileTmp.writeline   "<p align=""center"" style=""font-weight:bold;color:#06C; "">newly introduced("&cstr(Date)&")</td>"
  FileTmp.writeline   "</tr>"
  FileTmp.writeline   "<tr>"
  FileTmp.writeline   "<td width=""150"" height=""23"" bordercolor=""#008080"" align=""center""><b>Module</b></td>"
  FileTmp.writeline   "<td width=""100"" height=""23"" bordercolor=""#008080"" align=""center""><b>File Name</b></td>"
  FileTmp.writeline   "<td height=""23"" bordercolor=""#008080"" align=""center""><b>Full Path</b></td>"
  FileTmp.writeline   "<td width=""90"" height=""23"" bordercolor=""#008080"" align=""center"">"
  FileTmp.writeline   "<b>Complexity</b></td>"
  FileTmp.writeline   "<td height=""23"" bordercolor=""#008080"" align=""center""><b>Depth</b></td>"
  FileTmp.writeline   "</tr>" 
  
  Do while (NOT rstDaily.EOF)
   If strService=rstDaily.fields("Service") then
    if isnull(rstDaily.fields("OldFile")) then
     FileTmp.writeline "<tr>"    
     strFile =  rstDaily.fields("File")      
     FileTmp.writeline "<td  bordercolor=""#008080"" style=""word-break:break-all;word-wrap:break-word"">" & rstDaily.fields("Module") & "</td>"
     FileTmp.writeline "<td  bordercolor=""#008080""  style=""word-break:break-all;word-wrap:break-word"">" & Right(strFile,Len(strFile)-InStrRev(strFile,"/")) & "</td>"
     'FileTmp.writeline "<td  bordercolor=""#008080""  style=""word-break:break-all;word-wrap:break-word"">" & "<a href=""Detail.html#"&strFile&""">" &Right(strFile,Len(strFile)-InStrRev(strFile,"/")) & "</a>"& "</td>"
     FileTmp.writeline "<td  bordercolor=""#008080"" style=""word-break:break-all;word-wrap:break-word"">" & strFile& "</td>"
     FileTmp.writeline "<td bordercolor=""#008080"">" & rstDaily.fields("MaxComplexity")&"</td>"
     FileTmp.writeline "<td bordercolor=""#008080"">" & rstDaily.fields("MaxDepth")&"</td>"
     FileTmp.writeline "</tr></tbody>"
     rowIndex=rowIndex+1
    end if  
    rstDaily.MoveNext()
   Else
    exit do
   End if
  Loop  'daily  
  FileTmp.writeline "</table>"
     
  '***************************************
  ' out put baseline information
  '***************************************
  FileTmp.writeline   "<p>&nbsp;&nbsp;&nbsp;</p>"
  FileTmp.writeline "Notes: Data that is greyed out in the original tracking form denotes the complexity of the file has been reduced to less than 50 and the depth of the file has been less than 7 currently.<br>"
  
  FileTmp.writeline   "<table border=""1"" width=""100%""  style=""float:left;font:12px Arial, Helvetica, sans-serif"" cellspacing=""0"" cellpadding=""0"" >"
  FileTmp.writeline   "<tr>"
  FileTmp.writeline   "<td height=""23"" colspan=""5"">"
  FileTmp.writeline   "<p align=""center"" style=""font-weight:bold;color:#06C; "">original tracking data(2007-05-17)</td>"
  FileTmp.writeline   "</tr>"
  FileTmp.writeline   "<tr>"
  FileTmp.writeline   "<td width=""150"" height=""23"" align=""center""><b>Module</b></td>"
  FileTmp.writeline   "<td width=""100"" height=""23"" align=""center""><b>File Name</b></td>"
  FileTmp.writeline   "<td  height=""23"" align=""center""><b>FullPath</b></td>"
  FileTmp.writeline   "<td width=""90"" height=""23"" align=""center""><b>Complexity</b></td>"
  FileTmp.writeline   "<td height=""23"" align=""center""><b>Depth</b></td>"
  FileTmp.writeline   "</tr>"
  'out put base line data 
  Dim rowIndex
  rowIndex =1
  
  Do while (NOT rstBaseline.EOF)
   If strService= rstBaseline.fields("Service") Then
    FileTmp.writeline "<tr>"
    strFile =  rstBaseline.fields("File")
    if  isnull(rstBaseline.fields("NewFile") )   Then
     strFontS="<font color=""#808080"">"
     strFontE="</font>"
    else
     strFontS=""
     strFontE=""
    end if  
    FileTmp.writeline "<td style=""word-break:break-all;word-wrap:break-word"">" &strFontS& rstBaseline.fields("Module") &strFontE& "</td>"
    FileTmp.writeline "<td style=""word-break:break-all;word-wrap:break-word"">" &strFontS& Right(strFile,Len(strFile)-InStrRev(strFile,"/")) &strFontE& "</td>"
    FileTmp.writeline "<td style=""word-break:break-all;word-wrap:break-word"">" &strFontS& strFile&strFontE& "</td>"
    FileTmp.writeline "<td>" &strFontS& rstBaseline.fields("MaxComplexity")&strFontE& "</td>"
    FileTmp.writeline "<td>" &strFontS&  rstBaseline.fields("MaxDepth")&strFontE& "</td>"
    FileTmp.writeline "</tr></tbody>"
    rowIndex=rowIndex+1
    rstBaseline.MoveNext()
   Else
    exit do
   End if
  Loop 'baseline
  FileTmp.writeline "</table>" 
  
 Next' loop for Service
 
 'FileTmp.writeline   "<!-- #include file=""Foot.inc"" -->"    
 FileTmp.writeline "</body>"
 FileTmp.writeline "</html>"

response.write "<br>Statistic page produced successfully!"

FileTmp.close  
set FileTmp=nothing        
set FSO=nothing

rstBaseline.close
rstDaily.close
rstService.close
set rstBaseline=nothing
set rstDaily=nothing
set rstService=nothing

'**************************************************************************************
rstTemp.close
rstCAA.close
rstJava.close
set rstTemp=nothing
set rstCAA=nothing
Set rstJava=nothing
oConn.close
conn.close
set oConn=nothing
set conn=nothing
%>
<!--p class=mainmenu><a href="result.html" target="_blank")>查看結果頁面!</a></p-->
<script>
window.opener=null;
window.close();
</script>
</body>
</html>

d). Bat call

@echo offf
::**************************************************************
::*
::*   Auto run sourcemonitor
::*  
::*
::**************************************************************

:: Set veriables

set SMSPRO="D:/Program Files/SourceMonitor"
set SMS=D:/CVS/SM
:: ---------------------------------------
:: Run SMS
:: ---------------------------------------
D:
CD %SMSPRO%
SourceMonitor.exe /C %SMS%/Baseline.xml

explorer "http://172.16.201.56/SM/Combine.asp"

f). 一個頁面調用頁面的例子

<html>
<head>
<style type="text/css">
body {font:11px Arial, Helvetica, sans-serif}
.mainmenu{
background-color:#EEE;
padding:1px 0 1px 5px;
color:#06C;
font-weight:bold;
word-break:break-all;
word-warp:warp;
cursor:pointer
}
</style>
<script>
function show(uid)
{
window.open(uid,'_blank','left=100,top=20,width=400,height=300');
}
</script>

</head>
<body>
<p style="font-weight:bold;">依次執行一下步驟完成數據分析及結果頁面生成工作:</p>
<p class=mainmenu><a onclick=show('Analysis.html')>1、利用SourceMonitor工具進行代碼複雜度及深度分析</a></p>
<p class=mainmenu><a onclick=show('maintain.asp')>2、將數據導入數據庫!</a></p>
<p class=mainmenu><a onclick=show('daily.asp')>3、生成結果頁面</a></p>
<p class=mainmenu><a href="result.html" target="_blank")>4、查看結果</a></p>
</body>
<!--toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,revisable=yes,-->
</html>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章