mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-19 18:00:23 +08:00
Remove obsolete types; add <inttypes.h> where needed; header fixes
- Remove obsolete types like "uint32"; use "uint32_t" consistently. - Make sure we include <inttypes.h> where needed. - Header file guards should be FOO_H or SUBDIR_FOO_H; _FOO_H infringes on the C implementation's namespace and should only be used when writing libc! - Change a few "int8_t" back to "char" where appropriate. There are a lot more places where that should be done, though. - Clean up the check for getuid/getgid in rdoff/rdlar.h.
This commit is contained in:
parent
2030bd21f4
commit
038d861ede
@ -118,6 +118,9 @@ if test $ac_cv_func_snprintf = no; then
|
||||
AC_MSG_ERROR([NASM requires ISO C99 (specifically, "vsnprintf")])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(getuid)
|
||||
AC_CHECK_FUNCS(getgid)
|
||||
|
||||
if test $ac_cv_prog_make_vpathok = no; then
|
||||
echo Copying generated srcs into build directory to compensate for VPATH breakage
|
||||
for file in macros.c insnsa.c insnsd.c insnsn.c insnsi.h version.h version.mac; do
|
||||
|
2
nasm.c
2
nasm.c
@ -149,7 +149,7 @@ static void nasm_fputs(const int8_t *line, FILE * outfile)
|
||||
puts(line);
|
||||
}
|
||||
|
||||
int main(int argc, int8_t **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
pass0 = 1;
|
||||
want_usage = terminate_after_phase = FALSE;
|
||||
|
@ -36,7 +36,7 @@ static const int8_t *help =
|
||||
static void output_ins(uint32_t, uint8_t *, int, int8_t *);
|
||||
static void skip(uint32_t dist, FILE * fp);
|
||||
|
||||
int main(int argc, int8_t **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
uint8_t buffer[INSN_MAX * 2], *p, *q;
|
||||
int8_t outbuf[256];
|
||||
|
@ -72,8 +72,8 @@ static efunc error;
|
||||
static struct seginfo {
|
||||
int8_t *segname;
|
||||
int segnumber;
|
||||
uint16 segtype;
|
||||
uint16 segreserved;
|
||||
uint16_t segtype;
|
||||
uint16_t segreserved;
|
||||
int32_t seglength;
|
||||
} segments[RDF_MAXSEGS];
|
||||
|
||||
@ -225,7 +225,7 @@ static void write_reloc_rec(struct RelocRec *r)
|
||||
{
|
||||
int8_t buf[4], *b;
|
||||
|
||||
if (r->refseg != (uint16) NO_SEG && (r->refseg & 1)) /* segment base ref */
|
||||
if (r->refseg != (uint16_t) NO_SEG && (r->refseg & 1)) /* segment base ref */
|
||||
r->type = RDFREC_SEGRELOC;
|
||||
|
||||
r->refseg >>= 1; /* adjust segment nos to RDF rather than NASM */
|
||||
@ -351,7 +351,7 @@ static void rdf2_deflabel(int8_t *name, int32_t segment, int32_t offset,
|
||||
struct CommonRec ci;
|
||||
static int farsym = 0;
|
||||
static int i;
|
||||
byte symflags = 0;
|
||||
uint8_t symflags = 0;
|
||||
int len;
|
||||
|
||||
/* Check if the label length is OK */
|
||||
|
@ -6,8 +6,8 @@
|
||||
* length array (of pointers).
|
||||
*/
|
||||
|
||||
#ifndef _COLLECTN_H
|
||||
#define _COLLECTN_H
|
||||
#ifndef RDOFF_COLLECTN_H
|
||||
#define RDOFF_COLLECTN_H 1
|
||||
|
||||
typedef struct tagCollection {
|
||||
void *p[32]; /* array of pointers to objects */
|
||||
|
13
rdoff/hash.c
13
rdoff/hash.c
@ -12,9 +12,7 @@
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
typedef unsigned int crc32;
|
||||
|
||||
const crc32 consttab[] = {
|
||||
const uint32_t consttab[] = {
|
||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
|
||||
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
|
||||
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
|
||||
@ -81,16 +79,15 @@ const crc32 consttab[] = {
|
||||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
|
||||
};
|
||||
|
||||
unsigned hash(const int8_t *name)
|
||||
uint32_t hash(const char *name)
|
||||
{
|
||||
register const int8_t *n;
|
||||
register crc32 hashval = 0xffffffff;
|
||||
register const char *n;
|
||||
register uint32_t hashval = 0xffffffff;
|
||||
|
||||
for (n = name; *n; n++)
|
||||
hashval = (hashval >> 8) ^ consttab[(hashval ^ *n) & 0xff];
|
||||
|
||||
hashval ^= 0xffffffff;
|
||||
|
||||
return (hashval);
|
||||
|
||||
return hashval;
|
||||
}
|
||||
|
@ -8,4 +8,11 @@
|
||||
* distributed in the NASM archive.
|
||||
*/
|
||||
|
||||
unsigned hash(const int8_t *name);
|
||||
#ifndef RDOFF_HASH_H
|
||||
#define RDOFF_HASH_H 1
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
uint32_t hash(const char *name);
|
||||
|
||||
#endif
|
||||
|
@ -70,8 +70,8 @@ struct modulenode {
|
||||
*/
|
||||
|
||||
void processmodule(const int8_t *filename, struct modulenode *mod);
|
||||
int allocnewseg(uint16 type, uint16 reserved);
|
||||
int findsegment(uint16 type, uint16 reserved);
|
||||
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);
|
||||
|
||||
@ -417,7 +417,7 @@ int lookformodule(const int8_t *name)
|
||||
* a segment of the type requested, and if one isn't found allocates a
|
||||
* new one.
|
||||
*/
|
||||
int allocnewseg(uint16 type, uint16 reserved)
|
||||
int allocnewseg(uint16_t type, uint16_t reserved)
|
||||
{
|
||||
outputseg[nsegs].type = type;
|
||||
outputseg[nsegs].number = nsegs;
|
||||
@ -429,7 +429,7 @@ int allocnewseg(uint16 type, uint16 reserved)
|
||||
return nsegs++;
|
||||
}
|
||||
|
||||
int findsegment(uint16 type, uint16 reserved)
|
||||
int findsegment(uint16_t type, uint16_t reserved)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -686,7 +686,7 @@ void write_output(const int8_t *filename)
|
||||
symtabEnt *se;
|
||||
segtab segs;
|
||||
int32_t offset;
|
||||
byte *data;
|
||||
uint8_t *data;
|
||||
|
||||
if ((f = fopen(filename, "wb")) == NULL) {
|
||||
fprintf(stderr, "ldrdf: couldn't open %s for output\n", filename);
|
||||
@ -1096,7 +1096,7 @@ void write_output(const int8_t *filename)
|
||||
* the output file
|
||||
*/
|
||||
for (i = 0; i < nsegs; i++) {
|
||||
uint16 s;
|
||||
uint16_t s;
|
||||
int32_t l;
|
||||
|
||||
if (i == 2)
|
||||
@ -1138,7 +1138,7 @@ void usage()
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, int8_t **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int8_t *outname = "aout.rdf";
|
||||
int moduleloaded = 0;
|
||||
|
@ -3,15 +3,17 @@
|
||||
* types of segment. This may be useful in other contexts also.
|
||||
*/
|
||||
|
||||
#ifndef UI16
|
||||
#define UI16 uint16_t
|
||||
#endif
|
||||
#ifndef RDOFF_LDSEGS_H
|
||||
#define RDOFF_LDSEGS_H 1
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
struct segconfig {
|
||||
UI16 typelow, typehi; /* range of seg nos for which this is valid */
|
||||
int8_t *typedesc; /* a description of the segment type */
|
||||
UI16 dowhat; /* one of the SEG_xxxx values below */
|
||||
UI16 mergetype; /* if SEG_MERGE what type segment do we merge with?
|
||||
uint16_t typelow, typehi; /* range of seg nos for which this is valid */
|
||||
int8_t *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?
|
||||
0 -> same type of segment. This type is also
|
||||
used with SEG_NEWSEG. */
|
||||
};
|
||||
@ -54,3 +56,5 @@ struct segconfig sconft[SEGCONFIGMAX] = {
|
||||
exit(1); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@ int8_t *getfilename(int8_t *pathname)
|
||||
return lastslash + 1;
|
||||
}
|
||||
|
||||
int main(int argc, int8_t **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
rdfmodule *m;
|
||||
int tmp;
|
||||
|
@ -40,7 +40,7 @@ static int write_data_record(FILE * of, int ofs, int nbytes,
|
||||
return (ofs);
|
||||
}
|
||||
|
||||
int main(int argc, int8_t **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
rdfmodule *m;
|
||||
int tmp;
|
||||
|
@ -19,7 +19,7 @@ void print_header(int32_t length, int rdf_version)
|
||||
int8_t buf[129], t, l, s, flags;
|
||||
uint8_t reclen;
|
||||
int32_t o, ll;
|
||||
uint16 rs;
|
||||
uint16_t rs;
|
||||
|
||||
while (length > 0) {
|
||||
fread(&t, 1, 1, infile);
|
||||
@ -162,11 +162,11 @@ void print_header(int32_t length, int rdf_version)
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, int8_t **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int8_t id[7];
|
||||
int32_t l;
|
||||
uint16 s;
|
||||
uint16_t s;
|
||||
int verbose = 0;
|
||||
int32_t offset;
|
||||
int foundnullsegment = 0;
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
* All module names beginning with '.' are reserved for possible future
|
||||
* extensions. The linker ignores all such modules, assuming they have
|
||||
* the format of a six byte type & version identifier followed by int32_t
|
||||
* the format of a six uint8_t type & version identifier followed by int32_t
|
||||
* content size, followed by data.
|
||||
*/
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@ -40,7 +41,7 @@
|
||||
* list modules
|
||||
*/
|
||||
|
||||
const int8_t *usage =
|
||||
const char *usage =
|
||||
"usage:\n"
|
||||
" rdflib x libname [extra operands]\n\n"
|
||||
" where x is one of:\n"
|
||||
|
@ -153,7 +153,7 @@ int rdf_relocate(rdfmodule * m)
|
||||
seg[r->r.offset] += (int8_t)rel;
|
||||
break;
|
||||
case 2:
|
||||
*(uint16 *) (seg + r->r.offset) += (uint16) rel;
|
||||
*(uint16_t *) (seg + r->r.offset) += (uint16_t) rel;
|
||||
break;
|
||||
case 4:
|
||||
*(int32_t *)(seg + r->r.offset) += rel;
|
||||
|
@ -9,8 +9,8 @@
|
||||
* file.
|
||||
*/
|
||||
|
||||
#ifndef _RDFLOAD_H
|
||||
#define _RDFLOAD_H
|
||||
#ifndef RDOFF_RDFLOAD_H
|
||||
#define RDOFF_RDFLOAD_H 1
|
||||
|
||||
#define RDOFF_UTILS
|
||||
|
||||
|
@ -241,7 +241,7 @@ int add_module(FILE * libfp, const int8_t *fname, int8_t *modname)
|
||||
/*
|
||||
* Main
|
||||
*/
|
||||
int main(int argc, int8_t *argv[])
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *libfp, *tmpfp, *modfp = NULL;
|
||||
struct stat finfo;
|
||||
|
@ -2,13 +2,17 @@
|
||||
* rdlar.h - definitions of new RDOFF library/archive format.
|
||||
*/
|
||||
|
||||
#ifndef _RDLAR_H
|
||||
#define _RDLAR_H
|
||||
#ifndef RDOFF_RDLAR_H
|
||||
#define RDOFF_RDLAR_H 1
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
/* For some MS-DOS C compilers */
|
||||
#define getuid() 0
|
||||
#define getgid() 0
|
||||
#include <inttypes.h>
|
||||
|
||||
/* For non-POSIX operating systems */
|
||||
#ifndef HAVE_GETUID
|
||||
# define getuid() 0
|
||||
#endif
|
||||
#ifndef HAVE_GETGID
|
||||
# define getgid() 0
|
||||
#endif
|
||||
|
||||
#define RDLAMAG 0x414C4452 /* Archive magic */
|
||||
|
@ -2,8 +2,11 @@
|
||||
* rdlib.h Functions for manipulating libraries of RDOFF object files.
|
||||
*/
|
||||
|
||||
#ifndef RDOFF_RDLIB_H
|
||||
#define RDOFF_RDLIB_H 1
|
||||
|
||||
struct librarynode {
|
||||
int8_t *name;
|
||||
char *name;
|
||||
FILE *fp; /* initialised to NULL - always check */
|
||||
int referenced; /* & open if required. Close afterwards */
|
||||
struct librarynode *next; /* if ! referenced. */
|
||||
@ -22,3 +25,5 @@ int rdl_searchlib(struct librarynode *lib, const int8_t *label, rdffile * f);
|
||||
int rdl_openmodule(struct librarynode *lib, int module, rdffile * f);
|
||||
|
||||
void rdl_perror(const int8_t *apname, const int8_t *filename);
|
||||
|
||||
#endif
|
||||
|
@ -57,7 +57,7 @@ memorybuffer *newmembuf()
|
||||
|
||||
void membufwrite(memorybuffer * const b, void *data, int bytes)
|
||||
{
|
||||
uint16 w;
|
||||
uint16_t w;
|
||||
int32_t l;
|
||||
|
||||
if (b->next) { /* memory buffer full - use next buffer */
|
||||
@ -88,7 +88,7 @@ void membufwrite(memorybuffer * const b, void *data, int bytes)
|
||||
break;
|
||||
|
||||
case -2:
|
||||
w = *(uint16 *) data;
|
||||
w = *(uint16_t *) data;
|
||||
b->buffer[b->length++] = w & 0xFF;
|
||||
w >>= 8;
|
||||
b->buffer[b->length++] = w & 0xFF;
|
||||
@ -152,9 +152,9 @@ int32_t translateint32_t(int32_t in)
|
||||
return r;
|
||||
}
|
||||
|
||||
uint16 translateint16_t(uint16 in)
|
||||
uint16_t translateint16_t(uint16_t in)
|
||||
{
|
||||
uint16 r;
|
||||
uint16_t r;
|
||||
uint8_t *i;
|
||||
|
||||
i = (uint8_t *)∈
|
||||
@ -171,7 +171,7 @@ static int8_t *knownsegtypes[8] = {
|
||||
};
|
||||
|
||||
/* Get a textual string describing the segment type */
|
||||
int8_t *translatesegmenttype(uint16 type)
|
||||
int8_t *translatesegmenttype(uint16_t type)
|
||||
{
|
||||
if (type < 8)
|
||||
return knownsegtypes[type];
|
||||
@ -228,7 +228,7 @@ int rdfopenhere(rdffile * f, FILE * fp, int *refcount, const int8_t *name)
|
||||
int8_t buf[8];
|
||||
int32_t initpos;
|
||||
int32_t l;
|
||||
uint16 s;
|
||||
uint16_t s;
|
||||
|
||||
if (translateint32_t(0x01020304) != 0x01020304) {
|
||||
/* fix this to be portable! */
|
||||
@ -354,14 +354,14 @@ int rdfloadseg(rdffile * f, int segment, void *buffer)
|
||||
case RDOFF_HEADER:
|
||||
fpos = f->header_ofs;
|
||||
slen = f->header_len;
|
||||
f->header_loc = (byte *) buffer;
|
||||
f->header_loc = (uint8_t *) buffer;
|
||||
f->header_fp = 0;
|
||||
break;
|
||||
default:
|
||||
if (segment < f->nsegs) {
|
||||
fpos = f->seg[segment].offset;
|
||||
slen = f->seg[segment].length;
|
||||
f->seg[segment].data = (byte *) buffer;
|
||||
f->seg[segment].data = (uint8_t *) buffer;
|
||||
} else {
|
||||
return rdf_errno = RDF_ERR_SEGMENT;
|
||||
}
|
||||
|
@ -11,20 +11,16 @@
|
||||
* with instructions of how to obtain a copy via ftp.
|
||||
*/
|
||||
|
||||
#ifndef _RDOFF_H
|
||||
#define _RDOFF_H
|
||||
#ifndef RDOFF_RDOFF_H
|
||||
#define RDOFF_RDOFF_H 1
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/*
|
||||
* RDOFF definitions. They are used by RDOFF utilities and by NASM's
|
||||
* 'outrdf2.c' output module.
|
||||
*/
|
||||
|
||||
/* Type definitions */
|
||||
typedef uint32_t uint32;
|
||||
typedef uint16_t uint16;
|
||||
typedef uint8_t byte;
|
||||
typedef unsigned int bool;
|
||||
|
||||
/* RDOFF format revision (currently used only when printing the version) */
|
||||
#define RDOFF2_REVISION "0.6.1"
|
||||
|
||||
@ -54,11 +50,11 @@ typedef unsigned int bool;
|
||||
|
||||
/*
|
||||
* Generic record - contains the type and length field, plus a 128 byte
|
||||
* int8_t array 'data'
|
||||
* array 'data'
|
||||
*/
|
||||
struct GenericRec {
|
||||
byte type;
|
||||
byte reclen;
|
||||
uint8_t type;
|
||||
uint8_t reclen;
|
||||
int8_t data[128];
|
||||
};
|
||||
|
||||
@ -66,24 +62,24 @@ struct GenericRec {
|
||||
* Relocation record
|
||||
*/
|
||||
struct RelocRec {
|
||||
byte type; /* must be 1 */
|
||||
byte reclen; /* content length */
|
||||
byte segment; /* only 0 for code, or 1 for data supported,
|
||||
uint8_t type; /* must be 1 */
|
||||
uint8_t reclen; /* content length */
|
||||
uint8_t 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 */
|
||||
byte length; /* 1 2 or 4 bytes */
|
||||
uint16 refseg; /* segment to which reference refers to */
|
||||
uint8_t length; /* 1 2 or 4 bytes */
|
||||
uint16_t refseg; /* segment to which reference refers to */
|
||||
};
|
||||
|
||||
/*
|
||||
* Extern/import record
|
||||
*/
|
||||
struct ImportRec {
|
||||
byte type; /* must be 2 */
|
||||
byte reclen; /* content length */
|
||||
byte flags; /* SYM_* flags (see below) */
|
||||
uint16 segment; /* segment number allocated to the label for reloc
|
||||
uint8_t type; /* must be 2 */
|
||||
uint8_t reclen; /* content length */
|
||||
uint8_t flags; /* SYM_* flags (see below) */
|
||||
uint16_t 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 */
|
||||
@ -95,10 +91,10 @@ struct ImportRec {
|
||||
* Public/export record
|
||||
*/
|
||||
struct ExportRec {
|
||||
byte type; /* must be 3 */
|
||||
byte reclen; /* content length */
|
||||
byte flags; /* SYM_* flags (see below) */
|
||||
byte segment; /* segment referred to (0/1/2) */
|
||||
uint8_t type; /* must be 3 */
|
||||
uint8_t reclen; /* content length */
|
||||
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 */
|
||||
};
|
||||
@ -107,8 +103,8 @@ struct ExportRec {
|
||||
* DLL record
|
||||
*/
|
||||
struct DLLRec {
|
||||
byte type; /* must be 4 */
|
||||
byte reclen; /* content length */
|
||||
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 */
|
||||
};
|
||||
|
||||
@ -116,8 +112,8 @@ struct DLLRec {
|
||||
* BSS record
|
||||
*/
|
||||
struct BSSRec {
|
||||
byte type; /* must be 5 */
|
||||
byte reclen; /* content length */
|
||||
uint8_t type; /* must be 5 */
|
||||
uint8_t reclen; /* content length */
|
||||
int32_t amount; /* number of bytes BSS to reserve */
|
||||
};
|
||||
|
||||
@ -125,8 +121,8 @@ struct BSSRec {
|
||||
* Module name record
|
||||
*/
|
||||
struct ModRec {
|
||||
byte type; /* must be 8 */
|
||||
byte reclen; /* content length */
|
||||
uint8_t type; /* must be 8 */
|
||||
uint8_t reclen; /* content length */
|
||||
int8_t modname[MODLIB_NAME_MAX]; /* module name */
|
||||
};
|
||||
|
||||
@ -134,11 +130,11 @@ struct ModRec {
|
||||
* Common variable record
|
||||
*/
|
||||
struct CommonRec {
|
||||
byte type; /* must be 10 */
|
||||
byte reclen; /* equals 7+label length */
|
||||
uint16 segment; /* segment number */
|
||||
uint8_t type; /* must be 10 */
|
||||
uint8_t reclen; /* equals 7+label length */
|
||||
uint16_t segment; /* segment number */
|
||||
int32_t size; /* size of common variable */
|
||||
uint16 align; /* alignment (power of two) */
|
||||
uint16_t align; /* alignment (power of two) */
|
||||
int8_t label[EXIM_LABEL_MAX]; /* zero terminated as in import */
|
||||
};
|
||||
|
||||
@ -171,14 +167,14 @@ typedef union RDFHeaderRec {
|
||||
|
||||
struct SegmentHeaderRec {
|
||||
/* information from file */
|
||||
uint16 type;
|
||||
uint16 number;
|
||||
uint16 reserved;
|
||||
uint16_t type;
|
||||
uint16_t number;
|
||||
uint16_t reserved;
|
||||
int32_t length;
|
||||
|
||||
/* information built up here */
|
||||
int32_t offset;
|
||||
byte *data; /* pointer to segment data if it exists in memory */
|
||||
uint8_t *data; /* pointer to segment data if it exists in memory */
|
||||
};
|
||||
|
||||
typedef struct RDFFileInfo {
|
||||
@ -187,13 +183,13 @@ typedef struct RDFFileInfo {
|
||||
int32_t header_len;
|
||||
int32_t header_ofs;
|
||||
|
||||
byte *header_loc; /* keep location of header */
|
||||
uint8_t *header_loc; /* keep location of header */
|
||||
int32_t header_fp; /* current location within header for reading */
|
||||
|
||||
struct SegmentHeaderRec seg[RDF_MAXSEGS];
|
||||
int nsegs;
|
||||
|
||||
int32_t eof_offset; /* offset of the first byte beyond the end of this
|
||||
int32_t eof_offset; /* offset of the first uint8_t beyond the end of this
|
||||
module */
|
||||
|
||||
int8_t *name; /* name of module in libraries */
|
||||
@ -204,7 +200,7 @@ typedef struct RDFFileInfo {
|
||||
* on 80x86 machines for efficiency */
|
||||
typedef struct memorybuffer {
|
||||
int length;
|
||||
byte buffer[BUF_BLOCK_LEN];
|
||||
uint8_t buffer[BUF_BLOCK_LEN];
|
||||
struct memorybuffer *next;
|
||||
} memorybuffer;
|
||||
|
||||
@ -242,8 +238,8 @@ enum {
|
||||
|
||||
/* utility functions */
|
||||
int32_t translateint32_t(int32_t in);
|
||||
uint16 translateint16_t(uint16 in);
|
||||
int8_t *translatesegmenttype(uint16 type);
|
||||
uint16_t translateint16_t(uint16_t in);
|
||||
int8_t *translatesegmenttype(uint16_t type);
|
||||
|
||||
/* RDOFF file manipulation functions */
|
||||
int rdfopen(rdffile * f, const int8_t *name);
|
||||
@ -270,4 +266,4 @@ void rdfdoneheader(rdf_headerbuf * h);
|
||||
|
||||
#endif /* RDOFF_UTILS */
|
||||
|
||||
#endif /* _RDOFF_H */
|
||||
#endif /* RDOFF_RDOFF_H */
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include "rdfload.h"
|
||||
#include "symtab.h"
|
||||
|
||||
typedef int (*main_fn) (int, int8_t **); /* Main function prototype */
|
||||
typedef int (*main_fn) (int, char **); /* Main function prototype */
|
||||
|
||||
int main(int argc, int8_t **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
rdfmodule *m;
|
||||
main_fn code;
|
||||
|
@ -1,6 +1,13 @@
|
||||
#ifndef RDOFF_SEGTAB_H
|
||||
#define RDOFF_SEGTAB_H 1
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef void *segtab;
|
||||
|
||||
void init_seglocations(segtab * r);
|
||||
void add_seglocation(segtab * r, int localseg, int destseg, int32_t offset);
|
||||
int get_seglocation(segtab * r, int localseg, int *destseg, int32_t *offset);
|
||||
void done_seglocations(segtab * r);
|
||||
|
||||
#endif
|
||||
|
@ -6,6 +6,11 @@
|
||||
* distributed in the NASM archive.
|
||||
*/
|
||||
|
||||
#ifndef RDOFF_SYMTAB_H
|
||||
#define RDOFF_SYMTAB_H 1
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef struct {
|
||||
int8_t *name;
|
||||
int segment;
|
||||
@ -18,3 +23,5 @@ void symtabDone(void *symtab);
|
||||
void symtabInsert(void *symtab, symtabEnt * ent);
|
||||
symtabEnt *symtabFind(void *symtab, const int8_t *name);
|
||||
void symtabDump(void *symtab, FILE * of);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user