diff options
| author | Mark Pulford <mark@kyne.com.au> | 2011-12-29 23:03:58 +1030 |
|---|---|---|
| committer | Mark Pulford <mark@kyne.com.au> | 2012-03-04 18:54:34 +1030 |
| commit | ca42b9a996f9046ba3876ad8a81cda1d935b39cf (patch) | |
| tree | 229cc0e408e28abc882778c68496c87af0d781ba /Makefile | |
| parent | 8eecc878e0560461ef42bd3cd8d6dfe33cf148e8 (diff) | |
| download | lua-cjson-ca42b9a996f9046ba3876ad8a81cda1d935b39cf.tar.gz lua-cjson-ca42b9a996f9046ba3876ad8a81cda1d935b39cf.tar.bz2 lua-cjson-ca42b9a996f9046ba3876ad8a81cda1d935b39cf.zip | |
Use internal dtoa/strtod for double conversion
The internal Lua CJSON dtoa/strtod routines have locale support
disabled. This avoids problems under locales with comma decimal
separators.
Build changes:
- CMake: Check for big endian architectures
- Makefile: Provide option to build with dtoa.c
Modifications to dtoa.c:
- Include locale dtoa_config.h configuration
- Rename Infinity/NaN to inf/nan to match common C libraries
- Rename strtod() -> internal_strtod() to prevent conflict with libc
function
Modifications to g_fmt.c:
- Return output string length (instead of original buffer pointer)
- Provide precision as an argument to g_fmt()
- Silence compilations warnings from vendor source
- while(a = b)
- Unused label "done:"
- Only swap to scientific notation when once the number of decimal
digits required exceeds the precision available. This matches
standard printf format %g.
- Display a "0" in front of numbers < 1.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 21 |
1 files changed, 20 insertions, 1 deletions
| @@ -4,6 +4,10 @@ | |||
| 4 | ## DISABLE_CJSON_GLOBAL: Do not store module is "cjson" global. | 4 | ## DISABLE_CJSON_GLOBAL: Do not store module is "cjson" global. |
| 5 | ## DISABLE_INVALID_NUMBERS: Permanently disable invalid JSON numbers: | 5 | ## DISABLE_INVALID_NUMBERS: Permanently disable invalid JSON numbers: |
| 6 | ## NaN, Infinity, hex. | 6 | ## NaN, Infinity, hex. |
| 7 | ## | ||
| 8 | ## Optional built-in number conversion uses the following defines: | ||
| 9 | ## USE_INTERNAL_DTOA: Use builtin strtod/dtoa for numeric conversions. | ||
| 10 | ## IEEE_BIG_ENDIAN: Required on big endian architectures. | ||
| 7 | 11 | ||
| 8 | ##### Build defaults ##### | 12 | ##### Build defaults ##### |
| 9 | LUA_VERSION = 5.1 | 13 | LUA_VERSION = 5.1 |
| @@ -42,10 +46,25 @@ INSTALL_CMD = install | |||
| 42 | #CJSON_CFLAGS = -DDISABLE_INVALID_NUMBERS | 46 | #CJSON_CFLAGS = -DDISABLE_INVALID_NUMBERS |
| 43 | #CJSON_LDFLAGS = -shared -L$(PREFIX)/lib -llua51 | 47 | #CJSON_LDFLAGS = -shared -L$(PREFIX)/lib -llua51 |
| 44 | 48 | ||
| 49 | ##### Use built in number conversion (optional) ##### | ||
| 50 | |||
| 51 | ## Enable built in number conversion | ||
| 52 | #FPCONV_OBJS = g_fmt.o dtoa.o | ||
| 53 | #CJSON_CFLAGS += -DUSE_INTERNAL_DTOA | ||
| 54 | |||
| 55 | ## Compile built in number conversion for big endian architectures | ||
| 56 | #CJSON_CFLAGS += -DIEEE_BIG_ENDIAN | ||
| 57 | |||
| 58 | ## Compile built in number conversion to support multi-threaded | ||
| 59 | ## applications (recommended) | ||
| 60 | #CJSON_CFLAGS += -pthread -DMULTIPLE_THREADS | ||
| 61 | #CJSON_LDFLAGS += -pthread | ||
| 62 | |||
| 45 | ##### End customisable sections ##### | 63 | ##### End customisable sections ##### |
| 46 | 64 | ||
| 47 | BUILD_CFLAGS = -I$(LUA_INCLUDE_DIR) $(CJSON_CFLAGS) | 65 | BUILD_CFLAGS = -I$(LUA_INCLUDE_DIR) $(CJSON_CFLAGS) |
| 48 | OBJS := lua_cjson.o strbuf.o fpconv.o | 66 | FPCONV_OBJS ?= fpconv.o |
| 67 | OBJS := lua_cjson.o strbuf.o $(FPCONV_OBJS) | ||
| 49 | 68 | ||
| 50 | .PHONY: all clean install package doc | 69 | .PHONY: all clean install package doc |
| 51 | 70 | ||
