Commit 57b47954 authored by David Gobbi's avatar David Gobbi

Fix two previously undetected wrapper bugs.

The vtkParseHierarchy class was not detecting enum types, and the
vtkWrapPython_PythonicName code for converting mangled type names
to pythonic names was not able to handle namespaces.

Change-Id: If5c044eca741c12a387d150a764b65cf7085a4f9
parent ba693ade
......@@ -326,8 +326,8 @@ HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename)
i += skip_space(&line[i]);
n = vtkParse_NameLength(&line[i]);
/* check for enum indicators */
if ((n == 3 && strncmp(&line[i], "int", n)) ||
(n == 4 && strncmp(&line[i], "enum", n)))
if ((n == 3 && strncmp(&line[i], "int", n) == 0) ||
(n == 4 && strncmp(&line[i], "enum", n) == 0))
{
entry->IsEnum = 1;
i += n;
......
......@@ -34,7 +34,8 @@
/* convert C++ templated types to valid python ids by mangling */
void vtkWrapPython_PythonicName(const char *name, char *pname)
{
size_t i, j;
size_t j = 0;
size_t i;
char *cp;
/* look for first char that is not alphanumeric or underscore */
......@@ -45,14 +46,31 @@ void vtkWrapPython_PythonicName(const char *name, char *pname)
/* get the mangled name */
vtkParse_MangledTypeName(name, pname);
/* remove mangling from first identifier and add an underscore */
/* put dots after namespaces */
i = 0;
cp = pname;
while (*cp == 'N')
{
cp++;
while (*cp >= '0' && *cp <= '9')
{
i = i*10 + (*cp++ - '0');
}
i += j;
while (j < i)
{
pname[j++] = *cp++;
}
pname[j++] = '.';
}
/* remove mangling from first identifier and add an underscore */
i = 0;
while (*cp >= '0' && *cp <= '9')
{
i = i*10 + (*cp++ - '0');
}
j = 0;
i += j;
while (j < i)
{
pname[j++] = *cp++;
......
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