OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [iconv/] [ccs/] [ccs.h] - Blame information for rev 262

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*
2
 * Copyright (c) 2003-2004, Artem B. Bityuckiy
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
 * SUCH DAMAGE.
24
 */
25
#ifndef __CCS_H__
26
#define __CCS_H__
27
 
28
#include <_ansi.h>
29
#include <sys/types.h>
30
#include <sys/param.h>
31
 
32
/*
33
 * Size-optimized tables will be linked instead of speed-optimized if
34
 * TABLE_USE_SIZE_OPTIMISATION macro is defined.
35
 */
36
#if defined (PREFER_SIZE_OVER_SPEED) || defined (__OPTIMIZE_SIZE__)
37
#  define TABLE_USE_SIZE_OPTIMIZATION
38
#endif
39
 
40
/* Invalid code marker */
41
#define INVALC  0xFFFF
42
/* Invalid block marker - marks empty blocks in speed-optimized tables */
43
#define INVBLK  0xFFFF
44
/* Lost code marker - marks codes that was lost during CCS->UCS mapping */
45
#define LOST_C DEFAULT_CHARACTER
46
 
47
/*
48
 * Table parameters values.
49
 */
50
/* Table version 1.0 identifier */
51
#define TABLE_VERSION_1 1
52
/* 8 and 16 bit tables identifiers */
53
#define TABLE_8BIT  8
54
#define TABLE_16BIT 16
55
/* Size-optimized and speed-optimized tables identifiers */
56
#define TABLE_SIZE_OPTIMIZED  1
57
#define TABLE_SPEED_OPTIMIZED 2
58
/* Built-in/external tables identifiers */
59
#define TABLE_BUILTIN  1
60
#define TABLE_EXTERNAL 2
61
 
62
/*
63
 * Binary table fields.
64
 */
