home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
SRC
/
unc.lzh
/
UNC
/
unc.h
< prev
Wrap
Text File
|
1991-06-10
|
4KB
|
165 lines
/*
* SCCS: %W% %G% %U%
* Header file for uncompile program.
*
*EMACS_MODES:c
*/
#include <module.h>
#define LWORD unsigned long
#define WORD unsigned short
#define BYTE unsigned char
#define MAXCHARS 50
#define HASHMOD 97
#ifdef __MAIN__
#define GLOBVAR
#else
#define GLOBVAR extern
#endif /* hcz */
/*
* The following structure is used to keep track of symbols.
*/
struct symstr {
struct symstr *s_next; /* Next in hash chain */
struct symstr *s_link; /* Next in duplicate labels */
unsigned s_type : 3; /* Symbol type */
unsigned s_newsym: 1; /* A new symbol */
unsigned s_invent: 1; /* Invented symbol */
long s_value; /* Value if defined */
short s_defs; /* Defined count */
short s_used; /* Used count */
char s_name[1]; /* Chars of name null term */
};
typedef struct symstr *symbol;
typedef struct {
int ef_t; /* Text file fd */
char *t_name; /* Text filename */
int ef_d; /* Data file fd */
char *d_name; /* Data filename */
int ef_stcnt; /* Number of symbols */
int ef_stmax; /* Max. number of symbols */
symbol *ef_stvec; /* Symbol vector */
} ef_fids;
typedef ef_fids *ef_fid;
/*
* Description of word in text file. This entry is held in the place
* corresponding to the address in the text file.
*/
typedef struct {
unsigned short t_contents; /* Actual contents */
unsigned short t_iindex; /* Index in table */
unsigned t_type : 2; /* Type */
#define T_UNKNOWN 0
#define T_OPCODE 1
#define T_ARGUMENT 2
unsigned t_vins : 1; /* Valid instruction */
unsigned t_bdest : 1; /* Is branch dest */
unsigned t_gbdest: 1; /* Is global dest */
unsigned t_dref : 1; /* Refered to in data */
unsigned t_bchtyp: 2; /* Branch type */
unsigned t_lng : 3; /* Length in words */
unsigned t_amap : 1; /* Worked out */
symbol t_relsymb; /* Relocation symbol */
symbol t_lab; /* Label */
long t_reflo; /* Lowest place referred */
long t_refhi; /* Highest place referred */
} t_entry;
#define R_NONE 0 /* No relocation */
#define R_BYTE 1 /* Byte relocation */
#define R_WORD 2 /* Word relocation */
#define R_LONG 3 /* Long relocation */
/*
* Branch types.
*/
#define T_NOBR 0
#define T_CONDBR 1
#define T_UNBR 2
#define T_JSR 3
typedef struct {
unsigned char d_contents; /* Actual contents */
unsigned d_initialized : 1; /* initialized (from file) */
unsigned d_type : 4; /* Data type */
unsigned d_reloc : 2; /* Relocatable */
unsigned d_rptr : 2; /* Where relocated */
short d_lng; /* Length -ve for D_CONT */
symbol d_relsymb; /* Relocation symbol */
long d_reldisp; /* Offset + or - from symb */
symbol d_lab; /* Label */
} d_entry;
/*
* Data types.
*/
#define D_ASC 0 /* Ascii chars */
#define D_ASCZ 1 /* Null-term ascii */
#define D_BYTE 2 /* Decimal bytes */
#define D_WORD 3 /* Words */
#define D_LONG 4 /* Longs */
#define D_ADDR 5 /* Address pointer */
#define D_CONT 6 /* Continuation of last */
/*
* 'Common' items.
*/
struct commit {
symbol *c_symb; /* List of symbols */
int c_int; /* Current number */
int c_max; /* Maximum */
};
/*
* Library file description.
*/
struct libit {
int lf_fd; /* File descriptor */
long lf_offset; /* Offset of current file */
long lf_next; /* Offset of next file */
char lf_name[14]; /* Name of item */
};
#define PFIRST 20
#define LABEL 0
#define OPCODE 10
#define ARGUMENT 20
#define COMMENT 45
#define STRING 45
#define ISOK 0
#define ISFALSCH 1
#define ISFEHLER -1
/*
* global variables
*/
extern int errno;
GLOBVAR symbol symbhash[HASHMOD];
GLOBVAR mod_exec hdr;
GLOBVAR int popt;
GLOBVAR ef_fids mainfile;
GLOBVAR int xp;
GLOBVAR short ismodule;
GLOBVAR unsigned long a6offset;
GLOBVAR long endp;
GLOBVAR short verbose, ropt, debug, xact;