root/trunk/tsuite/auto/doc_tsuite.pl

Revision 2345, 3.9 kB (checked in by gary, 5 months ago)

coll_t3.in - add cosmic rays to increase stability
doc_tsuite.pl - better output at end of run, clean up comments
grains_hot.in - add quantum heating (remove non qheat command)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#!/usr/bin/perl
2
3#  This program takes  the '*.in' files, one at a time,
4#  creates a HTML file, 'doc_tsuite.htm' and prints the inputs
5#  and description into the HTML file. The names of the input
6#  files and the tasks they perform are printed in a text file
7#  'doc_tsuite.txt'.
8
9#  Program written by Geetashree Chakravorty, Graduate Student
10#  Computer Science Department, University of Kentucky
11#  in the year 2001 for Dr. Gary Ferland
12
13
14#Assigment of variables to the two output files
15# Variable assignment for the output HTML file
16$htests='doc_tsuite.htm'
17# Variable assignment of the output Text file
18$tests='doc_tsuite.txt';   
19$tfile='tempfile.tmp';
20
21#open the output HTML file
22open(THTML,">$htests");
23
24#open the output text file
25open(TTEXT,">$tests");
26
27#two variables $bool1 and $bool2 has been assigned as
28#flags to determine whether to print the lines with 'assert' and '//'
29#initially $bool1 and $bool2 has been set to '0' which means the
30#printed result will not print the lines having 'assert' and '//'.
31
32#To have 'assert' and '//' back on we have to remove the comment sign
33#before the next two print commands and comment the default values set
34#and then set $bool1=<> and $bool2=<>.
35
36# the conditions are as follow:
37#       $bool1  $bool2
38#         0       0   --->no assert and // (Default)
39#         0       1   --->no assert
40#         1       0   --->no //
41#         1       1   --->all included 
42                 
43#print "Do you want to have 'assert' on (Enter 0 for No and 1 for Yes): \n";
44$bool1=0;
45#print "Do you want the '\\' on (Enter 0 for No and 1 for Yes): \n";
46$bool2=0;
47
48print THTML "<html>\n
49<head>\n
50<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n
51   <meta name=\"GENERATOR\" content=\"Mozilla/4.77 [en] (X11; U; Linux 2.4.3-12 i686) [Netscape]\">\n
52   <title>Cloudy test suite</title>\n
53
54</head>
55<body>";
56print THTML "<h4>  This HTML file was created by the program doc_tsuite.pl.  doc_tsuite.txt contains a tab delimited list of the files. </h4>\n";
57
58#start of source program
59#open *.in files
60while(defined($input=glob("*.in")))
61{
62        open(TEST,"$input");   #TEST is the handle to the input .in files
63
64#$flag is a flag whih is set to 1 when it encounters a blank space
65$flag=0;
66
67#prints the name of the file as header
68print THTML "<hr>";
69         print THTML "<kbd>";
70        print THTML "<h2>$input  ";
71#reading in each line of file, formatting it and printing the formated result in 'text2.html'
72
73while(<TEST>)
74{
75        if($_=~/title/)
76        {
77                $rtitle=$_;
78                $rtitle=~s/title\s//;  # Removes 'title' from line 
79                print TTEXT "$input\t$rtitle";
80                print THTML "</kbd><I>$rtitle</I></h2><kbd>";
81        }
82        if($flag==0)
83        {
84                if($_!~/^\n*$/) 
85                {
86                        # printing files in a line to line basis
87                        if ($bool1==0 && $bool2==0)
88                        {       
89                                if($_!~/\/\//)    # if not comments
90                                {
91                                        if($_!~/assert/)   # if not asserts
92                                        {
93                                                print THTML "<br>$_";
94                                        }
95                                }
96                        }
97                        elsif($bool1==0 && $bool2==1)
98                        {
99                                if($_!~ /assert/)    # if not asserts
100                                {
101                                        print THTML "<br>$_";
102                                }
103                        }       
104                        elsif($bool1==1 && $bool2==0)
105                        {       
106                                if($_!~/\/\//)       # if not comments
107                                {
108                                        print THTML "<br>$_";
109                                }
110                        }
111                        elsif($bool1==1 && $bool2==1)
112                        {       
113                                print THTML "<br>$_";
114                        }
115                        else
116                        {
117                                print "Error in setting values.\n"
118                        }
119                }
120                else
121                {
122                        print THTML "</kbd>";   
123                        $flag=1;
124                }
125        }
126        if($flag==1)
127                {       if($_=~/^\n$/)
128                                {
129                                        print THTML "<p>";      # prints description in a paragraph format.
130                                }
131                        if($_=~/^(\n*Checks|\-)/)
132                                {
133                                        print THTML "<br>$_";   # prints 'Checks'
134                                }
135                        else
136                                {
137                                        print THTML "$_";
138                                }
139                }
140        }
141        print THTML "</p>";
142        close(TEST);
143}
144
145print THTML "<hr>\n
146</body>\n
147</html>";
148
149#closing both 'doc_tsuite.txt' and 'doc_tsuite.html'
150close(TTEXT);
151close(THTML);
152
153print "\n$tests contains a list of the file names and titles.\n";
154print "$htests has the formatted contents of each test case.\n";
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Note: See TracBrowser for help on using the browser.