#!/usr/bin/env perl ##### # findsym.pl # Andy Hammerlindl 2010/06/01 # # Extract static symbols used in builtin.cc and write code so that they are # translated only once when creating the symbol table. ##### $outname = shift(@ARGV); if (not $outname) { print STDERR "usage ./findsym.pl out_symbols.h file1.cc file2.cc ...\n"; exit(1); } open(header, ">$outname") || die("Couldn't open $outname for writing"); print header <) { while (m/SYM\(([_A-Za-z][_A-Za-z0-9]*)\)/gx) { $symbols{ $1 } = 1; } } } foreach my $s (sort keys %symbols) { add($s); }