aboutsummaryrefslogtreecommitdiffstats
path: root/libucd_int.h
blob: 22a10989c6bb48f48e69e6d428daaad1d6f1d881 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * libucd_int.h
 *
 * Internal header file for libucd
 */

#ifndef LIBUCD_INT_H
#define LIBUCD_INT_H

#include <stdlib.h>
#include "ucd.h"
#include "int24.h"
#include "compiler.h"

#define UCS_CNT	0x110000
#define UCS_MAX (UCS_CNT-1)

extern const char _libucd_hangul_jamo_l[][4];
extern const char _libucd_hangul_jamo_v[][4];
extern const char _libucd_hangul_jamo_t[][4];

/* This structure is exactly 32 bytes long, nice and alignable. */
struct _libucd_property_array {
  int32_t  ucs;			/* Wasteful but fast (used in search) */
  uint8_t  general_category;
  uint8_t  script;
  uint8_t  numeric_value_num;
  uint8_t  numeric_value_den_exp; /* bit 7 = 1 if exponent */
  uint64_t flags_block;		/* Block index is byte 6, byte 7 free */
  int24    simple_uppercase;
  int24    simple_lowercase;
  int24    simple_titlecase;
  uint8_t  age;			/* (major << 3) + minor */
  uint8_t  canonical_combining_class;
  unsigned sentence_break	:4;
  unsigned grapheme_cluster_break :4;
  unsigned word_break		:4;
  unsigned joining_type  	:3;
  unsigned joining_group 	:6;
  unsigned east_asian_width     :3;
  unsigned hangul_syllable_type :3;
  unsigned line_break           :6;
  unsigned numeric_type         :2;
  unsigned bidi_class           :5;
} ALIGNED(32);
extern const struct _libucd_property_array _libucd_property_array[];
extern const int _libucd_property_array_count;

struct _libucd_ucstoname_tab {
  int24    ucs;
  uint24   names_offset;
  uint16_t proparray_offset;
} ALIGNED(8);
extern const struct _libucd_ucstoname_tab _libucd_ucstoname_tab[];

struct _libucd_nametoucs_tab {
  int24	   ucs;
};
extern const struct _libucd_nametoucs_tab _libucd_nametoucs_tab[];

extern const unsigned char _libucd_names_list[];
extern const char * const _libucd_nameslist_dict[256];

/* This is a private data structure included in each ucd object */
#if defined(__i386__) || defined(__x86_64__)
# define HAVE_ATOMIC_CTR
#endif

struct libucd_private {
#if defined(HAVE_PTHREAD_H) && !defined(HAVE_ATOMIC_CTR)
  pthread_mutex_t mutex;
#endif
  volatile unsigned int usage_ctr;
};

const struct unicode_character_data *
_libucd_character_data_raw(int32_t ucs);

struct libucd_enum_names {
  const char *long_name;
  const char *short_name;
};

#endif