X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=symbol.h;h=f985b1bb23322b29873443a3b0ed79f34a88b2cc;hp=899ba6aa13fa2ec90688ea5c8d74e90b73cf31b3;hb=66b362fa203d0850e8dce8045adb454e354c22ce;hpb=d28f432296e812643e236d1bfc9b556a7b11c461 diff --git a/symbol.h b/symbol.h index 899ba6a..f985b1b 100644 --- a/symbol.h +++ b/symbol.h @@ -1,30 +1,57 @@ -//////////////////////////////////////////////////////////////////////////////////////////////////// -// RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System +// +// RMAC - Reboot's Macro Assembler for all Atari computers // SYMBOL.H - Symbol Handling -// Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends +// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986 -// Source Utilised with the Kind Permission of Landon Dyer +// Source utilised with the kind permission of Landon Dyer +// #ifndef __SYMBOL_H__ #define __SYMBOL_H__ -#include "rmac.h" +#include -// Macros -#define NBUCKETS 256 // Number of hash buckets (power of 2) +// Line lists +#define LLIST struct _llist +LLIST +{ + LLIST * next; + uint8_t * line; + int lineno; +}; -// Globals, externals etc +// Symbols +#define SYM struct _sym +SYM +{ + SYM * snext; // * -> Next symbol on hash-chain + SYM * sorder; // * -> Next sym in order of reference + SYM * sdecl; // * -> Next sym in order of declaration + uint8_t stype; // Symbol type + uint16_t sattr; // Attribute bits + uint32_t sattre; // Extended attribute bits + uint16_t senv; // Enviroment number + uint64_t svalue; // Symbol value (now 64-bit) + uint8_t * sname; // * -> Symbol's print-name + LLIST * lineList; // * -> Macro's linked list of lines + LLIST * last; // * -> end of macro linked list + uint32_t uid; // Symbol's unique ID +}; + +// Exported variables extern int curenv; -extern char subttl[]; - -// Prototypes -SYM *lookup(char *, int, int); -void init_sym(void); -SYM *newsym(char *, int, int); -char *nstring(char *); -void sym_decl(SYM *); -int syg_fix(void); +extern uint32_t firstglobal;// Index of the fist global symbol in an ELF object. + +// Exported functions +SYM * lookup(uint8_t *, int, int); +void InitSymbolTable(void); +SYM * NewSymbol(uint8_t *, int, int); +void AddToSymbolDeclarationList(SYM *); +void ForceUndefinedSymbolsGlobal(void); int symtable(void); -int sy_assign(char *, char *(*)()); +uint32_t sy_assign(uint8_t *, uint8_t *(*)()); +uint32_t sy_assign_ELF(uint8_t *, uint8_t *(*)()); +uint8_t * GetSymbolNameByUID(uint32_t); + +#endif // __SYMBOL_H__ -#endif // __SYMBOL_H__ \ No newline at end of file