PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/elua/elua-git-20110610-5cb72c0595bbcc1e919d-patches/lua-remove-dump.patch

https://code.google.com/p/mizar32/
Patch | 195 lines | 173 code | 22 blank | 0 comment | 0 complexity | 7e38d1d510d2e2589cb2e53269d589e2 MD5 | raw file
  1Index: elua/src/lua/lapi.c
  2===================================================================
  3--- elua.orig/src/lua/lapi.c	2011-06-03 19:06:16.754074015 +0200
  4+++ elua/src/lua/lapi.c	2011-06-25 04:40:23.808035679 +0200
  5@@ -915,6 +915,7 @@
  6 }
  7 
  8 
  9+#ifndef NO_DUMP
 10 LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {
 11   int status;
 12   TValue *o;
 13@@ -928,6 +929,7 @@
 14   lua_unlock(L);
 15   return status;
 16 }
 17+#endif
 18 
 19 
 20 LUA_API int  lua_status (lua_State *L) {
 21Index: elua/src/lua/ldo.c
 22===================================================================
 23--- elua.orig/src/lua/ldo.c	2011-06-25 04:40:23.756035421 +0200
 24+++ elua/src/lua/ldo.c	2011-06-25 04:40:23.808035679 +0200
 25@@ -525,11 +525,17 @@
 26   Proto *tf;
 27   Closure *cl;
 28   struct SParser *p = cast(struct SParser *, ud);
 29+#ifndef NO_UNDUMP
 30   int c = luaZ_lookahead(p->z);
 31+#endif
 32   luaC_checkGC(L);
 33   set_block_gc(L);  /* stop collector during parsing */
 34+#ifndef NO_UNDUMP
 35   tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z,
 36                                                              &p->buff, p->name);
 37+#else
 38+  tf = luaY_parser(L, p->z, &p->buff, p->name);
 39+#endif
 40   cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L)));
 41   cl->l.p = tf;
 42   for (i = 0; i < tf->nups; i++)  /* initialize eventual upvalues */
 43Index: elua/src/lua/ldump.c
 44===================================================================
 45--- elua.orig/src/lua/ldump.c	2011-06-24 13:56:09.754078683 +0200
 46+++ elua/src/lua/ldump.c	2011-06-25 04:40:23.808035679 +0200
 47@@ -13,6 +13,10 @@
 48 
 49 #include "lua.h"
 50 
 51+
 52+#ifndef NO_DUMP
 53+
 54+
 55 #include "lobject.h"
 56 #include "lstate.h"
 57 #include "lundump.h"
 58@@ -308,3 +312,6 @@
 59  target.is_arm_fpa=0;
 60  return luaU_dump_crosscompile(L,f,w,data,strip,target);
 61 }
 62+
 63+
 64+#endif  // NO_DUMP
 65Index: elua/src/lua/lstrlib.c
 66===================================================================
 67--- elua.orig/src/lua/lstrlib.c	2011-06-25 04:40:23.684035062 +0200
 68+++ elua/src/lua/lstrlib.c	2011-06-25 04:40:23.808035679 +0200
 69@@ -137,6 +137,7 @@
 70 }
 71 
 72 
 73+#ifndef NO_DUMP
 74 static int writer (lua_State *L, const void* b, size_t size, void* B) {
 75   (void)L;
 76   luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
 77@@ -154,6 +155,7 @@
 78   luaL_pushresult(&b);
 79   return 1;
 80 }
 81+#endif  // NO_DUMP
 82 
 83 
 84 
 85@@ -832,7 +834,9 @@
 86 const LUA_REG_TYPE strlib[] = {
 87   {LSTRKEY("byte"), LFUNCVAL(str_byte)},
 88   {LSTRKEY("char"), LFUNCVAL(str_char)},
 89+#ifndef NO_DUMP
 90   {LSTRKEY("dump"), LFUNCVAL(str_dump)},
 91+#endif
 92   {LSTRKEY("find"), LFUNCVAL(str_find)},
 93   {LSTRKEY("format"), LFUNCVAL(str_format)},
 94 #if LUA_OPTIMIZE_MEMORY > 0 && defined(LUA_COMPAT_GFIND)
 95Index: elua/src/lua/lundump.c
 96===================================================================
 97--- elua.orig/src/lua/lundump.c	2011-06-03 19:06:16.766074070 +0200
 98+++ elua/src/lua/lundump.c	2011-06-25 04:40:23.808035679 +0200
 99@@ -20,6 +20,10 @@
100 #include "lundump.h"
101 #include "lzio.h"
102 
103+
104+#ifndef NO_UNDUMP
105+
106+
107 typedef struct {
108  lua_State* L;
109  ZIO* Z;
110@@ -305,3 +309,6 @@
111  *h++=(char)sizeof(lua_Number);
112  *h++=(char)(((lua_Number)0.5)==0);		/* is lua_Number integral? */
113 }
114+
115+
116+#endif  // NO_UNDUMP
117Index: elua/src/lua/lundump.h
118===================================================================
119--- elua.orig/src/lua/lundump.h	2011-06-03 19:06:16.838074425 +0200
120+++ elua/src/lua/lundump.h	2011-06-25 04:40:23.808035679 +0200
121@@ -12,6 +12,7 @@
122 #include "lobject.h"
123 #include "lzio.h"
124 
125+
126 typedef uint32_t strsize_t;
127 
128 /* info about target machine for cross-compilation */
129@@ -24,11 +25,15 @@
130  int is_arm_fpa;
131 } DumpTargetInfo;
132 
133+#ifndef NO_UNDUMP
134 /* load one chunk; from lundump.c */
135 LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name);
136 
137 /* make header; from lundump.c */
138 LUAI_FUNC void luaU_header (char* h);
139+#endif
140+
141+#ifndef NO_DUMP
142 
143 /* dump one chunk to a different target; from ldump.c */
144 int luaU_dump_crosscompile (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip, DumpTargetInfo target);
145@@ -41,6 +46,8 @@
146 LUAI_FUNC void luaU_print (const Proto* f, int full);
147 #endif
148 
149+#endif // NO_DUMP
150+
151 /* for header of binary files -- this is Lua 5.1 */
152 #define LUAC_VERSION		0x51
153 
154Index: elua/src/lua/luaconf.h
155===================================================================
156--- elua.orig/src/lua/luaconf.h	2011-06-25 04:40:23.792035600 +0200
157+++ elua/src/lua/luaconf.h	2011-06-25 04:40:23.812035704 +0200
158@@ -36,6 +36,17 @@
159 */
160 #define NO_GETENV
161 
162+/*
163+@@ Defining NO_DUMP removes the dump mechanism, but it is always needed when
164+** compiling the corss-compiler
165+@@ Defining NO_UNDUMP removes the undump nechanism, which is needed to be able
166+** to load compiled bytecode from *.lc files.
167+*/
168+#ifndef LUA_CROSS_COMPILER
169+# define NO_DUMP
170+#endif
171+#define NO_UNDUMP
172+
173 
174 /*
175 @@ NO_SIGNAL removes all calls to signal() since embedded platforms don't
176Index: elua/src/main.c
177===================================================================
178--- elua.orig/src/main.c	2011-06-03 19:06:16.738073936 +0200
179+++ elua/src/main.c	2011-06-25 04:40:23.812035704 +0200
180@@ -30,11 +30,15 @@
181 char *boot_order[] = {
182 #if defined(BUILD_MMCFS)
183   "/mmc/autorun.lua",
184+# ifndef NO_UNDUMP
185   "/mmc/autorun.lc",
186+# endif
187 #endif
188 #if defined(BUILD_ROMFS)
189   "/rom/autorun.lua",
190+# ifndef NO_UNDUMP
191   "/rom/autorun.lc",
192+# endif
193 #endif
194 };
195