Commit fb5df905 authored by David Gobbi's avatar David Gobbi

Add VTK_WRAPEXCLUDE attribute

parent d7e47571
......@@ -25,6 +25,8 @@
#ifdef __VTK_WRAP__
#define VTK_WRAP_HINTS_DEFINED
// Exclude a method or class from wrapping
#define VTK_WRAPEXCLUDE [[vtk::wrapexclude]]
// The return value points to a newly-created VTK object.
#define VTK_NEWINSTANCE [[vtk::newinstance]]
// The parameter is a pointer to a zerocopy buffer.
......@@ -36,6 +38,7 @@
#endif
#ifndef VTK_WRAP_HINTS_DEFINED
#define VTK_WRAPEXCLUDE
#define VTK_NEWINSTANCE
#define VTK_ZEROCOPY
#define VTK_EXPECTS(x)
......
This diff is collapsed.
......@@ -2567,9 +2567,9 @@ virt_specifier:
{
currentFunction->IsFinal = 1;
}
else if (strcmp($<str>1, "override") == 0) {
else if (strcmp($<str>1, "override") == 0)
{
currentFunction->IsOverride = 1; }
currentFunction->IsOverride = 1;
}
}
......@@ -2633,6 +2633,10 @@ structor_declaration:
{
currentFunction->IsExplicit = 1;
}
if (getType() & VTK_PARSE_WRAPEXCLUDE)
{
currentFunction->IsExcluded = 1;
}
currentFunction->Name = $<str>1;
currentFunction->Comment = vtkstrdup(getComment());
vtkParseDebug("Parsed func", currentFunction->Name);
......@@ -3845,6 +3849,11 @@ void start_class(const char *classname, int is_struct_or_union)
currentClass->ItemType = VTK_UNION_INFO;
}
if (getType() & VTK_PARSE_WRAPEXCLUDE)
{
currentClass->IsExcluded = 1;
}
if (classname && classname[0] != '\0')
{
/* if name of class being defined contains "::" or "<..>", then skip it */
......@@ -3885,6 +3894,8 @@ void start_class(const char *classname, int is_struct_or_union)
vtkParse_InitFunction(currentFunction);
startSig();
clearComment();
clearType();
clearTypeId();
}
/* reached the end of a class definition */
......@@ -4643,6 +4654,12 @@ void handle_attribute(const char *att, int pack)
print_parser_error("attribute takes no ...", att, l);
exit(1);
}
else if (l == 16 && strncmp(att, "vtk::wrapexclude", l) == 0 &&
!args && (role == VTK_PARSE_ATTRIB_DECL ||
role == VTK_PARSE_ATTRIB_CLASS))
{
setTypeMod(VTK_PARSE_WRAPEXCLUDE);
}
else if (l == 16 && strncmp(att, "vtk::newinstance", l) == 0 &&
!args && role == VTK_PARSE_ATTRIB_DECL)
{
......@@ -4788,6 +4805,14 @@ void output_function()
}
}
/* exclude from wrapping */
if (currentFunction->ReturnValue &&
currentFunction->ReturnValue->Type & VTK_PARSE_WRAPEXCLUDE)
{
currentFunction->ReturnValue->Type ^= VTK_PARSE_WRAPEXCLUDE;
currentFunction->IsExcluded = 1;
}
/* friend */
if (currentFunction->ReturnValue &&
currentFunction->ReturnValue->Type & VTK_PARSE_FRIEND)
......
......@@ -155,6 +155,7 @@ void vtkParse_InitFunction(FunctionInfo *func)
func->IsOverride = 0;
func->IsExplicit = 0;
func->IsLegacy = 0;
func->IsExcluded = 0;
#ifndef VTK_PARSE_LEGACY_REMOVE
/* everything below here is legacy information, *
......@@ -239,6 +240,7 @@ void vtkParse_CopyFunction(FunctionInfo *func, const FunctionInfo *orig)
func->IsOverride = orig->IsOverride;
func->IsExplicit = orig->IsExplicit;
func->IsLegacy = orig->IsLegacy;
func->IsExcluded = orig->IsExcluded;
#ifndef VTK_PARSE_LEGACY_REMOVE
/* everything below here is legacy information, *
......@@ -455,6 +457,7 @@ void vtkParse_InitClass(ClassInfo *cls)
cls->IsAbstract = 0;
cls->IsFinal = 0;
cls->HasDelete = 0;
cls->IsExcluded = 0;
}
/* Copy a Class struct */
......@@ -608,6 +611,7 @@ void vtkParse_CopyClass(ClassInfo *cls, const ClassInfo *orig)
cls->IsAbstract = orig->IsAbstract;
cls->IsFinal = orig->IsFinal;
cls->HasDelete = orig->HasDelete;
cls->IsExcluded = orig->IsExcluded;
}
/* Free a Class struct */
......
......@@ -186,6 +186,7 @@ struct _FunctionInfo
int IsOperator;
int IsVariadic;
int IsLegacy; /* marked as a legacy method or function */
int IsExcluded; /* marked as excluded from wrapping */
int IsStatic; /* methods only */
int IsVirtual; /* methods only */
int IsPureVirtual; /* methods only */
......@@ -256,6 +257,7 @@ typedef struct _ClassInfo
int IsAbstract;
int IsFinal;
int HasDelete;
int IsExcluded;
} ClassInfo;
/**
......
......@@ -76,9 +76,10 @@
/**
* Attributes (used for hints)
*/
#define VTK_PARSE_ATTRIBUTES 0x03000000
#define VTK_PARSE_ATTRIBUTES 0x07000000
#define VTK_PARSE_NEWINSTANCE 0x01000000
#define VTK_PARSE_ZEROCOPY 0x02000000
#define VTK_PARSE_WRAPEXCLUDE 0x04000000
/**
* Special
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment