Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -urN lua-5.0/src/lib/lbaselib.c lua/src/lib/lbaselib.c
- --- lua-5.0/src/lib/lbaselib.c 2003-04-03 07:35:34.000000000 -0600
- +++ lua/src/lib/lbaselib.c 2013-05-30 16:32:09.524617720 -0500
- @@ -1,5 +1,4 @@
- /*
- -** $Id: lbaselib.c,v 1.130 2003/04/03 13:35:34 roberto Exp $
- ** Basic library
- ** See Copyright Notice in lua.h
- */
- @@ -19,6 +18,11 @@
- #include "lualib.h"
- +/* Added by DP */
- +void (*luaB_fputs)(const char * s) = (void (*)(const char *))printf;
- +void luaB_set_fputs(void (*f)(const char *)) {
- + luaB_fputs = f;
- +}
- /*
- @@ -39,11 +43,11 @@
- s = lua_tostring(L, -1); /* get result */
- if (s == NULL)
- return luaL_error(L, "`tostring' must return a string to `print'");
- - if (i>1) fputs("\t", stdout);
- - fputs(s, stdout);
- + if (i>1) luaB_fputs("\t");
- + luaB_fputs(s);
- lua_pop(L, 1); /* pop result */
- }
- - fputs("\n", stdout);
- + luaB_fputs("\n");
- return 0;
- }
- diff -urN lua-5.0/src/lib/liolib.c lua/src/lib/liolib.c
- --- lua-5.0/src/lib/liolib.c 2003-03-19 15:16:12.000000000 -0600
- +++ lua/src/lib/liolib.c 2013-05-30 16:32:09.524617720 -0500
- @@ -1,5 +1,4 @@
- /*
- -** $Id: liolib.c,v 2.39 2003/03/19 21:16:12 roberto Exp $
- ** Standard I/O (and system) library
- ** See Copyright Notice in lua.h
- */
- @@ -211,7 +210,8 @@
- static int io_tmpfile (lua_State *L) {
- FILE **pf = newfile(L);
- - *pf = tmpfile();
- + // *pf = tmpfile();
- + *pf = NULL;
- return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;
- }
- @@ -303,17 +303,18 @@
- static int read_number (lua_State *L, FILE *f) {
- lua_Number d;
- - if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
- + /*if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
- lua_pushnumber(L, d);
- return 1;
- }
- - else return 0; /* read fails */
- + else */ return 0; /* read fails */
- }
- static int test_eof (lua_State *L, FILE *f) {
- - int c = getc(f);
- - ungetc(c, f);
- + /* int c = getc(f);
- + ungetc(c, f); */
- + int c = 0;
- lua_pushlstring(L, NULL, 0);
- return (c != EOF);
- }
- @@ -537,21 +538,24 @@
- */
- static int io_execute (lua_State *L) {
- - lua_pushnumber(L, system(luaL_checkstring(L, 1)));
- + // lua_pushnumber(L, system(luaL_checkstring(L, 1)));
- + lua_pushnumber(L, 0);
- return 1;
- }
- static int io_remove (lua_State *L) {
- const char *filename = luaL_checkstring(L, 1);
- - return pushresult(L, remove(filename) == 0, filename);
- +// return pushresult(L, remove(filename) == 0, filename);
- + return pushresult(L, 0, filename);
- }
- static int io_rename (lua_State *L) {
- const char *fromname = luaL_checkstring(L, 1);
- const char *toname = luaL_checkstring(L, 2);
- - return pushresult(L, rename(fromname, toname) == 0, fromname);
- +// return pushresult(L, rename(fromname, toname) == 0, fromname);
- + return pushresult(L, 0, fromname);
- }
- @@ -628,6 +632,7 @@
- static int io_date (lua_State *L) {
- +#if 0
- const char *s = luaL_optstring(L, 1, "%c");
- time_t t = (time_t)(luaL_optnumber(L, 2, -1));
- struct tm *stm;
- @@ -660,6 +665,8 @@
- else
- return luaL_error(L, "`date' format too long");
- }
- +#endif
- + lua_pushnil(L);
- return 1;
- }
- @@ -707,7 +714,8 @@
- int op = luaL_findstring(luaL_optstring(L, 2, "all"), catnames);
- luaL_argcheck(L, l || lua_isnoneornil(L, 1), 1, "string expected");
- luaL_argcheck(L, op != -1, 2, "invalid option");
- - lua_pushstring(L, setlocale(cat[op], l));
- +// lua_pushstring(L, setlocale(cat[op], l));
- + lua_pushstring(L, "C");
- return 1;
- }
- diff -urN lua-5.0/src/lib/lmathlib.c lua/src/lib/lmathlib.c
- --- lua-5.0/src/lib/lmathlib.c 2003-03-11 06:30:37.000000000 -0600
- +++ lua/src/lib/lmathlib.c 2013-05-30 16:32:09.524617720 -0500
- @@ -1,5 +1,4 @@
- /*
- -** $Id: lmathlib.c,v 1.56 2003/03/11 12:30:37 roberto Exp $
- ** Standard mathematical library
- ** See Copyright Notice in lua.h
- */
- @@ -86,7 +85,7 @@
- }
- static int math_mod (lua_State *L) {
- - lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2)));
- + lua_pushnumber(L, fmodf(luaL_checknumber(L, 1), luaL_checknumber(L, 2)));
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement