Header And Logo

PostgreSQL
| The world's most advanced open source database.

Data Structures | Typedefs | Functions

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, int B_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

typedef unsigned char symbol

Definition at line 2 of file api.h.


Function Documentation

void SN_close_env ( struct SN_env z,
int  S_size 
)
struct SN_env* SN_create_env ( int  S_size,
int  I_size,
int  B_size 
) [read]

Definition at line 3 of file api.c.

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

Referenced by 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(), hungarian_ISO_8859_1_create_env(), hungarian_UTF_8_create_env(), italian_ISO_8859_1_create_env(), italian_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(), spanish_ISO_8859_1_create_env(), spanish_UTF_8_create_env(), swedish_ISO_8859_1_create_env(), swedish_UTF_8_create_env(), and turkish_UTF_8_create_env().

{
    struct SN_env * z = (struct SN_env *) calloc(1, sizeof(struct SN_env));
    if (z == NULL) return NULL;
    z->p = create_s();
    if (z->p == NULL) goto error;
    if (S_size)
    {
        int i;
        z->S = (symbol * *) calloc(S_size, sizeof(symbol *));
        if (z->S == NULL) goto error;

        for (i = 0; i < S_size; i++)
        {
            z->S[i] = create_s();
            if (z->S[i] == NULL) goto error;
        }
    }

    if (I_size)
    {
        z->I = (int *) calloc(I_size, sizeof(int));
        if (z->I == NULL) goto error;
    }

    if (B_size)
    {
        z->B = (unsigned char *) calloc(B_size, sizeof(unsigned char));
        if (z->B == NULL) goto error;
    }

    return z;
error:
    SN_close_env(z, S_size);
    return NULL;
}

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

Definition at line 58 of file api.c.

References SN_env::c, SN_env::l, NULL, and replace_s().

Referenced by dsnowball_lexize().

{
    int err = replace_s(z, 0, z->l, size, s, NULL);
    z->c = 0;
    return err;
}