Instead, they are called automatically in the objects' (de)constructors.
/*
- * $Id: rb_ecore.c 9 2004-06-19 19:53:47Z tilman $
+ * $Id: rb_ecore.c 27 2004-07-08 18:25:05Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
#include "rb_timer.h"
#include "rb_idler.h"
+#ifdef DEBUG
static VALUE m_init (VALUE self)
{
return INT2FIX (ecore_init ());
}
+static VALUE m_shutdown (VALUE self)
+{
+ return INT2FIX (ecore_shutdown ());
+}
+#endif
+
static VALUE m_main_loop_begin (VALUE self)
{
ecore_main_loop_begin ();
return Qnil;
}
-static VALUE m_shutdown (VALUE self)
-{
- rb_gc_start ();
-
- return INT2FIX (ecore_shutdown ());
-}
-
void Init_ecore (void)
{
mEcore = rb_define_module ("Ecore");
+#ifdef DEBUG
rb_define_module_function (mEcore, "init",
m_init, 0);
+ rb_define_module_function (mEcore, "shutdown",
+ m_shutdown, 0);
+#endif
+
rb_define_module_function (mEcore, "main_loop_begin",
m_main_loop_begin, 0);
rb_define_module_function (mEcore, "main_loop_iterate",
m_main_loop_iterate, 0);
rb_define_module_function (mEcore, "main_loop_quit",
m_main_loop_quit, 0);
- rb_define_module_function (mEcore, "shutdown",
- m_shutdown, 0);
Init_Timer ();
Init_Idler ();
/*
- * $Id: rb_idler.c 25 2004-06-26 23:07:01Z tilman $
+ * $Id: rb_idler.c 27 2004-07-08 18:25:05Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
return (r != Qfalse);
}
-static VALUE c_init (VALUE self)
-{
- RbEcoreIdler *idler = NULL;
-
- Data_Get_Struct (self, RbEcoreIdler, idler);
-
- idler->cb = (void *) rb_block_proc ();
- idler->idler = ecore_idler_add (on_idler, idler);
-
- return self;
-}
-
static void c_free (RbEcoreIdler *idler)
{
if (idler->idler && !idler->deleted)
ecore_idler_del (idler->idler);
+ ecore_shutdown ();
+
free (idler);
}
VALUE self;
RbEcoreIdler *idler;
+ if (!rb_block_given_p ())
+ return Qnil;
+
self = Data_Make_Struct (klass, RbEcoreIdler, NULL, c_free, idler);
+ ecore_init ();
+
+ idler->cb = (void *) rb_block_proc ();
+ idler->idler = ecore_idler_add (on_idler, idler);
+
rb_obj_call_init (self, 0, NULL);
return self;
cIdler = rb_define_class_under (mEcore, "Idler", rb_cObject);
rb_define_singleton_method (cIdler, "new", c_new, 1);
- rb_define_method (cIdler, "initialize", c_init, 1);
rb_define_method (cIdler, "delete", c_delete, 0);
}
/*
- * $Id: rb_timer.c 25 2004-06-26 23:07:01Z tilman $
+ * $Id: rb_timer.c 27 2004-07-08 18:25:05Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
return (r != Qfalse);
}
-static VALUE c_init (VALUE self, VALUE interval)
-{
- RbEcoreTimer *timer = NULL;
-
- Data_Get_Struct (self, RbEcoreTimer, timer);
-
- timer->cb = (void *) rb_block_proc ();
- timer->timer = ecore_timer_add (NUM2DBL (interval),
- on_timer, timer);
-
- return self;
-}
-
static void c_free (RbEcoreTimer *timer)
{
if (timer->timer && !timer->deleted)
ecore_timer_del (timer->timer);
+ ecore_shutdown ();
+
free (timer);
}
static VALUE c_new (VALUE klass, VALUE interval)
{
- VALUE self, argv[1];
+ VALUE self;
RbEcoreTimer *timer;
+ if (!rb_block_given_p ())
+ return Qnil;
+
self = Data_Make_Struct (klass, RbEcoreTimer, NULL, c_free, timer);
- argv[0] = interval;
- rb_obj_call_init (self, 1, argv);
+ ecore_init ();
+
+ timer->cb = (void *) rb_block_proc ();
+ timer->timer = ecore_timer_add (NUM2DBL (interval),
+ on_timer, timer);
+
+ rb_obj_call_init (self, 0, NULL);
return self;
}
cTimer = rb_define_class_under (mEcore, "Timer", rb_cObject);
rb_define_singleton_method (cTimer, "new", c_new, 1);
- rb_define_method (cTimer, "initialize", c_init, 1);
rb_define_method (cTimer, "delete", c_delete, 0);
}
/*
- * $Id: rb_ecore_evas.c 26 2004-07-06 18:27:19Z tilman $
+ * $Id: rb_ecore_evas.c 27 2004-07-08 18:25:05Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
#include <ruby.h>
+#include <Ecore.h>
#include <Ecore_Evas.h>
#include <rb_evas.h>
rb_hash_aset (evases, INT2NUM ((long) ee), Qnil);
+ ecore_evas_shutdown ();
+ ecore_shutdown ();
+
free (ee);
}
GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
- snprintf (buf, sizeof (buf), "#<EcoreEvas:%p ptr=%p>",
+ snprintf (buf, sizeof (buf), "#<Ecore::Evas::EcoreEvas:%p ptr=%p>",
(void *) self, *ee);
return rb_str_new2 (buf);
/*
- * $Id: rb_ecore_evas_main.c 22 2004-06-26 16:43:41Z tilman $
+ * $Id: rb_ecore_evas_main.c 27 2004-07-08 18:25:05Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
#include "rb_gl_x11.h"
#include "rb_fb.h"
+#ifdef DEBUG
static VALUE m_init (VALUE self)
{
return INT2FIX (ecore_evas_init ());
{
return INT2FIX (ecore_evas_shutdown ());
}
+#endif
void Init_ecore_evas (void)
{
mEvas = rb_define_module_under (mEcore, "Evas");
+#ifdef DEBUG
rb_define_module_function (mEvas, "init", m_init, 0);
rb_define_module_function (mEvas, "shutdown", m_shutdown, 0);
+#endif
Init_EcoreEvas ();
Init_SoftwareX11 ();
/*
- * $Id: rb_fb.c 25 2004-06-26 23:07:01Z tilman $
+ * $Id: rb_fb.c 27 2004-07-08 18:25:05Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
#include <ruby.h>
+#include <Ecore.h>
#include <Ecore_Evas.h>
#include "rb_ecore_evas_main.h"
#include "rb_ecore_evas.h"
-static VALUE c_init (int argc, VALUE *argv, VALUE self)
+static VALUE c_new (int argc, VALUE *argv, VALUE klass)
{
- VALUE disp, rot, w, h;
+ VALUE self, disp, rot, w, h;
Ecore_Evas **ee = NULL;
char *cdisp = NULL;
int irot = 0, iw = 0, ih = 0;
- Data_Get_Struct (self, Ecore_Evas *, ee);
+ self = Data_Make_Struct (klass, Ecore_Evas *,
+ NULL, c_ecore_evas_free, ee);
rb_scan_args (argc, argv, "04", &disp, &rot, &w, &h);
ih = NUM2INT (h);
}
- *ee = ecore_evas_fb_new (cdisp, irot, iw, ih);
-
- return self;
-}
-
-static VALUE c_new (int argc, VALUE *argv, VALUE klass)
-{
- VALUE self;
- Ecore_Evas **ee;
+ ecore_init ();
+ ecore_evas_init ();
- self = Data_Make_Struct (klass, Ecore_Evas *,
- NULL, c_ecore_evas_free, ee);
+ *ee = ecore_evas_fb_new (cdisp, irot, iw, ih);
- rb_obj_call_init (self, argc, argv);
+ rb_obj_call_init (self, 0, NULL);
return self;
}
VALUE cFb = rb_define_class_under (mEvas, "Fb", cEcoreEvas);
rb_define_singleton_method (cFb, "new", c_new, -1);
- rb_define_method (cFb, "initialize", c_init, -1);
}
-
/*
- * $Id: rb_gl_x11.c 25 2004-06-26 23:07:01Z tilman $
+ * $Id: rb_gl_x11.c 27 2004-07-08 18:25:05Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
#include <ruby.h>
+#include <Ecore.h>
#include <Ecore_Evas.h>
#include "rb_ecore_evas_main.h"
#include "rb_ecore_evas.h"
-static VALUE c_init (int argc, VALUE *argv, VALUE self)
+static VALUE c_new (int argc, VALUE *argv, VALUE klass)
{
- VALUE disp, parent, geom[4];
+ VALUE self, disp, parent, geom[4];
Ecore_Evas **ee = NULL;
char *cdisp = NULL;
int i, igeom[4] = {0, 0, 0, 0};
- Data_Get_Struct (self, Ecore_Evas *, ee);
+ self = Data_Make_Struct (klass, Ecore_Evas *,
+ NULL, c_ecore_evas_free, ee);
rb_scan_args (argc, argv, "06", &disp, &parent,
&geom[0], &geom[1], &geom[2], &geom[3]);
igeom[i] = NUM2INT (geom[i]);
}
+ ecore_init ();
+ ecore_evas_init ();
+
*ee = ecore_evas_gl_x11_new (cdisp, 0,
igeom[0], igeom[1],
igeom[2], igeom[3]);
- return self;
-}
-
-static VALUE c_new (int argc, VALUE *argv, VALUE klass)
-{
- VALUE self;
- Ecore_Evas **ee;
-
- self = Data_Make_Struct (klass, Ecore_Evas *,
- NULL, c_ecore_evas_free, ee);
-
- rb_obj_call_init (self, argc, argv);
+ rb_obj_call_init (self, 0, NULL);
return self;
}
VALUE cGlX11 = rb_define_class_under (mEvas, "GlX11", cEcoreEvas);
rb_define_singleton_method (cGlX11, "new", c_new, -1);
- rb_define_method (cGlX11, "initialize", c_init, -1);
}
-
/*
- * $Id: rb_software_x11.c 25 2004-06-26 23:07:01Z tilman $
+ * $Id: rb_software_x11.c 27 2004-07-08 18:25:05Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
#include <ruby.h>
+#include <Ecore.h>
#include <Ecore_Evas.h>
#include "rb_ecore_evas_main.h"
#include "rb_ecore_evas.h"
-static VALUE c_init (int argc, VALUE *argv, VALUE self)
+static VALUE c_new (int argc, VALUE *argv, VALUE klass)
{
- VALUE disp, parent, geom[4];
+ VALUE self, disp, parent, geom[4];
Ecore_Evas **ee = NULL;
char *cdisp = NULL;
int i, igeom[4] = {0, 0, 0, 0};
- Data_Get_Struct (self, Ecore_Evas *, ee);
+ self = Data_Make_Struct (klass, Ecore_Evas *,
+ NULL, c_ecore_evas_free, ee);
rb_scan_args (argc, argv, "06", &disp, &parent,
&geom[0], &geom[1], &geom[2], &geom[3]);
igeom[i] = NUM2INT (geom[i]);
}
+ ecore_init ();
+ ecore_evas_init ();
+
*ee = ecore_evas_software_x11_new (cdisp, 0,
igeom[0], igeom[1],
igeom[2], igeom[3]);
- return self;
-}
-
-static VALUE c_new (int argc, VALUE *argv, VALUE klass)
-{
- VALUE self;
- Ecore_Evas **ee;
-
- self = Data_Make_Struct (klass, Ecore_Evas *,
- NULL, c_ecore_evas_free, ee);
-
- rb_obj_call_init (self, argc, argv);
+ rb_obj_call_init (self, 0, NULL);
return self;
}
cEcoreEvas);
rb_define_singleton_method (cSoftwareX11, "new", c_new, -1);
- rb_define_method (cSoftwareX11, "initialize", c_init, -1);
}
-
/*
- * $Id: rb_job.c 25 2004-06-26 23:07:01Z tilman $
+ * $Id: rb_job.c 27 2004-07-08 18:25:05Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
#include <ruby.h>
+#include <Ecore.h>
#include <Ecore_Job.h>
#include <stdbool.h>
job->deleted = true;
}
-static VALUE c_init (VALUE self)
-{
- RbEcoreJob *job = NULL;
-
- Data_Get_Struct (self, RbEcoreJob, job);
-
- job->cb = (void *) rb_block_proc ();
- job->job = ecore_job_add (on_job, job);
-
- return self;
-}
-
static void c_free (RbEcoreJob *job)
{
if (job->job && !job->deleted)
ecore_job_del (job->job);
+ ecore_shutdown ();
+
free (job);
}
VALUE self;
RbEcoreJob *job;
+ if (!rb_block_given_p ())
+ return Qnil;
+
self = Data_Make_Struct (klass, RbEcoreJob, NULL, c_free, job);
+ ecore_init ();
+
+ job->cb = (void *) rb_block_proc ();
+ job->job = ecore_job_add (on_job, job);
+
rb_obj_call_init (self, 0, NULL);
return self;
cJob = rb_define_class_under (mJob, "Job", rb_cObject);
rb_define_singleton_method (cJob, "new", c_new, 0);
- rb_define_method (cJob, "initialize", c_init, 0);
rb_define_method (cJob, "delete", c_delete, 0);
}