]> Shamusworld >> Repos - rmac/blob - symbol.h
Version bump for last commit. :-)
[rmac] / symbol.h
1 //
2 // RMAC - Renamed Macro Assembler for all Atari computers
3 // SYMBOL.H - Symbol Handling
4 // Copyright (C) 199x Landon Dyer, 2011-2022 Reboot and Friends
5 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
6 // Source utilised with the kind permission of Landon Dyer
7 //
8
9 #ifndef __SYMBOL_H__
10 #define __SYMBOL_H__
11
12 #include <inttypes.h>
13
14 // Line lists
15 #define LLIST struct _llist
16 LLIST
17 {
18         LLIST * next;
19         uint8_t * line;
20         int lineno;
21 };
22
23 // Symbols
24 #define SYM struct _sym
25 SYM
26 {
27         SYM * snext;                    // * -> Next symbol on hash-chain
28         SYM * sorder;                   // * -> Next sym in order of reference
29         SYM * sdecl;                    // * -> Next sym in order of declaration
30         uint8_t stype;                  // Symbol type
31         uint16_t sattr;                 // Attribute bits
32         uint32_t sattre;                // Extended attribute bits
33         uint16_t senv;                  // Enviroment number
34         uint64_t svalue;                // Symbol value (now 64-bit)
35         uint8_t * sname;                // * -> Symbol's print-name
36         LLIST * lineList;               // * -> Macro's linked list of lines
37         LLIST * last;                   // * -> end of macro linked list
38         uint16_t cfileno;               // File the macro is defined in
39         uint32_t uid;                   // Symbol's unique ID
40         uint8_t st_type;                // stabs debug symbol's "type" field
41         uint8_t st_other;               // stabs debug symbol's "other" field
42         uint16_t st_desc;               // stabs debug symbol's "description" field
43 };
44
45 // Exported variables
46 extern int curenv;
47 extern uint32_t firstglobal;// Index of the fist global symbol in an ELF object.
48
49 // Exported functions
50 SYM * lookup(uint8_t *, int, int);
51 void InitSymbolTable(void);
52 SYM * NewSymbol(const uint8_t *, int, int);
53 void AddToSymbolDeclarationList(SYM *);
54 void ForceUndefinedSymbolsGlobal(void);
55 int symtable(void);
56 uint32_t AssignSymbolNos(uint8_t *, uint8_t *(*)());
57 uint32_t AssignSymbolNosELF(uint8_t *, uint8_t *(*)());
58 void DumpLODSymbols(void);
59 uint8_t * GetSymbolNameByUID(uint32_t);
60 SYM * NewDebugSymbol(const uint8_t *, uint8_t, uint8_t, uint16_t);
61 void GenMainFileSym(const char *);
62 void GenLineNoSym(void);
63
64 // Helper to avoid unnecessary branches:
65 #define GENLINENOSYM() if (dsym_flag) GenLineNoSym()
66
67 #endif // __SYMBOL_H__
68