lilypond-0.0.77.jcn1
[lilypond.git] / bin / genheader
blob911b038f6dd194098863db9507bb175a4c9e7f69
1 #!/usr/bin/perl -w
3 # generate the standard header of a LilyPond source file.
4 my $fn;
6 sub
7 do_init
9 $MAILADRESS=$ENV{MAILADRESS};
10 @pw=(getpwuid($<));
11 $username=$pw[6];
13 die "arg needed\n" if (!($#ARGV+1));
14 $fn = $ARGV[0];
16 $hh_b = ($fn =~ /hh$/ );
17 $inc_b= ($hh_b || $fn =~ /[ti]cc$/);
20 sub
21 do_head
24 my $what="implement ";
25 $what = "declare " if ($hh_b);
26 my ($PROJECT, $cwd);
27 $PROJECT = "the GNU LilyPond music typesetter";
28 chop($cwd = `pwd`);
30 $PROJECT= "the Flower Library" if ($cwd =~ /flower/);
32 my $headstr ="/*
33 $fn -- $what
35 source file of $PROJECT
37 (c) 1997 $username <$MAILADRESS>
38 */\n";
39 print $headstr;
41 sub do_inc
43 my $headstr="";
44 my $startdef= $fn;
45 $startdef =~ s/[\.-]/_/g;
46 $startdef =~ tr/a-z/A-Z/;
47 my $terminatestr="\n";
49 if ($inc_b) {
50 $headstr = "\n\n#ifndef $startdef\n#define $startdef\n";
51 $terminatestr .= "#endif // $startdef\n"
54 print $headstr, $terminatestr;
56 do_init;
57 do_head;
58 do_inc;