libtranscript
 All Data Structures Functions Variables Enumerations Enumerator Modules
handle.h
1 /* Copyright (C) 2011-2012 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_HANDLE_H
15 #define TRANSCRIPT_HANDLE_H
16 #include <transcript/bool.h>
17 
18 typedef transcript_error_t (*conversion_func_t)(transcript_t *handle, const char **inbuf, const char *inbuflimit,
19  char **outbuf, const char *outbuflimit, int flags);
20 typedef transcript_error_t (*flush_func_t)(transcript_t *handle, char **outbuf, const char *outbuflimit);
21 typedef transcript_error_t (*skip_func_t)(transcript_t *handle, const char **inbuf, const char *inbuflimit);
22 typedef transcript_error_t (*put_unicode_func_t)(uint_fast32_t codepoint, char **outbuf, const char *outbuflimit);
23 typedef uint_fast32_t (*get_unicode_func_t)(const char **inbuf, const char *inbuflimit, bool_t skip);
24 typedef void (*reset_func_t)(transcript_t *handle);
25 typedef void (*close_func_t)(transcript_t *handle);
26 typedef void (*save_load_func_t)(transcript_t *handle, void *state);
27 
28 struct transcript_t {
29  conversion_func_t convert_to;
30  conversion_func_t convert_from;
31  /* flush_func_t flush_to; */ /* The same for all converters! */
32  flush_func_t flush_from;
33  skip_func_t skip_to;
34  /* skip_func_t skip_from; */ /* The same for all converters! */
35  put_unicode_func_t put_unicode;
36  get_unicode_func_t get_unicode;
37  reset_func_t reset_to;
38  reset_func_t reset_from;
39  close_func_t close;
40  save_load_func_t save;
41  save_load_func_t load;
42  void *library_handle;
43  int flags;
44 };
45 
46 TRANSCRIPT_API transcript_t *transcript_open_converter_nolock(const char *name, transcript_utf_t utf_type,
47  int flags, transcript_error_t *error);
48 TRANSCRIPT_API void transcript_close_converter_nolock(transcript_t *handle);
49 #endif
transcript_error_t
Error values.
Definition: transcript.h:91
An opaque structure describing a converter and its state.
Definition: handle.h:28