comparison structures.h @ 16:a2a81589380d default tip

Reformat the whole source via clang-format for better consistency.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 14 Oct 2021 01:53:20 +0300
parents 89183953bddc
children
comparison
equal deleted inserted replaced
15:89183953bddc 16:a2a81589380d
66 ~(3 << ((address % (4 * sizeof *MemType)) << 1))) | \ 66 ~(3 << ((address % (4 * sizeof *MemType)) << 1))) | \
67 (type << ((address % (4 * sizeof *MemType)) << 1))) 67 (type << ((address % (4 * sizeof *MemType)) << 1)))
68 68
69 /* The table consists of bit pairs with the following values: */ 69 /* The table consists of bit pairs with the following values: */
70 70
71 #define MEM_UNPROCESSED 0 /* the memory place has not been processed yet */ 71 #define MEM_UNPROCESSED 0 /* the memory place has not been processed yet */
72 #define MEM_INSTRUCTION 1 /* a machine language instruction starts at 72 #define MEM_INSTRUCTION 1 /* a machine language instruction starts at this memory place */
73 this memory place */ 73 #define MEM_DATA 2 /* the memory place contains data */
74 #define MEM_DATA 2 /* the memory place contains data */ 74 #define MEM_PARAMETER 3 /* a parameter of a machine language instruction is at this place */
75 #define MEM_PARAMETER 3 /* a parameter of a machine language
76 instruction is at this place */
77 75
78 /*************************\ 76 /*************************\
79 * Memory place flag table * 77 * Memory place flag table *
80 \*************************/ 78 \*************************/
81 79
113 #define PutLabel(address) DOPutLabel(address, __func__, __LINE__) 111 #define PutLabel(address) DOPutLabel(address, __func__, __LINE__)
114 112
115 113
116 static inline void DOPutLabel(unsigned int address, const char *name, const int line) 114 static inline void DOPutLabel(unsigned int address, const char *name, const int line)
117 { 115 {
118 (void) name; 116 (void)name;
119 (void) line; 117 (void)line;
120 118
121 MemLabel[((ADDR_T)address) / (8 * sizeof *MemLabel)] |= (1 << (address % (8 * sizeof *MemLabel))); 119 MemLabel[((ADDR_T)address) / (8 * sizeof *MemLabel)] |= (1 << (address % (8 * sizeof *MemLabel)));
122 } 120 }
123 121
124 static inline unsigned char IsReferenced(unsigned int address) 122 static inline unsigned char IsReferenced(unsigned int address)
125 { 123 {
126 return MemReferenced[address]; 124 return MemReferenced[address];
127 } 125 }
128 126
129 127
130 static inline void DOPutReference(unsigned int address, const char *name, const int line) 128 static inline void DOPutReference(unsigned int address, const char *name, const int line)
131 { 129 {
132 (void) name; 130 (void)name;
133 (void) line; 131 (void)line;
134 132
135 MemReferenced[address]++; 133 MemReferenced[address]++;
136 } 134 }
137 135
138 #define PutReference(address) DOPutReference(address, __func__, __LINE__) 136 #define PutReference(address) DOPutReference(address, __func__, __LINE__)
139 137
140 /* These macros tell if there is a label for a given address, or cause a 138 /* These macros tell if there is a label for a given address, or cause a
164 * Routine/warning address table entries * 162 * Routine/warning address table entries *
165 \***************************************/ 163 \***************************************/
166 164
167 typedef struct table 165 typedef struct table
168 { 166 {
169 ADDR_T address; 167 ADDR_T address;
170 ADDR_T parent; 168 ADDR_T parent;
171 unsigned char type; 169 unsigned char type;
172 } table; 170 } table;
173 171
174 /* The table.type byte has the following format: */ 172 /* The table.type byte has the following format: */
175 173
176 #define RTN_SURE 0x80 /* address must point to a valid subprogram */ 174 #define RTN_SURE 0x80 /* address must point to a valid subprogram */
224 * Label table entries * 222 * Label table entries *
225 \*********************/ 223 \*********************/
226 224
227 typedef struct label 225 typedef struct label
228 { 226 {
229 int is_range; 227 int is_range;
230 ADDR_T address, len; 228 ADDR_T address, len;
231 char *name; 229 char *name;
232 } label; 230 } label;
233 231
234 /********************\ 232 /********************\
235 * Word table entries * 233 * Word table entries *
236 \********************/ 234 \********************/
237 235
238 typedef struct words 236 typedef struct words
239 { 237 {
240 ADDR_T start, end; 238 ADDR_T start, end;
241 } words; 239 } words;
242 240
243 #ifndef _MAIN_C_ 241 #ifndef _MAIN_C_
244 extern char *prog; 242 extern char *prog;
245 extern ADDR_T StartAddress, EndAddress, BasicHeaderLength; 243 extern ADDR_T StartAddress, EndAddress, BasicHeaderLength;