00001 /* LibHnj is dual licensed under LGPL and MPL. Boilerplate for both 00002 * licenses follows. 00003 */ 00004 00005 /* LibHnj - a library for high quality hyphenation and justification 00006 * Copyright (C) 1998 Raph Levien, (C) 2001 ALTLinux, Moscow 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public 00019 * License along with this library; if not, write to the 00020 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 * Boston, MA 02110-1301, USA. 00022 */ 00023 00024 /* 00025 * The contents of this file are subject to the Mozilla Public License 00026 * Version 1.0 (the "MPL"); you may not use this file except in 00027 * compliance with the MPL. You may obtain a copy of the MPL at 00028 * http://www.mozilla.org/MPL/ 00029 * 00030 * Software distributed under the MPL is distributed on an "AS IS" basis, 00031 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL 00032 * for the specific language governing rights and limitations under the 00033 * MPL. 00034 * 00035 */ 00036 #ifndef __HYPHEN_H__ 00037 #define __HYPHEN_H__ 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif /* __cplusplus */ 00042 00043 typedef struct _HyphenDict HyphenDict; 00044 typedef struct _HyphenState HyphenState; 00045 typedef struct _HyphenTrans HyphenTrans; 00046 #define MAX_CHARS 256 00047 #define MAX_NAME 20 00048 00049 struct _HyphenDict { 00050 int num_states; 00051 char cset[MAX_NAME]; 00052 HyphenState *states; 00053 }; 00054 00055 struct _HyphenState { 00056 char *match; 00057 int fallback_state; 00058 int num_trans; 00059 HyphenTrans *trans; 00060 }; 00061 00062 struct _HyphenTrans { 00063 char ch; 00064 int new_state; 00065 }; 00066 00067 HyphenDict *hnj_hyphen_load (const char *fn); 00068 void hnj_hyphen_free (HyphenDict *dict); 00069 int hnj_hyphen_hyphenate (HyphenDict *dict, 00070 const char *word, int word_size, 00071 char *hyphens); 00072 00073 #ifdef __cplusplus 00074 } 00075 #endif /* __cplusplus */ 00076 00077 #endif /* __HYPHEN_H__ */