diff options
-rw-r--r-- | assemble.c | 32 | ||||
-rw-r--r-- | disasm.c | 20 | ||||
-rw-r--r-- | disasm.h | 4 | ||||
-rw-r--r-- | float.c | 14 | ||||
-rw-r--r-- | float.h | 2 | ||||
-rw-r--r-- | insns.h | 2 | ||||
-rw-r--r-- | insns.pl | 7 | ||||
-rw-r--r-- | labels.c | 38 | ||||
-rw-r--r-- | labels.h | 16 | ||||
-rw-r--r-- | lcc/lin-aout.c | 18 | ||||
-rw-r--r-- | lcc/lin-elf.c | 18 | ||||
-rw-r--r-- | listing.c | 22 | ||||
-rw-r--r-- | macros.pl | 2 | ||||
-rw-r--r-- | names.c | 2 | ||||
-rw-r--r-- | nasm.c | 105 | ||||
-rw-r--r-- | nasm.h | 59 | ||||
-rw-r--r-- | nasmlib.c | 93 | ||||
-rw-r--r-- | nasmlib.h | 40 | ||||
-rw-r--r-- | ndisasm.c | 16 | ||||
-rw-r--r-- | outform.c | 4 | ||||
-rw-r--r-- | outform.h | 4 | ||||
-rw-r--r-- | output/outaout.c | 20 | ||||
-rw-r--r-- | output/outas86.c | 26 | ||||
-rw-r--r-- | output/outbin.c | 50 | ||||
-rw-r--r-- | output/outcoff.c | 50 | ||||
-rw-r--r-- | output/outdbg.c | 30 | ||||
-rw-r--r-- | output/outelf.c | 72 | ||||
-rw-r--r-- | output/outieee.c | 58 | ||||
-rw-r--r-- | output/outmacho.c | 58 | ||||
-rw-r--r-- | output/outobj.c | 68 | ||||
-rw-r--r-- | output/outrdf.c | 40 | ||||
-rw-r--r-- | output/outrdf2.c | 36 | ||||
-rw-r--r-- | parser.c | 8 | ||||
-rw-r--r-- | parser.h | 2 | ||||
-rw-r--r-- | preproc.c | 138 | ||||
-rw-r--r-- | preproc.h | 14 | ||||
-rw-r--r-- | rdoff/ldrdf.c | 40 | ||||
-rw-r--r-- | rdoff/ldsegs.h | 2 | ||||
-rw-r--r-- | rdoff/rdf2bin.c | 8 | ||||
-rw-r--r-- | rdoff/rdf2ihx.c | 2 | ||||
-rw-r--r-- | rdoff/rdfdump.c | 4 | ||||
-rw-r--r-- | rdoff/rdflib.c | 16 | ||||
-rw-r--r-- | rdoff/rdfload.c | 6 | ||||
-rw-r--r-- | rdoff/rdfload.h | 2 | ||||
-rw-r--r-- | rdoff/rdlar.c | 28 | ||||
-rw-r--r-- | rdoff/rdlib.c | 20 | ||||
-rw-r--r-- | rdoff/rdlib.h | 8 | ||||
-rw-r--r-- | rdoff/rdoff.c | 16 | ||||
-rw-r--r-- | rdoff/rdoff.h | 24 | ||||
-rw-r--r-- | rdoff/symtab.c | 4 | ||||
-rw-r--r-- | rdoff/symtab.h | 4 | ||||
-rwxr-xr-x | regs.pl | 2 |
52 files changed, 688 insertions, 686 deletions
@@ -99,8 +99,8 @@ static efunc errfunc; static struct ofmt *outfmt; static ListGen *list; -static int32_t calcsize(int32_t, int32_t, int, insn *, const int8_t *); -static void gencode(int32_t, int32_t, int, insn *, const int8_t *, int32_t); +static int32_t calcsize(int32_t, int32_t, int, insn *, const char *); +static void gencode(int32_t, int32_t, int, insn *, const char *, int32_t); static int regval(operand * o); static int regflag(operand * o); static int matches(struct itemplate *, insn *, int bits); @@ -116,7 +116,7 @@ static void out(int32_t offset, int32_t segto, const void *data, uint32_t type, int32_t segment, int32_t wrt) { static int32_t lineno = 0; /* static!!! */ - static int8_t *lnfname = NULL; + static char *lnfname = NULL; if ((type & OUT_TYPMASK) == OUT_ADDRESS) { if (segment != NO_SEG || wrt != NO_SEG) { @@ -168,7 +168,7 @@ static void out(int32_t offset, int32_t segto, const void *data, } static int jmp_match(int32_t segment, int32_t offset, int bits, - insn * ins, const int8_t *code) + insn * ins, const char *code) { int32_t isize; uint8_t c = code[0]; @@ -285,11 +285,11 @@ int32_t assemble(int32_t segment, int32_t offset, int bits, uint32_t cp, } if (instruction->opcode == I_INCBIN) { - static int8_t fname[FILENAME_MAX]; + static char fname[FILENAME_MAX]; FILE *fp; int32_t len; - int8_t *prefix = "", *combine; - int8_t **pPrevPath = NULL; + char *prefix = "", *combine; + char **pPrevPath = NULL; len = FILENAME_MAX - 1; if (len > instruction->eops->stringlen) @@ -321,7 +321,7 @@ int32_t assemble(int32_t segment, int32_t offset, int bits, uint32_t cp, error(ERR_NONFATAL, "`incbin': unable to seek on file `%s'", fname); else { - static int8_t buf[2048]; + static char buf[2048]; int32_t t = instruction->times; int32_t base = 0; @@ -390,7 +390,7 @@ int32_t assemble(int32_t segment, int32_t offset, int bits, uint32_t cp, m += jmp_match(segment, offset, bits, instruction, temp->code); if (m == 100) { /* matches! */ - const int8_t *codes = temp->code; + const char *codes = temp->code; int32_t insn_size = calcsize(segment, offset, bits, instruction, codes); itimes = instruction->times; @@ -558,11 +558,11 @@ int32_t insn_size(int32_t segment, int32_t offset, int bits, uint32_t cp, } if (instruction->opcode == I_INCBIN) { - int8_t fname[FILENAME_MAX]; + char fname[FILENAME_MAX]; FILE *fp; int32_t len; - int8_t *prefix = "", *combine; - int8_t **pPrevPath = NULL; + char *prefix = "", *combine; + char **pPrevPath = NULL; len = FILENAME_MAX - 1; if (len > instruction->eops->stringlen) @@ -616,7 +616,7 @@ int32_t insn_size(int32_t segment, int32_t offset, int bits, uint32_t cp, if (m == 100) { /* we've matched an instruction. */ int32_t isize; - const int8_t *codes = temp->code; + const char *codes = temp->code; int j; isize = calcsize(segment, offset, bits, instruction, codes); @@ -658,7 +658,7 @@ static int is_sbyte(insn * ins, int op, int size) } static int32_t calcsize(int32_t segment, int32_t offset, int bits, - insn * ins, const int8_t *codes) + insn * ins, const char *codes) { int32_t length = 0; uint8_t c; @@ -895,9 +895,9 @@ static int32_t calcsize(int32_t segment, int32_t offset, int bits, return length; } static void gencode(int32_t segment, int32_t offset, int bits, - insn * ins, const int8_t *codes, int32_t insn_end) + insn * ins, const char *codes, int32_t insn_end) { - static int8_t condval[] = { /* conditional opcodes */ + static char condval[] = { /* conditional opcodes */ 0x7, 0x3, 0x2, 0x6, 0x2, 0x4, 0xF, 0xD, 0xC, 0xE, 0x6, 0x2, 0x3, 0x7, 0x3, 0x5, 0xE, 0xC, 0xD, 0xF, 0x1, 0xB, 0x9, 0x5, 0x0, 0xA, 0xA, 0xB, 0x8, 0x4 @@ -96,7 +96,7 @@ static int whichreg(int32_t regflags, int regval) return 0; } -static const int8_t *whichcond(int condval) +static const char *whichcond(int condval) { static int conds[] = { C_O, C_NO, C_C, C_NC, C_Z, C_NZ, C_NA, C_A, @@ -175,7 +175,7 @@ static uint8_t *do_ea(uint8_t *data, int modrm, int asize, break; case 1: op->segment |= SEG_DISP8; - op->offset = (int8_t)*data++; + op->offset = (char)*data++; break; case 2: op->segment |= SEG_DISP16; @@ -294,7 +294,7 @@ static uint8_t *do_ea(uint8_t *data, int modrm, int asize, break; case 1: op->segment |= SEG_DISP8; - op->offset = (int8_t)*data++; + op->offset = (char)*data++; break; case 2: op->segment |= SEG_DISP32; @@ -402,7 +402,7 @@ static int matches(struct itemplate *t, uint8_t *data, int asize, if (*data++) return FALSE; if (c >= 014 && c <= 016) { - ins->oprs[c - 014].offset = (int8_t)*data++; + ins->oprs[c - 014].offset = (char)*data++; ins->oprs[c - 014].segment |= SEG_SIGNED; } if (c >= 020 && c <= 022) @@ -440,7 +440,7 @@ static int matches(struct itemplate *t, uint8_t *data, int asize, ins->oprs[c - 044].addr_size = asize; } if (c >= 050 && c <= 052) { - ins->oprs[c - 050].offset = (int8_t)*data++; + ins->oprs[c - 050].offset = (char)*data++; ins->oprs[c - 050].segment |= SEG_RELATIVE; } if (c >= 060 && c <= 062) { @@ -575,12 +575,12 @@ static int matches(struct itemplate *t, uint8_t *data, int asize, return data - origdata; } -int32_t disasm(uint8_t *data, int8_t *output, int outbufsize, int segsize, +int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, int32_t offset, int autosync, uint32_t prefer) { struct itemplate **p, **best_p; int length, best_length = 0; - int8_t *segover; + char *segover; int rep, lock, asize, osize, i, slen, colon; uint8_t *origdata; int works; @@ -855,7 +855,7 @@ int32_t disasm(uint8_t *data, int8_t *output, int outbufsize, int segsize, if (ins.oprs[i].segment & SEG_DISP8) { int sign = '+'; if (ins.oprs[i].offset & 0x80) { - ins.oprs[i].offset = -(int8_t)ins.oprs[i].offset; + ins.oprs[i].offset = -(char)ins.oprs[i].offset; sign = '-'; } slen += @@ -883,7 +883,7 @@ int32_t disasm(uint8_t *data, int8_t *output, int outbufsize, int segsize, } output[slen] = '\0'; if (segover) { /* unused segment override */ - int8_t *p = output; + char *p = output; int count = slen + 1; while (count--) p[count + 3] = p[count]; @@ -893,7 +893,7 @@ int32_t disasm(uint8_t *data, int8_t *output, int outbufsize, int segsize, return length; } -int32_t eatbyte(uint8_t *data, int8_t *output, int outbufsize) +int32_t eatbyte(uint8_t *data, char *output, int outbufsize) { snprintf(output, outbufsize, "db 0x%02X", *data); return 1; @@ -11,8 +11,8 @@ #define INSN_MAX 32 /* one instruction can't be longer than this */ -int32_t disasm(uint8_t *data, int8_t *output, int outbufsize, int segsize, +int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, int32_t offset, int autosync, uint32_t prefer); -int32_t eatbyte(uint8_t *data, int8_t *output, int outbufsize); +int32_t eatbyte(uint8_t *data, char *output, int outbufsize); #endif @@ -57,11 +57,11 @@ static int ieee_multiply(uint16_t *to, uint16_t *from) } } -static void ieee_flconvert(int8_t *string, uint16_t *mant, +static void ieee_flconvert(char *string, uint16_t *mant, int32_t *exponent, efunc error) { - int8_t digits[MANT_DIGITS]; - int8_t *p, *q, *r; + char digits[MANT_DIGITS]; + char *p, *q, *r; uint16_t mult[MANT_WORDS], bit; uint16_t *m; int32_t tenpwr, twopwr; @@ -213,7 +213,7 @@ static int ieee_round(uint16_t *mant, int i) #define put(a,b) ( (*(a)=(b)), ((a)[1]=(b)>>8) ) -static int to_double(int8_t *str, int32_t sign, uint8_t *result, +static int to_double(char *str, int32_t sign, uint8_t *result, efunc error) { uint16_t mant[MANT_WORDS]; @@ -275,7 +275,7 @@ static int to_double(int8_t *str, int32_t sign, uint8_t *result, return 1; /* success */ } -static int to_float(int8_t *str, int32_t sign, uint8_t *result, +static int to_float(char *str, int32_t sign, uint8_t *result, efunc error) { uint16_t mant[MANT_WORDS]; @@ -330,7 +330,7 @@ static int to_float(int8_t *str, int32_t sign, uint8_t *result, return 1; } -static int to_ldoub(int8_t *str, int32_t sign, uint8_t *result, +static int to_ldoub(char *str, int32_t sign, uint8_t *result, efunc error) { uint16_t mant[MANT_WORDS]; @@ -391,7 +391,7 @@ static int to_ldoub(int8_t *str, int32_t sign, uint8_t *result, return 1; } -int float_const(int8_t *number, int32_t sign, uint8_t *result, int bytes, +int float_const(char *number, int32_t sign, uint8_t *result, int bytes, efunc error) { if (bytes == 4) @@ -10,7 +10,7 @@ #ifndef NASM_FLOAT_H #define NASM_FLOAT_H -int float_const(int8_t *number, int32_t sign, uint8_t *result, int bytes, +int float_const(char *number, int32_t sign, uint8_t *result, int bytes, efunc error); #endif @@ -23,7 +23,7 @@ struct itemplate { int opcode; /* the token, passed from "parser.c" */ int operands; /* number of operands */ int32_t opd[3]; /* bit flags for operand types */ - const int8_t *code; /* the code it assembles to */ + const char *code; /* the code it assembles to */ uint32_t flags; /* some flags */ }; @@ -69,7 +69,6 @@ if ( !defined($output) || $output eq 'a' ) { print A "/* This file auto-generated from insns.dat by insns.pl" . " - don't edit it */\n\n"; - print A "#include \<inttypes.h\>\n\n"; print A "#include \"nasm.h\"\n"; print A "#include \"insns.h\"\n"; print A "\n"; @@ -98,7 +97,6 @@ if ( !defined($output) || $output eq 'd' ) { print D "/* This file auto-generated from insns.dat by insns.pl" . " - don't edit it */\n\n"; - print D "#include \<inttypes.h\>\n\n"; print D "#include \"nasm.h\"\n"; print D "#include \"insns.h\"\n"; print D "\n"; @@ -163,9 +161,8 @@ if ( !defined($output) || $output eq 'n' ) { print N "/* This file is auto-generated from insns.dat by insns.pl" . " - don't edit it */\n\n"; print N "/* This file in included by names.c */\n\n"; - print N "#include \<inttypes.h\>\n\n"; - print N "static const int8_t *insn_names[] = {"; + print N "static const char *insn_names[] = {"; $first = 1; foreach $i (@opcodes) { print N "," if ( !$first ); @@ -176,7 +173,7 @@ if ( !defined($output) || $output eq 'n' ) { } print N "\n};\n\n"; print N "/* Conditional instructions */\n"; - print N "static const int8_t *icn[] = {"; + print N "static const char *icn[] = {"; $first = 1; foreach $i (@opcodes_cc) { print N "," if ( !$first ); @@ -58,7 +58,7 @@ union label { /* actual label structures */ struct { int32_t segment, offset; - int8_t *label, *special; + char *label, *special; int is_global, is_norm; } defn; struct { @@ -70,7 +70,7 @@ union label { /* actual label structures */ struct permts { /* permanent text storage */ struct permts *next; /* for the linked list */ int size, usage; /* size and used space in ... */ - int8_t data[PERMTS_SIZE]; /* ... the data block itself */ + char data[PERMTS_SIZE]; /* ... the data block itself */ }; extern int global_offset_changed; /* defined in nasm.c */ @@ -81,24 +81,24 @@ static struct permts *perm_head; /* start of perm. text storage */ static struct permts *perm_tail; /* end of perm. text storage */ static void init_block(union label *blk); -static int8_t *perm_copy(int8_t *string1, int8_t *string2); +static char *perm_copy(char *string1, char *string2); -static int8_t *prevlabel; +static char *prevlabel; static int initialized = FALSE; -int8_t lprefix[PREFIX_MAX] = { 0 }; -int8_t lpostfix[PREFIX_MAX] = { 0 }; +char lprefix[PREFIX_MAX] = { 0 }; +char lpostfix[PREFIX_MAX] = { 0 }; /* * Internal routine: finds the `union label' corresponding to the * given label name. Creates a new one, if it isn't found, and if * `create' is TRUE. */ -static union label *find_label(int8_t *label, int create) +static union label *find_label(char *label, int create) { int hash = 0; - int8_t *p, *prev; + char *p, *prev; int prevlen; union label *lptr; @@ -146,7 +146,7 @@ static union label *find_label(int8_t *label, int create) return NULL; } -int lookup_label(int8_t *label, int32_t *segment, int32_t *offset) +int lookup_label(char *label, int32_t *segment, int32_t *offset) { union label *lptr; @@ -162,7 +162,7 @@ int lookup_label(int8_t *label, int32_t *segment, int32_t *offset) return 0; } -int is_extern(int8_t *label) +int is_extern(char *label) { union label *lptr; @@ -176,7 +176,7 @@ int is_extern(int8_t *label) return 0; } -void redefine_label(int8_t *label, int32_t segment, int32_t offset, int8_t *special, +void redefine_label(char *label, int32_t segment, int32_t offset, char *special, int is_norm, int isextrn, struct ofmt *ofmt, efunc error) { @@ -217,12 +217,12 @@ void redefine_label(int8_t *label, int32_t segment, int32_t offset, int8_t *spec if (pass0 == 1) { exi = !!(lptr->defn.is_global & GLOBAL_BIT); if (exi) { - int8_t *xsymbol; + char *xsymbol; int slen; slen = strlen(lprefix); slen += strlen(lptr->defn.label); slen += strlen(lpostfix); - slen++; /* room for that null int8_t */ + slen++; /* room for that null char */ xsymbol = nasm_malloc(slen); snprintf(xsymbol, slen, "%s%s%s", lprefix, lptr->defn.label, lpostfix); @@ -249,7 +249,7 @@ void redefine_label(int8_t *label, int32_t segment, int32_t offset, int8_t *spec /* if (pass0 == 1) */ } -void define_label(int8_t *label, int32_t segment, int32_t offset, int8_t *special, +void define_label(char *label, int32_t segment, int32_t offset, char *special, int is_norm, int isextrn, struct ofmt *ofmt, efunc error) { union label *lptr; @@ -285,7 +285,7 @@ void define_label(int8_t *label, int32_t segment, int32_t offset, int8_t *specia if (pass0 == 1 || (!is_norm && !isextrn && (segment & 1))) { exi = !!(lptr->defn.is_global & GLOBAL_BIT); if (exi) { - int8_t *xsymbol; + char *xsymbol; int slen; slen = strlen(lprefix); slen += strlen(lptr->defn.label); @@ -316,7 +316,7 @@ void define_label(int8_t *label, int32_t segment, int32_t offset, int8_t *specia } /* if (pass0 == 1) */ } -void define_common(int8_t *label, int32_t segment, int32_t size, int8_t *special, +void define_common(char *label, int32_t segment, int32_t size, char *special, struct ofmt *ofmt, efunc error) { union label *lptr; @@ -344,7 +344,7 @@ void define_common(int8_t *label, int32_t segment, int32_t size, int8_t *special special); } -void declare_as_global(int8_t *label, int8_t *special, efunc error) +void declare_as_global(char *label, char *special, efunc error) { union label *lptr; @@ -436,9 +436,9 @@ static void init_block(union label *blk) blk[LABEL_BLOCK - 1].admin.next = NULL; } -static int8_t *perm_copy(int8_t *string1, int8_t *string2) +static char *perm_copy(char *string1, char *string2) { - int8_t *p, *q; + char *p, *q; int len = strlen(string1) + strlen(string2) + 1; if (perm_tail->size - perm_tail->usage < len) { @@ -6,19 +6,19 @@ * distributed in the NASM archive. */ -extern int8_t lprefix[PREFIX_MAX]; -extern int8_t lpostfix[PREFIX_MAX]; +extern char lprefix[PREFIX_MAX]; +extern char lpostfix[PREFIX_MAX]; -int lookup_label(int8_t *label, int32_t *segment, int32_t *offset); -int is_extern(int8_t *label); -void define_label(int8_t *label, int32_t segment, int32_t offset, int8_t *special, +int lookup_label(char *label, int32_t *segment, int32_t *offset); +int is_extern(char *label); +void define_label(char *label, int32_t segment, int32_t offset, char *special, int is_norm, int isextrn, struct ofmt *ofmt, efunc error); -void redefine_label(int8_t *label, int32_t segment, int32_t offset, int8_t *special, +void redefine_label(char *label, int32_t segment, int32_t offset, char *special, int is_norm, int isextrn, struct ofmt *ofmt, efunc error); -void define_common(int8_t *label, int32_t segment, int32_t size, int8_t *special, +void define_common(char *label, int32_t segment, int32_t size, char *special, struct ofmt *ofmt, efunc error); -void declare_as_global(int8_t *label, int8_t *special, efunc error); +void declare_as_global(char *label, char *special, efunc error); int init_labels(void); void cleanup_labels(void); diff --git a/lcc/lin-aout.c b/lcc/lin-aout.c index 9685e57..e4ac48f 100644 --- a/lcc/lin-aout.c +++ b/lcc/lin-aout.c @@ -8,31 +8,31 @@ #define NASMPATH "/usr/local/bin/nasm" -int8_t *cpp[] = { LCCDIR "cpp", "-D__STDC__=1", +char *cpp[] = { LCCDIR "cpp", "-D__STDC__=1", "-Di386", "-D__i386", "-D__i386__", "-Dlinux", "-D__linux", "-D__linux__", "-Dunix", "-D__unix", "-D__unix__", "$1", "$2", "$3", 0 }; -int8_t *include[] = { "-I" LCCDIR "include", "-I/usr/local/include", +char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include", "-I/usr/include", 0 }; -int8_t *com[] = { LCCDIR "rcc", "-target=x86/nasm", +char *com[] = { LCCDIR "rcc", "-target=x86/nasm", "$1", "$2", "$3", 0 }; -int8_t *as[] = { NASMPATH, "-a", "-faout", "-o", "$3", "$1", "$2", 0 }; -int8_t *ld[] = { "/usr/bin/ld", "-m", "i386linux", +char *as[] = { NASMPATH, "-a", "-faout", "-o", "$3", "$1", "$2", 0 }; +char *ld[] = { "/usr/bin/ld", "-m", "i386linux", "-L/usr/i486-linuxaout/lib", "-o", "$3", "$1", "/usr/i486-linuxaout/lib/crt0.o", "$2", "", "-lc", 0 }; -static int8_t *bbexit = LCCDIR "bbexit.o"; +static char *bbexit = LCCDIR "bbexit.o"; -extern int8_t *concat(int8_t *, int8_t *); -extern int access(const int8_t *, int); +extern char *concat(char *, char *); +extern int access(const char *, int); -int option(int8_t *arg) +int option(char *arg) { if (strncmp(arg, "-lccdir=", 8) == 0) { cpp[0] = concat(&arg[8], "/cpp"); diff --git a/lcc/lin-elf.c b/lcc/lin-elf.c index 2f15de3..693309f 100644 --- a/lcc/lin-elf.c +++ b/lcc/lin-elf.c @@ -8,19 +8,19 @@ #define NASMPATH "/usr/local/bin/nasm" -int8_t *cpp[] = { LCCDIR "cpp", "-D__STDC__=1", +char *cpp[] = { LCCDIR "cpp", "-D__STDC__=1", "-D__ELF__", "-Di386", "-D__i386", "-D__i386__", "-Dlinux", "-D__linux", "-D__linux__", "$1", "$2", "$3", 0 }; -int8_t *include[] = { "-I" LCCDIR "include", "-I/usr/local/include", +char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include", "-I/usr/include", 0 }; -int8_t *com[] = { LCCDIR "rcc", "-target=x86/nasm", +char *com[] = { LCCDIR "rcc", "-target=x86/nasm", "$1", "$2", "$3", 0 }; -int8_t *as[] = { NASMPATH, "-a", "-felf", "-o", "$3", "$1", "$2", 0 }; -int8_t *ld[] = { "/usr/bin/ld", "-m", "elf_i386", +char *as[] = { NASMPATH, "-a", "-felf", "-o", "$3", "$1", "$2", 0 }; +char *ld[] = { "/usr/bin/ld", "-m", "elf_i386", "-dynamic-linker", "/lib/ld-linux.so.1", "-L/usr/i486-linux/lib", "-o", "$3", "$1", @@ -28,12 +28,12 @@ int8_t *ld[] = { "/usr/bin/ld", "-m", "elf_i386", "$2", "", "-lc", "", "/usr/lib/crtend.o", "/usr/lib/crtn.o", 0 }; -static int8_t *bbexit = LCCDIR "bbexit.o"; +static char *bbexit = LCCDIR "bbexit.o"; -extern int8_t *concat(int8_t *, int8_t *); -extern int access(const int8_t *, int); +extern char *concat(char *, char *); +extern int access(const char *, int); -int option(int8_t *arg) +int option(char *arg) { if (strncmp(arg, "-lccdir=", 8) == 0) { cpp[0] = concat(&arg[8], "/cpp"); @@ -31,14 +31,14 @@ static struct MacroInhibit { int inhibiting; } *mistack; -static int8_t xdigit[] = "0123456789ABCDEF"; +static char xdigit[] = "0123456789ABCDEF"; #define HEX(a,b) (*(a)=xdigit[((b)>>4)&15],(a)[1]=xdigit[(b)&15]); -static int8_t listline[LIST_MAX_LEN]; +static char listline[LIST_MAX_LEN]; static int listlinep; -static int8_t listdata[2 * LIST_INDENT]; /* we need less than that actually */ +static char listdata[2 * LIST_INDENT]; /* we need less than that actually */ static int32_t listoffset; static int32_t listlineno; @@ -78,7 +78,7 @@ static void list_emit(void) listdata[0] = '\0'; } -static void list_init(int8_t *fname, efunc error) +static void list_init(char *fname, efunc error) { listfp = fopen(fname, "w"); if (!listfp) { @@ -112,7 +112,7 @@ static void list_cleanup(void) fclose(listfp); } -static void list_out(int32_t offset, int8_t *str) +static void list_out(int32_t offset, char *str) { if (strlen(listdata) + strlen(str) > LIST_HEXBIT) { strcat(listdata, "-"); @@ -136,7 +136,7 @@ static void list_output(int32_t offset, const void *data, uint32_t type) if (typ == OUT_RAWDATA) { uint8_t const *p = data; - int8_t q[3]; + char q[3]; while (size--) { HEX(q, *p); q[2] = '\0'; @@ -145,7 +145,7 @@ static void list_output(int32_t offset, const void *data, uint32_t type) } } else if (typ == OUT_ADDRESS) { uint64_t d = *(int64_t *)data; - int8_t q[20]; + char q[20]; uint8_t p[8], *r = p; if (size == 4) { q[0] = '['; @@ -182,7 +182,7 @@ static void list_output(int32_t offset, const void *data, uint32_t type) } } else if (typ == OUT_REL2ADR) { uint32_t d = *(int32_t *)data; - int8_t q[11]; + char q[11]; uint8_t p[4], *r = p; q[0] = '('; q[5] = ')'; @@ -193,7 +193,7 @@ static void list_output(int32_t offset, const void *data, uint32_t type) list_out(offset, q); } else if (typ == OUT_REL4ADR) { uint32_t d = *(int32_t *)data; - int8_t q[11]; + char q[11]; uint8_t p[4], *r = p; q[0] = '('; q[9] = ')'; @@ -205,13 +205,13 @@ static void list_output(int32_t offset, const void *data, uint32_t type) HEX(q + 7, p[3]); list_out(offset, q); } else if (typ == OUT_RESERVE) { - int8_t q[20]; + char q[20]; snprintf(q, sizeof(q), "<res %08lX>", size); list_out(offset, q); } } -static void list_line(int type, int8_t *line) +static void list_line(int type, char *line) { if (!listp) return; @@ -19,7 +19,7 @@ undef $tasm_count; open(OUTPUT,">macros.c") or die "unable to open macros.c\n"; print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" . -" - don't edit it */\n\n#include <stddef.h>\n#include <inttypes.h>\n\nstatic const int8_t *stdmac[] = {\n"; +" - don't edit it */\n\n#include <stddef.h>\n\nstatic const char *stdmac[] = {\n"; foreach $fname ( @ARGV ) { open(INPUT,$fname) or die "unable to open $fname\n"; @@ -7,7 +7,7 @@ * distributed in the NASM archive. */ -static const int8_t *conditions[] = { /* condition code names */ +static const char *conditions[] = { /* condition code names */ "a", "ae", "b", "be", "c", "e", "g", "ge", "l", "le", "na", "nae", "nb", "nbe", "nc", "ne", "ng", "nge", "nl", "nle", "no", "np", "ns", "nz", "o", "p", "pe", "po", "s", "z" @@ -29,15 +29,15 @@ struct forwrefinfo { /* info held on forward refs. */ int operand; }; -static int get_bits(int8_t *value); -static uint32_t get_cpu(int8_t *cpu_str); -static void parse_cmdline(int, int8_t **); -static void assemble_file(int8_t *); -static int getkw(int8_t **directive, int8_t **value); +static int get_bits(char *value); +static uint32_t get_cpu(char *cpu_str); +static void parse_cmdline(int, char **); +static void assemble_file(char *); +static int getkw(char **directive, char **value); static void register_output_formats(void); -static void report_error_gnu(int severity, const int8_t *fmt, ...); -static void report_error_vc(int severity, const int8_t *fmt, ...); -static void report_error_common(int severity, const int8_t *fmt, +static void report_error_gnu(int severity, const char *fmt, ...); +static void report_error_vc(int severity, const char *fmt, ...); +static void report_error_common(int severity, const char *fmt, va_list args); static int is_suppressed_warning(int severity); static void usage(void); @@ -48,9 +48,9 @@ int tasm_compatible_mode = FALSE; int pass0; int maxbits = 0; -static int8_t inname[FILENAME_MAX]; -static int8_t outname[FILENAME_MAX]; -static int8_t listname[FILENAME_MAX]; +static char inname[FILENAME_MAX]; +static char outname[FILENAME_MAX]; +static char listname[FILENAME_MAX]; static int globallineno; /* for forward-reference tracking */ /* static int pass = 0; */ static struct ofmt *ofmt = NULL; @@ -86,7 +86,7 @@ static enum op_type operating_mode; * Which of the suppressible warnings are suppressed. Entry zero * doesn't do anything. Initial defaults are given here. */ -static int8_t suppressed[1 + ERR_WARN_MAX] = { +static char suppressed[1 + ERR_WARN_MAX] = { 0, TRUE, TRUE, TRUE, FALSE, TRUE }; @@ -94,7 +94,7 @@ static int8_t suppressed[1 + ERR_WARN_MAX] = { * The option names for the suppressible warnings. As before, entry * zero does nothing. */ -static const int8_t *suppressed_names[1 + ERR_WARN_MAX] = { +static const char *suppressed_names[1 + ERR_WARN_MAX] = { NULL, "macro-params", "macro-selfref", "orphan-labels", "number-overflow", "gnu-elf-extensions" @@ -104,7 +104,7 @@ static const int8_t *suppressed_names[1 + ERR_WARN_MAX] = { * The explanations for the suppressible warnings. As before, entry * zero does nothing. */ -static const int8_t *suppressed_what[1 + ERR_WARN_MAX] = { +static const char *suppressed_what[1 + ERR_WARN_MAX] = { NULL, "macro calls with wrong no. of params", "cyclic macro self-references", @@ -119,8 +119,8 @@ static const int8_t *suppressed_what[1 + ERR_WARN_MAX] = { * not preprocess their source file. */ -static void no_pp_reset(int8_t *, int, efunc, evalfunc, ListGen *); -static int8_t *no_pp_getline(void); +static void no_pp_reset(char *, int, efunc, evalfunc, ListGen *); +static char *no_pp_getline(void); static void no_pp_cleanup(int); static Preproc no_pp = { no_pp_reset, @@ -140,7 +140,7 @@ static int want_usage; static int terminate_after_phase; int user_nolist = 0; /* fbk 9/2/00 */ -static void nasm_fputs(const int8_t *line, FILE * outfile) +static void nasm_fputs(const char *line, FILE * outfile) { if (outfile) { fputs(line, outfile); @@ -187,7 +187,7 @@ int main(int argc, char **argv) /* define some macros dependent of command-line */ { - int8_t temp[64]; + char temp[64]; snprintf(temp, sizeof(temp), "__OUTPUT_FORMAT__=%s\n", ofmt->shortname); pp_pre_define(temp); @@ -196,7 +196,7 @@ int main(int argc, char **argv) switch (operating_mode) { case op_depend: { - int8_t *line; + char *line; preproc->reset(inname, 0, report_error, evaluate, &nasmlist); if (outname[0] == '\0') ofmt->filename(inname, outname, report_error); @@ -211,8 +211,8 @@ int main(int argc, char **argv) case op_preprocess: { - int8_t *line; - int8_t *file_name = NULL; + char *line; + char *file_name = NULL; int32_t prior_linnum = 0; int lineinc = 0; @@ -322,7 +322,7 @@ int main(int argc, char **argv) * Get a parameter for a command line option. * First arg must be in the form of e.g. -f... */ -static int8_t *get_param(int8_t *p, int8_t *q, int *advance) +static char *get_param(char *p, char *q, int *advance) { *advance = 0; if (p[2]) { /* the parameter's in the option */ @@ -341,7 +341,7 @@ static int8_t *get_param(int8_t *p, int8_t *q, int *advance) } struct textargs { - const int8_t *label; + const char *label; int value; }; @@ -354,9 +354,9 @@ struct textargs textopts[] = { }; int stopoptions = 0; -static int process_arg(int8_t *p, int8_t *q) +static int process_arg(char *p, char *q) { - int8_t *param; + char *param; int i, advance = 0; if (!p || !p[0]) @@ -515,7 +515,7 @@ static int process_arg(int8_t *p, int8_t *q) case 'r': case 'v': { - const int8_t *nasm_version_string = + const char *nasm_version_string = "NASM version " NASM_VER " compiled on " __DATE__ #ifdef DEBUG " with -DDEBUG" @@ -622,7 +622,7 @@ static int process_arg(int8_t *p, int8_t *q) static void process_respfile(FILE * rfile) { - int8_t *buffer, *p, *q, *prevarg; + char *buffer, *p, *q, *prevarg; int bufsize, prevargsize; bufsize = prevargsize = ARG_BUF_DELTA; @@ -685,10 +685,10 @@ static void process_respfile(FILE * rfile) * argv array. Used by the environment variable and response file * processing. */ -static void process_args(int8_t *args) +static void process_args(char *args) { - int8_t *p, *q, *arg, *prevarg; - int8_t separator = ' '; + char *p, *q, *arg, *prevarg; + char separator = ' '; p = args; if (*p && *p != '-') @@ -709,10 +709,10 @@ static void process_args(int8_t *args) process_arg(arg, NULL); } -static void parse_cmdline(int argc, int8_t **argv) +static void parse_cmdline(int argc, char **argv) { FILE *rfile; - int8_t *envreal, *envcopy = NULL, *p, *arg; + char *envreal, *envcopy = NULL, *p, *arg; *inname = *outname = *listname = '\0'; @@ -740,7 +740,7 @@ static void parse_cmdline(int argc, int8_t **argv) * different to the -@resp file processing below for regular * NASM. */ - int8_t *str = malloc(2048); + char *str = malloc(2048); FILE *f = fopen(&argv[0][1], "r"); if (!str) { printf("out of memory"); @@ -757,8 +757,10 @@ static void parse_cmdline(int argc, int8_t **argv) argv++; } if (!stopoptions && argv[0][0] == '-' && argv[0][1] == '@') { - if ((p = get_param(argv[0], argc > 1 ? argv[1] : NULL, &i))) { - if ((rfile = fopen(p, "r"))) { + p = get_param(argv[0], argc > 1 ? argv[1] : NULL, &i); + if (p) { + rfile = fopen(p, "r"); + if (rfile) { process_respfile(rfile); fclose(rfile); } else @@ -775,9 +777,9 @@ static void parse_cmdline(int argc, int8_t **argv) "no input file specified"); } -static void assemble_file(int8_t *fname) +static void assemble_file(char *fname) { - int8_t *directive, *value, *p, *q, *special, *line, debugid[80]; + char *directive, *value, *p, *q, *special, *line, debugid[80]; insn output_ins; int i, rn_error, validid; int32_t seg, offs; @@ -830,7 +832,8 @@ static void assemble_file(int8_t *fname) /* here we parse our directives; this is not handled by the 'real' * parser. */ directive = line; - if ((i = getkw(&directive, &value))) { + i = getkw(&directive, &value); + if (i) { switch (i) { case 1: /* [SEGMENT n] */ seg = ofmt->section(value, pass2, &sb); @@ -1336,9 +1339,9 @@ static void assemble_file(int8_t *fname) #endif } /* exit from assemble_file (...) */ -static int getkw(int8_t **directive, int8_t **value) +static int getkw(char **directive, char **value) { - int8_t *p, *q, *buf; + char *p, *q, *buf; buf = *directive; @@ -1422,7 +1425,7 @@ static int getkw(int8_t **directive, int8_t **value) * @param severity the severity of the warning or error * @param fmt the printf style format string */ -static void report_error_gnu(int severity, const int8_t *fmt, ...) +static void report_error_gnu(int severity, const char *fmt, ...) { va_list ap; @@ -1432,7 +1435,7 @@ static void report_error_gnu(int severity, const int8_t *fmt, ...) if (severity & ERR_NOFILE) fputs("nasm: ", error_file); else { - int8_t *currentfile = NULL; + char *currentfile = NULL; int32_t lineno = 0; src_get(&lineno, ¤tfile); fprintf(error_file, "%s:%ld: ", currentfile, lineno); @@ -1458,7 +1461,7 @@ static void report_error_gnu(int severity, const int8_t *fmt, ...) * @param severity the severity of the warning or error * @param fmt the printf style format string */ -static void report_error_vc(int severity, const int8_t *fmt, ...) +static void report_error_vc(int severity, const char *fmt, ...) { va_list ap; @@ -1468,7 +1471,7 @@ static void report_error_vc(int severity, const int8_t *fmt, ...) if (severity & ERR_NOFILE) fputs("nasm: ", error_file); else { - int8_t *currentfile = NULL; + char *currentfile = NULL; int32_t lineno = 0; src_get(&lineno, ¤tfile); fprintf(error_file, "%s(%ld) : ", currentfile, lineno); @@ -1511,7 +1514,7 @@ static int is_suppressed_warning(int severity) * @param severity the severity of the warning or error * @param fmt the printf style format string */ -static void report_error_common(int severity, const int8_t *fmt, +static void report_error_common(int severity, const char *fmt, va_list args) { switch (severity & ERR_MASK) { @@ -1581,7 +1584,7 @@ static efunc no_pp_err; static ListGen *no_pp_list; static int32_t no_pp_lineinc; -static void no_pp_reset(int8_t *file, int pass, efunc error, evalfunc eval, +static void no_pp_reset(char *file, int pass, efunc error, evalfunc eval, ListGen * listgen) { src_set_fname(nasm_strdup(file)); @@ -1597,9 +1600,9 @@ static void no_pp_reset(int8_t *file, int pass, efunc error, evalfunc eval, (void)eval; /* placate compilers */ } -static int8_t *no_pp_getline(void) +static char *no_pp_getline(void) { - int8_t *buffer, *p, *q; + char *buffer, *p, *q; int bufsize; bufsize = BUF_DELTA; @@ -1639,7 +1642,7 @@ static int8_t *no_pp_getline(void) if (!strncmp(buffer, "%line", 5)) { int32_t ln; int li; - int8_t *nm = nasm_malloc(strlen(buffer)); + char *nm = nasm_malloc(strlen(buffer)); if (sscanf(buffer + 5, "%ld+%d %s", &ln, &li, nm) == 3) { nasm_free(src_set_fname(nm)); src_set_linnum(ln); @@ -1661,7 +1664,7 @@ static void no_pp_cleanup(int pass) fclose(no_pp_fp); } -static uint32_t get_cpu(int8_t *value) +static uint32_t get_cpu(char *value) { if (!strcmp(value, "8086")) @@ -1702,7 +1705,7 @@ static uint32_t get_cpu(int8_t *value) return IF_PLEVEL; /* the maximum level */ } -static int get_bits(int8_t *value) +static int get_bits(char *value) { int i; @@ -12,6 +12,7 @@ #define NASM_NASM_H #include <stdio.h> +#include <inttypes.h> #include "version.h" /* generated NASM version macros */ #ifndef NULL @@ -66,7 +67,7 @@ struct ofmt; /* * An error reporting function should look like this. */ -typedef void (*efunc) (int severity, const int8_t *fmt, ...); +typedef void (*efunc) (int severity, const char *fmt, ...); /* * These are the error severity codes which get passed as the first @@ -108,7 +109,7 @@ typedef void (*efunc) (int severity, const int8_t *fmt, ...); /* * A label-lookup function should look like this. */ -typedef int (*lfunc) (int8_t *label, int32_t *segment, int32_t *offset); +typedef int (*lfunc) (char *label, int32_t *segment, int32_t *offset); /* * And a label-definition function like this. The boolean parameter @@ -116,8 +117,8 @@ typedef int (*lfunc) (int8_t *label, int32_t *segment, int32_t *offset); * should affect the local-label system), or something odder like * an EQU or a segment-base symbol, which shouldn't. */ -typedef void (*ldfunc) (int8_t *label, int32_t segment, int32_t offset, - int8_t *special, int is_norm, int isextrn, +typedef void (*ldfunc) (char *label, int32_t segment, int32_t offset, + char *special, int is_norm, int isextrn, struct ofmt * ofmt, efunc error); /* @@ -127,10 +128,10 @@ typedef struct { /* * Called to initialize the listing file generator. Before this * is called, the other routines will silently do nothing when - * called. The `int8_t *' parameter is the file name to write the + * called. The `char *' parameter is the file name to write the * listing to. */ - void (*init) (int8_t *, efunc); + void (*init) (char *, efunc); /* * Called to clear stuff up and close the listing file. @@ -156,7 +157,7 @@ typedef struct { * whether the line came directly from an input file or is the * result of a multi-line macro expansion. */ - void (*line) (int, int8_t *); + void (*line) (int, char *); /* * Called to change one of the various levelled mechanisms in @@ -191,7 +192,7 @@ typedef struct { struct tokenval { int t_type; int64_t t_integer, t_inttwo; - int8_t *t_charptr; + char *t_charptr; }; typedef int (*scanner) (void *private_data, struct tokenval * tv); @@ -300,14 +301,14 @@ typedef struct { * of the pass, an error reporting function, an evaluator * function, and a listing generator to talk to. */ - void (*reset) (int8_t *, int, efunc, evalfunc, ListGen *); + void (*reset) (char *, int, efunc, evalfunc, ListGen *); /* * Called to fetch a line of preprocessed source. The line * returned has been malloc'ed, and so should be freed after * use. */ - int8_t *(*getline) (void); + char *(*getline) (void); /* * Called at the end of a pass. @@ -493,7 +494,7 @@ typedef struct { /* operand to an instruction */ typedef struct extop { /* extended operand */ struct extop *next; /* linked list */ int32_t type; /* defined above */ - int8_t *stringval; /* if it's a string, then here it is */ + char *stringval; /* if it's a string, then here it is */ int stringlen; /* ... and here's how long it is */ int32_t segment; /* if it's a number/address, then... */ int64_t offset; /* ... it's given here ... */ @@ -503,7 +504,7 @@ typedef struct extop { /* extended operand */ #define MAXPREFIX 4 typedef struct { /* an instruction itself */ - int8_t *label; /* the label defined, or NULL */ + char *label; /* the label defined, or NULL */ int prefixes[MAXPREFIX]; /* instruction prefixes, if any */ int nprefix; /* number of entries in above */ int opcode; /* the opcode - not just the string */ @@ -531,12 +532,12 @@ struct ofmt { * This is a short (one-liner) description of the type of * output generated by the driver. */ - const int8_t *fullname; + const char *fullname; /* * This is a single keyword used to select the driver. */ - const int8_t *shortname; + const char *shortname; /* @@ -544,7 +545,7 @@ struct ofmt { * It is set to NULL in all the out modules and is not implemented * in the main program */ - const int8_t *helpstring; + const char *helpstring; /* * this is a pointer to the first element of the debug information @@ -561,13 +562,13 @@ struct ofmt { struct dfmt *current_dfmt; /* - * This, if non-NULL, is a NULL-terminated list of `int8_t *'s + * This, if non-NULL, is a NULL-terminated list of `char *'s * pointing to extra standard macros supplied by the object * format (e.g. a sensible initial default value of __SECT__, * and user-level equivalents for any format-specific * directives). */ - const int8_t **stdmac; + const char **stdmac; /* * This procedure is called at the start of an output session. @@ -585,7 +586,7 @@ struct ofmt { * and the second parameter gives the value. This function returns * 1 if recognized, 0 if unrecognized */ - int (*setinfo) (enum geninfo type, int8_t **string); + int (*setinfo) (enum geninfo type, char **string); /* * This procedure is called by assemble() to write actual @@ -627,8 +628,8 @@ struct ofmt { * been an EXTERN, a COMMON or a GLOBAL. The distinction should * be obvious to the output format from the other parameters. */ - void (*symdef) (int8_t *name, int32_t segment, int32_t offset, int is_global, - int8_t *special); + void (*symdef) (char *name, int32_t segment, int32_t offset, int is_global, + char *special); /* * This procedure is called when the source code requests a @@ -645,7 +646,7 @@ struct ofmt { * the segment, by setting `*bits' to 16 or 32. Or, if it * doesn't wish to define a default, it can leave `bits' alone. */ - int32_t (*section) (int8_t *name, int pass, int *bits); + int32_t (*section) (char *name, int pass, int *bits); /* * This procedure is called to modify the segment base values @@ -676,7 +677,7 @@ struct ofmt { * should also return non-zero if it correctly processes the * directive. */ - int (*directive) (int8_t *directive, int8_t *value, int pass); + int (*directive) (char *directive, char *value, int pass); /* * This procedure is called before anything else - even before @@ -695,7 +696,7 @@ struct ofmt { * The parameter `outname' points to an area of storage * guaranteed to be at least FILENAME_MAX in size. */ - void (*filename) (int8_t *inname, int8_t *outname, efunc error); + void (*filename) (char *inname, char *outname, efunc error); /* * This procedure is called after assembly finishes, to allow @@ -748,12 +749,12 @@ struct dfmt { * This is a short (one-liner) description of the type of * output generated by the driver. */ - const int8_t *fullname; + const char *fullname; /* * This is a single keyword used to select the driver. */ - const int8_t *shortname; + const char *shortname; /* * init - called initially to set up local pointer to object format, @@ -766,7 +767,7 @@ struct dfmt { * linenum - called any time there is output with a change of * line number or file. */ - void (*linenum) (const int8_t *filename, int32_t linenumber, int32_t segto); + void (*linenum) (const char *filename, int32_t linenumber, int32_t segto); /* * debug_deflabel - called whenever a label is defined. Parameters @@ -774,8 +775,8 @@ struct dfmt { * would be called before the output format version. */ - void (*debug_deflabel) (int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special); + void (*debug_deflabel) (char *name, int32_t segment, int32_t offset, + int is_global, char *special); /* * debug_directive - called whenever a DEBUG directive other than 'LINE' * is encountered. 'directive' contains the first parameter to the @@ -784,7 +785,7 @@ struct dfmt { * function with 'directive' equal to "VAR" and 'params' equal to * "_somevar:int". */ - void (*debug_directive) (const int8_t *directive, const int8_t *params); + void (*debug_directive) (const char *directive, const char *params); /* * typevalue - called whenever the assembler wishes to register a type @@ -35,7 +35,7 @@ void nasm_set_malloc_error(efunc error) } #ifdef LOGALLOC -void *nasm_malloc_log(int8_t *file, int line, size_t size) +void *nasm_malloc_log(char *file, int line, size_t size) #else void *nasm_malloc(size_t size) #endif @@ -52,7 +52,7 @@ void *nasm_malloc(size_t size) } #ifdef LOGALLOC -void *nasm_realloc_log(int8_t *file, int line, void *q, size_t size) +void *nasm_realloc_log(char *file, int line, void *q, size_t size) #else void *nasm_realloc(void *q, size_t size) #endif @@ -72,7 +72,7 @@ void *nasm_realloc(void *q, size_t size) } #ifdef LOGALLOC -void nasm_free_log(int8_t *file, int line, void *q) +void nasm_free_log(char *file, int line, void *q) #else void nasm_free(void *q) #endif @@ -86,12 +86,12 @@ void nasm_free(void *q) } #ifdef LOGALLOC -int8_t *nasm_strdup_log(int8_t *file, int line, const int8_t *s) +char *nasm_strdup_log(char *file, int line, const char *s) #else -int8_t *nasm_strdup(const int8_t *s) +char *nasm_strdup(const char *s) #endif { - int8_t *p; + char *p; int size = strlen(s) + 1; p = malloc(size); @@ -107,12 +107,12 @@ int8_t *nasm_strdup(const int8_t *s) } #ifdef LOGALLOC -int8_t *nasm_strndup_log(int8_t *file, int line, int8_t *s, size_t len) +char *nasm_strndup_log(char *file, int line, char *s, size_t len) #else -int8_t *nasm_strndup(int8_t *s, size_t len) +char *nasm_strndup(char *s, size_t len) #endif { - int8_t *p; + char *p; int size = len + 1; p = malloc(size); @@ -129,7 +129,7 @@ int8_t *nasm_strndup(int8_t *s, size_t len) } #if !defined(stricmp) && !defined(strcasecmp) -int nasm_stricmp(const int8_t *s1, const int8_t *s2) +int nasm_stricmp(const char *s1, const char *s2) { while (*s1 && tolower(*s1) == tolower(*s2)) s1++, s2++; @@ -143,7 +143,7 @@ int nasm_stricmp(const int8_t *s1, const int8_t *s2) #endif #if !defined(strnicmp) && !defined(strncasecmp) -int nasm_strnicmp(const int8_t *s1, const int8_t *s2, int n) +int nasm_strnicmp(const char *s1, const char *s2, int n) { while (n > 0 && *s1 && tolower(*s1) == tolower(*s2)) s1++, s2++, n--; @@ -159,9 +159,9 @@ int nasm_strnicmp(const int8_t *s1, const int8_t *s2, int n) #define lib_isnumchar(c) ( isalnum(c) || (c) == '$') #define numvalue(c) ((c)>='a' ? (c)-'a'+10 : (c)>='A' ? (c)-'A'+10 : (c)-'0') -int64_t readnum(int8_t *str, int *error) +int64_t readnum(char *str, int *error) { - int8_t *r = str, *q; + char *r = str, *q; int32_t radix; uint64_t result, checklimit; int digit, last; @@ -256,7 +256,7 @@ int64_t readnum(int8_t *str, int *error) return result * sign; } -int64_t readstrnum(int8_t *str, int length, int *warn) +int64_t readstrnum(char *str, int length, int *warn) { int64_t charconst = 0; int i; @@ -306,10 +306,10 @@ void fwriteint32_t(int32_t data, FILE * fp) fputc((int)((data >> 24) & 255), fp); } -void standard_extension(int8_t *inname, int8_t *outname, int8_t *extension, +void standard_extension(char *inname, char *outname, char *extension, efunc error) { - int8_t *p, *q; + char *p, *q; if (*outname) /* file name already exists, */ return; /* so do nothing */ @@ -490,7 +490,7 @@ void *saa_wstruct(struct SAA *s) void saa_wbytes(struct SAA *s, const void *data, int32_t len) { - const int8_t *d = data; + const char *d = data; while (len > 0) { int32_t l = s->end->length - s->end->posn; @@ -558,7 +558,7 @@ void *saa_rbytes(struct SAA *s, int32_t *len) void saa_rnbytes(struct SAA *s, void *data, int32_t len) { - int8_t *d = data; + char *d = data; while (len > 0) { int32_t l; @@ -586,7 +586,7 @@ void saa_fread(struct SAA *s, int32_t posn, void *data, int32_t len) { struct SAA *p; int64_t pos; - int8_t *cdata = data; + char *cdata = data; if (!s->rptr || posn < s->rptr->start) saa_rewind(s); @@ -617,7 +617,7 @@ void saa_fwrite(struct SAA *s, int32_t posn, void *data, int32_t len) { struct SAA *p; int64_t pos; - int8_t *cdata = data; + char *cdata = data; if (!s->rptr || posn < s->rptr->start) saa_rewind(s); @@ -646,11 +646,12 @@ void saa_fwrite(struct SAA *s, int32_t posn, void *data, int32_t len) void saa_fpwrite(struct SAA *s, FILE * fp) { - int8_t *data; + char *data; int32_t len; saa_rewind(s); - while ((data = saa_rbytes(s, &len))) +// while ((data = saa_rbytes(s, &len))) + for (; (data = saa_rbytes(s, &len));) fwrite(data, 1, len, fp); } @@ -659,11 +660,11 @@ void saa_fpwrite(struct SAA *s, FILE * fp) * by the scanner. */ #include "names.c" -static const int8_t *special_names[] = { +static const char *special_names[] = { "byte", "dword", "far", "long", "near", "nosplit", "qword", "short", "strict", "to", "tword", "word" }; -static const int8_t *prefix_names[] = { +static const char *prefix_names[] = { "a16", "a32", "lock", "o16", "o32", "rep", "repe", "repne", "repnz", "repz", "times" }; @@ -673,7 +674,7 @@ static const int8_t *prefix_names[] = { * formats. It keeps a succession of temporary-storage strings in * stdscan_tempstorage, which can be cleared using stdscan_reset. */ -static int8_t **stdscan_tempstorage = NULL; +static char **stdscan_tempstorage = NULL; static int stdscan_tempsize = 0, stdscan_templen = 0; #define STDSCAN_TEMP_DELTA 256 @@ -698,9 +699,9 @@ void nasmlib_cleanup(void) nasm_free(stdscan_tempstorage); } -static int8_t *stdscan_copy(int8_t *p, int len) +static char *stdscan_copy(char *p, int len) { - int8_t *text; + char *text; text = nasm_malloc(len + 1); strncpy(text, p, len); @@ -710,17 +711,17 @@ static int8_t *stdscan_copy(int8_t *p, int len) stdscan_tempsize += STDSCAN_TEMP_DELTA; stdscan_tempstorage = nasm_realloc(stdscan_tempstorage, stdscan_tempsize * - sizeof(int8_t *)); + sizeof(char *)); } stdscan_tempstorage[stdscan_templen++] = text; return text; } -int8_t *stdscan_bufptr = NULL; +char *stdscan_bufptr = NULL; int stdscan(void *private_data, struct tokenval *tv) { - int8_t ourcopy[MAX_KEYWORD + 1], *r, *s; + char ourcopy[MAX_KEYWORD + 1], *r, *s; (void)private_data; /* Don't warn that this parameter is unused */ @@ -768,7 +769,7 @@ int stdscan(void *private_data, struct tokenval *tv) } for (i = 0; i < elements(icn); i++) if (!strncmp(ourcopy, icn[i], strlen(icn[i]))) { - int8_t *p = ourcopy + strlen(icn[i]); + char *p = ourcopy + strlen(icn[i]); tv->t_integer = ico[i]; if ((tv->t_inttwo = bsi(p, conditions, elements(conditions))) >= 0) @@ -829,7 +830,7 @@ int stdscan(void *private_data, struct tokenval *tv) tv->t_charptr = NULL; return tv->t_type = TOKEN_NUM; } else if (*stdscan_bufptr == '\'' || *stdscan_bufptr == '"') { /* a char constant */ - int8_t quote = *stdscan_bufptr++, *r; + char quote = *stdscan_bufptr++, *r; int rn_warn; r = tv->t_charptr = stdscan_bufptr; while (*stdscan_bufptr && *stdscan_bufptr != quote) @@ -1032,7 +1033,7 @@ int32_t reloc_wrt(expr * vect) /* * Binary search. */ -int bsi(int8_t *string, const int8_t **array, int size) +int bsi(char *string, const char **array, int size) { int i = -1, j = size; /* always, i < index < j */ while (j - i >= 2) { @@ -1048,12 +1049,12 @@ int bsi(int8_t *string, const int8_t **array, int size) return -1; /* we haven't got it :( */ } -static int8_t *file_name = NULL; +static char *file_name = NULL; static int32_t line_number = 0; -int8_t *src_set_fname(int8_t *newname) +char *src_set_fname(char *newname) { - int8_t *oldname = file_name; + char *oldname = file_name; file_name = newname; return oldname; } @@ -1070,7 +1071,7 @@ int32_t src_get_linnum(void) return line_number; } -int src_get(int32_t *xline, int8_t **xname) +int src_get(int32_t *xline, char **xname) { if (!file_name || !*xname || strcmp(*xname, file_name)) { nasm_free(*xname); @@ -1086,11 +1087,11 @@ int src_get(int32_t *xline, int8_t **xname) return 0; } -void nasm_quote(int8_t **str) +void nasm_quote(char **str) { int ln = strlen(*str); - int8_t q = (*str)[0]; - int8_t *p; + char q = (*str)[0]; + char *p; if (ln > 1 && (*str)[ln - 1] == q && (q == '"' || q == '\'')) return; q = '"'; @@ -1104,9 +1105,9 @@ void nasm_quote(int8_t **str) *str = p; } -int8_t *nasm_strcat(int8_t *one, int8_t *two) +char *nasm_strcat(char *one, char *two) { - int8_t *rslt; + char *rslt; int l1 = strlen(one); rslt = nasm_malloc(l1 + strlen(two) + 1); strcpy(rslt, one); @@ -1117,14 +1118,14 @@ int8_t *nasm_strcat(int8_t *one, int8_t *two) void null_debug_init(struct ofmt *of, void *id, FILE * fp, efunc error) { } -void null_debug_linenum(const int8_t *filename, int32_t linenumber, int32_t segto) +void null_debug_linenum(const char *filename, int32_t linenumber, int32_t segto) { } -void null_debug_deflabel(int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special) +void null_debug_deflabel(char *name, int32_t segment, int32_t offset, + int is_global, char *special) { } -void null_debug_routine(const int8_t *directive, const int8_t *params) +void null_debug_routine(const char *directive, const char *params) { } void null_debug_typevalue(int32_t type) @@ -31,14 +31,14 @@ void nasm_set_malloc_error(efunc); void *nasm_malloc(size_t); void *nasm_realloc(void *, size_t); void nasm_free(void *); -int8_t *nasm_strdup(const int8_t *); -int8_t *nasm_strndup(int8_t *, size_t); +char *nasm_strdup(const char *); +char *nasm_strndup(char *, size_t); #else -void *nasm_malloc_log(int8_t *, int, size_t); -void *nasm_realloc_log(int8_t *, int, void *, size_t); -void nasm_free_log(int8_t *, int, void *); -int8_t *nasm_strdup_log(int8_t *, int, const int8_t *); -int8_t *nasm_strndup_log(int8_t *, int, int8_t *, size_t); +void *nasm_malloc_log(char *, int, size_t); +void *nasm_realloc_log(char *, int, void *, size_t); +void nasm_free_log(char *, int, void *); +char *nasm_strdup_log(char *, int, const char *); +char *nasm_strndup_log(char *, int, char *, size_t); #define nasm_malloc(x) nasm_malloc_log(__FILE__,__LINE__,x) #define nasm_realloc(x,y) nasm_realloc_log(__FILE__,__LINE__,x,y) #define nasm_free(x) nasm_free_log(__FILE__,__LINE__,x) @@ -58,7 +58,7 @@ int8_t *nasm_strndup_log(int8_t *, int, int8_t *, size_t); #define nasm_stricmp strcasecmp #endif #else -int nasm_stricmp(const int8_t *, const int8_t *); +int nasm_stricmp(const char *, const char *); #endif #if defined(strnicmp) || defined(strncasecmp) @@ -68,14 +68,14 @@ int nasm_stricmp(const int8_t *, const int8_t *); #define nasm_strnicmp strncasecmp #endif #else -int nasm_strnicmp(const int8_t *, const int8_t *, int); +int nasm_strnicmp(const char *, const char *, int); #endif /* * Convert a string into a number, using NASM number rules. Sets * `*error' to TRUE if an error occurs, and FALSE otherwise. */ -int64_t readnum(int8_t *str, int *error); +int64_t readnum(char *str, int *error); /* * Convert a character constant into a number. Sets @@ -83,7 +83,7 @@ int64_t readnum(int8_t *str, int *error); * str points to and length covers the middle of the string, * without the quotes. */ -int64_t readstrnum(int8_t *str, int length, int *warn); +int64_t readstrnum(char *str, int length, int *warn); /* * seg_init: Initialise the segment-number allocator. @@ -97,7 +97,7 @@ int32_t seg_alloc(void); * function to add an extension to the name of the input file */ #ifdef NASM_NASM_H -void standard_extension(int8_t *inname, int8_t *outname, int8_t *extension, +void standard_extension(char *inname, char *outname, char *extension, efunc error); #endif @@ -207,7 +207,7 @@ struct SAA { */ struct SAA *next, *end, *rptr; int32_t elem_len, length, posn, start, rpos; - int8_t *data; + char *data; }; struct SAA *saa_init(int32_t elem_len); /* 1 == byte */ @@ -226,7 +226,7 @@ void saa_fpwrite(struct SAA *, FILE *); /* * Standard scanner. */ -extern int8_t *stdscan_bufptr; +extern char *stdscan_bufptr; void stdscan_reset(void); int stdscan(void *private_data, struct tokenval *tv); #endif @@ -250,9 +250,9 @@ int32_t reloc_wrt(expr *); * matching `string', or <0 if no match. `array' is taken to * contain `size' elements. */ -int bsi(int8_t *string, const int8_t **array, int size); +int bsi(char *string, const char **array, int size); -int8_t *src_set_fname(int8_t *newname); +char *src_set_fname(char *newname); int32_t src_set_linnum(int32_t newline); int32_t src_get_linnum(void); /* @@ -261,13 +261,13 @@ int32_t src_get_linnum(void); * It return 0 if the information was the same as the last time you * checked, -1 if the name changed and (new-old) if just the line changed. */ -int src_get(int32_t *xline, int8_t **xname); +int src_get(int32_t *xline, char **xname); -void nasm_quote(int8_t **str); -int8_t *nasm_strcat(int8_t *one, int8_t *two); +void nasm_quote(char **str); +char *nasm_strcat(char *one, char *two); void nasmlib_cleanup(void); -void null_debug_routine(const int8_t *directive, const int8_t *params); +void null_debug_routine(const char *directive, const char *params); extern struct dfmt null_debug_form; extern struct dfmt *null_debug_arr[2]; @@ -21,7 +21,7 @@ #define BPL 8 /* bytes per line of hex dump */ -static const int8_t *help = +static const char *help = "usage: ndisasm [-a] [-i] [-h] [-r] [-u] [-b bits] [-o origin] [-s sync...]\n" " [-e bytes] [-k start,bytes] [-p vendor] file\n" " -a or -i activates auto (intelligent) sync\n" @@ -33,15 +33,15 @@ static const int8_t *help = " -k avoids disassembling <bytes> bytes from position <start>\n" " -p selects the preferred vendor instruction set (intel, amd, cyrix, idt)\n"; -static void output_ins(uint32_t, uint8_t *, int, int8_t *); +static void output_ins(uint32_t, uint8_t *, int, char *); static void skip(uint32_t dist, FILE * fp); int main(int argc, char **argv) { uint8_t buffer[INSN_MAX * 2], *p, *q; - int8_t outbuf[256]; - int8_t *pname = *argv; - int8_t *filename = NULL; + char outbuf[256]; + char *pname = *argv; + char *filename = NULL; uint32_t nextsync, synclen, initskip = 0L; int lenread; int32_t lendis; @@ -57,7 +57,7 @@ int main(int argc, char **argv) init_sync(); while (--argc) { - int8_t *v, *vv, *p = *++argv; + char *v, *vv, *p = *++argv; if (*p == '-' && p[1]) { p++; while (*p) @@ -290,7 +290,7 @@ int main(int argc, char **argv) } static void output_ins(uint32_t offset, uint8_t *data, - int datalen, int8_t *insn) + int datalen, char *insn) { int bytes; fprintf(stdout, "%08lX ", offset); @@ -322,7 +322,7 @@ static void output_ins(uint32_t offset, uint8_t *data, */ static void skip(uint32_t dist, FILE * fp) { - int8_t buffer[256]; /* should fit on most stacks :-) */ + char buffer[256]; /* should fit on most stacks :-) */ /* * Got to be careful with fseek: at least one fseek I've tried @@ -18,7 +18,7 @@ static int ndrivers = 0; -struct ofmt *ofmt_find(int8_t *name) +struct ofmt *ofmt_find(char *name) { /* find driver */ int i; @@ -28,7 +28,7 @@ struct ofmt *ofmt_find(int8_t *name) return NULL; } -struct dfmt *dfmt_find(struct ofmt *ofmt, int8_t *name) +struct dfmt *dfmt_find(struct ofmt *ofmt, char *name) { /* find driver */ struct dfmt **dfmt = ofmt->debug_formats; while (*dfmt) { @@ -262,8 +262,8 @@ struct ofmt *drivers[] = { #endif /* BUILD_DRIVERS_ARRAY */ -struct ofmt *ofmt_find(int8_t *); -struct dfmt *dfmt_find(struct ofmt *, int8_t *); +struct ofmt *ofmt_find(char *); +struct dfmt *dfmt_find(struct ofmt *, char *); void ofmt_list(struct ofmt *, FILE *); void dfmt_list(struct ofmt *ofmt, FILE * fp); struct ofmt *ofmt_register(efunc error); diff --git a/output/outaout.c b/output/outaout.c index e250767..b6164f5 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -43,7 +43,7 @@ struct Symbol { int32_t segment; /* back-reference used by gsym_reloc */ struct Symbol *next; /* list of globals in each section */ struct Symbol *nextfwd; /* list of unresolved-size symbols */ - int8_t *name; /* for unresolved-size symbols */ + char *name; /* for unresolved-size symbols */ int32_t symnum; /* index into symbol table */ }; @@ -218,7 +218,7 @@ static void aout_cleanup(int debuginfo) saa_free(strs); } -static int32_t aout_section_names(int8_t *name, int pass, int *bits) +static int32_t aout_section_names(char *name, int pass, int *bits) { /* * Default to 32 bits. @@ -239,8 +239,8 @@ static int32_t aout_section_names(int8_t *name, int pass, int *bits) return NO_SEG; } -static void aout_deflabel(int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special) +static void aout_deflabel(char *name, int32_t segment, int32_t offset, + int is_global, char *special) { int pos = strslen + 4; struct Symbol *sym; @@ -269,7 +269,7 @@ static void aout_deflabel(int8_t *name, int32_t segment, int32_t offset, if (!strcmp((*s)->name, name)) { struct tokenval tokval; expr *e; - int8_t *p = special; + char *p = special; while (*p && !isspace(*p)) p++; @@ -356,7 +356,7 @@ static void aout_deflabel(int8_t *name, int32_t segment, int32_t offset, struct tokenval tokval; expr *e; int fwd = FALSE; - int8_t *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */ + char *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */ if (!bsd) { error(ERR_NONFATAL, "Linux a.out does not support" @@ -886,24 +886,24 @@ static int32_t aout_segbase(int32_t segment) return segment; } -static int aout_directive(int8_t *directive, int8_t *value, int pass) +static int aout_directive(char *directive, char *value, int pass) { return 0; } -static void aout_filename(int8_t *inname, int8_t *outname, efunc error) +static void aout_filename(char *inname, char *outname, efunc error) { standard_extension(inname, outname, ".o", error); } -static const int8_t *aout_stdmac[] = { +static const char *aout_stdmac[] = { "%define __SECT__ [section .text]", "%macro __NASM_CDecl__ 1", "%endmacro", NULL }; -static int aout_set_info(enum geninfo type, int8_t **val) +static int aout_set_info(enum geninfo type, char **val) { return 0; } diff --git a/output/outas86.c b/output/outas86.c index b75fd5f..c2c5e92 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -57,7 +57,7 @@ struct Section { struct Piece *head, *last, **tail; }; -static int8_t as86_module[FILENAME_MAX]; +static char as86_module[FILENAME_MAX]; static struct Section stext, sdata; static uint32_t bsslen; @@ -78,7 +78,7 @@ static efunc error; static void as86_write(void); static void as86_write_section(struct Section *, int); -static int as86_add_string(int8_t *name); +static int as86_add_string(char *name); static void as86_sect_write(struct Section *, const uint8_t *, uint32_t); @@ -135,7 +135,7 @@ static void as86_cleanup(int debuginfo) saa_free(strs); } -static int32_t as86_section_names(int8_t *name, int pass, int *bits) +static int32_t as86_section_names(char *name, int pass, int *bits) { /* * Default is 16 bits. @@ -156,7 +156,7 @@ static int32_t as86_section_names(int8_t *name, int pass, int *bits) return NO_SEG; } -static int as86_add_string(int8_t *name) +static int as86_add_string(char *name) { int pos = strslen; int length = strlen(name); @@ -167,8 +167,8 @@ static int as86_add_string(int8_t *name) return pos; } -static void as86_deflabel(int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special) +static void as86_deflabel(char *name, int32_t segment, int32_t offset, + int is_global, char *special) { struct Symbol *sym; @@ -505,7 +505,7 @@ static void as86_write_section(struct Section *sect, int index) */ length = p->bytes; do { - int8_t buf[64]; + char buf[64]; int32_t tmplen = (length > 64 ? 64 : length); fputc(0x40 | (tmplen & 0x3F), as86fp); saa_rnbytes(sect->data, buf, tmplen); @@ -576,14 +576,14 @@ static int32_t as86_segbase(int32_t segment) return segment; } -static int as86_directive(int8_t *directive, int8_t *value, int pass) +static int as86_directive(char *directive, char *value, int pass) { return 0; } -static void as86_filename(int8_t *inname, int8_t *outname, efunc error) +static void as86_filename(char *inname, char *outname, efunc error) { - int8_t *p; + char *p; if ((p = strrchr(inname, '.')) != NULL) { strncpy(as86_module, inname, p - inname); @@ -594,18 +594,18 @@ static void as86_filename(int8_t *inname, int8_t *outname, efunc error) standard_extension(inname, outname, ".o", error); } -static const int8_t *as86_stdmac[] = { +static const char *as86_stdmac[] = { "%define __SECT__ [section .text]", "%macro __NASM_CDecl__ 1", "%endmacro", NULL }; -static int as86_set_info(enum geninfo type, int8_t **val) +static int as86_set_info(enum geninfo type, char **val) { return 0; } -void as86_linenumber(int8_t *name, int32_t segment, int32_t offset, int is_main, +void as86_linenumber(char *name, int32_t segment, int32_t offset, int is_main, int lineno) { } diff --git a/output/outbin.c b/output/outbin.c index cd46752..89465e3 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -76,12 +76,12 @@ static efunc error; /* This struct is used to keep track of symbols for map-file generation. */ static struct bin_label { - int8_t *name; + char *name; struct bin_label *next; } *no_seg_labels, **nsl_tail; static struct Section { - int8_t *name; + char *name; struct SAA *contents; int32_t length; /* section length in bytes */ @@ -91,8 +91,8 @@ static struct Section { uint32_t valign; /* notional section alignment */ uint32_t start; /* section start address */ uint32_t vstart; /* section virtual start address */ - int8_t *follows; /* the section that this one will follow */ - int8_t *vfollows; /* the section that this one will notionally follow */ + char *follows; /* the section that this one will follow */ + char *vfollows; /* the section that this one will notionally follow */ int32_t start_index; /* NASM section id for non-relocated version */ int32_t vstart_index; /* the NASM section id */ @@ -120,8 +120,8 @@ static struct Reloc { struct Section *target; } *relocs, **reloctail; -extern int8_t *stdscan_bufptr; -extern int lookup_label(int8_t *label, int32_t *segment, int32_t *offset); +extern char *stdscan_bufptr; +extern int lookup_label(char *label, int32_t *segment, int32_t *offset); static uint8_t format_mode; /* 0 = original bin, 1 = extended bin */ static int32_t current_section; /* only really needed if format_mode = 0 */ @@ -134,9 +134,9 @@ static int origin_defined; #define MAP_SECTIONS 4 #define MAP_SYMBOLS 8 static int map_control = 0; -static int8_t *infile, *outfile; +static char *infile, *outfile; -static const int8_t *bin_stdmac[] = { +static const char *bin_stdmac[] = { "%define __SECT__ [section .text]", "%imacro org 1+.nolist", "[org %1]", @@ -161,7 +161,7 @@ static void add_reloc(struct Section *s, int32_t bytes, int32_t secref, r->target = s; } -static struct Section *find_section_by_name(const int8_t *name) +static struct Section *find_section_by_name(const char *name) { struct Section *s; @@ -181,7 +181,7 @@ static struct Section *find_section_by_index(int32_t index) return s; } -static struct Section *create_section(int8_t *name) +static struct Section *create_section(char *name) { /* Create a new section. */ last_section->next = nasm_malloc(sizeof(struct Section)); last_section->next->ifollows = last_section; @@ -583,7 +583,7 @@ static void bin_cleanup(int debuginfo) /* Step 7: Generate the map file. */ if (map_control) { - const int8_t *not_defined = { "not defined" }; + const char *not_defined = { "not defined" }; /* Display input and output file names. */ fprintf(rf, "\n- NASM Map file "); @@ -835,8 +835,8 @@ static void bin_out(int32_t segto, const void *data, uint32_t type, } } -static void bin_deflabel(int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special) +static void bin_deflabel(char *name, int32_t segment, int32_t offset, + int is_global, char *special) { (void)segment; /* Don't warn that this parameter is unused */ (void)offset; /* Don't warn that this parameter is unused */ @@ -876,13 +876,13 @@ enum { ATTRIB_START, ATTRIB_ALIGN, ATTRIB_FOLLOWS, ATTRIB_NOBITS, ATTRIB_PROGBITS }; -static int bin_read_attribute(int8_t **line, int *attribute, +static int bin_read_attribute(char **line, int *attribute, uint32_t *value) { expr *e; int attrib_name_size; struct tokenval tokval; - int8_t *exp; + char *exp; /* Skip whitespace. */ while (**line && isspace(**line)) @@ -938,7 +938,7 @@ static int bin_read_attribute(int8_t **line, int *attribute, (*line)++; } } else { - int8_t c; + char c; int pcount = 1; /* Full expression (delimited by parenthesis) */ @@ -1004,11 +1004,11 @@ static int bin_read_attribute(int8_t **line, int *attribute, return 1; } -static void bin_assign_attributes(struct Section *sec, int8_t *astring) +static void bin_assign_attributes(struct Section *sec, char *astring) { int attribute, check; uint32_t value; - int8_t *p; + char *p; while (1) { /* Get the next attribute. */ check = bin_read_attribute(&astring, &attribute, &value); @@ -1196,7 +1196,7 @@ static void bin_define_section_labels() { static int labels_defined = 0; struct Section *sec; - int8_t *label_name; + char *label_name; size_t base_len; if (labels_defined) @@ -1222,9 +1222,9 @@ static void bin_define_section_labels() labels_defined = 1; } -static int32_t bin_secname(int8_t *name, int pass, int *bits) +static int32_t bin_secname(char *name, int pass, int *bits) { - int8_t *p; + char *p; struct Section *sec; /* bin_secname is called with *name = NULL at the start of each @@ -1288,7 +1288,7 @@ static int32_t bin_secname(int8_t *name, int pass, int *bits) return current_section; } -static int bin_directive(int8_t *directive, int8_t *args, int pass) +static int bin_directive(char *directive, char *args, int pass) { /* Handle ORG directive */ if (!nasm_stricmp(directive, "org")) { @@ -1323,7 +1323,7 @@ static int bin_directive(int8_t *directive, int8_t *args, int pass) /* The 'map' directive allows the user to generate section * and symbol information to stdout, stderr, or to a file. */ else if (format_mode && !nasm_stricmp(directive, "map")) { - int8_t *p; + char *p; if (pass != 1) return 1; @@ -1370,7 +1370,7 @@ static int bin_directive(int8_t *directive, int8_t *args, int pass) return 0; } -static void bin_filename(int8_t *inname, int8_t *outname, efunc error) +static void bin_filename(char *inname, char *outname, efunc error) { standard_extension(inname, outname, "", error); infile = inname; @@ -1382,7 +1382,7 @@ static int32_t bin_segbase(int32_t segment) return segment; } -static int bin_set_info(enum geninfo type, int8_t **val) +static int bin_set_info(enum geninfo type, char **val) { return 0; } diff --git a/output/outcoff.c b/output/outcoff.c index bdcc4ce..78331ea 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -77,7 +77,7 @@ struct Reloc { }; struct Symbol { - int8_t name[9]; + char name[9]; int32_t strpos; /* string table position of name */ int section; /* section number where it's defined * - in COFF codes, not NASM codes */ @@ -87,7 +87,7 @@ struct Symbol { static FILE *coffp; static efunc error; -static int8_t coff_infile[FILENAME_MAX]; +static char coff_infile[FILENAME_MAX]; struct Section { struct SAA *data; @@ -96,7 +96,7 @@ struct Section { int32_t index; struct Reloc *head, **tail; uint32_t flags; /* section flags */ - int8_t name[9]; + char name[9]; int32_t pos, relpos; }; @@ -126,7 +126,7 @@ static void coff_gen_init(FILE *, efunc); static void coff_sect_write(struct Section *, const uint8_t *, uint32_t); static void coff_write(void); -static void coff_section_header(int8_t *, int32_t, int32_t, int32_t, int32_t, int, int32_t); +static void coff_section_header(char *, int32_t, int32_t, int32_t, int32_t, int, int32_t); static void coff_write_relocs(struct Section *); static void coff_write_symbols(void); @@ -197,7 +197,7 @@ static void coff_cleanup(int debuginfo) saa_free(strs); } -static int coff_make_section(int8_t *name, uint32_t flags) +static int coff_make_section(char *name, uint32_t flags) { struct Section *s; @@ -227,9 +227,9 @@ static int coff_make_section(int8_t *name, uint32_t flags) return nsects - 1; } -static int32_t coff_section_names(int8_t *name, int pass, int *bits) +static int32_t coff_section_names(char *name, int pass, int *bits) { - int8_t *p; + char *p; uint32_t flags, align_and = ~0L, align_or = 0L; int i; @@ -261,7 +261,7 @@ static int32_t coff_section_names(int8_t *name, int pass, int *bits) while (*p && isspace(*p)) p++; while (*p) { - int8_t *q = p; + char *q = p; while (*p && !isspace(*p)) p++; if (*p) @@ -350,8 +350,8 @@ static int32_t coff_section_names(int8_t *name, int pass, int *bits) return sects[i]->index; } -static void coff_deflabel(int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special) +static void coff_deflabel(char *name, int32_t segment, int32_t offset, + int is_global, char *special) { int pos = strslen + 4; struct Symbol *sym; @@ -589,7 +589,7 @@ static void coff_sect_write(struct Section *sect, typedef struct tagString { struct tagString *Next; int len; - int8_t *String; + char *String; } STRING; #define EXPORT_SECTION_NAME ".drectve" @@ -601,14 +601,14 @@ typedef struct tagString { static STRING *Exports = NULL; static struct Section *directive_sec; -void AddExport(int8_t *name) +void AddExport(char *name) { STRING *rvp = Exports, *newS; newS = (STRING *) nasm_malloc(sizeof(STRING)); newS->len = strlen(name); newS->Next = NULL; - newS->String = (int8_t *)nasm_malloc(newS->len + 1); + newS->String = (char *)nasm_malloc(newS->len + 1); strcpy(newS->String, name); if (rvp == NULL) { int i; @@ -641,7 +641,7 @@ void BuildExportTable(void) if (rvp == NULL) return; while (rvp) { - len = sprintf((int8_t *)buf, "-export:%s ", rvp->String); + len = sprintf((char *)buf, "-export:%s ", rvp->String); coff_sect_write(directive_sec, buf, len); rvp = rvp->Next; } @@ -655,10 +655,10 @@ void BuildExportTable(void) Exports = NULL; } -static int coff_directives(int8_t *directive, int8_t *value, int pass) +static int coff_directives(char *directive, char *value, int pass) { if (!strcmp(directive, "export")) { - int8_t *q, *name; + char *q, *name; if (pass == 2) return 1; /* ignore in pass two */ @@ -752,11 +752,11 @@ static void coff_write(void) saa_fpwrite(strs, coffp); } -static void coff_section_header(int8_t *name, int32_t vsize, +static void coff_section_header(char *name, int32_t vsize, int32_t datalen, int32_t datapos, int32_t relpos, int nrelocs, int32_t flags) { - int8_t padname[8]; + char padname[8]; memset(padname, 0, 8); strncpy(padname, name, 8); @@ -795,10 +795,10 @@ static void coff_write_relocs(struct Section *s) } } -static void coff_symbol(int8_t *name, int32_t strpos, int32_t value, +static void coff_symbol(char *name, int32_t strpos, int32_t value, int section, int type, int aux) { - int8_t padname[8]; + char padname[8]; if (name) { memset(padname, 0, 8); @@ -817,7 +817,7 @@ static void coff_symbol(int8_t *name, int32_t strpos, int32_t value, static void coff_write_symbols(void) { - int8_t filename[18]; + char filename[18]; uint32_t i; /* @@ -862,19 +862,19 @@ static int32_t coff_segbase(int32_t segment) return segment; } -static void coff_std_filename(int8_t *inname, int8_t *outname, efunc error) +static void coff_std_filename(char *inname, char *outname, efunc error) { strcpy(coff_infile, inname); standard_extension(inname, outname, ".o", error); } -static void coff_win32_filename(int8_t *inname, int8_t *outname, efunc error) +static void coff_win32_filename(char *inname, char *outname, efunc error) { strcpy(coff_infile, inname); standard_extension(inname, outname, ".obj", error); } -static const int8_t *coff_stdmac[] = { +static const char *coff_stdmac[] = { "%define __SECT__ [section .text]", "%macro __NASM_CDecl__ 1", "%endmacro", @@ -884,7 +884,7 @@ static const int8_t *coff_stdmac[] = { NULL }; -static int coff_set_info(enum geninfo type, int8_t **val) +static int coff_set_info(enum geninfo type, char **val) { return 0; } diff --git a/output/outdbg.c b/output/outdbg.c index d7bcb48..045ad37 100644 --- a/output/outdbg.c +++ b/output/outdbg.c @@ -22,7 +22,7 @@ struct Section { struct Section *next; int32_t number; - int8_t *name; + char *name; } *dbgsect; FILE *dbgf; @@ -55,7 +55,7 @@ static void dbg_cleanup(int debuginfo) fclose(dbgf); } -static int32_t dbg_section_names(int8_t *name, int pass, int *bits) +static int32_t dbg_section_names(char *name, int pass, int *bits) { int seg; @@ -70,7 +70,7 @@ static int32_t dbg_section_names(int8_t *name, int pass, int *bits) seg = seg_alloc()); else { int n = strcspn(name, " \t"); - int8_t *sname = nasm_strndup(name, n); + char *sname = nasm_strndup(name, n); struct Section *s; seg = NO_SEG; @@ -91,8 +91,8 @@ static int32_t dbg_section_names(int8_t *name, int pass, int *bits) return seg; } -static void dbg_deflabel(int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special) +static void dbg_deflabel(char *name, int32_t segment, int32_t offset, + int is_global, char *special) { fprintf(dbgf, "deflabel %s := %08lx:%08lx %s (%d)%s%s\n", name, segment, offset, @@ -119,7 +119,7 @@ static void dbg_out(int32_t segto, void *data, uint32_t type, fprintf(dbgf, "raw data = "); while (realbytes--) { id = *(uint8_t *)data; - data = (int8_t *)data + 1; + data = (char *)data + 1; fprintf(dbgf, "%02x ", id); } fprintf(dbgf, "\n"); @@ -127,7 +127,7 @@ static void dbg_out(int32_t segto, void *data, uint32_t type, case OUT_ADDRESS: ldata = 0; /* placate gcc */ if (realbytes == 1) - ldata = *((int8_t *)data); + ldata = *((char *)data); else if (realbytes == 2) ldata = *((int16_t *)data); else if (realbytes == 4) @@ -154,26 +154,26 @@ static int32_t dbg_segbase(int32_t segment) return segment; } -static int dbg_directive(int8_t *directive, int8_t *value, int pass) +static int dbg_directive(char *directive, char *value, int pass) { fprintf(dbgf, "directive [%s] value [%s] (pass %d)\n", directive, value, pass); return 1; } -static void dbg_filename(int8_t *inname, int8_t *outname, efunc error) +static void dbg_filename(char *inname, char *outname, efunc error) { standard_extension(inname, outname, ".dbg", error); } -static int dbg_set_info(enum geninfo type, int8_t **val) +static int dbg_set_info(enum geninfo type, char **val) { (void)type; (void)val; return 0; } -int8_t *types[] = { +char *types[] = { "unknown", "label", "byte", "word", "dword", "float", "qword", "tbyte" }; void dbgdbg_init(struct ofmt *of, void *id, FILE * fp, efunc error) @@ -188,12 +188,12 @@ static void dbgdbg_cleanup(void) { } -static void dbgdbg_linnum(const int8_t *lnfname, int32_t lineno, int32_t segto) +static void dbgdbg_linnum(const char *lnfname, int32_t lineno, int32_t segto) { fprintf(dbgf, "dbglinenum %s(%ld) := %08lx\n", lnfname, lineno, segto); } -static void dbgdbg_deflabel(int8_t *name, int32_t segment, - int32_t offset, int is_global, int8_t *special) +static void dbgdbg_deflabel(char *name, int32_t segment, + int32_t offset, int is_global, char *special) { fprintf(dbgf, "dbglabel %s := %08lx:%08lx %s (%d)%s%s\n", name, @@ -201,7 +201,7 @@ static void dbgdbg_deflabel(int8_t *name, int32_t segment, is_global == 2 ? "common" : is_global ? "global" : "local", is_global, special ? ": " : "", special); } -static void dbgdbg_define(const int8_t *type, const int8_t *params) +static void dbgdbg_define(const char *type, const char *params) { fprintf(dbgf, "dbgdirective [%s] value [%s]\n", type, params); } diff --git a/output/outelf.c b/output/outelf.c index e185c7e..103479c 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -56,7 +56,7 @@ struct Symbol { int32_t globnum; /* symbol table offset if global */ struct Symbol *next; /* list of globals in each section */ struct Symbol *nextfwd; /* list of unresolved-size symbols */ - int8_t *name; /* used temporarily if in above list */ + char *name; /* used temporarily if in above list */ }; #define SHT_PROGBITS 1 @@ -73,7 +73,7 @@ struct Section { int type; /* SHT_PROGBITS or SHT_NOBITS */ int align; /* alignment: power of two */ uint32_t flags; /* section flags */ - int8_t *name; + char *name; struct SAA *rel; int32_t rellen; struct Reloc *head, **tail; @@ -85,7 +85,7 @@ static struct Section **sects; static int nsects, sectlen; #define SHSTR_DELTA 256 -static int8_t *shstrtab; +static char *shstrtab; static int shstrtablen, shstrtabsize; static struct SAA *syms; @@ -104,7 +104,7 @@ static evalfunc evaluate; static struct Symbol *fwds; -static int8_t elf_module[FILENAME_MAX]; +static char elf_module[FILENAME_MAX]; extern struct ofmt of_elf; @@ -122,7 +122,7 @@ extern struct ofmt of_elf; #define SEG_ALIGN 16 /* alignment of sections in file */ #define SEG_ALIGN_1 (SEG_ALIGN-1) -static const int8_t align_str[SEG_ALIGN] = ""; /* ANSI will pad this with 0s */ +static const char align_str[SEG_ALIGN] = ""; /* ANSI will pad this with 0s */ #define ELF_MAX_SECTIONS 16 /* really 10, but let's play safe */ static struct ELF_SECTDATA { @@ -141,7 +141,7 @@ static void elf_section_header(int, int, int, void *, int, int32_t, int, int, static void elf_write_sections(void); static struct SAA *elf_build_symtab(int32_t *, int32_t *); static struct SAA *elf_build_reltab(int32_t *, struct Reloc *); -static void add_sectname(int8_t *, int8_t *); +static void add_sectname(char *, char *); /* this stuff is needed for the stabs debugging format */ #define N_SO 0x64 /* ID for main source file */ @@ -166,13 +166,13 @@ struct erel { struct symlininfo { int offset; int section; /* section index */ - int8_t *name; /* shallow-copied pointer of section name */ + char *name; /* shallow-copied pointer of section name */ }; struct linelist { struct symlininfo info; int line; - int8_t *filename; + char *filename; struct linelist *next; struct linelist *last; }; @@ -181,7 +181,7 @@ static struct linelist *stabslines = 0; static int stabs_immcall = 0; static int currentline = 0; static int numlinestabs = 0; -static int8_t *stabs_filename = 0; +static char *stabs_filename = 0; static int symtabsection; static uint8_t *stabbuf = 0, *stabstrbuf = 0, *stabrelbuf = 0; static int stablen, stabstrlen, stabrellen; @@ -189,9 +189,9 @@ static int stablen, stabstrlen, stabrellen; static struct dfmt df_stabs; void stabs_init(struct ofmt *, void *, FILE *, efunc); -void stabs_linenum(const int8_t *filename, int32_t linenumber, int32_t); -void stabs_deflabel(int8_t *, int32_t, int32_t, int, int8_t *); -void stabs_directive(const int8_t *, const int8_t *); +void stabs_linenum(const char *filename, int32_t linenumber, int32_t); +void stabs_deflabel(char *, int32_t, int32_t, int, char *); +void stabs_directive(const char *, const char *); void stabs_typevalue(int32_t); void stabs_output(int, void *); void stabs_generate(); @@ -277,7 +277,7 @@ static void elf_cleanup(int debuginfo) } } -static void add_sectname(int8_t *firsthalf, int8_t *secondhalf) +static void add_sectname(char *firsthalf, char *secondhalf) { int len = strlen(firsthalf) + strlen(secondhalf); while (shstrtablen + len + 1 > shstrtabsize) @@ -287,7 +287,7 @@ static void add_sectname(int8_t *firsthalf, int8_t *secondhalf) shstrtablen += len + 1; } -static int elf_make_section(int8_t *name, int type, int flags, int align) +static int elf_make_section(char *name, int type, int flags, int align) { struct Section *s; @@ -319,9 +319,9 @@ static int elf_make_section(int8_t *name, int type, int flags, int align) return nsects - 1; } -static int32_t elf_section_names(int8_t *name, int pass, int *bits) +static int32_t elf_section_names(char *name, int pass, int *bits) { - int8_t *p; + char *p; int flags_and, flags_or, type, align, i; /* @@ -342,7 +342,7 @@ static int32_t elf_section_names(int8_t *name, int pass, int *bits) while (*p && isspace(*p)) p++; while (*p) { - int8_t *q = p; + char *q = p; while (*p && !isspace(*p)) p++; if (*p) @@ -424,8 +424,8 @@ static int32_t elf_section_names(int8_t *name, int pass, int *bits) return sects[i]->index; } -static void elf_deflabel(int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special) +static void elf_deflabel(char *name, int32_t segment, int32_t offset, + int is_global, char *special) { int pos = strslen; struct Symbol *sym; @@ -459,7 +459,7 @@ static void elf_deflabel(int8_t *name, int32_t segment, int32_t offset, if (!strcmp((*s)->name, name)) { struct tokenval tokval; expr *e; - int8_t *p = special; + char *p = special; while (*p && !isspace(*p)) p++; @@ -586,7 +586,7 @@ static void elf_deflabel(int8_t *name, int32_t segment, int32_t offset, struct tokenval tokval; expr *e; int fwd = FALSE; - int8_t *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */ + char *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */ while (special[n] && isspace(special[n])) n++; @@ -917,9 +917,9 @@ static void elf_write(void) { int nsections, align; int scount; - int8_t *p; + char *p; int commlen; - int8_t comment[64]; + char comment[64]; int i; struct SAA *symtab; @@ -1228,25 +1228,25 @@ static int32_t elf_segbase(int32_t segment) return segment; } -static int elf_directive(int8_t *directive, int8_t *value, int pass) +static int elf_directive(char *directive, char *value, int pass) { return 0; } -static void elf_filename(int8_t *inname, int8_t *outname, efunc error) +static void elf_filename(char *inname, char *outname, efunc error) { strcpy(elf_module, inname); standard_extension(inname, outname, ".o", error); } -static const int8_t *elf_stdmac[] = { +static const char *elf_stdmac[] = { "%define __SECT__ [section .text]", "%macro __NASM_CDecl__ 1", "%define $_%1 $%1", "%endmacro", NULL }; -static int elf_set_info(enum geninfo type, int8_t **val) +static int elf_set_info(enum geninfo type, char **val) { return 0; } @@ -1289,10 +1289,10 @@ void stabs_init(struct ofmt *of, void *id, FILE * fp, efunc error) { } -void stabs_linenum(const int8_t *filename, int32_t linenumber, int32_t segto) +void stabs_linenum(const char *filename, int32_t linenumber, int32_t segto) { if (!stabs_filename) { - stabs_filename = (int8_t *)nasm_malloc(strlen(filename) + 1); + stabs_filename = (char *)nasm_malloc(strlen(filename) + 1); strcpy(stabs_filename, filename); } else { if (strcmp(stabs_filename, filename)) { @@ -1302,7 +1302,7 @@ void stabs_linenum(const int8_t *filename, int32_t linenumber, int32_t segto) /* why not nasm_free(stabs_filename); we're done with the old one */ - stabs_filename = (int8_t *)nasm_malloc(strlen(filename) + 1); + stabs_filename = (char *)nasm_malloc(strlen(filename) + 1); strcpy(stabs_filename, filename); } } @@ -1310,12 +1310,12 @@ void stabs_linenum(const int8_t *filename, int32_t linenumber, int32_t segto) currentline = linenumber; } -void stabs_deflabel(int8_t *name, int32_t segment, int32_t offset, int is_global, - int8_t *special) +void stabs_deflabel(char *name, int32_t segment, int32_t offset, int is_global, + char *special) { } -void stabs_directive(const int8_t *directive, const int8_t *params) +void stabs_directive(const char *directive, const char *params) { } @@ -1367,14 +1367,14 @@ void stabs_generate(void) { int i, numfiles, strsize, numstabs = 0, currfile, mainfileindex; uint8_t *sbuf, *ssbuf, *rbuf, *sptr, *rptr; - int8_t **allfiles; + char **allfiles; int *fileidx; struct linelist *ptr; ptr = stabslines; - allfiles = (int8_t **)nasm_malloc(numlinestabs * sizeof(int8_t *)); + allfiles = (char **)nasm_malloc(numlinestabs * sizeof(char *)); for (i = 0; i < numlinestabs; i++) allfiles[i] = 0; numfiles = 0; @@ -1421,7 +1421,7 @@ void stabs_generate(void) rptr = rbuf; for (i = 0; i < numfiles; i++) { - strcpy((int8_t *)ssbuf + fileidx[i], allfiles[i]); + strcpy((char *)ssbuf + fileidx[i], allfiles[i]); } ssbuf[0] = 0; diff --git a/output/outieee.c b/output/outieee.c index 7cea69f..ea124fe 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -52,7 +52,7 @@ #define ARRAY_BOT 0x1 -static int8_t ieee_infile[FILENAME_MAX]; +static char ieee_infile[FILENAME_MAX]; static int ieee_uppercase; static efunc error; @@ -76,7 +76,7 @@ struct LineNumber { static struct FileName { struct FileName *next; - int8_t *name; + char *name; int32_t index; } *fnhead, **fntail; @@ -88,7 +88,7 @@ static struct Array { static struct ieeePublic { struct ieeePublic *next; - int8_t *name; + char *name; int32_t offset; int32_t segment; /* only if it's far-absolute */ int32_t index; @@ -97,7 +97,7 @@ static struct ieeePublic { static struct ieeeExternal { struct ieeeExternal *next; - int8_t *name; + char *name; int32_t commonsize; } *exthead, **exttail; @@ -125,7 +125,7 @@ static struct ieeeSection { } combine; int32_t use32; /* is this segment 32-bit? */ struct ieeePublic *pubhead, **pubtail, *lochead, **loctail; - int8_t *name; + char *name; } *seghead, **segtail, *ieee_seg_needs_update; struct ieeeObjData { @@ -161,16 +161,16 @@ static void ieee_data_new(struct ieeeSection *); static void ieee_write_fixup(int32_t, int32_t, struct ieeeSection *, int, uint32_t, int32_t); static void ieee_install_fixup(struct ieeeSection *, struct ieeeFixupp *); -static int32_t ieee_segment(int8_t *, int, int *); +static int32_t ieee_segment(char *, int, int *); static void ieee_write_file(int debuginfo); static void ieee_write_byte(struct ieeeSection *, int); static void ieee_write_word(struct ieeeSection *, int); static void ieee_write_dword(struct ieeeSection *, int32_t); -static void ieee_putascii(int8_t *, ...); +static void ieee_putascii(char *, ...); static void ieee_putcs(int); static int32_t ieee_putld(int32_t, int32_t, uint8_t *); static int32_t ieee_putlr(struct ieeeFixupp *); -static void ieee_unqualified_name(int8_t *, int8_t *); +static void ieee_unqualified_name(char *, char *); /* * pup init @@ -196,7 +196,7 @@ static void ieee_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) checksum = 0; of_ieee.current_dfmt->init(&of_ieee, NULL, fp, errfunc); } -static int ieee_set_info(enum geninfo type, int8_t **val) +static int ieee_set_info(enum geninfo type, char **val) { (void)type; (void)val; @@ -252,8 +252,8 @@ static void ieee_cleanup(int debuginfo) /* * callback for labels */ -static void ieee_deflabel(int8_t *name, int32_t segment, - int32_t offset, int is_global, int8_t *special) +static void ieee_deflabel(char *name, int32_t segment, + int32_t offset, int is_global, char *special) { /* * We have three cases: @@ -651,7 +651,7 @@ static void ieee_install_fixup(struct ieeeSection *seg, /* * segment registry */ -static int32_t ieee_segment(int8_t *name, int pass, int *bits) +static int32_t ieee_segment(char *name, int pass, int *bits) { /* * We call the label manager here to define a name for the new @@ -668,7 +668,7 @@ static int32_t ieee_segment(int8_t *name, int pass, int *bits) } else { struct ieeeSection *seg; int ieee_idx, attrs, rn_error; - int8_t *p; + char *p; /* * Look for segment attributes. @@ -805,7 +805,7 @@ static int32_t ieee_segment(int8_t *name, int pass, int *bits) /* * directives supported */ -static int ieee_directive(int8_t *directive, int8_t *value, int pass) +static int ieee_directive(char *directive, char *value, int pass) { (void)value; @@ -843,7 +843,7 @@ static int32_t ieee_segbase(int32_t segment) /* * filename */ -static void ieee_filename(int8_t *inname, int8_t *outname, efunc error) +static void ieee_filename(char *inname, char *outname, efunc error) { strcpy(ieee_infile, inname); standard_extension(inname, outname, ".o", error); @@ -860,7 +860,7 @@ static void ieee_write_file(int debuginfo) struct ieeeObjData *data; struct ieeeFixupp *fix; struct Array *arr; - static int8_t boast[] = "The Netwide Assembler " NASM_VER; + static char boast[] = "The Netwide Assembler " NASM_VER; int i; /* @@ -908,8 +908,8 @@ static void ieee_write_file(int debuginfo) if (!debuginfo && !strcmp(seg->name, "??LINE")) seg = seg->next; while (seg) { - int8_t buf[256]; - int8_t attrib; + char buf[256]; + char attrib; switch (seg->combine) { case CMB_PUBLIC: default: @@ -958,7 +958,7 @@ static void ieee_write_file(int debuginfo) i = 1; for (seg = seghead; seg; seg = seg->next) { for (pub = seg->pubhead; pub; pub = pub->next) { - int8_t buf[256]; + char buf[256]; ieee_unqualified_name(buf, pub->name); ieee_putascii("NI%X,%02X%s.\r\n", i, strlen(buf), buf); if (pub->segment == -1) @@ -979,7 +979,7 @@ static void ieee_write_file(int debuginfo) pub = fpubhead; i = 1; while (pub) { - int8_t buf[256]; + char buf[256]; ieee_unqualified_name(buf, pub->name); ieee_putascii("NI%X,%02X%s.\r\n", i, strlen(buf), buf); if (pub->segment == -1) @@ -1003,7 +1003,7 @@ static void ieee_write_file(int debuginfo) ext = exthead; i = 1; while (ext) { - int8_t buf[256]; + char buf[256]; ieee_unqualified_name(buf, ext->name); ieee_putascii("NX%X,%02X%s.\r\n", i++, strlen(buf), buf); ext = ext->next; @@ -1030,7 +1030,7 @@ static void ieee_write_file(int debuginfo) i = 1; for (seg = seghead; seg && debuginfo; seg = seg->next) { for (loc = seg->lochead; loc; loc = loc->next) { - int8_t buf[256]; + char buf[256]; ieee_unqualified_name(buf, loc->name); ieee_putascii("NN%X,%02X%s.\r\n", i, strlen(buf), buf); if (loc->segment == -1) @@ -1114,9 +1114,9 @@ static void ieee_write_dword(struct ieeeSection *seg, int32_t data) ieee_write_byte(seg, (data >> 16) & 0xFF); ieee_write_byte(seg, (data >> 24) & 0xFF); } -static void ieee_putascii(int8_t *format, ...) +static void ieee_putascii(char *format, ...) { - int8_t buffer[256]; + char buffer[256]; int i, l; va_list ap; @@ -1189,7 +1189,7 @@ static int32_t ieee_putlr(struct ieeeFixupp *p) * becomes an issue if real mode code is used. A pure 32-bit linker could * get away without defining the virtual mode... */ - int8_t buf[40]; + char buf[40]; int32_t size = p->size; switch (p->ftype) { case FT_SEG: @@ -1241,7 +1241,7 @@ static int32_t ieee_putlr(struct ieeeFixupp *p) /* Dump all segment data (text and fixups )*/ -static void ieee_unqualified_name(int8_t *dest, int8_t *source) +static void ieee_unqualified_name(char *dest, char *source) { if (ieee_uppercase) { while (*source) @@ -1297,7 +1297,7 @@ static void dbgls_cleanup(void) * so, we have to make sure the ??LINE segment is avaialbe * as the first segment when this debug format is selected */ -static void dbgls_linnum(const int8_t *lnfname, int32_t lineno, int32_t segto) +static void dbgls_linnum(const char *lnfname, int32_t lineno, int32_t segto) { struct FileName *fn; struct ieeeSection *seg; @@ -1344,8 +1344,8 @@ static void dbgls_linnum(const int8_t *lnfname, int32_t lineno, int32_t segto) seg->currentpos); } -static void dbgls_deflabel(int8_t *name, int32_t segment, - int32_t offset, int is_global, int8_t *special) +static void dbgls_deflabel(char *name, int32_t segment, + int32_t offset, int is_global, char *special) { struct ieeeSection *seg; int used_special; /* have we used the special text? */ diff --git a/output/outmacho.c b/output/outmacho.c index 6d18fdb..5e71900 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -56,8 +56,8 @@ struct section { int align; /* data that goes into the file */ - int8_t sectname[16]; /* what this section is called */ - int8_t segname[16]; /* segment this section will be in */ + char sectname[16]; /* what this section is called */ + char segname[16]; /* segment this section will be in */ uint32_t size; /* in-memory and -file size */ uint32_t nreloc; /* relocation entry count */ uint32_t flags; /* type and attributes (masked) */ @@ -78,9 +78,9 @@ struct section { static struct sectmap { - const int8_t *nasmsect; - const int8_t *segname; - const int8_t *sectname; + const char *nasmsect; + const char *segname; + const char *sectname; const int32_t flags; } sectmap[] = { { ".text", "__TEXT", "__text", S_REGULAR|S_ATTR_SOME_INSTRUCTIONS}, { @@ -111,7 +111,7 @@ struct reloc { struct symbol { /* nasm internal data */ struct symbol *next; /* next symbol in the list */ - int8_t *name; /* name of this symbol */ + char *name; /* name of this symbol */ int32_t initial_snum; /* symbol number used above in reloc */ int32_t snum; /* true snum for reloc */ @@ -205,7 +205,7 @@ static int exact_log2 (uint32_t align) { if (align != (align & -align)) { return -1; } else { -#if __GNUC__ >= 4 +#ifdef __GNUC__ return (align ? __builtin_ctzl (align) : 0); #else uint32_t result = 0; @@ -219,8 +219,8 @@ static int exact_log2 (uint32_t align) { } } -static struct section *get_section_by_name(const int8_t *segname, - const int8_t *sectname) +static struct section *get_section_by_name(const char *segname, + const char *sectname) { struct section *s; @@ -242,8 +242,8 @@ static struct section *get_section_by_index(const int32_t index) return s; } -static int32_t get_section_index_by_name(const int8_t *segname, - const int8_t *sectname) +static int32_t get_section_index_by_name(const char *segname, + const char *sectname) { struct section *s; @@ -254,7 +254,7 @@ static int32_t get_section_index_by_name(const int8_t *segname, return -1; } -static int8_t *get_section_name_by_index(const int32_t index) +static char *get_section_name_by_index(const int32_t index) { struct section *s; @@ -284,7 +284,7 @@ static uint8_t get_section_fileindex_by_index(const int32_t index) static void macho_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) { - int8_t zero = 0; + char zero = 0; machofp = fp; error = errfunc; @@ -306,11 +306,11 @@ static void macho_init(FILE * fp, efunc errfunc, ldfunc ldef, strs = saa_init(1L); /* string table starts with a zero byte - don't ask why */ - saa_wbytes(strs, &zero, sizeof(int8_t)); + saa_wbytes(strs, &zero, sizeof(char)); strslen = 1; } -static int macho_setinfo(enum geninfo type, int8_t **val) +static int macho_setinfo(enum geninfo type, char **val) { return 0; } @@ -505,10 +505,10 @@ static void macho_output(int32_t secto, const void *data, uint32_t type, } } -static int32_t macho_section(int8_t *name, int pass, int *bits) +static int32_t macho_section(char *name, int pass, int *bits) { int32_t index, originalIndex; - int8_t *sectionAttributes; + char *sectionAttributes; struct sectmap *sm; struct section *s; @@ -525,7 +525,7 @@ static int32_t macho_section(int8_t *name, int pass, int *bits) for (sm = sectmap; sm->nasmsect != NULL; ++sm) { /* make lookup into section name translation table */ if (!strcmp(name, sm->nasmsect)) { - int8_t *currentAttribute; + char *currentAttribute; /* try to find section with that name */ originalIndex = index = get_section_index_by_name(sm->segname, @@ -557,7 +557,7 @@ static int32_t macho_section(int8_t *name, int pass, int *bits) && (currentAttribute = strtok((char*)§ionAttributes, " \t"))) { if (0 != *currentAttribute) { if (0 == strncasecmp("align=", currentAttribute, 6)) { - int8_t *end; + char *end; int newAlignment, value; value = strtoul(currentAttribute + 6, (char**)&end, 0); @@ -612,8 +612,8 @@ static int32_t macho_section(int8_t *name, int pass, int *bits) return NO_SEG; } -static void macho_symdef(int8_t *name, int32_t section, int32_t offset, - int is_global, int8_t *special) +static void macho_symdef(char *name, int32_t section, int32_t offset, + int is_global, char *special) { struct symbol *sym; @@ -689,17 +689,17 @@ static int32_t macho_segbase(int32_t section) return section; } -static int macho_directive(int8_t *directive, int8_t *value, int pass) +static int macho_directive(char *directive, char *value, int pass) { return 0; } -static void macho_filename(int8_t *inname, int8_t *outname, efunc error) +static void macho_filename(char *inname, char *outname, efunc error) { standard_extension(inname, outname, ".o", error); } -static const int8_t *macho_stdmac[] = { +static const char *macho_stdmac[] = { "%define __SECT__ [section .text]", "%macro __NASM_CDecl__ 1", "%endmacro", @@ -731,7 +731,7 @@ static void macho_layout_symbols (uint32_t *numsyms, uint32_t i,j; *numsyms = 0; - *strtabsize = sizeof (int8_t); + *strtabsize = sizeof (char); symp = &syms; @@ -944,7 +944,7 @@ static void macho_write_section (void) { struct section *s, *s2; struct reloc *r; - int8_t *rel_paddata = "\0\0\0"; + char *rel_paddata = "\0\0\0"; uint8_t fi, *p, *q, blk[4]; int32_t l; @@ -1118,7 +1118,7 @@ static void macho_write (void) ** uint32_t command type == LC_SEGMENT ** uint32_t size of load command ** (including section load commands) - ** int8_t[16] segment name + ** char[16] segment name ** uint32_t in-memory offset ** uint32_t in-memory size ** uint32_t in-file offset to data area @@ -1130,8 +1130,8 @@ static void macho_write (void) ** uint32_t flags ** ** section commands - ** int8_t[16] section name - ** int8_t[16] segment name + ** char[16] section name + ** char[16] segment name ** uint32_t in-memory offset ** uint32_t in-memory size ** uint32_t in-file offset diff --git a/output/outobj.c b/output/outobj.c index b77cdae..f960183 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -379,7 +379,7 @@ static ObjRecord *obj_value(ObjRecord * orp, uint32_t val) /* * Writes a counted string */ -static ObjRecord *obj_name(ObjRecord * orp, int8_t *name) +static ObjRecord *obj_name(ObjRecord * orp, char *name) { int len = strlen(name); uint8_t *ptr; @@ -459,7 +459,7 @@ static void ori_null(ObjRecord * orp) * This concludes the low level section of outobj.c */ -static int8_t obj_infile[FILENAME_MAX]; +static char obj_infile[FILENAME_MAX]; static efunc error; static evalfunc evaluate; @@ -486,7 +486,7 @@ struct LineNumber { static struct FileName { struct FileName *next; - int8_t *name; + char *name; struct LineNumber *lnhead, **lntail; int index; } *fnhead, **fntail; @@ -501,7 +501,7 @@ static struct Array { static struct Public { struct Public *next; - int8_t *name; + char *name; int32_t offset; int32_t segment; /* only if it's far-absolute */ int type; /* only for local debug syms */ @@ -509,7 +509,7 @@ static struct Public { static struct External { struct External *next; - int8_t *name; + char *name; int32_t commonsize; int32_t commonelem; /* element size if FAR, else zero */ int index; /* OBJ-file external index */ @@ -520,7 +520,7 @@ static struct External { DEFWRT_GROUP /* a group */ } defwrt_type; union { - int8_t *string; + char *string; struct Segment *seg; struct Group *grp; } defwrt_ptr; @@ -549,36 +549,36 @@ static struct Segment { } combine; int32_t use32; /* is this segment 32-bit? */ struct Public *pubhead, **pubtail, *lochead, **loctail; - int8_t *name; - int8_t *segclass, *overlay; /* `class' is a C++ keyword :-) */ + char *name; + char *segclass, *overlay; /* `class' is a C++ keyword :-) */ ObjRecord *orp; } *seghead, **segtail, *obj_seg_needs_update; static struct Group { struct Group *next; - int8_t *name; + char *name; int32_t index; /* NASM segment id */ int32_t obj_index; /* OBJ-file group index */ int32_t nentries; /* number of elements... */ int32_t nindices; /* ...and number of index elts... */ union { int32_t index; - int8_t *name; + char *name; } segs[GROUP_MAX]; /* ...in this */ } *grphead, **grptail, *obj_grp_needs_update; static struct ImpDef { struct ImpDef *next; - int8_t *extname; - int8_t *libname; + char *extname; + char *libname; unsigned int impindex; - int8_t *impname; + char *impname; } *imphead, **imptail; static struct ExpDef { struct ExpDef *next; - int8_t *intname; - int8_t *extname; + char *intname; + char *extname; unsigned int ordinal; int flags; } *exphead, **exptail; @@ -595,9 +595,9 @@ struct ofmt of_obj; /* The current segment */ static struct Segment *current_seg; -static int32_t obj_segment(int8_t *, int, int *); +static int32_t obj_segment(char *, int, int *); static void obj_write_file(int debuginfo); -static int obj_directive(int8_t *, int8_t *, int); +static int obj_directive(char *, char *, int); static void obj_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) { @@ -632,7 +632,7 @@ static void obj_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) of_obj.current_dfmt->init(&of_obj, NULL, fp, errfunc); } -static int obj_set_info(enum geninfo type, int8_t **val) +static int obj_set_info(enum geninfo type, char **val) { (void)type; (void)val; @@ -695,7 +695,7 @@ static void obj_cleanup(int debuginfo) } } -static void obj_ext_set_defwrt(struct External *ext, int8_t *id) +static void obj_ext_set_defwrt(struct External *ext, char *id) { struct Segment *seg; struct Group *grp; @@ -722,8 +722,8 @@ static void obj_ext_set_defwrt(struct External *ext, int8_t *id) dws = ext; } -static void obj_deflabel(int8_t *name, int32_t segment, - int32_t offset, int is_global, int8_t *special) +static void obj_deflabel(char *name, int32_t segment, + int32_t offset, int is_global, char *special) { /* * We have three cases: @@ -888,7 +888,7 @@ static void obj_deflabel(int8_t *name, int32_t segment, * We might have a default-WRT specification. */ if (!nasm_strnicmp(special, "wrt", 3)) { - int8_t *p; + char *p; int len; special += 3; special += strspn(special, " \t"); @@ -1255,7 +1255,7 @@ static void obj_write_fixup(ObjRecord * orp, int bytes, obj_commit(forp); } -static int32_t obj_segment(int8_t *name, int pass, int *bits) +static int32_t obj_segment(char *name, int pass, int *bits) { /* * We call the label manager here to define a name for the new @@ -1277,7 +1277,7 @@ static int32_t obj_segment(int8_t *name, int pass, int *bits) struct Group *grp; struct External **extp; int obj_idx, i, attrs, rn_error; - int8_t *p; + char *p; /* * Look for segment attributes. @@ -1506,10 +1506,10 @@ static int32_t obj_segment(int8_t *name, int pass, int *bits) } } -static int obj_directive(int8_t *directive, int8_t *value, int pass) +static int obj_directive(char *directive, char *value, int pass) { if (!strcmp(directive, "group")) { - int8_t *p, *q, *v; + char *p, *q, *v; if (pass == 1) { struct Group *grp; struct Segment *seg; @@ -1623,7 +1623,7 @@ static int obj_directive(int8_t *directive, int8_t *value, int pass) return 1; } if (!strcmp(directive, "import")) { - int8_t *q, *extname, *libname, *impname; + char *q, *extname, *libname, *impname; if (pass == 2) return 1; /* ignore in pass two */ @@ -1669,7 +1669,7 @@ static int obj_directive(int8_t *directive, int8_t *value, int pass) return 1; } if (!strcmp(directive, "export")) { - int8_t *q, *extname, *intname, *v; + char *q, *extname, *intname, *v; struct ExpDef *export; int flags = 0; unsigned int ordinal = 0; @@ -1797,7 +1797,7 @@ static int32_t obj_segbase(int32_t segment) return segment; /* no special treatment */ } -static void obj_filename(int8_t *inname, int8_t *outname, efunc lerror) +static void obj_filename(char *inname, char *outname, efunc lerror) { strcpy(obj_infile, inname); standard_extension(inname, outname, ".obj", lerror); @@ -1813,7 +1813,7 @@ static void obj_write_file(int debuginfo) struct External *ext; struct ImpDef *imp; struct ExpDef *export; - static int8_t boast[] = "The Netwide Assembler " NASM_VER; + static char boast[] = "The Netwide Assembler " NASM_VER; int lname_idx; ObjRecord *orp; @@ -2290,7 +2290,7 @@ void obj_fwrite(ObjRecord * orp) fputc((-cksum) & 0xFF, ofp); } -static const int8_t *obj_stdmac[] = { +static const char *obj_stdmac[] = { "%define __SECT__ [section .text]", "%imacro group 1+.nolist", "[group %1]", @@ -2351,7 +2351,7 @@ static void dbgbi_cleanup(void) } } -static void dbgbi_linnum(const int8_t *lnfname, int32_t lineno, int32_t segto) +static void dbgbi_linnum(const char *lnfname, int32_t lineno, int32_t segto) { struct FileName *fn; struct LineNumber *ln; @@ -2402,8 +2402,8 @@ static void dbgbi_linnum(const int8_t *lnfname, int32_t lineno, int32_t segto) fn->lntail = &ln->next; } -static void dbgbi_deflabel(int8_t *name, int32_t segment, - int32_t offset, int is_global, int8_t *special) +static void dbgbi_deflabel(char *name, int32_t segment, + int32_t offset, int is_global, char *special) { struct Segment *seg; diff --git a/output/outrdf.c b/output/outrdf.c index 624cc72..3c72652 100644 --- a/output/outrdf.c +++ b/output/outrdf.c @@ -30,7 +30,7 @@ typedef int16_t int16; /* not sure if this will be required to be altered at all... best to typedef it just in case */ -static const int8_t *RDOFFId = "RDOFF1"; /* written to start of RDOFF files */ +static const char *RDOFFId = "RDOFF1"; /* written to start of RDOFF files */ /* the records that can be found in the RDOFF header */ @@ -42,39 +42,39 @@ static const int8_t *RDOFFId = "RDOFF1"; /* written to start of RDOFF files */ * 32764. */ struct RelocRec { - int8_t type; /* must be 1 */ - int8_t segment; /* only 0 for code, or 1 for data supported, + char type; /* must be 1 */ + char segment; /* only 0 for code, or 1 for data supported, * but add 64 for relative refs (ie do not require * reloc @ loadtime, only linkage) */ int32_t offset; /* from start of segment in which reference is loc'd */ - int8_t length; /* 1 2 or 4 bytes */ + char length; /* 1 2 or 4 bytes */ int16 refseg; /* segment to which reference refers to */ }; struct ImportRec { - int8_t type; /* must be 2 */ + char type; /* must be 2 */ int16 segment; /* segment number allocated to the label for reloc * records - label is assumed to be at offset zero * in this segment, so linker must fix up with offset * of segment and of offset within segment */ - int8_t label[33]; /* zero terminated... should be written to file until + char label[33]; /* zero terminated... should be written to file until * the zero, but not after it - max len = 32 chars */ }; struct ExportRec { - int8_t type; /* must be 3 */ - int8_t segment; /* segment referred to (0/1) */ + char type; /* must be 3 */ + char segment; /* segment referred to (0/1) */ int32_t offset; /* offset within segment */ - int8_t label[33]; /* zero terminated as above. max len = 32 chars */ + char label[33]; /* zero terminated as above. max len = 32 chars */ }; struct DLLRec { - int8_t type; /* must be 4 */ - int8_t libname[128]; /* name of library to link with at load time */ + char type; /* must be 4 */ + char libname[128]; /* name of library to link with at load time */ }; struct BSSRec { - int8_t type; /* must be 5 */ + char type; /* must be 5 */ int32_t amount; /* number of bytes BSS to reserve */ }; @@ -87,7 +87,7 @@ struct BSSRec { typedef struct memorybuffer { int length; - int8_t buffer[BUF_BLOCK_LEN]; + char buffer[BUF_BLOCK_LEN]; struct memorybuffer *next; } memorybuffer; @@ -209,7 +209,7 @@ static void rdf_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) bsslength = 0; } -static int32_t rdf_section_names(int8_t *name, int pass, int *bits) +static int32_t rdf_section_names(char *name, int pass, int *bits) { /* * Default is 32 bits. @@ -275,8 +275,8 @@ static void write_dll_rec(struct DLLRec *r) membufwrite(header, r->libname, strlen(r->libname) + 1); } -static void rdf_deflabel(int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special) +static void rdf_deflabel(char *name, int32_t segment, int32_t offset, + int is_global, char *special) { struct ExportRec r; struct ImportRec ri; @@ -493,7 +493,7 @@ static int32_t rdf_segbase(int32_t segment) return segment; } -static int rdf_directive(int8_t *directive, int8_t *value, int pass) +static int rdf_directive(char *directive, char *value, int pass) { struct DLLRec r; @@ -509,12 +509,12 @@ static int rdf_directive(int8_t *directive, int8_t *value, int pass) return 0; } -static void rdf_filename(int8_t *inname, int8_t *outname, efunc error) +static void rdf_filename(char *inname, char *outname, efunc error) { standard_extension(inname, outname, ".rdf", error); } -static int8_t *rdf_stdmac[] = { +static char *rdf_stdmac[] = { "%define __SECT__ [section .text]", "%imacro library 1+.nolist", "[library %1]", @@ -524,7 +524,7 @@ static int8_t *rdf_stdmac[] = { NULL }; -static int rdf_set_info(enum geninfo type, int8_t **val) +static int rdf_set_info(enum geninfo type, char **val) { return 0; } diff --git a/output/outrdf2.c b/output/outrdf2.c index 62adf9c..15f9b3a 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -28,7 +28,7 @@ #include "rdoff/rdoff.h" /* This signature is written to start of RDOFF files */ -static const int8_t *RDOFF2Id = RDOFF2_SIGNATURE; +static const char *RDOFF2Id = RDOFF2_SIGNATURE; /* Note that whenever a segment is referred to in the RDOFF file, its number * is always half of the segment number that NASM uses to refer to it; this @@ -39,7 +39,7 @@ static const int8_t *RDOFF2Id = RDOFF2_SIGNATURE; #define COUNT_SEGTYPES 9 -static int8_t *segmenttypes[COUNT_SEGTYPES] = { +static char *segmenttypes[COUNT_SEGTYPES] = { "null", "text", "code", "data", "comment", "lcomment", "pcomment", "symdebug", "linedebug" @@ -70,7 +70,7 @@ static FILE *ofile; static efunc error; static struct seginfo { - int8_t *segname; + char *segname; int segnumber; uint16_t segtype; uint16_t segreserved; @@ -127,10 +127,10 @@ static void rdf2_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) headerlength = 0; } -static int32_t rdf2_section_names(int8_t *name, int pass, int *bits) +static int32_t rdf2_section_names(char *name, int pass, int *bits) { int i; - int8_t *p, *q; + char *p, *q; int code = -1; int reserved = 0; @@ -223,7 +223,7 @@ static int32_t rdf2_section_names(int8_t *name, int pass, int *bits) */ static void write_reloc_rec(struct RelocRec *r) { - int8_t buf[4], *b; + char buf[4], *b; if (r->refseg != (uint16_t) NO_SEG && (r->refseg & 1)) /* segment base ref */ r->type = RDFREC_SEGRELOC; @@ -248,7 +248,7 @@ static void write_reloc_rec(struct RelocRec *r) */ static void write_export_rec(struct ExportRec *r) { - int8_t buf[4], *b; + char buf[4], *b; r->segment >>= 1; @@ -265,7 +265,7 @@ static void write_export_rec(struct ExportRec *r) static void write_import_rec(struct ImportRec *r) { - int8_t buf[4], *b; + char buf[4], *b; r->segment >>= 1; @@ -284,7 +284,7 @@ static void write_import_rec(struct ImportRec *r) */ static void write_bss_rec(struct BSSRec *r) { - int8_t buf[4], *b; + char buf[4], *b; saa_wbytes(header, &r->type, 1); saa_wbytes(header, &r->reclen, 1); @@ -299,7 +299,7 @@ static void write_bss_rec(struct BSSRec *r) */ static void write_common_rec(struct CommonRec *r) { - int8_t buf[4], *b; + char buf[4], *b; r->segment >>= 1; @@ -343,15 +343,15 @@ static void write_modname_rec(struct ModRec *r) /* * Handle export, import and common records. */ -static void rdf2_deflabel(int8_t *name, int32_t segment, int32_t offset, - int is_global, int8_t *special) +static void rdf2_deflabel(char *name, int32_t segment, int32_t offset, + int is_global, char *special) { struct ExportRec r; struct ImportRec ri; struct CommonRec ci; static int farsym = 0; static int i; - int8_t symflags = 0; + char symflags = 0; int len; /* Check if the label length is OK */ @@ -462,7 +462,7 @@ static void rdf2_deflabel(int8_t *name, int32_t segment, int32_t offset, static void membufwrite(int segment, const void *data, int bytes) { int i; - int8_t buf[4], *b; + char buf[4], *b; for (i = 0; i < nsegments; i++) { if (segments[i].segnumber == segment) @@ -704,7 +704,7 @@ static int32_t rdf2_segbase(int32_t segment) /* * Handle RDOFF2 specific directives */ -static int rdf2_directive(int8_t *directive, int8_t *value, int pass) +static int rdf2_directive(char *directive, char *value, int pass) { int n; @@ -739,12 +739,12 @@ static int rdf2_directive(int8_t *directive, int8_t *value, int pass) return 0; } -static void rdf2_filename(int8_t *inname, int8_t *outname, efunc error) +static void rdf2_filename(char *inname, char *outname, efunc error) { standard_extension(inname, outname, ".rdf", error); } -static const int8_t *rdf2_stdmac[] = { +static const char *rdf2_stdmac[] = { "%define __SECT__ [section .text]", "%imacro library 1+.nolist", "[library %1]", @@ -757,7 +757,7 @@ static const int8_t *rdf2_stdmac[] = { NULL }; -static int rdf2_set_info(enum geninfo type, int8_t **val) +static int rdf2_set_info(enum geninfo type, char **val) { return 0; } @@ -46,7 +46,7 @@ void parser_global_info(struct ofmt *output, loc_t * locp) location = locp; } -insn *parse_line(int pass, int8_t *buffer, insn * result, +insn *parse_line(int pass, char *buffer, insn * result, efunc errfunc, evalfunc evaluate, ldfunc ldef) { int operand; @@ -220,7 +220,7 @@ insn *parse_line(int pass, int8_t *buffer, insn * result, int32_t sign = +1L; if (i == '-') { - int8_t *save = stdscan_bufptr; + char *save = stdscan_bufptr; i = stdscan(NULL, &tokval); sign = -1L; if (i != TOKEN_FLOAT || !is_comma_next()) { @@ -253,7 +253,7 @@ insn *parse_line(int pass, int8_t *buffer, insn * result, nasm_realloc(eop, sizeof(extop) + eop->stringlen); tail = &eop->next; *fixptr = eop; - eop->stringval = (int8_t *)eop + sizeof(extop); + eop->stringval = (char *)eop + sizeof(extop); if (eop->stringlen < 4 || !float_const(tokval.t_charptr, sign, (uint8_t *)eop->stringval, @@ -757,7 +757,7 @@ insn *parse_line(int pass, int8_t *buffer, insn * result, static int is_comma_next(void) { - int8_t *p; + char *p; int i; struct tokenval tv; @@ -11,7 +11,7 @@ #define NASM_PARSER_H void parser_global_info(struct ofmt *output, loc_t * locp); -insn *parse_line(int pass, int8_t *buffer, insn * result, +insn *parse_line(int pass, char *buffer, insn * result, efunc error, evalfunc evaluate, ldfunc ldef); void cleanup_insn(insn * instruction); @@ -61,7 +61,7 @@ typedef struct IncPath IncPath; */ struct SMacro { SMacro *next; - int8_t *name; + char *name; int casesense; int nparam; int in_progress; @@ -87,7 +87,7 @@ struct SMacro { */ struct MMacro { MMacro *next; - int8_t *name; + char *name; int casesense; int64_t nparam_min, nparam_max; int plus; /* is the last parameter greedy? */ @@ -113,7 +113,7 @@ struct MMacro { struct Context { Context *next; SMacro *localmac; - int8_t *name; + char *name; uint32_t number; }; @@ -138,7 +138,7 @@ struct Context { */ struct Token { Token *next; - int8_t *text; + char *text; SMacro *mac; /* associated macro for TOK_SMAC_END */ int type; }; @@ -185,7 +185,7 @@ struct Include { FILE *fp; Cond *conds; Line *expansion; - int8_t *fname; + char *fname; int lineno, lineinc; MMacro *mstk; /* stack of active macros/reps */ }; @@ -197,7 +197,7 @@ struct Include { */ struct IncPath { IncPath *next; - int8_t *path; + char *path; }; /* @@ -251,7 +251,7 @@ enum { * we treat CXZ and ECXZ as condition codes, albeit non-invertible * ones, so we need a different enum... */ -static const int8_t *conditions[] = { +static const char *conditions[] = { "a", "ae", "b", "be", "c", "cxz", "e", "ecxz", "g", "ge", "l", "le", "na", "nae", "nb", "nbe", "nc", "ne", "ng", "nge", "nl", "nle", "no", "np", "ns", "nz", "o", "p", "pe", "po", "s", "z" @@ -270,7 +270,7 @@ static int inverse_ccs[] = { /* * Directive names. */ -static const int8_t *directives[] = { +static const char *directives[] = { "%arg", "%assign", "%clear", "%define", "%elif", "%elifctx", "%elifdef", "%elifid", "%elifidn", "%elifidni", "%elifmacro", "%elifnctx", @@ -331,13 +331,13 @@ enum { TM_IFNDEF, TM_INCLUDE, TM_LOCAL }; -static const int8_t *tasm_directives[] = { +static const char *tasm_directives[] = { "arg", "elif", "else", "endif", "if", "ifdef", "ifdifi", "ifndef", "include", "local" }; static int StackSize = 4; -static int8_t *StackPointer = "ebp"; +static char *StackPointer = "ebp"; static int ArgOffset = 8; static int LocalOffset = 4; @@ -385,17 +385,17 @@ static MMacro *defining; #define PARAM_DELTA 16 /* - * The standard macro set: defined as `static int8_t *stdmac[]'. Also + * The standard macro set: defined as `static char *stdmac[]'. Also * gives our position in the macro set, when we're processing it. */ #include "macros.c" -static const int8_t **stdmacpos; +static const char **stdmacpos; /* * The extra standard macros that come from the object format, if * any. */ -static const int8_t **extrastdmac = NULL; +static const char **extrastdmac = NULL; int any_extrastdmac; /* @@ -416,12 +416,12 @@ static Blocks blocks = { NULL, NULL }; static Token *expand_mmac_params(Token * tline); static Token *expand_smacro(Token * tline); static Token *expand_id(Token * tline); -static Context *get_ctx(int8_t *name, int all_contexts); +static Context *get_ctx(char *name, int all_contexts); static void make_tok_num(Token * tok, int32_t val); -static void error(int severity, const int8_t *fmt, ...); +static void error(int severity, const char *fmt, ...); static void *new_Block(size_t size); static void delete_Blocks(void); -static Token *new_Token(Token * next, int type, int8_t *text, int txtlen); +static Token *new_Token(Token * next, int type, char *text, int txtlen); static Token *delete_Token(Token * t); /* @@ -437,10 +437,10 @@ static Token *delete_Token(Token * t); * place to do it for the moment, and it is a hack (ideally it would * be nice to be able to use the NASM pre-processor to do it). */ -static int8_t *check_tasm_directive(int8_t *line) +static char *check_tasm_directive(char *line) { int32_t i, j, k, m, len; - int8_t *p = line, *oldline, oldchar; + char *p = line, *oldline, oldchar; /* Skip whitespace */ while (isspace(*p) && *p != 0) @@ -495,10 +495,10 @@ static int8_t *check_tasm_directive(int8_t *line) * flags') into NASM preprocessor line number indications (`%line * lineno file'). */ -static int8_t *prepreproc(int8_t *line) +static char *prepreproc(char *line) { int lineno, fnlen; - int8_t *fname, *oldline; + char *fname, *oldline; if (line[0] == '#' && line[1] == ' ') { oldline = line; @@ -523,7 +523,7 @@ static int8_t *prepreproc(int8_t *line) * invariant under case changes. We implement this by applying a * perfectly normal hash function to the uppercase of the string. */ -static int hash(int8_t *s) +static int hash(char *s) { unsigned int h = 0; int i = 0; @@ -609,14 +609,14 @@ static void ctx_pop(void) * return lines from the standard macro set if this has not already * been done. */ -static int8_t *read_line(void) +static char *read_line(void) { - int8_t *buffer, *p, *q; + char *buffer, *p, *q; int bufsize, continued_count; if (stdmacpos) { if (*stdmacpos) { - int8_t *ret = nasm_strdup(*stdmacpos++); + char *ret = nasm_strdup(*stdmacpos++); if (!*stdmacpos && any_extrastdmac) { stdmacpos = extrastdmac; any_extrastdmac = FALSE; @@ -718,9 +718,9 @@ static int8_t *read_line(void) * don't need to parse the value out of e.g. numeric tokens: we * simply split one string into many. */ -static Token *tokenize(int8_t *line) +static Token *tokenize(char *line) { - int8_t *p = line; + char *p = line; int type; Token *list = NULL; Token *t, **tail = &list; @@ -769,7 +769,7 @@ static Token *tokenize(int8_t *line) /* * A string token. */ - int8_t c = *p; + char c = *p; p++; type = TOK_STRING; while (*p && *p != c) @@ -814,7 +814,7 @@ static Token *tokenize(int8_t *line) * Anything else is an operator of some kind. We check * for all the double-character operators (>>, <<, //, * %%, <=, >=, ==, !=, <>, &&, ||, ^^), but anything - * else is a single-int8_tacter operator. + * else is a single-character operator. */ type = TOK_OTHER; if ((p[0] == '>' && p[1] == '>') || @@ -900,7 +900,7 @@ static void delete_Blocks(void) * back to the caller. It sets the type and text elements, and * also the mac and next elements to NULL. */ -static Token *new_Token(Token * next, int type, int8_t *text, int txtlen) +static Token *new_Token(Token * next, int type, char *text, int txtlen) { Token *t; int i; @@ -942,16 +942,16 @@ static Token *delete_Token(Token * t) * If expand_locals is not zero, identifiers of the form "%$*xxx" * will be transformed into ..@ctxnum.xxx */ -static int8_t *detoken(Token * tlist, int expand_locals) +static char *detoken(Token * tlist, int expand_locals) { Token *t; int len; - int8_t *line, *p; + char *line, *p; len = 0; for (t = tlist; t; t = t->next) { if (t->type == TOK_PREPROC_ID && t->text[1] == '!') { - int8_t *p = getenv(t->text + 2); + char *p = getenv(t->text + 2); nasm_free(t->text); if (p) t->text = nasm_strdup(p); @@ -964,8 +964,8 @@ static int8_t *detoken(Token * tlist, int expand_locals) t->text[0] == '%' && t->text[1] == '$') { Context *ctx = get_ctx(t->text, FALSE); if (ctx) { - int8_t buffer[40]; - int8_t *p, *q = t->text + 2; + char buffer[40]; + char *p, *q = t->text + 2; q += strspn(q, "$"); snprintf(buffer, sizeof(buffer), "..@%lu.", ctx->number); @@ -1050,7 +1050,7 @@ static int ppscan(void *private_data, struct tokenval *tokval) if (tline->type == TOK_STRING) { int rn_warn; - int8_t q, *r; + char q, *r; int l; r = tline->text; @@ -1105,7 +1105,7 @@ static int ppscan(void *private_data, struct tokenval *tokval) * simple wrapper which calls either strcmp or nasm_stricmp * depending on the value of the `casesense' parameter. */ -static int mstrcmp(int8_t *p, int8_t *q, int casesense) +static int mstrcmp(char *p, char *q, int casesense) { return casesense ? strcmp(p, q) : nasm_stricmp(p, q); } @@ -1120,7 +1120,7 @@ static int mstrcmp(int8_t *p, int8_t *q, int casesense) * only the context that directly results from the number of $'s * in variable's name. */ -static Context *get_ctx(int8_t *name, int all_contexts) +static Context *get_ctx(char *name, int all_contexts) { Context *ctx; SMacro *m; @@ -1167,10 +1167,10 @@ static Context *get_ctx(int8_t *name, int all_contexts) * the include path one by one until it finds the file or reaches * the end of the path. */ -static FILE *inc_fopen(int8_t *file) +static FILE *inc_fopen(char *file) { FILE *fp; - int8_t *prefix = "", *combine; + char *prefix = "", *combine; IncPath *ip = ipath; static int namelen = 0; int len = strlen(file); @@ -1223,7 +1223,7 @@ static FILE *inc_fopen(int8_t *file) * is true, macro will be searched in outer contexts as well. */ static int -smacro_defined(Context * ctx, int8_t *name, int nparam, SMacro ** defn, +smacro_defined(Context * ctx, char *name, int nparam, SMacro ** defn, int nocase) { SMacro *m; @@ -1586,7 +1586,7 @@ static int if_condition(Token * tline, int i) * First tokenize the string, apply "expand_smacro" and then de-tokenize back. * The returned variable should ALWAYS be freed after usage. */ -void expand_macros_in_string(int8_t **p) +void expand_macros_in_string(char **p) { Token *line = tokenize(*p); line = expand_smacro(line); @@ -1610,7 +1610,7 @@ static int do_directive(Token * tline) int i, j, nparam, nolist; int64_t k, m; int offset; - int8_t *p, *mname; + char *p, *mname; Include *inc; Context *ctx; Cond *cond; @@ -1735,7 +1735,7 @@ static int do_directive(Token * tline) */ offset = ArgOffset; do { - int8_t *arg, directive[256]; + char *arg, directive[256]; int size = StackSize; /* Find the argument name */ @@ -1814,7 +1814,7 @@ static int do_directive(Token * tline) */ offset = LocalOffset; do { - int8_t *local, directive[256]; + char *local, directive[256]; int size = StackSize; /* Find the argument name */ @@ -2870,9 +2870,9 @@ static Token *expand_mmac_params(Token * tline) (((tline->text[1] == '+' || tline->text[1] == '-') && tline->text[2]) || tline->text[1] == '%' || (tline->text[1] >= '0' && tline->text[1] <= '9'))) { - int8_t *text = NULL; + char *text = NULL; int type = 0, cc; /* type = 0 to placate optimisers */ - int8_t tmpbuf[30]; + char tmpbuf[30]; int n, i; MMacro *mac; @@ -2996,7 +2996,7 @@ static Token *expand_mmac_params(Token * tline) break; case TOK_ID: if (tt->type == TOK_ID || tt->type == TOK_NUMBER) { - int8_t *tmp = nasm_strcat(t->text, tt->text); + char *tmp = nasm_strcat(t->text, tt->text); nasm_free(t->text); t->text = tmp; t->next = delete_Token(tt); @@ -3004,7 +3004,7 @@ static Token *expand_mmac_params(Token * tline) break; case TOK_NUMBER: if (tt->type == TOK_NUMBER) { - int8_t *tmp = nasm_strcat(t->text, tt->text); + char *tmp = nasm_strcat(t->text, tt->text); nasm_free(t->text); t->text = tmp; t->next = delete_Token(tt); @@ -3031,7 +3031,7 @@ static Token *expand_smacro(Token * tline) int nparam, sparam, brackets, rescan; Token *org_tline = tline; Context *ctx; - int8_t *mname; + char *mname; /* * Trick: we should avoid changing the start token pointer since it can @@ -3168,7 +3168,7 @@ static Token *expand_smacro(Token * tline) } if (tline->type == TOK_OTHER && tline->text[1] == 0) { - int8_t ch = tline->text[0]; + char ch = tline->text[0]; if (ch == ',' && !paren && brackets <= 0) { if (++nparam >= sparam) { sparam += PARAM_DELTA; @@ -3317,7 +3317,7 @@ static Token *expand_smacro(Token * tline) if (t->next->type == TOK_ID || t->next->type == TOK_PREPROC_ID || t->next->type == TOK_NUMBER) { - int8_t *p = nasm_strcat(t->text, t->next->text); + char *p = nasm_strcat(t->text, t->next->text); nasm_free(t->text); t->next = delete_Token(t->next); t->text = p; @@ -3686,10 +3686,10 @@ static int expand_mmacro(Token * tline) * won't want to see same error twice (preprocessing is done once * per pass) we will want to show errors only during pass one. */ -static void error(int severity, const int8_t *fmt, ...) +static void error(int severity, const char *fmt, ...) { va_list arg; - int8_t buff[1024]; + char buff[1024]; /* If we're in a dead branch of IF or something like it, ignore the error */ if (istk && istk->conds && !emitting(istk->conds->state)) @@ -3707,7 +3707,7 @@ static void error(int severity, const int8_t *fmt, ...) } static void -pp_reset(int8_t *file, int apass, efunc errfunc, evalfunc eval, +pp_reset(char *file, int apass, efunc errfunc, evalfunc eval, ListGen * listgen) { int h; @@ -3744,9 +3744,9 @@ pp_reset(int8_t *file, int apass, efunc errfunc, evalfunc eval, pass = apass; } -static int8_t *pp_getline(void) +static char *pp_getline(void) { - int8_t *line; + char *line; Token *tline; while (1) { @@ -3840,7 +3840,7 @@ static int8_t *pp_getline(void) while (1) { /* until we get a line we can use */ if (istk->expansion) { /* from a macro expansion */ - int8_t *p; + char *p; Line *l = istk->expansion; if (istk->mstk) istk->mstk->lineno++; @@ -3989,7 +3989,7 @@ static void pp_cleanup(int pass) } } -void pp_include_path(int8_t *path) +void pp_include_path(char *path) { IncPath *i; /* by alexfru: order of path inclusion fixed (was reverse order) */ @@ -4021,11 +4021,11 @@ void pp_include_path(int8_t *path) * The function use is simple: * * The 1st call (with NULL argument) returns a pointer to the 1st path - * (int8_t** type) or NULL if none include paths available. + * (char** type) or NULL if none include paths available. * * All subsequent calls take as argument the value returned by this * function last. The return value is either the next path - * (int8_t** type) or NULL if the end of the paths list is reached. + * (char** type) or NULL if the end of the paths list is reached. * * It is maybe not the best way to do things, but I didn't want * to export too much, just one or two functions and no types or @@ -4034,7 +4034,7 @@ void pp_include_path(int8_t *path) * Can't say I like the current situation with e.g. this path list either, * it seems to be never deallocated after creation... */ -int8_t **pp_get_include_path_ptr(int8_t **pPrevPath) +char **pp_get_include_path_ptr(char **pPrevPath) { /* This macro returns offset of a member of a structure */ #define GetMemberOffset(StructType,MemberName)\ @@ -4047,7 +4047,7 @@ int8_t **pp_get_include_path_ptr(int8_t **pPrevPath) else return NULL; } - i = (IncPath *) ((int8_t *)pPrevPath - GetMemberOffset(IncPath, path)); + i = (IncPath *) ((char *)pPrevPath - GetMemberOffset(IncPath, path)); i = i->next; if (i != NULL) return &i->path; @@ -4056,7 +4056,7 @@ int8_t **pp_get_include_path_ptr(int8_t **pPrevPath) #undef GetMemberOffset } -void pp_pre_include(int8_t *fname) +void pp_pre_include(char *fname) { Token *inc, *space, *name; Line *l; @@ -4072,11 +4072,11 @@ void pp_pre_include(int8_t *fname) predef = l; } -void pp_pre_define(int8_t *definition) +void pp_pre_define(char *definition) { Token *def, *space; Line *l; - int8_t *equals; + char *equals; equals = strchr(definition, '='); space = new_Token(NULL, TOK_WHITESPACE, NULL, 0); @@ -4094,7 +4094,7 @@ void pp_pre_define(int8_t *definition) predef = l; } -void pp_pre_undefine(int8_t *definition) +void pp_pre_undefine(char *definition) { Token *def, *space; Line *l; @@ -4120,7 +4120,7 @@ void pp_pre_undefine(int8_t *definition) * PASS A VALID STRING TO THIS FUNCTION!!!!! */ -void pp_runtime(int8_t *definition) +void pp_runtime(char *definition) { Token *def; @@ -4130,14 +4130,14 @@ void pp_runtime(int8_t *definition) } -void pp_extra_stdmac(const int8_t **macros) +void pp_extra_stdmac(const char **macros) { extrastdmac = macros; } static void make_tok_num(Token * tok, int32_t val) { - int8_t numbuf[20]; + char numbuf[20]; snprintf(numbuf, sizeof(numbuf), "%ld", val); tok->text = nasm_strdup(numbuf); tok->type = TOK_NUMBER; @@ -9,13 +9,13 @@ #ifndef NASM_PREPROC_H #define NASM_PREPROC_H -void pp_include_path(int8_t *); -int8_t **pp_get_include_path_ptr(int8_t **pPrevPath); -void pp_pre_include(int8_t *); -void pp_pre_define(int8_t *); -void pp_pre_undefine(int8_t *); -void pp_runtime(int8_t *); -void pp_extra_stdmac(const int8_t **); +void pp_include_path(char *); +char **pp_get_include_path_ptr(char **pPrevPath); +void pp_pre_include(char *); +void pp_pre_define(char *); +void pp_pre_undefine(char *); +void pp_runtime(char *); +void pp_extra_stdmac(const char **); extern Preproc nasmpp; diff --git a/rdoff/ldrdf.c b/rdoff/ldrdf.c index eeafeaf..a8e6b05 100644 --- a/rdoff/ldrdf.c +++ b/rdoff/ldrdf.c @@ -55,7 +55,7 @@ struct modulenode { struct segment_infonode seginfo[RDF_MAXSEGS]; /* what are we doing with each segment? */ void *header; - int8_t *name; + char *name; struct modulenode *next; int32_t bss_reloc; }; @@ -69,11 +69,11 @@ struct modulenode { * Function prototypes of private utility functions */ -void processmodule(const int8_t *filename, struct modulenode *mod); +void processmodule(const char *filename, struct modulenode *mod); int allocnewseg(uint16_t type, uint16_t reserved); int findsegment(uint16_t type, uint16_t reserved); -void symtab_add(const int8_t *symbol, int segment, int32_t offset); -int symtab_get(const int8_t *symbol, int *segment, int32_t *offset); +void symtab_add(const char *symbol, int segment, int32_t offset); +int symtab_get(const char *symbol, int *segment, int32_t *offset); /* ========================================================================= * Global data structures. @@ -91,13 +91,13 @@ struct librarynode *lastlib = NULL; void *symtab = NULL; /* objects search path */ -int8_t *objpath = NULL; +char *objpath = NULL; /* libraries search path */ -int8_t *libpath = NULL; +char *libpath = NULL; /* file to embed as a generic record */ -int8_t *generic_rec_file = NULL; +char *generic_rec_file = NULL; /* error file */ static FILE *error_file; @@ -157,11 +157,11 @@ void initsegments() /* * loadmodule * - * Determine the int8_tacteristics of a module, and decide what to do with + * Determine the characteristics of a module, and decide what to do with * each segment it contains (including determining destination segments and * relocation factors for segments that are kept). */ -void loadmodule(const int8_t *filename) +void loadmodule(const char *filename) { if (options.verbose) printf("loading `%s'\n", filename); @@ -207,7 +207,7 @@ void loadmodule(const int8_t *filename) * (b) is fairly easy, because we're now keeping track of how big each * segment in our output file is... */ -void processmodule(const int8_t *filename, struct modulenode *mod) +void processmodule(const char *filename, struct modulenode *mod) { struct segconfig sconf; int seg, outseg; @@ -395,7 +395,7 @@ void processmodule(const int8_t *filename, struct modulenode *mod) /* * Return 1 if a given module is in the list, 0 otherwise. */ -int lookformodule(const int8_t *name) +int lookformodule(const char *name) { struct modulenode *curr = modules; @@ -457,7 +457,7 @@ int findsegment(uint16_t type, uint16_t reserved) * routine won't change a previously existing symbol. It will change * to segment = -2 only if the segment was previously < 0. */ -void symtab_add(const int8_t *symbol, int segment, int32_t offset) +void symtab_add(const char *symbol, int segment, int32_t offset) { symtabEnt *ste; @@ -509,7 +509,7 @@ void symtab_add(const int8_t *symbol, int segment, int32_t offset) * are assumed to have -1:0 associated. Returns 1 if the symbol was * successfully located. */ -int symtab_get(const int8_t *symbol, int *segment, int32_t *offset) +int symtab_get(const char *symbol, int *segment, int32_t *offset) { symtabEnt *ste = symtabFind(symtab, symbol); if (!ste) { @@ -529,7 +529,7 @@ int symtab_get(const int8_t *symbol, int *segment, int32_t *offset) * checks that a library can be opened and is in the correct format, * then adds it to the linked list of libraries. */ -void add_library(const int8_t *name) +void add_library(const char *name) { if (rdl_verify(name)) { rdl_perror("ldrdf", name); @@ -675,7 +675,7 @@ int search_libraries() * all the modules into a single output module, and then writes this to a * file. */ -void write_output(const int8_t *filename) +void write_output(const char *filename) { FILE *f; rdf_headerbuf *rdfheader; @@ -885,7 +885,7 @@ void write_output(const int8_t *filename) "warning: relocation out of range " "at %s(%02x:%08lx)\n", cur->name, (int)hr->r.segment, hr->r.offset); - *data = (int8_t)offset; + *data = (char)offset; break; case 2: offset += *(int16_t *)data; @@ -1140,9 +1140,9 @@ void usage() int main(int argc, char **argv) { - int8_t *outname = "aout.rdf"; + char *outname = "aout.rdf"; int moduleloaded = 0; - int8_t *respstrings[128] = { 0, }; + char *respstrings[128] = { 0, }; options.verbose = 0; options.align = 16; @@ -1217,7 +1217,7 @@ int main(int argc, char **argv) } case '@':{ int i = 0; - int8_t buf[256]; + char buf[256]; FILE *f; options.respfile = 1; @@ -1237,7 +1237,7 @@ int main(int argc, char **argv) argv++, argc--; while (fgets(buf, sizeof(buf), f) != NULL) { - int8_t *p; + char *p; if (buf[0] == '\n') continue; if ((p = strchr(buf, '\n')) != NULL) diff --git a/rdoff/ldsegs.h b/rdoff/ldsegs.h index 83ce71b..7050376 100644 --- a/rdoff/ldsegs.h +++ b/rdoff/ldsegs.h @@ -10,7 +10,7 @@ struct segconfig { uint16_t typelow, typehi; /* range of seg nos for which this is valid */ - int8_t *typedesc; /* a description of the segment type */ + char *typedesc; /* a description of the segment type */ uint16_t dowhat; /* one of the SEG_xxxx values below */ uint16_t mergetype; /* if SEG_MERGE what type segment do we merge with? diff --git a/rdoff/rdf2bin.c b/rdoff/rdf2bin.c index 8807088..2dc6862 100644 --- a/rdoff/rdf2bin.c +++ b/rdoff/rdf2bin.c @@ -12,10 +12,10 @@ int32_t origin = 0; int align = 16; -int8_t *getfilename(int8_t *pathname) +char *getfilename(char *pathname) { - int8_t *lastslash = pathname - 1; - int8_t *i = pathname; + char *lastslash = pathname - 1; + char *i = pathname; while (*i) { if (*i == '/') @@ -30,7 +30,7 @@ int main(int argc, char **argv) rdfmodule *m; int tmp; FILE *of; - int8_t *padding; + char *padding; int codepad, datapad, bsspad = 0; if (argc < 2) { diff --git a/rdoff/rdf2ihx.c b/rdoff/rdf2ihx.c index dca54d4..ef87115 100644 --- a/rdoff/rdf2ihx.c +++ b/rdoff/rdf2ihx.c @@ -45,7 +45,7 @@ int main(int argc, char **argv) rdfmodule *m; int tmp; FILE *of; - int8_t *padding; + char *padding; uint8_t *segbin[2]; int pad[2], segn, ofs, i; int32_t segaddr; diff --git a/rdoff/rdfdump.c b/rdoff/rdfdump.c index 96c5a36..d4e29d6 100644 --- a/rdoff/rdfdump.c +++ b/rdoff/rdfdump.c @@ -16,7 +16,7 @@ FILE *infile; void print_header(int32_t length, int rdf_version) { - int8_t buf[129], t, l, s, flags; + char buf[129], t, l, s, flags; uint8_t reclen; int32_t o, ll; uint16_t rs; @@ -164,7 +164,7 @@ void print_header(int32_t length, int rdf_version) int main(int argc, char **argv) { - int8_t id[7]; + char id[7]; int32_t l; uint16_t s; int verbose = 0; diff --git a/rdoff/rdflib.c b/rdoff/rdflib.c index 8295877..9070e7c 100644 --- a/rdoff/rdflib.c +++ b/rdoff/rdflib.c @@ -3,7 +3,7 @@ /* * an rdoff library is simply a sequence of RDOFF object files, each * preceded by the name of the module, an ASCII string of up to 255 - * int8_tacters, terminated by a zero. + * characters, terminated by a zero. * * When a library is being created, special signature block is placed * in the beginning of the file. It is a string 'RDLIB' followed by a @@ -52,7 +52,7 @@ const char *usage = " d - delete (module-name)\n" " t - list\n"; /* Library signature */ -const int8_t *rdl_signature = "RDLIB2", *sig_modname = ".sig"; +const char *rdl_signature = "RDLIB2", *sig_modname = ".sig"; char **_argv; @@ -73,7 +73,7 @@ static void int32_ttolocal(int32_t *l) #endif } -int8_t copybytes(FILE * fp, FILE * fp2, int n) +char copybytes(FILE * fp, FILE * fp2, int n) { int i, t = 0; @@ -90,7 +90,7 @@ int8_t copybytes(FILE * fp, FILE * fp2, int n) exit(1); } } - return (int8_t)t; /* return last int8_t read */ + return (char)t; /* return last char read */ } int32_t copyint32_t(FILE * fp, FILE * fp2) @@ -120,11 +120,11 @@ int32_t copyint32_t(FILE * fp, FILE * fp2) int main(int argc, char **argv) { FILE *fp, *fp2 = NULL, *fptmp; - int8_t *p, buf[256], c; + char *p, buf[256], c; int i; int32_t l; time_t t; - int8_t rdbuf[10]; + char rdbuf[10]; _argv = argv; @@ -209,7 +209,7 @@ int main(int argc, char **argv) while (!feof(fp)) { /* read name */ p = buf; - while ((*(p++) = (int8_t)fgetc(fp))) + while ((*(p++) = (char)fgetc(fp))) if (feof(fp)) break; @@ -321,7 +321,7 @@ int main(int argc, char **argv) while (!feof(fptmp)) { /* read name */ p = buf; - while ((*(p++) = (int8_t)fgetc(fptmp))) + while ((*(p++) = (char)fgetc(fptmp))) if (feof(fptmp)) break; diff --git a/rdoff/rdfload.c b/rdoff/rdfload.c index a7a059f..cd24c2d 100644 --- a/rdoff/rdfload.c +++ b/rdoff/rdfload.c @@ -27,11 +27,11 @@ extern int rdf_errno; -rdfmodule *rdfload(const int8_t *filename) +rdfmodule *rdfload(const char *filename) { rdfmodule *f; int32_t bsslength = 0; - int8_t *hdr; + char *hdr; rdfheaderrec *r; f = malloc(sizeof(rdfmodule)); @@ -150,7 +150,7 @@ int rdf_relocate(rdfmodule * m) non-portable */ switch (r->r.length) { case 1: - seg[r->r.offset] += (int8_t)rel; + seg[r->r.offset] += (char)rel; break; case 2: *(uint16_t *) (seg + r->r.offset) += (uint16_t) rel; diff --git a/rdoff/rdfload.h b/rdoff/rdfload.h index 6802ed1..5e6ffba 100644 --- a/rdoff/rdfload.h +++ b/rdoff/rdfload.h @@ -25,7 +25,7 @@ typedef struct RDFModuleStruct { void *symtab; } rdfmodule; -rdfmodule *rdfload(const int8_t *filename); +rdfmodule *rdfload(const char *filename); int rdf_relocate(rdfmodule * m); #endif diff --git a/rdoff/rdlar.c b/rdoff/rdlar.c index 5eeb1aa..07a2a16 100644 --- a/rdoff/rdlar.c +++ b/rdoff/rdlar.c @@ -22,12 +22,12 @@ typedef enum { FALSE, TRUE } bool; /** Constants **/ -const int8_t commands[] = "adnrtx"; -const int8_t modifiers[] = "cflouvV"; +const char commands[] = "adnrtx"; +const char modifiers[] = "cflouvV"; /** Global variables **/ -int8_t *progname = "rdlar"; -int8_t **_argv = NULL; +char *progname = "rdlar"; +char **_argv = NULL; struct { bool createok; bool usefname; @@ -96,7 +96,7 @@ void usage(void) /* * Print an error message and exit */ -void error_exit(int errcode, bool useperror, const int8_t *fmt, ...) +void error_exit(int errcode, bool useperror, const char *fmt, ...) { va_list ap; @@ -113,7 +113,7 @@ void error_exit(int errcode, bool useperror, const int8_t *fmt, ...) /* * Fill in and write a header */ -void put_header(struct rdlm_hdr *hdr, FILE * libfp, int8_t *modname) +void put_header(struct rdlm_hdr *hdr, FILE * libfp, char *modname) { int n = 0; @@ -128,9 +128,9 @@ void put_header(struct rdlm_hdr *hdr, FILE * libfp, int8_t *modname) } /* - * Copy n bytes from one file to another and return last int8_tacter read. + * Copy n bytes from one file to another and return last character read. */ -int8_t copybytes(FILE * fp, FILE * fp2, int n) +char copybytes(FILE * fp, FILE * fp2, int n) { int i, t = 0; @@ -143,7 +143,7 @@ int8_t copybytes(FILE * fp, FILE * fp2, int n) if (fputc(t, fp2) == EOF) error_exit(1, FALSE, "write error"); } - return (int8_t)t; + return (char)t; } /* @@ -173,7 +173,7 @@ int32_t copyint32_t(FILE * fp, FILE * fp2) /* * Create a new library */ -int create_library(int8_t *libname) +int create_library(char *libname) { FILE *libfp; struct rdlm_hdr hdr; @@ -200,7 +200,7 @@ int create_library(int8_t *libname) /* * Add a module to the library */ -int add_module(FILE * libfp, const int8_t *fname, int8_t *modname) +int add_module(FILE * libfp, const char *fname, char *modname) { FILE *modfp; struct rdlm_hdr hdr = { RDLMMAG, 0, 0, 0, 0, 0, 0 }; @@ -246,8 +246,8 @@ int main(int argc, char **argv) FILE *libfp, *tmpfp, *modfp = NULL; struct stat finfo; struct rdlm_hdr hdr; - int8_t buf[MAXMODNAMELEN], *p = NULL; - int8_t c; + char buf[MAXMODNAMELEN], *p = NULL; + char c; int i; progname = argv[0]; @@ -368,7 +368,7 @@ int main(int argc, char **argv) if (options.verbose) { printf("%ld bytes", hdr.size); } - putint8_t('\n'); + putchar('\n'); } copybytes(libfp, modfp, hdr.size); diff --git a/rdoff/rdlib.c b/rdoff/rdlib.c index 8f13d1d..c094a56 100644 --- a/rdoff/rdlib.c +++ b/rdoff/rdlib.c @@ -16,19 +16,19 @@ int rdl_error = 0; -int8_t *rdl_errors[5] = { +char *rdl_errors[5] = { "no error", "could not open file", "invalid file structure", "file contains modules of an unsupported RDOFF version", "module not found" }; -int rdl_verify(const int8_t *filename) +int rdl_verify(const char *filename) { FILE *fp = fopen(filename, "rb"); - int8_t buf[257]; + char buf[257]; int i; int32_t length; - static int8_t lastverified[256]; + static char lastverified[256]; static int lastresult = -1; if (lastresult != -1 && !strcmp(filename, lastverified)) @@ -51,7 +51,7 @@ int rdl_verify(const int8_t *filename) /* * A special module, eg a signature block or a directory. * Format of such a module is defined to be: - * six int8_t type identifier + * six char type identifier * int32_t count bytes content * content * so we can handle it uniformaly with RDOFF2 modules. @@ -75,7 +75,7 @@ int rdl_verify(const int8_t *filename) return lastresult = 0; /* library in correct format */ } -int rdl_open(struct librarynode *lib, const int8_t *name) +int rdl_open(struct librarynode *lib, const char *name) { int i = rdl_verify(name); if (i) @@ -95,9 +95,9 @@ void rdl_close(struct librarynode *lib) free(lib->name); } -int rdl_searchlib(struct librarynode *lib, const int8_t *label, rdffile * f) +int rdl_searchlib(struct librarynode *lib, const char *label, rdffile * f) { - int8_t buf[512]; + char buf[512]; int i, t; void *hdr; rdfheaderrec *r; @@ -182,7 +182,7 @@ int rdl_searchlib(struct librarynode *lib, const int8_t *label, rdffile * f) int rdl_openmodule(struct librarynode *lib, int moduleno, rdffile * f) { - int8_t buf[512]; + char buf[512]; int i, cmod, t; int32_t length; @@ -251,7 +251,7 @@ int rdl_openmodule(struct librarynode *lib, int moduleno, rdffile * f) return rdl_error = 4; /* module not found */ } -void rdl_perror(const int8_t *apname, const int8_t *filename) +void rdl_perror(const char *apname, const char *filename) { if (rdl_error >= 16) rdfperror(apname, filename); diff --git a/rdoff/rdlib.h b/rdoff/rdlib.h index c051da7..17978d4 100644 --- a/rdoff/rdlib.h +++ b/rdoff/rdlib.h @@ -19,11 +19,11 @@ extern int rdl_error; #define RDL_EVERSION 3 #define RDL_ENOTFOUND 4 -int rdl_verify(const int8_t *filename); -int rdl_open(struct librarynode *lib, const int8_t *filename); -int rdl_searchlib(struct librarynode *lib, const int8_t *label, rdffile * f); +int rdl_verify(const char *filename); +int rdl_open(struct librarynode *lib, const char *filename); +int rdl_searchlib(struct librarynode *lib, const char *label, rdffile * f); int rdl_openmodule(struct librarynode *lib, int module, rdffile * f); -void rdl_perror(const int8_t *apname, const int8_t *filename); +void rdl_perror(const char *apname, const char *filename); #endif diff --git a/rdoff/rdoff.c b/rdoff/rdoff.c index c564467..9bbfd29 100644 --- a/rdoff/rdoff.c +++ b/rdoff/rdoff.c @@ -164,14 +164,14 @@ uint16_t translateint16_t(uint16_t in) } /* Segment types */ -static int8_t *knownsegtypes[8] = { +static char *knownsegtypes[8] = { "NULL", "text", "data", "object comment", "linked comment", "loader comment", "symbolic debug", "line number debug" }; /* Get a textual string describing the segment type */ -int8_t *translatesegmenttype(uint16_t type) +char *translatesegmenttype(uint16_t type) { if (type < 8) return knownsegtypes[type]; @@ -189,10 +189,10 @@ int8_t *translatesegmenttype(uint16_t type) } /* This signature is written to the start of RDOFF files */ -const int8_t *RDOFFId = RDOFF2_SIGNATURE; +const char *RDOFFId = RDOFF2_SIGNATURE; /* Error messages. Must correspond to the codes defined in rdoff.h */ -const int8_t *rdf_errors[11] = { +const char *rdf_errors[11] = { /* 0 */ "no error occurred", /* 1 */ "could not open file", /* 2 */ "invalid file format", @@ -212,7 +212,7 @@ int rdf_errno = 0; The library functions ======================================================================== */ -int rdfopen(rdffile * f, const int8_t *name) +int rdfopen(rdffile * f, const char *name) { FILE *fp; @@ -223,9 +223,9 @@ int rdfopen(rdffile * f, const int8_t *name) return rdfopenhere(f, fp, NULL, name); } -int rdfopenhere(rdffile * f, FILE * fp, int *refcount, const int8_t *name) +int rdfopenhere(rdffile * f, FILE * fp, int *refcount, const char *name) { - int8_t buf[8]; + char buf[8]; int32_t initpos; int32_t l; uint16_t s; @@ -322,7 +322,7 @@ int rdfclose(rdffile * f) /* * Print the message for last error (from rdf_errno) */ -void rdfperror(const int8_t *app, const int8_t *name) +void rdfperror(const char *app, const char *name) { fprintf(stderr, "%s:%s: %s\n", app, name, rdf_errors[rdf_errno]); if (rdf_errno == RDF_ERR_OPEN || rdf_errno == RDF_ERR_READ) { diff --git a/rdoff/rdoff.h b/rdoff/rdoff.h index 7cb0363..dc23f2b 100644 --- a/rdoff/rdoff.h +++ b/rdoff/rdoff.h @@ -55,7 +55,7 @@ struct GenericRec { uint8_t type; uint8_t reclen; - int8_t data[128]; + char data[128]; }; /* @@ -83,7 +83,7 @@ struct ImportRec { records - label is assumed to be at offset zero in this segment, so linker must fix up with offset of segment and of offset within segment */ - int8_t label[EXIM_LABEL_MAX]; /* zero terminated, should be written to file + char label[EXIM_LABEL_MAX]; /* zero terminated, should be written to file until the zero, but not after it */ }; @@ -96,7 +96,7 @@ struct ExportRec { uint8_t flags; /* SYM_* flags (see below) */ uint8_t segment; /* segment referred to (0/1/2) */ int32_t offset; /* offset within segment */ - int8_t label[EXIM_LABEL_MAX]; /* zero terminated as in import */ + char label[EXIM_LABEL_MAX]; /* zero terminated as in import */ }; /* @@ -105,7 +105,7 @@ struct ExportRec { struct DLLRec { uint8_t type; /* must be 4 */ uint8_t reclen; /* content length */ - int8_t libname[MODLIB_NAME_MAX]; /* name of library to link with at load time */ + char libname[MODLIB_NAME_MAX]; /* name of library to link with at load time */ }; /* @@ -123,7 +123,7 @@ struct BSSRec { struct ModRec { uint8_t type; /* must be 8 */ uint8_t reclen; /* content length */ - int8_t modname[MODLIB_NAME_MAX]; /* module name */ + char modname[MODLIB_NAME_MAX]; /* module name */ }; /* @@ -135,7 +135,7 @@ struct CommonRec { uint16_t segment; /* segment number */ int32_t size; /* size of common variable */ uint16_t align; /* alignment (power of two) */ - int8_t label[EXIM_LABEL_MAX]; /* zero terminated as in import */ + char label[EXIM_LABEL_MAX]; /* zero terminated as in import */ }; /* Flags for ExportRec */ @@ -154,7 +154,7 @@ extern char *strdup(const char *); #endif typedef union RDFHeaderRec { - int8_t type; /* invariant throughout all below */ + char type; /* invariant throughout all below */ struct GenericRec g; /* type 0 */ struct RelocRec r; /* type == 1 / 6 */ struct ImportRec i; /* type == 2 / 7 */ @@ -192,7 +192,7 @@ typedef struct RDFFileInfo { int32_t eof_offset; /* offset of the first uint8_t beyond the end of this module */ - int8_t *name; /* name of module in libraries */ + char *name; /* name of module in libraries */ int *refcount; /* pointer to reference count on file, or NULL */ } rdffile; @@ -239,17 +239,17 @@ enum { /* utility functions */ int32_t translateint32_t(int32_t in); uint16_t translateint16_t(uint16_t in); -int8_t *translatesegmenttype(uint16_t type); +char *translatesegmenttype(uint16_t type); /* RDOFF file manipulation functions */ -int rdfopen(rdffile * f, const int8_t *name); -int rdfopenhere(rdffile * f, FILE * fp, int *refcount, const int8_t *name); +int rdfopen(rdffile * f, const char *name); +int rdfopenhere(rdffile * f, FILE * fp, int *refcount, const char *name); int rdfclose(rdffile * f); int rdffindsegment(rdffile * f, int segno); int rdfloadseg(rdffile * f, int segment, void *buffer); rdfheaderrec *rdfgetheaderrec(rdffile * f); /* returns static storage */ void rdfheaderrewind(rdffile * f); /* back to start of header */ -void rdfperror(const int8_t *app, const int8_t *name); +void rdfperror(const char *app, const char *name); /* functions to write a new RDOFF header to a file - use rdfnewheader to allocate a header, rdfaddheader to add records to it, diff --git a/rdoff/symtab.c b/rdoff/symtab.c index d05cf18..8d8ac62 100644 --- a/rdoff/symtab.c +++ b/rdoff/symtab.c @@ -82,7 +82,7 @@ void symtabInsert(void *stab, symtabEnt * ent) } /* ------------------------------------- */ -symtabEnt *symtabFind(void *stab, const int8_t *name) +symtabEnt *symtabFind(void *stab, const char *name) { symtab mytab = (symtab) stab; int slot = slotnum(name); @@ -103,7 +103,7 @@ void symtabDump(void *stab, FILE * of) { symtab mytab = (symtab) stab; int i; - int8_t *SegNames[3] = { "code", "data", "bss" }; + char *SegNames[3] = { "code", "data", "bss" }; fprintf(of, "Symbol table is ...\n"); for (i = 0; i < SYMTABSIZE; ++i) { diff --git a/rdoff/symtab.h b/rdoff/symtab.h index ca8c694..6a79ee2 100644 --- a/rdoff/symtab.h +++ b/rdoff/symtab.h @@ -12,7 +12,7 @@ #include <inttypes.h> typedef struct { - int8_t *name; + char *name; int segment; int32_t offset; int32_t flags; @@ -21,7 +21,7 @@ typedef struct { void *symtabNew(void); void symtabDone(void *symtab); void symtabInsert(void *symtab, symtabEnt * ent); -symtabEnt *symtabFind(void *symtab, const int8_t *name); +symtabEnt *symtabFind(void *symtab, const char *name); void symtabDump(void *symtab, FILE * of); #endif @@ -71,7 +71,7 @@ if ( $fmt eq 'h' ) { } elsif ( $fmt eq 'c' ) { # Output regs.c print "/* automatically generated from $file - do not edit */\n"; - print "static const int8_t *reg_names[] = "; $ch = '{'; + print "static const char *reg_names[] = "; $ch = '{'; # This one has no dummy entry for 0 foreach $reg ( sort(keys(%regs)) ) { print "$ch\n \"${reg}\""; |