Remove lua_compat
Luajit 2.1 now includes everything we need.
This commit is contained in:
parent
17814972ab
commit
b5e40495fd
8 changed files with 10 additions and 61 deletions
|
@ -1,21 +0,0 @@
|
|||
/* Copyright (c), Niclas Meyer <niclas@countingsort.com>
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef KIWMI_LUAK_LUA_COMPAT_H
|
||||
#define KIWMI_LUAK_LUA_COMPAT_H
|
||||
|
||||
#include <lauxlib.h>
|
||||
#include <lua.h>
|
||||
|
||||
#define luaC_newlibtable(L, l) \
|
||||
lua_createtable(L, 0, sizeof(l) / sizeof((l)[0]) - 1)
|
||||
|
||||
#define luaC_newlib(L, l) (luaC_newlibtable(L, l), luaC_setfuncs(L, l, 0))
|
||||
|
||||
void luaC_setfuncs(lua_State *L, const luaL_Reg *l, int nup);
|
||||
|
||||
#endif /* KIWMI_LUAK_LUA_COMPAT_H */
|
|
@ -19,7 +19,6 @@
|
|||
#include "luak/kiwmi_lua_callback.h"
|
||||
#include "luak/kiwmi_output.h"
|
||||
#include "luak/kiwmi_view.h"
|
||||
#include "luak/lua_compat.h"
|
||||
#include "luak/luak.h"
|
||||
|
||||
static int
|
||||
|
@ -319,9 +318,9 @@ luaK_kiwmi_cursor_register(lua_State *L)
|
|||
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, -2, "__index");
|
||||
luaC_setfuncs(L, kiwmi_cursor_methods, 0);
|
||||
luaL_setfuncs(L, kiwmi_cursor_methods, 0);
|
||||
|
||||
luaC_newlib(L, kiwmi_cursor_events);
|
||||
luaL_newlib(L, kiwmi_cursor_events);
|
||||
lua_setfield(L, -2, "__events");
|
||||
|
||||
lua_pushcfunction(L, luaK_usertype_ref_equal);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "input/keyboard.h"
|
||||
#include "luak/kiwmi_lua_callback.h"
|
||||
#include "luak/lua_compat.h"
|
||||
|
||||
static int
|
||||
l_kiwmi_keyboard_keymap(lua_State *L)
|
||||
|
@ -354,9 +353,9 @@ luaK_kiwmi_keyboard_register(lua_State *L)
|
|||
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, -2, "__index");
|
||||
luaC_setfuncs(L, kiwmi_keyboard_methods, 0);
|
||||
luaL_setfuncs(L, kiwmi_keyboard_methods, 0);
|
||||
|
||||
luaC_newlib(L, kiwmi_keyboard_events);
|
||||
luaL_newlib(L, kiwmi_keyboard_events);
|
||||
lua_setfield(L, -2, "__events");
|
||||
|
||||
lua_pushcfunction(L, luaK_usertype_ref_equal);
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "desktop/output.h"
|
||||
#include "luak/kiwmi_lua_callback.h"
|
||||
#include "luak/lua_compat.h"
|
||||
#include "server.h"
|
||||
|
||||
static int
|
||||
|
@ -391,9 +390,9 @@ luaK_kiwmi_output_register(lua_State *L)
|
|||
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, -2, "__index");
|
||||
luaC_setfuncs(L, kiwmi_output_methods, 0);
|
||||
luaL_setfuncs(L, kiwmi_output_methods, 0);
|
||||
|
||||
luaC_newlib(L, kiwmi_output_events);
|
||||
luaL_newlib(L, kiwmi_output_events);
|
||||
lua_setfield(L, -2, "__events");
|
||||
|
||||
lua_pushcfunction(L, luaK_usertype_ref_equal);
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "luak/kiwmi_lua_callback.h"
|
||||
#include "luak/kiwmi_output.h"
|
||||
#include "luak/kiwmi_view.h"
|
||||
#include "luak/lua_compat.h"
|
||||
#include "server.h"
|
||||
|
||||
static int
|
||||
|
@ -590,9 +589,9 @@ luaK_kiwmi_server_register(lua_State *L)
|
|||
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, -2, "__index");
|
||||
luaC_setfuncs(L, kiwmi_server_methods, 0);
|
||||
luaL_setfuncs(L, kiwmi_server_methods, 0);
|
||||
|
||||
luaC_newlib(L, kiwmi_server_events);
|
||||
luaL_newlib(L, kiwmi_server_events);
|
||||
lua_setfield(L, -2, "__events");
|
||||
|
||||
lua_pushcfunction(L, luaK_usertype_ref_equal);
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "input/seat.h"
|
||||
#include "luak/kiwmi_lua_callback.h"
|
||||
#include "luak/kiwmi_output.h"
|
||||
#include "luak/lua_compat.h"
|
||||
#include "server.h"
|
||||
|
||||
static int
|
||||
|
@ -702,9 +701,9 @@ luaK_kiwmi_view_register(lua_State *L)
|
|||
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, -2, "__index");
|
||||
luaC_setfuncs(L, kiwmi_view_methods, 0);
|
||||
luaL_setfuncs(L, kiwmi_view_methods, 0);
|
||||
|
||||
luaC_newlib(L, kiwmi_view_events);
|
||||
luaL_newlib(L, kiwmi_view_events);
|
||||
lua_setfield(L, -2, "__events");
|
||||
|
||||
lua_pushcfunction(L, luaK_usertype_ref_equal);
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/* Copyright (c), Niclas Meyer <niclas@countingsort.com>
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "luak/lua_compat.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
luaC_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
|
||||
{
|
||||
luaL_checkstack(L, nup, "too many upvalues");
|
||||
for (; l->name; ++l) {
|
||||
for (int i = 0; i < nup; ++i) {
|
||||
lua_pushvalue(L, -nup);
|
||||
}
|
||||
lua_pushcclosure(L, l->func, nup);
|
||||
lua_setfield(L, -(nup + 2), l->name);
|
||||
}
|
||||
lua_pop(L, nup);
|
||||
}
|
|
@ -22,7 +22,6 @@ kiwmi_sources = files(
|
|||
'luak/kiwmi_output.c',
|
||||
'luak/kiwmi_server.c',
|
||||
'luak/kiwmi_view.c',
|
||||
'luak/lua_compat.c',
|
||||
'luak/luak.c',
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue