eufon

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

luak.h (1320B)


      1 /* Copyright (c), Niclas Meyer <niclas@countingsort.com>
      2  *
      3  * This Source Code Form is subject to the terms of the Mozilla Public
      4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5  * You can obtain one at https://mozilla.org/MPL/2.0/.
      6  */
      7 
      8 #ifndef KIWMI_LUAK_LUAK_H
      9 #define KIWMI_LUAK_LUAK_H
     10 
     11 #include <stdbool.h>
     12 
     13 #include <lua.h>
     14 #include <wayland-server.h>
     15 
     16 #include "server.h"
     17 
     18 struct kiwmi_lua {
     19     lua_State *L;
     20     int objects;
     21     struct wl_list scheduled_callbacks;
     22     struct wl_global *global;
     23 };
     24 
     25 struct kiwmi_object {
     26     struct kiwmi_lua *lua;
     27 
     28     void *object;
     29     size_t refcount;
     30     bool valid;
     31 
     32     struct wl_listener destroy;
     33     struct wl_list callbacks; // struct kiwmi_lua_callback::link
     34 
     35     struct {
     36         struct wl_signal destroy;
     37     } events;
     38 };
     39 
     40 void *luaK_toudata(lua_State *L, int ud, const char *tname);
     41 int luaK_kiwmi_object_gc(lua_State *L);
     42 struct kiwmi_object *luaK_get_kiwmi_object(
     43     struct kiwmi_lua *lua,
     44     void *ptr,
     45     struct wl_signal *destroy);
     46 int luaK_callback_register_dispatch(lua_State *L);
     47 int luaK_usertype_ref_equal(lua_State *L);
     48 struct kiwmi_lua *luaK_create(struct kiwmi_server *server);
     49 bool luaK_dofile(struct kiwmi_lua *lua, const char *config_path);
     50 void luaK_destroy(struct kiwmi_lua *lua);
     51 
     52 #endif /* KIWMI_LUAK_LUAK_H */