libtranscript
/home/gertjan/projects/transcript/src/transcript_internal.h
00001 /* Copyright (C) 2011 G.P. Halkes
00002    This program is free software: you can redistribute it and/or modify
00003    it under the terms of the GNU General Public License version 3, as
00004    published by the Free Software Foundation.
00005 
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.
00010 
00011    You should have received a copy of the GNU General Public License
00012    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00013 */
00014 #ifndef TRANSCRIPT_INTERNAL_H
00015 #define TRANSCRIPT_INTERNAL_H
00016 
00017 #include <stdio.h>
00018 #include <pthread.h>
00019 #include "transcript.h"
00020 #include "moduledefs.h"
00021 
00022 #ifndef DB_DIRECTORY
00023 #define DB_DIRECTORY "/usr/local/lib/transcript"
00024 #endif
00025 
00026 #define NORMALIZE_NAME_MAX 160
00027 #ifdef HAS_INLINE
00028 #define _TRANSCRIPT_INLINE inline
00029 #else
00030 #define _TRANSCRIPT_INLINE
00031 #endif
00032 
00033 #ifdef HAS_STRDUP
00034 #define _transcript_strdup strdup
00035 #else
00036 TRANSCRIPT_LOCAL char *_transcript_strdup(const char *str);
00037 #endif
00038 
00039 #define ACQUIRE_LOCK() pthread_mutex_lock(&_transcript_lock);
00040 #define RELEASE_LOCK() pthread_mutex_unlock(&_transcript_lock);
00041 
00042 TRANSCRIPT_LOCAL extern void (*_transcript_acquire_lock)(void *);
00043 TRANSCRIPT_LOCAL extern void (*_transcript_release_lock)(void *);
00044 TRANSCRIPT_LOCAL extern pthread_mutex_t _transcript_lock;
00045 
00046 struct _transcript_iconv_t {
00047         transcript_t *from, *to;
00048 };
00049 
00050 typedef struct transcript_alias_name_t {
00051         char *name;
00052         struct transcript_alias_name_t *next;
00053 } transcript_alias_name_t;
00054 
00055 #define NAME_DESC_FLAG_HAS_DISPNAME (1<<0)
00056 #define NAME_DESC_FLAG_DISABLED (1<<1)
00057 #define NAME_DESC_FLAG_PROBE_LOAD (1<<2)
00058 
00059 typedef struct transcript_name_desc_t {
00060         char *real_name;
00061         char *name;
00062         transcript_alias_name_t *aliases;
00063         struct transcript_name_desc_t *next;
00064         int flags;
00065 } transcript_name_desc_t;
00066 
00067 typedef void *(*open_func_t)(const char *);
00068 
00069 TRANSCRIPT_LOCAL transcript_t *_transcript_fill_utf(transcript_t *handle, transcript_utf_t utf_type);
00070 
00071 TRANSCRIPT_LOCAL void _transcript_log(const char *fmt, ...);
00072 
00073 TRANSCRIPT_LOCAL transcript_name_desc_t *_transcript_get_name_desc(const char *name, int need_normalization);
00074 
00075 TRANSCRIPT_LOCAL void *_transcript_db_open(const char *name, const char *ext, open_func_t open_func, transcript_error_t *error);
00076 
00077 TRANSCRIPT_LOCAL int _transcript_isalnum(int c);
00078 TRANSCRIPT_LOCAL int _transcript_isdigit(int c);
00079 TRANSCRIPT_LOCAL int _transcript_isspace(int c);
00080 TRANSCRIPT_LOCAL int _transcript_isidchr(int c);
00081 TRANSCRIPT_LOCAL int _transcript_tolower(int c);
00082 
00083 TRANSCRIPT_LOCAL void _transcript_init_aliases_from_file(void);
00084 TRANSCRIPT_LOCAL void _transcript_free_aliases(void);
00085 TRANSCRIPT_LOCAL void *_transcript_open_state_table_converter(const converter_tables_v1_t *tables, int flags, transcript_error_t *error);
00086 TRANSCRIPT_LOCAL void *_transcript_open_sbcs_table_converter(const sbcs_converter_v1_t *tables, int flags, transcript_error_t *error);
00087 
00088 TRANSCRIPT_LOCAL extern const char **_transcript_search_path;
00089 TRANSCRIPT_LOCAL extern int _transcript_initialized_count;
00090 #endif
 All Data Structures Variables