Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API for outputting JSON to stream #187

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,6 @@ TINYCBOR_SOURCES = \
src/cbortojson.c \
src/cborvalidation.c \
#
# if open_memstream is unavailable on the system, try to implement our own
# version using funopen or fopencookie
ifeq ($(open_memstream-pass),)
ifeq ($(funopen-pass)$(fopencookie-pass),)
CFLAGS += -DWITHOUT_OPEN_MEMSTREAM
ifeq ($(wildcard .config),.config)
$(warning warning: funopen and fopencookie unavailable, open_memstream can not be implemented and conversion to JSON will not work properly!)
endif
else
TINYCBOR_SOURCES += src/open_memstream.c
endif
endif
endif

# json2cbor depends on an external library (cjson)
Expand Down
3 changes: 1 addition & 2 deletions Makefile.configure
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
ALLTESTS = open_memstream funopen fopencookie gc_sections \
ALLTESTS = funopen fopencookie gc_sections \
system-cjson cjson freestanding
MAKEFILE := $(lastword $(MAKEFILE_LIST))
OUT :=

PROGRAM-open_memstream = extern int open_memstream(); int main() { return open_memstream(); }
PROGRAM-funopen = extern int funopen(); int main() { return funopen(); }
PROGRAM-fopencookie = extern int fopencookie(); int main() { return fopencookie(); }
PROGRAM-gc_sections = int main() {}
Expand Down
2 changes: 2 additions & 0 deletions Makefile.nmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ TINYCBOR_SOURCES = \
src\cborerrorstrings.c \
src\cborencoder.c \
src\cborencoder_close_container_checked.c \
src\cbortojson.c \
src\cborparser.c \
src\cborparser_dup_string.c \
src\cborpretty.c \
Expand All @@ -14,6 +15,7 @@ TINYCBOR_OBJS = \
src\cborerrorstrings.obj \
src\cborencoder.obj \
src\cborencoder_close_container_checked.obj \
src\cbortojson.obj \
src\cborparser.obj \
src\cborparser_dup_string.obj \
src\cborpretty.obj \
Expand Down
1 change: 1 addition & 0 deletions src/cborjson.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ enum CborToJsonFlags
CborConvertDefaultFlags = 0
};

CBOR_API CborError cbor_value_to_json_stream(CborStreamFunction stream, void* token, CborValue *it, int flags);
CBOR_API CborError cbor_value_to_json_advance(FILE *out, CborValue *value, int flags);
CBOR_INLINE_API CborError cbor_value_to_json(FILE *out, const CborValue *value, int flags)
{
Expand Down
Loading