stylish updates.
[apps/madmutt.git] / lib-lua / lib-lua_priv.h
1 /*
2  *  This program is free software; you can redistribute it and/or modify
3  *  it under the terms of the GNU General Public License as published by
4  *  the Free Software Foundation; either version 2 of the License, or (at
5  *  your option) any later version.
6  *
7  *  This program is distributed in the hope that it will be useful, but
8  *  WITHOUT ANY WARRANTY; without even the implied warranty of
9  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  *  General Public License for more details.
11  *
12  *  You should have received a copy of the GNU General Public License
13  *  along with this program; if not, write to the Free Software
14  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15  *  MA 02110-1301, USA.
16  *
17  *  Copyright © 2007 Pierre Habouzit
18  */
19
20 #ifndef MUTT_LIB_LUA_LIB_LUA_PRIV_H
21 #define MUTT_LIB_LUA_LIB_LUA_PRIV_H
22
23 #include "lib-lua.h"
24
25 #include <lua.h>
26 #include <lualib.h>
27 #include <lauxlib.h>
28
29 typedef enum reg_type {
30     REG_NIL,
31     REG_INT,
32     REG_STR,
33 } reg_type;
34
35 typedef struct reg_entry {
36     int type;
37     union {
38         int i;
39         void *p;
40         char *s;
41     };
42 } reg_entry;
43
44 static inline void reg_entry_wipe(reg_entry *e) {
45     switch (e->type) {
46       case REG_STR:
47         p_delete(&e->s);
48         break;
49       default:
50         break;
51     }
52     e->type = REG_NIL;
53 }
54
55 #define LUA_MADMUTT  "madmutt"
56 int luaopen_madmutt(lua_State *L);
57
58 #endif