json port from cjson. not work yet

This commit is contained in:
funshine 2015-03-16 09:00:33 +08:00
parent 9818c5063b
commit 9c0c960e84
8 changed files with 1550 additions and 4 deletions

View File

@ -36,7 +36,8 @@ SUBDIRS= \
smart \
wofs \
modules \
spiffs
spiffs \
cjson
endif # } PDIR
@ -84,6 +85,7 @@ COMPONENTS_eagle.app.v6 = \
smart/smart.a \
wofs/wofs.a \
spiffs/spiffs.a \
cjson/libcjson.a \
modules/libmodules.a
LINKFLAGS_eagle.app.v6 = \

1
app/cjson Submodule

@ -0,0 +1 @@
Subproject commit d59326b2d718e1a140b9b396ffe0a557b2d93fe0

View File

@ -4,7 +4,7 @@
#define LUA_USE_BUILTIN_STRING // for string.xxx()
#define LUA_USE_BUILTIN_TABLE // for table.xxx()
#define LUA_USE_BUILTIN_COROUTINE // for coroutine.xxx()
#define LUA_USE_BUILTIN_MATH // for math.xxx(), partially work
// #define LUA_USE_BUILTIN_MATH // for math.xxx(), partially work
// #define LUA_USE_BUILTIN_IO // for io.xxx(), partially work
// #define LUA_USE_BUILTIN_OS // for os.xxx(), not work
@ -30,6 +30,7 @@
#define LUA_USE_MODULES_COAP
#define LUA_USE_MODULES_U8G
#define LUA_USE_MODULES_WS2812
#define LUA_USE_MODULES_CJSON
#endif /* LUA_USE_MODULES */
#endif /* __USER_MODULES_H__ */

View File

@ -47,6 +47,7 @@ INCLUDES += -I ../platform
INCLUDES += -I ../wofs
INCLUDES += -I ../spiffs
INCLUDES += -I ../smart
INCLUDES += -I ../cjson
PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile

View File

@ -79,6 +79,9 @@ LUALIB_API int ( luaopen_file )( lua_State *L );
#define AUXLIB_OW "ow"
LUALIB_API int ( luaopen_ow )( lua_State *L );
#define AUXLIB_CJSON "cjson"
LUALIB_API int ( luaopen_ow )( lua_State *L );
// Helper macros
#define MOD_CHECK_ID( mod, id )\
if( !platform_ ## mod ## _exists( id ) )\

1530
app/modules/cjson.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -338,7 +338,7 @@ LUALIB_API int luaopen_file( lua_State *L )
#if LUA_OPTIMIZE_MEMORY > 0
return 0;
#else // #if LUA_OPTIMIZE_MEMORY > 0
luaL_register( L, AUXLIB_NODE, file_map );
luaL_register( L, AUXLIB_FILE, file_map );
// Add constants
return 1;

View File

@ -141,6 +141,13 @@
#define ROM_MODULES_WS2812
#endif
#if defined(LUA_USE_MODULES_CJSON)
#define MODULES_CJSON "cjson"
#define ROM_MODULES_CJSON \
_ROM(MODULES_CJSON, luaopen_cjson, cjson_map)
#else
#define ROM_MODULES_CJSON
#endif
#define LUA_MODULES_ROM \
ROM_MODULES_GPIO \
@ -159,7 +166,8 @@
ROM_MODULES_UART \
ROM_MODULES_OW \
ROM_MODULES_BIT \
ROM_MODULES_WS2812
ROM_MODULES_WS2812 \
ROM_MODULES_CJSON
#endif