File: unijp.h

package info (click to toggle)
libunicode-japanese-perl 0.50-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,376 kB
  • sloc: ansic: 30,821; perl: 5,635; erlang: 224; makefile: 191
file content (88 lines) | stat: -rw-r--r-- 3,532 bytes parent folder | download
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
85
86
87
88
/* ----------------------------------------------------------------------------
 * unijp.h
 * ----------------------------------------------------------------------------
 * Mastering programmed by YAMASHINA Hio
 *
 * Copyright 2008 YAMASHINA Hio
 * ----------------------------------------------------------------------------
 * $Id$
 * ------------------------------------------------------------------------- */
#ifndef UNIJP_H
#define UNIJP_H

#ifdef __cplusplus
extern "C"
{
#endif

#include "unijp_types.h"
#include "unijp_version.h"

struct unijp_s
{
  const uj_alloc_t* alloc;
  uj_uint8* data;
  uj_size_t data_len;
  uj_bool   is_binary;
};
typedef struct unijp_s unijp_t;

/* ----------------------------------------------------------------------------
: uj_new(str, bytes_len, icode).
: uj_new_r(alloc, str, bytes_len, icode).
+--------------------------------------------------------------------------- */
extern unijp_t* uj_new(const uj_uint8* str, uj_size_t bytes, uj_charcode_t icode);
extern unijp_t* uj_new_r(const uj_alloc_t* const alloc, const uj_uint8* str, uj_size_t bytes, uj_charcode_t icode);
  

/* ----------------------------------------------------------------------------
: uj_delete(uj).
+--------------------------------------------------------------------------- */
extern void uj_delete(unijp_t* uj);

/* ----------------------------------------------------------------------------
: uj_conv(uj, ocode, &len).
+--------------------------------------------------------------------------- */
extern uj_uint8* uj_conv(unijp_t* uj, uj_charcode_t ocode, uj_size_t* p_len);

/* ----------------------------------------------------------------------------
: uj_delete_buffer(uj, ptr).
: release memory which returned from uj_conv.
+--------------------------------------------------------------------------- */
extern void uj_delete_buffer(unijp_t* uj, uj_uint8* ptr);

/* ----------------------------------------------------------------------------
: str = uj_to_utf8(uj, &len).
: str = uj_to_sjis(uj, &len).
: str = uj_to_eucjp(uj, &len).
: str = uj_to_jis(uj, &len).
+--------------------------------------------------------------------------- */
extern uj_uint8* uj_to_utf8(const unijp_t* uj, uj_size_t* p_len);
extern uj_uint8* uj_to_sjis(const unijp_t* uj, uj_size_t* p_len);
extern uj_uint8* uj_to_eucjp(const unijp_t* uj, uj_size_t* p_len);
extern uj_uint8* uj_to_jis(const unijp_t* uj, uj_size_t* p_len);
extern uj_uint8* uj_to_ucs2(const unijp_t* uj, uj_size_t* p_len);
extern uj_uint8* uj_to_ucs4(const unijp_t* uj, uj_size_t* p_len);
extern uj_uint8* uj_to_utf16(const unijp_t* uj, uj_size_t* p_len);

/* ----------------------------------------------------------------------------
: uj_getcode(str, len).
+--------------------------------------------------------------------------- */
extern uj_charcode_t uj_getcode(const uj_uint8* str, uj_size_t len);

/* ----------------------------------------------------------------------------
: uj_charcode_parse(str).
: uj_charcode_str(code).
+--------------------------------------------------------------------------- */
extern uj_charcode_t uj_charcode_parse(const char* name);
extern uj_charcode_t uj_charcode_parse_n(const char* name, int str_len);
extern const char*   uj_charcode_str(uj_charcode_t code);

#ifdef __cplusplus
}
#endif

#endif /* !defined(UNIJP_H) */
/* ----------------------------------------------------------------------------
 * End of File.
 * ------------------------------------------------------------------------- */