namespace geno_eye
{
typedef enum
{
LABEL_BIND_TOP = 1,
LABEL_BIND_BOTTOM = 1 << 1,
LABEL_BIND_LEFT = 1 << 2,
LABEL_BIND_RIGHT = 1 << 3
} LabelBind;
}
####
geno_eye::LabelBind GENO_EYE_LABEL_BIND_T
INPUT
GENO_EYE_LABEL_BIND_T
char* sv_text = SvPV_nolen($arg);
$var = 0;
if (strstr(sv_text, "top") || strstr(sv_text, "TOP"))
$var |= geno_eye::LABEL_BIND_TOP;
else if (strstr(sv_text, "bottom") || strstr(sv_text, "BOTTOM"))
$var |= geno_eye::LABEL_BIND_BOTTOM;
if (strstr(sv_text, "left") || strstr(sv_text, "LEFT"))
$var |= geno_eye::LABEL_BIND_LEFT;
else if (strstr(sv_text, "right") || strstr(sv_text, "RIGHT"))
$var |= geno_eye::LABEL_BIND_RIGHT;
OUTPUT
GENO_EYE_LABEL_BIND_T
if ($var|geno_eye::LABEL_BIND_TOP)
sv_setpv($arg, "top");
else if ($var|geno_eye::LABEL_BIND_BOTTOM)
sv_setpv($arg, "bottom");
if ($var|geno_eye::LABEL_BIND_LEFT)
sv_catpv($arg, "left");
else if ($var|geno_eye::LABEL_BIND_RIGHT)
sv_catpv($arg, "right");
####
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#undef do_open
#undef do_close
#ifdef __cplusplus
}
#endif
#include "geno_eye_perl.h"
#include
#include
#undef xsp_constructor_class
#define xsp_constructor_class(c) (c)
#include
MODULE=Test PACKAGE=Test
void test(geno_eye::LabelBind value)
CODE:
std::cout << "binary value: " << value << std::endl;
####
$ xsubpp -typemap test_typemap test.xs >test.cpp
Bareword found where operator expected at (eval 2) line 3, near ""\n char* sv_text = SvPV_nolen($arg);
$var = 0;
if (strstr(sv_text, "top"
(Might be a runaway multi-line "" string starting on line 1)
(Missing operator before top?)
String found where operator expected at (eval 2) line 3, near "top") || strstr(sv_text, ""
Bareword found where operator expected at (eval 2) line 3, near "") || strstr(sv_text, "TOP"
(Missing operator before TOP?)
String found where operator expected at (eval 2) line 5, near "TOP"))
$var |= geno_eye::LABEL_BIND_TOP;
else if (strstr(sv_text, ""
(Might be a runaway multi-line "" string starting on line 3)
String found where operator expected at (eval 2) line 5, near "bottom") || strstr(sv_text, ""
Bareword found where operator expected at (eval 2) line 5, near "") || strstr(sv_text, "BOTTOM"
(Missing operator before BOTTOM?)
String found where operator expected at (eval 2) line 7, near "BOTTOM"))
$var |= geno_eye::LABEL_BIND_BOTTOM;
if (strstr(sv_text, ""
(Might be a runaway multi-line "" string starting on line 5)
String found where operator expected at (eval 2) line 7, near "left") || strstr(sv_text, ""
Bareword found where operator expected at (eval 2) line 7, near "") || strstr(sv_text, "LEFT"
(Missing operator before LEFT?)
String found where operator expected at (eval 2) line 9, near "LEFT"))
$var |= geno_eye::LABEL_BIND_LEFT;
else if (strstr(sv_text, ""
(Might be a runaway multi-line "" string starting on line 7)
String found where operator expected at (eval 2) line 9, near "right") || strstr(sv_text, ""
Bareword found where operator expected at (eval 2) line 9, near "") || strstr(sv_text, "RIGHT"
(Missing operator before RIGHT?)
String found where operator expected at (eval 2) line 11, near "RIGHT"))
$var |= geno_eye::LABEL_BIND_RIGHT
;\n""
(Might be a runaway multi-line "" string starting on line 9)
syntax error at (eval 2) line 3, near ""\n char* sv_text = SvPV_nolen($arg);
$var = 0;
if (strstr(sv_text, "top"