static void vtkWrapText_PythonTypeSignature( struct vtkWPString *result, const char *braces[2], ValueInfo *arg) { char text[256]; const char *dimension; const char *classname = ""; if (vtkWrap_IsVoid(arg)) { classname = "void"; } else if (vtkWrap_IsFunction(arg)) { classname = "function"; } else if (vtkWrap_IsString(arg) || vtkWrap_IsCharPointer(arg)) { classname = "string"; if ((arg->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNICODE_STRING) { classname = "unicode"; } } else if (vtkWrap_IsChar(arg)) { classname = "char"; } else if (vtkWrap_IsBool(arg)) { classname = "bool"; } else if (vtkWrap_IsRealNumber(arg)) { classname = "float"; } else if (vtkWrap_IsInteger(arg)) { classname = "int"; } else { vtkWrapText_PythonName(arg->Class, text); classname = text; } if ((vtkWrap_IsArray(arg) && arg->CountHint) || vtkWrap_IsPODPointer(arg)) { vtkWPString_Append(result, braces[0]); vtkWPString_Append(result, classname); vtkWPString_Append(result, ", ..."); vtkWPString_Append(result, braces[1]); } else if (vtkWrap_IsArray(arg)) { sprintf(text, "%d", arg->Count); dimension = text; vtkWrapText_PythonArraySignature(result, classname, braces, 1, &dimension); } else if (vtkWrap_IsNArray(arg)) { vtkWrapText_PythonArraySignature(result, classname, braces, arg->NumberOfDimensions, arg->Dimensions); } else { vtkWPString_Append(result, classname); } }
/* Write the code to convert one argument with vtkPythonArgs */ void vtkWrapPython_GetSingleArgument( FILE *fp, ClassInfo *data, int i, ValueInfo *arg, int static_call) { const char *prefix = "ap."; const char *cp; char argname[32]; char pythonname[1024]; size_t l; argname[0] = '\0'; if (static_call) { prefix = "vtkPythonArgs::"; sprintf(argname, "arg%d, ", i); } if (vtkWrap_IsEnumMember(data, arg)) { fprintf(fp, "%sGetEnumValue(%stemp%d, \"%s.%s\")", prefix, argname, i, data->Name, arg->Class); } else if (arg->IsEnum) { cp = arg->Class; for (l = 0; cp[l] != '\0'; l++) { if (cp[l] == ':') { break; } } if (cp[l] == ':' && cp[l+1] == ':') { fprintf(fp, "%sGetEnumValue(%stemp%d, \"%*.*s.%s\")", prefix, argname, i, (int)l, (int)l, cp, &cp[l+2]); } else { fprintf(fp, "%sGetEnumValue(%stemp%d, \"%s\")", prefix, argname, i, cp); } } else if (vtkWrap_IsPythonObject(arg)) { fprintf(fp, "%s%sGetPythonObject(temp%d)", prefix, argname, i); } else if (vtkWrap_IsVTKObject(arg)) { vtkWrapText_PythonName(arg->Class, pythonname); if (strcmp(arg->Class, pythonname) != 0) { /* use typeid() for templated names */ fprintf(fp, "%sGetVTKObject(%stemp%d, typeid(%s).name())", prefix, argname, i, arg->Class); } else { fprintf(fp, "%sGetVTKObject(%stemp%d, \"%s\")", prefix, argname, i, pythonname); } } else if (vtkWrap_IsSpecialObject(arg) && !vtkWrap_IsNonConstRef(arg)) { vtkWrapText_PythonName(arg->Class, pythonname); fprintf(fp, "%sGetSpecialObject(%stemp%d, pobj%d, \"%s\")", prefix, argname, i, i, pythonname); } else if (vtkWrap_IsSpecialObject(arg) && vtkWrap_IsNonConstRef(arg)) { vtkWrapText_PythonName(arg->Class, pythonname); fprintf(fp, "%sGetSpecialObject(%stemp%d, \"%s\")", prefix, argname, i, pythonname); } else if (vtkWrap_IsQtEnum(arg)) { fprintf(fp, "%sGetSIPEnumValue(%stemp%d, \"%s\")", prefix, argname, i, arg->Class); } else if (vtkWrap_IsQtObject(arg)) { fprintf(fp, "%sGetSIPObject(%stemp%d, \"%s\")", prefix, argname, i, arg->Class); } else if (vtkWrap_IsFunction(arg)) { fprintf(fp, "%sGetFunction(%stemp%d)", prefix, argname, i); } else if (vtkWrap_IsVoidPointer(arg)) { fprintf(fp, "%sGetBuffer(%stemp%d, &pbuf%d)", prefix, argname, i, i); } else if (vtkWrap_IsString(arg) || vtkWrap_IsCharPointer(arg)) { fprintf(fp, "%sGetValue(%stemp%d)", prefix, argname, i); } else if (vtkWrap_IsNumeric(arg) && vtkWrap_IsScalar(arg)) { fprintf(fp, "%sGetValue(%stemp%d)", prefix, argname, i); } else if (vtkWrap_IsNArray(arg)) { fprintf(fp, "%sGetNArray(%s%.*stemp%d, %d, size%d)", prefix, argname, (int)(arg->NumberOfDimensions-1), "**********", i, arg->NumberOfDimensions, i); } else if (vtkWrap_IsArray(arg)) { fprintf(fp, "%sGetArray(%stemp%d, size%d)", prefix, argname, i, i); } else if (vtkWrap_IsPODPointer(arg)) { fprintf(fp, "%sGetArray(%stemp%d, size%d)", prefix, argname, i, i); } }