summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/lua
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2014-06-02 14:39:22 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2014-06-21 19:22:26 +0200
commit3181aa0eb5b0f49b3c64aa3ef63dad3b771cff75 (patch)
tree902165284944ccd5d989dc2d814a4c9eca4622be /meta-oe/recipes-devtools/lua
parenta4b54a8cc3855a0ca2585215c3dcb971f0ca59c1 (diff)
downloadmeta-openembedded-3181aa0eb5b0f49b3c64aa3ef63dad3b771cff75.tar.gz
lua: Remove lua5.1
* we have lua-5.2 in "lua" recipe and lua-5.1 in "lua5.1", but these aren't completely separate in sysroot: WARNING: The recipe lua is trying to install files into a shared area when those files already exist. Those files and their manifest location are: /OE/build/oe-core/tmp-eglibc/sysroots/qemux86/usr/include/lauxlib.h Matched in manifest-qemux86-lua5.1.populate_sysroot /OE/build/oe-core/tmp-eglibc/sysroots/qemux86/usr/include/lua.h Matched in manifest-qemux86-lua5.1.populate_sysroot /OE/build/oe-core/tmp-eglibc/sysroots/qemux86/usr/include/lua.hpp Matched in manifest-qemux86-lua5.1.populate_sysroot /OE/build/oe-core/tmp-eglibc/sysroots/qemux86/usr/include/luaconf.h Matched in manifest-qemux86-lua5.1.populate_sysroot /OE/build/oe-core/tmp-eglibc/sysroots/qemux86/usr/include/lualib.h Matched in manifest-qemux86-lua5.1.populate_sysroot /OE/build/oe-core/tmp-eglibc/sysroots/qemux86/usr/lib/liblua.a Matched in manifest-qemux86-lua5.1.populate_sysroot Please verify which package should provide the above files. Causing some undeterministic behavior. * keep only 5.2 in "lua" Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-devtools/lua')
-rw-r--r--meta-oe/recipes-devtools/lua/lua5.1/bitwise_operators.patch605
-rw-r--r--meta-oe/recipes-devtools/lua/lua5.1/lua5.1.pc11
-rw-r--r--meta-oe/recipes-devtools/lua/lua5.1/luaorg_1.patch18
-rw-r--r--meta-oe/recipes-devtools/lua/lua5.1/luaorg_2.patch44
-rw-r--r--meta-oe/recipes-devtools/lua/lua5.1/uclibc-pthread.patch13
-rw-r--r--meta-oe/recipes-devtools/lua/lua5.1_5.1.5.bb55
6 files changed, 0 insertions, 746 deletions
diff --git a/meta-oe/recipes-devtools/lua/lua5.1/bitwise_operators.patch b/meta-oe/recipes-devtools/lua/lua5.1/bitwise_operators.patch
deleted file mode 100644
index 4f0331ebb..000000000
--- a/meta-oe/recipes-devtools/lua/lua5.1/bitwise_operators.patch
+++ /dev/null
@@ -1,605 +0,0 @@
1diff -Nurd lua-5.1.5/src/lcode.c lua-5.1.5/src/lcode.c
2--- lua-5.1.5/src/lcode.c 2011-01-31 16:53:16.000000000 +0200
3+++ lua-5.1.5/src/lcode.c 2012-11-28 21:12:23.958419501 +0200
4@@ -642,6 +642,17 @@
5 case OP_POW: r = luai_numpow(v1, v2); break;
6 case OP_UNM: r = luai_numunm(v1); break;
7 case OP_LEN: return 0; /* no constant folding for 'len' */
8+#if defined(LUA_BITWISE_OPERATORS)
9+ case OP_BOR: luai_logor(r, v1, v2); break;
10+ case OP_BAND: luai_logand(r, v1, v2); break;
11+ case OP_BXOR: luai_logxor(r, v1, v2); break;
12+ case OP_BLSHFT: luai_loglshft(r, v1, v2); break;
13+ case OP_BRSHFT: luai_logrshft(r, v1, v2); break;
14+ case OP_BNOT: luai_lognot(r, v1); break;
15+ case OP_INTDIV:
16+ if (v2 == 0) return 0; /* do not attempt to divide by 0 */
17+ r = luai_numintdiv(v1, v2); break;
18+#endif
19 default: lua_assert(0); r = 0; break;
20 }
21 if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */
22@@ -654,7 +665,11 @@
23 if (constfolding(op, e1, e2))
24 return;
25 else {
26+#if defined(LUA_BITWISE_OPERATORS)
27+ int o2 = (op != OP_UNM && op != OP_LEN && op != OP_BNOT) ? luaK_exp2RK(fs, e2) : 0;
28+#else
29 int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0;
30+#endif
31 int o1 = luaK_exp2RK(fs, e1);
32 if (o1 > o2) {
33 freeexp(fs, e1);
34@@ -690,6 +705,14 @@
35 expdesc e2;
36 e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
37 switch (op) {
38+#if defined(LUA_BITWISE_OPERATORS)
39+ case OPR_BNOT: {
40+ if (e->k == VK)
41+ luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
42+ codearith(fs, OP_BNOT, e, &e2);
43+ break;
44+ }
45+#endif
46 case OPR_MINUS: {
47 if (!isnumeral(e))
48 luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
49@@ -770,6 +793,14 @@
50 case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break;
51 case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break;
52 case OPR_POW: codearith(fs, OP_POW, e1, e2); break;
53+#if defined(LUA_BITWISE_OPERATORS)
54+ case OPR_BOR: codearith(fs, OP_BOR, e1, e2); break;
55+ case OPR_BAND: codearith(fs, OP_BAND, e1, e2); break;
56+ case OPR_BXOR: codearith(fs, OP_BXOR, e1, e2); break;
57+ case OPR_BLSHFT: codearith(fs, OP_BLSHFT, e1, e2); break;
58+ case OPR_BRSHFT: codearith(fs, OP_BRSHFT, e1, e2); break;
59+ case OPR_INTDIV: codearith(fs, OP_INTDIV, e1, e2); break;
60+#endif
61 case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break;
62 case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break;
63 case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break;
64diff -Nurd lua-5.1.5/src/lcode.h lua-5.1.5/src/lcode.h
65--- lua-5.1.5/src/lcode.h 2007-12-27 15:02:25.000000000 +0200
66+++ lua-5.1.5/src/lcode.h 2012-11-28 21:12:23.958419501 +0200
67@@ -25,6 +25,9 @@
68 */
69 typedef enum BinOpr {
70 OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW,
71+#if defined(LUA_BITWISE_OPERATORS)
72+ OPR_BOR, OPR_BAND, OPR_BXOR, OPR_BLSHFT, OPR_BRSHFT, OPR_INTDIV,
73+#endif
74 OPR_CONCAT,
75 OPR_NE, OPR_EQ,
76 OPR_LT, OPR_LE, OPR_GT, OPR_GE,
77@@ -33,8 +36,11 @@
78 } BinOpr;
79
80
81+#if defined(LUA_BITWISE_OPERATORS)
82+typedef enum UnOpr { OPR_BNOT, OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
83+#else
84 typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
85-
86+#endif
87
88 #define getcode(fs,e) ((fs)->f->code[(e)->u.s.info])
89
90diff -Nurd lua-5.1.5/src/ldebug.c lua-5.1.5/src/ldebug.c
91--- lua-5.1.5/src/ldebug.c 2008-05-08 19:56:26.000000000 +0300
92+++ lua-5.1.5/src/ldebug.c 2012-11-28 21:12:23.958419501 +0200
93@@ -592,6 +592,16 @@
94 luaG_typeerror(L, p2, "perform arithmetic on");
95 }
96
97+#if defined (LUA_BITWISE_OPERATORS)
98+void luaG_logicerror (lua_State *L, const TValue *p1, const TValue *p2) {
99+ TValue temp;
100+ if (luaV_tonumber(p1, &temp) == NULL)
101+ p2 = p1; /* first operand is wrong */
102+ luaG_typeerror(L, p2, "perform bitwise operation on");
103+}
104+#endif
105+
106+
107
108 int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
109 const char *t1 = luaT_typenames[ttype(p1)];
110diff -Nurd lua-5.1.5/src/ldebug.h lua-5.1.5/src/ldebug.h
111--- lua-5.1.5/src/ldebug.h 2007-12-27 15:02:25.000000000 +0200
112+++ lua-5.1.5/src/ldebug.h 2012-11-28 21:12:23.958419501 +0200
113@@ -30,4 +30,9 @@
114 LUAI_FUNC int luaG_checkcode (const Proto *pt);
115 LUAI_FUNC int luaG_checkopenop (Instruction i);
116
117+#if defined (LUA_BITWISE_OPERATORS)
118+LUAI_FUNC void luaG_logicerror (lua_State *L, const TValue *p1,
119+ const TValue *p2);
120+#endif
121+
122 #endif
123diff -Nurd lua-5.1.5/src/llex.c lua-5.1.5/src/llex.c
124--- lua-5.1.5/src/llex.c 2009-11-23 16:58:22.000000000 +0200
125+++ lua-5.1.5/src/llex.c 2012-11-28 21:12:23.958419501 +0200
126@@ -39,7 +39,11 @@
127 "end", "false", "for", "function", "if",
128 "in", "local", "nil", "not", "or", "repeat",
129 "return", "then", "true", "until", "while",
130+#if defined(LUA_BITWISE_OPERATORS)
131+ "..", "...", "==", ">=", ">>", "<=", "<<", "^^", "~=", "!="
132+#else
133 "..", "...", "==", ">=", "<=", "~=",
134+#endif
135 "<number>", "<name>", "<string>", "<eof>",
136 NULL
137 };
138@@ -373,6 +377,30 @@
139 if (ls->current != '=') return '=';
140 else { next(ls); return TK_EQ; }
141 }
142+#if defined(LUA_BITWISE_OPERATORS)
143+ case '<': {
144+ next(ls);
145+ if (ls->current == '=') { next(ls); return TK_LE; }
146+ else if (ls->current == '<') { next(ls); return TK_LSHFT; }
147+ else return '<';
148+ }
149+ case '>': {
150+ next(ls);
151+ if (ls->current == '=') { next(ls); return TK_GE; }
152+ else if (ls->current == '>') { next(ls); return TK_RSHFT; }
153+ else return '>';
154+ }
155+ case '^': {
156+ next(ls);
157+ if (ls->current != '^') return '^';
158+ else { next(ls); return TK_XOR; }
159+ }
160+ case '!': {
161+ next(ls);
162+ if (ls->current != '=') return '!';
163+ else { next(ls); return TK_NE; }
164+ }
165+#else
166 case '<': {
167 next(ls);
168 if (ls->current != '=') return '<';
169@@ -381,8 +409,9 @@
170 case '>': {
171 next(ls);
172 if (ls->current != '=') return '>';
173- else { next(ls); return TK_GE; }
174+ else { next(ls); return TK_GE; }
175 }
176+#endif
177 case '~': {
178 next(ls);
179 if (ls->current != '=') return '~';
180diff -Nurd lua-5.1.5/src/llex.h lua-5.1.5/src/llex.h
181--- lua-5.1.5/src/llex.h 2007-12-27 15:02:25.000000000 +0200
182+++ lua-5.1.5/src/llex.h 2012-11-28 21:12:23.962419499 +0200
183@@ -28,7 +28,11 @@
184 TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
185 TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
186 /* other terminal symbols */
187+#if defined(LUA_BITWISE_OPERATORS)
188+ TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LSHFT, TK_LE, TK_RSHFT, TK_XOR, TK_NE, TK_CNE, TK_NUMBER,
189+#else
190 TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
191+#endif
192 TK_NAME, TK_STRING, TK_EOS
193 };
194
195diff -Nurd lua-5.1.5/src/lopcodes.c lua-5.1.5/src/lopcodes.c
196--- lua-5.1.5/src/lopcodes.c 2007-12-27 15:02:25.000000000 +0200
197+++ lua-5.1.5/src/lopcodes.c 2012-11-28 21:12:23.962419499 +0200
198@@ -32,6 +32,15 @@
199 "DIV",
200 "MOD",
201 "POW",
202+#if defined(LUA_BITWISE_OPERATORS)
203+ "BOR",
204+ "BAND",
205+ "OP_BXOR"
206+ "BLSHFT",
207+ "BRSHFT",
208+ "BNOT",
209+ "INTDIV",
210+#endif
211 "UNM",
212 "NOT",
213 "LEN",
214@@ -78,6 +87,15 @@
215 ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */
216 ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */
217 ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */
218+#if defined(LUA_BITWISE_OPERATORS)
219+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BOR */
220+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BAND */
221+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BXOR */
222+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BLSHFT */
223+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BRSHFT */
224+ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_BNOT */
225+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_INTDIV */
226+#endif
227 ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */
228 ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */
229 ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */
230diff -Nurd lua-5.1.5/src/lopcodes.h lua-5.1.5/src/lopcodes.h
231--- lua-5.1.5/src/lopcodes.h 2007-12-27 15:02:25.000000000 +0200
232+++ lua-5.1.5/src/lopcodes.h 2012-11-28 21:12:23.962419499 +0200
233@@ -174,10 +174,20 @@
234 OP_DIV,/* A B C R(A) := RK(B) / RK(C) */
235 OP_MOD,/* A B C R(A) := RK(B) % RK(C) */
236 OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */
237+#if defined(LUA_BITWISE_OPERATORS)
238+OP_BOR,/* A B C R(A) := RK(B) | RK(C) */
239+OP_BAND,/* A B C R(A) := RK(B) & RK(C) */
240+OP_BXOR,/* A B C R(A) := RK(B) ^| RK(C) */
241+OP_BLSHFT,/* A B C R(A) := RK(B) << RK(C) */
242+OP_BRSHFT,/* A B C R(A) := RK(B) >> RK(C) */
243+OP_BNOT,/* A B R(A) := ~ R(B) */
244+OP_INTDIV,/* A B C R(A) := RK(B) \ RK(C) */
245+#endif
246 OP_UNM,/* A B R(A) := -R(B) */
247 OP_NOT,/* A B R(A) := not R(B) */
248 OP_LEN,/* A B R(A) := length of R(B) */
249
250+
251 OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
252
253 OP_JMP,/* sBx pc+=sBx */
254@@ -186,8 +196,8 @@
255 OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */
256 OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */
257
258-OP_TEST,/* A C if not (R(A) <=> C) then pc++ */
259-OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
260+OP_TEST,/* A C if not (R(A) <=> C) then pc++ */
261+OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
262
263 OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
264 OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */
265@@ -197,8 +207,8 @@
266 if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/
267 OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */
268
269-OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
270- if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */
271+OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
272+ if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */
273 OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */
274
275 OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/
276diff -Nurd lua-5.1.5/src/lparser.c lua-5.1.5/src/lparser.c
277--- lua-5.1.5/src/lparser.c 2011-10-21 22:31:42.000000000 +0300
278+++ lua-5.1.5/src/lparser.c 2012-11-28 21:12:23.962419499 +0200
279@@ -780,6 +780,9 @@
280 case TK_NOT: return OPR_NOT;
281 case '-': return OPR_MINUS;
282 case '#': return OPR_LEN;
283+#if defined(LUA_BITWISE_OPERATORS)
284+ case '~': return OPR_BNOT;
285+#endif
286 default: return OPR_NOUNOPR;
287 }
288 }
289@@ -793,6 +796,14 @@
290 case '/': return OPR_DIV;
291 case '%': return OPR_MOD;
292 case '^': return OPR_POW;
293+#if defined(LUA_BITWISE_OPERATORS)
294+ case '|': return OPR_BOR;
295+ case '&': return OPR_BAND;
296+ case TK_XOR: return OPR_BXOR;
297+ case TK_LSHFT: return OPR_BLSHFT;
298+ case TK_RSHFT: return OPR_BRSHFT;
299+ case '\\': return OPR_INTDIV;
300+#endif
301 case TK_CONCAT: return OPR_CONCAT;
302 case TK_NE: return OPR_NE;
303 case TK_EQ: return OPR_EQ;
304@@ -812,6 +823,9 @@
305 lu_byte right; /* right priority */
306 } priority[] = { /* ORDER OPR */
307 {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */
308+#if defined(LUA_BITWISE_OPERATORS)
309+ {6, 6}, {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `|' `&' `!' `<<' `>>' `\' */
310+#endif
311 {10, 9}, {5, 4}, /* power and concat (right associative) */
312 {3, 3}, {3, 3}, /* equality and inequality */
313 {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */
314diff -Nurd lua-5.1.5/src/ltm.c lua-5.1.5/src/ltm.c
315--- lua-5.1.5/src/ltm.c 2007-12-27 15:02:25.000000000 +0200
316+++ lua-5.1.5/src/ltm.c 2012-11-28 21:12:23.962419499 +0200
317@@ -34,6 +34,9 @@
318 "__add", "__sub", "__mul", "__div", "__mod",
319 "__pow", "__unm", "__len", "__lt", "__le",
320 "__concat", "__call"
321+#if defined(LUA_BITWISE_OPERATORS)
322+ ,"__or", "__and", "__xor", "__shl", "__shr", "__not", "__intdiv"
323+#endif
324 };
325 int i;
326 for (i=0; i<TM_N; i++) {
327diff -Nurd lua-5.1.5/src/ltm.h lua-5.1.5/src/ltm.h
328--- lua-5.1.5/src/ltm.h 2007-12-27 15:02:25.000000000 +0200
329+++ lua-5.1.5/src/ltm.h 2012-11-28 21:12:23.962419499 +0200
330@@ -33,6 +33,15 @@
331 TM_LE,
332 TM_CONCAT,
333 TM_CALL,
334+#if defined(LUA_BITWISE_OPERATORS)
335+ TM_BOR,
336+ TM_BAND,
337+ TM_BXOR,
338+ TM_BLSHFT,
339+ TM_BRSHFT,
340+ TM_BNOT,
341+ TM_INTDIV,
342+#endif
343 TM_N /* number of elements in the enum */
344 } TMS;
345
346diff -Nurd lua-5.1.5/src/luaconf.h lua-5.1.5/src/luaconf.h
347--- lua-5.1.5/src/luaconf.h 2008-02-11 18:25:08.000000000 +0200
348+++ lua-5.1.5/src/luaconf.h 2012-11-28 21:12:23.962419499 +0200
349@@ -2,6 +2,7 @@
350 ** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
351 ** Configuration file for Lua
352 ** See Copyright Notice in lua.h
353+** Added logic operators : & | ^^ (xor) << >> ~, arithmetic operator \ (integer division) and != as an alternative to ~=
354 */
355
356
357@@ -209,6 +210,12 @@
358 */
359 #define LUA_IDSIZE 60
360
361+/*
362+@@ LUA_BITWISE_OPERATORS enable logical operators | & ^| >> << ~ on lua_Number
363+@* but also arithmetic operator \ (integer division) and != as an alernative to ~=
364+*/
365+#define LUA_BITWISE_OPERATORS
366+
367
368 /*
369 ** {==================================================================
370@@ -216,6 +223,7 @@
371 ** ===================================================================
372 */
373
374+
375 #if defined(lua_c) || defined(luaall_c)
376
377 /*
378@@ -526,25 +534,6 @@
379
380
381 /*
382-@@ The luai_num* macros define the primitive operations over numbers.
383-*/
384-#if defined(LUA_CORE)
385-#include <math.h>
386-#define luai_numadd(a,b) ((a)+(b))
387-#define luai_numsub(a,b) ((a)-(b))
388-#define luai_nummul(a,b) ((a)*(b))
389-#define luai_numdiv(a,b) ((a)/(b))
390-#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))
391-#define luai_numpow(a,b) (pow(a,b))
392-#define luai_numunm(a) (-(a))
393-#define luai_numeq(a,b) ((a)==(b))
394-#define luai_numlt(a,b) ((a)<(b))
395-#define luai_numle(a,b) ((a)<=(b))
396-#define luai_numisnan(a) (!luai_numeq((a), (a)))
397-#endif
398-
399-
400-/*
401 @@ lua_number2int is a macro to convert lua_Number to int.
402 @@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
403 ** CHANGE them if you know a faster way to convert a lua_Number to
404@@ -560,7 +549,7 @@
405 /* On a Microsoft compiler, use assembler */
406 #if defined(_MSC_VER)
407
408-#define lua_number2int(i,d) __asm fld d __asm fistp i
409+#define lua_number2int(i,d) { __asm fld d __asm fistp i }
410 #define lua_number2integer(i,n) lua_number2int(i, n)
411
412 /* the next trick should work on any Pentium, but sometimes clashes
413@@ -582,6 +571,38 @@
414
415 #endif
416
417+
418+/*
419+@@ The luai_num* macros define the primitive operations over numbers.
420+*/
421+#if defined(LUA_CORE)
422+#include <math.h>
423+#define luai_numadd(a,b) ((a)+(b))
424+#define luai_numsub(a,b) ((a)-(b))
425+#define luai_nummul(a,b) ((a)*(b))
426+#define luai_numdiv(a,b) ((a)/(b))
427+#ifdef LUA_BITWISE_OPERATORS
428+#define luai_numintdiv(a,b) (floor((a)/(b)))
429+#endif
430+#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))
431+#define luai_numpow(a,b) (pow(a,b))
432+#define luai_numunm(a) (-(a))
433+#define luai_numeq(a,b) ((a)==(b))
434+#define luai_numlt(a,b) ((a)<(b))
435+#define luai_numle(a,b) ((a)<=(b))
436+#define luai_numisnan(a) (!luai_numeq((a), (a)))
437+
438+#if defined(LUA_BITWISE_OPERATORS)
439+#define luai_logor(r, a, b) { lua_Integer ai,bi; lua_number2int(ai,a); lua_number2int(bi,b); r = ai|bi; }
440+#define luai_logand(r, a,b) { lua_Integer ai,bi; lua_number2int(ai,a); lua_number2int(bi,b); r = ai&bi; }
441+#define luai_logxor(r, a,b) { lua_Integer ai,bi; lua_number2int(ai,a); lua_number2int(bi,b); r = ai^bi; }
442+#define luai_lognot(r,a) { lua_Integer ai; lua_number2int(ai,a); r = ~ai; }
443+#define luai_loglshft(r, a,b) { lua_Integer ai,bi; lua_number2int(ai,a); lua_number2int(bi,b); r = ai<<bi; }
444+#define luai_logrshft(r, a,b) { lua_Integer ai,bi; lua_number2int(ai,a); lua_number2int(bi,b); r = ai>>bi; }
445+#endif
446+
447+#endif
448+
449 /* }================================================================== */
450
451
452diff -Nurd lua-5.1.5/src/lua.h lua-5.1.5/src/lua.h
453--- lua-5.1.5/src/lua.h 2012-01-13 22:36:20.000000000 +0200
454+++ lua-5.1.5/src/lua.h 2012-11-28 21:13:01.266418680 +0200
455@@ -17,7 +17,7 @@
456
457
458 #define LUA_VERSION "Lua 5.1"
459-#define LUA_RELEASE "Lua 5.1.5"
460+#define LUA_RELEASE "Lua 5.1.5+bitwiseops"
461 #define LUA_VERSION_NUM 501
462 #define LUA_COPYRIGHT "Copyright (C) 1994-2012 Lua.org, PUC-Rio"
463 #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
464diff -Nurd lua-5.1.5/src/lvm.c lua-5.1.5/src/lvm.c
465--- lua-5.1.5/src/lvm.c 2011-08-17 23:43:11.000000000 +0300
466+++ lua-5.1.5/src/lvm.c 2012-11-28 21:12:23.966419498 +0200
467@@ -329,6 +329,9 @@
468 case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break;
469 case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
470 case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
471+#if defined(LUA_BITWISE_OPERATORS)
472+ case TM_INTDIV: setnvalue(ra, luai_numintdiv(nb, nc)); break;
473+#endif
474 default: lua_assert(0); break;
475 }
476 }
477@@ -336,7 +339,30 @@
478 luaG_aritherror(L, rb, rc);
479 }
480
481-
482+#if defined(LUA_BITWISE_OPERATORS)
483+static void Logic (lua_State *L, StkId ra, const TValue *rb,
484+ const TValue *rc, TMS op) {
485+ TValue tempb, tempc;
486+ const TValue *b, *c;
487+ if ((b = luaV_tonumber(rb, &tempb)) != NULL &&
488+ (c = luaV_tonumber(rc, &tempc)) != NULL) {
489+ lua_Number nb = nvalue(b), nc = nvalue(c);
490+ lua_Integer r;
491+ switch (op) {
492+ case TM_BLSHFT: luai_loglshft(r, nb, nc); break;
493+ case TM_BRSHFT: luai_logrshft(r, nb, nc); break;
494+ case TM_BOR: luai_logor(r, nb, nc); break;
495+ case TM_BAND: luai_logand(r, nb, nc); break;
496+ case TM_BXOR: luai_logxor(r, nb, nc); break;
497+ case TM_BNOT: luai_lognot(r, nb); break;
498+ default: lua_assert(0); r = 0; break;
499+ }
500+ setnvalue(ra, r);
501+ }
502+ else if (!call_binTM(L, rb, rc, ra, op))
503+ luaG_logicerror(L, rb, rc);
504+}
505+#endif
506
507 /*
508 ** some macros for common tasks in `luaV_execute'
509@@ -373,6 +399,22 @@
510 }
511
512
513+#if defined(LUA_BITWISE_OPERATORS)
514+#define logic_op(op,tm) { \
515+ TValue *rb = RKB(i); \
516+ TValue *rc = RKC(i); \
517+ if (ttisnumber(rb) && ttisnumber(rc)) { \
518+ lua_Integer r; \
519+ lua_Number nb = nvalue(rb), nc = nvalue(rc); \
520+ op(r, nb, nc); \
521+ setnvalue(ra, r); \
522+ } \
523+ else \
524+ Protect(Logic(L, ra, rb, rc, tm)); \
525+ }
526+#endif
527+
528+
529
530 void luaV_execute (lua_State *L, int nexeccalls) {
531 LClosure *cl;
532@@ -506,6 +548,45 @@
533 }
534 continue;
535 }
536+#if defined(LUA_BITWISE_OPERATORS)
537+ case OP_BOR: {
538+ logic_op(luai_logor, TM_BOR);
539+ continue;
540+ }
541+ case OP_BAND: {
542+ logic_op(luai_logand, TM_BAND);
543+ continue;
544+ }
545+ case OP_BXOR: {
546+ logic_op(luai_logxor, TM_BXOR);
547+ continue;
548+ }
549+ case OP_BLSHFT: {
550+ logic_op(luai_loglshft, TM_BLSHFT);
551+ continue;
552+ }
553+ case OP_BRSHFT: {
554+ logic_op(luai_logrshft, TM_BRSHFT);
555+ continue;
556+ }
557+ case OP_BNOT: {
558+ TValue *rb = RB(i);
559+ if (ttisnumber(rb)) {
560+ lua_Integer r;
561+ lua_Number nb = nvalue(rb);
562+ luai_lognot(r, nb);
563+ setnvalue(ra, r);
564+ }
565+ else {
566+ Protect(Logic(L, ra, rb, rb, TM_BNOT));
567+ }
568+ continue;
569+ }
570+ case OP_INTDIV: {
571+ arith_op(luai_numintdiv, TM_DIV);
572+ continue;
573+ }
574+#endif
575 case OP_NOT: {
576 int res = l_isfalse(RB(i)); /* next assignment may change this value */
577 setbvalue(ra, res);
578diff -Nurd lua-5.1.5/test/bitwisepatchtest.lua lua-5.1.5/test/bitwisepatchtest.lua
579--- lua-5.1.5/test/bitwisepatchtest.lua 1970-01-01 02:00:00.000000000 +0200
580+++ lua-5.1.5/test/bitwisepatchtest.lua 2012-11-28 21:12:23.966419498 +0200
581@@ -0,0 +1,24 @@
582+hex=function (i) return "0x"..string.format("%X", i) end
583+print(hex(0x54|0x55))
584+print(hex(0x54&0x66))
585+print(hex(0x54^|0x66))
586+print(hex(~0x54))
587+print(hex(0xF<< 4))
588+print(hex(0xF0>> 4))
589+a,b=0x54,0x55
590+print(hex(a),"|",hex(b), "=",hex(a|b))
591+print(hex(a),"|","0x55", "=",hex(a|0x55))
592+print(hex(a),"|","0x5|0x50 (", hex(0x5|0x50), ") =",hex(a|(0x5|0x50)))
593+a,b=0x54,0x66
594+print(hex(a),"&",hex(b), "=",hex(a&b))
595+print(hex(a),"&","0x66", "=",hex(a&0x66))
596+print(hex(a),"^|",hex(b), "=",hex(a^|b))
597+print(hex(a),"^|","0x66", "=",hex(a^|0x66))
598+print("~"..hex(a),"=",hex(~a))
599+a,b=0xF,0xF0
600+print(hex(a).."<<4","=",hex(a<<4))
601+print(hex(b)..">>4","=",hex(b>>4))
602+a,b=0xF,4
603+print(hex(a).."<<"..b,"=",hex(a<<b))
604+a,b=0xF0,4
605+print(hex(a)..">>"..b,"=",hex(a>>b))
diff --git a/meta-oe/recipes-devtools/lua/lua5.1/lua5.1.pc b/meta-oe/recipes-devtools/lua/lua5.1/lua5.1.pc
deleted file mode 100644
index 64c03d2b6..000000000
--- a/meta-oe/recipes-devtools/lua/lua5.1/lua5.1.pc
+++ /dev/null
@@ -1,11 +0,0 @@
1prefix=/usr
2libdir=${prefix}/lib
3includedir=${prefix}/include
4
5Name: Lua
6Description: Lua language engine
7Version: 5.1.5
8Requires:
9Libs: -L${libdir} -llua
10Libs.private: -lm
11Cflags: -I${includedir}
diff --git a/meta-oe/recipes-devtools/lua/lua5.1/luaorg_1.patch b/meta-oe/recipes-devtools/lua/lua5.1/luaorg_1.patch
deleted file mode 100644
index b64a6a26b..000000000
--- a/meta-oe/recipes-devtools/lua/lua5.1/luaorg_1.patch
+++ /dev/null
@@ -1,18 +0,0 @@
1lua.org patch 1 for lua-5.1.5.
2from http://www.lua.org/bugs.html
3
4Upstream-Status: Backport
5
6Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
7diff -Nurd lua-5.1.5/src/Makefile lua-5.1.5/src/Makefile
8--- lua-5.1.5/src/Makefile 2012-02-13 22:41:22.000000000 +0200
9+++ lua-5.1.5/src/Makefile 2013-10-25 11:29:49.769540434 +0300
10@@ -48,7 +48,7 @@
11 a: $(ALL_A)
12
13 $(LUA_A): $(CORE_O) $(LIB_O)
14- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
15+ $(AR) $@ $(CORE_O) $(LIB_O)
16 $(RANLIB) $@
17
18 $(LUA_T): $(LUA_O) $(LUA_A)
diff --git a/meta-oe/recipes-devtools/lua/lua5.1/luaorg_2.patch b/meta-oe/recipes-devtools/lua/lua5.1/luaorg_2.patch
deleted file mode 100644
index 0c48ea287..000000000
--- a/meta-oe/recipes-devtools/lua/lua5.1/luaorg_2.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1lua.org patch 2 for lua-5.1.5.
2from http://www.lua.org/bugs.html
3
4Upstream-Status: Backport
5
6Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
7diff -Nurd lua-5.1.5/src/lzio.c lua-5.1.5/src/lzio.c
8--- lua-5.1.5/src/lzio.c 2007-12-27 15:02:25.000000000 +0200
9+++ lua-5.1.5/src/lzio.c 2013-10-25 11:32:45.773536572 +0300
10@@ -22,10 +22,14 @@
11 size_t size;
12 lua_State *L = z->L;
13 const char *buff;
14+ if (z->eoz) return EOZ;
15 lua_unlock(L);
16 buff = z->reader(L, z->data, &size);
17 lua_lock(L);
18- if (buff == NULL || size == 0) return EOZ;
19+ if (buff == NULL || size == 0) {
20+ z->eoz = 1; /* avoid calling reader function next time */
21+ return EOZ;
22+ }
23 z->n = size - 1;
24 z->p = buff;
25 return char2int(*(z->p++));
26@@ -51,6 +55,7 @@
27 z->data = data;
28 z->n = 0;
29 z->p = NULL;
30+ z->eoz = 0;
31 }
32
33
34diff -Nurd lua-5.1.5/src/lzio.h lua-5.1.5/src/lzio.h
35--- lua-5.1.5/src/lzio.h 2007-12-27 15:02:25.000000000 +0200
36+++ lua-5.1.5/src/lzio.h 2013-10-25 11:31:50.301537789 +0300
37@@ -59,6 +59,7 @@
38 lua_Reader reader;
39 void* data; /* additional data */
40 lua_State *L; /* Lua state (for reader) */
41+ int eoz; /* true if reader has no more data */
42 };
43
44
diff --git a/meta-oe/recipes-devtools/lua/lua5.1/uclibc-pthread.patch b/meta-oe/recipes-devtools/lua/lua5.1/uclibc-pthread.patch
deleted file mode 100644
index 0555e81b1..000000000
--- a/meta-oe/recipes-devtools/lua/lua5.1/uclibc-pthread.patch
+++ /dev/null
@@ -1,13 +0,0 @@
1Index: lua-5.1.4/src/Makefile
2===================================================================
3--- lua-5.1.4.orig/src/Makefile 2010-10-16 09:51:52.000000000 +0200
4+++ lua-5.1.4/src/Makefile 2010-10-16 09:52:15.000000000 +0200
5@@ -12,7 +12,7 @@
6 AR= ar rcu
7 RANLIB= ranlib
8 RM= rm -f
9-LIBS= -lm $(MYLIBS)
10+LIBS= -lm -lpthread $(MYLIBS)
11
12 MYCFLAGS=
13 MYLDFLAGS=
diff --git a/meta-oe/recipes-devtools/lua/lua5.1_5.1.5.bb b/meta-oe/recipes-devtools/lua/lua5.1_5.1.5.bb
deleted file mode 100644
index f9469948e..000000000
--- a/meta-oe/recipes-devtools/lua/lua5.1_5.1.5.bb
+++ /dev/null
@@ -1,55 +0,0 @@
1DESCRIPTION = "Lua is a powerful light-weight programming language designed \
2for extending applications."
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=59bdd99bb82238f238cf5c65c21604fd"
5HOMEPAGE = "http://www.lua.org/"
6
7PR = "r2"
8
9DEPENDS += "readline"
10SRC_URI = "http://www.lua.org/ftp/lua-${PV}.tar.gz \
11 file://bitwise_operators.patch \
12 file://lua5.1.pc \
13 file://luaorg_1.patch \
14 file://luaorg_2.patch \
15"
16S = "${WORKDIR}/lua-${PV}"
17
18inherit pkgconfig binconfig
19
20UCLIBC_PATCHES += "file://uclibc-pthread.patch"
21SRC_URI_append_libc-uclibc = "${UCLIBC_PATCHES}"
22
23TARGET_CC_ARCH += " -fPIC ${LDFLAGS}"
24EXTRA_OEMAKE = "'CC=${CC} -fPIC' 'MYCFLAGS=${CFLAGS} -DLUA_USE_LINUX -fPIC' MYLDFLAGS='${LDFLAGS}'"
25
26do_configure_prepend() {
27 sed -i -e s:/usr/local:${prefix}:g src/luaconf.h
28 sed -i -e s:lib/lua/5.1/:${base_libdir}/lua/5.1/:g src/luaconf.h
29}
30
31do_compile () {
32 oe_runmake linux
33}
34
35do_install () {
36 oe_runmake \
37 'INSTALL_TOP=${D}${prefix}' \
38 'INSTALL_BIN=${D}${bindir}' \
39 'INSTALL_INC=${D}${includedir}/' \
40 'INSTALL_MAN=${D}${mandir}/man1' \
41 'INSTALL_SHARE=${D}${datadir}/lua' \
42 'INSTALL_LIB=${D}${libdir}' \
43 'INSTALL_CMOD=${D}${libdir}/lua/5.1' \
44 install
45 install -d ${D}${libdir}/pkgconfig
46 install -m 0644 ${WORKDIR}/lua5.1.pc ${D}${libdir}/pkgconfig/lua5.1.pc
47 rmdir ${D}${libdir}/lua/5.1
48 rmdir ${D}${libdir}/lua
49 rmdir ${D}${datadir}/lua/5.1
50 rmdir ${D}${datadir}/lua
51}
52BBCLASSEXTEND = "native"
53
54SRC_URI[md5sum] = "2e115fe26e435e33b0d5c022e4490567"
55SRC_URI[sha256sum] = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333"