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 licence given in the file "Licence"
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\n#include \"compiler.h\"\n\nstatic const char *stdmac[] = {\n";
24 foreach $fname ( @ARGV ) {
25 open(INPUT
,$fname) or die "unable to open $fname\n";
29 if (m/^\s*\*END\*TASM\*MACROS\*\s*$/) {
31 } elsif (m/^\s*((\s*([^\"\';\s]+|\"[^\"]*\"|\'[^\']*\'))*)\s*(;.*)?$/) {
36 print OUTPUT
" \"$_\",\n";
40 die "$fname:$line: error unterminated quote";
45 print OUTPUT
" NULL\n};\n";
46 $tasm_count = $index unless ( defined($tasm_count) );
47 print OUTPUT
"#define TASM_MACRO_COUNT $tasm_count\n";