#!/usr/bin/env perl ##### # opsymbols.pl # Andy Hammerlindl 2010/06/01 # # Extract mapping such as '+' --> SYM_PLUS from camp.l ##### use strict; use warnings; use Getopt::Long; my $campfile; my $outfile; GetOptions( 'campfile=s' => \$campfile, 'output=s' => \$outfile ) || die("Argument errors"); open(my $header, ">$outfile") || die("Couldn't open opsymbols.h for writing"); print $header <) { if (m/^"(\S+)"\s*{\s*DEFSYMBOL\((\w+)\);/) { add($1, $2); } if (m/^(\w+)\s*{\s*DEFSYMBOL\((\w+)\);/) { add($1, $2); } if (m/^\s*EXTRASYMBOL\(\s*(\w+)\s*,\s*(\w+)\s*\)/) { add($1, $2); } } print $header <