-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fluent:master' into master
- Loading branch information
Showing
28 changed files
with
988 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv64)") | ||
message(STATUS "Forcing characters to be signed, as on x86_64.") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char") | ||
if(FLB_LUAJIT) | ||
message(WARNING "LuaJIT is disabled, this platform does not support built-in LuaJIT and system provided one neither.") | ||
set(FLB_LUAJIT OFF) | ||
endif() | ||
endif () |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,84 +20,16 @@ | |
#ifndef FLB_UTF8_H | ||
#define FLB_UTF8_H | ||
|
||
#define FLB_UTF8_ACCEPT 0 | ||
#define FLB_UTF8_REJECT 1 | ||
#define FLB_UTF8_CONTINUE 2 | ||
|
||
#include <fluent-bit/flb_info.h> | ||
#include <inttypes.h> | ||
|
||
/* is the start of a UTF-8 string ? */ | ||
#define flb_utf8_check(c) (((c) & 0xC0) != 0x80) | ||
|
||
static const char trailingBytesForUTF8[256] = { | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | ||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 | ||
}; | ||
|
||
/* returns length of next utf-8 sequence */ | ||
static inline int flb_utf8_len(const char *s) | ||
{ | ||
return trailingBytesForUTF8[(unsigned int)(unsigned char)s[0]] + 1; | ||
} | ||
|
||
/* | ||
* UTF-8 Decoding routines are originally written by Bjoern Hoehrmann | ||
* <[email protected]> and taken from the following web site: | ||
* | ||
* http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ | ||
* | ||
* They have been siglhy renamed to follow Fluent Bit naming requirements. | ||
*/ | ||
|
||
#define FLB_UTF8_ACCEPT 0 | ||
#define FLB_UTF8_REJECT 1 | ||
|
||
static const uint8_t utf8d[] = { | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 00..1f | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20..3f | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40..5f | ||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 60..7f | ||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, // 80..9f | ||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, // a0..bf | ||
8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // c0..df | ||
0xa,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3, // e0..ef | ||
0xb,0x6,0x6,0x6,0x5,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, // f0..ff | ||
0x0,0x1,0x2,0x3,0x5,0x8,0x7,0x1,0x1,0x1,0x4,0x6,0x1,0x1,0x1,0x1, // s0..s0 | ||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1, // s1..s2 | ||
1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1, // s3..s4 | ||
1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,1,1,1, // s5..s6 | ||
1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8 | ||
}; | ||
|
||
static inline uint32_t flb_utf8_decode(uint32_t *state, uint32_t *codep, | ||
uint32_t byte) | ||
{ | ||
uint32_t type = utf8d[byte]; | ||
|
||
*codep = (*state != FLB_UTF8_ACCEPT) ? | ||
(byte & 0x3fu) | (*codep << 6) : | ||
(0xff >> type) & (byte); | ||
|
||
*state = utf8d[256 + *state*16 + type]; | ||
return *state; | ||
} | ||
|
||
|
||
static inline void flb_utf8_print(const uint8_t *s) { | ||
uint32_t codepoint; | ||
uint32_t state = 0; | ||
|
||
for (; *s; ++s) | ||
if (!flb_utf8_decode(&state, &codepoint, *s)) { | ||
printf("\\u%04x\n", codepoint); | ||
} | ||
|
||
if (state != FLB_UTF8_ACCEPT) { | ||
printf("The string is not well-formed\n"); | ||
} | ||
} | ||
int flb_utf8_len(const char *s); | ||
uint32_t flb_utf8_decode(uint32_t *state, uint32_t *codep, uint8_t byte); | ||
void flb_utf8_print(char *input); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.