/*
* A simple array of 32-bit masks for lookup.
*/
-static unsigned long masks32[32] = {
+static ac_uint4 masks32[32] = {
0x00000001UL, 0x00000002UL, 0x00000004UL, 0x00000008UL,
0x00000010UL, 0x00000020UL, 0x00000040UL, 0x00000080UL,
0x00000100UL, 0x00000200UL, 0x00000400UL, 0x00000800UL,
*
**************************************************************************/
-static unsigned long _ucprop_size;
-static unsigned short *_ucprop_offsets;
-static unsigned long *_ucprop_ranges;
+static ac_uint4 _ucprop_size;
+static ac_uint2 *_ucprop_offsets;
+static ac_uint4 *_ucprop_ranges;
/*
* Return -1 on error, 0 if okay
_ucprop_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_ucprop_size > 0) {
/*
* Allocate all the storage needed for the lookup table.
*/
- _ucprop_offsets = (unsigned short *) malloc(hdr.size.bytes);
+ _ucprop_offsets = (ac_uint2 *) malloc(hdr.size.bytes);
/*
* Calculate the offset into the storage for the ranges. The offsets
* the header count field. This means the offset to the ranges must be
* calculated after aligning the count to a 4-byte boundary.
*/
- if ((size = ((hdr.cnt + 1) * sizeof(unsigned short))) & 3)
+ if ((size = ((hdr.cnt + 1) * sizeof(ac_uint2))) & 3)
size += 4 - (size & 3);
size >>= 1;
- _ucprop_ranges = (unsigned long *) (_ucprop_offsets + size);
+ _ucprop_ranges = (ac_uint4 *) (_ucprop_offsets + size);
/*
* Load the offset array.
*/
- fread((char *) _ucprop_offsets, sizeof(unsigned short), size, in);
+ fread((char *) _ucprop_offsets, sizeof(ac_uint2), size, in);
/*
* Do an endian swap if necessary. Don't forget there is an extra node on
* Load the ranges. The number of elements is in the last array position
* of the offsets.
*/
- fread((char *) _ucprop_ranges, sizeof(unsigned long),
+ fread((char *) _ucprop_ranges, sizeof(ac_uint4),
_ucprop_offsets[_ucprop_size], in);
fclose(in);
}
static int
-_ucprop_lookup(unsigned long code, unsigned long n)
+_ucprop_lookup(ac_uint4 code, ac_uint4 n)
{
long l, r, m;
}
int
-ucisprop(unsigned long code, unsigned long mask1, unsigned long mask2)
+ucisprop(ac_uint4 code, ac_uint4 mask1, ac_uint4 mask2)
{
- unsigned long i;
+ ac_uint4 i;
if (mask1 == 0 && mask2 == 0)
return 0;
*
**************************************************************************/
-static unsigned long _uccase_size;
-static unsigned short _uccase_len[2];
-static unsigned long *_uccase_map;
+static ac_uint4 _uccase_size;
+static ac_uint2 _uccase_len[2];
+static ac_uint4 *_uccase_map;
/*
* Return -1 on error, 0 if okay
_uccase_load(char *paths, int reload)
{
FILE *in;
- unsigned long i;
+ ac_uint4 i;
_ucheader_t hdr;
if (_uccase_size > 0) {
_uccase_len[0] = hdr.size.len[0] * 3;
_uccase_len[1] = hdr.size.len[1] * 3;
- _uccase_map = (unsigned long *)
- malloc(_uccase_size * sizeof(unsigned long));
+ _uccase_map = (ac_uint4 *)
+ malloc(_uccase_size * sizeof(ac_uint4));
/*
* Load the case mapping table.
*/
- fread((char *) _uccase_map, sizeof(unsigned long), _uccase_size, in);
+ fread((char *) _uccase_map, sizeof(ac_uint4), _uccase_size, in);
/*
* Do an endian swap if necessary.
_uccase_size = 0;
}
-static unsigned long
-_uccase_lookup(unsigned long code, long l, long r, int field)
+static ac_uint4
+_uccase_lookup(ac_uint4 code, long l, long r, int field)
{
long m;
return code;
}
-unsigned long
-uctoupper(unsigned long code)
+ac_uint4
+uctoupper(ac_uint4 code)
{
int field;
long l, r;
return _uccase_lookup(code, l, r, field);
}
-unsigned long
-uctolower(unsigned long code)
+ac_uint4
+uctolower(ac_uint4 code)
{
int field;
long l, r;
return _uccase_lookup(code, l, r, field);
}
-unsigned long
-uctotitle(unsigned long code)
+ac_uint4
+uctotitle(ac_uint4 code)
{
int field;
long l, r;
*
**************************************************************************/
-static unsigned long _uccomp_size;
-static unsigned long *_uccomp_data;
+static ac_uint4 _uccomp_size;
+static ac_uint4 *_uccomp_data;
/*
* Return -1 on error, 0 if okay
_uccomp_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_uccomp_size > 0) {
}
_uccomp_size = hdr.cnt;
- _uccomp_data = (unsigned long *) malloc(hdr.size.bytes);
+ _uccomp_data = (ac_uint4 *) malloc(hdr.size.bytes);
/*
* Read the composition data in.
*/
- size = hdr.size.bytes / sizeof(unsigned long);
- fread((char *) _uccomp_data, sizeof(unsigned long), size, in);
+ size = hdr.size.bytes / sizeof(ac_uint4);
+ fread((char *) _uccomp_data, sizeof(ac_uint4), size, in);
/*
* Do an endian swap if necessary.
}
int
-uccomp(unsigned long node1, unsigned long node2, unsigned long *comp)
+uccomp(ac_uint4 node1, ac_uint4 node2, ac_uint4 *comp)
{
int l, r, m;
}
int
-uccomp_hangul(unsigned long *str, int len)
+uccomp_hangul(ac_uint4 *str, int len)
{
const int SBase = 0xAC00, LBase = 0x1100,
VBase = 0x1161, TBase = 0x11A7,
SCount = LCount * NCount; /* 11172 */
int i, rlen;
- unsigned long ch, last, lindex, sindex;
+ ac_uint4 ch, last, lindex, sindex;
last = str[0];
rlen = 1;
/* check if two current characters are L and V */
lindex = last - LBase;
- if (lindex < (unsigned long) LCount) {
- unsigned long vindex = ch - VBase;
- if (vindex < (unsigned long) VCount) {
+ if (lindex < (ac_uint4) LCount) {
+ ac_uint4 vindex = ch - VBase;
+ if (vindex < (ac_uint4) VCount) {
/* make syllable of form LV */
last = SBase + (lindex * VCount + vindex) * TCount;
str[rlen-1] = last; /* reset last */
/* check if two current characters are LV and T */
sindex = last - SBase;
- if (sindex < (unsigned long) SCount
+ if (sindex < (ac_uint4) SCount
&& (sindex % TCount) == 0)
{
- unsigned long tindex = ch - TBase;
- if (tindex <= (unsigned long) TCount) {
+ ac_uint4 tindex = ch - TBase;
+ if (tindex <= (ac_uint4) TCount) {
/* make syllable of form LVT */
last += tindex;
str[rlen-1] = last; /* reset last */
}
int
-uccanoncomp(unsigned long *str, int len)
+uccanoncomp(ac_uint4 *str, int len)
{
int i, stpos, copos;
- unsigned long cl, prevcl, st, ch, co;
+ ac_uint4 cl, prevcl, st, ch, co;
st = str[0];
stpos = 0;
*
**************************************************************************/
-static unsigned long _ucdcmp_size;
-static unsigned long *_ucdcmp_nodes;
-static unsigned long *_ucdcmp_decomp;
+static ac_uint4 _ucdcmp_size;
+static ac_uint4 *_ucdcmp_nodes;
+static ac_uint4 *_ucdcmp_decomp;
-static unsigned long _uckdcmp_size;
-static unsigned long *_uckdcmp_nodes;
-static unsigned long *_uckdcmp_decomp;
+static ac_uint4 _uckdcmp_size;
+static ac_uint4 *_uckdcmp_nodes;
+static ac_uint4 *_uckdcmp_decomp;
/*
* Return -1 on error, 0 if okay
_ucdcmp_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_ucdcmp_size > 0) {
}
_ucdcmp_size = hdr.cnt << 1;
- _ucdcmp_nodes = (unsigned long *) malloc(hdr.size.bytes);
+ _ucdcmp_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
_ucdcmp_decomp = _ucdcmp_nodes + (_ucdcmp_size + 1);
/*
* Read the decomposition data in.
*/
- size = hdr.size.bytes / sizeof(unsigned long);
- fread((char *) _ucdcmp_nodes, sizeof(unsigned long), size, in);
+ size = hdr.size.bytes / sizeof(ac_uint4);
+ fread((char *) _ucdcmp_nodes, sizeof(ac_uint4), size, in);
/*
* Do an endian swap if necessary.
_uckdcmp_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_uckdcmp_size > 0) {
}
_uckdcmp_size = hdr.cnt << 1;
- _uckdcmp_nodes = (unsigned long *) malloc(hdr.size.bytes);
+ _uckdcmp_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
_uckdcmp_decomp = _uckdcmp_nodes + (_uckdcmp_size + 1);
/*
* Read the decomposition data in.
*/
- size = hdr.size.bytes / sizeof(unsigned long);
- fread((char *) _uckdcmp_nodes, sizeof(unsigned long), size, in);
+ size = hdr.size.bytes / sizeof(ac_uint4);
+ fread((char *) _uckdcmp_nodes, sizeof(ac_uint4), size, in);
/*
* Do an endian swap if necessary.
}
int
-ucdecomp(unsigned long code, unsigned long *num, unsigned long **decomp)
+ucdecomp(ac_uint4 code, ac_uint4 *num, ac_uint4 **decomp)
{
long l, r, m;
}
int
-uckdecomp(unsigned long code, unsigned long *num, unsigned long **decomp)
+uckdecomp(ac_uint4 code, ac_uint4 *num, ac_uint4 **decomp)
{
long l, r, m;
}
int
-ucdecomp_hangul(unsigned long code, unsigned long *num, unsigned long decomp[])
+ucdecomp_hangul(ac_uint4 code, ac_uint4 *num, ac_uint4 decomp[])
{
if (!ucishangul(code))
return 0;
code -= 0xac00;
- decomp[0] = 0x1100 + (unsigned long) (code / 588);
- decomp[1] = 0x1161 + (unsigned long) ((code % 588) / 28);
- decomp[2] = 0x11a7 + (unsigned long) (code % 28);
+ decomp[0] = 0x1100 + (ac_uint4) (code / 588);
+ decomp[1] = 0x1161 + (ac_uint4) ((code % 588) / 28);
+ decomp[2] = 0x11a7 + (ac_uint4) (code % 28);
*num = (decomp[2] != 0x11a7) ? 3 : 2;
return 1;
/* mode == 0 for canonical, mode == 1 for compatibility */
static int
-uccanoncompatdecomp(const unsigned long *in, int inlen,
- unsigned long **out, int *outlen, short mode, void *ctx)
+uccanoncompatdecomp(const ac_uint4 *in, int inlen,
+ ac_uint4 **out, int *outlen, short mode, void *ctx)
{
int l, size;
unsigned i, j, k;
- unsigned long num, class, *decomp, hangdecomp[3];
+ ac_uint4 num, class, *decomp, hangdecomp[3];
size = inlen * 2;
- *out = (unsigned long *) ber_memalloc_x(size * sizeof(**out), ctx);
+ *out = (ac_uint4 *) ber_memalloc_x(size * sizeof(**out), ctx);
if (*out == NULL)
return *outlen = -1;
if (mode ? uckdecomp(in[j], &num, &decomp) : ucdecomp(in[j], &num, &decomp)) {
if ( size - i < num) {
size = inlen + i - j + num - 1;
- *out = (unsigned long *) ber_memrealloc_x(*out, size * sizeof(**out), ctx );
+ *out = (ac_uint4 *) ber_memrealloc_x(*out, size * sizeof(**out), ctx );
if (*out == NULL)
return *outlen = -1;
}
} else if (ucdecomp_hangul(in[j], &num, hangdecomp)) {
if (size - i < num) {
size = inlen + i - j + num - 1;
- *out = (unsigned long *) ber_memrealloc_x(*out, size * sizeof(**out), ctx);
+ *out = (ac_uint4 *) ber_memrealloc_x(*out, size * sizeof(**out), ctx);
if (*out == NULL)
return *outlen = -1;
}
} else {
if (size - i < 1) {
size = inlen + i - j;
- *out = (unsigned long *) ber_memrealloc_x(*out, size * sizeof(**out), ctx);
+ *out = (ac_uint4 *) ber_memrealloc_x(*out, size * sizeof(**out), ctx);
if (*out == NULL)
return *outlen = -1;
}
}
int
-uccanondecomp(const unsigned long *in, int inlen,
- unsigned long **out, int *outlen, void *ctx)
+uccanondecomp(const ac_uint4 *in, int inlen,
+ ac_uint4 **out, int *outlen, void *ctx)
{
return uccanoncompatdecomp(in, inlen, out, outlen, 0, ctx);
}
int
-uccompatdecomp(const unsigned long *in, int inlen,
- unsigned long **out, int *outlen, void *ctx)
+uccompatdecomp(const ac_uint4 *in, int inlen,
+ ac_uint4 **out, int *outlen, void *ctx)
{
return uccanoncompatdecomp(in, inlen, out, outlen, 1, ctx);
}
*
**************************************************************************/
-static unsigned long _uccmcl_size;
-static unsigned long *_uccmcl_nodes;
+static ac_uint4 _uccmcl_size;
+static ac_uint4 *_uccmcl_nodes;
/*
* Return -1 on error, 0 if okay
_uccmcl_load(char *paths, int reload)
{
FILE *in;
- unsigned long i;
+ ac_uint4 i;
_ucheader_t hdr;
if (_uccmcl_size > 0) {
}
_uccmcl_size = hdr.cnt * 3;
- _uccmcl_nodes = (unsigned long *) malloc(hdr.size.bytes);
+ _uccmcl_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
/*
* Read the combining classes in.
*/
- fread((char *) _uccmcl_nodes, sizeof(unsigned long), _uccmcl_size, in);
+ fread((char *) _uccmcl_nodes, sizeof(ac_uint4), _uccmcl_size, in);
/*
* Do an endian swap if necessary.
_uccmcl_size = 0;
}
-unsigned long
-uccombining_class(unsigned long code)
+ac_uint4
+uccombining_class(ac_uint4 code)
{
long l, r, m;
*
**************************************************************************/
-static unsigned long *_ucnum_nodes;
-static unsigned long _ucnum_size;
+static ac_uint4 *_ucnum_nodes;
+static ac_uint4 _ucnum_size;
static short *_ucnum_vals;
/*
_ucnumb_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_ucnum_size > 0) {
}
_ucnum_size = hdr.cnt;
- _ucnum_nodes = (unsigned long *) malloc(hdr.size.bytes);
+ _ucnum_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
_ucnum_vals = (short *) (_ucnum_nodes + _ucnum_size);
/*
* Determine the number of values that have to be adjusted.
*/
size = (hdr.size.bytes -
- (_ucnum_size * (sizeof(unsigned long) << 1))) /
+ (_ucnum_size * (sizeof(ac_uint4) << 1))) /
sizeof(short);
for (i = 0; i < size; i++)
}
int
-ucnumber_lookup(unsigned long code, struct ucnumber *num)
+ucnumber_lookup(ac_uint4 code, struct ucnumber *num)
{
long l, r, m;
short *vp;
}
int
-ucdigit_lookup(unsigned long code, int *digit)
+ucdigit_lookup(ac_uint4 code, int *digit)
{
long l, r, m;
short *vp;
}
struct ucnumber
-ucgetnumber(unsigned long code)
+ucgetnumber(ac_uint4 code)
{
struct ucnumber num;
}
int
-ucgetdigit(unsigned long code)
+ucgetdigit(ac_uint4 code)
{
int dig;
main(void)
{
int dig;
- unsigned long i, lo, *dec;
+ ac_uint4 i, lo, *dec;
struct ucnumber num;
ucdata_setup(".");
* A header written to the output file with the byte-order-mark and the number
* of property nodes.
*/
-static unsigned short hdr[2] = {0xfeff, 0};
+static ac_uint2 hdr[2] = {0xfeff, 0};
#define NUMPROPS 50
#define NEEDPROPS (NUMPROPS + (4 - (NUMPROPS & 3)))
};
typedef struct {
- unsigned long *ranges;
- unsigned short used;
- unsigned short size;
+ ac_uint4 *ranges;
+ ac_uint2 used;
+ ac_uint2 size;
} _ranges_t;
static _ranges_t proptbl[NUMPROPS];
/*
* Make sure this array is sized to be on a 4-byte boundary at compile time.
*/
-static unsigned short propcnt[NEEDPROPS];
+static ac_uint2 propcnt[NEEDPROPS];
/*
* Array used to collect a decomposition before adding it to the decomposition
* table.
*/
-static unsigned long dectmp[64];
-static unsigned long dectmp_size;
+static ac_uint4 dectmp[64];
+static ac_uint4 dectmp_size;
typedef struct {
- unsigned long code;
- unsigned short size;
- unsigned short used;
- unsigned long *decomp;
+ ac_uint4 code;
+ ac_uint2 size;
+ ac_uint2 used;
+ ac_uint4 *decomp;
} _decomp_t;
/*
* compatibility mappings.
*/
static _decomp_t *decomps;
-static unsigned long decomps_used;
-static unsigned long decomps_size;
+static ac_uint4 decomps_used;
+static ac_uint4 decomps_size;
static _decomp_t *kdecomps;
-static unsigned long kdecomps_used;
-static unsigned long kdecomps_size;
+static ac_uint4 kdecomps_used;
+static ac_uint4 kdecomps_size;
/*
* Composition exclusion table stuff.
*/
#define COMPEX_SET(c) (compexs[(c) >> 5] |= (1 << ((c) & 31)))
#define COMPEX_TEST(c) (compexs[(c) >> 5] & (1 << ((c) & 31)))
-static unsigned long compexs[2048];
+static ac_uint4 compexs[2048];
/*
* Struct for holding a composition pair, and array of composition pairs
*/
typedef struct {
- unsigned long comp;
- unsigned long count;
- unsigned long code1;
- unsigned long code2;
+ ac_uint4 comp;
+ ac_uint4 count;
+ ac_uint4 code1;
+ ac_uint4 code2;
} _comp_t;
static _comp_t *comps;
-static unsigned long comps_used;
+static ac_uint4 comps_used;
/*
* Types and lists for handling lists of case mappings.
*/
typedef struct {
- unsigned long key;
- unsigned long other1;
- unsigned long other2;
+ ac_uint4 key;
+ ac_uint4 other1;
+ ac_uint4 other2;
} _case_t;
static _case_t *upper;
static _case_t *lower;
static _case_t *title;
-static unsigned long upper_used;
-static unsigned long upper_size;
-static unsigned long lower_used;
-static unsigned long lower_size;
-static unsigned long title_used;
-static unsigned long title_size;
+static ac_uint4 upper_used;
+static ac_uint4 upper_size;
+static ac_uint4 lower_used;
+static ac_uint4 lower_size;
+static ac_uint4 title_used;
+static ac_uint4 title_size;
/*
* Array used to collect case mappings before adding them to a list.
*/
-static unsigned long cases[3];
+static ac_uint4 cases[3];
/*
* An array to hold ranges for combining classes.
*/
-static unsigned long *ccl;
-static unsigned long ccl_used;
-static unsigned long ccl_size;
+static ac_uint4 *ccl;
+static ac_uint4 ccl_used;
+static ac_uint4 ccl_size;
/*
* Structures for handling numbers.
*/
typedef struct {
- unsigned long code;
- unsigned long idx;
+ ac_uint4 code;
+ ac_uint4 idx;
} _codeidx_t;
typedef struct {
* Arrays to hold the mapping of codes to numbers.
*/
static _codeidx_t *ncodes;
-static unsigned long ncodes_used;
-static unsigned long ncodes_size;
+static ac_uint4 ncodes_used;
+static ac_uint4 ncodes_size;
static _num_t *nums;
-static unsigned long nums_used;
-static unsigned long nums_size;
+static ac_uint4 nums_used;
+static ac_uint4 nums_size;
/*
* Array for holding numbers.
*/
static _num_t *nums;
-static unsigned long nums_used;
-static unsigned long nums_size;
+static ac_uint4 nums_used;
+static ac_uint4 nums_size;
static void
-add_range(unsigned long start, unsigned long end, char *p1, char *p2)
+add_range(ac_uint4 start, ac_uint4 end, char *p1, char *p2)
{
int i, j, k, len;
_ranges_t *rlp;
*/
if (rlp->used == rlp->size) {
if (rlp->size == 0)
- rlp->ranges = (unsigned long *)
- malloc(sizeof(unsigned long) << 3);
+ rlp->ranges = (ac_uint4 *)
+ malloc(sizeof(ac_uint4) << 3);
else
- rlp->ranges = (unsigned long *)
+ rlp->ranges = (ac_uint4 *)
realloc((char *) rlp->ranges,
- sizeof(unsigned long) * (rlp->size + 8));
+ sizeof(ac_uint4) * (rlp->size + 8));
rlp->size += 8;
}
}
static void
-ordered_range_insert(unsigned long c, char *name, int len)
+ordered_range_insert(ac_uint4 c, char *name, int len)
{
int i, j;
- unsigned long s, e;
+ ac_uint4 s, e;
_ranges_t *rlp;
if (len == 0)
*/
if (rlp->used == rlp->size) {
if (rlp->size == 0)
- rlp->ranges = (unsigned long *)
- malloc(sizeof(unsigned long) << 3);
+ rlp->ranges = (ac_uint4 *)
+ malloc(sizeof(ac_uint4) << 3);
else
- rlp->ranges = (unsigned long *)
+ rlp->ranges = (ac_uint4 *)
realloc((char *) rlp->ranges,
- sizeof(unsigned long) * (rlp->size + 8));
+ sizeof(ac_uint4) * (rlp->size + 8));
rlp->size += 8;
}
}
static void
-add_decomp(unsigned long code, short compat)
+add_decomp(ac_uint4 code, short compat)
{
- unsigned long i, j, size;
+ ac_uint4 i, j, size;
_decomp_t **pdecomps;
- unsigned long *pdecomps_used;
- unsigned long *pdecomps_size;
+ ac_uint4 *pdecomps_used;
+ ac_uint4 *pdecomps_size;
if (compat) {
pdecomps = &kdecomps;
size = dectmp_size + (4 - (dectmp_size & 3));
if ((*pdecomps)[i].size < size) {
if ((*pdecomps)[i].size == 0)
- (*pdecomps)[i].decomp = (unsigned long *)
- malloc(sizeof(unsigned long) * size);
+ (*pdecomps)[i].decomp = (ac_uint4 *)
+ malloc(sizeof(ac_uint4) * size);
else
- (*pdecomps)[i].decomp = (unsigned long *)
+ (*pdecomps)[i].decomp = (ac_uint4 *)
realloc((char *) (*pdecomps)[i].decomp,
- sizeof(unsigned long) * size);
+ sizeof(ac_uint4) * size);
(*pdecomps)[i].size = size;
}
(*pdecomps)[i].code = code;
(*pdecomps)[i].used = dectmp_size;
(void) AC_MEMCPY((char *) (*pdecomps)[i].decomp, (char *) dectmp,
- sizeof(unsigned long) * dectmp_size);
+ sizeof(ac_uint4) * dectmp_size);
/*
* NOTICE: This needs changing later so it is more general than simply
}
static void
-add_title(unsigned long code)
+add_title(ac_uint4 code)
{
- unsigned long i, j;
+ ac_uint4 i, j;
/*
* Always map the code to itself.
}
static void
-add_upper(unsigned long code)
+add_upper(ac_uint4 code)
{
- unsigned long i, j;
+ ac_uint4 i, j;
/*
* Always map the code to itself.
}
static void
-add_lower(unsigned long code)
+add_lower(ac_uint4 code)
{
- unsigned long i, j;
+ ac_uint4 i, j;
/*
* Always map the code to itself.
}
static void
-ordered_ccl_insert(unsigned long c, unsigned long ccl_code)
+ordered_ccl_insert(ac_uint4 c, ac_uint4 ccl_code)
{
- unsigned long i, j;
+ ac_uint4 i, j;
if (ccl_used == ccl_size) {
if (ccl_size == 0)
- ccl = (unsigned long *) malloc(sizeof(unsigned long) * 24);
+ ccl = (ac_uint4 *) malloc(sizeof(ac_uint4) * 24);
else
- ccl = (unsigned long *)
- realloc((char *) ccl, sizeof(unsigned long) * (ccl_size + 24));
+ ccl = (ac_uint4 *)
+ realloc((char *) ccl, sizeof(ac_uint4) * (ccl_size + 24));
ccl_size += 24;
}
* Adds a number if it does not already exist and returns an index value
* multiplied by 2.
*/
-static unsigned long
+static ac_uint4
make_number(short num, short denom)
{
- unsigned long n;
+ ac_uint4 n;
/*
* Determine if the number already exists.
}
static void
-add_number(unsigned long code, short num, short denom)
+add_number(ac_uint4 code, short num, short denom)
{
- unsigned long i, j;
+ ac_uint4 i, j;
/*
* Insert the code in order.
static void
read_cdata(FILE *in)
{
- unsigned long i, lineno, skip, code, ccl_code;
+ ac_uint4 i, lineno, skip, code, ccl_code;
short wnum, neg, number[2], compat;
char line[512], *s, *e;
}
static _decomp_t *
-find_decomp(unsigned long code, short compat)
+find_decomp(ac_uint4 code, short compat)
{
long l, r, m;
_decomp_t *decs;
static void
decomp_it(_decomp_t *d, short compat)
{
- unsigned long i;
+ ac_uint4 i;
_decomp_t *dp;
for (i = 0; i < d->used; i++) {
static void
expand_decomp(void)
{
- unsigned long i;
+ ac_uint4 i;
for (i = 0; i < decomps_used; i++) {
dectmp_size = 0;
static void
read_compexdata(FILE *in)
{
- unsigned short i, code;
+ ac_uint2 i, code;
char line[512], *s;
- (void) memset((char *) compexs, 0, sizeof(unsigned long) << 11);
+ (void) memset((char *) compexs, 0, sizeof(ac_uint4) << 11);
while (fgets(line, sizeof(line), in)) {
if( (s=strchr(line, '\n')) ) *s = '\0';
static void
create_comps(void)
{
- unsigned long i, cu;
+ ac_uint4 i, cu;
comps = (_comp_t *) malloc(comps_used * sizeof(_comp_t));
{
FILE *out;
ac_uint4 bytes;
- unsigned long i, idx, nprops;
- unsigned short casecnt[2];
+ ac_uint4 i, idx, nprops;
+ ac_uint2 casecnt[2];
char path[BUFSIZ];
/*****************************************************************
* Calculate the byte count needed and pad the property counts array to a
* 4-byte boundary.
*/
- if ((bytes = sizeof(unsigned short) * (NUMPROPS + 1)) & 3)
+ if ((bytes = sizeof(ac_uint2) * (NUMPROPS + 1)) & 3)
bytes += 4 - (bytes & 3);
- nprops = bytes / sizeof(unsigned short);
- bytes += sizeof(unsigned long) * idx;
+ nprops = bytes / sizeof(ac_uint2);
+ bytes += sizeof(ac_uint4) * idx;
/*
* Write the header.
/*
* Write the byte count.
*/
- fwrite((char *) &bytes, sizeof(unsigned long), 1, out);
+ fwrite((char *) &bytes, sizeof(ac_uint4), 1, out);
/*
* Write the property list counts.
*/
- fwrite((char *) propcnt, sizeof(unsigned short), nprops, out);
+ fwrite((char *) propcnt, sizeof(ac_uint2), nprops, out);
/*
* Write the property lists.
*/
for (i = 0; i < NUMPROPS; i++) {
if (proptbl[i].used > 0)
- fwrite((char *) proptbl[i].ranges, sizeof(unsigned long),
+ fwrite((char *) proptbl[i].ranges, sizeof(ac_uint4),
proptbl[i].used, out);
}
/*
* Write the header.
*/
- fwrite((char *) hdr, sizeof(unsigned short), 2, out);
+ fwrite((char *) hdr, sizeof(ac_uint2), 2, out);
/*
* Write the upper and lower case table sizes.
*/
- fwrite((char *) casecnt, sizeof(unsigned short), 2, out);
+ fwrite((char *) casecnt, sizeof(ac_uint2), 2, out);
if (upper_used > 0)
/*
/*
* Write the header.
*/
- hdr[1] = (unsigned short) comps_used * 4;
- fwrite((char *) hdr, sizeof(unsigned short), 2, out);
+ hdr[1] = (ac_uint2) comps_used * 4;
+ fwrite((char *) hdr, sizeof(ac_uint2), 2, out);
/*
* Write out the byte count to maintain header size.
*/
bytes = comps_used * sizeof(_comp_t);
- fwrite((char *) &bytes, sizeof(unsigned long), 1, out);
+ fwrite((char *) &bytes, sizeof(ac_uint4), 1, out);
/*
* Now, if comps exist, write them out.
/*
* Write the header.
*/
- fwrite((char *) hdr, sizeof(unsigned short), 2, out);
+ fwrite((char *) hdr, sizeof(ac_uint2), 2, out);
/*
* Write a temporary byte count which will be calculated as the
* decompositions are written out.
*/
bytes = 0;
- fwrite((char *) &bytes, sizeof(unsigned long), 1, out);
+ fwrite((char *) &bytes, sizeof(ac_uint4), 1, out);
if (decomps_used) {
/*
* Write the list of decomp nodes.
*/
for (i = idx = 0; i < decomps_used; i++) {
- fwrite((char *) &decomps[i].code, sizeof(unsigned long), 1, out);
- fwrite((char *) &idx, sizeof(unsigned long), 1, out);
+ fwrite((char *) &decomps[i].code, sizeof(ac_uint4), 1, out);
+ fwrite((char *) &idx, sizeof(ac_uint4), 1, out);
idx += decomps[i].used;
}
/*
* Write the sentinel index as the last decomp node.
*/
- fwrite((char *) &idx, sizeof(unsigned long), 1, out);
+ fwrite((char *) &idx, sizeof(ac_uint4), 1, out);
/*
* Write the decompositions themselves.
*/
for (i = 0; i < decomps_used; i++)
- fwrite((char *) decomps[i].decomp, sizeof(unsigned long),
+ fwrite((char *) decomps[i].decomp, sizeof(ac_uint4),
decomps[i].used, out);
/*
* Seek back to the beginning and write the byte count.
*/
- bytes = (sizeof(unsigned long) * idx) +
- (sizeof(unsigned long) * ((hdr[1] << 1) + 1));
- fseek(out, sizeof(unsigned short) << 1, 0L);
- fwrite((char *) &bytes, sizeof(unsigned long), 1, out);
+ bytes = (sizeof(ac_uint4) * idx) +
+ (sizeof(ac_uint4) * ((hdr[1] << 1) + 1));
+ fseek(out, sizeof(ac_uint2) << 1, 0L);
+ fwrite((char *) &bytes, sizeof(ac_uint4), 1, out);
fclose(out);
}
/*
* Write the header.
*/
- fwrite((char *) hdr, sizeof(unsigned short), 2, out);
+ fwrite((char *) hdr, sizeof(ac_uint2), 2, out);
/*
* Write a temporary byte count which will be calculated as the
* decompositions are written out.
*/
bytes = 0;
- fwrite((char *) &bytes, sizeof(unsigned long), 1, out);
+ fwrite((char *) &bytes, sizeof(ac_uint4), 1, out);
if (kdecomps_used) {
/*
* Write the list of kdecomp nodes.
*/
for (i = idx = 0; i < kdecomps_used; i++) {
- fwrite((char *) &kdecomps[i].code, sizeof(unsigned long), 1, out);
- fwrite((char *) &idx, sizeof(unsigned long), 1, out);
+ fwrite((char *) &kdecomps[i].code, sizeof(ac_uint4), 1, out);
+ fwrite((char *) &idx, sizeof(ac_uint4), 1, out);
idx += kdecomps[i].used;
}
/*
* Write the sentinel index as the last decomp node.
*/
- fwrite((char *) &idx, sizeof(unsigned long), 1, out);
+ fwrite((char *) &idx, sizeof(ac_uint4), 1, out);
/*
* Write the decompositions themselves.
*/
for (i = 0; i < kdecomps_used; i++)
- fwrite((char *) kdecomps[i].decomp, sizeof(unsigned long),
+ fwrite((char *) kdecomps[i].decomp, sizeof(ac_uint4),
kdecomps[i].used, out);
/*
* Seek back to the beginning and write the byte count.
*/
- bytes = (sizeof(unsigned long) * idx) +
- (sizeof(unsigned long) * ((hdr[1] << 1) + 1));
- fseek(out, sizeof(unsigned short) << 1, 0L);
- fwrite((char *) &bytes, sizeof(unsigned long), 1, out);
+ bytes = (sizeof(ac_uint4) * idx) +
+ (sizeof(ac_uint4) * ((hdr[1] << 1) + 1));
+ fseek(out, sizeof(ac_uint2) << 1, 0L);
+ fwrite((char *) &bytes, sizeof(ac_uint4), 1, out);
fclose(out);
}
/*
* Write the header.
*/
- fwrite((char *) hdr, sizeof(unsigned short), 2, out);
+ fwrite((char *) hdr, sizeof(ac_uint2), 2, out);
/*
* Write out the byte count to maintain header size.
*/
- bytes = ccl_used * sizeof(unsigned long);
- fwrite((char *) &bytes, sizeof(unsigned long), 1, out);
+ bytes = ccl_used * sizeof(ac_uint4);
+ fwrite((char *) &bytes, sizeof(ac_uint4), 1, out);
if (ccl_used > 0)
/*
* Write the combining class ranges out.
*/
- fwrite((char *) ccl, sizeof(unsigned long), ccl_used, out);
+ fwrite((char *) ccl, sizeof(ac_uint4), ccl_used, out);
fclose(out);
* The count part of the header will be the total number of codes that
* have numbers.
*/
- hdr[1] = (unsigned short) (ncodes_used << 1);
+ hdr[1] = (ac_uint2) (ncodes_used << 1);
bytes = (ncodes_used * sizeof(_codeidx_t)) + (nums_used * sizeof(_num_t));
/*
* Write the header.
*/
- fwrite((char *) hdr, sizeof(unsigned short), 2, out);
+ fwrite((char *) hdr, sizeof(ac_uint2), 2, out);
/*
* Write out the byte count to maintain header size.
*/
- fwrite((char *) &bytes, sizeof(unsigned long), 1, out);
+ fwrite((char *) &bytes, sizeof(ac_uint4), 1, out);
/*
* Now, if number mappings exist, write them out.