History

Lua 5.1-rc3

Lua Team committed 20 years ago

Commit 010ebd01 parent 2fee0d617 files · +480 −377Browse files

Showing the changes to src (6 of 17 files). Show all

Unified · Split

6 files
  1. src/Makefile +2 −0
  2. src/liolib.c +2 −2
  3. src/llex.c +2 −2
  4. src/loslib.c +5 −4
  5. src/lstate.h +5 −5
  6. src/luaconf.h +2 −2
src/Makefile+2−0
@@ -107,6 +107,8 @@ posix: · 106 unmodified lines
107solaris:107solaris:
108 $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl"108 $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl"
109 109
110# list targets that do not create files (but not all makes understand .PHONY)
111.PHONY: all $(PLATS) default o a clean depend echo none
110 112
111# DO NOT DELETE113# DO NOT DELETE
112 114
src/liolib.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: liolib.c,v 2.71 2006/01/17 13:54:02 roberto Exp $2** $Id: liolib.c,v 2.72 2006/01/28 12:59:13 roberto Exp $
3** Standard I/O (and system) library3** Standard I/O (and system) library
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -283,7 +283,7 @@ static int read_line (lua_State *L, FILE *f) { · 277 unmodified lines
283 return (lua_strlen(L, -1) > 0); /* check whether read something */283 return (lua_strlen(L, -1) > 0); /* check whether read something */
284 }284 }
285 l = strlen(p);285 l = strlen(p);
286 if (p[l-1] != '\n')286 if (l == 0 || p[l-1] != '\n')
287 luaL_addsize(&b, l);287 luaL_addsize(&b, l);
288 else {288 else {
289 luaL_addsize(&b, l - 1); /* do not include `eol' */289 luaL_addsize(&b, l - 1); /* do not include `eol' */
src/llex.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: llex.c,v 2.18 2006/01/23 20:06:19 roberto Exp $2** $Id: llex.c,v 2.19 2006/02/06 18:28:16 roberto Exp $
3** Lexical Analyzer3** Lexical Analyzer
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -166,7 +166,7 @@ static int check_next (LexState *ls, const char *set) { · 160 unmodified lines
166 166
167 167
168static void buffreplace (LexState *ls, char from, char to) {168static void buffreplace (LexState *ls, char from, char to) {
169 int n = luaZ_bufflen(ls->buff);169 size_t n = luaZ_bufflen(ls->buff);
170 char *p = luaZ_buffer(ls->buff);170 char *p = luaZ_buffer(ls->buff);
171 while (n--)171 while (n--)
172 if (p[n] == from) p[n] = to;172 if (p[n] == from) p[n] = to;
src/loslib.c+5−4
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: loslib.c,v 1.16 2005/12/22 16:19:56 roberto Exp $2** $Id: loslib.c,v 1.17 2006/01/27 13:54:31 roberto Exp $
3** Standard Operating System library3** Standard Operating System library
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -21,6 +21,7 @@ · 15 unmodified lines
21 21
22 22
23static int os_pushresult (lua_State *L, int i, const char *filename) {23static int os_pushresult (lua_State *L, int i, const char *filename) {
24 int en = errno; /* calls to Lua API may change this value */
24 if (i) {25 if (i) {
25 lua_pushboolean(L, 1);26 lua_pushboolean(L, 1);
26 return 1;27 return 1;
@@ -28,10 +29,10 @@ static int os_pushresult (lua_State *L, int i, const char *filename) { · 1 unmodified line
28 else {29 else {
29 lua_pushnil(L);30 lua_pushnil(L);
30 if (filename)31 if (filename)
31 lua_pushfstring(L, "%s: %s", filename, strerror(errno));32 lua_pushfstring(L, "%s: %s", filename, strerror(en));
32 else33 else
33 lua_pushfstring(L, "%s", strerror(errno));34 lua_pushfstring(L, "%s", strerror(en));
34 lua_pushinteger(L, errno);35 lua_pushinteger(L, en);
35 return 3;36 return 3;
36 }37 }
37}38}
src/lstate.h+5−5
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lstate.h,v 2.23 2005/07/09 13:22:34 roberto Exp $2** $Id: lstate.h,v 2.24 2006/02/06 18:27:59 roberto Exp $
3** Global State3** Global State
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -49,8 +49,8 @@ typedef struct CallInfo { · 43 unmodified lines
49 StkId base; /* base for this function */49 StkId base; /* base for this function */
50 StkId func; /* function index in the stack */50 StkId func; /* function index in the stack */
51 StkId top; /* top for this function */51 StkId top; /* top for this function */
52 int nresults; /* expected number of results from this function */
53 const Instruction *savedpc;52 const Instruction *savedpc;
53 int nresults; /* expected number of results from this function */
54 int tailcalls; /* number of tail calls lost under this entry */54 int tailcalls; /* number of tail calls lost under this entry */
55} CallInfo;55} CallInfo;
56 56
@@ -71,9 +71,9 @@ typedef struct global_State { · 14 unmodified lines
71 void *ud; /* auxiliary data to `frealloc' */71 void *ud; /* auxiliary data to `frealloc' */
72 lu_byte currentwhite;72 lu_byte currentwhite;
73 lu_byte gcstate; /* state of garbage collector */73 lu_byte gcstate; /* state of garbage collector */
74 int sweepstrgc; /* position of sweep in `strt' */
74 GCObject *rootgc; /* list of all collectable objects */75 GCObject *rootgc; /* list of all collectable objects */
75 GCObject **sweepgc; /* position of sweep in `rootgc' */76 GCObject **sweepgc; /* position of sweep in `rootgc' */
76 int sweepstrgc; /* position of sweep in `strt' */
77 GCObject *gray; /* list of gray objects */77 GCObject *gray; /* list of gray objects */
78 GCObject *grayagain; /* list of objects to be traversed atomically */78 GCObject *grayagain; /* list of objects to be traversed atomically */
79 GCObject *weak; /* list of weak tables (to be cleared) */79 GCObject *weak; /* list of weak tables (to be cleared) */
@@ -99,6 +99,7 @@ typedef struct global_State { · 19 unmodified lines
99*/99*/
100struct lua_State {100struct lua_State {
101 CommonHeader;101 CommonHeader;
102 lu_byte status;
102 StkId top; /* first free slot in the stack */103 StkId top; /* first free slot in the stack */
103 StkId base; /* base of current function */104 StkId base; /* base of current function */
104 global_State *l_G;105 global_State *l_G;
@@ -106,14 +107,13 @@ struct lua_State { · 1 unmodified line
106 const Instruction *savedpc; /* `savedpc' of current function */107 const Instruction *savedpc; /* `savedpc' of current function */
107 StkId stack_last; /* last free slot in the stack */108 StkId stack_last; /* last free slot in the stack */
108 StkId stack; /* stack base */109 StkId stack; /* stack base */
109 int stacksize;
110 CallInfo *end_ci; /* points after end of ci array*/110 CallInfo *end_ci; /* points after end of ci array*/
111 CallInfo *base_ci; /* array of CallInfo's */111 CallInfo *base_ci; /* array of CallInfo's */
112 int stacksize;
112 int size_ci; /* size of array `base_ci' */113 int size_ci; /* size of array `base_ci' */
113 unsigned short nCcalls; /* number of nested C calls */114 unsigned short nCcalls; /* number of nested C calls */
114 lu_byte hookmask;115 lu_byte hookmask;
115 lu_byte allowhook;116 lu_byte allowhook;
116 lu_byte status;
117 int basehookcount;117 int basehookcount;
118 int hookcount;118 int hookcount;
119 lua_Hook hook;119 lua_Hook hook;
src/luaconf.h+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: luaconf.h,v 1.79 2006/01/23 19:51:43 roberto Exp $2** $Id: luaconf.h,v 1.80 2006/01/27 13:54:39 roberto Exp $
3** Configuration file for Lua3** Configuration file for Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -541,7 +541,7 @@ · 535 unmodified lines
541*/541*/
542 542
543/* On a Pentium, resort to a trick */543/* On a Pentium, resort to a trick */
544#if !defined(LUA_ANSI) && !defined(__SSE2__) && \544#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
545 (defined(__i386) || defined (_M_IX86) || defined(__i386__))545 (defined(__i386) || defined (_M_IX86) || defined(__i386__))
546union luai_Cast { double l_d; long l_l; };546union luai_Cast { double l_d; long l_l; };
547#define lua_number2int(i,d) \547#define lua_number2int(i,d) \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t