diff options
author | Mark Pulford <mark@kyne.com.au> | 2011-12-30 14:17:44 +1030 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2011-12-30 14:17:44 +1030 |
commit | 2416b145073211b840781da6abf4b6d97f4657a6 (patch) | |
tree | 6e92a13a7cc8ef8357245bc3ef320f5841350991 /fpconv.h | |
parent | 6cc88e3ac5275868e168acaf60203563f131355b (diff) | |
download | lua-cjson-2416b145073211b840781da6abf4b6d97f4657a6.tar.gz lua-cjson-2416b145073211b840781da6abf4b6d97f4657a6.tar.bz2 lua-cjson-2416b145073211b840781da6abf4b6d97f4657a6.zip |
Add fpconv to work around comma decimal points
Create a separate buffer and translate comma <> dot before calling
strtod(), and after calling sprintf() as required.
- Add "update_locale" Lua API call and init locale on module load.
- Move sprintf format string to fpconv
Diffstat (limited to 'fpconv.h')
-rw-r--r-- | fpconv.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fpconv.h b/fpconv.h new file mode 100644 index 0000000..b8a6469 --- /dev/null +++ b/fpconv.h | |||
@@ -0,0 +1,11 @@ | |||
1 | /* Lua CJSON floating point conversion routines */ | ||
2 | |||
3 | /* Buffer larger than required to store the largest %.14g number */ | ||
4 | # define FPCONV_G_FMT_BUFSIZE 32 | ||
5 | |||
6 | extern void fpconv_update_locale(); | ||
7 | extern int fpconv_g_fmt(char*, double, int); | ||
8 | extern double fpconv_strtod(const char*, char**); | ||
9 | |||
10 | /* vi:ai et sw=4 ts=4: | ||
11 | */ | ||