3 # macros.pl produce macros.c from standard.mac
5 # The Netwide Assembler is copyright (C) 1996 Simon Tatham and
6 # Julian Hall. All rights reserved. The software is
7 # redistributable under the license given in the file "LICENSE"
8 # distributed in the NASM archive.
19 open(OUTPUT
,">macros.c") or die "unable to open macros.c\n";
22 print OUTPUT
" * Do not edit - this file auto-generated by macros.pl from:\n";
23 print OUTPUT
" * ", join(' ', @ARGV), "\n";
26 print OUTPUT
"#include \"tables.h\"\n";
28 print OUTPUT
"const char * const nasm_stdmac[] = {";
30 foreach $fname ( @ARGV ) {
31 open(INPUT
,$fname) or die "unable to open $fname\n";
32 print OUTPUT
"\n /* From $fname */\n";
36 if (m/^\s*\*END\*TASM\*MACROS\*\s*$/) {
38 print OUTPUT
" /* End of TASM macros */\n";
39 } elsif (m/^\s*((\s*([^\"\';\s]+|\"[^\"]*\"|\'[^\']*\'))*)\s*(;.*)?$/) {
44 print OUTPUT
" \"$_\",\n";
48 die "$fname:$line: error unterminated quote";
53 print OUTPUT
"\n NULL\n};\n\n";
54 $tasm_count = $index unless ( defined($tasm_count) );
55 print OUTPUT
"const char * const * nasm_stdmac_after_tasm = ",
56 "&nasm_stdmac[$tasm_count];\n";