Skip to content

Commit

Permalink
perlvariables - iteration N
Browse files Browse the repository at this point in the history
Later commits reworked a lot of this, but the use of GValue over void*
was kept.
  • Loading branch information
aglasgall authored and davidben committed Feb 20, 2013
1 parent 6a20996 commit 06e04a9
Show file tree
Hide file tree
Showing 11 changed files with 1,194 additions and 260 deletions.
5 changes: 3 additions & 2 deletions Makefile.am
Expand Up @@ -38,13 +38,14 @@ AM_CPPFLAGS = -I$(top_srcdir)/ \
$(GIT_FLAGS)

CODELIST_SRCS=message.c mainwin.c popwin.c zephyr.c messagelist.c \
commands.c global.c text.c fmtext.c editwin.c util.c logging.c \
commands.c global.c text.c fmtext.c gmarshal_funcs.c editwin.c \
util.c logging.c \
perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \
regex.c history.c view.c dict.c variable.c filterelement.c pair.c \
keypress.c keymap.c keybinding.c cmd.c context.c \
aim.c buddy.c buddylist.c style.c errqueue.c \
zbuddylist.c popexec.c select.c wcwidth.c \
mainpanel.c msgwin.c sepbar.c editcontext.c signal.c
mainpanel.c msgwin.c sepbar.c editcontext.c signal.c closures.c

NORMAL_SRCS = filterproc.c window.c windowcb.c

Expand Down
28 changes: 28 additions & 0 deletions closures.c
@@ -0,0 +1,28 @@
#define OWL_PERL
#include "owl.h"
#include <dlfcn.h>
#include <gperl.h>
#include <gperl_marshal.h>

gboolean (*gvalue_from_sv) (GValue * value, SV * sv) = NULL;
SV * (*sv_from_gvalue) (const GValue * value) = NULL;
GClosure * (*perl_closure_new) (SV * callback, SV * data, gboolean swap) = NULL;

/* Caller does not own return value */
const char *owl_closure_init(void)
{
void *handle = NULL;
const char *res = "Unable to dlopen self - huh?";

handle = dlopen(NULL, RTLD_LAZY | RTLD_NOLOAD);
if(handle) {
gvalue_from_sv = dlsym(handle, "gperl_value_from_sv");
sv_from_gvalue = dlsym(handle, "gperl_sv_from_value");
perl_closure_new = dlsym(handle, "gperl_closure_new");
/* ... */
res = dlerror();
dlclose(handle);
}
return res;
}

7 changes: 7 additions & 0 deletions configure.ac
Expand Up @@ -126,6 +126,8 @@ AX_PROG_PERL_MODULES([Glib],,
[AC_MSG_ERROR([cannot find perl module Glib.])])
AX_PROG_PERL_MODULES([PAR],,
[AC_MSG_WARN([PAR.pm not found. Loadable modules will be disabled.])])
AX_PROG_PERL_MODULES([ExtUtils::Depends],,
[AC_MSG_ERROR([cannot find perl module ExtUtils::Depends])])

dnl Add CFLAGS and LIBS for glib-2.0
PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.16 gobject-2.0 gthread-2.0])
Expand All @@ -139,6 +141,11 @@ if test "x${prefix}" = "xNONE"; then
prefix="${ac_default_prefix}"
fi

dnl Add CFLAGS for glib-perl
GLIB_PERL_CFLAGS=`perl -MExtUtils::Depends -e 'my $e = ExtUtils::Depends->new("BarnOwl","Glib"); my %h = $e->get_makefile_vars; print $h{"INC"}'`
AC_MSG_NOTICE([Adding glib-perl CFLAGS ${GLIB_PERL_CFLAGS}])
AM_CFLAGS="${GLIB_PERL_CFLAGS} ${AM_CFLAGS}"

dnl Checks for typedefs, structures, and compiler characteristics.

AX_CFLAGS_WARN_ALL([AM_CFLAGS])
Expand Down

0 comments on commit 06e04a9

Please sign in to comment.