1 /* LibHnj is dual licensed under LGPL and MPL. Boilerplate for both
2  * licenses follows.
3  */
4 
5 /* LibHnj - a library for high quality hyphenation and justification
6  * Copyright (C) 1998 Raph Levien, (C) 2001 ALTLinux, Moscow
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA  02111-1307  USA.
22 */
23 
24 /*
25  * The contents of this file are subject to the Mozilla Public License
26  * Version 1.0 (the "MPL"); you may not use this file except in
27  * compliance with the MPL.  You may obtain a copy of the MPL at
28  * http://www.mozilla.org/MPL/
29  *
30  * Software distributed under the MPL is distributed on an "AS IS" basis,
31  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
32  * for the specific language governing rights and limitations under the
33  * MPL.
34  *
35  */
36 
37 /*
38  * Changes by Gunnar Ritter, Freiburg i. Br., Germany, August 2005.
39  *
40  * Sccsid @(#)hyphen.h	1.3 (gritter) 8/25/05
41  */
42 
43 #ifndef __HYPHEN_H__
44 #define __HYPHEN_H__
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif /* __cplusplus */
49 
50 typedef struct _HyphenDict HyphenDict;
51 typedef struct _HyphenState HyphenState;
52 typedef struct _HyphenTrans HyphenTrans;
53 #define MAX_CHARS 256
54 #define MAX_NAME 20
55 
56 struct _HyphenDict {
57   int num_states;
58   int alc_states;
59   char cset[MAX_NAME];
60   HyphenState *states;
61   char *space;
62   char *spptr;
63   int spacesize;
64 };
65 
66 struct _HyphenState {
67   char *match;
68   int fallback_state;
69   int num_trans;
70   int alc_trans;
71   HyphenTrans *trans;
72 };
73 
74 struct _HyphenTrans {
75   char ch;
76   int new_state;
77 };
78 
79 HyphenDict *hnj_hyphen_load (const char *fn);
80 void hnj_hyphen_free (HyphenDict *dict);
81 int hnj_hyphen_hyphenate (HyphenDict *dict,
82 			   const char *_word, int word_size,
83 			   char *hyphens);
84 
85 #ifdef __cplusplus
86 }
87 #endif /* __cplusplus */
88 
89 #endif /* __HYPHEN_H__ */
90