65
/* "No table" marker */
66
#define EXTTABLE_NO_TABLE 0
67
/* Version offset (2 bytes) */
68
#define EXTTABLE_VERSION_OFF 0
69
/* Bits number offset (2 bytes) */
70
#define EXTTABLE_BITS_OFF 2
71
/* CCS name length offset (2 bytes) */
72
#define EXTTABLE_CCSNAME_LEN_OFF 4
73
/* CCS name offset (expanded to even bytes number)*/
74
#define EXTTABLE_CCSNAME_OFF 8
75
/* Header length (minus CCS name) */
76
#define EXTTABLE_HEADER_LEN (EXTTABLE_CCSNAME_OFF + 16*4)
77
/* Tables and lengths offsets minus CCS name length (4 bytes) */
78
#define EXTTABLE_FROM_SPEED_BE_OFF     (EXTTABLE_CCSNAME_OFF + 0)
79
#define EXTTABLE_FROM_SPEED_BE_LEN_OFF (EXTTABLE_CCSNAME_OFF + 4)
80
#define EXTTABLE_FROM_SPEED_LE_OFF     (EXTTABLE_CCSNAME_OFF + 8)
81
#define EXTTABLE_FROM_SPEED_LE_LEN_OFF (EXTTABLE_CCSNAME_OFF + 12)
82
#define EXTTABLE_FROM_SIZE_BE_OFF      (EXTTABLE_CCSNAME_OFF + 16)
83
#define EXTTABLE_FROM_SIZE_BE_LEN_OFF  (EXTTABLE_CCSNAME_OFF + 20)
84
#define EXTTABLE_FROM_SIZE_LE_OFF      (EXTTABLE_CCSNAME_OFF + 24)
85
#define EXTTABLE_FROM_SIZE_LE_LEN_OFF  (EXTTABLE_CCSNAME_OFF + 28)
86
#define EXTTABLE_TO_SPEED_BE_OFF       (EXTTABLE_CCSNAME_OFF + 32)
87
#define EXTTABLE_TO_SPEED_BE_LEN_OFF   (EXTTABLE_CCSNAME_OFF + 36)
88
#define EXTTABLE_TO_SPEED_LE_OFF       (EXTTABLE_CCSNAME_OFF + 40)
89
#define EXTTABLE_TO_SPEED_LE_LEN_OFF   (EXTTABLE_CCSNAME_OFF + 44)
90
#define EXTTABLE_TO_SIZE_BE_OFF        (EXTTABLE_CCSNAME_OFF + 48)
91
#define EXTTABLE_TO_SIZE_BE_LEN_OFF    (EXTTABLE_CCSNAME_OFF + 52)
92
#define EXTTABLE_TO_SIZE_LE_OFF        (EXTTABLE_CCSNAME_OFF + 56)
93
#define EXTTABLE_TO_SIZE_LE_LEN_OFF    (EXTTABLE_CCSNAME_OFF + 60)
94
/* Endian-independent offsets */
95
#if (BYTE_ORDER == LITTLE_ENDIAN)
96
#  define EXTTABLE_FROM_SPEED_OFF     EXTTABLE_FROM_SPEED_LE_OFF
97
#  define EXTTABLE_FROM_SIZE_OFF      EXTTABLE_FROM_SIZE_LE_OFF
98
#  define EXTTABLE_TO_SPEED_OFF       EXTTABLE_TO_SPEED_LE_OFF
99
#  define EXTTABLE_TO_SIZE_OFF        EXTTABLE_TO_SIZE_LE_OFF
100
#  define EXTTABLE_FROM_SPEED_LEN_OFF EXTTABLE_FROM_SPEED_LE_LEN_OFF
101
#  define EXTTABLE_FROM_SIZE_LEN_OFF  EXTTABLE_FROM_SIZE_LE_LEN_OFF
102
#  define EXTTABLE_TO_SPEED_LEN_OFF   EXTTABLE_TO_SPEED_LE_LEN_OFF
103
#  define EXTTABLE_TO_SIZE_LEN_OFF    EXTTABLE_TO_SIZE_LE_LEN_OFF
104
#elif (BYTE_ORDER == BIG_ENDIAN)
105
#  define EXTTABLE_FROM_SPEED_OFF     EXTTABLE_FROM_SPEED_BE_OFF
106
#  define EXTTABLE_FROM_SIZE_OFF      EXTTABLE_FROM_SIZE_BE_OFF
107
#  define EXTTABLE_TO_SPEED_OFF       EXTTABLE_TO_SPEED_BE_OFF
108
#  define EXTTABLE_TO_SIZE_OFF        EXTTABLE_TO_SIZE_BE_OFF
109
#  define EXTTABLE_FROM_SPEED_LEN_OFF EXTTABLE_FROM_SPEED_BE_LEN_OFF
110
#  define EXTTABLE_FROM_SIZE_LEN_OFF  EXTTABLE_FROM_SIZE_BE_LEN_OFF
111
#  define EXTTABLE_TO_SPEED_LEN_OFF   EXTTABLE_TO_SPEED_BE_LEN_OFF
112
#  define EXTTABLE_TO_SIZE_LEN_OFF    EXTTABLE_TO_SIZE_BE_LEN_OFF
113
#endif
114
 
115
/*
116
 * Size-optimized suitable fields indexes.
117
 */
118
/* Ranges number array index */
119
#define RANGES_NUM_INDEX    0
120
/* Un-ranged codes number array index */
121
#define UNRANGED_NUM_INDEX  1
122
/* First un-ranged pair index array index */
123
#define FIRST_UNRANGED_INDEX_INDEX 2
124
/* First range array index */
125
#define FIRST_RANGE_INDEX   3
126
 
127
 
128
/*
129
 * Builtin CCS table description structure.
130
 */
131
typedef struct
132
{
133
  __uint16_t ver;               /* Table version */
134
  _CONST char *name;            /* CCS name */
135
  __uint16_t bits;              /* CCS's bits number */
136
  int from_ucs_type;            /* UCS -> CCS table optimization type */
137
  _CONST __uint16_t *from_ucs;  /* UCS -> CCS table */
138
  int to_ucs_type;              /* CCS -> UCS table optimization type */
139
  _CONST __uint16_t *to_ucs;    /* CCS -> UCS table */
140
} iconv_ccs_t;
141
 
142
/*
143
 * CCS table descriptor.
144
 */
145
typedef struct
146
{
147
  int bits;               /* CCS's bits number */
148
  int type;               /* Table type (builtin/external) */
149
  int optimization;       /* Table optimization type (speed/size) */
150
  _CONST __uint16_t *tbl; /* Table's data */
151
} iconv_ccs_desc_t;
152
 
153
/* Array containing all built-in CCS tables */
154
extern _CONST iconv_ccs_t *
155
_iconv_ccs[];
156
 
157
#endif /* __CCS_H__ */
158
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.