[Cmake-commits] [cmake-commits] martink committed cmDocumentation.cxx 1.67 1.68 cmDocumentation.h 1.32 1.33 cmDocumentationFormatter.h 1.6 1.7 cmPolicies.cxx 1.4 1.5 cmPolicies.h 1.5 1.6 cmake.cxx 1.362 1.363 cmake.h 1.101 1.102 cmakemain.cxx 1.77 1.78

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Mar 4 09:16:35 EST 2008


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

Modified Files:
	cmDocumentation.cxx cmDocumentation.h 
	cmDocumentationFormatter.h cmPolicies.cxx cmPolicies.h 
	cmake.cxx cmake.h cmakemain.cxx 
Log Message:
ENH: add --help-policies and --help-policy command line options


Index: cmDocumentation.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentation.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C 2 -d -r1.32 -r1.33
*** cmDocumentation.h	19 Feb 2008 19:33:43 -0000	1.32
--- cmDocumentation.h	4 Mar 2008 14:16:33 -0000	1.33
***************
*** 139,142 ****
--- 139,143 ----
    bool PrintDocumentationSingleModule(std::ostream& os);
    bool PrintDocumentationSingleProperty(std::ostream& os);
+   bool PrintDocumentationSinglePolicy(std::ostream& os);
    bool PrintDocumentationSingleVariable(std::ostream& os);
    bool PrintDocumentationUsage(std::ostream& os);
***************
*** 144,147 ****
--- 145,149 ----
    bool PrintDocumentationModules(std::ostream& os);
    bool PrintDocumentationCustomModules(std::ostream& os);
+   bool PrintDocumentationPolicies(std::ostream& os);
    bool PrintDocumentationProperties(std::ostream& os);
    bool PrintDocumentationVariables(std::ostream& os);

Index: cmPolicies.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPolicies.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C 2 -d -r1.5 -r1.6
*** cmPolicies.h	2 Mar 2008 14:12:27 -0000	1.5
--- cmPolicies.h	4 Mar 2008 14:16:33 -0000	1.6
***************
*** 78,81 ****
--- 78,84 ----
    std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
  
+   ///! Get docs for policies
+   void GetDocumentation(std::vector<cmDocumentationEntry>& v);
+ 
    private:
    // might have to make these internal for VS6 not sure yet

Index: cmPolicies.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPolicies.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -C 2 -d -r1.4 -r1.5
*** cmPolicies.cxx	2 Mar 2008 14:03:33 -0000	1.4
--- cmPolicies.cxx	4 Mar 2008 14:16:33 -0000	1.5
***************
*** 410,411 ****
--- 410,431 ----
  }
  
+ void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v)
+ {
+   // now loop over all the policies and set them as appropriate
+   std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i 
+     = this->Policies.begin();
+   for (;i != this->Policies.end(); ++i)
+   {
+     std::string full;
+     full += i->second->LongDescription;
+     // add in some more text here based on status
+     // switch (i->second->Status)
+     // {
+       // case cmPolicies::WARN:
+           
+     cmDocumentationEntry e(i->second->IDString.c_str(),
+                            i->second->ShortDescription.c_str(),
+                            full.c_str());
+     v.push_back(e);
+   }
+ }

Index: cmake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.h,v
retrieving revision 1.101
retrieving revision 1.102
diff -C 2 -d -r1.101 -r1.102
*** cmake.h	1 Mar 2008 20:20:35 -0000	1.101
--- cmake.h	4 Mar 2008 14:16:33 -0000	1.102
***************
*** 259,262 ****
--- 259,263 ----
                                    cmDocumentationSection *>&);
    void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&);
+   void GetPolicyDocumentation(std::vector<cmDocumentationEntry>& entries);
  
    ///! Set/Get a property of this target file

Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.362
retrieving revision 1.363
diff -C 2 -d -r1.362 -r1.363
*** cmake.cxx	1 Mar 2008 20:20:35 -0000	1.362
--- cmake.cxx	4 Mar 2008 14:16:33 -0000	1.363
***************
*** 2445,2448 ****
--- 2445,2453 ----
  }
  
+ void cmake::GetPolicyDocumentation(std::vector<cmDocumentationEntry>& v)
+ {
+   this->Policies->GetDocumentation(v);
+ }
+ 
  void cmake::GetPropertiesDocumentation(std::map<std::string,
                                         cmDocumentationSection *>& v)

Index: cmDocumentation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentation.cxx,v
retrieving revision 1.67
retrieving revision 1.68
diff -C 2 -d -r1.67 -r1.68
*** cmDocumentation.cxx	19 Feb 2008 19:33:43 -0000	1.67
--- cmDocumentation.cxx	4 Mar 2008 14:16:33 -0000	1.68
***************
*** 339,342 ****
--- 339,344 ----
      case cmDocumentation::SingleModule:
        return this->PrintDocumentationSingleModule(os);
