mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
44fd9dbb42
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@913 0fc631ac-6414-0410-93d0-97cfa31319b6
35 lines
601 B
Perl
35 lines
601 B
Perl
# Generate a header and source file
|
|
|
|
$file = $ARGV[0];
|
|
$macro = uc $file;
|
|
$macro =~ s@/@_@g;
|
|
|
|
# read templates
|
|
|
|
open F, "../src/code_template.hpp";
|
|
$hpp = join('',<F>);
|
|
close F;
|
|
|
|
open F, "../src/code_template.cpp";
|
|
$cpp = join('',<F>);
|
|
close F;
|
|
|
|
# insert stuff
|
|
|
|
$hpp =~ s/_\r?\n/_$macro\n/g;
|
|
|
|
$cpp =~ s@<util/prec.hpp>@$&\n#include <$file.hpp>@g;
|
|
|
|
# write files
|
|
|
|
if (-e "../src/$file.hpp" or -e "../src/$file.cpp") {
|
|
die "The output files already exist!";
|
|
}
|
|
|
|
open F, "> ../src/$file.hpp";
|
|
print F $hpp;
|
|
close F;
|
|
|
|
open F, "> ../src/$file.cpp";
|
|
print F $cpp;
|
|
close F; |