1#ifndef SNOWBALL_INCLUDED_SNOWBALL_RUNTIME_H
2#define SNOWBALL_INCLUDED_SNOWBALL_RUNTIME_H
6#define HEAD 2*sizeof(int)
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
27static void debug(
struct SN_env * z,
int number,
int line_count) {
29 int limit =
SIZE(z->
p);
30 if (number >= 0)
printf(
"%3d (line %4d): [%d]'", number, line_count, limit);
31 for (
i = 0;
i <= limit;
i++) {
39 if (ch == 0) ch =
'#';
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 *))
Datum repeat(PG_FUNCTION_ARGS)