PostgreSQL Source Code  git master
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 
15 struct 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 
23 extern symbol * create_s(void);
24 extern void lose_s(symbol * p);
25 
26 extern int skip_utf8(const symbol * p, int c, int lb, int l, int n);
27 
28 extern int in_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
29 extern int in_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
30 extern int out_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
31 extern int out_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
32 
33 extern int in_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
34 extern int in_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
35 extern int out_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
36 extern int out_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
37 
38 extern int eq_s(struct SN_env * z, int s_size, const symbol * s);
39 extern int eq_s_b(struct SN_env * z, int s_size, const symbol * s);
40 extern int eq_v(struct SN_env * z, const symbol * p);
41 extern int eq_v_b(struct SN_env * z, const symbol * p);
42 
43 extern int find_among(struct SN_env * z, const struct among * v, int v_size);
44 extern int find_among_b(struct SN_env * z, const struct among * v, int v_size);
45 
46 extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjustment);
47 extern int slice_from_s(struct SN_env * z, int s_size, const symbol * s);
48 extern int slice_from_v(struct SN_env * z, const symbol * p);
49 extern int slice_del(struct SN_env * z);
50 
51 extern int insert_s(struct SN_env * z, int bra, int ket, int s_size, const symbol * s);
52 extern int insert_v(struct SN_env * z, int bra, int ket, const symbol * p);
53 
54 extern symbol * slice_to(struct SN_env * z, symbol * p);
55 extern symbol * assign_to(struct SN_env * z, symbol * p);
56 
57 extern void debug(struct SN_env * z, int number, int line_count);
58 
int find_among_b(struct SN_env *z, const struct among *v, int v_size)
Definition: utilities.c:267
int s_size
Definition: header.h:16
symbol * p
Definition: api.h:15
int substring_i
Definition: header.h:18
int ket
Definition: api.h:16
int bra
Definition: api.h:16
int eq_v(struct SN_env *z, const symbol *p)
Definition: utilities.c:199
int slice_from_s(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:392
int skip_utf8(const symbol *p, int c, int lb, int l, int n)
Definition: utilities.c:30
int slice_from_v(struct SN_env *z, const symbol *p)
Definition: utilities.c:397
symbol * create_s(void)
Definition: utilities.c:7
symbol * assign_to(struct SN_env *z, symbol *p)
Definition: utilities.c:441
int lb
Definition: api.h:16
int slice_del(struct SN_env *z)
Definition: utilities.c:401
Datum repeat(PG_FUNCTION_ARGS)
void lose_s(symbol *p)
Definition: utilities.c:17
char * c
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:91
int insert_v(struct SN_env *z, int bra, int ket, const symbol *p)
Definition: utilities.c:414
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:115
int eq_s_b(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:194
int out_grouping_b(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:177
int replace_s(struct SN_env *z, int c_bra, int c_ket, int s_size, const symbol *s, int *adjustment)
Definition: utilities.c:343
Definition: header.h:15
symbol * slice_to(struct SN_env *z, symbol *p)
Definition: utilities.c:423
int eq_v_b(struct SN_env *z, const symbol *p)
Definition: utilities.c:203
int result
Definition: header.h:19
const symbol * s
Definition: header.h:17
int out_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:127
int out_grouping(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:165
int in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:103
int in_grouping(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:405
void debug(struct SN_env *z, int number, int line_count)
int in_grouping_b(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:153
Definition: api.h:14
int eq_s(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:189
int l
Definition: api.h:16
unsigned char symbol
Definition: api.h:2
int find_among(struct SN_env *z, const struct among *v, int v_size)
Definition: utilities.c:207