Commit d4fab073 authored by Brad King's avatar Brad King 💬 Committed by Code Review
Browse files

Merge topic 'remove-revision-macros' into master

8250ac3e Remove RevisionMacro remnants
parents 6dfb1b9b 8250ac3e
......@@ -85,9 +85,6 @@ proc TestOne {cname} {
}
}
# Test the PrintRevisions method.
b PrintRevisions
b Delete
}
......
......@@ -189,60 +189,6 @@ void vtkObjectBase::UnRegister(vtkObjectBase* o)
this->UnRegisterInternal(o, 0);
}
void vtkObjectBase::CollectRevisions(ostream& os)
{
os << "vtkObjectBase 1.18\n";
}
void vtkObjectBase::PrintRevisions(ostream& os)
{
vtksys_ios::ostringstream revisions;
this->CollectRevisions(revisions);
vtksys_stl::string s = revisions.str();
const char* c = s.c_str();
while(*c)
{
const char* beginClass = 0;
const char* endClass = 0;
const char* beginRevision = 0;
const char* endRevision = 0;
for(;*c && *c != '\n'; ++c)
{
if(!beginClass && *c != ' ')
{
beginClass = c;
}
else if(beginClass && !endClass && *c == ' ')
{
endClass = c;
}
else if(endClass && !beginRevision && (*c >= '0' && *c <= '9'))
{
beginRevision = c;
}
else if(beginRevision && !endRevision && *c == ' ')
{
endRevision = c;
}
}
if (beginRevision && !endRevision)
{
endRevision = c - 1;
}
if(beginClass && endClass && beginRevision && endRevision)
{
os.write(beginClass, endClass-beginClass);
os << " ";
os.write(beginRevision, endRevision-beginRevision);
os << "\n";
}
if(*c == '\n')
{
++c;
}
}
}
//----------------------------------------------------------------------------
void vtkObjectBase::RegisterInternal(vtkObjectBase*, int check)
{
......
......@@ -148,19 +148,14 @@ public:
void SetReferenceCount(int);
// Description:
// Prints a list of the class .cxx file CVS revisions for all
// classes in the object's inheritance chain. The format of the
// list is "vtkObjectBase 1.4\n" with one class per line. The list
// always starts with the least-derived class (vtkObjectBase), and
// ends with the most-derived class. This is useful for programs
// wishing to do serialization of VTK objects.
void PrintRevisions(ostream& os);
// Legacy. Do not call.
void PrintRevisions(ostream&) {}
protected:
vtkObjectBase();
virtual ~vtkObjectBase();
virtual void CollectRevisions(ostream& os);
virtual void CollectRevisions(ostream&) {} // Legacy; do not use!
int ReferenceCount;
vtkWeakPointerBase **WeakPointers;
......
......@@ -631,28 +631,14 @@ virtual double *Get##name() \
return thisClass::SafeDownCast(this->NewInstanceInternal()); \
}
// Version of vtkTypeMacro that adds the CollectRevisions method.
// This version takes a third argument that may be VTKCOMMONCORE_EXPORT,
// VTKCOMMONCORE_EXPORT, etc. You should not use this version unless you
// have split the implementation of a class across multiple VTK libraries.
// When in doubt, use vtkTypeRevisionMacro instead.
#define vtkExportedTypeRevisionMacro(thisClass,superclass,dllExport) \
protected: \
dllExport void CollectRevisions(ostream& os); \
public: \
// Legacy versions of vtkTypeMacro and helpers.
#if !defined(VTK_LEGACY_REMOVE)
# define vtkExportedTypeRevisionMacro(thisClass,superclass,dllExport) \
vtkTypeMacro(thisClass,superclass)
// Version of vtkTypeMacro that adds the CollectRevisions method.
#define vtkTypeRevisionMacro(thisClass,superclass) vtkExportedTypeRevisionMacro(thisClass,superclass,)
// Macro to implement the standard CollectRevisions method.
#define vtkCxxRevisionMacro(thisClass, revision) \
void thisClass::CollectRevisions(ostream& sos) \
{ \
vtkOStreamWrapper os(sos); \
this->Superclass::CollectRevisions(os); \
os << #thisClass " " revision "\n"; \
}
# define vtkTypeRevisionMacro(thisClass,superclass) \
vtkTypeMacro(thisClass,superclass)
# define vtkCxxRevisionMacro(thisClass, revision)
#endif
// Macro to implement the standard form of the New() method.
#define vtkStandardNewMacro(thisClass) \
......
......@@ -57,7 +57,7 @@ class MyProcess : public vtkProcess
{
public:
static MyProcess *New();
vtkTypeRevisionMacro(MyProcess, vtkProcess);
vtkTypeMacro(MyProcess, vtkProcess);
bool IsServer;
vtkSetMacro(ImageReductionFactor, int);
......@@ -75,7 +75,6 @@ protected:
int ImageReductionFactor;
};
vtkCxxRevisionMacro(MyProcess, "$Revision$");
vtkStandardNewMacro(MyProcess);
//-----------------------------------------------------------------------------
......
......@@ -37,7 +37,7 @@ class MyProcess : public vtkProcess
{
public:
static MyProcess *New();
vtkTypeRevisionMacro(MyProcess, vtkProcess);
vtkTypeMacro(MyProcess, vtkProcess);
virtual void Execute();
......@@ -87,7 +87,6 @@ protected:
char **Argv;
};
vtkCxxRevisionMacro(MyProcess, "$Revision$");
vtkStandardNewMacro(MyProcess);
void MyProcess::Execute()
......
......@@ -648,8 +648,11 @@ int checkFunctionSignature(ClassInfo *data)
else if (!strcmp("vtkObjectBase",data->Name))
{
/* remove the special vtkObjectBase methods */
if (!strcmp(currentFunction->Name,"PrintRevisions") ||
!strcmp(currentFunction->Name,"Print"))
if (!strcmp(currentFunction->Name,"Print")
#ifndef VTK_LEGACY_REMOVE
|| !strcmp(currentFunction->Name,"PrintRevisions")
#endif
)
{
args_ok = 0;
}
......@@ -889,8 +892,10 @@ void vtkParseOutput(FILE *fp, FileInfo *file_info)
{
/* Add the Print method to vtkObject. */
fprintf(fp," public native String Print();\n");
#ifndef VTK_LEGACY_REMOVE
/* Add the PrintRevisions method to vtkObject. */
fprintf(fp," public native String PrintRevisions();\n");
#endif
/* Add the default toString from java object */
fprintf(fp," public String toString() { return Print(); }\n");
}
......
......@@ -485,8 +485,11 @@ int checkFunctionSignature(ClassInfo *data)
else if (!strcmp("vtkObjectBase",data->Name))
{
/* remove the special vtkObjectBase methods */
if (!strcmp(currentFunction->Name,"PrintRevisions") ||
!strcmp(currentFunction->Name,"Print"))
if (!strcmp(currentFunction->Name,"Print")
#ifndef VTK_LEGACY_REMOVE
|| !strcmp(currentFunction->Name,"PrintRevisions")
#endif
)
{
args_ok = 0;
}
......
......@@ -982,8 +982,11 @@ int checkFunctionSignature(ClassInfo *data)
else if (!strcmp("vtkObjectBase",data->Name))
{
/* remove the special vtkObjectBase methods */
if (!strcmp(currentFunction->Name,"PrintRevisions") ||
!strcmp(currentFunction->Name,"Print"))
if (!strcmp(currentFunction->Name,"Print")
#ifndef VTK_LEGACY_REMOVE
|| !strcmp(currentFunction->Name,"PrintRevisions")
#endif
)
{
args_ok = 0;
}
......@@ -1336,6 +1339,7 @@ void vtkParseOutput(FILE *fp, FileInfo *file_info)
fprintf(fp," return tmp;\n");
fprintf(fp,"}\n");
#ifndef VTK_LEGACY_REMOVE
/* Add the PrintRevisions method to vtkObject. */
fprintf(fp,"\nextern \"C\" JNIEXPORT jstring JNICALL Java_vtk_vtkObject_PrintRevisions(JNIEnv *env,jobject obj)\n");
fprintf(fp,"{\n vtkObject *op;\n");
......@@ -1349,6 +1353,7 @@ void vtkParseOutput(FILE *fp, FileInfo *file_info)
fprintf(fp," return tmp;\n");
fprintf(fp,"}\n");
#endif
fprintf(fp,"\nextern \"C\" JNIEXPORT jint JNICALL Java_vtk_vtkObject_AddObserver(JNIEnv *env,jobject obj, jstring id0, jobject id1, jstring id2)\n");
fprintf(fp,"{\n vtkObject *op;\n");
......
......@@ -2652,14 +2652,16 @@ static void vtkWrapPython_ClassMethodDef(
classname);
}
/* vtkObjectBase needs GetAddressAsString, PrintRevisions, UnRegister */
/* vtkObjectBase needs GetAddressAsString, UnRegister */
else if (strcmp("vtkObjectBase", data->Name) == 0)
{
fprintf(fp,
" {(char*)\"GetAddressAsString\", Py%s_GetAddressAsString, 1,\n"
" (char*)\"V.GetAddressAsString(string) -> string\\nC++: const char *GetAddressAsString()\\n\\nGet address of C++ object in format 'Addr=%%p' after casting to\\nthe specified type. You can get the same information from o.__this__.\"},\n"
#ifndef VTK_LEGACY_REMOVE
" {(char*)\"PrintRevisions\", Py%s_PrintRevisions, 1,\n"
" (char*)\"V.PrintRevisions() -> string\\nC++: const char *PrintRevisions()\\n\\nPrints the .cxx file CVS revisions of the classes in the\\nobject's inheritance chain.\"},\n"
#endif
" {(char*)\"Register\", Py%s_Register, 1,\n"
" (char*)\"V.Register(vtkObjectBase)\\nC++: virtual void Register(vtkObjectBase *o)\\n\\nIncrease the reference count by 1.\\n\"},\n"
" {(char*)\"UnRegister\", Py%s_UnRegister, 1,\n"
......@@ -3245,7 +3247,9 @@ static void vtkWrapPython_CustomMethods(
theFunc = data->Functions[i];
if ((strcmp(theFunc->Name, "GetAddressAsString") == 0) ||
#ifndef VTK_LEGACY_REMOVE
(strcmp(theFunc->Name, "PrintRevisions") == 0) ||
#endif
(strcmp(theFunc->Name, "Register") == 0) ||
(strcmp(theFunc->Name, "UnRegister") == 0))
{
......@@ -3279,6 +3283,7 @@ static void vtkWrapPython_CustomMethods(
"\n",
classname, data->Name, data->Name);
#ifndef VTK_LEGACY_REMOVE
/* add the PrintRevisions method to vtkObjectBase. */
fprintf(fp,
"static PyObject *\n"
......@@ -3305,6 +3310,7 @@ static void vtkWrapPython_CustomMethods(
"}\n"
"\n",
classname, data->Name, data->Name);
#endif
/* Override the Register method to check whether to ignore Register */
fprintf(fp,
......
......@@ -905,8 +905,11 @@ int checkFunctionSignature(ClassInfo *data)
else if (!strcmp("vtkObjectBase",data->Name))
{
/* remove the special vtkObjectBase methods */
if (!strcmp(currentFunction->Name,"PrintRevisions") ||
!strcmp(currentFunction->Name,"Print"))
if (!strcmp(currentFunction->Name,"Print")
#ifndef VTK_LEGACY_REMOVE
|| !strcmp(currentFunction->Name,"PrintRevisions")
#endif
)
{
args_ok = 0;
}
......@@ -1416,6 +1419,7 @@ void vtkParseOutput(FILE *fp, FileInfo *file_info)
fprintf(fp," Tcl_SetResult(interp,const_cast<char *>(buf_with_warning_C4701.str().c_str()),\n");
fprintf(fp," TCL_VOLATILE);\n");
fprintf(fp," return TCL_OK;\n }\n");
#ifndef VTK_LEGACY_REMOVE
/* Add the PrintRevisions method to vtkObjectBase. */
fprintf(fp," if ((!strcmp(\"PrintRevisions\",argv[1]))&&(argc == 2))\n {\n");
fprintf(fp," vtksys_ios::ostringstream buf_with_warning_C4701;\n");
......@@ -1424,6 +1428,7 @@ void vtkParseOutput(FILE *fp, FileInfo *file_info)
fprintf(fp," Tcl_SetResult(interp,const_cast<char *>(buf_with_warning_C4701.str().c_str()),\n");
fprintf(fp," TCL_VOLATILE);\n");
fprintf(fp," return TCL_OK;\n }\n");
#endif
}
/* Add the AddObserver method to vtkObject. */
......
Supports Markdown
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