1 /*
2  * Copyright (C) 2002 Red Hat, Inc.
3  *
4  * This is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Library General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the Free Software
16  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 
19 /* The interfaces in this file are subject to change at any time. */
20 
21 #ifndef vte_iso2022_h_included
22 #define vte_iso2022_h_included
23 
24 
25 #include <glib.h>
26 #include <glib-object.h>
27 #include "buffer.h"
28 #include "matcher.h"
29 
30 G_BEGIN_DECLS
31 
32 struct _vte_iso2022_state;
33 typedef void (*_vte_iso2022_codeset_changed_cb_fn)(struct _vte_iso2022_state *,
34 						   gpointer);
35 struct _vte_iso2022_state *_vte_iso2022_state_new(const char *native_codeset,
36 						  _vte_iso2022_codeset_changed_cb_fn,
37 						  gpointer);
38 void _vte_iso2022_state_set_codeset(struct _vte_iso2022_state *state,
39 				    const char *codeset);
40 const char *_vte_iso2022_state_get_codeset(struct _vte_iso2022_state *state);
41 gsize _vte_iso2022_process(struct _vte_iso2022_state *state,
42 			  guchar *input, gsize length,
43 			  GArray *gunichars);
44 gunichar _vte_iso2022_process_single(struct _vte_iso2022_state *state,
45 				     gunichar c, gunichar map);
46 void _vte_iso2022_state_free(struct _vte_iso2022_state *);
47 
48 
49 #define VTE_ISO2022_ENCODED_WIDTH_BIT_OFFSET	28
50 #define VTE_ISO2022_ENCODED_WIDTH_MASK		(3 << VTE_ISO2022_ENCODED_WIDTH_BIT_OFFSET)
51 #define VTE_ISO2022_HAS_ENCODED_WIDTH(__c)	(((__c) & VTE_ISO2022_ENCODED_WIDTH_MASK) != 0)
52 int _vte_iso2022_get_encoded_width(gunichar c);
53 int _vte_iso2022_unichar_width(struct _vte_iso2022_state *state,
54 			       gunichar c);
55 
56 G_END_DECLS
57 
58 #endif
59