Commit d189ad0d authored by David Gobbi's avatar David Gobbi

ENH: Move wrapper text-formatting utils into vtkWrapText.c.

parent 2bf9f848
......@@ -34,7 +34,7 @@ IF(NOT CMAKE_CROSSCOMPILING)
ENDIF (VTK_WRAP_TCL)
IF (VTK_WRAP_PYTHON)
ADD_EXECUTABLE(vtkWrapPython vtkWrapPython.c vtkWrap.c
ADD_EXECUTABLE(vtkWrapPython vtkWrapPython.c vtkWrap.c vtkWrapText.c
vtkParseMain.c vtkParse.tab.c vtkParsePreprocess.c
vtkParseHierarchy.c)
ADD_EXECUTABLE(vtkWrapPythonInit vtkWrapPythonInit.c)
......
......@@ -459,6 +459,33 @@ int vtkWrap_IsClassWrapped(
return 0;
}
/* -------------------------------------------------------------------- */
/* Expand all typedef types that are used in function arguments */
void vtkWrap_ExpandTypedefs(ClassInfo *data, HierarchyInfo *hinfo)
{
int i, j, n;
FunctionInfo *funcInfo;
n = data->NumberOfFunctions;
for (i = 0; i < n; i++)
{
funcInfo = data->Functions[i];
if (funcInfo->Access == VTK_ACCESS_PUBLIC)
{
for (j = 0; j < funcInfo->NumberOfArguments; j++)
{
vtkParseHierarchy_ExpandTypedefs(
hinfo, funcInfo->Arguments[j], data->Name);
}
if (funcInfo->ReturnValue)
{
vtkParseHierarchy_ExpandTypedefs(
hinfo, funcInfo->ReturnValue, data->Name);
}
}
}
}
/* -------------------------------------------------------------------- */
/* get the type name */
......
......@@ -127,6 +127,13 @@ int vtkWrap_IsTypeOf(
int vtkWrap_IsClassWrapped(
HierarchyInfo *hinfo, const char *classname);
/**
* Expand all typedef types that are used in function arguments.
* This should be done before any wrapping is done, to make sure
* that the wrappers see the real types.
*/
void vtkWrap_ExpandTypedefs(ClassInfo *data, HierarchyInfo *hinfo);
/**
* Get the name of a type. The name will not include "const".
*/
......
This diff is collapsed.
This diff is collapsed.
/*=========================================================================
Program: Visualization Toolkit
Module: vtkWrapText.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* vtkWrap provides useful functions for generating wrapping code.
*/
#ifndef VTK_WRAP_TEXT_H
#define VTK_WRAP_TEXT_H
#include "vtkParse.h"
#include "vtkParseHierarchy.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Quote a string for inclusion in a C string literal. The "maxlen"
* should be set to a value between 32 and 2047. Values over 2047
* will result in string literals too long for some compilers. If
* the string is truncated, a "..." will be appended.
*/
const char *vtkWrapText_QuoteString(const char *comment, size_t maxlen);
/**
* Format a doxygen comment for plain text, and word-wrap at
* the specified width. A 70-char width is recommended.
*/
const char *vtkWrapText_FormatComment(const char *comment, size_t width);
/**
* Format a method signature by applying word-wrap at the specified
* width and taking special care not to split any literals or names.
* A width of 70 chars is recommended.
*/
const char *vtkWrapText_FormatSignature(
const char *signature, size_t width, size_t maxlen);
/**
* Produce a python signature for a method, for use in documentation.
*/
const char *vtkWrapText_PythonSignature(FunctionInfo *currentFunction);
#ifdef __cplusplus
}
#endif
#endif
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