+     case cmDocumentation::SinglePolicy:
+       return this->PrintDocumentationSinglePolicy(os);
      case cmDocumentation::SingleProperty:
        return this->PrintDocumentationSingleProperty(os);
***************
*** 382,385 ****
--- 384,389 ----
      case cmDocumentation::CustomModules: 
        return this->PrintDocumentationCustomModules(os);
+     case cmDocumentation::Policies: 
+       return this->PrintDocumentationPolicies(os);
      case cmDocumentation::Properties: 
        return this->PrintDocumentationProperties(os);
***************
*** 695,698 ****
--- 699,708 ----
        help.HelpForm = this->GetFormFromFilename(help.Filename);
        }
+     else if(strcmp(argv[i], "--help-policies") == 0)
+       {
+       help.HelpType = cmDocumentation::Policies;
+       GET_OPT_ARGUMENT(help.Filename);
+       help.HelpForm = this->GetFormFromFilename(help.Filename);
+       }
      else if(strcmp(argv[i], "--help-variables") == 0)
        {
***************
*** 765,768 ****
--- 775,785 ----
        help.HelpForm = this->GetFormFromFilename(help.Filename);
        }
+     else if(strcmp(argv[i], "--help-policy") == 0)
+       {
+       help.HelpType = cmDocumentation::SinglePolicy;
+       GET_OPT_ARGUMENT(help.Argument);
+       GET_OPT_ARGUMENT(help.Filename);
+       help.HelpForm = this->GetFormFromFilename(help.Filename);
+       }
      else if(strcmp(argv[i], "--help-variable") == 0)
        {
***************
*** 1134,1137 ****
--- 1151,1168 ----
  
  //----------------------------------------------------------------------------
+ bool cmDocumentation::PrintDocumentationSinglePolicy(std::ostream& os)
+ {
+   if (this->PrintDocumentationGeneric(os,"Policies"))
+     {
+     return true;
+     }
+ 
+   // Argument was not a command.  Complain.
+   os << "Argument \"" << this->CurrentArgument.c_str()
+      << "\" to --help-policy is not a CMake policy.\n";
+   return false;
+ }
+ 
+ //----------------------------------------------------------------------------
  bool cmDocumentation::PrintDocumentationSingleVariable(std::ostream& os)
  {
***************
*** 1234,1237 ****
--- 1265,1283 ----
  
  //----------------------------------------------------------------------------
+ bool cmDocumentation::PrintDocumentationPolicies(std::ostream& os)
+ {
+   this->ClearSections();
+   this->AddSectionToPrint("Description");
+   this->AddSectionToPrint("Policies");
+   this->AddSectionToPrint("Copyright");
+   this->AddSectionToPrint("See Also");
+ 
+   this->CurrentFormatter->PrintHeader(this->GetNameString(), os);
+   this->Print(os);
+   this->CurrentFormatter->PrintFooter(os);
+   return true;
+ }
+ 
+ //----------------------------------------------------------------------------
  bool cmDocumentation::PrintDocumentationProperties(std::ostream& os)
  {

Index: cmakemain.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmakemain.cxx,v
retrieving revision 1.77
retrieving revision 1.78
diff -C 2 -d -r1.77 -r1.78
*** cmakemain.cxx	19 Feb 2008 19:33:43 -0000	1.77
--- cmakemain.cxx	4 Mar 2008 14:16:33 -0000	1.78
***************
*** 325,332 ****
--- 325,334 ----
  
      std::vector<cmDocumentationEntry> commands;
+     std::vector<cmDocumentationEntry> policies;
      std::vector<cmDocumentationEntry> compatCommands;
      std::vector<cmDocumentationEntry> generators;
      std::map<std::string,cmDocumentationSection *> propDocs;
  
+     hcm.GetPolicyDocumentation(policies);
      hcm.GetCommandDocumentation(commands, true, false);
      hcm.GetCommandDocumentation(compatCommands, false, true);
***************
*** 341,344 ****
--- 343,347 ----
      doc.PrependSection("Options",cmDocumentationOptions);
      doc.SetSection("Commands",commands);
+     doc.SetSection("Policies",policies);
      doc.AppendSection("Compatibility Commands",compatCommands);
      doc.SetSections(propDocs);

Index: cmDocumentationFormatter.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentationFormatter.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmDocumentationFormatter.h	19 Feb 2008 19:33:43 -0000	1.6
--- cmDocumentationFormatter.h	4 Mar 2008 14:16:33 -0000	1.7
***************
*** 34,38 ****
      List, ModuleList, PropertyList, VariableList,
      Full, Properties, Variables, Modules, CustomModules, Commands, 
!     CompatCommands, Copyright, Version };
  
    /** Forms of documentation output.  */
--- 34,38 ----
      List, ModuleList, PropertyList, VariableList,
      Full, Properties, Variables, Modules, CustomModules, Commands, 
!     CompatCommands, Copyright, Version, Policies, SinglePolicy };
  
    /** Forms of documentation output.  */



More information about the Cmake-commits mailing list