mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
69888b5c4c
- download of v5.3.4 of Lua from git - building using RIOT build system - patched to remove the need for _times and _link to be provided to Lua via newlib.
63 lines
1.7 KiB
Diff
63 lines
1.7 KiB
Diff
From b681cb20ee6bfc31b8ba23ec321140aae6e53e9d Mon Sep 17 00:00:00 2001
|
|
From: danpetry <daniel.petry@fu-berlin.de>
|
|
Date: Wed, 23 May 2018 14:09:17 +0200
|
|
Subject: [PATCH 1/1] Remove dependency on nonexistent RIOT syscalls
|
|
|
|
Os.rename and os.clock, in Lua, now always return an error message.
|
|
Also, l_randomizePivot, which is used by table.sort, will always
|
|
supply 0 rather than a pseudorandom number.
|
|
---
|
|
loslib.c | 7 ++-----
|
|
ltablib.c | 4 +++-
|
|
2 files changed, 5 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/loslib.c b/loslib.c
|
|
index dd2bb378..f9e5cbd2 100644
|
|
--- a/loslib.c
|
|
+++ b/loslib.c
|
|
@@ -157,9 +157,7 @@ static int os_remove (lua_State *L) {
|
|
|
|
|
|
static int os_rename (lua_State *L) {
|
|
- const char *fromname = luaL_checkstring(L, 1);
|
|
- const char *toname = luaL_checkstring(L, 2);
|
|
- return luaL_fileresult(L, rename(fromname, toname) == 0, NULL);
|
|
+ return luaL_error(L, "This function is not implemented in RIOT yet");
|
|
}
|
|
|
|
|
|
@@ -181,8 +179,7 @@ static int os_getenv (lua_State *L) {
|
|
|
|
|
|
static int os_clock (lua_State *L) {
|
|
- lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC);
|
|
- return 1;
|
|
+ return luaL_error(L, "This function is not implemented in RIOT yet");
|
|
}
|
|
|
|
|
|
diff --git a/ltablib.c b/ltablib.c
|
|
index 588bf40d..8895b653 100644
|
|
--- a/ltablib.c
|
|
+++ b/ltablib.c
|
|
@@ -235,13 +235,15 @@ static int unpack (lua_State *L) {
|
|
/* type for array indices */
|
|
typedef unsigned int IdxT;
|
|
|
|
-
|
|
/*
|
|
** Produce a "random" 'unsigned int' to randomize pivot choice. This
|
|
** macro is used only when 'sort' detects a big imbalance in the result
|
|
** of a partition. (If you don't want/need this "randomness", ~0 is a
|
|
** good choice.)
|
|
*/
|
|
+
|
|
+#define l_randomizePivot() 0
|
|
+
|
|
#if !defined(l_randomizePivot) /* { */
|
|
|
|
#include <time.h>
|
|
--
|
|
2.17.0
|
|
|