2005-01-21 17:38:04 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#ifndef cmWhileCommand_h
|
|
|
|
#define cmWhileCommand_h
|
|
|
|
|
|
|
|
#include "cmCommand.h"
|
|
|
|
#include "cmFunctionBlocker.h"
|
|
|
|
#include "cmListFileCache.h"
|
|
|
|
|
|
|
|
/** \class cmWhileFunctionBlocker
|
|
|
|
* \brief subclass of function blocker
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class cmWhileFunctionBlocker : public cmFunctionBlocker
|
|
|
|
{
|
|
|
|
public:
|
2006-05-18 21:50:01 +04:00
|
|
|
cmWhileFunctionBlocker() {Executing = false; Depth=0;}
|
2005-01-21 17:38:04 +03:00
|
|
|
virtual ~cmWhileFunctionBlocker() {}
|
|
|
|
virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
|
|
|
|
cmMakefile &mf);
|
|
|
|
virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
|
|
|
|
virtual void ScopeEnded(cmMakefile &mf);
|
|
|
|
|
2006-03-15 19:02:08 +03:00
|
|
|
std::vector<cmListFileArgument> Args;
|
|
|
|
std::vector<cmListFileFunction> Functions;
|
|
|
|
bool Executing;
|
2006-05-18 21:50:01 +04:00
|
|
|
private:
|
|
|
|
int Depth;
|
2005-01-21 17:38:04 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/** \class cmWhileCommand
|
|
|
|
* \brief starts a while loop
|
|
|
|
*
|
|
|
|
* cmWhileCommand starts a while loop
|
|
|
|
*/
|
|
|
|
class cmWhileCommand : public cmCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* This is a virtual constructor for the command.
|
|
|
|
*/
|
|
|
|
virtual cmCommand* Clone()
|
|
|
|
{
|
|
|
|
return new cmWhileCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This overrides the default InvokeInitialPass implementation.
|
|
|
|
* It records the arguments before expansion.
|
|
|
|
*/
|
|
|
|
virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is called when the command is first encountered in
|
|
|
|
* the CMakeLists.txt file.
|
|
|
|
*/
|
|
|
|
virtual bool InitialPass(std::vector<std::string> const&) { return false; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This determines if the command is invoked when in script mode.
|
|
|
|
*/
|
|
|
|
virtual bool IsScriptable() { return true; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the command as specified in CMakeList.txt.
|
|
|
|
*/
|
2007-10-10 19:47:43 +04:00
|
|
|
virtual const char* GetName() { return "while";}
|
2005-01-21 17:38:04 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Succinct documentation.
|
|
|
|
*/
|
|
|
|
virtual const char* GetTerseDocumentation()
|
|
|
|
{
|
|
|
|
return "Evaluate a group of commands while a condition is true";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* More documentation.
|
|
|
|
*/
|
|
|
|
virtual const char* GetFullDocumentation()
|
|
|
|
{
|
|
|
|
return
|
2007-10-10 19:47:43 +04:00
|
|
|
" while(condition)\n"
|
2005-01-21 17:38:04 +03:00
|
|
|
" COMMAND1(ARGS ...)\n"
|
|
|
|
" COMMAND2(ARGS ...)\n"
|
|
|
|
" ...\n"
|
2007-10-10 19:47:43 +04:00
|
|
|
" endwhile(condition)\n"
|
|
|
|
"All commands between while and the matching endwhile are recorded "
|
|
|
|
"without being invoked. Once the endwhile is evaluated, the "
|
2005-01-21 17:38:04 +03:00
|
|
|
"recorded list of commands is invoked as long as the condition "
|
2008-01-10 06:09:19 +03:00
|
|
|
"is true. The condition is evaluated using the same logic as the "
|
2007-10-15 22:50:18 +04:00
|
|
|
"if command.";
|
2005-01-21 17:38:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
cmTypeMacro(cmWhileCommand, cmCommand);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|