libtranscript
 All Data Structures Functions Variables Enumerations Enumerator Modules
transcript_internal.h
1 /* Copyright (C) 2011,2013 G.P. Halkes
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License version 3, as
4  published by the Free Software Foundation.
5 
6  This program is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  GNU General Public License for more details.
10 
11  You should have received a copy of the GNU General Public License
12  along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14 #ifndef TRANSCRIPT_INTERNAL_H
15 #define TRANSCRIPT_INTERNAL_H
16 
17 #include <stdio.h>
18 #include <pthread.h>
19 #include "transcript.h"
20 #include "moduledefs.h"
21 
22 #ifndef DB_DIRECTORY
23 #define DB_DIRECTORY "/usr/local/lib/transcript"
24 #endif
25 
26 #define NORMALIZE_NAME_MAX 160
27 #ifdef HAS_INLINE
28 #define _TRANSCRIPT_INLINE inline
29 #else
30 #define _TRANSCRIPT_INLINE
31 #endif
32 
33 #ifdef HAS_STRDUP
34 #define _transcript_strdup strdup
35 #else
36 TRANSCRIPT_LOCAL char *_transcript_strdup(const char *str);
37 #endif
38 
39 #define ACQUIRE_LOCK() pthread_mutex_lock(&_transcript_lock);
40 #define RELEASE_LOCK() pthread_mutex_unlock(&_transcript_lock);
41 
42 TRANSCRIPT_LOCAL extern void (*_transcript_acquire_lock)(void *);
43 TRANSCRIPT_LOCAL extern void (*_transcript_release_lock)(void *);
44 TRANSCRIPT_LOCAL extern pthread_mutex_t _transcript_lock;
45 
46 struct _transcript_iconv_t {
47  transcript_t *from, *to;
48 };
49 
50 typedef struct transcript_alias_name_t {
51  char *name;
52  struct transcript_alias_name_t *next;
53 } transcript_alias_name_t;
54 
55 #define NAME_DESC_FLAG_HAS_DISPNAME (1<<0)
56 #define NAME_DESC_FLAG_DISABLED (1<<1)
57 #define NAME_DESC_FLAG_PROBE_LOAD (1<<2)
58 
59 typedef struct transcript_name_desc_t {
60  char *real_name;
61  char *name;
62  transcript_alias_name_t *aliases;
63  struct transcript_name_desc_t *next;
64  int flags;
65 } transcript_name_desc_t;
66 
67 typedef void *(*open_func_t)(const char *);
68 
69 TRANSCRIPT_LOCAL transcript_t *_transcript_fill_utf(transcript_t *handle, transcript_utf_t utf_type);
70 
71 TRANSCRIPT_LOCAL void _transcript_log(const char *fmt, ...);
72 
73 TRANSCRIPT_LOCAL transcript_name_desc_t *_transcript_get_name_desc(const char *name, int need_normalization);
74 
75 TRANSCRIPT_LOCAL void *_transcript_db_open(const char *name, const char *ext, open_func_t open_func, transcript_error_t *error);
76 
77 TRANSCRIPT_LOCAL int _transcript_isalnum(int c);
78 TRANSCRIPT_LOCAL int _transcript_isdigit(int c);
79 TRANSCRIPT_LOCAL int _transcript_isspace(int c);
80 TRANSCRIPT_LOCAL int _transcript_isidchr(int c);
81 TRANSCRIPT_LOCAL int _transcript_tolower(int c);
82 
83 TRANSCRIPT_LOCAL void _transcript_init_aliases_from_file(void);
84 TRANSCRIPT_LOCAL void _transcript_free_aliases(void);
85 TRANSCRIPT_LOCAL void *_transcript_open_state_table_converter(const converter_tables_v1_t *tables, int flags, transcript_error_t *error);
86 TRANSCRIPT_LOCAL void *_transcript_open_sbcs_table_converter(const sbcs_converter_v1_t *tables, int flags, transcript_error_t *error);
87 
88 TRANSCRIPT_LOCAL extern const char **_transcript_search_path;
89 TRANSCRIPT_LOCAL extern int _transcript_initialized_count;
90 #endif
transcript_error_t
Error values.
Definition: transcript.h:91
An opaque structure describing a converter and its state.
Definition: handle.h:28