mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
Make the macros table "unsigned char"
It gets less ugly if we make the macros table "unsigned char".
This commit is contained in:
parent
7b5aad8498
commit
7e50d232ba
14
macros.pl
14
macros.pl
@ -26,7 +26,7 @@ sub charcify(@) {
|
||||
foreach $o (unpack("C*", join('',@_))) {
|
||||
$c = pack("C", $o);
|
||||
if ($o < 32 || $o > 126 || $c eq '"' || $c eq "\\") {
|
||||
$l .= sprintf("(char)%3d,", $o);
|
||||
$l .= sprintf("%3d,", $o);
|
||||
} else {
|
||||
$l .= "\'".$c."\',";
|
||||
}
|
||||
@ -48,7 +48,7 @@ print OUT "#include \"tables.h\"\n";
|
||||
print OUT "#include \"nasmlib.h\"\n";
|
||||
print OUT "#include \"hashtbl.h\"\n";
|
||||
print OUT "\n";
|
||||
print OUT "const char nasm_stdmac[] = {";
|
||||
print OUT "const unsigned char nasm_stdmac[] = {";
|
||||
|
||||
my $npkg = 0;
|
||||
my @pkg_list = ();
|
||||
@ -73,7 +73,7 @@ foreach $fname ( @ARGV ) {
|
||||
printf OUT " /* %4d */ 0\n", $index++;
|
||||
print OUT "};\n";
|
||||
$index = 0;
|
||||
printf OUT "const char %s_stdmac[] = {\n", $out_alias[0];
|
||||
printf OUT "const unsigned char %s_stdmac[] = {\n", $out_alias[0];
|
||||
print OUT " /* From $fname */\n";
|
||||
$lastname = $fname;
|
||||
push(@out_list, $out_alias[0]);
|
||||
@ -86,7 +86,7 @@ foreach $fname ( @ARGV ) {
|
||||
printf OUT " /* %4d */ 0\n", $index++;
|
||||
print OUT "};\n";
|
||||
$index = 0;
|
||||
printf OUT "static const char nasm_stdmac_%s[] = {\n", $pkg;
|
||||
printf OUT "static const unsigned char nasm_stdmac_%s[] = {\n", $pkg;
|
||||
print OUT " /* From $fname */\n";
|
||||
$lastname = $fname;
|
||||
push(@pkg_list, $pkg);
|
||||
@ -127,7 +127,7 @@ foreach $fname ( @ARGV ) {
|
||||
close(INPUT);
|
||||
}
|
||||
printf OUT " /* %4d */ 0\n};\n\n", $index++;
|
||||
print OUT "const char * const nasm_stdmac_after_tasm = ",
|
||||
print OUT "const unsigned char * const nasm_stdmac_after_tasm = ",
|
||||
"&nasm_stdmac[$tasm_count];\n\n";
|
||||
|
||||
my @hashinfo = gen_perfect_hash(\%pkg_number);
|
||||
@ -139,11 +139,11 @@ verify_hash_table(\%pkg_number, \@hashinfo);
|
||||
my ($n, $sv, $g) = @hashinfo;
|
||||
die if ($n & ($n-1));
|
||||
|
||||
print OUT "const char *nasm_stdmac_find_package(const char *package)\n";
|
||||
print OUT "const unsigned char *nasm_stdmac_find_package(const char *package)\n";
|
||||
print OUT "{\n";
|
||||
print OUT " static const struct {\n";
|
||||
print OUT " const char *package;\n";
|
||||
print OUT " const char *macros;\n";
|
||||
print OUT " const unsigned char *macros;\n";
|
||||
print OUT " } packages[$npkg] = {\n";
|
||||
foreach $pkg (@pkg_list) {
|
||||
printf OUT " { \"%s\", nasm_stdmac_%s },\n",
|
||||
|
@ -642,7 +642,7 @@ static char *read_line(void)
|
||||
|
||||
if (stdmacpos) {
|
||||
unsigned char c;
|
||||
const char *p = stdmacpos;
|
||||
const unsigned char *p = stdmacpos;
|
||||
char *ret, *q;
|
||||
size_t len = 0;
|
||||
while ((c = *p++)) {
|
||||
@ -2153,7 +2153,7 @@ static int do_directive(Token * tline)
|
||||
|
||||
case PP_USE:
|
||||
{
|
||||
static const char *use_pkg;
|
||||
static const macros_t *use_pkg;
|
||||
const char *pkg_macro;
|
||||
|
||||
t = tline->next = expand_smacro(tline->next);
|
||||
@ -2175,7 +2175,7 @@ static int do_directive(Token * tline)
|
||||
if (!use_pkg)
|
||||
error(ERR_NONFATAL, "unknown `%%use' package: %s", t->text);
|
||||
/* The first string will be <%define>__USE_*__ */
|
||||
pkg_macro = use_pkg + 1;
|
||||
pkg_macro = (char *)use_pkg + 1;
|
||||
if (!smacro_defined(NULL, pkg_macro, 0, NULL, true)) {
|
||||
/* Not already included, go ahead and include it */
|
||||
stdmacpos = use_pkg;
|
||||
|
@ -15,7 +15,7 @@ extern const char * const pp_directives[];
|
||||
extern const uint8_t pp_directives_len[];
|
||||
|
||||
/* Pointer to a macro chain */
|
||||
typedef const char macros_t;
|
||||
typedef const unsigned char macros_t;
|
||||
|
||||
enum preproc_token pp_token_hash(const char *token);
|
||||
void pp_include_path(char *);
|
||||
|
6
tables.h
6
tables.h
@ -14,9 +14,9 @@
|
||||
/* --- From standard.mac via macros.pl: --- */
|
||||
|
||||
/* macros.c */
|
||||
extern const char nasm_stdmac[];
|
||||
extern const char * const nasm_stdmac_after_tasm;
|
||||
const char *nasm_stdmac_find_package(const char *);
|
||||
extern const unsigned char nasm_stdmac[];
|
||||
extern const unsigned char * const nasm_stdmac_after_tasm;
|
||||
const unsigned char *nasm_stdmac_find_package(const char *);
|
||||
|
||||
/* --- From insns.dat via insns.pl: --- */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user