try to resolve missing bool/true/false problems with perl bindings
This commit is contained in:
parent
b794dbf72d
commit
f53f474de2
3 changed files with 3 additions and 4 deletions
|
|
@ -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",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue