PostgreSQL Source Code  git master
api.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SN_env
 

Typedefs

typedef unsigned char symbol
 

Functions

struct SN_envSN_create_env (int S_size, int I_size)
 
void SN_close_env (struct SN_env *z, int S_size)
 
int SN_set_current (struct SN_env *z, int size, const symbol *s)
 

Typedef Documentation

◆ symbol

typedef unsigned char symbol

Definition at line 2 of file api.h.

Function Documentation

◆ SN_close_env()

void SN_close_env ( struct SN_env z,
int  S_size 
)

Definition at line 34 of file api.c.

35 {
36  if (z == NULL) return;
37  if (S_size)
38  {
39  int i;
40  for (i = 0; i < S_size; i++)
41  {
42  lose_s(z->S[i]);
43  }
44  free(z->S);
45  }
46  free(z->I);
47  if (z->p) lose_s(z->p);
48  free(z);
49 }
#define free(a)
Definition: header.h:65
int i
Definition: isn.c:72
symbol * p
Definition: api.h:15
int * I
Definition: api.h:18
symbol ** S
Definition: api.h:17
void lose_s(symbol *p)
Definition: utilities.c:15

References free, i, SN_env::I, lose_s(), SN_env::p, and SN_env::S.

Referenced by arabic_UTF_8_close_env(), armenian_UTF_8_close_env(), basque_ISO_8859_1_close_env(), basque_UTF_8_close_env(), catalan_ISO_8859_1_close_env(), catalan_UTF_8_close_env(), danish_ISO_8859_1_close_env(), danish_UTF_8_close_env(), dutch_ISO_8859_1_close_env(), dutch_UTF_8_close_env(), english_ISO_8859_1_close_env(), english_UTF_8_close_env(), finnish_ISO_8859_1_close_env(), finnish_UTF_8_close_env(), french_ISO_8859_1_close_env(), french_UTF_8_close_env(), german_ISO_8859_1_close_env(), german_UTF_8_close_env(), greek_UTF_8_close_env(), hindi_UTF_8_close_env(), hungarian_ISO_8859_2_close_env(), hungarian_UTF_8_close_env(), indonesian_ISO_8859_1_close_env(), indonesian_UTF_8_close_env(), irish_ISO_8859_1_close_env(), irish_UTF_8_close_env(), italian_ISO_8859_1_close_env(), italian_UTF_8_close_env(), lithuanian_UTF_8_close_env(), nepali_UTF_8_close_env(), norwegian_ISO_8859_1_close_env(), norwegian_UTF_8_close_env(), porter_ISO_8859_1_close_env(), porter_UTF_8_close_env(), portuguese_ISO_8859_1_close_env(), portuguese_UTF_8_close_env(), romanian_ISO_8859_2_close_env(), romanian_UTF_8_close_env(), russian_KOI8_R_close_env(), russian_UTF_8_close_env(), serbian_UTF_8_close_env(), SN_create_env(), spanish_ISO_8859_1_close_env(), spanish_UTF_8_close_env(), swedish_ISO_8859_1_close_env(), swedish_UTF_8_close_env(), tamil_UTF_8_close_env(), turkish_UTF_8_close_env(), and yiddish_UTF_8_close_env().

◆ SN_create_env()

struct SN_env* SN_create_env ( int  S_size,
int  I_size 
)

Definition at line 3 of file api.c.

4 {
5  struct SN_env * z = (struct SN_env *) calloc(1, sizeof(struct SN_env));
6  if (z == NULL) return NULL;
7  z->p = create_s();
8  if (z->p == NULL) goto error;
9  if (S_size)
10  {
11  int i;
12  z->S = (symbol * *) calloc(S_size, sizeof(symbol *));
13  if (z->S == NULL) goto error;
14 
15  for (i = 0; i < S_size; i++)
16  {
17  z->S[i] = create_s();
18  if (z->S[i] == NULL) goto error;
19  }
20  }
21 
22  if (I_size)
23  {
24  z->I = (int *) calloc(I_size, sizeof(int));
25  if (z->I == NULL) goto error;
26  }
27 
28  return z;
29 error:
30  SN_close_env(z, S_size);
31  return NULL;
32 }
void SN_close_env(struct SN_env *z, int S_size)
Definition: api.c:34
unsigned char symbol
Definition: api.h:2
#define calloc(a, b)
Definition: header.h:55
static void error(void)
Definition: sql-dyntest.c:147
Definition: api.h:14
symbol * create_s(void)
Definition: utilities.c:5

References calloc, create_s(), error(), i, SN_env::I, SN_env::p, SN_env::S, and SN_close_env().

Referenced by arabic_UTF_8_create_env(), armenian_UTF_8_create_env(), basque_ISO_8859_1_create_env(), basque_UTF_8_create_env(), catalan_ISO_8859_1_create_env(), catalan_UTF_8_create_env(), danish_ISO_8859_1_create_env(), danish_UTF_8_create_env(), dutch_ISO_8859_1_create_env(), dutch_UTF_8_create_env(), english_ISO_8859_1_create_env(), english_UTF_8_create_env(), finnish_ISO_8859_1_create_env(), finnish_UTF_8_create_env(), french_ISO_8859_1_create_env(), french_UTF_8_create_env(), german_ISO_8859_1_create_env(), german_UTF_8_create_env(), greek_UTF_8_create_env(), hindi_UTF_8_create_env(), hungarian_ISO_8859_2_create_env(), hungarian_UTF_8_create_env(), indonesian_ISO_8859_1_create_env(), indonesian_UTF_8_create_env(), irish_ISO_8859_1_create_env(), irish_UTF_8_create_env(), italian_ISO_8859_1_create_env(), italian_UTF_8_create_env(), lithuanian_UTF_8_create_env(), nepali_UTF_8_create_env(), norwegian_ISO_8859_1_create_env(), norwegian_UTF_8_create_env(), porter_ISO_8859_1_create_env(), porter_UTF_8_create_env(), portuguese_ISO_8859_1_create_env(), portuguese_UTF_8_create_env(), romanian_ISO_8859_2_create_env(), romanian_UTF_8_create_env(), russian_KOI8_R_create_env(), russian_UTF_8_create_env(), serbian_UTF_8_create_env(), spanish_ISO_8859_1_create_env(), spanish_UTF_8_create_env(), swedish_ISO_8859_1_create_env(), swedish_UTF_8_create_env(), tamil_UTF_8_create_env(), turkish_UTF_8_create_env(), and yiddish_UTF_8_create_env().

◆ SN_set_current()

int SN_set_current ( struct SN_env z,
int  size,
const symbol s 
)

Definition at line 51 of file api.c.

52 {
53  int err = replace_s(z, 0, z->l, size, s, NULL);
54  z->c = 0;
55  return err;
56 }
void err(int eval, const char *fmt,...)
Definition: err.c:43
static pg_noinline void Size size
Definition: slab.c:607
int c
Definition: api.h:16
int l
Definition: api.h:16
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

References SN_env::c, err(), SN_env::l, replace_s(), and size.

Referenced by dsnowball_lexize().