[cmake-commits] martink committed cmBreakCommand.cxx NONE 1.1 cmBreakCommand.h NONE 1.1 cmExecutionStatus.h NONE 1.1 cmReturnCommand.cxx NONE 1.1 cmReturnCommand.h NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jan 23 10:28:29 EST 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv30376

Added Files:
	cmBreakCommand.cxx cmBreakCommand.h cmExecutionStatus.h 
	cmReturnCommand.cxx cmReturnCommand.h 
Log Message:
ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class


--- NEW FILE: cmBreakCommand.h ---
/*=========================================================================

  Program:   CMake - Cross-Platform Makefile Generator
  Module:    $RCSfile: cmBreakCommand.h,v $
  Language:  C++
  Date:      $Date: 2008/01/23 15:28:26 $
  Version:   $Revision: 1.1 $

  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 cmBreakCommand_h
#define cmBreakCommand_h

#include "cmCommand.h"

/** \class cmBreakCommand
 * \brief Break from an enclosing foreach or while loop
 *
 * cmBreakCommand returns from an enclosing foreach or while loop
 */
class cmBreakCommand : public cmCommand
{
public:
  /**
   * This is a virtual constructor for the command.
   */
  virtual cmCommand* Clone() 
    {
    return new cmBreakCommand;
    }

  /**
   * This is called when the command is first encountered in
   * the CMakeLists.txt file.
   */
  virtual bool InitialPass(std::vector<std::string> const& args,
                           cmExecutionStatus &status);

  /**
   * 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.
   */
  virtual const char* GetName() {return "break";}
  
  /**
   * Succinct documentation.
   */
  virtual const char* GetTerseDocumentation() 
    {
    return "Break from an enclosing foreach or while loop.";
    }
  
  /**
   * More documentation.
   */
  virtual const char* GetFullDocumentation()
    {
    return
      "  break()\n"
      "Breaks from an enclosing foreach loop or while loop";
    }
  
  cmTypeMacro(cmBreakCommand, cmCommand);
};



#endif

--- NEW FILE: cmBreakCommand.cxx ---
/*=========================================================================

  Program:   CMake - Cross-Platform Makefile Generator
  Module:    $RCSfile: cmBreakCommand.cxx,v $
  Language:  C++
  Date:      $Date: 2008/01/23 15:28:26 $
  Version:   $Revision: 1.1 $

  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.

=========================================================================*/
#include "cmBreakCommand.h"

// cmBreakCommand
bool cmBreakCommand::InitialPass(std::vector<std::string> const&,
                                  cmExecutionStatus &status)
{
  status.SetBreakInvoked(true);
  return true;
}


--- NEW FILE: cmExecutionStatus.h ---
/*=========================================================================

  Program:   CMake - Cross-Platform Makefile Generator
  Module:    $RCSfile: cmExecutionStatus.h,v $
  Language:  C++
  Date:      $Date: 2008/01/23 15:28:26 $
  Version:   $Revision: 1.1 $

  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 cmExecutionStatus_h
#define cmExecutionStatus_h

#include "cmObject.h"

/** \class cmExecutionStatus
 * \brief Superclass for all command status classes
 *
 * when a command is involked it may set values on a command status instance
 */
class cmExecutionStatus : public cmObject
{
public:
  cmTypeMacro(cmExecutionStatus, cmObject);
  
  cmExecutionStatus() { this->Clear();};
  
  virtual void SetReturnInvoked(bool val) 
  { this->ReturnInvoked = val; }
  virtual bool GetReturnInvoked()
  { return this->ReturnInvoked; }
                                 
  virtual void SetBreakInvoked(bool val) 
  { this->BreakInvoked = val; }
  virtual bool GetBreakInvoked()
  { return this->BreakInvoked; }
            
  virtual void Clear()
  { this->ReturnInvoked = false; this->BreakInvoked = false; }

                                        
protected:
  bool ReturnInvoked;
  bool BreakInvoked;
};

#endif

--- NEW FILE: cmReturnCommand.h ---
/*=========================================================================

  Program:   CMake - Cross-Platform Makefile Generator
  Module:    $RCSfile: cmReturnCommand.h,v $
  Language:  C++
  Date:      $Date: 2008/01/23 15:28:26 $
  Version:   $Revision: 1.1 $

  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 cmReturnCommand_h
#define cmReturnCommand_h

#include "cmCommand.h"

/** \class cmReturnCommand
 * \brief Return from a directory or function
 *
 * cmReturnCommand returns from a directory or function
 */
class cmReturnCommand : public cmCommand
{
public:
  /**
   * This is a virtual constructor for the command.
   */
  virtual cmCommand* Clone() 
    {
    return new cmReturnCommand;
    }

  /**
   * This is called when the command is first encountered in
   * the CMakeLists.txt file.
   */
  virtual bool InitialPass(std::vector<std::string> const& args,
                           cmExecutionStatus &status);

  /**
   * 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.
   */
  virtual const char* GetName() {return "return";}
  
  /**
   * Succinct documentation.
   */
  virtual const char* GetTerseDocumentation() 
    {
    return "Return from a directory or function.";
    }
  
  /**
   * More documentation.
   */
  virtual const char* GetFullDocumentation()
    {
    return
      "  return()\n"
      "Returns from a directory or function. When this command is "
      "encountered, it caused process of the current function or "
      "directory to stop and control is return to the caller of the "
      "function, or the parent directory if any. Note that a macro "
      "is not a function and does not handle return liek a function does.";
    }
  
  cmTypeMacro(cmReturnCommand, cmCommand);
};



#endif

--- NEW FILE: cmReturnCommand.cxx ---
/*=========================================================================

  Program:   CMake - Cross-Platform Makefile Generator
  Module:    $RCSfile: cmReturnCommand.cxx,v $
  Language:  C++
  Date:      $Date: 2008/01/23 15:28:26 $
  Version:   $Revision: 1.1 $

  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.

=========================================================================*/
#include "cmReturnCommand.h"

// cmReturnCommand
bool cmReturnCommand::InitialPass(std::vector<std::string> const&,
                                  cmExecutionStatus &status)
{
  status.SetReturnInvoked(true);
  return true;
}




More information about the Cmake-commits mailing list