diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-06-19 16:26:12 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-06-19 16:26:12 -0700 |
commit | 926fc40b65119a58b25f90eb4edb5198d9707fa6 (patch) | |
tree | 6b339ff02aa7eeb9b4264102db7a2d74ee1a286e /macros.pl | |
parent | 435d55b34422c74af8050da4152fd9dd79bc5848 (diff) | |
download | nasm-926fc40b65119a58b25f90eb4edb5198d9707fa6.tar.gz nasm-926fc40b65119a58b25f90eb4edb5198d9707fa6.tar.bz2 nasm-926fc40b65119a58b25f90eb4edb5198d9707fa6.zip |
%use: call these directives "standard macro packages"
Adopt the term "standard macro packages", "modules" are too
ambiguous.
Diffstat (limited to 'macros.pl')
-rwxr-xr-x | macros.pl | 46 |
1 files changed, 23 insertions, 23 deletions
@@ -31,11 +31,11 @@ print OUT "#include \"hashtbl.h\"\n"; print OUT "\n"; print OUT "const char * const nasm_stdmac[] = {"; -my $nmodule = 0; -my @module_list = (); -my %module_number = (); -my %module_index = (); -my $module; +my $npkg = 0; +my @pkg_list = (); +my %pkg_number = (); +my %pkg_index = (); +my $pkg; foreach $fname ( @ARGV ) { open(INPUT,$fname) or die "unable to open $fname\n"; @@ -47,15 +47,15 @@ foreach $fname ( @ARGV ) { $tasm_count = $index; print OUT " /* End of TASM macros */\n"; } elsif (m/^USE:\s*(\S+)\s*$/) { - $module = $1; - if (defined($module_number{$module})) { - die "$0: $fname: duplicate module: $module\n"; + $pkg = $1; + if (defined($pkg_number{$pkg})) { + die "$0: $fname: duplicate package: $pkg\n"; } printf OUT " /* %4d */ NULL,\n", $index++; - print OUT " /* %use $module */\n"; - push(@module_list, $module); - $module_number{$module} = $nmodule++; - $module_index{$module} = $index; + print OUT " /* %use $pkg */\n"; + push(@pkg_list, $pkg); + $pkg_number{$pkg} = $npkg++; + $pkg_index{$pkg} = $index; } elsif (m/^\s*((\s*([^\"\';\s]+|\"[^\"]*\"|\'[^\']*\'))*)\s*(;.*)?$/) { my $s1, $s2, $pd, $ws; $s1 = $1; @@ -89,24 +89,24 @@ printf OUT " /* %4d */ NULL\n};\n\n", $index++; print OUT "const char * const * const nasm_stdmac_after_tasm = ", "&nasm_stdmac[$tasm_count];\n\n"; -my @hashinfo = gen_perfect_hash(\%module_number); +my @hashinfo = gen_perfect_hash(\%pkg_number); if (!@hashinfo) { die "$0: no hash found\n"; } # Paranoia... -verify_hash_table(\%module_number, \@hashinfo); +verify_hash_table(\%pkg_number, \@hashinfo); my ($n, $sv, $g) = @hashinfo; die if ($n & ($n-1)); -print OUT "const char * const *nasm_stdmac_find_module(const char *module)\n"; +print OUT "const char * const *nasm_stdmac_find_package(const char *package)\n"; print OUT "{\n"; print OUT " static const struct {\n"; -print OUT " const char *module;\n"; +print OUT " const char *package;\n"; print OUT " const char * const *macros;\n"; -print OUT " } modules[$nmodule] = {\n"; -foreach $module (@module_list) { +print OUT " } packages[$npkg] = {\n"; +foreach $pkg (@pkg_list) { printf OUT " { \"%s\", nasm_stdmac+%d },\n", - $module, $module_index{$module}; + $pkg, $pkg_index{$pkg}; } print OUT " };\n"; @@ -136,19 +136,19 @@ print OUT " uint64_t crc;\n"; print OUT " uint16_t ix;\n"; print OUT "\n"; -printf OUT " crc = crc64i(UINT64_C(0x%08x%08x), module);\n", +printf OUT " crc = crc64i(UINT64_C(0x%08x%08x), package);\n", $$sv[0], $$sv[1]; print OUT " k1 = (uint32_t)crc;\n"; print OUT " k2 = (uint32_t)(crc >> 32);\n"; print OUT "\n"; printf OUT " ix = hash1[k1 & 0x%x] + hash2[k2 & 0x%x];\n", $n-1, $n-1; -printf OUT " if (ix >= %d)\n", scalar(@module_list); +printf OUT " if (ix >= %d)\n", scalar(@pkg_list); print OUT " return NULL;\n"; print OUT "\n"; -print OUT " if (nasm_stricmp(modules[ix].module, module))\n"; +print OUT " if (nasm_stricmp(packages[ix].package, package))\n"; print OUT " return NULL;\n"; print OUT "\n"; -print OUT " return modules[ix].macros;\n"; +print OUT " return packages[ix].macros;\n"; print OUT "}\n"; close(OUT); |