Value.uses API
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@70 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
8b6109d8eb
commit
d5328ef255
8 changed files with 152 additions and 17 deletions
31
llvm/wrap.c
31
llvm/wrap.c
|
|
@ -98,19 +98,22 @@ void **make_array_from_list(PyObject *list, int n)
|
|||
return arr;
|
||||
}
|
||||
|
||||
PyObject *make_list_from_LLVMTypeRef_array(LLVMTypeRef *p, unsigned n)
|
||||
{
|
||||
size_t i;
|
||||
PyObject *list = PyList_New(n);
|
||||
|
||||
if (!list)
|
||||
return NULL;
|
||||
|
||||
for (i=0; i<n; i++) {
|
||||
PyObject *elem = ctor_LLVMTypeRef(p[i]);
|
||||
PyList_SetItem(list, i, elem);
|
||||
}
|
||||
|
||||
return list;
|
||||
#define LIST_FROM_ARRAY_IMPL(TYPE) \
|
||||
PyObject *make_list_from_ ## TYPE ## _array( TYPE *p, unsigned n) \
|
||||
{ \
|
||||
size_t i; \
|
||||
PyObject *list = PyList_New(n); \
|
||||
\
|
||||
if (!list) \
|
||||
return NULL; \
|
||||
\
|
||||
for (i=0; i<n; i++) { \
|
||||
PyObject *elem = ctor_ ## TYPE (p[i]); \
|
||||
PyList_SetItem(list, i, elem); \
|
||||
} \
|
||||
\
|
||||
return list; \
|
||||
}
|
||||
|
||||
LIST_FROM_ARRAY_IMPL(LLVMTypeRef)
|
||||
LIST_FROM_ARRAY_IMPL(LLVMValueRef)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue