Commit de1a579e authored by David Gobbi's avatar David Gobbi Committed by Marcus D. Hanwell
Browse files

ENH: create a simple list of supported types for each wrapper.

This change will make the wrappers automatically reject any
type that they don't explicitly support.  This is much better
than the previous system, which required a separate "if" line
for each rejected type.
parent 9e0906e5
......@@ -505,10 +505,24 @@ void HandleDataArray(FILE *fp, FileInfo *data)
void outputFunction(FILE *fp, FileInfo *data)
{
int i;
static int supported_types[] = {
VTK_PARSE_VOID, VTK_PARSE_BOOL, VTK_PARSE_FLOAT, VTK_PARSE_DOUBLE,
VTK_PARSE_CHAR, VTK_PARSE_UNSIGNED_CHAR, VTK_PARSE_SIGNED_CHAR,
VTK_PARSE_INT, VTK_PARSE_UNSIGNED_INT,
VTK_PARSE_SHORT, VTK_PARSE_UNSIGNED_SHORT,
VTK_PARSE_LONG, VTK_PARSE_UNSIGNED_LONG,
VTK_PARSE_ID_TYPE, VTK_PARSE_UNSIGNED_ID_TYPE,
VTK_PARSE_LONG_LONG, VTK_PARSE_UNSIGNED_LONG_LONG,
VTK_PARSE___INT64, VTK_PARSE_UNSIGNED___INT64,
VTK_PARSE_VTK_OBJECT, VTK_PARSE_STRING,
0
};
int i, j;
int args_ok = 1;
int rType = (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE);
int aType = 0;
int baseType = 0;
/* some functions will not get wrapped no matter what else */
if (currentFunction->IsOperator ||
......@@ -537,11 +551,24 @@ void outputFunction(FILE *fp, FileInfo *data)
for (i = 0; i < currentFunction->NumberOfArguments; i++)
{
aType = (currentFunction->ArgTypes[i] & VTK_PARSE_UNQUALIFIED_TYPE);
baseType = (aType & VTK_PARSE_BASE_TYPE);
if (currentFunction->ArgTypes[i] != VTK_PARSE_FUNCTION)
{
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
}
if (aType == VTK_PARSE_VTK_OBJECT) args_ok = 0;
if ((aType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) args_ok = 0;
if (((aType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER)&&
((aType & VTK_PARSE_INDIRECT) != 0)) args_ok = 0;
if (((aType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) &&
((aType & VTK_PARSE_INDIRECT) != 0) &&
(aType != VTK_PARSE_STRING_REF)) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_CHAR_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_INT_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_SHORT_PTR) args_ok = 0;
......@@ -549,13 +576,23 @@ void outputFunction(FILE *fp, FileInfo *data)
if (aType == VTK_PARSE_UNSIGNED_ID_TYPE_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_LONG_LONG_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED___INT64_PTR) args_ok = 0;
if ((aType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) args_ok = 0;
}
if ((rType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) args_ok = 0;
if (rType == VTK_PARSE_VTK_OBJECT) args_ok = 0;
if (((rType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER)&&
((rType & VTK_PARSE_INDIRECT) != 0)) args_ok = 0;
baseType = (rType & VTK_PARSE_BASE_TYPE);
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
if (rType == VTK_PARSE_VTK_OBJECT) args_ok = 0;
if (((rType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) &&
((rType & VTK_PARSE_INDIRECT) != 0) &&
(rType != VTK_PARSE_STRING_REF)) args_ok = 0;
/* eliminate unsigned char * and unsigned short * */
if (rType == VTK_PARSE_UNSIGNED_INT_PTR) args_ok = 0;
......@@ -565,8 +602,6 @@ void outputFunction(FILE *fp, FileInfo *data)
if (rType == VTK_PARSE_UNSIGNED_LONG_LONG_PTR) args_ok = 0;
if (rType == VTK_PARSE_UNSIGNED___INT64_PTR) args_ok = 0;
if ((rType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) args_ok = 0;
if (currentFunction->NumberOfArguments &&
(currentFunction->ArgTypes[0] == VTK_PARSE_FUNCTION)
&&(currentFunction->NumberOfArguments != 1)) args_ok = 0;
......
......@@ -343,9 +343,23 @@ int DoneOne()
void outputFunction(FILE *fp, FileInfo *data)
{
static int supported_types[] = {
VTK_PARSE_VOID, VTK_PARSE_BOOL, VTK_PARSE_FLOAT, VTK_PARSE_DOUBLE,
VTK_PARSE_CHAR, VTK_PARSE_UNSIGNED_CHAR, VTK_PARSE_SIGNED_CHAR,
VTK_PARSE_INT, VTK_PARSE_UNSIGNED_INT,
VTK_PARSE_SHORT, VTK_PARSE_UNSIGNED_SHORT,
VTK_PARSE_LONG, VTK_PARSE_UNSIGNED_LONG,
VTK_PARSE_ID_TYPE, VTK_PARSE_UNSIGNED_ID_TYPE,
VTK_PARSE_LONG_LONG, VTK_PARSE_UNSIGNED_LONG_LONG,
VTK_PARSE___INT64, VTK_PARSE_UNSIGNED___INT64,
VTK_PARSE_VTK_OBJECT, VTK_PARSE_STRING,
0
};
int rType = (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE);
int aType = 0;
int i;
int baseType = 0;
int i, j;
int args_ok = 1;
/* beans */
char *beanfunc;
......@@ -368,11 +382,24 @@ void outputFunction(FILE *fp, FileInfo *data)
for (i = 0; i < currentFunction->NumberOfArguments; i++)
{
aType = (currentFunction->ArgTypes[i] & VTK_PARSE_UNQUALIFIED_TYPE);
baseType = (aType & VTK_PARSE_BASE_TYPE);
if (currentFunction->ArgTypes[i] != VTK_PARSE_FUNCTION)
{
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
}
if (aType == VTK_PARSE_VTK_OBJECT) args_ok = 0;
if ((currentFunction->ArgTypes[i] % VTK_PARSE_FLOAT0) == VTK_PARSE_UNKNOWN) args_ok = 0;
if (((aType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) &&
((aType & VTK_PARSE_INDIRECT) != 0)) args_ok = 0;
((aType & VTK_PARSE_INDIRECT) != 0) &&
(aType != VTK_PARSE_STRING_REF)) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_CHAR_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_INT_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_SHORT_PTR) args_ok = 0;
......@@ -380,13 +407,23 @@ void outputFunction(FILE *fp, FileInfo *data)
if (aType == VTK_PARSE_UNSIGNED_ID_TYPE_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_LONG_LONG_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED___INT64_PTR) args_ok = 0;
if ((aType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) args_ok = 0;
}
if ((rType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) args_ok = 0;
baseType = (rType & VTK_PARSE_BASE_TYPE);
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
if (rType == VTK_PARSE_VTK_OBJECT) args_ok = 0;
if (((rType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) &&
((rType & VTK_PARSE_INDIRECT) != 0)) args_ok = 0;
((rType & VTK_PARSE_INDIRECT) != 0) &&
(rType != VTK_PARSE_STRING_REF)) args_ok = 0;
/* eliminate unsigned char * and unsigned short * */
if (rType == VTK_PARSE_UNSIGNED_CHAR_PTR) args_ok = 0;
......@@ -396,7 +433,6 @@ void outputFunction(FILE *fp, FileInfo *data)
if (rType == VTK_PARSE_UNSIGNED_ID_TYPE_PTR) args_ok = 0;
if (rType == VTK_PARSE_UNSIGNED_LONG_LONG_PTR) args_ok = 0;
if (rType == VTK_PARSE_UNSIGNED___INT64_PTR) args_ok = 0;
if ((rType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) args_ok = 0;
if (currentFunction->NumberOfArguments &&
(currentFunction->ArgTypes[0] == VTK_PARSE_FUNCTION)
......
......@@ -827,9 +827,23 @@ void HandleDataArray(FILE *fp, FileInfo *data)
void outputFunction(FILE *fp, FileInfo *data)
{
static int supported_types[] = {
VTK_PARSE_VOID, VTK_PARSE_BOOL, VTK_PARSE_FLOAT, VTK_PARSE_DOUBLE,
VTK_PARSE_CHAR, VTK_PARSE_UNSIGNED_CHAR, VTK_PARSE_SIGNED_CHAR,
VTK_PARSE_INT, VTK_PARSE_UNSIGNED_INT,
VTK_PARSE_SHORT, VTK_PARSE_UNSIGNED_SHORT,
VTK_PARSE_LONG, VTK_PARSE_UNSIGNED_LONG,
VTK_PARSE_ID_TYPE, VTK_PARSE_UNSIGNED_ID_TYPE,
VTK_PARSE_LONG_LONG, VTK_PARSE_UNSIGNED_LONG_LONG,
VTK_PARSE___INT64, VTK_PARSE_UNSIGNED___INT64,
VTK_PARSE_VTK_OBJECT, VTK_PARSE_STRING,
0
};
int rType = (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE);
int aType = 0;
int i;
int baseType = 0;
int i, j;
int args_ok = 1;
char *jniFunction = 0;
char *begPtr = 0;
......@@ -863,11 +877,24 @@ void outputFunction(FILE *fp, FileInfo *data)
for (i = 0; i < currentFunction->NumberOfArguments; i++)
{
aType = (currentFunction->ArgTypes[i] & VTK_PARSE_UNQUALIFIED_TYPE);
baseType = (aType & VTK_PARSE_BASE_TYPE);
if (currentFunction->ArgTypes[i] != VTK_PARSE_FUNCTION)
{
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
}
if (aType == VTK_PARSE_VTK_OBJECT) args_ok = 0;
if ((aType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) args_ok = 0;
if (((aType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) &&
((aType & VTK_PARSE_INDIRECT) != 0)) args_ok = 0;
((aType & VTK_PARSE_INDIRECT) != 0) &&
(aType != VTK_PARSE_STRING_REF)) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_CHAR_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_INT_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_SHORT_PTR) args_ok = 0;
......@@ -875,14 +902,23 @@ void outputFunction(FILE *fp, FileInfo *data)
if (aType == VTK_PARSE_UNSIGNED_ID_TYPE_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED_LONG_LONG_PTR) args_ok = 0;
if (aType == VTK_PARSE_UNSIGNED___INT64_PTR) args_ok = 0;
if ((aType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) args_ok = 0;
}
if ((rType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) args_ok = 0;
baseType = (rType & VTK_PARSE_BASE_TYPE);
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
if (rType == VTK_PARSE_VTK_OBJECT) args_ok = 0;
if (((rType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) &&
((rType & VTK_PARSE_INDIRECT) != 0)) args_ok = 0;
if ((rType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) args_ok = 0;
((rType & VTK_PARSE_INDIRECT) != 0) &&
(rType != VTK_PARSE_STRING_REF)) args_ok = 0;
/* eliminate unsigned short * usigned int * etc */
if (rType == VTK_PARSE_UNSIGNED_INT_PTR) args_ok = 0;
......
......@@ -2266,9 +2266,30 @@ static int vtkWrapPython_IsConstructor(
static int vtkWrapPython_MethodCheck(
FunctionInfo *currentFunction)
{
int i;
static int supported_types[] = {
VTK_PARSE_VOID, VTK_PARSE_BOOL, VTK_PARSE_FLOAT, VTK_PARSE_DOUBLE,
VTK_PARSE_CHAR, VTK_PARSE_UNSIGNED_CHAR, VTK_PARSE_SIGNED_CHAR,
VTK_PARSE_INT, VTK_PARSE_UNSIGNED_INT,
VTK_PARSE_SHORT, VTK_PARSE_UNSIGNED_SHORT,
VTK_PARSE_LONG, VTK_PARSE_UNSIGNED_LONG,
VTK_PARSE_ID_TYPE, VTK_PARSE_UNSIGNED_ID_TYPE,
#ifdef VTK_TYPE_USE_LONG_LONG
VTK_PARSE_LONG_LONG, VTK_PARSE_UNSIGNED_LONG_LONG,
#endif
#ifdef VTK_TYPE_USE___INT64
VTK_PARSE___INT64, VTK_PARSE_UNSIGNED___INT64,
#endif
VTK_PARSE_VTK_OBJECT, VTK_PARSE_STRING,
#ifdef Py_USING_UNICODE
VTK_PARSE_UNICODE_STRING,
#endif
0
};
int i, j;
int args_ok = 1;
int argType = 0;
int baseType = 0;
int returnType = 0;
/* some functions will not get wrapped no matter what else,
......@@ -2281,42 +2302,43 @@ static int vtkWrapPython_MethodCheck(
return 0;
}
returnType = (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE);
/* check to see if we can handle all the args */
for (i = 0; i < currentFunction->NumberOfArguments; i++)
{
argType = (currentFunction->ArgTypes[i] & VTK_PARSE_UNQUALIFIED_TYPE);
baseType = (argType & VTK_PARSE_BASE_TYPE);
if (currentFunction->ArgTypes[i] != VTK_PARSE_FUNCTION)
{
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
}
if ((argType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) args_ok = 0;
if (((argType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) &&
((argType & VTK_PARSE_INDIRECT) != VTK_PARSE_REF) &&
((argType & VTK_PARSE_INDIRECT) != 0)) args_ok = 0;
if (((argType & VTK_PARSE_INDIRECT) == VTK_PARSE_REF) &&
(argType != VTK_PARSE_VTK_OBJECT_REF) &&
((currentFunction->ArgTypes[i] & VTK_PARSE_CONST) == 0)) args_ok = 0;
if (argType == VTK_PARSE_CHAR_PTR &&
currentFunction->ArgCounts[i] > 0) args_ok = 0;
if (argType == VTK_PARSE_UNSIGNED_CHAR_PTR) args_ok = 0;
if (argType == VTK_PARSE_UNSIGNED_INT_PTR) args_ok = 0;
if (argType == VTK_PARSE_UNSIGNED_LONG_LONG_PTR) args_ok = 0;
if (argType == VTK_PARSE_UNSIGNED___INT64_PTR) args_ok = 0;
if (argType == VTK_PARSE_UNSIGNED_SHORT_PTR) args_ok = 0;
if (argType == VTK_PARSE_UNSIGNED_LONG_PTR) args_ok = 0;
#ifndef VTK_TYPE_USE___INT64
if (argType == VTK_PARSE___INT64) args_ok = 0;
if (argType == VTK_PARSE_UNSIGNED___INT64) args_ok = 0;
#endif
#ifndef VTK_TYPE_USE_LONG_LONG
if (argType == VTK_PARSE_LONG_LONG) args_ok = 0;
if (argType == VTK_PARSE_UNSIGNED_LONG_LONG) args_ok = 0;
#endif
if (argType == VTK_PARSE_STRING_PTR) args_ok = 0;
if (argType == VTK_PARSE_UNICODE_STRING_PTR) args_ok = 0;
#ifndef Py_USING_UNICODE
if ((argType & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_UNICODE_STRING) args_ok = 0;
#endif
}
/* make sure we have all the info we need for array arguments */
......@@ -2337,7 +2359,18 @@ static int vtkWrapPython_MethodCheck(
(currentFunction->NumberOfArguments != 1)) args_ok = 0;
/* check the return type */
if ((returnType & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN) args_ok = 0;
returnType = (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE);
baseType = (returnType & VTK_PARSE_BASE_TYPE);
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
if (((returnType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) &&
((returnType & VTK_PARSE_INDIRECT) != VTK_PARSE_REF) &&
((returnType & VTK_PARSE_INDIRECT) != 0)) args_ok = 0;
......@@ -2345,28 +2378,14 @@ static int vtkWrapPython_MethodCheck(
/* eliminate "unsigned char *" and "unsigned short *" */
if (returnType == VTK_PARSE_UNSIGNED_CHAR_PTR) args_ok = 0;
if (returnType == VTK_PARSE_UNSIGNED_INT_PTR) args_ok = 0;
if (returnType == VTK_PARSE_UNSIGNED_LONG_LONG_PTR) args_ok = 0;
if (returnType == VTK_PARSE_UNSIGNED___INT64_PTR) args_ok = 0;
if (returnType == VTK_PARSE_UNSIGNED_SHORT_PTR) args_ok = 0;
if (returnType == VTK_PARSE_UNSIGNED_LONG_PTR) args_ok = 0;
/* eliminate types that aren't supported by the compiler */
#ifndef VTK_TYPE_USE___INT64
if (returnType == VTK_PARSE___INT64) args_ok = 0;
if (returnType == VTK_PARSE_UNSIGNED___INT64) args_ok = 0;
#endif
#ifndef VTK_TYPE_USE_LONG_LONG
if (returnType == VTK_PARSE_LONG_LONG) args_ok = 0;
if (returnType == VTK_PARSE_UNSIGNED_LONG_LONG) args_ok = 0;
#endif
if (returnType == VTK_PARSE_STRING_PTR) args_ok = 0;
if (returnType == VTK_PARSE_UNICODE_STRING_PTR) args_ok = 0;
#ifndef Py_USING_UNICODE
if ((returnType & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_UNICODE_STRING) args_ok = 0;
#endif
/* if we need a return type hint make sure we have one */
switch (returnType)
{
......
......@@ -149,7 +149,6 @@ void output_temp(FILE *fp, int i, int aType, char *Id, int count)
case VTK_PARSE_SIGNED_CHAR: fprintf(fp,"signed char "); break;
case VTK_PARSE_BOOL: fprintf(fp,"bool "); break;
case VTK_PARSE_STRING: fprintf(fp,"vtkStdString "); break;
case VTK_PARSE_UNICODE_STRING: fprintf(fp,"vtkUnicodeString "); break;
case VTK_PARSE_UNKNOWN: return;
}
......@@ -668,8 +667,28 @@ void get_args(FILE *fp, int i)
void outputFunction(FILE *fp, FileInfo *data)
{
int i;
static int supported_types[] = {
VTK_PARSE_VOID, VTK_PARSE_BOOL, VTK_PARSE_FLOAT, VTK_PARSE_DOUBLE,
VTK_PARSE_CHAR, VTK_PARSE_UNSIGNED_CHAR, VTK_PARSE_SIGNED_CHAR,
VTK_PARSE_INT, VTK_PARSE_UNSIGNED_INT,
VTK_PARSE_SHORT, VTK_PARSE_UNSIGNED_SHORT,
VTK_PARSE_LONG, VTK_PARSE_UNSIGNED_LONG,
VTK_PARSE_ID_TYPE, VTK_PARSE_UNSIGNED_ID_TYPE,
#ifdef VTK_TYPE_USE_LONG_LONG
VTK_PARSE_LONG_LONG, VTK_PARSE_UNSIGNED_LONG_LONG,
#endif
#ifdef VTK_TYPE_USE___INT64
VTK_PARSE___INT64, VTK_PARSE_UNSIGNED___INT64,
#endif
VTK_PARSE_VTK_OBJECT, VTK_PARSE_STRING,
0
};
int i, j;
int args_ok = 1;
int returnType = 0;
int argType = 0;
int baseType = 0;
/* some functions will not get wrapped no matter what else */
if (currentFunction->IsOperator ||
......@@ -683,41 +702,38 @@ void outputFunction(FILE *fp, FileInfo *data)
/* check to see if we can handle the args */
for (i = 0; i < currentFunction->NumberOfArguments; i++)
{
if ((currentFunction->ArgTypes[i] & VTK_PARSE_BASE_TYPE)
== VTK_PARSE_UNKNOWN) args_ok = 0;
#ifndef VTK_TYPE_USE_LONG_LONG
if ((currentFunction->ArgTypes[i] & VTK_PARSE_BASE_TYPE)
== VTK_PARSE_LONG_LONG ||
(currentFunction->ArgTypes[i] & VTK_PARSE_BASE_TYPE)
== VTK_PARSE_UNSIGNED_LONG_LONG) args_ok = 0;
#endif
#ifndef VTK_TYPE_USE___INT64
if ((currentFunction->ArgTypes[i] & VTK_PARSE_BASE_TYPE)
== VTK_PARSE___INT64 ||
(currentFunction->ArgTypes[i] & VTK_PARSE_BASE_TYPE)
== VTK_PARSE_UNSIGNED___INT64) args_ok = 0;
#endif
argType = (currentFunction->ArgTypes[i] & VTK_PARSE_UNQUALIFIED_TYPE);
baseType = (argType & VTK_PARSE_BASE_TYPE);
if ((currentFunction->ArgTypes[i] & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_STRING &&
(currentFunction->ArgTypes[i] & VTK_PARSE_INDIRECT) != 0 &&
(currentFunction->ArgTypes[i] & VTK_PARSE_INDIRECT) !=
VTK_PARSE_REF) args_ok = 0;
if (currentFunction->ArgTypes[i] != VTK_PARSE_FUNCTION)
{
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
}
if ((currentFunction->ArgTypes[i] & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_UNICODE_STRING) args_ok = 0;
if (baseType == VTK_PARSE_STRING &&
(argType & VTK_PARSE_INDIRECT) != 0 &&
(argType & VTK_PARSE_INDIRECT) != VTK_PARSE_REF)
{
args_ok = 0;
}
if ((currentFunction->ArgTypes[i] & VTK_PARSE_BASE_TYPE)
== VTK_PARSE_VTK_OBJECT &&
(currentFunction->ArgTypes[i] & VTK_PARSE_INDIRECT)
!= VTK_PARSE_POINTER) args_ok = 0;
if (baseType == VTK_PARSE_VTK_OBJECT &&
(argType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER)
{
args_ok = 0;
}
/* if its a pointer arg make sure we have the ArgCount */
if (((currentFunction->ArgTypes[i] & VTK_PARSE_INDIRECT) != 0) &&
((currentFunction->ArgTypes[i] & VTK_PARSE_UNQUALIFIED_TYPE)
!= VTK_PARSE_CHAR_PTR) &&
((currentFunction->ArgTypes[i] & VTK_PARSE_UNQUALIFIED_TYPE)
!= VTK_PARSE_VTK_OBJECT_PTR))
if (((argType & VTK_PARSE_INDIRECT) != 0) &&
(argType != VTK_PARSE_CHAR_PTR) &&
(baseType != VTK_PARSE_VTK_OBJECT))
{
if (currentFunction->NumberOfArguments > 1 ||
!currentFunction->ArgCounts[i])
......@@ -725,70 +741,66 @@ void outputFunction(FILE *fp, FileInfo *data)
args_ok = 0;
}
}
if (((currentFunction->ArgTypes[i] & VTK_PARSE_UNSIGNED) != 0) &&
(currentFunction->ArgTypes[i] != VTK_PARSE_UNSIGNED_CHAR) &&
(currentFunction->ArgTypes[i] != VTK_PARSE_UNSIGNED_INT) &&
(currentFunction->ArgTypes[i] != VTK_PARSE_UNSIGNED_SHORT) &&
(currentFunction->ArgTypes[i] != VTK_PARSE_UNSIGNED_LONG) &&
(currentFunction->ArgTypes[i] != VTK_PARSE_UNSIGNED_LONG_LONG) &&
(currentFunction->ArgTypes[i] != VTK_PARSE_UNSIGNED_ID_TYPE))
if (((argType & VTK_PARSE_UNSIGNED) != 0) &&
(argType != VTK_PARSE_UNSIGNED_CHAR) &&
(argType != VTK_PARSE_UNSIGNED_INT) &&
(argType != VTK_PARSE_UNSIGNED_SHORT) &&
(argType != VTK_PARSE_UNSIGNED_LONG) &&
(argType != VTK_PARSE_UNSIGNED_LONG_LONG) &&
(argType != VTK_PARSE_UNSIGNED_ID_TYPE))
{
args_ok = 0;
}
}
if ((currentFunction->ReturnType & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_UNKNOWN) args_ok = 0;
#ifndef VTK_TYPE_USE_LONG_LONG
if ((currentFunction->ReturnType & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_LONG_LONG ||
(currentFunction->ReturnType & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_UNSIGNED_LONG_LONG) args_ok = 0;
#endif
#ifndef VTK_TYPE_USE___INT64
if ((currentFunction->ReturnType & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE___INT64 ||
(currentFunction->ReturnType & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_UNSIGNED___INT64) args_ok = 0;
#endif
if ((currentFunction->ReturnType & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_STRING &&
(currentFunction->ReturnType & VTK_PARSE_INDIRECT) != 0 &&
(currentFunction->ReturnType & VTK_PARSE_INDIRECT) !=
VTK_PARSE_REF) args_ok = 0;
if ((currentFunction->ReturnType & VTK_PARSE_BASE_TYPE) ==
VTK_PARSE_UNICODE_STRING) args_ok = 0;
if ((currentFunction->ReturnType & VTK_PARSE_BASE_TYPE)
== VTK_PARSE_VTK_OBJECT &&
(currentFunction->ReturnType & VTK_PARSE_INDIRECT)
!= VTK_PARSE_POINTER) args_ok = 0;
if (((currentFunction->ReturnType & VTK_PARSE_INDIRECT)
!= VTK_PARSE_POINTER) &&
((currentFunction->ReturnType & VTK_PARSE_INDIRECT)
!= VTK_PARSE_REF) &&
((currentFunction->ReturnType & VTK_PARSE_INDIRECT) != 0))
/* check the return type */
returnType = (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE);
baseType = (returnType & VTK_PARSE_BASE_TYPE);
for (j = 0; supported_types[j] != 0; j++)
{
if (baseType == supported_types[j]) { break; }
}
if (supported_types[j] == 0)
{
args_ok = 0;
}
if (baseType == VTK_PARSE_STRING &&
(returnType & VTK_PARSE_INDIRECT) != 0 &&
(returnType & VTK_PARSE_INDIRECT) != VTK_PARSE_REF)
{
args_ok = 0;
}
if (baseType == VTK_PARSE_VTK_OBJECT &&
(returnType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER)
{
args_ok = 0;
}
if (((returnType & VTK_PARSE_INDIRECT) != VTK_PARSE_POINTER) &&
((returnType & VTK_PARSE_INDIRECT) != VTK_PARSE_REF) &&
((returnType & VTK_PARSE_INDIRECT) != 0))
{
args_ok = 0;
}
if (currentFunction->NumberOfArguments &&
(currentFunction->ArgTypes[0] == VTK_PARSE_FUNCTION)
&&(currentFunction->NumberOfArguments != 1))
(currentFunction->ArgTypes[0] == VTK_PARSE_FUNCTION) &&
(currentFunction->NumberOfArguments != 1))
{
args_ok = 0;
}
/* we can't handle void * return types */
if ((currentFunction->