Rizin
unix-like reverse engineering framework and cli tools
unicode.h
Go to the documentation of this file.
1 #ifndef TREE_SITTER_UNICODE_H_
2 #define TREE_SITTER_UNICODE_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <limits.h>
9 #include <stdint.h>
10 
11 #define U_EXPORT
12 #define U_EXPORT2
13 #include "unicode/utf8.h"
14 #include "unicode/utf16.h"
15 
17 
18 // These functions read one unicode code point from the given string,
19 // returning the number of bytes consumed.
21  const uint8_t *string,
23  int32_t *code_point
24 );
25 
26 static inline uint32_t ts_decode_utf8(
27  const uint8_t *string,
29  int32_t *code_point
30 ) {
31  uint32_t i = 0;
32  U8_NEXT(string, i, length, *code_point);
33  return i;
34 }
35 
36 static inline uint32_t ts_decode_utf16(
37  const uint8_t *string,
39  int32_t *code_point
40 ) {
41  uint32_t i = 0;
42  U16_NEXT(((uint16_t *)string), i, length, *code_point);
43  return i * 2;
44 }
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
50 #endif // TREE_SITTER_UNICODE_H_
lzma_index ** i
Definition: index.h:629
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
unsigned short uint16_t
Definition: sftypes.h:30
int int32_t
Definition: sftypes.h:33
unsigned int uint32_t
Definition: sftypes.h:29
unsigned char uint8_t
Definition: sftypes.h:31
#define U_SENTINEL
Definition: umachine.h:444
static const int32_t TS_DECODE_ERROR
Definition: unicode.h:16
static uint32_t ts_decode_utf16(const uint8_t *string, uint32_t length, int32_t *code_point)
Definition: unicode.h:36
static uint32_t ts_decode_utf8(const uint8_t *string, uint32_t length, int32_t *code_point)
Definition: unicode.h:26
uint32_t(* UnicodeDecodeFunction)(const uint8_t *string, uint32_t length, int32_t *code_point)
Definition: unicode.h:20
C API: 16-bit Unicode handling macros.
#define U16_NEXT(s, i, length, c)
Definition: utf16.h:308
C API: 8-bit Unicode handling macros.
#define U8_NEXT(s, i, length, c)
Definition: utf8.h:351