提交 c8037568 编写于 作者: T Terry Ellison

Merge pull request #883 from nodemcu/dev

Resync master to dev prior to upgrading Dev to SDK 1.5
......@@ -86,8 +86,13 @@ COMPONENTS_eagle.app.v6 = \
crypto/libcrypto.a \
dhtlib/libdhtlib.a \
tsl2561/tsl2561lib.a \
modules/libmodules.a
modules/libmodules.a \
# Inspect the modules library and work out which modules need to be linked.
# For each enabled module, a symbol name of the form XYZ_module_selected is
# returned. At link time those names are declared undefined, so those (and
# only those) modules are pulled in.
SELECTED_MODULE_SYMS=$(filter %_module_selected %module_selected1,$(shell $(NM) modules/.output/$(TARGET)/$(FLAVOR)/lib/libmodules.a))
LINKFLAGS_eagle.app.v6 = \
-Wl,--gc-sections \
......@@ -98,6 +103,7 @@ LINKFLAGS_eagle.app.v6 = \
-Wl,--no-check-sections \
-Wl,--wrap=_xtos_set_exception_handler \
-Wl,-static \
$(addprefix -u , $(SELECTED_MODULE_SYMS)) \
-Wl,--start-group \
-lc \
-lgcc \
......@@ -134,9 +140,11 @@ DEPENDS_eagle.app.v6 = \
# -DWLAN_CONFIG_CCX
CONFIGURATION_DEFINES = -D__ets__ \
-DICACHE_FLASH \
-DLUA_OPTIMIZE_MEMORY=2 \
-DMIN_OPT_LEVEL=2 \
-DLWIP_OPEN_SRC \
-DPBUF_RSV_FOR_WLAN \
-DEBUF_LWIP
-DEBUF_LWIP \
DEFINES += \
$(UNIVERSAL_TARGET_DEFINES) \
......
......@@ -60,10 +60,10 @@ uart_config(uint8 uart_no)
uart_div_modify(uart_no, UART_CLK_FREQ / (UartDev.baut_rate));
WRITE_PERI_REG(UART_CONF0(uart_no), UartDev.exist_parity
| UartDev.parity
| (UartDev.stop_bits << UART_STOP_BIT_NUM_S)
| (UartDev.data_bits << UART_BIT_NUM_S));
WRITE_PERI_REG(UART_CONF0(uart_no), ((UartDev.exist_parity & UART_PARITY_EN_M) << UART_PARITY_EN_S) //SET BIT AND PARITY MODE
| ((UartDev.parity & UART_PARITY_M) <<UART_PARITY_S )
| ((UartDev.stop_bits & UART_STOP_BIT_NUM) << UART_STOP_BIT_NUM_S)
| ((UartDev.data_bits & UART_BIT_NUM) << UART_BIT_NUM_S));
//clear rx and tx fifo,not ready
......
......@@ -17,20 +17,20 @@ typedef enum {
} UartBitsNum4Char;
typedef enum {
ONE_STOP_BIT = 0,
ONE_HALF_STOP_BIT = BIT2,
TWO_STOP_BIT = BIT2
ONE_STOP_BIT = 0x1,
ONE_HALF_STOP_BIT = 0x2,
TWO_STOP_BIT = 0x3
} UartStopBitsNum;
typedef enum {
NONE_BITS = 0,
ODD_BITS = 0,
EVEN_BITS = BIT4
NONE_BITS = 0x2,
ODD_BITS = 1,
EVEN_BITS = 0
} UartParityMode;
typedef enum {
STICK_PARITY_DIS = 0,
STICK_PARITY_EN = BIT3 | BIT5
STICK_PARITY_EN = 1
} UartExistParity;
typedef enum {
......
......@@ -78,26 +78,36 @@
#define UART_RXFIFO_CNT 0x000000FF
#define UART_RXFIFO_CNT_S 0
#define UART_CONF0( i ) (REG_UART_BASE( i ) + 0x20)
#define UART_TXFIFO_RST (BIT(18))
#define UART_RXFIFO_RST (BIT(17))
#define UART_IRDA_EN (BIT(16))
#define UART_TX_FLOW_EN (BIT(15))
#define UART_LOOPBACK (BIT(14))
#define UART_IRDA_RX_INV (BIT(13))
#define UART_IRDA_TX_INV (BIT(12))
#define UART_IRDA_WCTL (BIT(11))
#define UART_IRDA_TX_EN (BIT(10))
#define UART_IRDA_DPLX (BIT(9))
#define UART_TXD_BRK (BIT(8))
#define UART_SW_DTR (BIT(7))
#define UART_SW_RTS (BIT(6))
#define UART_STOP_BIT_NUM 0x00000003
#define UART_STOP_BIT_NUM_S 4
#define UART_BIT_NUM 0x00000003
#define UART_BIT_NUM_S 2
#define UART_PARITY_EN (BIT(1))
#define UART_PARITY (BIT(0))
#define UART_CONF0( i ) (REG_UART_BASE( i ) + 0x20)
#define UART_DTR_INV (BIT(24))
#define UART_RTS_INV (BIT(23))
#define UART_TXD_INV (BIT(22))
#define UART_DSR_INV (BIT(21))
#define UART_CTS_INV (BIT(20))
#define UART_RXD_INV (BIT(19))
#define UART_TXFIFO_RST (BIT(18))
#define UART_RXFIFO_RST (BIT(17))
#define UART_IRDA_EN (BIT(16))
#define UART_TX_FLOW_EN (BIT(15))
#define UART_LOOPBACK (BIT(14))
#define UART_IRDA_RX_INV (BIT(13))
#define UART_IRDA_TX_INV (BIT(12))
#define UART_IRDA_WCTL (BIT(11))
#define UART_IRDA_TX_EN (BIT(10))
#define UART_IRDA_DPLX (BIT(9))
#define UART_TXD_BRK (BIT(8))
#define UART_SW_DTR (BIT(7))
#define UART_SW_RTS (BIT(6))
#define UART_STOP_BIT_NUM 0x00000003
#define UART_STOP_BIT_NUM_S 4
#define UART_BIT_NUM 0x00000003
#define UART_BIT_NUM_S 2
#define UART_PARITY_EN (BIT(1))
#define UART_PARITY_EN_M 0x00000001
#define UART_PARITY_EN_S 1
#define UART_PARITY (BIT(0))
#define UART_PARITY_M 0x00000001
#define UART_PARITY_S 0
#define UART_CONF1( i ) (REG_UART_BASE( i ) + 0x24)
#define UART_RX_TOUT_EN (BIT(31))
......
#ifndef __MODULE_H__
#define __MODULE_H__
#include "user_modules.h"
#include "lrodefs.h"
/* Registering a module within NodeMCU is really easy these days!
*
* Most of the work is done by a combination of pre-processor, compiler
* and linker "magic". Gone are the days of needing to update 4+ separate
* files just to register a module!
*
* You will need:
* - to include this header
* - a name for the module
* - a LUA_REG_TYPE module map
* - optionally, an init function
*
* Then simply put a line like this at the bottom of your module file:
*
* NODEMCU_MODULE(MYNAME, "myname", myname_map, luaopen_myname);
*
* or perhaps
*
* NODEMCU_MODULE(MYNAME, "myname", myname_map, NULL);
*
* if you don't need an init function.
*
* When you've done this, the module can be enabled in user_modules.h with:
*
* #define LUA_USE_MODULES_MYNAME
*
* and within NodeMCU you access it with myname.foo(), assuming you have
* a foo function in your module.
*/
#define MODULE_EXPAND_(x) x
#define MODULE_PASTE_(x,y) x##y
#define MODULE_EXPAND_PASTE_(x,y) MODULE_PASTE_(x,y)
#define LOCK_IN_SECTION(s) __attribute__((used,unused,section(s)))
/* For the ROM table, we name the variable according to ( | denotes concat):
* cfgname | _module_selected | LUA_USE_MODULES_##cfgname
* where the LUA_USE_MODULES_XYZ macro is first expanded to yield either
* an empty string (or 1) if the module has been enabled, or the literal
* LUA_USE_MOUDLE_XYZ in the case it hasn't. Thus, the name of the variable
* ends up looking either like XYZ_module_enabled, or if not enabled,
* XYZ_module_enabledLUA_USE_MODULES_XYZ. This forms the basis for
* letting the build system detect automatically (via nm) which modules need
* to be linked in.
*/
#define NODEMCU_MODULE(cfgname, luaname, map, initfunc) \
const LOCK_IN_SECTION(".lua_libs") \
luaL_Reg MODULE_PASTE_(lua_lib_,cfgname) = { luaname, initfunc }; \
const LOCK_IN_SECTION(".lua_rotable") \
luaR_table MODULE_EXPAND_PASTE_(cfgname,MODULE_EXPAND_PASTE_(_module_selected,MODULE_PASTE_(LUA_USE_MODULES_,cfgname))) \
= { luaname, map }
/* System module registration support, not using LUA_USE_MODULES_XYZ. */
#define BUILTIN_LIB_INIT(name, luaname, initfunc) \
const LOCK_IN_SECTION(".lua_libs") \
luaL_Reg MODULE_PASTE_(lua_lib_,name) = { luaname, initfunc }
#define BUILTIN_LIB(name, luaname, map) \
const LOCK_IN_SECTION(".lua_rotable") \
luaR_table MODULE_PASTE_(lua_rotable_,name) = { luaname, map }
#if !(MIN_OPT_LEVEL==2 && LUA_OPTIMIZE_MEMORY==2)
# error "NodeMCU modules must be built with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif
#endif
......@@ -12,9 +12,7 @@
#define LUA_USE_BUILTIN_DEBUG_MINIMAL // for debug.getregistry() and debug.traceback()
#ifndef LUA_CROSS_COMPILER
#define LUA_USE_MODULES
#ifdef LUA_USE_MODULES
#define LUA_USE_MODULES_ADC
#define LUA_USE_MODULES_BIT
//#define LUA_USE_MODULES_BMP085
......@@ -47,7 +45,6 @@
//#define LUA_USE_MODULES_WS2801
#define LUA_USE_MODULES_WS2812
#endif /* LUA_USE_MODULES */
#endif
#endif /* LUA_CROSS_COMPILER */
#endif /* __USER_MODULES_H__ */
......@@ -816,6 +816,7 @@ static int panic (lua_State *L) {
luai_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n",
lua_tostring(L, -1));
#endif
while (1) {}
return 0;
}
......
......@@ -489,6 +489,7 @@ static int luaB_newproxy (lua_State *L) {
{LSTRKEY("xpcall"), LFUNCVAL(luaB_xpcall)}
#if LUA_OPTIMIZE_MEMORY == 2
#undef MIN_OPT_LEVEL
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE base_funcs_list[] = {
......
......@@ -383,6 +383,7 @@ static int db_errorfb (lua_State *L) {
return 1;
}
#undef MIN_OPT_LEVEL
#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE dblib[] = {
......
......@@ -538,6 +538,7 @@ static int f_flush (lua_State *L) {
return pushresult(L, fs_flush(tofile(L)) == 0, NULL);
}
#undef MIN_OPT_LEVEL
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
#if LUA_OPTIMIZE_MEMORY == 2
......
......@@ -311,6 +311,7 @@ static int math_randomseed (lua_State *L) {
#undef MIN_OPT_LEVEL
#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE math_map[] = {
......
......@@ -646,6 +646,7 @@ static const lua_CFunction loaders[] =
{loader_preload, loader_Lua, loader_C, loader_Croot, NULL};
#if LUA_OPTIMIZE_MEMORY > 0
#undef MIN_OPT_LEVEL
#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE lmt[] = {
......
......@@ -83,9 +83,11 @@ int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
case LUA_TBOOLEAN:
return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */
case LUA_TLIGHTUSERDATA:
return pvalue(t1) == pvalue(t2);
case LUA_TROTABLE:
return rvalue(t1) == rvalue(t2);
case LUA_TLIGHTFUNCTION:
return pvalue(t1) == pvalue(t2);
return fvalue(t1) == fvalue(t2);
default:
lua_assert(iscollectable(t1));
return gcvalue(t1) == gcvalue(t2);
......
......@@ -16,7 +16,7 @@
#undef LREGISTER
#if (MIN_OPT_LEVEL > 0) && (LUA_OPTIMIZE_MEMORY >= MIN_OPT_LEVEL)
#define LUA_REG_TYPE luaR_entry ICACHE_RODATA_ATTR
#define LUA_REG_TYPE luaR_entry
#define LSTRKEY LRO_STRKEY
#define LNUMKEY LRO_NUMKEY
#define LNILKEY LRO_NILKEY
......
......@@ -825,6 +825,7 @@ static int str_format (lua_State *L) {
return 1;
}
#undef MIN_OPT_LEVEL
#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE strlib[] = {
......
......@@ -266,6 +266,7 @@ static int sort (lua_State *L) {
/* }====================================================== */
#undef MIN_OPT_LEVEL
#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE tab_funcs[] = {
......
......@@ -221,6 +221,7 @@ static int os_exit (lua_State *L) {
c_exit(luaL_optint(L, 1, EXIT_SUCCESS));
}
#undef MIN_OPT_LEVEL
#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE syslib[] = {
......
......@@ -319,22 +319,25 @@ void luaV_concat (lua_State *L, int total, int last) {
lu_mem max_sizet = MAX_SIZET;
if (G(L)->memlimit < max_sizet) max_sizet = G(L)->memlimit;
do {
/* Any call which does a memory allocation may trim the stack,
invalidating top unless the stack is fixed duri ng the allocation */
StkId top = L->base + last + 1;
fixedstack(L);
int n = 2; /* number of elements handled in this pass (at least 2) */
if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) {
unfixedstack(L);
if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) {
/* restore 'top' pointer, since stack might have been reallocted */
top = L->base + last + 1;
luaG_concaterror(L, top-2, top-1);
}
} else if (tsvalue(top-1)->len == 0) /* second op is empty? */
} else if (tsvalue(top-1)->len == 0) { /* second op is empty? */
(void)tostring(L, top - 2); /* result is first op (as string) */
else {
} else {
/* at least two string values; get as many as possible */
size_t tl = tsvalue(top-1)->len;
char *buffer;
int i;
fixedstack(L);
/* collect total length */
for (n = 1; n < total && tostring(L, top-n-1); n++) {
size_t l = tsvalue(top-n-1)->len;
......@@ -351,10 +354,10 @@ void luaV_concat (lua_State *L, int total, int last) {
}
setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));
luaZ_resetbuffer(&G(L)->buff);
unfixedstack(L);
}
total -= n-1; /* got `n' strings to create 1 new */
last -= n-1;
unfixedstack(L);
} while (total > 1); /* repeat until only 1 result left */
}
......
// Module for interfacing with adc
//#include "lua.h"
#include "lualib.h"
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "auxmods.h"
#include "lrotable.h"
#include "c_types.h"
#include "user_interface.h"
......@@ -28,26 +25,10 @@ static int adc_readvdd33( lua_State* L )
}
// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE adc_map[] =
{
{ LSTRKEY( "read" ), LFUNCVAL( adc_sample ) },
static const LUA_REG_TYPE adc_map[] = {
{ LSTRKEY( "read" ), LFUNCVAL( adc_sample ) },
{ LSTRKEY( "readvdd33" ), LFUNCVAL( adc_readvdd33) },
#if LUA_OPTIMIZE_MEMORY > 0
#endif
{ LNILKEY, LNILVAL }
};
LUALIB_API int luaopen_adc( lua_State *L )
{
#if LUA_OPTIMIZE_MEMORY > 0
return 0;
#else // #if LUA_OPTIMIZE_MEMORY > 0
luaL_register( L, AUXLIB_ADC, adc_map );
// Add constants
return 1;
#endif // #if LUA_OPTIMIZE_MEMORY > 0
}
NODEMCU_MODULE(ADC, "adc", adc_map, NULL);
// Auxiliary Lua modules. All of them are declared here, then each platform
// decides what module(s) to register in the src/platform/xxxxx/platform_conf.h file
// FIXME: no longer platform_conf.h - either CPU header file, or board file
#ifndef __AUXMODS_H__
#define __AUXMODS_H__
#include "lua.h"
#define AUXLIB_GPIO "gpio"
LUALIB_API int ( luaopen_gpio )( lua_State *L );
#define AUXLIB_SPI "spi"
LUALIB_API int ( luaopen_spi )( lua_State *L );
#define AUXLIB_CAN "can"
LUALIB_API int ( luaopen_can )( lua_State *L );
#define AUXLIB_TMR "tmr"
LUALIB_API int ( luaopen_tmr )( lua_State *L );
#define AUXLIB_PD "pd"
LUALIB_API int ( luaopen_pd )( lua_State *L );
#define AUXLIB_UART "uart"
LUALIB_API int ( luaopen_uart )( lua_State *L );
#define AUXLIB_TERM "term"
LUALIB_API int ( luaopen_term )( lua_State *L );
#define AUXLIB_PWM "pwm"
LUALIB_API int ( luaopen_pwm )( lua_State *L );
#define AUXLIB_PACK "pack"
LUALIB_API int ( luaopen_pack )( lua_State *L );
#define AUXLIB_BIT "bit"
LUALIB_API int ( luaopen_bit )( lua_State *L );
#define AUXLIB_NET "net"
LUALIB_API int ( luaopen_net )( lua_State *L );
#define AUXLIB_CPU "cpu"
LUALIB_API int ( luaopen_cpu )( lua_State* L );
#define AUXLIB_ADC "adc"
LUALIB_API int ( luaopen_adc )( lua_State *L );
#define AUXLIB_RPC "rpc"
LUALIB_API int ( luaopen_rpc )( lua_State *L );
#define AUXLIB_BITARRAY "bitarray"
LUALIB_API int ( luaopen_bitarray )( lua_State *L );
#define AUXLIB_ELUA "elua"
LUALIB_API int ( luaopen_elua )( lua_State *L );
#define AUXLIB_I2C "i2c"
LUALIB_API int ( luaopen_i2c )( lua_State *L );
#define AUXLIB_WIFI "wifi"
LUALIB_API int ( luaopen_wifi )( lua_State *L );
#define AUXLIB_COAP "coap"
LUALIB_API int ( luaopen_coap )( lua_State *L );
#define AUXLIB_MQTT "mqtt"
LUALIB_API int ( luaopen_mqtt )( lua_State *L );
#define AUXLIB_U8G "u8g"
LUALIB_API int ( luaopen_u8g )( lua_State *L );
#define AUXLIB_UCG "ucg"
LUALIB_API int ( luaopen_ucg )( lua_State *L );
#define AUXLIB_NODE "node"
LUALIB_API int ( luaopen_node )( lua_State *L );
#define AUXLIB_FILE "file"
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_cjson )( lua_State *L );
#define AUXLIB_CRYPTO "crypto"
LUALIB_API int ( luaopen_crypto )( lua_State *L );
#define AUXLIB_RC "rc"
LUALIB_API int ( luaopen_rc )( lua_State *L );
#define AUXLIB_DHT "dht"
LUALIB_API int ( luaopen_dht )( lua_State *L );
// Helper macros
#define MOD_CHECK_ID( mod, id )\
if( !platform_ ## mod ## _exists( id ) )\
return luaL_error( L, #mod" %d does not exist", ( unsigned )id )
#define MOD_CHECK_TIMER( id )\
if( id == PLATFORM_TIMER_SYS_ID && !platform_timer_sys_available() )\
return luaL_error( L, "the system timer is not available on this platform" );\
if( !platform_timer_exists( id ) )\
return luaL_error( L, "timer %d does not exist", ( unsigned )id )\
#define MOD_CHECK_RES_ID( mod, id, resmod, resid )\
if( !platform_ ## mod ## _check_ ## resmod ## _id( id, resid ) )\
return luaL_error( L, #resmod" %d not valid with " #mod " %d", ( unsigned )resid, ( unsigned )id )
#define MOD_REG_NUMBER( L, name, val )\
lua_pushnumber( L, val );\
lua_setfield( L, -2, name )
#define MOD_REG_LUDATA( L, name, val )\
lua_pushlightuserdata( L, val );\
lua_setfield( L, -2, name )
#endif
......@@ -5,13 +5,10 @@
// Modified by BogdanM for eLua
#include "module.h"
#include "c_limits.h"
//#include "lua.h"
#include "lauxlib.h"
#include "auxmods.h"
// #include "type.h"
#include "lrotable.h"
/* FIXME: Assume size_t is an unsigned lua_Integer */
typedef size_t lua_UInteger;
......@@ -122,9 +119,7 @@ static int bit_clear( lua_State* L )
return 1;
}
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE bit_map[] = {
static const LUA_REG_TYPE bit_map[] = {
{ LSTRKEY( "bnot" ), LFUNCVAL( bit_bnot ) },
{ LSTRKEY( "band" ), LFUNCVAL( bit_band ) },
{ LSTRKEY( "bor" ), LFUNCVAL( bit_bor ) },
......@@ -140,6 +135,4 @@ const LUA_REG_TYPE bit_map[] = {
{ LNILKEY, LNILVAL}
};
LUALIB_API int luaopen_bit (lua_State *L) {
LREGISTER( L, "bit", bit_map );
}
NODEMCU_MODULE(BIT, "bit", bit_map, NULL);
#include "lualib.h"
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "auxmods.h"
#include "lrotable.h"
#include "c_stdlib.h"
#include "c_string.h"
......@@ -185,19 +183,12 @@ static int ICACHE_FLASH_ATTR bmp085_lua_pressure(lua_State* L) {
return 1;
}
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE bmp085_map[] =
{
{ LSTRKEY( "temperature" ), LFUNCVAL( bmp085_lua_temperature )},
{ LSTRKEY( "pressure" ), LFUNCVAL( bmp085_lua_pressure )},
static const LUA_REG_TYPE bmp085_map[] = {
{ LSTRKEY( "temperature" ), LFUNCVAL( bmp085_lua_temperature )},
{ LSTRKEY( "pressure" ), LFUNCVAL( bmp085_lua_pressure )},
{ LSTRKEY( "pressure_raw" ), LFUNCVAL( bmp085_lua_pressure_raw )},
{ LSTRKEY( "init" ), LFUNCVAL( bmp085_init )},
{ LSTRKEY( "init" ), LFUNCVAL( bmp085_init )},
{ LNILKEY, LNILVAL}
};
LUALIB_API int luaopen_bmp085(lua_State *L) {
LREGISTER(L, "bmp085", bmp085_map);
return 1;
}
NODEMCU_MODULE(BMP085, "bmp085", bmp085_map, NULL);
......@@ -37,10 +37,10 @@
*/
// #include <assert.h>
#include "module.h"
#include "c_string.h"
#include "c_math.h"
#include "c_limits.h"
#include "lua.h"
#include "lauxlib.h"
#include "flash_api.h"
......@@ -1528,53 +1528,7 @@ static int json_protect_conversion(lua_State *l)
* errors are memory related */
return luaL_error(l, "Memory allocation error in CJSON protected call");
}
#endif
// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE cjson_map[] =
{
{ LSTRKEY( "encode" ), LFUNCVAL( json_encode ) },
{ LSTRKEY( "decode" ), LFUNCVAL( json_decode ) },
// { LSTRKEY( "encode_sparse_array" ), LFUNCVAL( json_cfg_encode_sparse_array ) },
// { LSTRKEY( "encode_max_depth" ), LFUNCVAL( json_cfg_encode_max_depth ) },