teptris 0.3.0.0-arm-linux → 0.3.0.1-arm-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/teptris_ext/engine/README.md +1 -1
- data/ext/teptris_ext/engine/src/include/teptris/teptris.h +10 -0
- data/ext/teptris_ext/engine/src/include/teptris/version.h +3 -3
- data/ext/teptris_ext/engine/src/teptris/api.c +6 -0
- data/ext/teptris_ext/engine/src/teptris/emit/emitter.c +72 -0
- data/ext/teptris_ext/engine/src/teptris/emit/emitter.h +3 -0
- data/lib/teptris/3.3/teptris_ext.so +0 -0
- data/lib/teptris/3.4/teptris_ext.so +0 -0
- data/lib/teptris/4.0/teptris_ext.so +0 -0
- data/lib/teptris/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 822ced70497b46e8007f8932878c79fe15a1b46d0c1cc47ec6e57ba8f4cb3993
|
|
4
|
+
data.tar.gz: 740287215936926c64cc55ce3827258f446bb481814142794267abca45a03097
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e299391c5fb336277e3c6e0fcac970f53f21885c33d5ff51e3f249c1c617f5c8e41e53b1f708a630bde03b73b4c989f6f6f4c3e11b52edeceeb86f799c3e822f
|
|
7
|
+
data.tar.gz: 990ab826824461c436def48c6ddb866ca50c2dc046d7609eb68e1efce1350217d008dba30e5aa3d9d08086ab358d3e3b90d921cc62f7f307af992f7f965f56a6
|
|
@@ -142,6 +142,16 @@ TEPTRIS_API teptris_status teptris_document_emit(const teptris_document *doc,
|
|
|
142
142
|
TEPTRIS_API teptris_status teptris_document_emit_json(const teptris_document *doc,
|
|
143
143
|
char **buf, size_t *len);
|
|
144
144
|
|
|
145
|
+
/* Natural-JSON emit: host-shaped values - real numbers, JSON
|
|
146
|
+
* booleans, datetimes as RFC 3339 strings (offset form carries its
|
|
147
|
+
* offset; the four TOML datetime shapes render date, time,
|
|
148
|
+
* date-time, and offset date-time). Two deliberate, lossy mappings:
|
|
149
|
+
* non-finite floats (TOML allows nan/inf) become null, and a
|
|
150
|
+
* datetime is indistinguishable from a same-shaped JSON string.
|
|
151
|
+
* Memory: *buf is malloc'd; caller frees with free(). */
|
|
152
|
+
TEPTRIS_API teptris_status teptris_document_emit_json_natural(
|
|
153
|
+
const teptris_document *doc, char **buf, size_t *len);
|
|
154
|
+
|
|
145
155
|
/* Bulk drain for FFI/ctypes bindings: the whole tree in ONE crossing as
|
|
146
156
|
* a self-describing flat buffer (explicit little-endian):
|
|
147
157
|
* table 0x01 u32 n *(u32 klen key node)
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
#define TEPTRIS_VERSION_H
|
|
3
3
|
|
|
4
4
|
#define TEPTRIS_VERSION_MAJOR 0
|
|
5
|
-
#define TEPTRIS_VERSION_MINOR
|
|
6
|
-
#define TEPTRIS_VERSION_PATCH
|
|
7
|
-
#define TEPTRIS_VERSION_STRING "0.
|
|
5
|
+
#define TEPTRIS_VERSION_MINOR 3
|
|
6
|
+
#define TEPTRIS_VERSION_PATCH 0
|
|
7
|
+
#define TEPTRIS_VERSION_STRING "0.3.0"
|
|
8
8
|
|
|
9
9
|
#endif /* TEPTRIS_VERSION_H */
|
|
@@ -218,6 +218,12 @@ teptris_status teptris_document_emit_json(const teptris_document *doc,
|
|
|
218
218
|
return teptris_emit_document_json(doc, buf, len);
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
teptris_status teptris_document_emit_json_natural(
|
|
222
|
+
const teptris_document *doc, char **buf, size_t *len)
|
|
223
|
+
{
|
|
224
|
+
return teptris_emit_document_json_natural(doc, buf, len);
|
|
225
|
+
}
|
|
226
|
+
|
|
221
227
|
/* --------------------------------------------------- bulk flatten ----- */
|
|
222
228
|
|
|
223
229
|
typedef struct {
|
|
@@ -699,6 +699,78 @@ static void emit_json_value(ebuf *b, const teptris_node *n)
|
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
+
/* Natural-JSON emit (#101 v1): host-shaped values instead of the
|
|
703
|
+
* toml-test dialect - real numbers, booleans as JSON booleans,
|
|
704
|
+
* datetimes as RFC 3339 strings (offset form carries its offset).
|
|
705
|
+
* The two lossy spots are deliberate and documented in the header:
|
|
706
|
+
* non-finite floats become null (JSON has no nan/inf), and the
|
|
707
|
+
* datetime KIND is not distinguishable from a same-shaped string. */
|
|
708
|
+
static void emit_json_nat_value(ebuf *b, const teptris_node *n)
|
|
709
|
+
{
|
|
710
|
+
switch (n->kind) {
|
|
711
|
+
case TEPTRIS_TABLE:
|
|
712
|
+
eb_c(b, '{');
|
|
713
|
+
for (size_t i = 0; i < n->as.table.len; i++) {
|
|
714
|
+
if (i > 0) {
|
|
715
|
+
eb_c(b, ',');
|
|
716
|
+
}
|
|
717
|
+
json_string(b, n->as.table.entries[i].key);
|
|
718
|
+
eb_c(b, ':');
|
|
719
|
+
emit_json_nat_value(b, n->as.table.entries[i].value);
|
|
720
|
+
}
|
|
721
|
+
eb_c(b, '}');
|
|
722
|
+
break;
|
|
723
|
+
case TEPTRIS_ARRAY:
|
|
724
|
+
eb_c(b, '[');
|
|
725
|
+
for (size_t i = 0; i < n->as.array.len; i++) {
|
|
726
|
+
if (i > 0) {
|
|
727
|
+
eb_c(b, ',');
|
|
728
|
+
}
|
|
729
|
+
emit_json_nat_value(b, n->as.array.items[i]);
|
|
730
|
+
}
|
|
731
|
+
eb_c(b, ']');
|
|
732
|
+
break;
|
|
733
|
+
case TEPTRIS_STRING:
|
|
734
|
+
json_string(b, n->as.str);
|
|
735
|
+
break;
|
|
736
|
+
case TEPTRIS_INTEGER:
|
|
737
|
+
emit_i64(b, n->as.i);
|
|
738
|
+
break;
|
|
739
|
+
case TEPTRIS_FLOAT:
|
|
740
|
+
if (isnan(n->as.f) || isinf(n->as.f)) {
|
|
741
|
+
eb_str(b, "null");
|
|
742
|
+
} else {
|
|
743
|
+
emit_float(b, n->as.f);
|
|
744
|
+
}
|
|
745
|
+
break;
|
|
746
|
+
case TEPTRIS_BOOLEAN:
|
|
747
|
+
eb_str(b, n->as.b ? "true" : "false");
|
|
748
|
+
break;
|
|
749
|
+
default:
|
|
750
|
+
eb_c(b, '"');
|
|
751
|
+
emit_dt(b, &n->as.dt, (teptris_kind)n->kind);
|
|
752
|
+
eb_c(b, '"');
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
teptris_status teptris_emit_document_json_natural(
|
|
757
|
+
const teptris_document *doc, char **buf, size_t *len)
|
|
758
|
+
{
|
|
759
|
+
if (doc == NULL || doc->root == NULL) {
|
|
760
|
+
return TEPTRIS_ERR_ARG;
|
|
761
|
+
}
|
|
762
|
+
ebuf b = {0, 0, 0, TEPTRIS_OK};
|
|
763
|
+
eb_reserve(&b, 256);
|
|
764
|
+
emit_json_nat_value(&b, doc->root);
|
|
765
|
+
if (b.st != TEPTRIS_OK) {
|
|
766
|
+
return b.st;
|
|
767
|
+
}
|
|
768
|
+
eb_c(&b, '\0');
|
|
769
|
+
*buf = b.p;
|
|
770
|
+
*len = b.len - 1;
|
|
771
|
+
return TEPTRIS_OK;
|
|
772
|
+
}
|
|
773
|
+
|
|
702
774
|
teptris_status teptris_emit_document_json(const teptris_document *doc,
|
|
703
775
|
char **buf, size_t *len)
|
|
704
776
|
{
|
|
@@ -8,4 +8,7 @@ teptris_status teptris_emit_document(const teptris_document *doc, char **buf,
|
|
|
8
8
|
teptris_status teptris_emit_document_json(const teptris_document *doc,
|
|
9
9
|
char **buf, size_t *len);
|
|
10
10
|
|
|
11
|
+
teptris_status teptris_emit_document_json_natural(
|
|
12
|
+
const teptris_document *doc, char **buf, size_t *len);
|
|
13
|
+
|
|
11
14
|
#endif /* TEPTRIS_EMITTER_H */
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/teptris/version.rb
CHANGED