[1213] | 1 | #!/usr/bin/perl -w
|
---|
[123] | 2 |
|
---|
[538] | 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 |
|
---|
[123] | 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";
|
---|
[546] | 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";
|
---|
[1286] | 53 | print CPPFILE " * Copyright (C) 2000 The New Zealand Digital Library Project\n";
|
---|
[123] | 54 | print CPPFILE " *\n";
|
---|
[538] | 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";
|
---|
[123] | 59 | print CPPFILE " *\n";
|
---|
[538] | 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";
|
---|
[123] | 64 | print CPPFILE " *\n";
|
---|
[538] | 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";
|
---|
[123] | 69 | print CPPFILE " *********************************************************************/\n";
|
---|
| 70 | print CPPFILE "\n";
|
---|
| 71 | print CPPFILE "\n";
|
---|
| 72 | print CPPFILE "#include \"$filename.h\"\n";
|
---|
| 73 | print CPPFILE "\n";
|
---|
| 74 |
|
---|
| 75 | close (CPPFILE);
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | print STDERR "Creating $filename.h\n";
|
---|
| 79 |
|
---|
| 80 | open (HFILE, ">$filename.h") || die "Couldn't write $filename.h";
|
---|
| 81 |
|
---|
| 82 | print HFILE "/**********************************************************************\n";
|
---|
| 83 | print HFILE " *\n";
|
---|
| 84 | print HFILE " * $filename.h -- \n";
|
---|
[546] | 85 | print HFILE " * A component of the Greenstone digital library software\n";
|
---|
| 86 | print HFILE " * from the New Zealand Digital Library Project at the\n";
|
---|
| 87 | print HFILE " * University of Waikato, New Zealand.\n";
|
---|
| 88 | print HFILE " *\n";
|
---|
[1286] | 89 | print HFILE " * Copyright (C) 2000 The New Zealand Digital Library Project\n";
|
---|
[123] | 90 | print HFILE " *\n";
|
---|
[538] | 91 | print HFILE " * This program is free software; you can redistribute it and/or modify\n";
|
---|
| 92 | print HFILE " * it under the terms of the GNU General Public License as published by\n";
|
---|
| 93 | print HFILE " * the Free Software Foundation; either version 2 of the License, or\n";
|
---|
| 94 | print HFILE " * (at your option) any later version.\n";
|
---|
[123] | 95 | print HFILE " *\n";
|
---|
[538] | 96 | print HFILE " * This program is distributed in the hope that it will be useful,\n";
|
---|
| 97 | print HFILE " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n";
|
---|
| 98 | print HFILE " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n";
|
---|
| 99 | print HFILE " * GNU General Public License for more details.\n";
|
---|
[123] | 100 | print HFILE " *\n";
|
---|
[538] | 101 | print HFILE " * You should have received a copy of the GNU General Public License\n";
|
---|
| 102 | print HFILE " * along with this program; if not, write to the Free Software\n";
|
---|
| 103 | print HFILE " * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n";
|
---|
| 104 | print HFILE " *\n";
|
---|
[123] | 105 | print HFILE " *********************************************************************/\n";
|
---|
| 106 | print HFILE "\n";
|
---|
| 107 | print HFILE "\n";
|
---|
| 108 | print HFILE "\#ifndef ${upperfilename}_H\n";
|
---|
| 109 | print HFILE "\#define ${upperfilename}_H\n";
|
---|
| 110 | print HFILE "\n";
|
---|
| 111 | print HFILE "\n";
|
---|
| 112 | print HFILE "\n";
|
---|
| 113 | print HFILE "\n";
|
---|
| 114 | print HFILE "\#endif\n";
|
---|
| 115 |
|
---|
| 116 | close (HFILE);
|
---|
| 117 | }
|
---|
| 118 |
|
---|