1 | #!/usr/bin/perl -w
|
---|
2 |
|
---|
3 | ###########################################################################
|
---|
4 | #
|
---|
5 | # newsrc.pl -- creates new blank source files
|
---|
6 | # A component of the Greenstone digital library software
|
---|
7 | # from the New Zealand Digital Library Project at the
|
---|
8 | # University of Waikato, New Zealand.
|
---|
9 | #
|
---|
10 | # Copyright (C) 1999 New Zealand Digital Library Project
|
---|
11 | #
|
---|
12 | # This program is free software; you can redistribute it and/or modify
|
---|
13 | # it under the terms of the GNU General Public License as published by
|
---|
14 | # the Free Software Foundation; either version 2 of the License, or
|
---|
15 | # (at your option) any later version.
|
---|
16 | #
|
---|
17 | # This program is distributed in the hope that it will be useful,
|
---|
18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | # GNU General Public License for more details.
|
---|
21 | #
|
---|
22 | # You should have received a copy of the GNU General Public License
|
---|
23 | # along with this program; if not, write to the Free Software
|
---|
24 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
25 | #
|
---|
26 | ###########################################################################
|
---|
27 |
|
---|
28 | foreach $filename (@ARGV) {
|
---|
29 | if (-e "$filename.cpp") {
|
---|
30 | print STDERR "$filename.cpp already exists\n";
|
---|
31 | next;
|
---|
32 | }
|
---|
33 | if (-e "$filename.h") {
|
---|
34 | print STDERR "$filename.h already exists\n";
|
---|
35 | next;
|
---|
36 | }
|
---|
37 |
|
---|
38 | $upperfilename = $filename;
|
---|
39 | $upperfilename =~ tr/a-z/A-Z/;
|
---|
40 | $upperfilename =~ s/[^A-Z]/_/g;
|
---|
41 |
|
---|
42 | print STDERR "Creating $filename.cpp\n";
|
---|
43 |
|
---|
44 | open (CPPFILE, ">$filename.cpp") || die "Couldn't write $filename.cpp";
|
---|
45 |
|
---|
46 | print CPPFILE "/**********************************************************************\n";
|
---|
47 | print CPPFILE " *\n";
|
---|
48 | print CPPFILE " * $filename.cpp -- \n";
|
---|
49 | print CPPFILE " * A component of the Greenstone digital library software\n";
|
---|
50 | print CPPFILE " * from the New Zealand Digital Library Project at the\n";
|
---|
51 | print CPPFILE " * University of Waikato, New Zealand.\n";
|
---|
52 | print CPPFILE " *\n";
|
---|
53 | print CPPFILE " * Copyright (C) 1999 The New Zealand Digital Library Project\n";
|
---|
54 | print CPPFILE " *\n";
|
---|
55 | print CPPFILE " * This program is free software; you can redistribute it and/or modify\n";
|
---|
56 | print CPPFILE " * it under the terms of the GNU General Public License as published by\n";
|
---|
57 | print CPPFILE " * the Free Software Foundation; either version 2 of the License, or\n";
|
---|
58 | print CPPFILE " * (at your option) any later version.\n";
|
---|
59 | print CPPFILE " *\n";
|
---|
60 | print CPPFILE " * This program is distributed in the hope that it will be useful,\n";
|
---|
61 | print CPPFILE " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n";
|
---|
62 | print CPPFILE " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n";
|
---|
63 | print CPPFILE " * GNU General Public License for more details.\n";
|
---|
64 | print CPPFILE " *\n";
|
---|
65 | print CPPFILE " * You should have received a copy of the GNU General Public License\n";
|
---|
66 | print CPPFILE " * along with this program; if not, write to the Free Software\n";
|
---|
67 | print CPPFILE " * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n";
|
---|
68 | print CPPFILE " *\n";
|
---|
69 | print CPPFILE " * \$" . "Id: Exp \$\n";
|
---|
70 | print CPPFILE " *\n";
|
---|
71 | print CPPFILE " *********************************************************************/\n";
|
---|
72 | print CPPFILE "\n";
|
---|
73 | print CPPFILE "/*\n";
|
---|
74 | print CPPFILE " \$" . "Log: newsrc.pl,v \$\n";
|
---|
75 | print CPPFILE " */\n";
|
---|
76 | print CPPFILE "\n";
|
---|
77 | print CPPFILE "\n";
|
---|
78 | print CPPFILE "#include \"$filename.h\"\n";
|
---|
79 | print CPPFILE "\n";
|
---|
80 |
|
---|
81 | close (CPPFILE);
|
---|
82 |
|
---|
83 |
|
---|
84 | print STDERR "Creating $filename.h\n";
|
---|
85 |
|
---|
86 | open (HFILE, ">$filename.h") || die "Couldn't write $filename.h";
|
---|
87 |
|
---|
88 | print HFILE "/**********************************************************************\n";
|
---|
89 | print HFILE " *\n";
|
---|
90 | print HFILE " * $filename.h -- \n";
|
---|
91 | print HFILE " * A component of the Greenstone digital library software\n";
|
---|
92 | print HFILE " * from the New Zealand Digital Library Project at the\n";
|
---|
93 | print HFILE " * University of Waikato, New Zealand.\n";
|
---|
94 | print HFILE " *\n";
|
---|
95 | print HFILE " * Copyright (C) 1999 The New Zealand Digital Library Project\n";
|
---|
96 | print HFILE " *\n";
|
---|
97 | print HFILE " * This program is free software; you can redistribute it and/or modify\n";
|
---|
98 | print HFILE " * it under the terms of the GNU General Public License as published by\n";
|
---|
99 | print HFILE " * the Free Software Foundation; either version 2 of the License, or\n";
|
---|
100 | print HFILE " * (at your option) any later version.\n";
|
---|
101 | print HFILE " *\n";
|
---|
102 | print HFILE " * This program is distributed in the hope that it will be useful,\n";
|
---|
103 | print HFILE " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n";
|
---|
104 | print HFILE " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n";
|
---|
105 | print HFILE " * GNU General Public License for more details.\n";
|
---|
106 | print HFILE " *\n";
|
---|
107 | print HFILE " * You should have received a copy of the GNU General Public License\n";
|
---|
108 | print HFILE " * along with this program; if not, write to the Free Software\n";
|
---|
109 | print HFILE " * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n";
|
---|
110 | print HFILE " *\n";
|
---|
111 | print HFILE " * \$" . "Id: Exp \$\n";
|
---|
112 | print HFILE " *\n";
|
---|
113 | print HFILE " *********************************************************************/\n";
|
---|
114 | print HFILE "\n";
|
---|
115 | print HFILE "\n";
|
---|
116 | print HFILE "\#ifndef ${upperfilename}_H\n";
|
---|
117 | print HFILE "\#define ${upperfilename}_H\n";
|
---|
118 | print HFILE "\n";
|
---|
119 | print HFILE "\n";
|
---|
120 | print HFILE "\n";
|
---|
121 | print HFILE "\n";
|
---|
122 | print HFILE "\#endif\n";
|
---|
123 |
|
---|
124 | close (HFILE);
|
---|
125 | }
|
---|
126 |
|
---|