OSDN Git Service

Delete wrong files
[eos/base.git] / sbin / makestructhtml.pl
1 #!/usr/bin/perl
2
3 use strict;
4 my $in=$ARGV[0];
5 my $structlist=$ARGV[1];
6 my $inline;
7 my $header;
8 my @structlist;
9 my $i=0;
10 my $inword;
11 my $outfile;
12 my $trimedword;
13 my $backtrimed;
14 my $foretrimed;
15 my $structname;
16 my @matchlist;
17 my $match;
18
19 open(STRUCTFILE,"$structlist");
20 while (<STRUCTFILE>){
21     chomp;
22     $structlist[$i]=$_;
23     $i++;
24 }
25
26 open(READFILE,"$in");
27 while (<READFILE>){
28     chomp;
29     ($header)=/^(\S+)/;
30     s/$header\s*//;
31     if (/typedef/){
32         ($structname)=/(\S+);\\n$/;
33         $structname=~s/(\S+)\}//;
34     } else {
35         ($structname)=/struct (\S+) *\{/;
36     }   
37     if ($structname=~/\S+/){
38         $outfile="$structname".".html";
39         open(OUTFILE,">$outfile");
40         print OUTFILE "<HTML>\n<BODY>\n";
41         print OUTFILE "<H1>$structname</H1><BR>\n";
42         print OUTFILE "<H3>in $header</H3><BR>\n";
43         s/\\n/ <BR>\n/g;
44         $inline=$_;
45         if (@matchlist = grep $inline=~/ $_ /, @structlist){
46             for $match (@matchlist){
47                 $inline=~s/ $match / <A HREF=\"$match.html\">$match <\/A>/g;
48             }
49         }
50         print OUTFILE "<PRE>\n$inline \n</PRE>";
51         print OUTFILE "</HTML>\n</BODY>\n";
52         close(OUTFILE);
53     }
54 }
55
56