move OPT_QUIT into the lua registry
[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_BOOL,
33     REG_QUAD,
34     REG_STR,
35 } reg_type;
36
37 typedef struct reg_entry {
38     int type;
39     union {
40         int i;
41         void *p;
42         char *s;
43     };
44 } reg_entry;
45
46 static inline void reg_entry_wipe(reg_entry *e) {
47     switch (e->type) {
48       case REG_STR:
49         p_delete(&e->s);
50         break;
51       default:
52         break;
53     }
54     e->type = REG_NIL;
55 }
56
57 #define LUA_MADMUTT  "madmutt"
58 int luaopen_madmutt(lua_State *L);
59
60 #endif