try to resolve missing bool/true/false problems with perl bindings

This commit is contained in:
Meredith L. Patterson 2013-12-06 04:27:44 +01:00
parent b794dbf72d
commit f53f474de2
3 changed files with 3 additions and 4 deletions

View file

@ -10,6 +10,6 @@ WriteMakefile(
LIBS => ["-lhammer"], LIBS => ["-lhammer"],
OBJECT => 'hammer_wrap.o', OBJECT => 'hammer_wrap.o',
INC => '-I../..', INC => '-I../..',
CCFLAGS => "$Config{ccflags} -DSWIG -std=gnu99", CCFLAGS => "$Config{ccflags} -DSWIG -DHAMMER_INTERNAL__NO_STDARG_H -std=gnu99",
); );

View file

@ -1,6 +1,7 @@
%module hammer; %module hammer;
%begin %{ %begin %{
#include <unistd.h> #include <unistd.h>
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
%} %}
@ -36,7 +37,7 @@
SWIG_exception_fail(SWIG_TypeError, "Expected array ref"); SWIG_exception_fail(SWIG_TypeError, "Expected array ref");
AV* av = (AV*) SvRV($input); AV* av = (AV*) SvRV($input);
size_t amax = av_top_index(av) + 1; // I want the length, not the top index... size_t amax = av_len(av) + 1; // I want the length, not the top index...
// TODO: is this array copied? // TODO: is this array copied?
$1 = malloc((amax+1) * sizeof(*$1)); $1 = malloc((amax+1) * sizeof(*$1));
$1[amax] = NULL; $1[amax] = NULL;

View file

@ -35,9 +35,7 @@ extern "C" {
#ifndef __cplusplus #ifndef __cplusplus
#ifndef HAMMER_INTERNAL__NO_STDARG_H #ifndef HAMMER_INTERNAL__NO_STDARG_H
#ifndef SWIGPERL
typedef int bool; typedef int bool;
#endif // SWIGPERL
#endif // HAMMER_INTERNAL__NO_STDARG_H #endif // HAMMER_INTERNAL__NO_STDARG_H
#endif #endif