1 /* |
|
2 * CDDL HEADER START |
|
3 * |
|
4 * The contents of this file are subject to the terms of the |
|
5 * Common Development and Distribution License (the "License"). |
|
6 * You may not use this file except in compliance with the License. |
|
7 * |
|
8 * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE |
|
9 * or http://www.opensolaris.org/os/licensing. |
|
10 * See the License for the specific language governing permissions |
|
11 * and limitations under the License. |
|
12 * |
|
13 * When distributing Covered Code, include this CDDL HEADER in each |
|
14 * file and include the License file at src/OPENSOLARIS.LICENSE. |
|
15 * If applicable, add the following below this CDDL HEADER, with the |
|
16 * fields enclosed by brackets "[]" replaced with your own identifying |
|
17 * information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 * |
|
19 * CDDL HEADER END |
|
20 */ |
|
21 |
|
22 /* |
|
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
|
24 * Use is subject to license terms. |
|
25 */ |
|
26 |
|
27 |
|
28 #ifndef _ENCODE_H_ |
|
29 #define _ENCODE_H_ |
|
30 |
|
31 typedef enum { FAIL, LOW, HIGH, ORIGINAL } Score; |
|
32 typedef enum { ConvName, |
|
33 ConvContent = 0x10, |
|
34 ConvContentWithCRLF, |
|
35 ConvContentCRLFOnly, |
|
36 ConvNameReverse = 0x100, |
|
37 ConvContentReverse = 0x1000, |
|
38 ConvContentWithCRLFReverse, |
|
39 ConvContentCRLFOnlyReverse |
|
40 } ConvType; |
|
41 |
|
42 #define GetConvTypeReverse(c) ((c == ConvName) ? ConvNameReverse : \ |
|
43 (c - ConvContent) + ConvContentReverse) |
|
44 |
|
45 typedef struct _Encoding Encoding; |
|
46 struct _Encoding { |
|
47 char codename[20]; |
|
48 GIConv icd; |
|
49 Score score; |
|
50 ConvType convtype; |
|
51 union { |
|
52 char converted_text[256]; |
|
53 char *contents; |
|
54 } u; |
|
55 }; |
|
56 |
|
57 typedef gboolean (*EncodeFunc) (Encoding *, gint, va_list); |
|
58 |
|
59 GList *init_encode (GSList *); |
|
60 Score decode_analyzer (GList *, ConvType, gchar *, size_t); |
|
61 void iterate_encode_with_func (GList *, EncodeFunc, ...); |
|
62 gboolean get_encode_elements (Encoding *, gint, va_list); |
|
63 gboolean translate_encode_index (Encoding *, gint, va_list); |
|
64 gint get_first_encode_index (GList *); |
|
65 void destroy_encode (GList *); |
|
66 void cleanup_encode (GList *); |
|
67 |
|
68 #endif |
|