Add some generic function pointer support
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10266 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b67e0a28a3
commit
f858eca260
2 changed files with 35 additions and 0 deletions
|
|
@ -111,6 +111,7 @@ extern "C" {
|
|||
extern SwigType *SwigType_del_element(SwigType *t);
|
||||
extern SwigType *SwigType_add_pointer(SwigType *t);
|
||||
extern SwigType *SwigType_add_memberpointer(SwigType *t, const String_or_char *qual);
|
||||
extern SwigType *SwigType_del_memberpointer(SwigType *t);
|
||||
extern SwigType *SwigType_del_pointer(SwigType *t);
|
||||
extern SwigType *SwigType_add_array(SwigType *t, const String_or_char *size);
|
||||
extern SwigType *SwigType_del_array(SwigType *t);
|
||||
|
|
@ -136,6 +137,7 @@ extern "C" {
|
|||
extern SwigType *SwigType_ltype(SwigType *t);
|
||||
extern int SwigType_ispointer(SwigType *t);
|
||||
extern int SwigType_ispointer_return(SwigType *t);
|
||||
extern int SwigType_isfunctionpointer(SwigType *t);
|
||||
extern int SwigType_ismemberpointer(SwigType *t);
|
||||
extern int SwigType_isreference(SwigType *t);
|
||||
extern int SwigType_isreference_return(SwigType *t);
|
||||
|
|
@ -151,6 +153,7 @@ extern "C" {
|
|||
extern int SwigType_isenum(SwigType *t);
|
||||
extern int SwigType_check_decl(SwigType *t, const String_or_char *decl);
|
||||
extern SwigType *SwigType_strip_qualifiers(SwigType *t);
|
||||
extern SwigType *SwigType_functionpointer_decompose(SwigType *t);
|
||||
extern String *SwigType_base(const SwigType *t);
|
||||
extern String *SwigType_namestr(const SwigType *t);
|
||||
extern String *SwigType_templateprefix(const SwigType *t);
|
||||
|
|
|
|||
|
|
@ -495,6 +495,38 @@ int SwigType_isqualifier(SwigType *t) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Function Pointers
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int SwigType_isfunctionpointer(SwigType *t) {
|
||||
char *c;
|
||||
if (!t)
|
||||
return 0;
|
||||
c = Char(t);
|
||||
if (strncmp(c, "p.f(", 4) == 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SwigType_functionpointer_decompose
|
||||
*
|
||||
* Decompose the function pointer into the parameter list and the return type
|
||||
* t - input and on completion contains the return type
|
||||
* returns the function's parameters
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
SwigType *SwigType_functionpointer_decompose(SwigType *t) {
|
||||
String *p;
|
||||
assert(SwigType_isfunctionpointer(t));
|
||||
p = SwigType_pop(t);
|
||||
Delete(p);
|
||||
p = SwigType_pop(t);
|
||||
return p;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Member Pointers
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue