summaryrefslogtreecommitdiff
path: root/iup/srclua3/il_mask.c
blob: 7f44090ed28655b0eb91c36e45f7ffeb7f2f3429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/** \file
 * \brief Bindig of iupmask to Lua 3.
 *
 * See Copyright Notice in "iup.h"
 */
 
#include <stdlib.h>

#include "iup.h"
#include "iupmask.h"

#include <lua.h>
#include <lauxlib.h>

#include "iuplua.h"
#include "il.h"
#include "il_controls.h"


static void cfMaskSet (void)
{
  iupmaskSet(iuplua_checkihandle(1), 
             luaL_check_string(2), 
             luaL_check_int(3), 
             luaL_check_int(4));
}

static void cfMaskRemove (void)
{
  iupmaskRemove(iuplua_checkihandle(1));
}

static void cfMaskMatSet(void)
{
  iupmaskMatSet(iuplua_checkihandle(1),
                luaL_check_string(2),
                luaL_check_int(3),
                luaL_check_int(4),
                luaL_check_int(5),
                luaL_check_int(6));

}

static void cfMaskMatRemove(void)
{
  iupmaskMatRemove(iuplua_checkihandle(1),
                   luaL_check_int(2),
                   luaL_check_int(3));

}

static void cfMaskSetInt(void)
{
  iupmaskSetInt(iuplua_checkihandle(1),
                luaL_check_int(2),
                luaL_check_int(3),
                luaL_check_int(4));

}

static void cfMaskSetFloat(void) 
{
  iupmaskSetFloat(iuplua_checkihandle(1),
                  luaL_check_int(2),
                  (float)luaL_check_number(3),
                  (float)luaL_check_number(4));

      
}

static void cfMaskMatSetInt (void)
{
  iupmaskMatSetInt(iuplua_checkihandle(1),
                   luaL_check_int(2),
                   luaL_check_int(3),
                   luaL_check_int(4),
                   luaL_check_int(5),
                   luaL_check_int(6));

}

static void cfMaskMatSetFloat (void)
{
  iupmaskMatSetFloat(iuplua_checkihandle(1),
                     luaL_check_int(2),
                     (float)luaL_check_number(3),
                     (float)luaL_check_number(4),
                     luaL_check_int(5),
                     luaL_check_int(6));
}

static void cfMaskCheck (void)
{
  iupmaskCheck(iuplua_checkihandle(1));
}

static void cfMaskMatCheck (void)
{
  iupmaskMatCheck(iuplua_checkihandle(1),
                  luaL_check_int(2),
                  luaL_check_int(3));
}

static int match_cb (Ihandle *handle)
{
  iuplua_call_start(handle, "match_cb");
  return iuplua_call();
}


int masklua_open(void)
{
  iuplua_regstring_mask(IUP_MASK_FLOAT, "IUPMASK_FLOAT");
  iuplua_regstring_mask(IUP_MASK_UFLOAT, "IUPMASK_UFLOAT");
  iuplua_regstring_mask(IUP_MASK_EFLOAT, "IUPMASK_EFLOAT");
  iuplua_regstring_mask(IUP_MASK_INT, "IUPMASK_INT");
  iuplua_regstring_mask(IUP_MASK_UINT, "IUPMASK_UINT");
  iuplua_regstring(IUP_MASK_FLOAT, "IUP_MASK_FLOAT");
  iuplua_regstring(IUP_MASK_UFLOAT, "IUP_MASK_UFLOAT");
  iuplua_regstring(IUP_MASK_EFLOAT, "IUP_MASK_EFLOAT");
  iuplua_regstring(IUP_MASK_INT, "IUP_MASK_INT");
  iuplua_regstring(IUP_MASK_UINT, "IUP_MASK_UINT");

  iuplua_register("iupmaskRemove", cfMaskRemove);
  iuplua_register("iupmaskMatRemove", cfMaskMatRemove);
  iuplua_register("iupmaskSet", cfMaskSet);
  iuplua_register("iupmaskMatSet", cfMaskMatSet);
  iuplua_register("iupmaskSetInt", cfMaskSetInt);
  iuplua_register("iupmaskSetFloat", cfMaskSetFloat);
  iuplua_register("iupmaskMatSetInt", cfMaskMatSetInt);
  iuplua_register("iupmaskMatSetFloat", cfMaskMatSetFloat);
  iuplua_register("iupmaskCheck", cfMaskCheck);
  iuplua_register("iupmaskMatCheck", cfMaskMatCheck);

  lua_register("iup_match_cb", (lua_CFunction)match_cb);

  return lua_dostring("iup_callbacks.match_cb = {\"MATCH_CB\", iup_match_cb}");
}