forked from rlane/ncursesw-ruby
-
Notifications
You must be signed in to change notification settings - Fork 13
/
form_wrap.h
71 lines (58 loc) · 2.12 KB
/
form_wrap.h
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
/*
* This is a curses forms wrapper as part of ncurses-ruby
* Contributed by Simon Kaczor <[email protected]>
* Prognosoft Inc. <http://www.prognosoft.biz>
* Copyright 2004
*
* This module is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this module; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Changes
* (C) 2011 Tobias Herzke
* (C) 2013 Gaute Hope <[email protected]>
*/
#if !defined(FORM_HH) && (defined(HAVE_FORM_H) || defined(HAVE_NCURSESW_FORM_H))
#define FORM_HH
# define _XOPEN_SOURCE_EXTENDED
#ifdef HAVE_FORM_H
#include <form.h>
#else
#include <ncursesw/form.h>
#endif
#include <ruby.h>
extern VALUE mForm;
extern VALUE cFIELD;
extern VALUE cFIELDTYPE;
extern VALUE cFORM;
/*extern VALUE cPAGE;*/
typedef struct {
bool (* field_check)(FIELD *,const void *);
FIELDTYPE* fieldtype;
} FLDCHKFUNC;
#define FORM_DEF_CONST(name) \
rb_define_const(mForm, #name, INT2NUM(name));
#define FORM_SNG_FUNC(name, nargs) \
rb_define_singleton_method(mForm, \
#name, \
&rbncurs_m_ ## name, \
nargs)
#define RB_CLASS_METH(class, alt_name, name, nargs) \
rb_define_method(class, #name, (&rbncurs_c_ ## name), nargs); \
if (alt_name != NULL) \
rb_define_method(class, alt_name, (&rbncurs_c_ ## name), nargs); \
void init_req_constants();
void init_just_constants();
void init_opts_constants();
void init_form(void);
#endif