Change to use stdint's implementation independent types rather than short and

long (which vary depending on whether you're on a 64-bit system or not).
This commit is contained in:
David Given 2012-09-27 10:54:41 +01:00
parent 7ef9b79c11
commit 2beb3646a7

53
h/out.h
View file

@ -6,19 +6,22 @@
#ifndef __OUT_H_INCLUDED #ifndef __OUT_H_INCLUDED
#define __OUT_H_INCLUDED #define __OUT_H_INCLUDED
#include <stdint.h>
/* /*
* output format for ACK assemblers * output format for ACK assemblers
*/ */
struct outhead { struct outhead {
unsigned short oh_magic; /* magic number */ uint16_t oh_magic; /* magic number */
unsigned short oh_stamp; /* version stamp */ uint16_t oh_stamp; /* version stamp */
unsigned short oh_flags; /* several format flags */ uint16_t oh_flags; /* several format flags */
unsigned short oh_nsect; /* number of outsect structures */ uint16_t oh_nsect; /* number of outsect structures */
unsigned short oh_nrelo; /* number of outrelo structures */ uint16_t oh_nrelo; /* number of outrelo structures */
unsigned short oh_nname; /* number of outname structures */ uint16_t oh_nname; /* number of outname structures */
long oh_nemit; /* sum of all os_flen */ uint32_t oh_nemit; /* sum of all os_flen */
long oh_nchar; /* size of string area */ uint32_t oh_nchar; /* size of string area */
}; };
#define O_MAGIC 0x0201 /* magic number of output file */ #define O_MAGIC 0x0201 /* magic number of output file */
@ -29,30 +32,30 @@ struct outhead {
#define HF_8086 0x0008 /* os_base specially encoded */ #define HF_8086 0x0008 /* os_base specially encoded */
struct outsect { struct outsect {
long os_base; /* startaddress in machine */ uint32_t os_base; /* startaddress in machine */
long os_size; /* section size in machine */ uint32_t os_size; /* section size in machine */
long os_foff; /* startaddress in file */ uint32_t os_foff; /* startaddress in file */
long os_flen; /* section size in file */ uint32_t os_flen; /* section size in file */
long os_lign; /* section alignment */ uint32_t os_lign; /* section alignment */
}; };
struct outrelo { struct outrelo {
char or_type; /* type of reference */ int8_t or_type; /* type of reference */
char or_sect; /* referencing section */ int8_t or_sect; /* referencing section */
unsigned short or_nami; /* referenced symbol index */ uint16_t or_nami; /* referenced symbol index */
long or_addr; /* referencing address */ uint32_t or_addr; /* referencing address */
}; };
struct outname { struct outname {
union { union {
char *on_ptr; /* symbol name (in core) */ int8_t *on_ptr; /* symbol name (in core) */
long on_off; /* symbol name (in file) */ uint32_t on_off; /* symbol name (in file) */
} on_u; } on_u;
#define on_mptr on_u.on_ptr #define on_mptr on_u.on_ptr
#define on_foff on_u.on_off #define on_foff on_u.on_off
unsigned short on_type; /* symbol type */ uint16_t on_type; /* symbol type */
unsigned short on_desc; /* debug info */ uint16_t on_desc; /* debug info */
long on_valu; /* symbol value */ uint32_t on_valu; /* symbol value */
}; };
/* /*
@ -115,9 +118,9 @@ struct outname {
*/ */
#define BADMAGIC(x) ((x).oh_magic!=O_MAGIC) #define BADMAGIC(x) ((x).oh_magic!=O_MAGIC)
#define OFF_SECT(x) SZ_HEAD #define OFF_SECT(x) SZ_HEAD
#define OFF_EMIT(x) (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT)) #define OFF_EMIT(x) (OFF_SECT(x) + ((uint32_t)(x).oh_nsect * SZ_SECT))
#define OFF_RELO(x) (OFF_EMIT(x) + (x).oh_nemit) #define OFF_RELO(x) (OFF_EMIT(x) + (x).oh_nemit)
#define OFF_NAME(x) (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO)) #define OFF_NAME(x) (OFF_RELO(x) + ((uint32_t)(x).oh_nrelo * SZ_RELO))
#define OFF_CHAR(x) (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME)) #define OFF_CHAR(x) (OFF_NAME(x) + ((uint32_t)(x).oh_nname * SZ_NAME))
#endif /* __OUT_H_INCLUDED */ #endif /* __OUT_H_INCLUDED */