2003-02-14 18:53:37 +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.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#include "cmDocumentation.h"
|
|
|
|
|
|
|
|
#include "cmSystemTools.h"
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
static const cmDocumentationEntry cmDocumentationStandardOptions[] =
|
|
|
|
{
|
|
|
|
{"--copyright", "Print the CMake copyright and exit.", 0},
|
2003-02-17 17:42:13 +03:00
|
|
|
{"--help", "Print usage information and exit.",
|
2003-02-14 18:53:37 +03:00
|
|
|
"Usage describes the basic command line interface and its options."},
|
2003-02-17 17:42:13 +03:00
|
|
|
{"--help-full", "Print full help and exit.",
|
2003-02-14 18:53:37 +03:00
|
|
|
"Full help displays most of the documentation provided by the UNIX "
|
|
|
|
"man page. It is provided for use on non-UNIX platforms, but is "
|
|
|
|
"also convenient if the man page is not installed."},
|
|
|
|
{"--help-html", "Print full help in HTML format.",
|
|
|
|
"This option is used by CMake authors to help produce web pages."},
|
2003-02-17 17:56:41 +03:00
|
|
|
{"--help-man", "Print a UNIX man page and exit.",
|
2003-02-14 18:53:37 +03:00
|
|
|
"This option is used by CMake authors to generate the UNIX man page."},
|
|
|
|
{"--version", "Show program name/version banner and exit.", 0},
|
|
|
|
{0,0,0}
|
|
|
|
};
|
|
|
|
|
2003-02-17 17:42:13 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
static const cmDocumentationEntry cmDocumentationCommandsHeader[] =
|
|
|
|
{
|
|
|
|
{0,
|
|
|
|
"The following commands are available in CMakeLists.txt code:", 0},
|
|
|
|
{0,0,0}
|
|
|
|
};
|
|
|
|
|
2003-07-08 05:52:10 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
static const cmDocumentationEntry cmDocumentationGeneratorsHeader[] =
|
|
|
|
{
|
|
|
|
{0,
|
|
|
|
"The following generators are available on this platform:", 0},
|
|
|
|
{0,0,0}
|
|
|
|
};
|
|
|
|
|
2003-02-17 17:56:41 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
const cmDocumentationEntry cmDocumentationMailingList[] =
|
|
|
|
{
|
|
|
|
{0,
|
|
|
|
"For help and discussion about using cmake, a mailing list is provided "
|
2003-02-19 04:42:02 +03:00
|
|
|
"at cmake@www.cmake.org. Please first read the full documentation at "
|
2003-02-17 17:56:41 +03:00
|
|
|
"http://www.cmake.org before posting questions to the list.", 0},
|
|
|
|
{0,0,0}
|
|
|
|
};
|
|
|
|
|
2003-02-19 04:42:02 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
const cmDocumentationEntry cmDocumentationAuthor[] =
|
|
|
|
{
|
|
|
|
{0,
|
|
|
|
"This manual page was generated by \"cmake --help-man\".", 0},
|
|
|
|
{0,0,0}
|
|
|
|
};
|
|
|
|
|
2003-02-14 18:53:37 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
const cmDocumentationEntry cmDocumentationCopyright[] =
|
|
|
|
{
|
|
|
|
{0,
|
2003-02-19 04:42:02 +03:00
|
|
|
"Copyright (c) 2002 Kitware, Inc., Insight Consortium. "
|
|
|
|
"All rights reserved.", 0},
|
2003-02-14 18:53:37 +03:00
|
|
|
{0,
|
|
|
|
"Redistribution and use in source and binary forms, with or without "
|
|
|
|
"modification, are permitted provided that the following conditions are "
|
2003-02-19 04:42:02 +03:00
|
|
|
"met:", 0},
|
|
|
|
{"",
|
2003-02-14 18:53:37 +03:00
|
|
|
"Redistributions of source code must retain the above copyright notice, "
|
2003-02-19 04:42:02 +03:00
|
|
|
"this list of conditions and the following disclaimer.", 0},
|
|
|
|
{"",
|
2003-02-14 18:53:37 +03:00
|
|
|
"Redistributions in binary form must reproduce the above copyright "
|
|
|
|
"notice, this list of conditions and the following disclaimer in the "
|
2003-02-19 04:42:02 +03:00
|
|
|
"documentation and/or other materials provided with the distribution.",
|
2003-02-14 18:53:37 +03:00
|
|
|
0},
|
2003-02-19 04:42:02 +03:00
|
|
|
{"",
|
2003-02-14 18:53:37 +03:00
|
|
|
"The names of Kitware, Inc., the Insight Consortium, or the names of "
|
|
|
|
"any consortium members, or of any contributors, may not be used to "
|
|
|
|
"endorse or promote products derived from this software without "
|
2003-02-19 04:42:02 +03:00
|
|
|
"specific prior written permission.", 0},
|
|
|
|
{"",
|
2003-02-14 18:53:37 +03:00
|
|
|
"Modified source versions must be plainly marked as such, and must "
|
2003-02-19 04:42:02 +03:00
|
|
|
"not be misrepresented as being the original software.", 0},
|
2003-02-14 18:53:37 +03:00
|
|
|
{0,
|
|
|
|
"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "
|
|
|
|
"``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "
|
|
|
|
"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR "
|
|
|
|
"A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR "
|
|
|
|
"CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, "
|
|
|
|
"EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, "
|
|
|
|
"PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR "
|
|
|
|
"PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF "
|
|
|
|
"LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING "
|
|
|
|
"NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS "
|
2003-02-19 04:42:02 +03:00
|
|
|
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", 0},
|
2003-02-14 18:53:37 +03:00
|
|
|
{0, 0, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
cmDocumentation::cmDocumentation()
|
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->CurrentForm = TextForm;
|
|
|
|
this->TextIndent = "";
|
|
|
|
this->TextWidth = 77;
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintCopyright(std::ostream& os)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-07-08 07:20:30 +04:00
|
|
|
os << "CMake version " CMake_VERSION_FULL "\n";
|
2003-02-19 04:42:02 +03:00
|
|
|
for(const cmDocumentationEntry* op = cmDocumentationCopyright;
|
|
|
|
op->brief; ++op)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
|
|
|
if(op->name)
|
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
os << " * ";
|
|
|
|
this->TextIndent = " ";
|
|
|
|
this->PrintColumn(os, op->brief);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->TextIndent = "";
|
|
|
|
this->PrintColumn(os, op->brief);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
os << "\n";
|
|
|
|
}
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintVersion(std::ostream& os)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-07-08 07:20:30 +04:00
|
|
|
os << "CMake version " CMake_VERSION_FULL "\n";
|
2003-02-19 04:42:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::AddSection(const char* name,
|
|
|
|
const cmDocumentationEntry* d)
|
|
|
|
{
|
|
|
|
this->Names.push_back(name);
|
|
|
|
this->Sections.push_back(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::ClearSections()
|
|
|
|
{
|
|
|
|
this->Names.erase(this->Names.begin(), this->Names.end());
|
|
|
|
this->Sections.erase(this->Sections.begin(), this->Sections.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
|
|
|
|
{
|
|
|
|
switch (ht)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
case cmDocumentation::Usage: this->PrintDocumentationUsage(os); break;
|
|
|
|
case cmDocumentation::Full: this->PrintDocumentationFull(os); break;
|
|
|
|
case cmDocumentation::HTML: this->PrintDocumentationHTML(os); break;
|
|
|
|
case cmDocumentation::Man: this->PrintDocumentationMan(os); break;
|
|
|
|
case cmDocumentation::Copyright: this->PrintCopyright(os); break;
|
|
|
|
case cmDocumentation::Version: this->PrintVersion(os); break;
|
|
|
|
default: break;
|
|
|
|
}
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-07-08 06:44:18 +04:00
|
|
|
bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
|
|
|
|
{
|
|
|
|
bool result = true;
|
|
|
|
|
|
|
|
// Loop over requested documentation types.
|
|
|
|
for(RequestedMapType::const_iterator i = this->RequestedMap.begin();
|
|
|
|
i != this->RequestedMap.end(); ++i)
|
|
|
|
{
|
|
|
|
// If a file name was given, use it. Otherwise, default to the
|
|
|
|
// given stream.
|
|
|
|
std::ofstream* fout = 0;
|
|
|
|
std::ostream* s = &os;
|
|
|
|
if(i->second.length() > 0)
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
2003-07-08 08:28:23 +04:00
|
|
|
fout = new std::ofstream(i->second.c_str(), std::ios::out | std::ios::binary);
|
2003-07-08 06:44:18 +04:00
|
|
|
#else
|
2003-07-08 08:28:23 +04:00
|
|
|
fout = new std::ofstream(i->second.c_str(), std::ios::out);
|
2003-07-08 06:44:18 +04:00
|
|
|
#endif
|
|
|
|
if(fout)
|
|
|
|
{
|
|
|
|
s = fout;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Print this documentation type to the stream.
|
|
|
|
this->PrintDocumentation(i->first, *s);
|
|
|
|
|
|
|
|
// Check for error.
|
|
|
|
if(!*s)
|
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close the file if we wrote one.
|
|
|
|
if(fout)
|
|
|
|
{
|
|
|
|
delete fout;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmDocumentation::CheckOptions(int argc, char** argv)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-04-03 07:44:42 +04:00
|
|
|
// Providing zero arguments gives usage information.
|
|
|
|
if(argc == 1)
|
|
|
|
{
|
2003-07-08 06:44:18 +04:00
|
|
|
this->RequestedMap[cmDocumentation::Usage] = "";
|
|
|
|
return true;
|
2003-04-03 07:44:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Search for supported help options.
|
2003-07-08 06:44:18 +04:00
|
|
|
bool result = false;
|
2003-02-19 04:42:02 +03:00
|
|
|
for(int i=1; i < argc; ++i)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-07-08 06:44:18 +04:00
|
|
|
// Check if this is a supported help option.
|
|
|
|
Type type = cmDocumentation::None;
|
2003-02-19 04:42:02 +03:00
|
|
|
if((strcmp(argv[i], "-help") == 0) ||
|
|
|
|
(strcmp(argv[i], "--help") == 0) ||
|
|
|
|
(strcmp(argv[i], "/?") == 0) ||
|
|
|
|
(strcmp(argv[i], "-usage") == 0) ||
|
|
|
|
(strcmp(argv[i], "-h") == 0) ||
|
|
|
|
(strcmp(argv[i], "-H") == 0))
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-07-08 06:44:18 +04:00
|
|
|
type = cmDocumentation::Usage;
|
|
|
|
}
|
|
|
|
else if(strcmp(argv[i], "--help-full") == 0)
|
|
|
|
{
|
|
|
|
type = cmDocumentation::Full;
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-07-08 06:44:18 +04:00
|
|
|
else if(strcmp(argv[i], "--help-html") == 0)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-07-08 06:44:18 +04:00
|
|
|
type = cmDocumentation::HTML;
|
2003-02-19 04:42:02 +03:00
|
|
|
}
|
2003-07-08 06:44:18 +04:00
|
|
|
else if(strcmp(argv[i], "--help-man") == 0)
|
2003-02-19 04:42:02 +03:00
|
|
|
{
|
2003-07-08 06:44:18 +04:00
|
|
|
type = cmDocumentation::Man;
|
2003-02-19 04:42:02 +03:00
|
|
|
}
|
2003-07-08 06:44:18 +04:00
|
|
|
else if(strcmp(argv[i], "--copyright") == 0)
|
2003-02-19 04:42:02 +03:00
|
|
|
{
|
2003-07-08 06:44:18 +04:00
|
|
|
type = cmDocumentation::Copyright;
|
2003-02-19 04:42:02 +03:00
|
|
|
}
|
2003-07-08 06:44:18 +04:00
|
|
|
else if((strcmp(argv[i], "--version") == 0) ||
|
|
|
|
(strcmp(argv[i], "-version") == 0) ||
|
|
|
|
(strcmp(argv[i], "-V") == 0) ||
|
|
|
|
(strcmp(argv[i], "/V") == 0))
|
2003-02-19 04:42:02 +03:00
|
|
|
{
|
2003-07-08 06:44:18 +04:00
|
|
|
type = cmDocumentation::Version;
|
2003-02-19 04:42:02 +03:00
|
|
|
}
|
2003-07-08 06:44:18 +04:00
|
|
|
if(type)
|
2003-02-19 04:42:02 +03:00
|
|
|
{
|
2003-07-08 06:44:18 +04:00
|
|
|
// This is a help option. See if there is a file name given.
|
|
|
|
result = true;
|
|
|
|
if((i+1 < argc) && (argv[i+1][0] != '-') &&
|
|
|
|
(strcmp(argv[i+1], "/V") != 0) && (strcmp(argv[i+1], "/?") != 0))
|
|
|
|
{
|
|
|
|
this->RequestedMap[type] = argv[i+1];
|
|
|
|
i = i+1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->RequestedMap[type] = "";
|
|
|
|
}
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
}
|
2003-07-08 06:44:18 +04:00
|
|
|
return result;
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
2003-02-14 21:06:37 +03:00
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::Print(Form f, std::ostream& os)
|
2003-02-14 21:06:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->CurrentForm = f;
|
2003-02-19 16:52:45 +03:00
|
|
|
for(unsigned int i=0; i < this->Sections.size(); ++i)
|
2003-02-19 04:42:02 +03:00
|
|
|
{
|
|
|
|
this->PrintSection(os, this->Sections[i], this->Names[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::SetNameSection(const cmDocumentationEntry* section)
|
|
|
|
{
|
|
|
|
this->SetSection(0, section, 0, this->NameSection);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::SetUsageSection(const cmDocumentationEntry* section)
|
|
|
|
{
|
|
|
|
this->SetSection(0, section, 0, this->UsageSection);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::SetDescriptionSection(const cmDocumentationEntry* section)
|
|
|
|
{
|
|
|
|
this->SetSection(0, section, 0, this->DescriptionSection);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::SetOptionsSection(const cmDocumentationEntry* section)
|
|
|
|
{
|
|
|
|
this->SetSection(0, section, cmDocumentationStandardOptions,
|
|
|
|
this->OptionsSection);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::SetCommandsSection(const cmDocumentationEntry* section)
|
|
|
|
{
|
|
|
|
this->SetSection(cmDocumentationCommandsHeader, section, 0,
|
|
|
|
this->CommandsSection);
|
|
|
|
}
|
|
|
|
|
2003-07-08 05:52:10 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::SetGeneratorsSection(const cmDocumentationEntry* section)
|
|
|
|
{
|
|
|
|
this->SetSection(cmDocumentationGeneratorsHeader, section, 0,
|
|
|
|
this->GeneratorsSection);
|
|
|
|
}
|
|
|
|
|
2003-07-11 07:15:45 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::SetSeeAlsoList(const cmDocumentationEntry* also)
|
|
|
|
{
|
|
|
|
this->SeeAlsoString = ".B ";
|
|
|
|
for(const cmDocumentationEntry* i = also; i->brief; ++i)
|
|
|
|
{
|
|
|
|
this->SeeAlsoString += i->brief;
|
|
|
|
this->SeeAlsoString += (i+1)->brief? "(1), ":"(1)";
|
|
|
|
}
|
|
|
|
cmDocumentationEntry e = {0, 0, 0};
|
|
|
|
e.brief = this->SeeAlsoString.c_str();
|
|
|
|
this->SeeAlsoSection.push_back(e);
|
|
|
|
e.brief = 0;
|
|
|
|
this->SeeAlsoSection.push_back(e);
|
|
|
|
}
|
|
|
|
|
2003-02-19 04:42:02 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintSection(std::ostream& os,
|
|
|
|
const cmDocumentationEntry* section,
|
|
|
|
const char* name)
|
|
|
|
{
|
|
|
|
switch (this->CurrentForm)
|
|
|
|
{
|
|
|
|
case TextForm: this->PrintSectionText(os, section, name); break;
|
|
|
|
case HTMLForm: this->PrintSectionHTML(os, section, name); break;
|
|
|
|
case ManForm: this->PrintSectionMan(os, section, name); break;
|
|
|
|
case UsageForm: this->PrintSectionUsage(os, section, name); break;
|
|
|
|
}
|
2003-02-14 21:06:37 +03:00
|
|
|
}
|
|
|
|
|
2003-02-14 18:53:37 +03:00
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintSectionText(std::ostream& os,
|
|
|
|
const cmDocumentationEntry* section,
|
|
|
|
const char* name)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
if(name)
|
|
|
|
{
|
2003-07-11 07:15:45 +04:00
|
|
|
os <<
|
|
|
|
"---------------------------------------"
|
|
|
|
"---------------------------------------\n";
|
2003-02-19 04:42:02 +03:00
|
|
|
os << name << "\n\n";
|
|
|
|
}
|
2003-02-14 18:53:37 +03:00
|
|
|
if(!section) { return; }
|
2003-02-19 04:42:02 +03:00
|
|
|
for(const cmDocumentationEntry* op = section; op->brief; ++op)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
if(op->name)
|
|
|
|
{
|
|
|
|
if(op->name[0])
|
|
|
|
{
|
|
|
|
os << " " << op->name << "\n";
|
|
|
|
}
|
|
|
|
this->TextIndent = " ";
|
|
|
|
this->PrintFormatted(os, op->brief);
|
|
|
|
if(op->full)
|
|
|
|
{
|
|
|
|
os << "\n";
|
|
|
|
this->PrintFormatted(os, op->full);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->TextIndent = "";
|
|
|
|
this->PrintFormatted(os, op->brief);
|
|
|
|
}
|
|
|
|
os << "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintSectionHTML(std::ostream& os,
|
|
|
|
const cmDocumentationEntry* section,
|
|
|
|
const char* name)
|
|
|
|
{
|
|
|
|
if(name)
|
|
|
|
{
|
|
|
|
os << "<h2>" << name << "</h2>\n";
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
if(!section) { return; }
|
2003-02-14 18:53:37 +03:00
|
|
|
for(const cmDocumentationEntry* op = section; op->brief;)
|
|
|
|
{
|
|
|
|
if(op->name)
|
|
|
|
{
|
|
|
|
os << "<ul>\n";
|
|
|
|
for(;op->name;++op)
|
|
|
|
{
|
|
|
|
os << " <li>\n";
|
2003-02-19 04:42:02 +03:00
|
|
|
if(op->name[0])
|
|
|
|
{
|
|
|
|
os << " <b><code>";
|
|
|
|
this->PrintHTMLEscapes(os, op->name);
|
|
|
|
os << "</code></b>: ";
|
|
|
|
}
|
2003-02-14 18:53:37 +03:00
|
|
|
this->PrintHTMLEscapes(os, op->brief);
|
|
|
|
if(op->full)
|
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
os << "<br>\n ";
|
|
|
|
this->PrintFormatted(os, op->full);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
os << "\n";
|
|
|
|
os << " </li>\n";
|
|
|
|
}
|
|
|
|
os << "</ul>\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->PrintFormatted(os, op->brief);
|
2003-02-14 18:53:37 +03:00
|
|
|
os << "\n";
|
|
|
|
++op;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintSectionMan(std::ostream& os,
|
|
|
|
const cmDocumentationEntry* section,
|
|
|
|
const char* name)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
if(name)
|
|
|
|
{
|
|
|
|
os << ".SH " << name << "\n";
|
|
|
|
}
|
|
|
|
if(!section) { return; }
|
|
|
|
for(const cmDocumentationEntry* op = section; op->brief; ++op)
|
|
|
|
{
|
|
|
|
if(op->name)
|
|
|
|
{
|
|
|
|
os << ".TP\n"
|
|
|
|
<< ".B " << (op->name[0]?op->name:"*") << "\n";
|
|
|
|
this->PrintFormatted(os, op->brief);
|
|
|
|
this->PrintFormatted(os, op->full);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
os << ".PP\n";
|
|
|
|
this->PrintFormatted(os, op->brief);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintSectionUsage(std::ostream& os,
|
|
|
|
const cmDocumentationEntry* section,
|
|
|
|
const char* name)
|
|
|
|
{
|
|
|
|
if(name)
|
|
|
|
{
|
|
|
|
os << name << "\n";
|
|
|
|
}
|
2003-02-14 18:53:37 +03:00
|
|
|
if(!section) { return; }
|
|
|
|
for(const cmDocumentationEntry* op = section; op->brief; ++op)
|
|
|
|
{
|
|
|
|
if(op->name)
|
|
|
|
{
|
2003-02-16 19:57:20 +03:00
|
|
|
os << " " << op->name;
|
2003-02-19 04:42:02 +03:00
|
|
|
this->TextIndent = " ";
|
|
|
|
int align = static_cast<int>(strlen(this->TextIndent))-4;
|
|
|
|
for(int i = static_cast<int>(strlen(op->name)); i < align; ++i)
|
2003-02-16 19:57:20 +03:00
|
|
|
{
|
|
|
|
os << " ";
|
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
os << "= ";
|
|
|
|
this->PrintColumn(os, op->brief);
|
|
|
|
os << "\n";
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
os << "\n";
|
2003-02-19 04:42:02 +03:00
|
|
|
this->TextIndent = "";
|
|
|
|
this->PrintFormatted(os, op->brief);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
}
|
2003-04-03 07:44:42 +04:00
|
|
|
os << "\n";
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintFormatted(std::ostream& os, const char* text)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
if(!text)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const char* ptr = text;
|
|
|
|
while(*ptr)
|
|
|
|
{
|
|
|
|
// Any ptrs starting in a space are treated as preformatted text.
|
|
|
|
std::string preformatted;
|
|
|
|
while(*ptr == ' ')
|
|
|
|
{
|
|
|
|
for(char ch = *ptr; ch && ch != '\n'; ++ptr, ch = *ptr)
|
|
|
|
{
|
|
|
|
preformatted.append(1, ch);
|
|
|
|
}
|
|
|
|
if(*ptr)
|
|
|
|
{
|
|
|
|
++ptr;
|
|
|
|
preformatted.append(1, '\n');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(preformatted.length())
|
|
|
|
{
|
|
|
|
this->PrintPreformatted(os, preformatted.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Other ptrs are treated as paragraphs.
|
|
|
|
std::string paragraph;
|
|
|
|
for(char ch = *ptr; ch && ch != '\n'; ++ptr, ch = *ptr)
|
|
|
|
{
|
|
|
|
paragraph.append(1, ch);
|
|
|
|
}
|
|
|
|
if(*ptr)
|
|
|
|
{
|
|
|
|
++ptr;
|
|
|
|
paragraph.append(1, '\n');
|
|
|
|
}
|
|
|
|
if(paragraph.length())
|
|
|
|
{
|
|
|
|
this->PrintParagraph(os, paragraph.c_str());
|
|
|
|
}
|
|
|
|
}
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintPreformatted(std::ostream& os, const char* text)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
switch (this->CurrentForm)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
case TextForm: this->PrintPreformattedText(os, text); break;
|
|
|
|
case HTMLForm: this->PrintPreformattedHTML(os, text); break;
|
|
|
|
case ManForm: this->PrintPreformattedMan(os, text); break;
|
|
|
|
case UsageForm: this->PrintPreformattedText(os, text); break;
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintParagraph(std::ostream& os, const char* text)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
switch (this->CurrentForm)
|
|
|
|
{
|
|
|
|
case TextForm: this->PrintParagraphText(os, text); break;
|
|
|
|
case HTMLForm: this->PrintParagraphHTML(os, text); break;
|
|
|
|
case ManForm: this->PrintParagraphMan(os, text); break;
|
|
|
|
case UsageForm: this->PrintParagraphText(os, text); break;
|
|
|
|
}
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintPreformattedText(std::ostream& os, const char* text)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
bool newline = true;
|
|
|
|
for(const char* ptr = text; *ptr; ++ptr)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
if(newline)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
os << this->TextIndent;
|
|
|
|
newline = false;
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
os << *ptr;
|
|
|
|
if(*ptr == '\n')
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
newline = true;
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
os << "\n";
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintParagraphText(std::ostream& os, const char* text)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
os << this->TextIndent;
|
|
|
|
this->PrintColumn(os, text);
|
|
|
|
os << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintPreformattedHTML(std::ostream& os, const char* text)
|
|
|
|
{
|
|
|
|
os << "<pre>";
|
|
|
|
this->PrintHTMLEscapes(os, text);
|
|
|
|
os << "</pre>\n ";
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintParagraphHTML(std::ostream& os, const char* text)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
os << "<p>";
|
|
|
|
this->PrintHTMLEscapes(os, text);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintPreformattedMan(std::ostream& os, const char* text)
|
|
|
|
{
|
|
|
|
os << text << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintParagraphMan(std::ostream& os, const char* text)
|
|
|
|
{
|
|
|
|
os << text << "\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintColumn(std::ostream& os, const char* text)
|
|
|
|
{
|
|
|
|
// Print text arranged in an indented column of fixed witdh.
|
2003-02-14 18:53:37 +03:00
|
|
|
const char* l = text;
|
|
|
|
int column = 0;
|
|
|
|
bool newSentence = false;
|
2003-02-14 21:06:37 +03:00
|
|
|
bool firstLine = true;
|
2003-02-19 16:52:45 +03:00
|
|
|
int width = this->TextWidth - static_cast<int>(strlen(this->TextIndent));
|
2003-02-14 21:06:37 +03:00
|
|
|
|
|
|
|
// Loop until the end of the text.
|
2003-02-14 18:53:37 +03:00
|
|
|
while(*l)
|
|
|
|
{
|
|
|
|
// Parse the next word.
|
|
|
|
const char* r = l;
|
|
|
|
while(*r && (*r != '\n') && (*r != ' ')) { ++r; }
|
|
|
|
|
|
|
|
// Does it fit on this line?
|
|
|
|
if(r-l < (width-column-(newSentence?1:0)))
|
|
|
|
{
|
|
|
|
// Word fits on this line.
|
|
|
|
if(r > l)
|
|
|
|
{
|
|
|
|
if(column)
|
|
|
|
{
|
|
|
|
// Not first word on line. Separate from the previous word
|
|
|
|
// by a space, or two if this is a new sentence.
|
|
|
|
if(newSentence)
|
|
|
|
{
|
|
|
|
os << " ";
|
|
|
|
column += 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
os << " ";
|
|
|
|
column += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// First word on line. Print indentation unless this is the
|
|
|
|
// first line.
|
2003-02-19 04:42:02 +03:00
|
|
|
os << (firstLine?"":this->TextIndent);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Print the word.
|
|
|
|
os.write(l, static_cast<long>(r-l));
|
|
|
|
newSentence = (*(r-1) == '.');
|
|
|
|
}
|
|
|
|
|
|
|
|
if(*r == '\n')
|
|
|
|
{
|
|
|
|
// Text provided a newline. Start a new line.
|
|
|
|
os << "\n";
|
|
|
|
++r;
|
|
|
|
column = 0;
|
2003-02-14 21:06:37 +03:00
|
|
|
firstLine = false;
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// No provided newline. Continue this line.
|
|
|
|
column += static_cast<long>(r-l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Word does not fit on this line. Start a new line.
|
|
|
|
os << "\n";
|
2003-02-14 21:06:37 +03:00
|
|
|
firstLine = false;
|
2003-02-14 18:53:37 +03:00
|
|
|
if(r > l)
|
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
os << this->TextIndent;
|
2003-02-14 18:53:37 +03:00
|
|
|
os.write(l, static_cast<long>(r-l));
|
|
|
|
column = static_cast<long>(r-l);
|
|
|
|
newSentence = (*(r-1) == '.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Move to beginning of next word. Skip over whitespace.
|
|
|
|
l = r;
|
|
|
|
while(*l && (*l == ' ')) { ++l; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintHTMLEscapes(std::ostream& os, const char* text)
|
2003-02-14 21:28:46 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
static cmDocumentationEntry escapes[] =
|
|
|
|
{
|
|
|
|
{"<", "<", 0},
|
|
|
|
{">", ">", 0},
|
|
|
|
{"&", "&", 0},
|
|
|
|
{"\n", "<br>", 0},
|
|
|
|
{0,0,0}
|
|
|
|
};
|
|
|
|
for(const char* p = text; *p; ++p)
|
2003-02-14 21:28:46 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
bool found = false;
|
|
|
|
for(const cmDocumentationEntry* op = escapes; !found && op->name; ++op)
|
2003-02-14 21:28:46 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
if(op->name[0] == *p)
|
2003-02-14 21:28:46 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
os << op->brief;
|
|
|
|
found = true;
|
2003-02-14 21:28:46 +03:00
|
|
|
}
|
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
if(!found)
|
2003-02-14 21:28:46 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
os << *p;
|
2003-02-14 21:28:46 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::PrintDocumentationUsage(std::ostream& os)
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->CreateUsageDocumentation();
|
|
|
|
this->Print(UsageForm, os);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintDocumentationFull(std::ostream& os)
|
|
|
|
{
|
|
|
|
this->CreateFullDocumentation();
|
|
|
|
this->Print(TextForm, os);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintDocumentationHTML(std::ostream& os)
|
|
|
|
{
|
|
|
|
this->CreateFullDocumentation();
|
|
|
|
os << "<html><body>\n";
|
|
|
|
this->Print(HTMLForm, os);
|
|
|
|
os << "</body></html>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::PrintDocumentationMan(std::ostream& os)
|
|
|
|
{
|
|
|
|
this->CreateManDocumentation();
|
|
|
|
os << ".TH CMake 1 \""
|
|
|
|
<< cmSystemTools::GetCurrentDateTime("%B %d, %Y").c_str()
|
2003-07-08 07:20:30 +04:00
|
|
|
<< "\" \"CMake " CMake_VERSION_FULL "\"\n";
|
2003-02-19 04:42:02 +03:00
|
|
|
this->Print(ManForm, os);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmDocumentation::CreateUsageDocumentation()
|
|
|
|
{
|
|
|
|
this->ClearSections();
|
|
|
|
if(!this->UsageSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("Usage", &this->UsageSection[0]);
|
|
|
|
}
|
|
|
|
if(!this->OptionsSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("Command-Line Options", &this->OptionsSection[0]);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-07-11 07:15:45 +04:00
|
|
|
if(!this->GeneratorsSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("Generators", &this->GeneratorsSection[0]);
|
|
|
|
}
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::CreateFullDocumentation()
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->ClearSections();
|
|
|
|
if(!this->NameSection.empty())
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->AddSection("Name", &this->NameSection[0]);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
if(!this->UsageSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("Usage", &this->UsageSection[0]);
|
|
|
|
}
|
|
|
|
if(!this->DescriptionSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection(0, &this->DescriptionSection[0]);
|
|
|
|
}
|
|
|
|
if(!this->OptionsSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("Command-Line Options", &this->OptionsSection[0]);
|
|
|
|
}
|
2003-07-11 07:15:45 +04:00
|
|
|
if(!this->GeneratorsSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("Generators", &this->GeneratorsSection[0]);
|
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
if(!this->CommandsSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("Listfile Commands", &this->CommandsSection[0]);
|
|
|
|
}
|
|
|
|
this->AddSection("Copyright", cmDocumentationCopyright);
|
|
|
|
this->AddSection("Mailing List", cmDocumentationMailingList);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::CreateManDocumentation()
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->ClearSections();
|
|
|
|
if(!this->NameSection.empty())
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->AddSection("NAME", &this->NameSection[0]);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
if(!this->UsageSection.empty())
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
this->AddSection("SYNOPSIS", &this->UsageSection[0]);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
if(!this->DescriptionSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("DESCRIPTION", &this->DescriptionSection[0]);
|
|
|
|
}
|
|
|
|
if(!this->OptionsSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("OPTIONS", &this->OptionsSection[0]);
|
|
|
|
}
|
2003-07-11 07:15:45 +04:00
|
|
|
if(!this->GeneratorsSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("GENERATORS", &this->GeneratorsSection[0]);
|
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
if(!this->CommandsSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("COMMANDS", &this->CommandsSection[0]);
|
|
|
|
}
|
|
|
|
this->AddSection("COPYRIGHT", cmDocumentationCopyright);
|
2003-07-11 07:15:45 +04:00
|
|
|
this->AddSection("MAILING LIST", cmDocumentationMailingList);
|
|
|
|
if(!this->SeeAlsoSection.empty())
|
|
|
|
{
|
|
|
|
this->AddSection("SEE ALSO", &this->SeeAlsoSection[0]);
|
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
this->AddSection("AUTHOR", cmDocumentationAuthor);
|
2003-02-14 18:53:37 +03:00
|
|
|
}
|
2003-02-17 17:42:13 +03:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2003-02-19 04:42:02 +03:00
|
|
|
void cmDocumentation::SetSection(const cmDocumentationEntry* header,
|
|
|
|
const cmDocumentationEntry* section,
|
|
|
|
const cmDocumentationEntry* footer,
|
|
|
|
std::vector<cmDocumentationEntry>& vec)
|
2003-02-17 17:42:13 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
vec.erase(vec.begin(), vec.end());
|
|
|
|
if(header)
|
2003-02-17 17:42:13 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
for(const cmDocumentationEntry* op = header; op->brief; ++op)
|
|
|
|
{
|
|
|
|
vec.push_back(*op);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(section)
|
|
|
|
{
|
|
|
|
for(const cmDocumentationEntry* op = section; op->brief; ++op)
|
|
|
|
{
|
|
|
|
vec.push_back(*op);
|
|
|
|
}
|
2003-02-17 17:42:13 +03:00
|
|
|
}
|
2003-02-19 04:42:02 +03:00
|
|
|
if(footer)
|
2003-02-17 17:42:13 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
for(const cmDocumentationEntry* op = footer; op->brief; ++op)
|
2003-02-17 17:42:13 +03:00
|
|
|
{
|
2003-02-19 04:42:02 +03:00
|
|
|
vec.push_back(*op);
|
2003-02-17 17:42:13 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
cmDocumentationEntry empty = {0,0,0};
|
2003-02-19 04:42:02 +03:00
|
|
|
vec.push_back(empty);
|
2003-02-17 17:42:13 +03:00
|
|
|
}
|