teptris 0.3.0.0-s390x-linux → 0.3.0.1-s390x-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 472a1314831be47d2e80ccdddf7a87af51357dac3ac3aa41dd92d649f82975a2
4
- data.tar.gz: 57bcb65db66177d1469c8c1712dc332b2acb828dd36198994ee7440ef2bf5599
3
+ metadata.gz: a89f1684832724a1f0b12b30316ad68f42671be42f451ec5e6afd2b010c6e60f
4
+ data.tar.gz: 0d9dfd722112d601da5b3b9c94171d0bda5fdd24a44608eaa3ce556a52690884
5
5
  SHA512:
6
- metadata.gz: cb8b0005dfd53387d4b7434c7508889a4bb43541c153f63dc4df9ef6f310bb1987c1cc07e26b74a6ae9881968adf36f2ce2c1c39525f78503270e9b3cc06bff1
7
- data.tar.gz: dce82b767d7b40253aa39ddb5d8cb94a6749650bf59d46a1be9d446f1e7fc3334138ce77ca0e86880d09d7888ac12238f4596e1a72db5ad999b85579799a466e
6
+ metadata.gz: 9241af3ca10a6fd3ac89a2d1eeb874d5fc23e6aa8477b5b9d42e557df98e1f70188a84678f5ed8fc7d7341a7ae111e10d77d2d7c14dc9c404b2a8d087e21e186
7
+ data.tar.gz: 7033ca0b47fcdec30611f0300be664464adfb9b3c18b706b7acb84a5cffb23b9b386ae4fb13bdea9279daea7166b483490f561e01c2272ad5f6beb992f7ef738
@@ -1,4 +1,4 @@
1
- # libteptris 0.1.27 — vendored source
1
+ # libteptris 0.3.0 — vendored source
2
2
 
3
3
  This directory carries the COMPLETE C source of the engine this
4
4
  gem's extension was built from (the packaging doctrine: compiled
@@ -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 1
6
- #define TEPTRIS_VERSION_PATCH 27
7
- #define TEPTRIS_VERSION_STRING "0.1.27"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Teptris
4
- VERSION = "0.3.0.0"
4
+ VERSION = "0.3.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.0
4
+ version: 0.3.0.1
5
5
  platform: s390x-linux
6
6
  authors:
7
7
  - teptris contributors