1 /*
2     $Id: section.h 2277 2021-01-23 16:37:23Z soci $
3 
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License along
15     with this program; if not, write to the Free Software Foundation, Inc.,
16     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 
18 */
19 #ifndef SECTION_H
20 #define SECTION_H
21 #include <stdio.h>
22 #include "avl.h"
23 #include "stdbool.h"
24 #include "str.h"
25 
26 struct Obj;
27 struct Memblocks;
28 struct optimizer_s;
29 
30 struct section_address_s {
31     address_t address;
32     address_t l_address;
33     address_t start;
34     address_t end;
35     address_t l_start;
36     address_t l_union;
37     bool moved;
38     bool wrapwarn;
39     bool bankwarn;
40     bool unionmode;
41     struct Obj *l_address_val;
42     struct Memblocks *mem;
43 };
44 
45 struct section_s {
46     int name_hash;
47     str_t name;
48     str_t cfname;
49     struct avltree_node node;
50 
51     uval_t requires;
52     uval_t conflicts;
53     uval_t provides;
54     address_t restart;
55     address_t l_restart;
56     address_t size;
57     struct section_address_s address;
58     uint8_t usepass;
59     uint8_t defpass;
60     uint8_t logicalrecursion;
61     bool declared;
62     struct section_s *parent;
63     struct section_s *next;
64     const struct file_list_s *file_list;
65     struct optimizer_s *optimizer;
66     struct linepos_s epoint;
67     struct avltree members;
68     struct avltree longjump;
69 };
70 
71 extern struct section_s *new_section(const str_t *);
72 extern struct section_s *find_new_section(const str_t *);
73 extern struct section_s *find_this_section(const char *);
74 extern void init_section(void);
75 extern void destroy_section(void);
76 extern void reset_section(struct section_s *);
77 extern void sectionprint(FILE *);
78 extern void section_sizecheck(void);
79 extern struct section_s *current_section, root_section;
80 extern struct section_address_s *current_address;
81 #endif
82