#include <stdlib.h>
#include <string.h>
+#include <keks/atom.h>
#include <keks/dec.h>
#include <keks/err.h>
exit(EXIT_FAILURE);
}
struct KEKSItems items;
- enum KEKSErr err = KEKSItemsInit(&items);
+ enum KEKSErr err = KEKSItemsInit(&items, 128);
if (err != KEKSErrNo) {
return EXIT_FAILURE;
}
#include <getopt.h>
#include <math.h>
#include <stdbool.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
-#include <keks/dec.h>
+#include <keks/atom.h>
#include <keks/err.h>
#include <keks/items.h>
#include <time.h>
#include <unistd.h>
-#include <keks/atoms.h>
+#include <keks/atom.h>
#include <keks/enc.h>
#include <keks/enctai.h>
--- /dev/null
+#ifndef KEKS_ATOM_H
+#define KEKS_ATOM_H
+
+#include <stdint.h>
+#include <stdlib.h>
+
+enum KEKSAtomType {
+ KEKSAtomEOC = 0x00,
+ KEKSAtomNIL = 0x01,
+ KEKSAtomFalse = 0x02,
+ KEKSAtomTrue = 0x03,
+ KEKSAtomUUID = 0x04,
+ KEKSAtomList = 0x08,
+ KEKSAtomMap = 0x09,
+ KEKSAtomBlob = 0x0B,
+ KEKSAtomPint = 0x0C,
+ KEKSAtomNint = 0x0D,
+ KEKSAtomFloat16 = 0x10,
+ KEKSAtomFloat32 = 0x11,
+ KEKSAtomFloat64 = 0x12,
+ KEKSAtomFloat128 = 0x13,
+ KEKSAtomFloat256 = 0x14,
+ KEKSAtomTAI64 = 0x18,
+ KEKSAtomTAI64N = 0x19,
+ KEKSAtomTAI64NA = 0x1A,
+
+ KEKSAtomStrings = 0x80,
+ KEKSAtomIsUTF8 = 0x40,
+};
+
+// TEXINFO: KEKSItemType
+// @deftp {Data type} {enum KEKSItemType}
+// High-level type of the atom.
+// @itemize
+// @item KEKSItemInvalid -- invalid item value, uninitialised
+// @item KEKSItemEOC
+// @item KEKSItemNIL
+// @item KEKSItemFalse
+// @item KEKSItemTrue
+// @item KEKSItemUUID
+// @item KEKSItemPint -- positive integer
+// @item KEKSItemNint -- negative integer
+// @item KEKSItemList
+// @item KEKSItemMap
+// @item KEKSItemBlob
+// @item KEKSItemFloat
+// @item KEKSItemTAI64
+// @item KEKSItemBin
+// @item KEKSItemStr
+// @item KEKSItemRaw -- raw value, non-decodable by the library
+// @end itemize
+// @end deftp
+enum KEKSItemType {
+ KEKSItemInvalid = 0,
+ KEKSItemEOC = 1,
+ KEKSItemNIL,
+ KEKSItemFalse,
+ KEKSItemTrue,
+ KEKSItemUUID,
+ KEKSItemPint,
+ KEKSItemNint,
+ KEKSItemList,
+ KEKSItemMap,
+ KEKSItemBlob,
+ KEKSItemFloat,
+ KEKSItemTAI64,
+ KEKSItemBin,
+ KEKSItemStr,
+ KEKSItemRaw,
+};
+
+// TEXINFO: KEKSAtom
+// @deftp {Data type} {struct KEKSAtom}
+// Basic unit of the library, describing single TLV-like value.
+// @table @code
+// @item .typ
+// High level @ref{KEKSItemType, type} of the atom's value. As a rule
+// you should look solely on it.
+// @item .v.uuid
+// Pointer to 16-byte UUID value.
+// @item .v.pint
+// Value of the positive integer.
+// @item .v.nint
+// Value of the negative integer.
+// @item .v.list
+// That value is filled only when dealing with @ref{Items, items}
+// for lists and maps.
+// Its @code{.head} is the index in items list to the first element
+// inside the container. If equals to 0, then it is empty. Its
+// @code{.len} contains number of the items (key-values pairs in
+// case of map) inside it.
+// @item .v.blob
+// That value is filled only when dealing with @ref{Items, items}.
+// @code{.chunkLen} is the length of the chunk. @code{.chunks} is
+// the number of chunks, including the terminating binary string.
+// @item .v.str
+// @code{.ptr} points to the start of the binary/UTF-8/TAI64*
+// string. @code{.len} is its length in bytes.
+// Raw values use it as a payload.
+// @end table
+// @end deftp
+struct KEKSAtom {
+ union {
+ const unsigned char *uuid;
+ uint64_t pint;
+ int64_t nint;
+ struct {
+ size_t head;
+ size_t len;
+ } list;
+ struct {
+ size_t chunkLen;
+ size_t chunks;
+ } blob;
+ struct {
+ const unsigned char *ptr;
+ size_t len;
+ } str;
+ } v;
+ enum KEKSItemType typ;
+ char _pad[4];
+};
+
+#endif // KEKS_ATOM_H
+++ /dev/null
-#ifndef KEKS_ATOMS_H
-#define KEKS_ATOMS_H
-
-enum KEKSAtomType {
- KEKSAtomEOC = 0x00,
- KEKSAtomNIL = 0x01,
- KEKSAtomFalse = 0x02,
- KEKSAtomTrue = 0x03,
- KEKSAtomUUID = 0x04,
- KEKSAtomList = 0x08,
- KEKSAtomMap = 0x09,
- KEKSAtomBlob = 0x0B,
- KEKSAtomPint = 0x0C,
- KEKSAtomNint = 0x0D,
- KEKSAtomFloat16 = 0x10,
- KEKSAtomFloat32 = 0x11,
- KEKSAtomFloat64 = 0x12,
- KEKSAtomFloat128 = 0x13,
- KEKSAtomFloat256 = 0x14,
- KEKSAtomTAI64 = 0x18,
- KEKSAtomTAI64N = 0x19,
- KEKSAtomTAI64NA = 0x1A,
-
- KEKSAtomStrings = 0x80,
- KEKSAtomIsUTF8 = 0x40,
-};
-
-#endif // KEKS_ATOMS_H
#include <stdint.h>
#include <string.h>
-#include "atoms.h"
+#include "atom.h"
#include "dec.h"
#include "err.h"
#include "frombe.h"
#define KEKS_DEC_H
#include <stddef.h>
-#include <stdint.h>
+#include "atom.h"
#include "err.h"
-// TEXINFO: KEKSItemType
-// @deftp {Data type} {enum KEKSItemType}
-// High-level type of the atom.
-// @itemize
-// @item KEKSItemInvalid -- invalid item value, uninitialised
-// @item KEKSItemEOC
-// @item KEKSItemNIL
-// @item KEKSItemFalse
-// @item KEKSItemTrue
-// @item KEKSItemUUID
-// @item KEKSItemPint -- positive integer
-// @item KEKSItemNint -- negative integer
-// @item KEKSItemList
-// @item KEKSItemMap
-// @item KEKSItemBlob
-// @item KEKSItemFloat
-// @item KEKSItemTAI64
-// @item KEKSItemBin
-// @item KEKSItemStr
-// @item KEKSItemRaw -- raw value, non-decodable by the library
-// @end itemize
-// @end deftp
-enum KEKSItemType {
- KEKSItemInvalid = 0,
- KEKSItemEOC = 1,
- KEKSItemNIL,
- KEKSItemFalse,
- KEKSItemTrue,
- KEKSItemUUID,
- KEKSItemPint,
- KEKSItemNint,
- KEKSItemList,
- KEKSItemMap,
- KEKSItemBlob,
- KEKSItemFloat,
- KEKSItemTAI64,
- KEKSItemBin,
- KEKSItemStr,
- KEKSItemRaw,
-};
-
-// TEXINFO: KEKSAtom
-// @deftp {Data type} {struct KEKSAtom}
-// Basic unit of the library, describing single TLV-like value.
-// @table @code
-// @item .typ
-// High level @ref{KEKSItemType, type} of the atom's value. As a rule
-// you should look solely on it.
-// @item .v.uuid
-// Pointer to 16-byte UUID value.
-// @item .v.pint
-// Value of the positive integer.
-// @item .v.nint
-// Value of the negative integer.
-// @item .v.list
-// That value is filled only when dealing with @ref{Items, items}
-// for lists and maps.
-// Its @code{.head} is the index in items list to the first element
-// inside the container. If equals to 0, then it is empty. Its
-// @code{.len} contains number of the items (key-values pairs in
-// case of map) inside it.
-// @item .v.blob
-// That value is filled only when dealing with @ref{Items, items}.
-// @code{.chunkLen} is the length of the chunk. @code{.chunks} is
-// the number of chunks, including the terminating binary string.
-// @item .v.str
-// @code{.ptr} points to the start of the binary/UTF-8/TAI64*
-// string. @code{.len} is its length in bytes.
-// Raw values use it as a payload.
-// @end table
-// @end deftp
-struct KEKSAtom {
- union {
- const unsigned char *uuid;
- uint64_t pint;
- int64_t nint;
- struct {
- size_t head;
- size_t len;
- } list;
- struct {
- size_t chunkLen;
- size_t chunks;
- } blob;
- struct {
- const unsigned char *ptr;
- size_t len;
- } str;
- } v;
- enum KEKSItemType typ;
- char _pad[4];
-};
-
// TEXINFO: KEKSAtomDecode
// @deftypefun {enum KEKSErr} KEKSAtomDecode ( @
// size_t *got, @
#include <stdint.h>
#include <string.h>
-#include "atoms.h"
+#include "atom.h"
#include "enc.h"
#include "tobe.h"
#include <stdbool.h>
#include <stddef.h>
-#include "dec.h"
+#include "atom.h"
#include "err.h"
// TEXINFO: KEKSItem
#include <stdint.h>
#include <string.h>
-#include "../dec.h"
+#include "../atom.h"
#include "../dectai.h"
#include "../enc.h"
#include "../err.h"