dictre.h
author viric@llimona
Sun, 02 Sep 2007 14:24:10 +0200
changeset 24 026a2ba0ce16
parent 21 01fe372188ac
permissions -rw-r--r--
Now the HTML result shows word meanings.

enum {
    MAXWORD=200,
    MAXDEF=100000,
    END_OF_URL=-2,
    HTTP_DECODE_ERROR=-3
};

enum Case
{
    LCASE = 0,
    UCASE = 1
};

struct Words
{
    struct Word *first;
    int length;
};

struct Word
{
    char *w;
    int def;
};

struct Def
{
    char *d;
    int offset;
    int length;
};

struct Dict
{
    unsigned char *index;
    int indexfd;
    int indexsize;
    FILE *defs;
    int trim_first_line;
    int trim_last_newlines;
};

/* write.c */
void write_dictionary(const char *name);

/* dict.c */
char * get_word(FILE *index);
int get_int(FILE *index);
char * get_def(FILE *fdefs, int offset, int length);
int str2int(const char *str);
int num_to_ia5(char *dest, int n);

/* filter.c */
void filter_all(const char *filter_par);

/* sort.c */
int sort_words();
/* load.c */
void load_init();
void load_dictionary(FILE *index, FILE *fdefs);
void print_words();

/* fastmalloc */
void * fastmalloc(int newsize);

/* repeated.c */
void new_hashdef(struct Def *ptr, int index);
int def_repeated(struct Def *ptr);
void init_repeated();
void remove_def(int i);


/* FOR ZPROCESS */
/* zdefs.c */
void zprocess_def(const char *root, char *def);


/* zhash.c */
void insert_word(const char *word, const char *unflexed);
void init_wordlist();
void dump_wordlist();

/* zrus.c */
char * mix_accents(char *a, const char *b);
void remove_accent(unsigned char *dest, const unsigned char *from);
int until_newword(const unsigned char *str, int *index);
int until_noword(const char *str, int *index);
int skip_newline(const char *str, int *index);
int is_ASCII(unsigned char c);
int get_case(enum Case *vcase, const char *str);
void get_lowcase_str(char *inout, const char *str);
void reapply_case(char *out, const char *in, const enum Case *vcase);
void remove_jo(char *str);

/* find.c */
void init_dictionary(struct Dict *d, const char *base);
void end_dictionary(struct Dict *d);
void find_def(struct Dict *d, const char *word, char * def);

/* http_dec.c */
int http_getc(FILE *f);