diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-12-10 17:03:46 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-12-10 17:03:46 -0200 |
| commit | af119c8b55f15910df17e02633d8a5ca656b209a (patch) | |
| tree | 74c0e645490a9114a3f3e81108ac8627e2e184d8 /luaconf.h | |
| parent | 1aead7f5536c92cfbd1dd7dbb51f5ac95f239e14 (diff) | |
| download | lua-af119c8b55f15910df17e02633d8a5ca656b209a.tar.gz lua-af119c8b55f15910df17e02633d8a5ca656b209a.tar.bz2 lua-af119c8b55f15910df17e02633d8a5ca656b209a.zip | |
official support for floating hexa numerals
Diffstat (limited to 'luaconf.h')
| -rw-r--r-- | luaconf.h | 20 |
1 files changed, 18 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luaconf.h,v 1.151 2010/11/12 15:48:30 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.152 2010/12/08 12:58:04 roberto Exp roberto $ |
| 3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -35,6 +35,7 @@ | |||
| 35 | 35 | ||
| 36 | #if defined(LUA_WIN) | 36 | #if defined(LUA_WIN) |
| 37 | #define LUA_DL_DLL | 37 | #define LUA_DL_DLL |
| 38 | #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ | ||
| 38 | #endif | 39 | #endif |
| 39 | 40 | ||
| 40 | 41 | ||
| @@ -43,6 +44,8 @@ | |||
| 43 | #define LUA_USE_POSIX | 44 | #define LUA_USE_POSIX |
| 44 | #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ | 45 | #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ |
| 45 | #define LUA_USE_READLINE /* needs some extra libraries */ | 46 | #define LUA_USE_READLINE /* needs some extra libraries */ |
| 47 | #define LUA_USE_HEXAFLOAT /* assume 'strtod' handles hexa formats */ | ||
| 48 | #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ | ||
| 46 | #endif | 49 | #endif |
| 47 | 50 | ||
| 48 | #if defined(LUA_USE_MACOSX) | 51 | #if defined(LUA_USE_MACOSX) |
| @@ -377,14 +380,27 @@ | |||
| 377 | @@ LUA_NUMBER_FMT is the format for writing numbers. | 380 | @@ LUA_NUMBER_FMT is the format for writing numbers. |
| 378 | @@ lua_number2str converts a number to a string. | 381 | @@ lua_number2str converts a number to a string. |
| 379 | @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. | 382 | @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. |
| 380 | @@ lua_str2number converts a string to a number. | ||
| 381 | */ | 383 | */ |
| 382 | #define LUA_NUMBER_SCAN "%lf" | 384 | #define LUA_NUMBER_SCAN "%lf" |
| 383 | #define LUA_NUMBER_FMT "%.14g" | 385 | #define LUA_NUMBER_FMT "%.14g" |
| 384 | #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) | 386 | #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) |
| 385 | #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ | 387 | #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ |
| 388 | |||
| 389 | |||
| 390 | /* | ||
| 391 | @@ lua_str2number converts a decimal numeric string to a number. | ||
| 392 | @@ lua_strx2number converts an hexadecimal numeric string to a number. | ||
| 393 | ** In C99, 'strtod' do both conversions. C89, however, has no function | ||
| 394 | ** to convert floating hexadecimal strings to numbers. For these | ||
| 395 | ** systems, you can leave 'lua_strx2number' undefined and Lua will | ||
| 396 | ** provide its own implementation. | ||
| 397 | */ | ||
| 386 | #define lua_str2number(s,p) strtod((s), (p)) | 398 | #define lua_str2number(s,p) strtod((s), (p)) |
| 387 | 399 | ||
| 400 | #if defined(LUA_USE_HEXAFLOAT) | ||
| 401 | #define lua_strx2number(s,p) strtod((s), (p)) | ||
| 402 | #endif | ||
| 403 | |||
| 388 | 404 | ||
| 389 | /* | 405 | /* |
| 390 | @@ The luai_num* macros define the primitive operations over numbers. | 406 | @@ The luai_num* macros define the primitive operations over numbers. |
