1
0
mirror of https://github.com/lua/lua synced 2025-03-28 16:43:03 +03:00

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

@ -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
** See Copyright Notice in lua.h
*/
@ -77,9 +77,18 @@ typedef unsigned char lu_byte;
/* type to ensure maximum alignment */
#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
union L_Umaxalign { LUSER_ALIGNMENT_T u; void *s; long l; };
#ifndef lua_assert

@ -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
** 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);
break;
case 'f':
setnvalue(L->top, va_arg(argp, lua_Number));
setnvalue(L->top, va_arg(argp, l_uacNumber));
incr_top(L);
break;
case '%':

@ -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
** See Copyright Notice in lua.h
*/
@ -140,7 +140,7 @@ typedef TObject *StkId; /* index to stack elements */
** String headers for string table
*/
typedef union TString {
union L_Umaxalign dummy; /* ensures maximum alignment for strings */
L_Umaxalign dummy; /* ensures maximum alignment for strings */
struct {
union GCObject *next; /* pointer to next object */
lu_byte tt; /* object type */
@ -158,7 +158,7 @@ typedef union TString {
typedef union Udata {
union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
struct {
union GCObject *next; /* pointer to next object */
lu_byte tt; /* object type */

@ -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
** 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 */
#define HEADER (sizeof(union L_Umaxalign))
#define HEADER (sizeof(L_Umaxalign))
#define MARKSIZE 32
#define MARK 0x55 /* 01010101 (a nice pattern) */

7
lua.h

@ -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
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
** 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 */
#ifndef LUA_NUMBER
#define LUA_NUMBER double
#endif
typedef double lua_Number;
#else
typedef LUA_NUMBER lua_Number;
#endif
/* mark for all API functions */