Debian Codegraph @

src/flow.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 // flow control stuff (loops, conditional assembly etc.)
6 #ifndef flow_H
7 #define flow_H
8
9
10 #include <stdio.h>
11 #include "config.h"
12
13
14 // struct to pass "!for" loop stuff from pseudoopcodes.c to flow.c
15 enum foralgo {
16 FORALGO_OLDCOUNT, // block can be skipped by passing zero, counter keeps value after block
17 FORALGO_NEWCOUNT, // first and last value are given, counter is out of range after block
18 FORALGO_ITERATE // iterate over string/list contents
19 };
20 struct for_loop {
21 struct symbol *symbol;
22 enum foralgo algorithm;
23 intval_t iterations_left;
24 union {
25 struct {
26 intval_t first,
27 increment; // 1 or -1
28 bits force_bit;
29 int addr_refs; // address reference count
30 } counter;
31 struct {
32 struct object obj; // string or list
33 } iter;
34 } u;
35 struct block block;
36 };
37
38 // structs to pass "!do"/"!while" stuff from pseudoopcodes.c to flow.c
39 struct condition {
40 // FIXME - add some "boolean given" and use that instead of checking for block.body == NULL
41 boolean invert; // only set for UNTIL conditions
42 struct block block;
43 };
44 struct do_while {
45 struct condition head_cond;
46 struct block block;
47 struct condition tail_cond;
48 };
49
50
51 // parse symbol name and return if symbol has defined value (called by ifdef/ifndef)
52 extern boolean check_ifdef_condition(void);
53
54 // back end function for "!for" pseudo opcode
55 extern void flow_forloop(struct for_loop *loop);
56
57 // try to read a condition into DynaBuf and store pointer to copy in
58 // given condition structure.
59 // if no condition given, NULL is written to structure.
60 // call with GotByte = first interesting character
61 extern void flow_store_doloop_condition(struct condition *condition, char terminator);
62
63 // read a condition into DynaBuf and store pointer to copy in
64 // given condition structure.
65 // call with GotByte = first interesting character
66 extern void flow_store_while_condition(struct condition *condition);
67
68 // back end function for "!do" pseudo opcode
69 extern void flow_do_while(struct do_while *loop);
70
71
72 #endif