STYLE: fix line length

This commit is contained in:
Ken Martin 2006-05-12 14:12:13 -04:00
parent daa37f1163
commit cac30b5ff8
13 changed files with 117 additions and 71 deletions

View File

@ -38,7 +38,8 @@ void cmTarget::SetType(TargetType type, const char* name)
this->Name = name; this->Name = name;
// only add dependency information for library targets // only add dependency information for library targets
this->TargetTypeValue = type; this->TargetTypeValue = type;
if(this->TargetTypeValue >= STATIC_LIBRARY && this->TargetTypeValue <= MODULE_LIBRARY) if(this->TargetTypeValue >= STATIC_LIBRARY
&& this->TargetTypeValue <= MODULE_LIBRARY)
{ {
this->RecordDependencies = true; this->RecordDependencies = true;
} }
@ -182,8 +183,8 @@ void cmTarget::TraceVSDependencies(std::string projFile,
ic != this->GetPostBuildCommands().end(); ++ic) ic != this->GetPostBuildCommands().end(); ++ic)
{ {
cmCustomCommand &c = *ic; cmCustomCommand &c = *ic;
for (std::vector<std::string>::const_iterator i = c.GetDepends().begin(); for (std::vector<std::string>::const_iterator i
i != c.GetDepends().end(); ++i) = c.GetDepends().begin(); i != c.GetDepends().end(); ++i)
{ {
srcFilesToProcess.push(*i); srcFilesToProcess.push(*i);
srcFilesQueued.insert(*i); srcFilesQueued.insert(*i);
@ -241,7 +242,8 @@ void cmTarget::TraceVSDependencies(std::string projFile,
if (srcFilesQueued.find(outsf->GetCustomCommand()->GetDepends()[i]) if (srcFilesQueued.find(outsf->GetCustomCommand()->GetDepends()[i])
== srcFilesQueued.end()) == srcFilesQueued.end())
{ {
srcFilesToProcess.push(outsf->GetCustomCommand()->GetDepends()[i]); srcFilesToProcess.push
(outsf->GetCustomCommand()->GetDepends()[i]);
srcFilesQueued.insert(outsf->GetCustomCommand()->GetDepends()[i]); srcFilesQueued.insert(outsf->GetCustomCommand()->GetDepends()[i]);
} }
} }
@ -380,7 +382,8 @@ const std::vector<std::string>& cmTarget::GetLinkDirectories()
// is an N^2 algorithm for adding the directories, but N // is an N^2 algorithm for adding the directories, but N
// should not get very big. // should not get very big.
const char* libpath = tgt->GetDirectory(); const char* libpath = tgt->GetDirectory();
if(std::find(this->LinkDirectories.begin(), this->LinkDirectories.end(), if(std::find(this->LinkDirectories.begin(),
this->LinkDirectories.end(),
libpath) == this->LinkDirectories.end()) libpath) == this->LinkDirectories.end())
{ {
this->LinkDirectories.push_back(libpath); this->LinkDirectories.push_back(libpath);
@ -396,7 +399,8 @@ const std::vector<std::string>& cmTarget::GetLinkDirectories()
return this->LinkDirectories; return this->LinkDirectories;
} }
void cmTarget::ClearDependencyInformation( cmMakefile& mf, const char* target ) void cmTarget::ClearDependencyInformation( cmMakefile& mf,
const char* target )
{ {
// Clear the dependencies. The cache variable must exist iff we are // Clear the dependencies. The cache variable must exist iff we are
// recording dependency information for this target. // recording dependency information for this target.
@ -627,7 +631,8 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf )
// 1. Build the dependency graph // 1. Build the dependency graph
// //
for(LinkLibraryVectorType::reverse_iterator lib = this->LinkLibraries.rbegin(); for(LinkLibraryVectorType::reverse_iterator lib
= this->LinkLibraries.rbegin();
lib != this->LinkLibraries.rend(); ++lib) lib != this->LinkLibraries.rend(); ++lib)
{ {
this->GatherDependencies( mf, lib->first, dep_map ); this->GatherDependencies( mf, lib->first, dep_map );
@ -838,10 +843,12 @@ const char* cmTarget::GetDirectory(const char* config)
case cmTarget::STATIC_LIBRARY: case cmTarget::STATIC_LIBRARY:
case cmTarget::MODULE_LIBRARY: case cmTarget::MODULE_LIBRARY:
case cmTarget::SHARED_LIBRARY: case cmTarget::SHARED_LIBRARY:
this->Directory = this->Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); this->Directory =
this->Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH");
break; break;
case cmTarget::EXECUTABLE: case cmTarget::EXECUTABLE:
this->Directory = this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); this->Directory =
this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
break; break;
default: default:
return 0; return 0;
@ -963,7 +970,8 @@ const char* cmTarget::GetLinkerLanguage(cmGlobalGenerator* gg)
return linkerLang; return linkerLang;
} }
std::set<cmStdString> languages; std::set<cmStdString> languages;
for(std::vector<cmSourceFile*>::const_iterator i = this->SourceFiles.begin(); for(std::vector<cmSourceFile*>::const_iterator i
= this->SourceFiles.begin();
i != this->SourceFiles.end(); ++i) i != this->SourceFiles.end(); ++i)
{ {
const char* lang = const char* lang =

View File

@ -60,7 +60,8 @@ public:
*/ */
bool IsInAll() { return this->GetPropertyAsBool("IN_ALL"); } bool IsInAll() { return this->GetPropertyAsBool("IN_ALL"); }
bool GetInAll() { return this->GetPropertyAsBool("IN_ALL"); } bool GetInAll() { return this->GetPropertyAsBool("IN_ALL"); }
void SetInAll(bool f) { this->SetProperty("IN_ALL", (f) ?"TRUE" : "FALSE"); } void SetInAll(bool f) {
this->SetProperty("IN_ALL", (f) ?"TRUE" : "FALSE"); }
///! Set the cmMakefile that owns this target ///! Set the cmMakefile that owns this target
void SetMakefile(cmMakefile *mf); void SetMakefile(cmMakefile *mf);
@ -96,7 +97,8 @@ public:
typedef std::vector<std::pair<std::string,LinkLibraryType> > typedef std::vector<std::pair<std::string,LinkLibraryType> >
LinkLibraryVectorType; LinkLibraryVectorType;
const LinkLibraryVectorType &GetLinkLibraries() {return this->LinkLibraries;} const LinkLibraryVectorType &GetLinkLibraries() {
return this->LinkLibraries;}
const LinkLibraryVectorType &GetOriginalLinkLibraries() const LinkLibraryVectorType &GetOriginalLinkLibraries()
{return this->OriginalLinkLibraries;} {return this->OriginalLinkLibraries;}
@ -133,7 +135,8 @@ public:
* installed. This is relative to INSTALL_PREFIX * installed. This is relative to INSTALL_PREFIX
*/ */
std::string GetRuntimeInstallPath() {return this->RuntimeInstallPath;} std::string GetRuntimeInstallPath() {return this->RuntimeInstallPath;}
void SetRuntimeInstallPath(const char *name) {this->RuntimeInstallPath = name;} void SetRuntimeInstallPath(const char *name) {
this->RuntimeInstallPath = name;}
/** /**
* Get/Set whether there is an install rule for this target. * Get/Set whether there is an install rule for this target.
@ -189,7 +192,8 @@ public:
/** Get the full name of the target according to the settings in its /** Get the full name of the target according to the settings in its
makefile. */ makefile. */
std::string GetFullName(const char* config=0, bool implib = false); std::string GetFullName(const char* config=0, bool implib = false);
void GetFullName(std::string& prefix, std::string& base, std::string& suffix, void GetFullName(std::string& prefix,
std::string& base, std::string& suffix,
const char* config=0, bool implib = false); const char* config=0, bool implib = false);
/** Get the full path to the target according to the settings in its /** Get the full path to the target according to the settings in its

View File

@ -43,7 +43,8 @@ bool cmTargetLinkLibrariesCommand::InitialPass(std::vector<std::string>
++i; ++i;
if(i == args.end()) if(i == args.end())
{ {
this->SetError("The \"debug\" argument must be followed by a library"); this->SetError
("The \"debug\" argument must be followed by a library");
return false; return false;
} }
this->Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(), this->Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(),

View File

@ -167,7 +167,8 @@ int cmTryCompileCommand::CoreTryCompileCode(
<< source << "\". TRY_COMPILE only works for enabled languages.\n" << source << "\". TRY_COMPILE only works for enabled languages.\n"
<< "Currently enabled languages are:"; << "Currently enabled languages are:";
std::vector<std::string> langs; std::vector<std::string> langs;
mf->GetCMakeInstance()->GetGlobalGenerator()->GetEnabledLanguages(langs); mf->GetCMakeInstance()->GetGlobalGenerator()->
GetEnabledLanguages(langs);
for(std::vector<std::string>::iterator l = langs.begin(); for(std::vector<std::string>::iterator l = langs.begin();
l != langs.end(); ++l) l != langs.end(); ++l)
{ {

View File

@ -77,16 +77,16 @@ public:
" TRY_COMPILE(RESULT_VAR bindir srcdir\n" " TRY_COMPILE(RESULT_VAR bindir srcdir\n"
" projectName <targetname> <CMAKE_FLAGS <Flags>>\n" " projectName <targetname> <CMAKE_FLAGS <Flags>>\n"
" <OUTPUT_VARIABLE var>)\n" " <OUTPUT_VARIABLE var>)\n"
"Try compiling a program. Return the success or failure in RESULT_VAR. " "Try compiling a program. Return the success or failure in "
"If <target name> is specified then build just that target " "RESULT_VAR. If <target name> is specified then build just that target "
"otherwise the all or ALL_BUILD target is built.\n" "otherwise the all or ALL_BUILD target is built.\n"
" TRY_COMPILE(RESULT_VAR bindir srcfile\n" " TRY_COMPILE(RESULT_VAR bindir srcfile\n"
" <CMAKE_FLAGS <Flags>>\n" " <CMAKE_FLAGS <Flags>>\n"
" <COMPILE_DEFINITIONS <flags> ...>\n" " <COMPILE_DEFINITIONS <flags> ...>\n"
" <OUTPUT_VARIABLE var>)\n" " <OUTPUT_VARIABLE var>)\n"
"Try compiling a srcfile. Return the success or failure in RESULT_VAR. " "Try compiling a srcfile. Return the success or failure in "
"CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE flags to cmake. Some " "RESULT_VAR. CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE flags "
"extra flags that can be included are, " "to cmake. Some extra flags that can be included are, "
"INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and LINK_LIBRARIES. " "INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and LINK_LIBRARIES. "
"COMPILE_DEFINITIONS are -Ddefinition that will be passed to the " "COMPILE_DEFINITIONS are -Ddefinition that will be passed to the "
"compile line. If srcfile is specified the files in " "compile line. If srcfile is specified the files in "
@ -95,7 +95,8 @@ public:
"output from the build process is stored in the given variable. " "output from the build process is stored in the given variable. "
"TRY_COMPILE creates a CMakeList.txt " "TRY_COMPILE creates a CMakeList.txt "
"file on the fly, and in that file it looks like this:\n" "file on the fly, and in that file it looks like this:\n"
" ADD_DEFINITIONS( <expanded COMPILE_DEFINITIONS from calling cmake>)\n" " ADD_DEFINITIONS( <expanded COMPILE_DEFINITIONS from calling "
"cmake>)\n"
" INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n" " INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n"
" LINK_DIRECTORIES(${LINK_DIRECTORIES})\n" " LINK_DIRECTORIES(${LINK_DIRECTORIES})\n"
" ADD_EXECUTABLE(cmTryCompileExec sources)\n" " ADD_EXECUTABLE(cmTryCompileExec sources)\n"

View File

@ -20,7 +20,8 @@
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
// cmUseMangledMesaCommand // cmUseMangledMesaCommand
bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args) bool cmUseMangledMesaCommand
::InitialPass(std::vector<std::string> const& args)
{ {
// expected two arguments: // expected two arguments:
// arguement one: the full path to gl_mangle.h // arguement one: the full path to gl_mangle.h

View File

@ -34,7 +34,8 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args)
// If it exists already and appears up to date then we are done. If // If it exists already and appears up to date then we are done. If
// the string contains "(IntDir)" but that is not the // the string contains "(IntDir)" but that is not the
// CMAKE_CFG_INTDIR setting then the value is out of date. // CMAKE_CFG_INTDIR setting then the value is out of date.
const char* intDir = this->Makefile->GetRequiredDefinition("CMAKE_CFG_INTDIR"); const char* intDir =
this->Makefile->GetRequiredDefinition("CMAKE_CFG_INTDIR");
if(cacheValue && if(cacheValue &&
(strstr(cacheValue, "(IntDir)") == 0 || (strstr(cacheValue, "(IntDir)") == 0 ||
intDir && strcmp(intDir, "$(IntDir)") == 0) && intDir && strcmp(intDir, "$(IntDir)") == 0) &&

View File

@ -238,7 +238,8 @@ cmVTKMakeInstantiatorCommand
// Write the instantiator class definition. // Write the instantiator class definition.
os << os <<
"\n" "\n"
"class " << this->ExportMacro.c_str() << " " << this->ClassName.c_str() << "\n" "class " << this->ExportMacro.c_str()
<< " " << this->ClassName.c_str() << "\n"
"{\n" "{\n"
"public:\n" "public:\n"
" " << this->ClassName.c_str() << "();\n" " " << this->ClassName.c_str() << "();\n"
@ -388,7 +389,8 @@ cmVTKMakeInstantiatorCommand
"\n" "\n"
"class " << this->ClassName.c_str() << "Initialize;\n" "class " << this->ClassName.c_str() << "Initialize;\n"
"\n" "\n"
"class " << this->ExportMacro.c_str() << " " << this->ClassName.c_str() << "\n" "class " << this->ExportMacro.c_str() << " "
<< this->ClassName.c_str() << "\n"
"{\n" "{\n"
" friend class " << this->ClassName.c_str() << "Initialize;\n" " friend class " << this->ClassName.c_str() << "Initialize;\n"
"\n" "\n"
@ -398,7 +400,8 @@ cmVTKMakeInstantiatorCommand
for(unsigned int i=0;i < this->Classes.size();++i) for(unsigned int i=0;i < this->Classes.size();++i)
{ {
os << " static vtkObject* Create_" << this->Classes[i].c_str() << "();\n"; os << " static vtkObject* Create_"
<< this->Classes[i].c_str() << "();\n";
} }
// Write the initializer class to make sure the creation functions // Write the initializer class to make sure the creation functions
@ -425,8 +428,7 @@ cmVTKMakeInstantiatorCommand
// Generates the file with the implementation of the class. All // Generates the file with the implementation of the class. All
// methods except the actual object creation functions are generated // methods except the actual object creation functions are generated
// here. // here.
void void cmVTKMakeInstantiatorCommand
cmVTKMakeInstantiatorCommand
::OldGenerateImplementationFile(std::ostream& os) ::OldGenerateImplementationFile(std::ostream& os)
{ {
// Write the ClassInitialize method to register all the creation functions. // Write the ClassInitialize method to register all the creation functions.
@ -439,7 +441,8 @@ cmVTKMakeInstantiatorCommand
for(unsigned int i=0;i < this->Classes.size();++i) for(unsigned int i=0;i < this->Classes.size();++i)
{ {
os << " vtkInstantiator::RegisterInstantiator(\"" os << " vtkInstantiator::RegisterInstantiator(\""
<< this->Classes[i].c_str() << "\", " << this->ClassName.c_str() << "::Create_" << this->Classes[i].c_str() << "\", "
<< this->ClassName.c_str() << "::Create_"
<< this->Classes[i].c_str() << ");\n"; << this->Classes[i].c_str() << ");\n";
} }
@ -453,7 +456,8 @@ cmVTKMakeInstantiatorCommand
for(unsigned int i=0;i < this->Classes.size();++i) for(unsigned int i=0;i < this->Classes.size();++i)
{ {
os << " vtkInstantiator::UnRegisterInstantiator(\"" os << " vtkInstantiator::UnRegisterInstantiator(\""
<< this->Classes[i].c_str() << "\", " << this->ClassName.c_str() << "::Create_" << this->Classes[i].c_str() << "\", "
<< this->ClassName.c_str() << "::Create_"
<< this->Classes[i].c_str() << ");\n"; << this->Classes[i].c_str() << ");\n";
} }

View File

@ -57,7 +57,8 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& argsIn)
std::ofstream depFile(depFileName.c_str()); std::ofstream depFile(depFileName.c_str());
depFile << "# This file is automatically generated by CMake VTK_WRAP_JAVA" depFile << "# This file is automatically generated by CMake VTK_WRAP_JAVA"
<< std::endl << std::endl; << std::endl << std::endl;
depFile << "SET(VTK_JAVA_DEPENDENCIES ${VTK_JAVA_DEPENDENCIES}" << std::endl; depFile <<
"SET(VTK_JAVA_DEPENDENCIES ${VTK_JAVA_DEPENDENCIES}" << std::endl;
// get the list of classes for this library // get the list of classes for this library
for(std::vector<std::string>::const_iterator j = (args.begin() + 2); for(std::vector<std::string>::const_iterator j = (args.begin() + 2);
@ -75,8 +76,8 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& argsIn)
} }
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j); std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
std::string newName = srcName + "Java"; std::string newName = srcName + "Java";
file.SetName(newName.c_str(), this->Makefile->GetCurrentOutputDirectory(), file.SetName(newName.c_str(),
"cxx",false); this->Makefile->GetCurrentOutputDirectory(), "cxx",false);
std::string hname = cdir + "/" + srcName + ".h"; std::string hname = cdir + "/" + srcName + ".h";
this->WrapHeaders.push_back(hname); this->WrapHeaders.push_back(hname);
// add starting depends // add starting depends
@ -101,7 +102,8 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& argsIn)
// Finalize java dependency file // Finalize java dependency file
depFile << ")" << std::endl; depFile << ")" << std::endl;
this->Makefile->AddDefinition(this->SourceList.c_str(), sourceListValue.c_str()); this->Makefile->AddDefinition(this->SourceList.c_str(),
sourceListValue.c_str());
return true; return true;
} }

View File

@ -76,7 +76,8 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const&
} }
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j); std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
std::string newName = srcName + "Python"; std::string newName = srcName + "Python";
file.SetName(newName.c_str(), this->Makefile->GetCurrentOutputDirectory(), file.SetName(newName.c_str(),
this->Makefile->GetCurrentOutputDirectory(),
"cxx",false); "cxx",false);
std::string hname = cdir + "/" + srcName + ".h"; std::string hname = cdir + "/" + srcName + ".h";
this->WrapHeaders.push_back(hname); this->WrapHeaders.push_back(hname);
@ -94,7 +95,8 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const&
cfile.SetName(initName.c_str(), this->Makefile->GetCurrentOutputDirectory(), cfile.SetName(initName.c_str(), this->Makefile->GetCurrentOutputDirectory(),
"cxx",false); "cxx",false);
this->Makefile->AddSource(cfile); this->Makefile->AddSource(cfile);
this->Makefile->AddDefinition(this->SourceList.c_str(), sourceListValue.c_str()); this->Makefile->AddDefinition(this->SourceList.c_str(),
sourceListValue.c_str());
return true; return true;
} }
@ -196,8 +198,8 @@ bool cmVTKWrapPythonCommand::WriteInit(const char *kitName,
for (i = 0; i < classes.size(); i++) for (i = 0; i < classes.size(); i++)
{ {
#ifdef _WIN32 #ifdef _WIN32
fprintf(fout, fprintf(fout, "extern \"C\" {__declspec( dllexport) "
"extern \"C\" {__declspec( dllexport) PyObject *PyVTKClass_%sNew(char *); }\n",classes[i].c_str()); "PyObject *PyVTKClass_%sNew(char *); }\n", classes[i].c_str());
#else #else
fprintf(fout,"extern \"C\" {PyObject *PyVTKClass_%sNew(char *); }\n", fprintf(fout,"extern \"C\" {PyObject *PyVTKClass_%sNew(char *); }\n",
classes[i].c_str()); classes[i].c_str());
@ -229,8 +231,8 @@ bool cmVTKWrapPythonCommand::WriteInit(const char *kitName,
kitName); kitName);
fprintf(fout," d = PyModule_GetDict(m);\n"); fprintf(fout," d = PyModule_GetDict(m);\n");
fprintf(fout," if (!d) Py_FatalError(\"can't get dictionary for module %s!\");\n\n", fprintf(fout," if (!d) Py_FatalError"
kitName); "(\"can't get dictionary for module %s!\");\n\n", kitName);
for (i = 0; i < classes.size(); i++) for (i = 0; i < classes.size(); i++)
{ {
@ -238,7 +240,8 @@ bool cmVTKWrapPythonCommand::WriteInit(const char *kitName,
classes[i].c_str()); classes[i].c_str());
fprintf(fout," if (-1 == PyDict_SetItemString(d, \"%s\", c))\n", fprintf(fout," if (-1 == PyDict_SetItemString(d, \"%s\", c))\n",
classes[i].c_str()); classes[i].c_str());
fprintf(fout," Py_FatalError(\"can't add class %s to dictionary!\");\n\n", fprintf(fout,
" Py_FatalError(\"can't add class %s to dictionary!\");\n\n",
classes[i].c_str()); classes[i].c_str());
} }
fprintf(fout,"}\n\n"); fprintf(fout,"}\n\n");

View File

@ -84,7 +84,8 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
std::string sourceListValue; std::string sourceListValue;
// was the list already populated // was the list already populated
const char *def = this->Makefile->GetDefinition(this->SourceList.c_str()); const char *def =
this->Makefile->GetDefinition(this->SourceList.c_str());
if (def) if (def)
{ {
sourceListValue = def; sourceListValue = def;
@ -114,7 +115,8 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j); std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
std::string newName = srcName + "Tcl"; std::string newName = srcName + "Tcl";
std::string hname = srcDir + "/" + srcName + ".h"; std::string hname = srcDir + "/" + srcName + ".h";
file.SetName(newName.c_str(), this->Makefile->GetCurrentOutputDirectory(), file.SetName(newName.c_str(),
this->Makefile->GetCurrentOutputDirectory(),
"cxx",false); "cxx",false);
this->WrapHeaders.push_back(hname); this->WrapHeaders.push_back(hname);
// add starting depends // add starting depends
@ -130,10 +132,12 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
std::string newName = this->LibraryName; std::string newName = this->LibraryName;
newName += "Init"; newName += "Init";
this->CreateInitFile(res); this->CreateInitFile(res);
cfile.SetName(newName.c_str(), this->Makefile->GetCurrentOutputDirectory(), cfile.SetName(newName.c_str(),
this->Makefile->GetCurrentOutputDirectory(),
"cxx",false); "cxx",false);
this->Makefile->AddSource(cfile); this->Makefile->AddSource(cfile);
this->Makefile->AddDefinition(this->SourceList.c_str(), sourceListValue.c_str()); this->Makefile->AddDefinition(this->SourceList.c_str(),
sourceListValue.c_str());
} }
return true; return true;
@ -144,7 +148,8 @@ void cmVTKWrapTclCommand::FinalPass()
// first we add the rules for all the .h to Tcl.cxx files // first we add the rules for all the .h to Tcl.cxx files
size_t lastClass = this->WrapClasses.size(); size_t lastClass = this->WrapClasses.size();
std::vector<std::string> depends; std::vector<std::string> depends;
const char* wtcl = this->Makefile->GetRequiredDefinition("VTK_WRAP_TCL_EXE"); const char* wtcl =
this->Makefile->GetRequiredDefinition("VTK_WRAP_TCL_EXE");
const char* hints = this->Makefile->GetDefinition("VTK_WRAP_HINTS"); const char* hints = this->Makefile->GetDefinition("VTK_WRAP_HINTS");
// wrap all the .h files // wrap all the .h files
@ -247,17 +252,22 @@ bool cmVTKWrapTclCommand::WriteInit(const char *kitName,
fprintf(fout, fprintf(fout,
"extern \"C\"\n" "extern \"C\"\n"
"{\n" "{\n"
"#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4) && (TCL_RELEASE_LEVEL >= TCL_FINAL_RELEASE)\n" "#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4) "
" typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp *,int, CONST84 char *[]);\n" "&& (TCL_RELEASE_LEVEL >= TCL_FINAL_RELEASE)\n"
" typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp *,"
"int, CONST84 char *[]);\n"
"#else\n" "#else\n"
" typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp *,int, char *[]);\n" " typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp *,"
"int, char *[]);\n"
"#endif\n" "#endif\n"
"}\n" "}\n"
"\n"); "\n");
for (i = 0; i < classes.size(); i++) for (i = 0; i < classes.size(); i++)
{ {
fprintf(fout,"int %sCommand(ClientData cd, Tcl_Interp *interp,\n int argc, char *argv[]);\n",classes[i].c_str()); fprintf(fout,"int %sCommand(ClientData cd, Tcl_Interp *interp,\n"
,classes[i].c_str());
fprintf(fout," int argc, char *argv[]);\n");
fprintf(fout,"ClientData %sNewCommand();\n",classes[i].c_str()); fprintf(fout,"ClientData %sNewCommand();\n",classes[i].c_str());
} }
@ -280,32 +290,37 @@ bool cmVTKWrapTclCommand::WriteInit(const char *kitName,
fprintf(fout,"extern Tcl_HashTable vtkCommandLookup;\n"); fprintf(fout,"extern Tcl_HashTable vtkCommandLookup;\n");
} }
fprintf(fout,"extern void vtkTclDeleteObjectFromHash(void *);\n"); fprintf(fout,"extern void vtkTclDeleteObjectFromHash(void *);\n");
fprintf(fout,"extern void vtkTclListInstances(Tcl_Interp *interp, ClientData arg);\n"); fprintf(fout,"extern void vtkTclListInstances(Tcl_Interp *interp,"
"ClientData arg);\n");
for (i = 0; i < this->Commands.size(); i++) for (i = 0; i < this->Commands.size(); i++)
{ {
fprintf(fout,"\nextern \"C\" {int VTK_EXPORT %s_Init(Tcl_Interp *interp);}\n", fprintf(fout,
"\nextern \"C\" {int VTK_EXPORT %s_Init(Tcl_Interp *interp);}\n",
capcommands[i].c_str()); capcommands[i].c_str());
} }
fprintf(fout,"\n\nextern \"C\" {int VTK_EXPORT %s_SafeInit(Tcl_Interp *interp);}\n", fprintf(fout,"\n\nextern \"C\" {int VTK_EXPORT "
kitName); "%s_SafeInit(Tcl_Interp *interp);}\n", kitName);
fprintf(fout,"\nextern \"C\" {int VTK_EXPORT %s_Init(Tcl_Interp *interp);}\n", fprintf(fout,"\nextern \"C\" {int VTK_EXPORT %s_Init"
kitName); "(Tcl_Interp *interp);}\n", kitName);
/* create an extern ref to the generic delete function */ /* create an extern ref to the generic delete function */
fprintf(fout,"\nextern void vtkTclGenericDeleteObject(ClientData cd);\n"); fprintf(fout,"\nextern void vtkTclGenericDeleteObject(ClientData cd);\n");
if (!strcmp(kitName,"Vtkcommontcl")) if (!strcmp(kitName,"Vtkcommontcl"))
{ {
fprintf(fout,"extern \"C\"\n{\nvoid vtkCommonDeleteAssocData(ClientData cd)\n"); fprintf(fout,"extern \"C\"\n{\nvoid "
"vtkCommonDeleteAssocData(ClientData cd)\n");
fprintf(fout," {\n"); fprintf(fout," {\n");
fprintf(fout," vtkTclInterpStruct *tis = static_cast<vtkTclInterpStruct*>(cd);\n"); fprintf(fout," vtkTclInterpStruct *tis = "
"static_cast<vtkTclInterpStruct*>(cd);\n");
fprintf(fout," delete tis;\n }\n}\n"); fprintf(fout," delete tis;\n }\n}\n");
} }
/* the main declaration */ /* the main declaration */
fprintf(fout,"\n\nint VTK_EXPORT %s_SafeInit(Tcl_Interp *interp)\n{\n",kitName); fprintf(fout,
"\n\nint VTK_EXPORT %s_SafeInit(Tcl_Interp *interp)\n{\n",kitName);
fprintf(fout," return %s_Init(interp);\n}\n",kitName); fprintf(fout," return %s_Init(interp);\n}\n",kitName);
fprintf(fout,"\n\nint VTK_EXPORT %s_Init(Tcl_Interp *interp)\n{\n", fprintf(fout,"\n\nint VTK_EXPORT %s_Init(Tcl_Interp *interp)\n{\n",
@ -324,14 +339,16 @@ bool cmVTKWrapTclCommand::WriteInit(const char *kitName,
" Tcl_InitHashTable(&info->PointerLookup, TCL_STRING_KEYS);\n"); " Tcl_InitHashTable(&info->PointerLookup, TCL_STRING_KEYS);\n");
fprintf(fout, fprintf(fout,
" Tcl_InitHashTable(&info->CommandLookup, TCL_STRING_KEYS);\n"); " Tcl_InitHashTable(&info->CommandLookup, TCL_STRING_KEYS);\n");
fprintf(fout, fprintf(fout, " Tcl_SetAssocData(interp,(char *) "
" Tcl_SetAssocData(interp,(char *) \"vtk\",NULL,(ClientData *)info);\n"); "\"vtk\",NULL,(ClientData *)info);\n");
fprintf(fout, fprintf(fout, " Tcl_CreateExitHandler(vtkCommonDeleteAssocData"
" Tcl_CreateExitHandler(vtkCommonDeleteAssocData,(ClientData *)info);\n"); ",(ClientData *)info);\n");
/* create special vtkCommand command */ /* create special vtkCommand command */
fprintf(fout," Tcl_CreateCommand(interp,(char *) \"vtkCommand\",\n" fprintf(fout,
" reinterpret_cast<vtkTclCommandType>(vtkCommandForward),\n" " Tcl_CreateCommand(interp,(char *) \"vtkCommand\",\n"
" reinterpret_cast<vtkTclCommandType>("
"vtkCommandForward),\n"
" (ClientData *)NULL, NULL);\n\n"); " (ClientData *)NULL, NULL);\n\n");
} }

View File

@ -135,8 +135,10 @@ public:
* will display it in our app. Consequently, we check for input in * will display it in our app. Consequently, we check for input in
* our app and send it off to the write end of the stdin pipe. * our app and send it off to the write end of the stdin pipe.
*/ */
static bool BorlandRunCommand(const char* command, const char* dir, static bool BorlandRunCommand(const char* command,
std::string& output, int& retVal, bool verbose, const char* dir,
std::string& output, int& retVal,
bool verbose,
int timeout, bool hideWindows); int timeout, bool hideWindows);
private: private:

View File

@ -83,7 +83,8 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args)
} }
// If GetPermissions fails, pretend like it is ok. File open will fail if // If GetPermissions fails, pretend like it is ok. File open will fail if
// the file is not writable // the file is not writable
std::ofstream file(fileName.c_str(), overwrite?std::ios::out : std::ios::app); std::ofstream file(fileName.c_str(),
overwrite?std::ios::out : std::ios::app);
if ( !file ) if ( !file )
{ {
std::string error = "Internal CMake error when trying to open file: "; std::string error = "Internal CMake error when trying to open file: ";