| 1 | //cxx . . $ `<file>/src/asm/tree.h`/ |
| 2 | // ACME - a crossassembler for producing 6502/65c02/65816 code. |
| 3 | // Copyright (C) 1998-2006 Marco Baye |
| 4 | // Have a look at "acme.c" for further info |
| 5 | // |
| 6 | // Tree stuff |
| 7 | #ifndef tree_H |
| 8 | #define tree_Hcxx . . $ `src/asm/tree.h:8:9`! |
| 9 | |
| 10 | #include <stdio.h> |
| 11 | #include "config.h"cxx . . $ `<file>/src/asm/config.h`/ |
| 12 | |
| 13 | |
| 14 | // Macros for pre-defining tree node tables |
| 15 | #define PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s, v) {NULL, NULL, 1, s, (void*) (v)} |
| 16 | #define PREDEFLASTcxx . . $ `src/asm/tree.h:16:9`!(s, v) {NULL, NULL, 0, s, (void*) (v)} |
| 17 | |
| 18 | |
| 19 | // type definitions |
| 20 | |
| 21 | typedef unsigned int hash_tcxx . . $ hash_t#; |
| 22 | // Must be unsigned, otherwise the hash algorithm won't be very useful! |
| 23 | |
| 24 | // tree node structure type definition (for easy lookups) |
| 25 | struct node_tcxx . . $ node_t# { |
| 26 | node_tcxx . . $ node_t#* greater_thancxx . . $ node_t#greater_than.; // pointer to sub-tree |
| 27 | node_tcxx . . $ node_t#* less_than_or_equalcxx . . $ node_t#less_than_or_equal.;// pointer to sub-tree |
| 28 | hash_tcxx . . $ hash_t# hash_valuecxx . . $ node_t#hash_value.; |
| 29 | const char* id_stringcxx . . $ node_t#id_string.; // name, zero-terminated |
| 30 | void* bodycxx . . $ node_t#body.; // bytes, handles or handler function |
| 31 | }; |
| 32 | |
| 33 | // tree node structure type definition (for macros/labels) |
| 34 | struct node_ra_tcxx . . $ node_ra_t# { |
| 35 | node_ra_tcxx . . $ node_ra_t#* greater_thancxx . . $ node_ra_t#greater_than.; // pointer to sub-tree |
| 36 | node_ra_tcxx . . $ node_ra_t#* less_than_or_equalcxx . . $ node_ra_t#less_than_or_equal.;// pointer to sub-tree |
| 37 | hash_tcxx . . $ hash_t# hash_valuecxx . . $ node_ra_t#hash_value.; |
| 38 | char* id_stringcxx . . $ node_ra_t#id_string.; // name, zero-terminated |
| 39 | void* bodycxx . . $ node_ra_t#body.; // macro/label body |
| 40 | unsigned int id_numbercxx . . $ node_ra_t#id_number.; // zone number |
| 41 | }; |
| 42 | |
| 43 | |
| 44 | // Prototypes |
| 45 | |
| 46 | // Add predefined tree items to given tree. |
| 47 | extern void Tree_add_tablecxx . . $ Tree_add_table(90ba9e887489f1c).(node_tcxx . . $ node_t#** tree, node_tcxx . . $ node_t#* table_to_add); |
| 48 | // Search for a given ID string in a given tree. Store "Body" component in |
| 49 | // NodeBody and return TRUE. Return FALSE if no matching item found. |
| 50 | extern boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! Tree_easy_scancxx . . $ Tree_easy_scan(7f10be3e8224db50).(node_tcxx . . $ node_t#* tree, void** node_body, struct dynabuf_tcxx . . $ dynabuf_t#* dyna_buf); |
| 51 | // Search for a "RAM tree" item. Save pointer to found tree item in given |
| 52 | // location. If no matching item is found, check the "Create" flag: If set, |
| 53 | // create new tree item, link to tree, fill with data and store its pointer. |
| 54 | // If "Create" is clear, store NULL. Returns whether item was created. |
| 55 | extern boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! Tree_hard_scancxx . . $ Tree_hard_scan(fbd309352d4134f6).(node_ra_tcxx . . $ node_ra_t#**, node_ra_tcxx . . $ node_ra_t#**, int, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!); |
| 56 | // Calls given function for each node of each tree of given forest. |
| 57 | extern void Tree_dump_forestcxx . . $ Tree_dump_forest(dc7737009984b828).(node_ra_tcxx . . $ node_ra_t#**, int, void (*)(node_ra_tcxx . . $ node_ra_t#*, FILEcxx . . $ FILE#*), FILEcxx . . $ FILE#*); |
| 58 | |
| 59 | |
| 60 | #endif |