root/trunk/tsuite/slow/doc_tsuite.pl

Revision 749, 4.1 kB (checked in by gary, 2 years ago)

tsuite - fix formatting of some sims in slow tsuite suite

programs now compile as c++ - mostly TRUE -> true, etc

htm files in programs now have readme_ as start of name

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