diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-07-09 15:31:35 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-07-09 15:31:35 -0300 |
| commit | b5f5fcd78251300aee44d958b9ac000fa05e0478 (patch) | |
| tree | 70537d3f4396b8ebf4773c559766c6358705aaaf | |
| parent | 2ef9bcfd118f263c06abfe2c04fe79a530ebe163 (diff) | |
| download | lua-b5f5fcd78251300aee44d958b9ac000fa05e0478.tar.gz lua-b5f5fcd78251300aee44d958b9ac000fa05e0478.tar.bz2 lua-b5f5fcd78251300aee44d958b9ac000fa05e0478.zip | |
use different constants (instead of different values for the same constant)
to define number sizes (LUA_INT_INT/LUA_INT_LONG/LUA_INT_LONGLONG and
LUA_REAL_FLOAT/LUA_REAL_DOUBLE/LUA_REAL_LONGDOUBLE) + use __int64 and
I64 instead of long long (and ll) for Windows
| -rw-r--r-- | luaconf.h | 40 |
1 files changed, 27 insertions, 13 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luaconf.h,v 1.184 2013/06/21 17:42:28 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.185 2013/06/25 19:04:40 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 | */ |
| @@ -384,12 +384,13 @@ | |||
| 384 | */ | 384 | */ |
| 385 | 385 | ||
| 386 | /* | 386 | /* |
| 387 | @@ LUA_INTSIZE defines size for Lua integer: 1=int, 2=long, 3=long long | 387 | @@ LUA_INT_INT/LUA_INT_LONG/LUA_INT_LONGLONG defines size for Lua integers; |
| 388 | @@ LUA_FLOATSIZE defines size for Lua float: 1=float, 2=double, 3=long double | 388 | @@ LUA_REAL_FLOAT/LUA_REAL_DOUBLE/LUA_REAL_LONGDOUBLE defines size for |
| 389 | @* Lua floats. | ||
| 389 | ** Default is long long + double | 390 | ** Default is long long + double |
| 390 | */ | 391 | */ |
| 391 | #define LUA_INTSIZE 3 | 392 | #define LUA_INT_LONGLONG |
| 392 | #define LUA_FLOATSIZE 2 | 393 | #define LUA_REAL_DOUBLE |
| 393 | 394 | ||
| 394 | 395 | ||
| 395 | /* | 396 | /* |
| @@ -408,7 +409,7 @@ | |||
| 408 | @@ lua_str2number converts a decimal numeric string to a number. | 409 | @@ lua_str2number converts a decimal numeric string to a number. |
| 409 | */ | 410 | */ |
| 410 | 411 | ||
| 411 | #if LUA_FLOATSIZE == 1 /* { single float */ | 412 | #if defined(LUA_REAL_FLOAT) /* { single float */ |
| 412 | 413 | ||
| 413 | #define LUA_NUMBER float | 414 | #define LUA_NUMBER float |
| 414 | 415 | ||
| @@ -423,7 +424,7 @@ | |||
| 423 | #define lua_str2number(s,p) strtof((s), (p)) | 424 | #define lua_str2number(s,p) strtof((s), (p)) |
| 424 | 425 | ||
| 425 | 426 | ||
| 426 | #elif LUA_FLOATSIZE == 3 /* }{ long double */ | 427 | #elif defined(LUA_REAL_LONGDOUBLE) /* }{ long double */ |
| 427 | 428 | ||
| 428 | #define LUA_NUMBER long double | 429 | #define LUA_NUMBER long double |
| 429 | 430 | ||
| @@ -437,7 +438,7 @@ | |||
| 437 | 438 | ||
| 438 | #define lua_str2number(s,p) strtold((s), (p)) | 439 | #define lua_str2number(s,p) strtold((s), (p)) |
| 439 | 440 | ||
| 440 | #else /* }{ default: double */ | 441 | #elif defined(LUA_REAL_DOUBLE) /* }{ double */ |
| 441 | 442 | ||
| 442 | #define LUA_NUMBER double | 443 | #define LUA_NUMBER double |
| 443 | 444 | ||
| @@ -451,7 +452,11 @@ | |||
| 451 | 452 | ||
| 452 | #define lua_str2number(s,p) strtod((s), (p)) | 453 | #define lua_str2number(s,p) strtod((s), (p)) |
| 453 | 454 | ||
| 454 | #endif /* } */ | 455 | #else /* }{ */ |
| 456 | |||
| 457 | #error "numeric real type not defined" | ||
| 458 | |||
| 459 | #endif /* } */ | ||
| 455 | 460 | ||
| 456 | 461 | ||
| 457 | #if defined(LUA_ANSI) | 462 | #if defined(LUA_ANSI) |
| @@ -511,22 +516,31 @@ | |||
| 511 | @@ lua_integer2str converts an integer to a string. | 516 | @@ lua_integer2str converts an integer to a string. |
| 512 | */ | 517 | */ |
| 513 | 518 | ||
| 514 | #if LUA_INTSIZE == 1 /* { int */ | 519 | #if defined(LUA_INT_INT) /* { int */ |
| 515 | 520 | ||
| 516 | #define LUA_INTEGER int | 521 | #define LUA_INTEGER int |
| 517 | #define LUA_INTEGER_FRMLEN "" | 522 | #define LUA_INTEGER_FRMLEN "" |
| 518 | 523 | ||
| 519 | #elif LUA_INTSIZE == 2 /* }{ long */ | 524 | #elif defined(LUA_INT_LONG) /* }{ long */ |
| 520 | 525 | ||
| 521 | #define LUA_INTEGER long | 526 | #define LUA_INTEGER long |
| 522 | #define LUA_INTEGER_FRMLEN "l" | 527 | #define LUA_INTEGER_FRMLEN "l" |
| 523 | 528 | ||
| 524 | #else /* }{ default: long long */ | 529 | #elif defined(LUA_INT_LONGLONG) /* }{ long long */ |
| 525 | 530 | ||
| 531 | #if defined(_WIN32) | ||
| 532 | #define LUA_INTEGER __int64 | ||
| 533 | #define LUA_INTEGER_FRMLEN "I64" | ||
| 534 | #else | ||
| 526 | #define LUA_INTEGER long long | 535 | #define LUA_INTEGER long long |
| 527 | #define LUA_INTEGER_FRMLEN "ll" | 536 | #define LUA_INTEGER_FRMLEN "ll" |
| 537 | #endif | ||
| 528 | 538 | ||
| 529 | #endif /* } */ | 539 | #else /* }{ */ |
| 540 | |||
| 541 | #error "numeric integer type not defined" | ||
| 542 | |||
| 543 | #endif /* } */ | ||
| 530 | 544 | ||
| 531 | 545 | ||
| 532 | #define LUA_INTEGER_SCAN "%" LUA_INTEGER_FRMLEN "d" | 546 | #define LUA_INTEGER_SCAN "%" LUA_INTEGER_FRMLEN "d" |
