eliot/dic/dic_internals.h

113 lines
3 KiB
C
Raw Normal View History

2004-04-08 11:43:06 +02:00
/* Eliot */
/* Copyright (C) 1999 Antoine Fraboulet */
2004-04-08 11:43:06 +02:00
/* */
/* This file is part of Eliot. */
/* */
/* Eliot is free software; you can redistribute it and/or modify */
2004-04-08 11:43:06 +02:00
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* Eliot is distributed in the hope that it will be useful, */
2004-04-08 11:43:06 +02:00
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
* \file dic_internals.h
* \brief Internal dictionary structures
* \author Antoine Fraboulet
* \date 2002
2004-04-08 11:43:06 +02:00
*/
#ifndef _DIC_INTERNALS_H_
#define _DIC_INTERNALS_H_
#if defined(__cplusplus)
2005-11-04 21:00:05 +01:00
extern "C"
{
2005-11-04 21:00:05 +01:00
#endif
2004-04-08 11:43:06 +02:00
#include <stdint.h>
#include "config.h"
/**
* bit masking for ascii characters \n
2005-11-04 21:00:05 +01:00
* ('a' & CHAR) == ('A' & CHAR) == 1
*/
#define DIC_CHAR_MASK 0x1F
2004-04-08 11:43:06 +02:00
/**
* keyword included in dictionary headers
* implies little endian storage on words
*/
2004-04-08 11:43:06 +02:00
#define _COMPIL_KEYWORD_ "_COMPILED_DICTIONARY_"
/**
* structure of a compressed dictionary \n
* \n
* ---------------- \n
* header \n
* ---------------- \n
* specialnode (0) \n
* + \n
* + nodes \n
* + \n
* firstnode (= root) \n
* ----------------
*/
2004-04-08 11:43:06 +02:00
#if defined(WORDS_BIGENDIAN)
struct __attribute__ ((packed)) _Dawg_edge {
uint32_t
chr : 5,
fill : 1,
last : 1,
term : 1,
ptr : 24;
};
#else
struct __attribute__ ((packed)) _Dawg_edge {
uint32_t
ptr : 24,
term : 1,
last : 1,
fill : 1,
chr : 5;
};
#endif
typedef struct _Dawg_edge Dawg_edge;
2004-04-08 11:43:06 +02:00
struct _Dict_header {
2004-04-08 11:43:06 +02:00
char ident[sizeof(_COMPIL_KEYWORD_)];
char unused_1;
char unused_2;
int root;
int nwords;
unsigned int edgesused;
unsigned int nodesused;
unsigned int nodessaved;
unsigned int edgessaved;
};
2004-04-08 11:43:06 +02:00
struct _Dictionary
{
2005-11-04 21:00:05 +01:00
Dawg_edge *dawg;
2004-04-08 11:43:06 +02:00
unsigned int root;
int nwords;
int nnodes;
int nedges;
};
#if defined(__cplusplus)
}
2005-11-04 21:00:05 +01:00
#endif
#endif /* _DIC_INTERNALS_H */