parent
301a6db92c
commit
7e672d79f8
|
@ -27,18 +27,7 @@
|
||||||
#ifndef EMBRYO_CC_AMX_H
|
#ifndef EMBRYO_CC_AMX_H
|
||||||
#define EMBRYO_CC_AMX_H
|
#define EMBRYO_CC_AMX_H
|
||||||
|
|
||||||
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
|
|
||||||
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
|
|
||||||
* here, these types are probably undefined.
|
|
||||||
*/
|
|
||||||
# ifdef HAVE_INTTYPES_H
|
|
||||||
#include <inttypes.h>
|
|
||||||
# else
|
|
||||||
# ifndef HAVE_STDINT_H
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* calling convention for all interface functions and callback functions */
|
/* calling convention for all interface functions and callback functions */
|
||||||
|
|
||||||
|
@ -58,8 +47,8 @@
|
||||||
|
|
||||||
#if !defined CELL_TYPE
|
#if !defined CELL_TYPE
|
||||||
#define CELL_TYPE
|
#define CELL_TYPE
|
||||||
typedef uint32_t ucell;
|
typedef unsigned int ucell;
|
||||||
typedef int32_t cell;
|
typedef int cell;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct tagAMX;
|
struct tagAMX;
|
||||||
|
@ -81,7 +70,7 @@
|
||||||
|
|
||||||
typedef struct tagAMX_FUNCSTUB
|
typedef struct tagAMX_FUNCSTUB
|
||||||
{
|
{
|
||||||
uint32_t address ;
|
unsigned int address;
|
||||||
char name[sEXPMAX + 1];
|
char name[sEXPMAX + 1];
|
||||||
} AMX_FUNCSTUB __attribute__((packed));
|
} AMX_FUNCSTUB __attribute__((packed));
|
||||||
|
|
||||||
|
@ -127,23 +116,23 @@
|
||||||
*/
|
*/
|
||||||
typedef struct tagAMX_HEADER
|
typedef struct tagAMX_HEADER
|
||||||
{
|
{
|
||||||
int32_t size ; /* size of the "file" */
|
int size ; /* size of the "file" */
|
||||||
uint16_t magic ; /* signature */
|
unsigned short magic ; /* signature */
|
||||||
char file_version ; /* file format version */
|
char file_version ; /* file format version */
|
||||||
char amx_version ; /* required version of the AMX */
|
char amx_version ; /* required version of the AMX */
|
||||||
int16_t flags ;
|
unsigned short flags ;
|
||||||
int16_t defsize ; /* size of a definition record */
|
unsigned short defsize ; /* size of a definition record */
|
||||||
int32_t cod ; /* initial value of COD - code block */
|
int cod ; /* initial value of COD - code block */
|
||||||
int32_t dat ; /* initial value of DAT - data block */
|
int dat ; /* initial value of DAT - data block */
|
||||||
int32_t hea ; /* initial value of HEA - start of the heap */
|
int hea ; /* initial value of HEA - start of the heap */
|
||||||
int32_t stp ; /* initial value of STP - stack top */
|
int stp ; /* initial value of STP - stack top */
|
||||||
int32_t cip ; /* initial value of CIP - the instruction pointer */
|
int cip ; /* initial value of CIP - the instruction pointer */
|
||||||
int32_t publics ; /* offset to the "public functions" table */
|
int publics ; /* offset to the "public functions" table */
|
||||||
int32_t natives ; /* offset to the "native functions" table */
|
int natives ; /* offset to the "native functions" table */
|
||||||
int32_t libraries ; /* offset to the table of libraries */
|
int libraries ; /* offset to the table of libraries */
|
||||||
int32_t pubvars ; /* the "public variables" table */
|
int pubvars ; /* the "public variables" table */
|
||||||
int32_t tags ; /* the "public tagnames" table */
|
int tags ; /* the "public tagnames" table */
|
||||||
int32_t nametable ; /* name table, file version 7 only */
|
int nametable ; /* name table, file version 7 only */
|
||||||
} AMX_HEADER __attribute__((packed));
|
} AMX_HEADER __attribute__((packed));
|
||||||
#define AMX_MAGIC 0xf1e0
|
#define AMX_MAGIC 0xf1e0
|
||||||
|
|
||||||
|
@ -223,8 +212,8 @@
|
||||||
else (result) = NULL; \
|
else (result) = NULL; \
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t *amx_Align16(uint16_t * v);
|
unsigned short *amx_Align16(unsigned short * v);
|
||||||
uint32_t *amx_Align32(uint32_t * v);
|
unsigned int *amx_Align32(unsigned int * v);
|
||||||
int amx_Allot(AMX * amx, int cells, cell * amx_addr,
|
int amx_Allot(AMX * amx, int cells, cell * amx_addr,
|
||||||
cell ** phys_addr);
|
cell ** phys_addr);
|
||||||
int amx_Callback(AMX * amx, cell index, cell * result,
|
int amx_Callback(AMX * amx, cell index, cell * result,
|
||||||
|
@ -241,7 +230,7 @@
|
||||||
int amx_FindPubVar(AMX * amx, char *varname,
|
int amx_FindPubVar(AMX * amx, char *varname,
|
||||||
cell * amx_addr);
|
cell * amx_addr);
|
||||||
int amx_FindTagId(AMX * amx, cell tag_id, char *tagname);
|
int amx_FindTagId(AMX * amx, cell tag_id, char *tagname);
|
||||||
int amx_Flags(AMX * amx, uint16_t * flags);
|
int amx_Flags(AMX * amx, unsigned short * flags);
|
||||||
int amx_GetAddr(AMX * amx, cell amx_addr, cell ** phys_addr);
|
int amx_GetAddr(AMX * amx, cell amx_addr, cell ** phys_addr);
|
||||||
int amx_GetNative(AMX * amx, int index, char *funcname);
|
int amx_GetNative(AMX * amx, int index, char *funcname);
|
||||||
int amx_GetPublic(AMX * amx, int index, char *funcname);
|
int amx_GetPublic(AMX * amx, int index, char *funcname);
|
||||||
|
|
|
@ -106,7 +106,7 @@ typedef struct __s_symbol
|
||||||
struct __s_symbol *next;
|
struct __s_symbol *next;
|
||||||
struct __s_symbol *parent; /* hierarchical types (multi-dimensional arrays) */
|
struct __s_symbol *parent; /* hierarchical types (multi-dimensional arrays) */
|
||||||
char name[sNAMEMAX + 1];
|
char name[sNAMEMAX + 1];
|
||||||
uint32_t hash; /* value derived from name, for quicker searching */
|
unsigned int hash; /* value derived from name, for quicker searching */
|
||||||
cell addr; /* address or offset (or value for constant, index for native function) */
|
cell addr; /* address or offset (or value for constant, index for native function) */
|
||||||
char vclass; /* sLOCAL if "addr" refers to a local symbol */
|
char vclass; /* sLOCAL if "addr" refers to a local symbol */
|
||||||
char ident; /* see below for possible values */
|
char ident; /* see below for possible values */
|
||||||
|
@ -472,7 +472,7 @@ void delete_symbols(symbol * root, int level, int del_labels,
|
||||||
int delete_functions);
|
int delete_functions);
|
||||||
int refer_symbol(symbol * entry, symbol * bywhom);
|
int refer_symbol(symbol * entry, symbol * bywhom);
|
||||||
void markusage(symbol * sym, int usage);
|
void markusage(symbol * sym, int usage);
|
||||||
uint32_t namehash(char *name);
|
unsigned int namehash(char *name);
|
||||||
symbol *findglb(char *name);
|
symbol *findglb(char *name);
|
||||||
symbol *findloc(char *name);
|
symbol *findloc(char *name);
|
||||||
symbol *findconst(char *name);
|
symbol *findconst(char *name);
|
||||||
|
|
|
@ -2467,7 +2467,7 @@ delete_symbols(symbol * root, int level, int delete_labels,
|
||||||
* comparison (which is costly). There is little interest in avoiding
|
* comparison (which is costly). There is little interest in avoiding
|
||||||
* clusters in similar names, which is why this function is plain simple.
|
* clusters in similar names, which is why this function is plain simple.
|
||||||
*/
|
*/
|
||||||
SC_FUNC uint32_t
|
SC_FUNC unsigned int
|
||||||
namehash(char *name)
|
namehash(char *name)
|
||||||
{
|
{
|
||||||
unsigned char *ptr = (unsigned char *)name;
|
unsigned char *ptr = (unsigned char *)name;
|
||||||
|
|
|
@ -634,7 +634,7 @@ assemble(FILE * fout, FILE * fin)
|
||||||
{
|
{
|
||||||
typedef struct tagFUNCSTUB
|
typedef struct tagFUNCSTUB
|
||||||
{
|
{
|
||||||
uint32_t address, nameofs;
|
unsigned int address, nameofs;
|
||||||
} FUNCSTUB;
|
} FUNCSTUB;
|
||||||
AMX_HEADER hdr;
|
AMX_HEADER hdr;
|
||||||
FUNCSTUB func;
|
FUNCSTUB func;
|
||||||
|
@ -643,7 +643,7 @@ assemble(FILE * fout, FILE * fin)
|
||||||
long nametablesize, nameofs;
|
long nametablesize, nameofs;
|
||||||
char line[256], *instr, *params;
|
char line[256], *instr, *params;
|
||||||
int i, pass;
|
int i, pass;
|
||||||
int16_t count;
|
short count;
|
||||||
symbol *sym, **nativelist;
|
symbol *sym, **nativelist;
|
||||||
constvalue *constptr;
|
constvalue *constptr;
|
||||||
cell mainaddr;
|
cell mainaddr;
|
||||||
|
@ -663,7 +663,7 @@ assemble(FILE * fout, FILE * fin)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
writeerror = FALSE;
|
writeerror = FALSE;
|
||||||
nametablesize = sizeof(int16_t);
|
nametablesize = sizeof(short);
|
||||||
numpublics = 0;
|
numpublics = 0;
|
||||||
numnatives = 0;
|
numnatives = 0;
|
||||||
numpubvars = 0;
|
numpubvars = 0;
|
||||||
|
@ -798,7 +798,7 @@ assemble(FILE * fout, FILE * fin)
|
||||||
/* dump zeros up to the rest of the header, so that we can easily "seek" */
|
/* dump zeros up to the rest of the header, so that we can easily "seek" */
|
||||||
for (nameofs = sizeof hdr; nameofs < cod; nameofs++)
|
for (nameofs = sizeof hdr; nameofs < cod; nameofs++)
|
||||||
putc(0, fout);
|
putc(0, fout);
|
||||||
nameofs = nametable + sizeof(int16_t);
|
nameofs = nametable + sizeof(short);
|
||||||
|
|
||||||
/* write the public functions table */
|
/* write the public functions table */
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
Loading…
Reference in New Issue