mkflags.pl

musicmud-2.1.6/src/mkflags.pl · 543 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/flags. Don't edit, it'll go away.\n";
print "\#ifndef FLAGS_H\n\#define FLAGS_H\n\n";
print "enum Flag { FL_NONE = -1, FL_FIRST = 0,\n";
$temp = 0;
while (<STDIN>) {
  s/\n//;
  if (/-/) {
    print "/* ", $temp, " */ \n";
  } else {
    print " FL_", uc $_, " = ", $temp, ",\n";
  }
  $temp++;
}
print "};\n";
print "inline void operator++(Flag &p, int=0) { p = Flag(p + 1); }\n";
if ($temp>(32*16)) {
    print "#error too many flags to fit";
}
print "\nextern int FL_MAX;\n\n#endif\n";

Site Stats

Snippets: 1791
Codebases: 571