small changes in type configuration facilities

This commit is contained in:
Roberto Ierusalimschy
2002-10-22 14:18:28 -03:00
parent 6823a2f57f
commit 84e0b1bc97
5 changed files with 23 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: llimits.h,v 1.45 2002/07/08 20:22:08 roberto Exp roberto $ ** $Id: llimits.h,v 1.46 2002/10/08 18:46:08 roberto Exp roberto $
** Limits, basic types, and some other `installation-dependent' definitions ** Limits, basic types, and some other `installation-dependent' definitions
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -77,9 +77,18 @@ typedef unsigned char lu_byte;
/* type to ensure maximum alignment */ /* type to ensure maximum alignment */
#ifndef LUSER_ALIGNMENT_T #ifndef LUSER_ALIGNMENT_T
#define LUSER_ALIGNMENT_T double typedef union { double u; void *s; long l; } L_Umaxalign;
#else
typedef LUSER_ALIGNMENT_T L_Umaxalign;
#endif
/* result of `usual argument convertion' over lua_Number */
#ifndef LUA_UACNUMBER
typedef double l_uacNumber;
#else
typedef LUA_UACNUMBER l_uacNumber;
#endif #endif
union L_Umaxalign { LUSER_ALIGNMENT_T u; void *s; long l; };
#ifndef lua_assert #ifndef lua_assert

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lobject.c,v 1.89 2002/10/04 14:31:03 roberto Exp roberto $ ** $Id: lobject.c,v 1.90 2002/10/08 18:46:08 roberto Exp roberto $
** Some generic functions over Lua objects ** Some generic functions over Lua objects
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -116,7 +116,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
incr_top(L); incr_top(L);
break; break;
case 'f': case 'f':
setnvalue(L->top, va_arg(argp, lua_Number)); setnvalue(L->top, va_arg(argp, l_uacNumber));
incr_top(L); incr_top(L);
break; break;
case '%': case '%':

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lobject.h,v 1.147 2002/10/08 18:46:08 roberto Exp roberto $ ** $Id: lobject.h,v 1.148 2002/10/16 20:40:58 roberto Exp roberto $
** Type definitions for Lua objects ** Type definitions for Lua objects
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -140,7 +140,7 @@ typedef TObject *StkId; /* index to stack elements */
** String headers for string table ** String headers for string table
*/ */
typedef union TString { typedef union TString {
union L_Umaxalign dummy; /* ensures maximum alignment for strings */ L_Umaxalign dummy; /* ensures maximum alignment for strings */
struct { struct {
union GCObject *next; /* pointer to next object */ union GCObject *next; /* pointer to next object */
lu_byte tt; /* object type */ lu_byte tt; /* object type */
@@ -158,7 +158,7 @@ typedef union TString {
typedef union Udata { typedef union Udata {
union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
struct { struct {
union GCObject *next; /* pointer to next object */ union GCObject *next; /* pointer to next object */
lu_byte tt; /* object type */ lu_byte tt; /* object type */

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: ltests.c,v 1.134 2002/08/30 19:09:21 roberto Exp roberto $ ** $Id: ltests.c,v 1.135 2002/09/05 19:57:08 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation ** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -58,7 +58,7 @@ static void setnameval (lua_State *L, const char *name, int val) {
/* ensures maximum alignment for HEADER */ /* ensures maximum alignment for HEADER */
#define HEADER (sizeof(union L_Umaxalign)) #define HEADER (sizeof(L_Umaxalign))
#define MARKSIZE 32 #define MARKSIZE 32
#define MARK 0x55 /* 01010101 (a nice pattern) */ #define MARK 0x55 /* 01010101 (a nice pattern) */

7
lua.h
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lua.h,v 1.156 2002/08/30 20:00:59 roberto Exp roberto $ ** $Id: lua.h,v 1.157 2002/09/02 20:00:41 roberto Exp roberto $
** Lua - An Extensible Extension Language ** Lua - An Extensible Extension Language
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
** http://www.lua.org mailto:info@lua.org ** http://www.lua.org mailto:info@lua.org
@@ -86,9 +86,10 @@ typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *sz);
/* type of Numbers in Lua */ /* type of Numbers in Lua */
#ifndef LUA_NUMBER #ifndef LUA_NUMBER
#define LUA_NUMBER double typedef double lua_Number;
#endif #else
typedef LUA_NUMBER lua_Number; typedef LUA_NUMBER lua_Number;
#endif
/* mark for all API functions */ /* mark for all API functions */