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";
21 print OUTPUT
"/* This file auto-generated from standard.mac by macros.pl" .
22 " - don't edit it */\n";
24 print OUTPUT
"#include \"tables.h\"\n";
26 print OUTPUT
"const char * const nasm_stdmac[] = {\n";
28 foreach $fname ( @ARGV ) {
29 open(INPUT
,$fname) or die "unable to open $fname\n";
33 if (m/^\s*\*END\*TASM\*MACROS\*\s*$/) {
35 } elsif (m/^\s*((\s*([^\"\';\s]+|\"[^\"]*\"|\'[^\']*\'))*)\s*(;.*)?$/) {
40 print OUTPUT
" \"$_\",\n";
44 die "$fname:$line: error unterminated quote";
49 print OUTPUT
" NULL\n};\n\n";
50 $tasm_count = $index unless ( defined($tasm_count) );
51 print OUTPUT
"const char * const * nasm_stdmac_after_tasm = ",
52 "&nasm_stdmac[$tasm_count];\n";