Commit dcacb7a3 authored by David Gobbi's avatar David Gobbi

Store WRAPEXCLUDE attribute in the hierarchy files

parent fb5df905
......@@ -965,6 +965,21 @@ const char *vtkParseHierarchy_GetProperty(
return NULL;
}
/* Check whether the header was named after the type */
int vtkParseHierarchy_IsPrimary(const HierarchyEntry *entry)
{
size_t n = strlen(entry->Name);
if (entry->HeaderFile &&
strncmp(entry->HeaderFile, entry->Name, n) == 0 &&
entry->HeaderFile[n] == '.')
{
return 1;
}
return 0;
}
/* Expand all unrecognized types in the template args of a type
* using the typedefs in the HierarchyInfo struct.
* Return a cached string (or the original string if no change). */
......
......@@ -111,11 +111,16 @@ HierarchyEntry *vtkParseHierarchy_FindEntryEx(
* Get properties for the class. Returns NULL if the property
* is not set, and returns either an empty string or a value string
* if the property is set. The properties supported are as follows:
* "WRAP_EXCLUDE_PYTHON"
* "WRAPEXCLUDE"
*/
const char *vtkParseHierarchy_GetProperty(
const HierarchyEntry *entry, const char *property);
/**
* Check whether item's name is the same as the header name.
*/
int vtkParseHierarchy_IsPrimary(const HierarchyEntry *entry);
/**
* Check whether class is derived from baseclass.
*/
......
......@@ -441,11 +441,14 @@ static int isClassWrapped(const char *classname)
entry = vtkParseHierarchy_FindEntry(hierarchyInfo, classname);
if (entry == 0 ||
vtkParseHierarchy_GetProperty(entry, "WRAP_EXCLUDE_PYTHON") ||
vtkParseHierarchy_GetProperty(entry, "WRAPEXCLUDE") ||
!vtkParseHierarchy_IsTypeOf(hierarchyInfo, entry, "vtkObjectBase"))
{
return 0;
}
/* Only the primary class in the header is wrapped in Java */
return vtkParseHierarchy_IsPrimary(entry);
}
return 1;
......
......@@ -278,11 +278,14 @@ static int isClassWrapped(const char *classname)
entry = vtkParseHierarchy_FindEntry(hierarchyInfo, classname);
if (entry == 0 ||
vtkParseHierarchy_GetProperty(entry, "WRAP_EXCLUDE_PYTHON") ||
vtkParseHierarchy_GetProperty(entry, "WRAPEXCLUDE") ||
!vtkParseHierarchy_IsTypeOf(hierarchyInfo, entry, "vtkObjectBase"))
{
return 0;
}
/* Only the primary class in the header is wrapped in Java */
return vtkParseHierarchy_IsPrimary(entry);
}
return 1;
......
......@@ -376,7 +376,7 @@ static char **append_class_contents(
line = append_scope_to_line(line, &m, &maxlen, scope);
line = append_class_to_line(line, &m, &maxlen, class_info);
tmpflags = "WRAP_EXCLUDE_PYTHON";
tmpflags = "WRAPEXCLUDE";
}
else if (data->Items[i].Type == VTK_ENUM_INFO)
{
......@@ -429,9 +429,8 @@ static char **append_class_contents(
* Append all types in a namespace
*/
static char **append_namespace_contents(
char **lines, size_t *np, NamespaceInfo *data, ClassInfo *main_class,
const char *scope, const char *header_file, const char *module_name,
const char *flags)
char **lines, size_t *np, NamespaceInfo *data, const char *scope,
const char *header_file, const char *module_name, const char *flags)
{
int i;
const char *tmpflags;
......@@ -473,21 +472,17 @@ static char **append_namespace_contents(
/* add a line for each type that is found */
for (i = 0; i < data->NumberOfItems; i++)
{
tmpflags = 0;
tmpflags = flags;
m = 0;
line[m] = '\0';
if (data->Items[i].Type == VTK_CLASS_INFO ||
data->Items[i].Type == VTK_STRUCT_INFO)
{
ClassInfo *class_info =
data->Classes[data->Items[i].Index];
/* all but the main class in each file is excluded from wrapping */
tmpflags = "WRAP_EXCLUDE_PYTHON";
if (class_info == main_class)
ClassInfo *class_info = data->Classes[data->Items[i].Index];
if (class_info->IsExcluded)
{
tmpflags = flags;
tmpflags = "WRAPEXCLUDE";
}
line = append_scope_to_line(line, &m, &maxlen, scope);
......@@ -495,9 +490,14 @@ static char **append_namespace_contents(
}
else if (data->Items[i].Type == VTK_ENUM_INFO)
{
EnumInfo *enum_info = data->Enums[data->Items[i].Index];
if (enum_info->IsExcluded)
{
tmpflags = "WRAPEXCLUDE";
}
line = append_scope_to_line(line, &m, &maxlen, scope);
line = append_enum_to_line(line, &m, &maxlen,
data->Enums[data->Items[i].Index]);
line = append_enum_to_line(line, &m, &maxlen, enum_info);
}
else if (data->Items[i].Type == VTK_TYPEDEF_INFO)
{
......@@ -536,8 +536,8 @@ static char **append_namespace_contents(
data->Namespaces[data->Items[i].Index]->Name)
{
lines = append_namespace_contents(lines, np,
data->Namespaces[data->Items[i].Index], 0,
scope, header_file, module_name, "WRAP_EXCLUDE_PYTHON");
data->Namespaces[data->Items[i].Index],
scope, header_file, module_name, "WRAPEXCLUDE");
}
}
......@@ -597,7 +597,7 @@ static char **vtkWrapHierarchy_ParseHeaderFile(
/* append the file contents to the output */
lines = append_namespace_contents(
lines, &n, data->Contents, data->MainClass, 0,
lines, &n, data->Contents, 0,
header_file, module_name, flags);
vtkParse_Free(data);
......
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