@ -1,38 +0,0 @@ |
|||
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|||
# |
|||
# Filename: package/.../lua-posix/clk_tck.patch |
|||
# Copyright (C) 2006 The T2 SDE Project |
|||
# |
|||
# More information can be found in the files COPYING and README. |
|||
# |
|||
# This patch file is dual-licensed. It is available under the license the |
|||
# patched project is licensed under, as long as it is an OpenSource license |
|||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|||
# of the GNU General Public License as published by the Free Software |
|||
# Foundation; either version 2 of the License, or (at your option) any later |
|||
# version. |
|||
# --- SDE-COPYRIGHT-NOTE-END --- |
|||
|
|||
|
|||
diff -ur posix/lposix.c posix-t2/lposix.c
|
|||
--- posix/lposix.c 2003-11-06 01:23:48.000000000 +0100
|
|||
+++ posix-t2/lposix.c 2006-02-01 22:15:50.000000000 +0100
|
|||
@@ -599,7 +599,7 @@
|
|||
clock_t elapsed; |
|||
}; |
|||
|
|||
-#define pushtime(L,x) lua_pushnumber(L,((lua_Number)x)/CLK_TCK)
|
|||
+#define pushtime(L,x) lua_pushnumber(L,((lua_Number)x)/CLOCKS_PER_SEC)
|
|||
|
|||
static int Ftimes(lua_State *L, int i, const void *data) |
|||
{ |
|||
@@ -620,7 +620,7 @@
|
|||
"utime", "stime", "cutime", "cstime", "elapsed", NULL |
|||
}; |
|||
|
|||
-#define storetime(L,name,x) storenumber(L,name,(lua_Number)x/CLK_TCK)
|
|||
+#define storetime(L,name,x) storenumber(L,name,(lua_Number)x/CLOCKS_PER_SEC)
|
|||
|
|||
static int Ptimes(lua_State *L) /** times() */ |
|||
{ |
@ -1,77 +0,0 @@ |
|||
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|||
# |
|||
# Filename: package/.../lua-posix/makefile.patch |
|||
# Copyright (C) 2006 The OpenSDE Project |
|||
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|||
# |
|||
# More information can be found in the files COPYING and README. |
|||
# |
|||
# This patch file is dual-licensed. It is available under the license the |
|||
# patched project is licensed under, as long as it is an OpenSource license |
|||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|||
# of the GNU General Public License as published by the Free Software |
|||
# Foundation; either version 2 of the License, or (at your option) any later |
|||
# version. |
|||
# --- SDE-COPYRIGHT-NOTE-END --- |
|||
--- posix/Makefile 2003-11-06 01:26:49.000000000 +0100
|
|||
+++ posix-5.1-alpha/Makefile 2005-09-04 14:17:03.000000000 +0200
|
|||
@@ -1,10 +1,20 @@
|
|||
# makefile for POSIX library for Lua |
|||
|
|||
# change these to reflect your Lua installation |
|||
-LUA= /tmp/lhf/lua-5.0
|
|||
-LUAINC= $(LUA)/include
|
|||
-LUALIB= $(LUA)/lib
|
|||
-LUABIN= $(LUA)/bin
|
|||
+LUA= lua
|
|||
+
|
|||
+LUAINC= $(LUA_ROOT)/include
|
|||
+LUALIB= $(LUA_ROOT)/lib
|
|||
+LUABIN= $(LUA_ROOT)/bin
|
|||
+
|
|||
+# installation path
|
|||
+LUA_ROOT= $(shell pkg-config --variable prefix lua)
|
|||
+LUA_CDIR= $(shell pkg-config --variable INSTALL_CMOD lua)
|
|||
+LUA_LDIR= $(shell pkg-config --variable INSTALL_LMOD lua)
|
|||
+
|
|||
+INSTALL = install
|
|||
+INSTALL_DATA = $(INSTALL) -m 644
|
|||
+INSTALL_EXEC = $(INSTALL) -m 755
|
|||
|
|||
# no need to change anything below here |
|||
CFLAGS= -fPIC $(INCS) $(WARN) -O2 $G |
|||
@@ -16,23 +26,25 @@
|
|||
|
|||
OBJS= $(MYLIB).o |
|||
|
|||
-T= $(MYLIB).so
|
|||
+all: $(MYLIB).so
|
|||
|
|||
-all: test
|
|||
+test: $(MYLIB).so
|
|||
+ $(LUA) -l$(MYNAME) test.lua
|
|||
|
|||
-test: $T
|
|||
- $(LUABIN)/lua -l$(MYNAME) test.lua
|
|||
+$(MYLIB).so: $(OBJS)
|
|||
+ $(CC) $(LDFLAGS) -o $@ -shared $(OBJS)
|
|||
|
|||
-$T: $(OBJS)
|
|||
- $(CC) -o $@ -shared $(OBJS)
|
|||
+install:
|
|||
+ $(INSTALL_EXEC) $(MYLIB).so $(LUA_CDIR)/
|
|||
+ $(INSTALL_DATA) $(MYNAME).lua $(LUA_LDIR)/
|
|||
|
|||
$(OBJS): modemuncher.c |
|||
|
|||
-tree: $T
|
|||
+tree: $(MYLIB).so
|
|||
$(LUABIN)/lua -l$(MYNAME) tree.lua . |
|||
|
|||
clean: |
|||
- rm -f $(OBJS) $T core core.* a.out
|
|||
+ rm -f $(OBJS) $(MYLIB).so core core.* a.out
|
|||
|
|||
x: |
|||
@echo "$(MYNAME) library:" |
@ -1,59 +0,0 @@ |
|||
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|||
# |
|||
# Filename: package/.../lua-posix/t2-ext-glob.patch |
|||
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|||
# |
|||
# More information can be found in the files COPYING and README. |
|||
# |
|||
# This patch file is dual-licensed. It is available under the license the |
|||
# patched project is licensed under, as long as it is an OpenSource license |
|||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|||
# of the GNU General Public License as published by the Free Software |
|||
# Foundation; either version 2 of the License, or (at your option) any later |
|||
# version. |
|||
# --- SDE-COPYRIGHT-NOTE-END --- |
|||
--- posix/lposix.c 2005-09-08 21:50:42.445019600 +0200
|
|||
+++ posix-t2/lposix.c 2005-09-08 21:49:14.994723494 +0200
|
|||
@@ -22,6 +22,7 @@
|
|||
#include <time.h> |
|||
#include <unistd.h> |
|||
#include <utime.h> |
|||
+#include <glob.h>
|
|||
|
|||
#define MYNAME "posix" |
|||
#define MYVERSION MYNAME " library for " LUA_VERSION " / Nov 2003" |
|||
@@ -177,6 +178,25 @@
|
|||
} |
|||
|
|||
|
|||
+static int Pglob(lua_State *L) /** glob(pattern) */
|
|||
+{
|
|||
+ const char *pattern = luaL_optstring(L, 1, ".");
|
|||
+ glob_t globres;
|
|||
+
|
|||
+ if (glob(pattern, GLOB_MARK, NULL, &globres))
|
|||
+ return pusherror(L, pattern);
|
|||
+ else
|
|||
+ {
|
|||
+ int i;
|
|||
+ lua_newtable(L);
|
|||
+ for (i=1; i<=globres.gl_pathc; i++)
|
|||
+ storeindex(L, i, globres.gl_pathv[i-1]);
|
|||
+ globfree(&globres);
|
|||
+ return 1;
|
|||
+ }
|
|||
+}
|
|||
+
|
|||
+
|
|||
static int aux_files(lua_State *L) |
|||
{ |
|||
DIR *d = lua_touserdata(L, lua_upvalueindex(1)); |
|||
@@ -773,6 +793,7 @@
|
|||
{"getlogin", Pgetlogin}, |
|||
{"getpasswd", Pgetpasswd}, |
|||
{"getprocessid", Pgetprocessid}, |
|||
+ {"glob", Pglob},
|
|||
{"kill", Pkill}, |
|||
{"link", Plink}, |
|||
{"mkdir", Pmkdir}, |
@ -1,74 +0,0 @@ |
|||
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|||
# |
|||
# Filename: package/.../lua-posix/update-lua51.patch |
|||
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|||
# |
|||
# More information can be found in the files COPYING and README. |
|||
# |
|||
# This patch file is dual-licensed. It is available under the license the |
|||
# patched project is licensed under, as long as it is an OpenSource license |
|||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|||
# of the GNU General Public License as published by the Free Software |
|||
# Foundation; either version 2 of the License, or (at your option) any later |
|||
# version. |
|||
# --- SDE-COPYRIGHT-NOTE-END --- |
|||
--- posix/lposix.c 2003-11-06 01:23:48.000000000 +0100
|
|||
+++ posix-5.1-alpha/lposix.c 2005-09-04 13:59:15.000000000 +0200
|
|||
@@ -64,7 +64,7 @@
|
|||
} |
|||
else |
|||
{ |
|||
- int j=luaL_findstring(luaL_checkstring(L, i), S);
|
|||
+ int j=luaL_checkoption(L, i, NULL, S);
|
|||
if (j==-1) luaL_argerror(L, i, "unknown selector"); |
|||
return F(L, j, data); |
|||
} |
|||
@@ -802,7 +802,7 @@
|
|||
{NULL, NULL} |
|||
}; |
|||
|
|||
-LUALIB_API int luaopen_posix (lua_State *L)
|
|||
+LUALIB_API int luaopen_lposix (lua_State *L)
|
|||
{ |
|||
luaL_openlib(L, MYNAME, R, 0); |
|||
lua_pushliteral(L,"version"); /** version */ |
|||
--- posix/posix.lua 2003-06-18 14:47:44.000000000 +0200
|
|||
+++ posix-5.1-alpha/posix.lua 2005-09-04 14:15:14.000000000 +0200
|
|||
@@ -1,10 +1,4 @@
|
|||
-- posix.lua |
|||
-- support code for posix library |
|||
--- usage lua -lposix ...
|
|||
|
|||
-local function so(x)
|
|||
- local SOPATH= os.getenv"LUA_SOPATH" or "./"
|
|||
- assert(loadlib(SOPATH.."l"..x..".so","luaopen_"..x))()
|
|||
-end
|
|||
-
|
|||
-so"posix"
|
|||
+require"lposix"
|
|||
--- posix/test.lua 2003-11-07 12:42:30.000000000 +0100
|
|||
+++ posix-5.1-alpha/test.lua 2005-09-04 13:51:39.000000000 +0200
|
|||
@@ -41,7 +41,7 @@
|
|||
f"HOME" |
|||
f"SHELL" |
|||
f"absent" |
|||
-for k in ox.getenv() do io.write(k,"\t") end io.write"\n"
|
|||
+for k,_ in pairs(ox.getenv()) do io.write(k,"\t") end io.write"\n"
|
|||
|
|||
------------------------------------------------------------------------------ |
|||
testing"putenv" |
|||
@@ -179,11 +179,11 @@
|
|||
------------------------------------------------------------------------------ |
|||
testing"times" |
|||
a=ox.times() |
|||
-for k,v in a do print(k,v) end
|
|||
+for k,v in pairs(a) do print(k,v) end
|
|||
print"sleeping 10 seconds..." |
|||
ox.sleep(10) |
|||
b=ox.times() |
|||
-for k,v in b do print(k,v) end
|
|||
+for k,v in pairs(b) do print(k,v) end
|
|||
print"" |
|||
print("elapsed",b.elapsed-a.elapsed) |
|||
print("clock",os.clock()) |