Declare class variables the right way.
[ruby-ecore.git] / src / ecore / rb_ecore.c
1 /*
2  * $Id: rb_ecore.c 45 2004-07-26 11:00:14Z tilman $
3  *
4  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <ruby.h>
22
23 #include <Ecore.h>
24
25 #define __RB_ECORE_C
26 #include "rb_ecore.h"
27 #include "rb_timer.h"
28 #include "rb_idler.h"
29
30 VALUE mEcore;
31
32 #ifdef DEBUG
33 static VALUE m_init (VALUE self)
34 {
35         return INT2FIX (ecore_init ());
36 }
37
38 static VALUE m_shutdown (VALUE self)
39 {
40         return INT2FIX (ecore_shutdown ());
41 }
42 #endif
43
44 static VALUE m_main_loop_begin (VALUE self)
45 {
46         ecore_main_loop_begin ();
47
48         return Qnil;
49 }
50
51 static VALUE m_main_loop_iterate (VALUE self)
52 {
53         ecore_main_loop_iterate ();
54
55         return Qnil;
56 }
57
58 static VALUE m_main_loop_quit (VALUE self)
59 {
60         ecore_main_loop_quit ();
61
62         return Qnil;
63 }
64
65 void Init_ecore (void)
66 {
67         mEcore = rb_define_module ("Ecore");
68
69 #ifdef DEBUG
70         rb_define_module_function (mEcore, "init",
71                                    m_init, 0);
72         rb_define_module_function (mEcore, "shutdown",
73                                    m_shutdown, 0);
74 #endif
75
76         rb_define_module_function (mEcore, "main_loop_begin",
77                                    m_main_loop_begin, 0);
78         rb_define_module_function (mEcore, "main_loop_iterate",
79                                    m_main_loop_iterate, 0);
80         rb_define_module_function (mEcore, "main_loop_quit",
81                                    m_main_loop_quit, 0);
82
83         Init_Timer ();
84         Init_Idler ();
85 }
86