31
|
1 |
#!C:\Perl\bin
|
|
2 |
|
|
3 |
&do_c_header;
|
|
4 |
#&do_cpp_header;
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
#end of sub calls
|
|
9 |
|
|
10 |
|
|
11 |
sub do_c_header
|
|
12 |
{
|
|
13 |
$l1="/** \
|
|
14 |
\@file FILENAME \
|
|
15 |
\@internalComponent \
|
|
16 |
*/";
|
|
17 |
|
|
18 |
$infile = "ls.txt";
|
|
19 |
#$logfile = "sample.dosc";
|
|
20 |
$cmd = "ls *.h > ls.txt";
|
|
21 |
$cmd2 = "rm ls.txt";
|
|
22 |
|
|
23 |
#open(LOGFILE, ">$logfile");
|
|
24 |
|
|
25 |
# take dir list
|
|
26 |
system $cmd;
|
|
27 |
|
|
28 |
#open ls.txt and read lines
|
|
29 |
open(INFILE, $infile);
|
|
30 |
@lines=<INFILE>;
|
|
31 |
|
|
32 |
foreach $filename (@lines) #$filename = @lines[1];
|
|
33 |
{
|
|
34 |
#print LOGFILE "$filename\n";
|
|
35 |
$l2 = "$l1";
|
|
36 |
#print LOGFILE "-----------\n";
|
|
37 |
#print LOGFILE "$l2\n";
|
|
38 |
#print LOGFILE "----\n";
|
|
39 |
$l2 =~ s/FILENAME/$filename/; #replace FILENAME with header file name
|
|
40 |
#print LOGFILE "$l2\n";
|
|
41 |
#print LOGFILE "-----------\n";
|
|
42 |
$filename =~ s/\.h/.dosc/; #rename .h to .dosc
|
|
43 |
#print LOGFILE $filename;
|
|
44 |
|
|
45 |
open (OUTFILE, ">$filename");
|
|
46 |
print OUTFILE $l2;
|
|
47 |
close (OUTFILE);
|
|
48 |
}
|
|
49 |
|
|
50 |
|
|
51 |
#clean the ls.txt file
|
|
52 |
close (INFILE);
|
|
53 |
system $cmd2;
|
|
54 |
|
|
55 |
#print LOGFILE "$l1";
|
|
56 |
#print LOGFILE @lines;
|
|
57 |
#close (LOGFILE);
|
|
58 |
}
|
|
59 |
|
|
60 |
sub do_cpp_header
|
|
61 |
{
|
|
62 |
$l1="/** \
|
|
63 |
\@file FILENAME \
|
|
64 |
\@internalComponent \
|
|
65 |
*/";
|
|
66 |
|
|
67 |
$infile = "ls.txt";
|
|
68 |
#$logfile = "sample.dosc";
|
|
69 |
$cmd = "ls | grep -v \\. > ls.txt";
|
|
70 |
$cmd2 = "rm ls.txt";
|
|
71 |
|
|
72 |
#open(LOGFILE, ">$logfile");
|
|
73 |
|
|
74 |
# take dir list
|
|
75 |
system $cmd;
|
|
76 |
|
|
77 |
#open ls.txt and read lines
|
|
78 |
open(INFILE, $infile);
|
|
79 |
@lines=<INFILE>;
|
|
80 |
|
|
81 |
foreach $filename (@lines) #$filename = @lines[1];
|
|
82 |
{
|
|
83 |
#print "$filename\n";
|
|
84 |
$l2 = "$l1";
|
|
85 |
$l2 =~ s/FILENAME/$filename/; #replace FILENAME with header file name
|
|
86 |
#print LOGFILE "-----------\n";
|
|
87 |
#print "$l2\n";
|
|
88 |
#print LOGFILE "----\n";
|
|
89 |
|
|
90 |
#print LOGFILE "$l2\n";
|
|
91 |
#print LOGFILE "-----------\n";
|
|
92 |
#print LOGFILE $filename;
|
|
93 |
$filename =~ s/\n/\.dosc/;
|
|
94 |
#print "$filename\n";
|
|
95 |
|
|
96 |
open (OUTFILE, ">$filename");
|
|
97 |
print OUTFILE $l2;
|
|
98 |
close (OUTFILE);
|
|
99 |
}
|
|
100 |
|
|
101 |
#clean the ls.txt file
|
|
102 |
close (INFILE);
|
|
103 |
# system $cmd2;
|
|
104 |
|
|
105 |
#print LOGFILE "$l1";
|
|
106 |
#print LOGFILE @lines;
|
|
107 |
#close (LOGFILE);
|
|
108 |
}
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|