Commit 93f30d00 authored by wlav's avatar wlav
Browse files

merge cppyy-dev into default: gives access to latest backend API

import os
import os, sys
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib.rarithmetic import intmask
......@@ -20,17 +20,20 @@ from pypy.module._cppyy import ffitypes
from pypy.module._cppyy.capi.capi_types import C_SCOPE, C_TYPE, C_OBJECT,\
C_METHOD, C_INDEX, C_INDEX_ARRAY, WLAVC_INDEX, C_FUNC_PTR
backend_library = 'libcppyy_backend.so'
backend_ext = '.so'
if 'win32' in sys.platform:
backend_ext = '.dll'
backend_library = 'libcppyy_backend'
# this is not technically correct, but will do for now
std_string_name = 'std::basic_string<char>'
std_string_name = 'std::string'
class _Arg: # poor man's union
_immutable_ = True
def __init__(self, tc, h = 0, l = -1, d = -1., s = '', p = rffi.cast(rffi.VOIDP, 0)):
def __init__(self, tc, h = 0, u = 0, l = -1, d = -1., s = '', p = rffi.cast(rffi.VOIDP, 0)):
self.tc = tc
self._handle = h
self._index = u
self._long = l
self._double = d
self._string = s
......@@ -41,6 +44,11 @@ class _ArgH(_Arg):
def __init__(self, val):
_Arg.__init__(self, 'h', h = val)
class _ArgU(_Arg): # separate class for rtyper
_immutable_ = True
def __init__(self, val):
_Arg.__init__(self, 'u', u = val)
class _ArgL(_Arg):
_immutable_ = True
def __init__(self, val):
......@@ -95,7 +103,10 @@ class W_RCTypeFunc(ctypefunc.W_CTypeFunc):
misc.write_raw_signed_data(data, rffi.cast(rffi.LONG, obj._long), argtype.size)
elif obj.tc == 'h':
assert isinstance(argtype, ctypeprim.W_CTypePrimitiveUnsigned)
misc.write_raw_unsigned_data(data, rffi.cast(rffi.ULONG, obj._handle), argtype.size)
misc.write_raw_unsigned_data(data, rffi.cast(rffi.UINTPTR_T, obj._handle), argtype.size)
elif obj.tc == 'u':
assert isinstance(argtype, ctypeprim.W_CTypePrimitiveUnsigned)
misc.write_raw_unsigned_data(data, rffi.cast(rffi.SIZE_T, obj._index), argtype.size)
elif obj.tc == 'p':
assert obj._voidp != rffi.cast(rffi.VOIDP, 0)
data = rffi.cast(rffi.VOIDPP, data)
......@@ -142,13 +153,17 @@ class State(object):
# TODO: the following need to match up with the globally defined C_XYZ low-level
# types (see capi/__init__.py), but by using strings here, that isn't guaranteed
c_opaque_ptr = state.c_ulong # not ptrdiff_t (which is signed)
c_opaque_ptr = state.c_uintptr_t # not size_t (which is signed)
c_size_t = state.c_size_t
c_ptrdiff_t = state.c_ptrdiff_t
c_intptr_t = state.c_intptr_t
c_uintptr_t = state.c_uintptr_t
c_scope = c_opaque_ptr
c_type = c_scope
c_object = c_opaque_ptr # not voidp (to stick with one handle type)
c_method = c_opaque_ptr
c_index = state.c_long
c_object = c_opaque_ptr # not voidp (to stick with one handle type)
c_method = c_uintptr_t # not intptr_t (which is signed)
c_index = c_size_t
c_index_array = state.c_voidp
c_void = state.c_void
......@@ -166,10 +181,10 @@ class State(object):
c_ccharp = state.c_ccharp
c_voidp = state.c_voidp
c_size_t = nt.new_primitive_type(space, 'size_t')
c_ptrdiff_t = nt.new_primitive_type(space, 'ptrdiff_t')
self.capi_call_ifaces = {
# direct interpreter access
'compile' : ([c_ccharp], c_int),
# name to opaque C++ scope representation
'resolve_name' : ([c_ccharp], c_ccharp),
'resolve_enum' : ([c_ccharp], c_ccharp),
......@@ -221,12 +236,17 @@ class State(object):
'get_all_cpp_names' : ([c_scope, c_voidp], c_voidp), # const char**
# namespace reflection information
'get_using_namespaces' : ([c_scope], c_index),
# type/class reflection information
'final_name' : ([c_type], c_ccharp),
'scoped_final_name' : ([c_type], c_ccharp),
'has_virtual_destructor' : ([c_type], c_int),
'has_complex_hierarchy' : ([c_type], c_int),
'num_bases' : ([c_type], c_int),
'base_name' : ([c_type, c_int], c_ccharp),
'is_smartptr' : ([c_type], c_int),
'is_subtype' : ([c_type, c_type], c_int),
'smartptr_info' : ([c_ccharp, c_voidp, c_voidp], c_int),
'add_smartptr_type' : ([c_ccharp], c_void),
......@@ -245,9 +265,11 @@ class State(object):
'method_result_type' : ([c_method], c_ccharp),
'method_num_args' : ([c_method], c_int),
'method_req_args' : ([c_method], c_int),
'method_arg_name' : ([c_method, c_int], c_ccharp),
'method_arg_type' : ([c_method, c_int], c_ccharp),
'method_arg_default' : ([c_method, c_int], c_ccharp),
'method_signature' : ([c_method, c_int], c_ccharp),
'method_signature_max' : ([c_method, c_int, c_int], c_ccharp),
'method_prototype' : ([c_scope, c_method, c_int], c_ccharp),
'is_const_method' : ([c_method], c_int),
......@@ -269,7 +291,7 @@ class State(object):
'num_datamembers' : ([c_scope], c_int),
'datamember_name' : ([c_scope, c_int], c_ccharp),
'datamember_type' : ([c_scope, c_int], c_ccharp),
'datamember_offset' : ([c_scope, c_int], c_ptrdiff_t),
'datamember_offset' : ([c_scope, c_int], c_intptr_t),
'datamember_index' : ([c_scope, c_ccharp], c_int),
# data member properties
......@@ -311,7 +333,15 @@ def load_backend(space):
state.backend = W_Library(space, space.newtext(libname), dldflags)
else:
# try usual lookups
state.backend = W_Library(space, space.newtext(backend_library), dldflags)
try:
if backend_library[-len(backend_ext):] == backend_ext:
fullname = backend_library
else:
fullname = backend_library+backend_ext
state.backend = W_Library(space, space.newtext(fullname), dldflags)
except Exception as e:
# TODO: where to find the value '.pypy-41'? Note that this only matters for testing.
state.backend = W_Library(space, space.newtext(backend_library+'.pypy-41'+backend_ext), dldflags)
if state.backend:
# fix constants
......@@ -354,7 +384,10 @@ def _cdata_to_size_t(space, w_cdata):
return rffi.cast(rffi.SIZE_T, space.uint_w(w_cdata))
def _cdata_to_ptrdiff_t(space, w_cdata):
return rffi.cast(rffi.LONG, space.int_w(w_cdata))
return rffi.cast(rffi.PTRDIFF_T, space.int_w(w_cdata))
def _cdata_to_intptr_t(space, w_cdata):
return rffi.cast(rffi.INTPTR_T, space.int_w(w_cdata))
def _cdata_to_ptr(space, w_cdata): # TODO: this is both a hack and dreadfully slow
w_cdata = space.interp_w(cdataobj.W_CData, w_cdata, can_be_None=False)
......@@ -365,6 +398,10 @@ def _cdata_to_ccharp(space, w_cdata):
ptr = _cdata_to_ptr(space, w_cdata) # see above ... something better?
return rffi.cast(rffi.CCHARP, ptr)
# direct interpreter access
def c_compile(space, code):
return space.int_w(call_capi(space, 'compile', [_ArgS(code)]))
# name to opaque C++ scope representation ------------------------------------
def c_resolve_name(space, name):
return charp2str_free(space, call_capi(space, 'resolve_name', [_ArgS(name)]))
......@@ -488,11 +525,17 @@ def c_get_all_cpp_names(space, scope):
c_free(space, rffi.cast(rffi.VOIDP, rawnames)) # id.
return allnames
# namespace reflection information
def c_get_using_namespaces(space, cppscope):
return space.uint_w(call_capi(space, 'get_using_namespaces', [_ArgH(cppscope)]))
# type/class reflection information ------------------------------------------
def c_final_name(space, cpptype):
return charp2str_free(space, call_capi(space, 'final_name', [_ArgH(cpptype)]))
def c_scoped_final_name(space, cpptype):
return charp2str_free(space, call_capi(space, 'scoped_final_name', [_ArgH(cpptype)]))
def c_has_virtual_destructor(space, handle):
return space.bool_w(call_capi(space, 'has_virtual_destructor', [_ArgH(handle)]))
def c_has_complex_hierarchy(space, handle):
return space.bool_w(call_capi(space, 'has_complex_hierarchy', [_ArgH(handle)]))
def c_num_bases(space, cppclass):
......@@ -500,6 +543,8 @@ def c_num_bases(space, cppclass):
def c_base_name(space, cppclass, base_index):
args = [_ArgH(cppclass.handle), _ArgL(base_index)]
return charp2str_free(space, call_capi(space, 'base_name', args))
def c_is_smartptr(space, handle):
return space.bool_w(call_capi(space, 'is_smartptr', [_ArgH(handle)]))
def c_is_subtype(space, derived, base):
jit.promote(base)
if derived == base:
......@@ -552,7 +597,7 @@ def c_method_indices_from_name(space, cppscope, name):
return py_indices
def c_get_method(space, cppscope, index):
args = [_ArgH(cppscope.handle), _ArgL(index)]
args = [_ArgH(cppscope.handle), _ArgU(index)]
return rffi.cast(C_METHOD, space.uint_w(call_capi(space, 'get_method', args)))
def c_method_name(space, cppmeth):
......@@ -567,6 +612,9 @@ def c_method_num_args(space, cppmeth):
return space.int_w(call_capi(space, 'method_num_args', [_ArgH(cppmeth)]))
def c_method_req_args(space, cppmeth):
return space.int_w(call_capi(space, 'method_req_args', [_ArgH(cppmeth)]))
def c_method_arg_name(space, cppmeth, arg_index):
args = [_ArgH(cppmeth), _ArgL(arg_index)]
return charp2str_free(space, call_capi(space, 'method_arg_name', args))
def c_method_arg_type(space, cppmeth, arg_index):
args = [_ArgH(cppmeth), _ArgL(arg_index)]
return charp2str_free(space, call_capi(space, 'method_arg_type', args))
......@@ -576,6 +624,9 @@ def c_method_arg_default(space, cppmeth, arg_index):
def c_method_signature(space, cppmeth, show_formalargs=True):
args = [_ArgH(cppmeth), _ArgL(show_formalargs)]
return charp2str_free(space, call_capi(space, 'method_signature', args))
def c_method_signature_max(space, cppmeth, show_formalargs, maxargs):
args = [_ArgH(cppmeth), _ArgL(show_formalargs), _ArgL(maxargs)]
return charp2str_free(space, call_capi(space, 'method_signature_max', args))
def c_method_prototype(space, cppscope, cppmeth, show_formalargs=True):
args = [_ArgH(cppscope.handle), _ArgH(cppmeth), _ArgL(show_formalargs)]
return charp2str_free(space, call_capi(space, 'method_prototype', args))
......@@ -583,24 +634,24 @@ def c_is_const_method(space, cppmeth):
return space.bool_w(call_capi(space, 'is_const_method', [_ArgH(cppmeth)]))
def c_get_num_templated_methods(space, cppscope):
return space.int_w(call_capi(space, 'method_is_template', [_ArgH(cppscope.handle)]))
return space.int_w(call_capi(space, 'get_num_templated_methods', [_ArgH(cppscope.handle)]))
def c_get_templated_method_name(space, cppscope, index):
args = [_ArgH(cppscope.handle), _ArgL(index)]
return charp2str_free(space, call_capi(space, 'method_is_template', args))
args = [_ArgH(cppscope.handle), _ArgU(index)]
return charp2str_free(space, call_capi(space, 'get_templated_method_name', args))
def c_exists_method_template(space, cppscope, name):
args = [_ArgH(cppscope.handle), _ArgS(name)]
return space.bool_w(call_capi(space, 'exists_method_template', args))
def c_method_is_template(space, cppscope, index):
args = [_ArgH(cppscope.handle), _ArgL(index)]
args = [_ArgH(cppscope.handle), _ArgU(index)]
return space.bool_w(call_capi(space, 'method_is_template', args))
def c_get_method_template(space, cppscope, name, proto):
args = [_ArgH(cppscope.handle), _ArgS(name), _ArgS(proto)]
return rffi.cast(C_METHOD, space.uint_w(call_capi(space, 'get_method_template', args)))
return rffi.cast(C_METHOD, space.int_w(call_capi(space, 'get_method_template', args)))
def c_get_global_operator(space, nss, lc, rc, op):
if nss is not None:
args = [_ArgH(nss.handle), _ArgH(lc.handle), _ArgH(rc.handle), _ArgS(op)]
return rffi.cast(WLAVC_INDEX, space.int_w(call_capi(space, 'get_global_operator', args)))
return rffi.cast(WLAVC_INDEX, space.uint_w(call_capi(space, 'get_global_operator', args)))
return rffi.cast(WLAVC_INDEX, -1)
# method properties ----------------------------------------------------------
......@@ -624,7 +675,7 @@ def c_datamember_type(space, cppscope, datamember_index):
return charp2str_free(space, call_capi(space, 'datamember_type', args))
def c_datamember_offset(space, cppscope, datamember_index):
args = [_ArgH(cppscope.handle), _ArgL(datamember_index)]
return _cdata_to_ptrdiff_t(space, call_capi(space, 'datamember_offset', args))
return _cdata_to_intptr_t(space, call_capi(space, 'datamember_offset', args))
def c_datamember_index(space, cppscope, name):
args = [_ArgH(cppscope.handle), _ArgS(name)]
......
......@@ -993,7 +993,7 @@ _converters["void**"] = VoidPtrPtrConverter
_converters["void*&"] = VoidPtrRefConverter
# special cases (note: 'string' aliases added below)
_converters["std::basic_string<char>"] = StdStringConverter
_converters["std::string"] = StdStringConverter
_converters["const std::basic_string<char>&"] = StdStringConverter # TODO: shouldn't copy
_converters["std::basic_string<char>&"] = StdStringRefConverter
_converters["std::basic_string<char>&&"] = StdStringMoveConverter
......@@ -1126,7 +1126,8 @@ def _add_aliased_converters():
("char", "signed char"), # TODO: check
("const char*", "char*"),
("std::basic_string<char>", "string"),
("std::string", "string"),
("std::string", "std::basic_string<char>"),
("const std::basic_string<char>&", "const string&"),
("std::basic_string<char>&", "string&"),
("std::basic_string<char>&&", "string&&"),
......
......@@ -384,7 +384,7 @@ _executors["long double&"] = LongDoubleRefExecutor
# special cases (note: 'string' aliases added below)
_executors["constructor"] = ConstructorExecutor
_executors["std::basic_string<char>"] = StdStringExecutor
_executors["std::string"] = StdStringExecutor
_executors["const std::basic_string<char>&"] = StdStringRefExecutor
_executors["std::basic_string<char>&"] = StdStringRefExecutor
......@@ -453,7 +453,8 @@ def _add_aliased_executors():
aliases = (
("const char*", "char*"),
("std::basic_string<char>", "string"),
("std::string", "string"),
("std::string", "std::basic_string<char>"),
("const std::basic_string<char>&", "const string&"),
("std::basic_string<char>&", "string&"),
......
......@@ -38,6 +38,8 @@ class State(object):
# special types
self.c_size_t = nt.new_primitive_type(space, 'size_t')
self.c_ptrdiff_t = nt.new_primitive_type(space, 'ptrdiff_t')
self.c_intptr_t = nt.new_primitive_type(space, 'intptr_t')
self.c_uintptr_t = nt.new_primitive_type(space, 'uintptr_t')
class BoolTypeMixin(object):
_mixin_ = True
......
......@@ -2,22 +2,26 @@
#define CPPYY_CAPI
#include <stddef.h>
#include <stdint.h>
#include "src/precommondefs.h"
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
typedef ptrdiff_t cppyy_scope_t;
typedef size_t cppyy_scope_t;
typedef cppyy_scope_t cppyy_type_t;
typedef void* cppyy_object_t;
typedef ptrdiff_t cppyy_method_t;
typedef intptr_t cppyy_method_t;
typedef long cppyy_index_t;
typedef size_t cppyy_index_t;
typedef void* cppyy_funcaddr_t;
typedef unsigned long cppyy_exctype_t;
/* direct interpreter access ---------------------------------------------- */
int cppyy_compile(const char* code);
/* name to opaque C++ scope representation -------------------------------- */
RPY_EXTERN
char* cppyy_resolve_name(const char* cppitem_name);
......@@ -103,12 +107,17 @@ extern "C" {
RPY_EXTERN
const char** cppyy_get_all_cpp_names(cppyy_scope_t scope, size_t* count);
/* namespace reflection information --------------------------------------- */
cppyy_index_t* cppyy_get_using_namespaces(cppyy_scope_t scope);
/* class reflection information ------------------------------------------- */
RPY_EXTERN
char* cppyy_final_name(cppyy_type_t type);
RPY_EXTERN
char* cppyy_scoped_final_name(cppyy_type_t type);
RPY_EXTERN
int cppyy_has_virtual_destructor(cppyy_type_t type);
RPY_EXTERN
int cppyy_has_complex_hierarchy(cppyy_type_t type);
RPY_EXTERN
int cppyy_num_bases(cppyy_type_t type);
......@@ -117,6 +126,8 @@ extern "C" {
RPY_EXTERN
int cppyy_is_subtype(cppyy_type_t derived, cppyy_type_t base);
RPY_EXTERN
int cppyy_is_smartptr(cppyy_type_t type);
RPY_EXTERN
int cppyy_smartptr_info(const char* name, cppyy_type_t* raw, cppyy_method_t* deref);
RPY_EXTERN
void cppyy_add_smartptr_type(const char* type_name);
......@@ -147,20 +158,24 @@ extern "C" {
RPY_EXTERN
int cppyy_method_req_args(cppyy_method_t);
RPY_EXTERN
char* cppyy_method_arg_name(cppyy_method_t,int arg_index);
RPY_EXTERN
char* cppyy_method_arg_type(cppyy_method_t, int arg_index);
RPY_EXTERN
char* cppyy_method_arg_default(cppyy_method_t, int arg_index);
RPY_EXTERN
char* cppyy_method_signature(cppyy_method_t, int show_formalargs);
RPY_EXTERN
char* cppyy_method_signature_max(cppyy_method_t, int show_formalargs, int maxargs);
RPY_EXTERN
char* cppyy_method_prototype(cppyy_scope_t scope, cppyy_method_t, int show_formalargs);
RPY_EXTERN
int cppyy_is_const_method(cppyy_method_t);
RPY_EXTERN
int get_num_templated_methods(cppyy_scope_t scope);
int cppyy_get_num_templated_methods(cppyy_scope_t scope);
RPY_EXTERN
char* get_templated_method_name(cppyy_scope_t scope, cppyy_index_t imeth);
char* cppyy_get_templated_method_name(cppyy_scope_t scope, cppyy_index_t imeth);
RPY_EXTERN
int cppyy_exists_method_template(cppyy_scope_t scope, const char* name);
RPY_EXTERN
......@@ -190,7 +205,7 @@ extern "C" {
RPY_EXTERN
char* cppyy_datamember_type(cppyy_scope_t scope, int datamember_index);
RPY_EXTERN
ptrdiff_t cppyy_datamember_offset(cppyy_scope_t scope, int datamember_index);
intptr_t cppyy_datamember_offset(cppyy_scope_t scope, int datamember_index);
RPY_EXTERN
int cppyy_datamember_index(cppyy_scope_t scope, const char* name);
......
......@@ -981,8 +981,8 @@ W_CPPTemplateOverload.typedef = TypeDef(
)
class W_CPPTemplateStaticOverload(W_CPPStaticOverload, TemplateOverloadMixin):
"""App-level dispatcher to allow both lookup/instantiation of templated methods and
dispatch among overloads between templated and non-templated method."""
"""Dispatcher to allow both lookup/instantiation of templated methods and
select among templated and non-templated method overloads."""
_attrs_ = ['name', 'tmpl_args', 'overloads', 'master', 'w_this']
_immutable_fields_ = ['name', 'tmpl_args']
......@@ -996,7 +996,8 @@ class W_CPPTemplateStaticOverload(W_CPPStaticOverload, TemplateOverloadMixin):
self.w_this = space.w_None
def clone(self, tmpl_args):
other = W_CPPTemplateStaticOverload(self.space, self.name, tmpl_args, self.scope, self.functions, self.flags)
other = W_CPPTemplateStaticOverload(self.space, self.name,
tmpl_args, self.scope, self.functions, self.flags)
other.overloads = self.overloads
other.master = self.master
other.w_this = self.w_this
......@@ -1007,7 +1008,8 @@ class W_CPPTemplateStaticOverload(W_CPPStaticOverload, TemplateOverloadMixin):
if isinstance(w_cppinstance, W_CPPInstance):
cppinstance = self.space.interp_w(W_CPPInstance, w_cppinstance)
if cppinstance.clsdecl.handle != self.scope.handle:
cppol = W_CPPTemplateStaticOverload(self.space, self.name, self.tmpl_args, self.scope, self.functions, self.flags)
cppol = W_CPPTemplateStaticOverload(self.space, self.name,
self.tmpl_args, self.scope, self.functions, self.flags)
cppol.w_this = w_cppinstance
cppol.master = self.master
return cppol # bound
......@@ -1256,10 +1258,10 @@ class W_CPPScopeDecl(W_Root):
return self.handle != other.handle
# For now, keep namespaces and classes separate as namespaces are extensible
# Namespaces and classes are separate as namespaces are (more) extensible
# with info from multiple dictionaries and do not need to bother with meta
# classes for inheritance. Both are python classes, though, and refactoring
# may be in order at some point.
# classes for inheritance. Both are python classes, though, and further
# refactoring may be in order at some point.
class W_CPPNamespaceDecl(W_CPPScopeDecl):
_attrs_ = ['space', 'handle', 'name', 'overloads', 'datamembers']
_immutable_fields_ = ['handle', 'name']
......@@ -1355,6 +1357,8 @@ class W_CPPClassDecl(W_CPPScopeDecl):
def _build_overloads(self):
assert len(self.overloads) == 0
methods_tmp = {}; ftype_tmp = {}
# add all ordinary methods (incl. pre-instantiated templates)
for idx in range(capi.c_num_methods(self.space, self)):
cppmeth = capi.c_get_method(self.space, self, idx)
if capi.c_is_constructor(self.space, cppmeth):
......@@ -1372,6 +1376,7 @@ class W_CPPClassDecl(W_CPPScopeDecl):
ftype_tmp[pyname] |= self._make_cppfunction(pyname, cppmeth, methods)
if capi.c_method_is_template(self.space, self, idx):
ftype_tmp[pyname] |= FUNCTION_IS_TEMPLATE
# the following covers the case where the only kind of operator[](idx)
# returns are the ones that produce non-const references; these can be
# used for __getitem__ just as much as for __setitem__, though
......@@ -1407,6 +1412,11 @@ class W_CPPClassDecl(W_CPPScopeDecl):
overload = W_CPPOverload(self.space, self, methods[:])
self.overloads[pyname] = overload
# add placeholders for all non-instantiated templated methods
for idx in range(capi.c_get_num_templated_methods(self.space, self)):
cppname = capi.c_get_templated_method_name(self.space, self, idx)
self.overloads[cppname] = W_CPPTemplateOverload(self.space, cppname, None, self, [])
def _make_cppfunction(self, pyname, cppmeth, funcs):
num_args = capi.c_method_num_args(self.space, cppmeth)
args_required = capi.c_method_req_args(self.space, cppmeth)
......
......@@ -439,14 +439,17 @@ def _pythonize(pyclass, name):
# also the fallback on the indexed __getitem__, but that is slower)
add_checked_item = False
if name.find('std::vector', 0, 11) != 0:
if ('begin' in pyclass.__dict__ and 'end' in pyclass.__dict__):
if 'begin' in pyclass.__dict__ and 'end' in pyclass.__dict__:
if _cppyy._scope_byname(name+'::iterator') or \
_cppyy._scope_byname(name+'::const_iterator'):
def __iter__(self):
i = self.begin()
while i != self.end():
end = self.size()
count = 0
while count != end:
yield i.__deref__()
i.__preinc__()
count += 1
i.__destruct__()
raise StopIteration
pyclass.__iter__ = __iter__
......
......@@ -160,7 +160,7 @@ int Pseudo_kLots = 42;
struct Cppyy_InitPseudoReflectionInfo {
Cppyy_InitPseudoReflectionInfo() {
// class example01 --
static long s_scope_id = 0;
static cppyy_scope_t s_scope_id = 0;
{ // namespace ''
s_handles[""] = (cppyy_scope_t)++s_scope_id;
......@@ -450,14 +450,14 @@ void cppyy_call_v(cppyy_method_t method, cppyy_object_t self, int nargs, void* a
Cppyy_PseudoMethodInfo* idx = (Cppyy_PseudoMethodInfo*)method;
if (idx == s_methods["static_example01::staticSetPayload_payload*_double"]) {
assert(!self && nargs == 2);
dummy::example01::staticSetPayload((dummy::payload*)(*(long*)&((CPPYY_G__value*)args)[0]),
dummy::example01::staticSetPayload((dummy::payload*)(*(intptr_t*)&((CPPYY_G__value*)args)[0]),
((CPPYY_G__value*)args)[1].obj.d);
} else if (idx == s_methods["static_example01::setCount_int"]) {
assert(!self && nargs == 1);
dummy::example01::setCount(((CPPYY_G__value*)args)[0].obj.in);
} else if (idx == s_methods["example01::setPayload_payload*"]) {
assert(self && nargs == 1);
((dummy::example01*)self)->setPayload((dummy::payload*)(*(long*)&((CPPYY_G__value*)args)[0]));
((dummy::example01*)self)->setPayload((dummy::payload*)(*(intptr_t*)&((CPPYY_G__value*)args)[0]));
} else if (idx == s_methods["CppyyTestData::destroy_arrays"]) {
assert(self && nargs == 0);
((dummy::CppyyTestData*)self)->destroy_arrays();
......@@ -591,11 +591,11 @@ int cppyy_call_i(cppyy_method_t method, cppyy_object_t self, int nargs, void* ar
result = dummy::example01::staticAddOneToInt(((CPPYY_G__value*)args)[0].obj.in);
} else if (idx == s_methods["static_example01::staticAddOneToInt_int_int"]) {
assert(!self && nargs == 2);
result = dummy::example01::staticAddOneToInt(
result = dummy::example01::staticAddOneToInt(
((CPPYY_G__value*)args)[0].obj.in, ((CPPYY_G__value*)args)[1].obj.in);
} else if (idx == s_methods["static_example01::staticAtoi_cchar*"]) {
assert(!self && nargs == 1);
result = dummy::example01::staticAtoi((const char*)(*(long*)&((CPPYY_G__value*)args)[0]));
result = dummy::example01::staticAtoi((const char*)(*(intptr_t*)&((CPPYY_G__value*)args)[0]));
} else if (idx == s_methods["static_example01::getCount"]) {
assert(!self && nargs == 0);
result = dummy::example01::getCount();
......@@ -605,7 +605,7 @@ int cppyy_call_i(cppyy_method_t method, cppyy_object_t self, int nargs, void* ar
} else if (idx == s_methods["example01::addDataToAtoi_cchar*"]) {
assert(self && nargs == 1);
result = ((dummy::example01*)self)->addDataToAtoi(
(const char*)(*(long*)&((CPPYY_G__value*)args)[0]));
(const char*)(*(intptr_t*)&((CPPYY_G__value*)args)[0]));
} else if (idx == s_methods["CppyyTestData::get_int"]) {
assert(self && nargs == 0);
result = ((dummy::CppyyTestData*)self)->get_int();
......@@ -621,20 +621,20 @@ long cppyy_call_l(cppyy_method_t method, cppyy_object_t self, int nargs, void* a
if (idx == s_methods["static_example01::staticStrcpy_cchar*"]) {
assert(!self && nargs == 1);
result = (long)dummy::example01::staticStrcpy(
(const char*)(*(long*)&((CPPYY_G__value*)args)[0]));
(const char*)(*(intptr_t*)&((CPPYY_G__value*)args)[0]));
} else if (idx == s_methods["static_example01::staticCyclePayload_payload*_double"]) {
assert(!self && nargs == 2);
result = (long)dummy::example01::staticCyclePayload(
(dummy::payload*)(*(long*)&((CPPYY_G__value*)args)[0]),
(dummy::payload*)(*(intptr_t*)&((CPPYY_G__value*)args)[0]),
((CPPYY_G__value*)args)[1].obj.d);
} else if (idx == s_methods["example01::addToStringValue_cchar*"]) {
assert(self && nargs == 1);
result = (long)((dummy::example01*)self)->addToStringValue(
(const char*)(*(long*)&((CPPYY_G__value*)args)[0]));
(const char*)(*(intptr_t*)&((CPPYY_G__value*)args)[0]));
} else if (idx == s_methods["example01::cyclePayload_payload*"]) {
assert(self && nargs == 1);
result = (long)((dummy::example01*)self)->cyclePayload(
(dummy::payload*)(*(long*)&((CPPYY_G__value*)args)[0]));
(dummy::payload*)(*(intptr_t*)&((CPPYY_G__value*)args)[0]));
} else if (idx == s_methods["CppyyTestData::get_uint"]) {
assert(self && nargs == 0);
result = (long)((dummy::CppyyTestData*)self)->get_uint();
......@@ -731,7 +731,7 @@ long cppyy_call_l(cppyy_method_t method, cppyy_object_t self, int nargs, void* a
} else if (idx == s_methods["CppyyTestData::pass_void_array_l"]) {
assert(self && nargs == 1);
result = (long)((dummy::CppyyTestData*)self)->pass_void_array_l(
(*(long**)&((CPPYY_G__value*)args)[0]));
(*(intptr_t**)&((CPPYY_G__value*)args)[0]));
} else if (idx == s_methods["CppyyTestData::pass_array_ulong"]) {
assert(self && nargs == 1);
result = (long)((dummy::CppyyTestData*)self)->pass_array(
......@@ -739,7 +739,7 @@ long cppyy_call_l(cppyy_method_t method, cppyy_object_t self, int nargs, void* a
} else if (idx == s_methods["CppyyTestData::pass_void_array_L"]) {
assert(self && nargs == 1);
result = (long)((dummy::CppyyTestData*)self)->pass_void_array_L(
(*(unsigned long**)&((CPPYY_G__value*)args)[0]));
(*(uintptr_t**)&((CPPYY_G__value*)args)[0]));
} else if (idx == s_methods["CppyyTestData::pass_array_float"]) {
assert(self && nargs == 1);
result = (long)((dummy::CppyyTestData*)self)->pass_array(
......@@ -868,7 +868,7 @@ char* cppyy_call_s(cppyy_method_t method, cppyy_object_t self, int nargs, void*
Cppyy_PseudoMethodInfo* idx = (Cppyy_PseudoMethodInfo*)method;