mkevents.pl

musicmud-2.1.6/src/mkevents.pl · 610 B

From the archive musicmud2.1.6.tar.gz

Download the archive   « Back to the archive contents

#!/usr/bin/perl
print "// This file made from ../data/events. Don't edit, it'll go away.\n";
print "\#ifndef EVENTS_H\n\#define EVENTS_H\n\n";
$temp = 1;
while (<STDIN>) {
  s/\n//;
  $extra = "";
  if (/-/) {
    print "/* ", $temp, " */ \n";
  } else {
      if (/\[before_\]/) { $_ =~ s/\[before_\]//g; $extra = "/* (before) */"; }
      if (/\[after_\]/) { $_ =~ s/\[after_\]//g; $extra = "/* (after) */"; }
      $fore = $_;
    if (!(/after_/) && !(/before_/)) {
      $_ = "on_" . $_;
    }
    s/_//g;
    print "#define E_", uc $_, " \"", $fore, "\" $extra\n";
  }
  $temp++;
}
print  "\n\n#endif\n";

Site Stats

Snippets: 1791
Codebases: 571