cleaned up API

This commit is contained in:
Ken Martin 2002-09-23 14:57:24 -04:00
parent d59d94ff6a
commit bafeb69742
2 changed files with 3 additions and 17 deletions

View File

@ -172,7 +172,6 @@ define the different types of compiles a library may be
Finally we define the key data structures and function prototypes Finally we define the key data structures and function prototypes
=========================================================================*/ =========================================================================*/
typedef const char* (*CM_DOC_FUNCTION)(); typedef const char* (*CM_DOC_FUNCTION)();
typedef const char* (*CM_NAME_FUNCTION)();
typedef int (*CM_INITIAL_PASS_FUNCTION)(void *info, void *mf, typedef int (*CM_INITIAL_PASS_FUNCTION)(void *info, void *mf,
int argc, char *[]); int argc, char *[]);
typedef void (*CM_FINAL_PASS_FUNCTION)(void *info, void *mf); typedef void (*CM_FINAL_PASS_FUNCTION)(void *info, void *mf);
@ -188,6 +187,7 @@ Finally we define the key data structures and function prototypes
CM_DESTRUCTOR_FUNCTION Destructor; CM_DESTRUCTOR_FUNCTION Destructor;
CM_DOC_FUNCTION GetTerseDocumentation; CM_DOC_FUNCTION GetTerseDocumentation;
CM_DOC_FUNCTION GetFullDocumentation; CM_DOC_FUNCTION GetFullDocumentation;
const char *Name;
void *ClientData; void *ClientData;
} cmLoadedCommandInfo; } cmLoadedCommandInfo;

View File

@ -38,7 +38,6 @@ public:
{ {
cmLoadedCommand *newC = new cmLoadedCommand; cmLoadedCommand *newC = new cmLoadedCommand;
// we must copy when we clone // we must copy when we clone
newC->m_commandName = this->m_commandName;
memcpy(&newC->info,&this->info,sizeof(info)); memcpy(&newC->info,&this->info,sizeof(info));
return newC; return newC;
} }
@ -68,9 +67,7 @@ public:
/** /**
* The name of the command as specified in CMakeList.txt. * The name of the command as specified in CMakeList.txt.
*/ */
virtual const char* GetName() { virtual const char* GetName() { return info.Name; }
return m_commandName.c_str();
}
/** /**
* Succinct documentation. * Succinct documentation.
@ -105,7 +102,6 @@ public:
cmTypeMacro(cmLoadedCommand, cmCommand); cmTypeMacro(cmLoadedCommand, cmCommand);
cmLoadedCommandInfo info; cmLoadedCommandInfo info;
std::string m_commandName;
}; };
bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args) bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args)
@ -193,15 +189,6 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& argsIn)
{ {
// Look for the symbol cmLoad, cmGetFactoryCompilerUsed, // Look for the symbol cmLoad, cmGetFactoryCompilerUsed,
// and cmGetFactoryVersion in the library // and cmGetFactoryVersion in the library
CM_NAME_FUNCTION nameFunction
= (CM_NAME_FUNCTION)
cmDynamicLoader::GetSymbolAddress(lib, "cmGetName");
if ( !nameFunction )
{
nameFunction =
(CM_NAME_FUNCTION)(
cmDynamicLoader::GetSymbolAddress(lib, "_cmGetName"));
}
CM_INIT_FUNCTION initFunction CM_INIT_FUNCTION initFunction
= (CM_INIT_FUNCTION) = (CM_INIT_FUNCTION)
cmDynamicLoader::GetSymbolAddress(lib, "cmInitializeCommand"); cmDynamicLoader::GetSymbolAddress(lib, "cmInitializeCommand");
@ -213,11 +200,10 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& argsIn)
} }
// if the symbol is found call it to set the name on the // if the symbol is found call it to set the name on the
// function blocker // function blocker
if(nameFunction) if(initFunction)
{ {
// create a function blocker and set it up // create a function blocker and set it up
cmLoadedCommand *f = new cmLoadedCommand(); cmLoadedCommand *f = new cmLoadedCommand();
f->m_commandName = (*nameFunction)();
if (!initFunction) if (!initFunction)
{ {
this->SetError("Attempt to load command failed. " this->SetError("Attempt to load command failed. "