1 #ifndef SNOWBALL_INCLUDED_SNOWBALL_RUNTIME_H
2 #define SNOWBALL_INCLUDED_SNOWBALL_RUNTIME_H
10 # define SIZE(p) (reinterpret_cast<const int *>(p))[-1]
11 # define SET_SIZE(p, n) (reinterpret_cast<int *>(p))[-1] = n
12 # define CAPACITY(p) (reinterpret_cast<int *>(p))[-2]
14 # define SIZE(p) ((const int *)(p))[-1]
15 # define SET_SIZE(p, n) ((int *)(p))[-1] = n
16 # define CAPACITY(p) ((int *)(p))[-2]
19 #ifdef SNOWBALL_RUNTIME_THROW_EXCEPTIONS
20 # define SNOWBALL_ERR void
22 # define SNOWBALL_ERR int
25 #ifdef SNOWBALL_DEBUG_COMMAND_USED
27 static void debug(
struct SN_env * z,
int n,
int line) {
30 printf(
"%3d (line %4d): [%d]'", n, line, len);
31 for (i = 0; i <= len; i++) {
32 if (z->
lb == i) putc(
'{', stdout);
33 if (z->
bra == i) putc(
'[', stdout);
34 if (z->
c == i) putc(
'|', stdout);
35 if (z->
ket == i) putc(
']', stdout);
36 if (z->
l == i) putc(
'}', stdout);
39 if (ch == 0) ch =
'#';
63 #if defined __cplusplus && !defined SNOWBALL_RUNTIME_THROW_EXCEPTIONS
74 extern int in_grouping_U(
struct SN_env * z,
const unsigned char * s,
int min,
int max,
int repeat);
76 extern int out_grouping_U(
struct SN_env * z,
const unsigned char * s,
int min,
int max,
int repeat);
79 extern int in_grouping(
struct SN_env * z,
const unsigned char * s,
int min,
int max,
int repeat);
80 extern int in_grouping_b(
struct SN_env * z,
const unsigned char * s,
int min,
int max,
int repeat);
81 extern int out_grouping(
struct SN_env * z,
const unsigned char * s,
int min,
int max,
int repeat);
82 extern int out_grouping_b(
struct SN_env * z,
const unsigned char * s,
int min,
int max,
int repeat);
107 #if defined __cplusplus && !defined SNOWBALL_RUNTIME_THROW_EXCEPTIONS
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
SNOWBALL_ERR insert_s(struct SN_env *z, int bra, int ket, int s_size, const symbol *s)
int eq_v_b(struct SN_env *z, const symbol *p)
SNOWBALL_ERR slice_from_s(struct SN_env *z, int s_size, const symbol *s)
int in_grouping(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
SNOWBALL_ERR slice_to(struct SN_env *z, symbol **p)
SNOWBALL_ERR assign_to(struct SN_env *z, symbol **p)
SNOWBALL_ERR slice_from_v(struct SN_env *z, const symbol *p)
int eq_s(struct SN_env *z, int s_size, const symbol *s)
SNOWBALL_ERR insert_v(struct SN_env *z, int bra, int ket, const symbol *p)
int eq_v(struct SN_env *z, const symbol *p)
SNOWBALL_ERR replace_s(struct SN_env *z, int c_bra, int c_ket, int s_size, const symbol *s)
int out_grouping_b(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
int in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
int skip_b_utf8(const symbol *p, int c, int limit, int n)
int eq_s_b(struct SN_env *z, int s_size, const symbol *s)
int out_grouping(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
SNOWBALL_ERR slice_del(struct SN_env *z)
int out_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
int skip_utf8(const symbol *p, int c, int limit, int n)
int in_grouping_b(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
int find_among_b(struct SN_env *z, const struct among *v, int v_size, int(*)(struct SN_env *))
int len_utf8(const symbol *p)
int find_among(struct SN_env *z, const struct among *v, int v_size, int(*)(struct SN_env *))