aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-10-22 14:18:28 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-10-22 14:18:28 -0300
commit84e0b1bc9789148092797fecf303547fef35a875 (patch)
tree68f96f805a188fc2cbde2bac7b10da33c8c4c77f
parent6823a2f57f5dfb4365e7cb0c9281fe0d00b0a1e4 (diff)
downloadlua-84e0b1bc9789148092797fecf303547fef35a875.tar.gz
lua-84e0b1bc9789148092797fecf303547fef35a875.tar.bz2
lua-84e0b1bc9789148092797fecf303547fef35a875.zip
small changes in type configuration facilities
-rw-r--r--llimits.h15
-rw-r--r--lobject.c4
-rw-r--r--lobject.h6
-rw-r--r--ltests.c4
-rw-r--r--lua.h7
5 files changed, 23 insertions, 13 deletions
diff --git a/llimits.h b/llimits.h
index 9acea06d..ae24db35 100644
--- a/llimits.h
+++ b/llimits.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llimits.h,v 1.45 2002/07/08 20:22:08 roberto Exp roberto $ 2** $Id: llimits.h,v 1.46 2002/10/08 18:46:08 roberto Exp roberto $
3** Limits, basic types, and some other `installation-dependent' definitions 3** Limits, basic types, and some other `installation-dependent' definitions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -77,9 +77,18 @@ typedef unsigned char lu_byte;
77 77
78/* type to ensure maximum alignment */ 78/* type to ensure maximum alignment */
79#ifndef LUSER_ALIGNMENT_T 79#ifndef LUSER_ALIGNMENT_T
80#define LUSER_ALIGNMENT_T double 80typedef union { double u; void *s; long l; } L_Umaxalign;
81#else
82typedef LUSER_ALIGNMENT_T L_Umaxalign;
83#endif
84
85
86/* result of `usual argument convertion' over lua_Number */
87#ifndef LUA_UACNUMBER
88typedef double l_uacNumber;
89#else
90typedef LUA_UACNUMBER l_uacNumber;
81#endif 91#endif
82union L_Umaxalign { LUSER_ALIGNMENT_T u; void *s; long l; };
83 92
84 93
85#ifndef lua_assert 94#ifndef lua_assert
diff --git a/lobject.c b/lobject.c
index bf6b4c00..6dde80fc 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 1.89 2002/10/04 14:31:03 roberto Exp roberto $ 2** $Id: lobject.c,v 1.90 2002/10/08 18:46:08 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -116,7 +116,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
116 incr_top(L); 116 incr_top(L);
117 break; 117 break;
118 case 'f': 118 case 'f':
119 setnvalue(L->top, va_arg(argp, lua_Number)); 119 setnvalue(L->top, va_arg(argp, l_uacNumber));
120 incr_top(L); 120 incr_top(L);
121 break; 121 break;
122 case '%': 122 case '%':
diff --git a/lobject.h b/lobject.h
index ba81d56d..580848aa 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.147 2002/10/08 18:46:08 roberto Exp roberto $ 2** $Id: lobject.h,v 1.148 2002/10/16 20:40:58 roberto Exp roberto $
3** Type definitions for Lua objects 3** Type definitions for Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -140,7 +140,7 @@ typedef TObject *StkId; /* index to stack elements */
140** String headers for string table 140** String headers for string table
141*/ 141*/
142typedef union TString { 142typedef union TString {
143 union L_Umaxalign dummy; /* ensures maximum alignment for strings */ 143 L_Umaxalign dummy; /* ensures maximum alignment for strings */
144 struct { 144 struct {
145 union GCObject *next; /* pointer to next object */ 145 union GCObject *next; /* pointer to next object */
146 lu_byte tt; /* object type */ 146 lu_byte tt; /* object type */
@@ -158,7 +158,7 @@ typedef union TString {
158 158
159 159
160typedef union Udata { 160typedef union Udata {
161 union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ 161 L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
162 struct { 162 struct {
163 union GCObject *next; /* pointer to next object */ 163 union GCObject *next; /* pointer to next object */
164 lu_byte tt; /* object type */ 164 lu_byte tt; /* object type */
diff --git a/ltests.c b/ltests.c
index d6f8adc4..86586d6a 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.134 2002/08/30 19:09:21 roberto Exp roberto $ 2** $Id: ltests.c,v 1.135 2002/09/05 19:57:08 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -58,7 +58,7 @@ static void setnameval (lua_State *L, const char *name, int val) {
58 58
59 59
60/* ensures maximum alignment for HEADER */ 60/* ensures maximum alignment for HEADER */
61#define HEADER (sizeof(union L_Umaxalign)) 61#define HEADER (sizeof(L_Umaxalign))
62 62
63#define MARKSIZE 32 63#define MARKSIZE 32
64#define MARK 0x55 /* 01010101 (a nice pattern) */ 64#define MARK 0x55 /* 01010101 (a nice pattern) */
diff --git a/lua.h b/lua.h
index d3a22a75..49a99f88 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.156 2002/08/30 20:00:59 roberto Exp roberto $ 2** $Id: lua.h,v 1.157 2002/09/02 20:00:41 roberto Exp roberto $
3** Lua - An Extensible Extension Language 3** Lua - An Extensible Extension Language
4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil 4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
5** http://www.lua.org mailto:info@lua.org 5** 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);
86 86
87/* type of Numbers in Lua */ 87/* type of Numbers in Lua */
88#ifndef LUA_NUMBER 88#ifndef LUA_NUMBER
89#define LUA_NUMBER double 89typedef double lua_Number;
90#endif 90#else
91typedef LUA_NUMBER lua_Number; 91typedef LUA_NUMBER lua_Number;
92#endif
92 93
93 94
94/* mark for all API functions */ 95/* mark for all API functions */