PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
header.h
Go to the documentation of this file.
1
2#include <limits.h>
3
4#include "api.h"
5
6#define MAXINT INT_MAX
7#define MININT INT_MIN
8
9#define HEAD 2*sizeof(int)
10
11#define SIZE(p) ((int *)(p))[-1]
12#define SET_SIZE(p, n) ((int *)(p))[-1] = n
13#define CAPACITY(p) ((int *)(p))[-2]
14
15struct among
16{ int s_size; /* number of chars in string */
17 const symbol * s; /* search string */
18 int substring_i;/* index to longest matching substring */
19 int result; /* result of the lookup */
20 int (* function)(struct SN_env *);
21};
22
23extern symbol * create_s(void);
24extern void lose_s(symbol * p);
25
26extern int skip_utf8(const symbol * p, int c, int limit, int n);
27
28extern int skip_b_utf8(const symbol * p, int c, int limit, int n);
29
30extern int in_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
31extern int in_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
32extern int out_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
33extern int out_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
34
35extern int in_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
36extern int in_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
37extern int out_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
38extern int out_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
39
40extern int eq_s(struct SN_env * z, int s_size, const symbol * s);
41extern int eq_s_b(struct SN_env * z, int s_size, const symbol * s);
42extern int eq_v(struct SN_env * z, const symbol * p);
43extern int eq_v_b(struct SN_env * z, const symbol * p);
44
45extern int find_among(struct SN_env * z, const struct among * v, int v_size);
46extern int find_among_b(struct SN_env * z, const struct among * v, int v_size);
47
48extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjptr);
49extern int slice_from_s(struct SN_env * z, int s_size, const symbol * s);
50extern int slice_from_v(struct SN_env * z, const symbol * p);
51extern int slice_del(struct SN_env * z);
52
53extern int insert_s(struct SN_env * z, int bra, int ket, int s_size, const symbol * s);
54extern int insert_v(struct SN_env * z, int bra, int ket, const symbol * p);
55
56extern symbol * slice_to(struct SN_env * z, symbol * p);
57extern symbol * assign_to(struct SN_env * z, symbol * p);
58
59extern int len_utf8(const symbol * p);
60
61extern void debug(struct SN_env * z, int number, int line_count);
unsigned char symbol
Definition: api.h:2
int insert_v(struct SN_env *z, int bra, int ket, const symbol *p)
Definition: utilities.c:444
int find_among_b(struct SN_env *z, const struct among *v, int v_size)
Definition: utilities.c:298
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:141
int insert_s(struct SN_env *z, int bra, int ket, int s_size, const symbol *s)
Definition: utilities.c:435
int slice_del(struct SN_env *z)
Definition: utilities.c:431
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:117
int eq_v_b(struct SN_env *z, const symbol *p)
Definition: utilities.c:229
int in_grouping(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:167
int eq_s(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:215
int replace_s(struct SN_env *z, int c_bra, int c_ket, int s_size, const symbol *s, int *adjptr)
Definition: utilities.c:374
int eq_v(struct SN_env *z, const symbol *p)
Definition: utilities.c:225
void lose_s(symbol *p)
Definition: utilities.c:15
int out_grouping_b(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:203
int in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:129
int skip_b_utf8(const symbol *p, int c, int limit, int n)
Definition: utilities.c:52
int eq_s_b(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:220
int out_grouping(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:191
int out_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:153
symbol * create_s(void)
Definition: utilities.c:5
symbol * slice_to(struct SN_env *z, symbol *p)
Definition: utilities.c:448
int slice_from_v(struct SN_env *z, const symbol *p)
Definition: utilities.c:427
int find_among(struct SN_env *z, const struct among *v, int v_size)
Definition: utilities.c:233
int skip_utf8(const symbol *p, int c, int limit, int n)
Definition: utilities.c:27
int slice_from_s(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:422
int in_grouping_b(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:179
int len_utf8(const symbol *p)
Definition: utilities.c:478
symbol * assign_to(struct SN_env *z, symbol *p)
Definition: utilities.c:466
void debug(struct SN_env *z, int number, int line_count)
Datum repeat(PG_FUNCTION_ARGS)
char * c
Definition: api.h:14
symbol * p
Definition: api.h:15
int ket
Definition: api.h:16
int bra
Definition: api.h:16
Definition: header.h:16
int result
Definition: header.h:19
int substring_i
Definition: header.h:18
int s_size
Definition: header.h:16
const symbol * s
Definition: header.h:17
int(* function)(struct SN_env *)
Definition: header.h:20