From 4f42f11a79fd44fd647c213c1561beb9e1d199af Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sat, 19 Jun 2004 19:17:47 +0000 Subject: [PATCH] Initial commit. --- AUTHORS | 3 ++ ChangeLog | 0 Makefile.am | 3 ++ NEWS | 0 README | 0 autogen.sh | 62 ++++++++++++++++++++++++++++++++++++ configure.ac | 33 ++++++++++++++++++++ m4/Makefile.am | 3 ++ src/Makefile.am | 13 ++++++++ src/rb_edje.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++ src/rb_edje.h | 26 ++++++++++++++++ src/rb_edje_main.c | 51 ++++++++++++++++++++++++++++++ src/rb_edje_main.h | 26 ++++++++++++++++ 13 files changed, 298 insertions(+) create mode 100644 AUTHORS create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 m4/Makefile.am create mode 100644 src/Makefile.am create mode 100644 src/rb_edje.c create mode 100644 src/rb_edje.h create mode 100644 src/rb_edje_main.c create mode 100644 src/rb_edje_main.h diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..7422397 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +$Id$ + +Tilman Sauerbeck (tilman at code-monkey de) diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..02cbb8d --- /dev/null +++ b/Makefile.am @@ -0,0 +1,3 @@ +## $Id$ + +SUBDIRS = m4 src diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..a535e8d --- /dev/null +++ b/autogen.sh @@ -0,0 +1,62 @@ +#! /bin/sh +# Run this to generate all the initial makefiles, etc. + +# Stolen from the GNU Midnight Commander. Customized for giFTcurs. Stolen from +# giFTcurs. Customized for giFT. Stolen from giFT. +# Customized for $this_project. + +# Make it possible to specify path in the environment +: ${AUTOCONF=autoconf} +: ${AUTOHEADER=autoheader} +: ${AUTOMAKE=automake} +: ${ACLOCAL=aclocal} +: ${LIBTOOLIZE=libtoolize} + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +( +cd $srcdir + +# The autoconf cache (version after 2.52) is not reliable yet. +rm -rf autom4te.cache + +rm -f aclocal.m4 +ACLOCAL_INCLUDES="-I m4" + +# Some old version of GNU build tools fail to set error codes. +# Check that they generate some of the files they should. + +echo "Running $ACLOCAL..." +$ACLOCAL $ACLOCAL_INCLUDES $ACLOCAL_FLAGS || exit 1 +test -f aclocal.m4 || \ + { echo "aclocal failed to generate aclocal.m4" 2>&1; exit 1; } + +echo "Running $AUTOHEADER..." +$AUTOHEADER || exit 1 +test -f config.h.in || \ + { echo "autoheader failed to generate config.h.in" 2>&1; exit 1; } + +echo "Running $AUTOCONF..." +$AUTOCONF || exit 1 +test -f configure || \ + { echo "autoconf failed to generate configure" 2>&1; exit 1; } + +# hack hack hack...i hate autotools. +echo "Running $LIBTOOLIZE --automake..." +$LIBTOOLIZE --automake || exit 1 +test -f ltmain.sh || \ + { echo "libtoolize failed to generate ltmain.sh" 2>&1; exit 1; } + +# Workaround for Automake 1.5 to ensure that depcomp is distributed. +echo "Running $AUTOMAKE..." +$AUTOMAKE -c -a src/Makefile || exit 1 +$AUTOMAKE -c -a || exit 1 +test -f Makefile.in || \ + { echo "automake failed to generate Makefile.in" 2>&1; exit 1; } + +) || exit 1 + +echo +echo "Type './configure' to configure ruby-edje." +echo diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..053c945 --- /dev/null +++ b/configure.ac @@ -0,0 +1,33 @@ +dnl $Id$ + +AC_INIT(ruby-edje, 0.0.1) +AC_CONFIG_SRCDIR([src/rb_edje_main.c]) + +AM_INIT_AUTOMAKE([dist-bzip2]) +AM_CONFIG_HEADER(config.h) + +AC_PROG_CC +AC_PROG_CC_STDC +AC_PROG_INSTALL + +AM_DISABLE_STATIC +AC_PROG_LIBTOOL + +AC_HEADER_STDC +AC_HEADER_STDBOOL + +AC_RUBY_EXT + +AC_PATH_GENERIC(evas, , , + AC_MSG_ERROR(Cannot find evas: Is evas-config in path?)) + +AC_PATH_GENERIC(edje, , , + AC_MSG_ERROR(Cannot find edje: Is edje-config in path?)) + +AC_CONFIG_FILES([ +Makefile +m4/Makefile +src/Makefile +]) + +AC_OUTPUT diff --git a/m4/Makefile.am b/m4/Makefile.am new file mode 100644 index 0000000..f9e1214 --- /dev/null +++ b/m4/Makefile.am @@ -0,0 +1,3 @@ +## $Id$ + +EXTRA_DIST = ac_path_generic.m4 ac_ruby_ext.m4 diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..1282061 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,13 @@ +## $Id$ + +AM_CFLAGS = $(EVAS_CFLAGS) $(EDJE_CFLAGS) +INCLUDES = -I$(RUBYDIR) -I$(RUBYSITEDIR) + +ext_LTLIBRARIES = edje.la +extdir = $(RUBYSITEDIR) + +edje_la_SOURCES = rb_edje_main.c rb_edje_main.h \ + rb_edje.c rb_edje.h + +edje_la_LIBADD = -lruby $(EVAS_LIBS) $(EDJE_LIBS) +edje_la_LDFLAGS = -module -avoid-version diff --git a/src/rb_edje.c b/src/rb_edje.c new file mode 100644 index 0000000..37b099c --- /dev/null +++ b/src/rb_edje.c @@ -0,0 +1,78 @@ +/* + * $Id$ + * + * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) + * + * This library 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.1 of the License, or (at your option) any later version. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include +#include + +#include "rb_edje_main.h" + +#define GET_OBJ(obj, type, o, desc) \ + type **(o) = NULL; \ +\ + Data_Get_Struct ((obj), type *, (o)); \ +\ + if (!*(o)) { \ + rb_raise (rb_eException, desc " destroyed already"); \ + return Qnil; \ + } + +VALUE cEdje; + +static VALUE c_new (VALUE klass, VALUE evas) +{ + VALUE self, argv[1]; + Evas_Object **edje; + + GET_OBJ (evas, Evas, e, "Evas"); + + self = Data_Make_Struct (klass, Evas_Object *, c_evas_object_mark, + c_evas_object_free, edje); + *edje = edje_object_add (*e); + + argv[0] = evas; + rb_obj_call_init (self, 1, argv); + + return self; +} + +static VALUE c_load (VALUE self, VALUE eet, VALUE group) +{ + GET_OBJ (self, Evas_Object, e, "EvasObject"); + + Check_Type (eet, T_STRING); + Check_Type (group, T_STRING); + + if (!edje_object_file_set (*e, STR2CSTR (eet), STR2CSTR (group))) + rb_raise (rb_eException, "Cannot load eet"); + + return Qnil; +} + +void Init_Edje (void) +{ + cEdje = rb_define_class_under (mEdje, "Edje", cEvasObject); + + rb_define_singleton_method (cEdje, "new", c_new, 1); + rb_define_method (cEdje, "load", c_load, 2); +} + diff --git a/src/rb_edje.h b/src/rb_edje.h new file mode 100644 index 0000000..9d9eb97 --- /dev/null +++ b/src/rb_edje.h @@ -0,0 +1,26 @@ +/* + * $Id$ + * + * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) + * + * This library 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.1 of the License, or (at your option) any later version. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __RB_EDJE_H +#define __RB_EDJE_H + +void Init_Edje (void); + +#endif diff --git a/src/rb_edje_main.c b/src/rb_edje_main.c new file mode 100644 index 0000000..e3e9a0f --- /dev/null +++ b/src/rb_edje_main.c @@ -0,0 +1,51 @@ +/* + * $Id$ + * + * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) + * + * This library 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.1 of the License, or (at your option) any later version. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "rb_edje_main.h" +#include "rb_edje.h" + +static VALUE m_init (VALUE self) +{ + return INT2FIX (edje_init ()); +} + +static VALUE m_shutdown (VALUE self) +{ + rb_gc_start (); + + return INT2FIX (edje_shutdown ()); +} + +void Init_edje (void) +{ + rb_require ("evas"); + + mEdje = rb_define_module ("Edje"); + + rb_define_module_function (mEdje, "init", m_init, 0); + rb_define_module_function (mEdje, "shutdown", m_shutdown, 0); + + Init_Edje (); +} + diff --git a/src/rb_edje_main.h b/src/rb_edje_main.h new file mode 100644 index 0000000..52e1663 --- /dev/null +++ b/src/rb_edje_main.h @@ -0,0 +1,26 @@ +/* + * $Id$ + * + * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) + * + * This library 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.1 of the License, or (at your option) any later version. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __RB_EDJE_MAIN_H +#define __RB_EDJE_MAIN_H + +VALUE mEdje; + +#endif -- 2.30.2