Debian Codegraph @

src/config.h

raw symbols SCIP
1 // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code.
2 // Copyright (C) 1998-2024 Marco Baye
3 // Have a look at "acme.c" for further info
4 //
5 // Configuration
6 #ifndef config_H
7 #define config_H
8
9
10 // make sure the enum below works with strange compilers, too:
11 #ifdef FALSE
12 #undef FALSE
13 #endif
14 #ifdef TRUE
15 #undef TRUE
16 #endif
17 // types
18 typedef enum { FALSE = 0, TRUE } boolean; // yes, I could include <stdbool.h>, but this source should work with ancient compilers as well...
19 typedef unsigned int bits;
20 typedef unsigned int scope_t;
21 typedef signed int intval_t; // at least 32 bits
22 typedef unsigned int uintval_t; // at least 32 bits (only used for logical shift right)
23 #define OUTBUF_MAXSIZE 0x1000000 // 16 MiB ought to be enough for anybody
24
25 // struct to remember where macros/symbols were defined
26 struct location {
27 const char *plat_filename; // filename in platform style
28 int line_number;
29 };
30 // struct for code blocks (loop conditions, loop bodies and macro bodies)
31 struct block {
32 int line_number; // start of block
33 char *body;
34 };
35
36
37 // stuff for results from expression parser:
38
39 enum numtype {
40 NUMTYPE_UNDEFINED,
41 NUMTYPE_INT,
42 NUMTYPE_FLOAT,
43 };
44
45 // structure for ints/floats
46 struct number {
47 enum numtype ntype;
48 bits flags; // FITS_IN_BYTE etc. (see alu.h)
49 union {
50 intval_t intval; // integer value
51 double fpval; // floating point value
52 } val;
53 int addr_refs; // address reference count (only look at this if value is DEFINED)
54 };
55
56 struct type;
57 struct string;
58 struct listitem;
59 // structure for ints/floats/lists/strings (anything that can be assigned to symbol)
60 struct object {
61 struct type *type;
62 union {
63 struct number number;
64 struct string *string;
65 struct listitem *listhead;
66 } u;
67 };
68 struct string {
69 int length;
70 int refs; // FIXME - either use correctly or remove altogether!
71 char payload[1]; // real structs are malloc'd to correct size
72 };
73 struct listitem {
74 struct listitem *next;
75 struct listitem *prev;
76 union {
77 struct {
78 int length; // this does not include the head element
79 int refs; // FIXME - either use correctly or remove altogether!
80 } listinfo; // if item is list head
81 struct object payload; // if item is not list head
82 } u;
83 };
84
85 // debugging flag, should be undefined in release version
86 // #define FDEBUG
87
88 // maximum nesting depth of "!src" and macro calls, also max number of passes
89 // is not actually a limitation, but a means of finding recursions
90 #define SANITY_LIMIT 64
91 // default value for "!fill"
92 #define FILLVALUE_FILL 0
93
94 // Nullpointer definition
95 #ifndef NULL
96 #define NULL ((void *) 0)
97 #endif
98
99
100 #endif