diff options
author | Freya Murphy <freya@freyacat.org> | 2023-12-17 11:10:04 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2023-12-17 11:10:04 -0500 |
commit | e0eacfa9773c83850ed5169d1e889ff845180581 (patch) | |
tree | 9f8bb433404ce7e4dda1b86ca4dd5d5a2fba10e9 /nbt | |
parent | snbt (diff) | |
download | nbtvis-main.tar.gz nbtvis-main.tar.bz2 nbtvis-main.zip |
Diffstat (limited to '')
-rw-r--r-- | nbt/json/print.c (renamed from src/json/print.c) | 4 | ||||
-rw-r--r-- | nbt/json/read.c (renamed from src/json/read.c) | 6 | ||||
-rw-r--r-- | nbt/nbt.c (renamed from src/tag.c) | 5 | ||||
-rw-r--r-- | nbt/nbt.h (renamed from src/tag.h) | 21 | ||||
-rw-r--r-- | nbt/nbt/print.c (renamed from src/nbt/print.c) | 0 | ||||
-rw-r--r-- | nbt/nbt/read.c (renamed from src/nbt/read.c) | 2 | ||||
-rw-r--r-- | nbt/snbt/print.c (renamed from src/snbt/print.c) | 3 | ||||
-rw-r--r-- | nbt/snbt/read.c (renamed from src/snbt/read.c) | 6 |
8 files changed, 26 insertions, 21 deletions
diff --git a/src/json/print.c b/nbt/json/print.c index ab154b9..3b7cdb3 100644 --- a/src/json/print.c +++ b/nbt/json/print.c @@ -1,8 +1,8 @@ -#include "json.h" - #include <stdarg.h> #include <stdio.h> +#include "nbt.h" + static char buf[1024]; __attribute__((format(printf, 3, 4))) diff --git a/src/json/read.c b/nbt/json/read.c index dbb246a..3316b55 100644 --- a/src/json/read.c +++ b/nbt/json/read.c @@ -1,12 +1,12 @@ -#include "json.h" -#include "../lib.h" - #include <ctype.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "nbt.h" +#include "lib.h" + static char ret = '\0'; typedef enum { @@ -1,8 +1,5 @@ -#include "tag.h" +#include "nbt.h" #include "map.h" -#include "nbt/nbt.h" -#include "snbt/snbt.h" -#include "json/json.h" #include <stdlib.h> @@ -1,14 +1,13 @@ -#pragma once - -#include "stream.h" -#include "map.h" +#pragma once #include <stdint.h> #include <stdbool.h> #include <arpa/inet.h> -#include <string.h> #include <unistd.h> +#include "map.h" +#include "stream.h" + typedef enum: int8_t { TAG_END = 0, TAG_BYTE = 1, @@ -25,8 +24,6 @@ typedef enum: int8_t { TAG_LONG_ARRAY = 12 } tagtype_t ; -struct tag_t; - typedef union { int8_t b; int16_t s; @@ -72,6 +69,16 @@ typedef enum { } format_t; void tag_free(tag_t *tag); + bool tag_read(tag_t *tag, const stream_t *stream, format_t format); bool tag_print(tag_t *tag, const stream_t *stream, format_t format); +bool json_read(tag_t *tag, const stream_t *stream); +bool json_print(const tag_t *tag, const stream_t *stream); + +bool nbt_read(tag_t *tag, const stream_t *stream); +bool nbt_print(const tag_t *tag, const stream_t *stream); + +bool snbt_read(tag_t *tag, const stream_t *stream); +bool snbt_print(const tag_t *tag, const stream_t *stream); +bool snbt_allowed_ident(char c); diff --git a/src/nbt/print.c b/nbt/nbt/print.c index 3f687dc..3f687dc 100644 --- a/src/nbt/print.c +++ b/nbt/nbt/print.c diff --git a/src/nbt/read.c b/nbt/nbt/read.c index 38f8b14..9ed4f08 100644 --- a/src/nbt/read.c +++ b/nbt/nbt/read.c @@ -1,5 +1,5 @@ #include "nbt.h" -#include "../lib.h" +#include "lib.h" #include <stdio.h> #include <stdlib.h> diff --git a/src/snbt/print.c b/nbt/snbt/print.c index 9dec75c..c62cc0a 100644 --- a/src/snbt/print.c +++ b/nbt/snbt/print.c @@ -1,7 +1,8 @@ -#include "snbt.h" #include <stdarg.h> #include <stdio.h> +#include "nbt.h" + static char buf[1024]; __attribute__((format(printf, 3, 4))) diff --git a/src/snbt/read.c b/nbt/snbt/read.c index 231404a..0ee89d2 100644 --- a/src/snbt/read.c +++ b/nbt/snbt/read.c @@ -1,10 +1,10 @@ -#include "snbt.h" -#include "../lib.h" - #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "nbt.h" +#include "lib.h" + typedef enum { TOK_RBRACE, TOK_LBRACE, |