11 #if !defined(__SDCC_pdk13) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !(defined(__SDCC_mcs51) && (defined(__SDCC_MODEL_SMALL) || defined(__SDCC_MODEL_MEDIUM))) // Lack of memory
13 enum { RULES_MAX
= 4 };
15 typedef int* rule_seq
;
16 typedef rule_seq
* rule_alts
;
18 int rule_seq_lists
[] = { 3, 1, 3, -1,
21 rule_seq rule_alts_lists
[] = { &rule_seq_lists
[0], NULL
,
22 &rule_seq_lists
[4], &rule_seq_lists
[6], NULL
};
23 rule_alts rule
[RULES_MAX
] = { &rule_alts_lists
[0],
27 char rule_terminal
[RULES_MAX
] = { 0, 0, 'a', 'b' };
29 enum { GOOD_POOL_MAX
= 64,
35 } good_pool
[GOOD_POOL_MAX
+1]; /* +1 to avoid incorrect SDCC warning */
40 struct good
* old_good
;
41 } bad_stack
[BAD_STACK_MAX
+1]; /* +1 to avoid incorrect SDCC warning */
43 int match(char* pos_arg
)
46 static struct bad
* bad_sp
;
47 #ifdef AVOID_SCCZ80_BUG
50 static struct good
* good_alloc
;
51 static struct good
* good
;
52 static struct good
* rgood
;
53 static rule_alts alts
;
57 static rule_seq seq
; /* this line breaks SDCC */
59 #ifdef AVOID_SCCZ80_BUG
66 good_alloc
= good_pool
;
75 assert(bad_sp
< &bad_stack
[BAD_STACK_MAX
]);
76 assert(good_alloc
< &good_pool
[GOOD_POOL_MAX
]);
77 assert(ruleno
>= 0 && ruleno
< RULES_MAX
);
84 assert(rule_terminal
[ruleno
]);
85 if (*pos
!= rule_terminal
[ruleno
])
98 struct good
* ngood
= good_alloc
++;
105 if (bad_sp
== bad_stack
) {
110 rgood
= bad_sp
->old_good
;
111 rpos
= bad_sp
->old_pos
;
119 bad_sp
->old_good
= rgood
;
120 bad_sp
->old_pos
= pos
;
131 #if !defined(__SDCC_pdk13) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !(defined(__SDCC_mcs51) && (defined(__SDCC_MODEL_SMALL) || defined(__SDCC_MODEL_MEDIUM))) // Lack of memory
132 ASSERT (match("baaab"));