Advertisement
losinggeneration

Dreamcast Lua 5.0 diff

May 30th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.06 KB | None | 0 0
  1. diff -urN lua-5.0/src/lib/lbaselib.c lua/src/lib/lbaselib.c
  2. --- lua-5.0/src/lib/lbaselib.c  2003-04-03 07:35:34.000000000 -0600
  3. +++ lua/src/lib/lbaselib.c  2013-05-30 16:32:09.524617720 -0500
  4. @@ -1,5 +1,4 @@
  5.  /*
  6. -** $Id: lbaselib.c,v 1.130 2003/04/03 13:35:34 roberto Exp $
  7.  ** Basic library
  8.  ** See Copyright Notice in lua.h
  9.  */
  10. @@ -19,6 +18,11 @@
  11.  #include "lualib.h"
  12.  
  13.  
  14. +/* Added by DP */
  15. +void (*luaB_fputs)(const char * s) = (void (*)(const char *))printf;
  16. +void luaB_set_fputs(void (*f)(const char *)) {
  17. +   luaB_fputs = f;
  18. +}
  19.  
  20.  
  21.  /*
  22. @@ -39,11 +43,11 @@
  23.      s = lua_tostring(L, -1);  /* get result */
  24.      if (s == NULL)
  25.        return luaL_error(L, "`tostring' must return a string to `print'");
  26. -    if (i>1) fputs("\t", stdout);
  27. -    fputs(s, stdout);
  28. +    if (i>1) luaB_fputs("\t");
  29. +    luaB_fputs(s);
  30.      lua_pop(L, 1);  /* pop result */
  31.    }
  32. -  fputs("\n", stdout);
  33. +  luaB_fputs("\n");
  34.    return 0;
  35.  }
  36.  
  37. diff -urN lua-5.0/src/lib/liolib.c lua/src/lib/liolib.c
  38. --- lua-5.0/src/lib/liolib.c    2003-03-19 15:16:12.000000000 -0600
  39. +++ lua/src/lib/liolib.c    2013-05-30 16:32:09.524617720 -0500
  40. @@ -1,5 +1,4 @@
  41.  /*
  42. -** $Id: liolib.c,v 2.39 2003/03/19 21:16:12 roberto Exp $
  43.  ** Standard I/O (and system) library
  44.  ** See Copyright Notice in lua.h
  45.  */
  46. @@ -211,7 +210,8 @@
  47.  
  48.  static int io_tmpfile (lua_State *L) {
  49.    FILE **pf = newfile(L);
  50. -  *pf = tmpfile();
  51. +  // *pf = tmpfile();
  52. +  *pf = NULL;
  53.    return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;
  54.  }
  55.  
  56. @@ -303,17 +303,18 @@
  57.  
  58.  static int read_number (lua_State *L, FILE *f) {
  59.    lua_Number d;
  60. -  if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
  61. +  /*if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
  62.      lua_pushnumber(L, d);
  63.      return 1;
  64.    }
  65. -  else return 0;  /* read fails */
  66. +  else */ return 0;  /* read fails */
  67.  }
  68.  
  69.  
  70.  static int test_eof (lua_State *L, FILE *f) {
  71. -  int c = getc(f);
  72. -  ungetc(c, f);
  73. +  /* int c = getc(f);
  74. +  ungetc(c, f); */
  75. +  int c = 0;
  76.    lua_pushlstring(L, NULL, 0);
  77.    return (c != EOF);
  78.  }
  79. @@ -537,21 +538,24 @@
  80.  */
  81.  
  82.  static int io_execute (lua_State *L) {
  83. -  lua_pushnumber(L, system(luaL_checkstring(L, 1)));
  84. +  // lua_pushnumber(L, system(luaL_checkstring(L, 1)));
  85. +  lua_pushnumber(L, 0);
  86.    return 1;
  87.  }
  88.  
  89.  
  90.  static int io_remove (lua_State *L) {
  91.    const char *filename = luaL_checkstring(L, 1);
  92. -  return pushresult(L, remove(filename) == 0, filename);
  93. +//  return pushresult(L, remove(filename) == 0, filename);
  94. +  return pushresult(L, 0, filename);
  95.  }
  96.  
  97.  
  98.  static int io_rename (lua_State *L) {
  99.    const char *fromname = luaL_checkstring(L, 1);
  100.    const char *toname = luaL_checkstring(L, 2);
  101. -  return pushresult(L, rename(fromname, toname) == 0, fromname);
  102. +//  return pushresult(L, rename(fromname, toname) == 0, fromname);
  103. +  return pushresult(L, 0, fromname);
  104.  }
  105.  
  106.  
  107. @@ -628,6 +632,7 @@
  108.  
  109.  
  110.  static int io_date (lua_State *L) {
  111. +#if 0
  112.    const char *s = luaL_optstring(L, 1, "%c");
  113.    time_t t = (time_t)(luaL_optnumber(L, 2, -1));
  114.    struct tm *stm;
  115. @@ -660,6 +665,8 @@
  116.      else
  117.        return luaL_error(L, "`date' format too long");
  118.    }
  119. +#endif
  120. +  lua_pushnil(L);
  121.    return 1;
  122.  }
  123.  
  124. @@ -707,7 +714,8 @@
  125.    int op = luaL_findstring(luaL_optstring(L, 2, "all"), catnames);
  126.    luaL_argcheck(L, l || lua_isnoneornil(L, 1), 1, "string expected");
  127.    luaL_argcheck(L, op != -1, 2, "invalid option");
  128. -  lua_pushstring(L, setlocale(cat[op], l));
  129. +//  lua_pushstring(L, setlocale(cat[op], l));
  130. +  lua_pushstring(L, "C");
  131.    return 1;
  132.  }
  133.  
  134. diff -urN lua-5.0/src/lib/lmathlib.c lua/src/lib/lmathlib.c
  135. --- lua-5.0/src/lib/lmathlib.c  2003-03-11 06:30:37.000000000 -0600
  136. +++ lua/src/lib/lmathlib.c  2013-05-30 16:32:09.524617720 -0500
  137. @@ -1,5 +1,4 @@
  138.  /*
  139. -** $Id: lmathlib.c,v 1.56 2003/03/11 12:30:37 roberto Exp $
  140.  ** Standard mathematical library
  141.  ** See Copyright Notice in lua.h
  142.  */
  143. @@ -86,7 +85,7 @@
  144.  }
  145.  
  146.  static int math_mod (lua_State *L) {
  147. -  lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2)));
  148. +  lua_pushnumber(L, fmodf(luaL_checknumber(L, 1), luaL_checknumber(L, 2)));
  149.    return 1;
  150.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement