diff options
Diffstat (limited to 'autodoc/source/exes')
-rw-r--r-- | autodoc/source/exes/adc_uni/adc_cl.cxx | 571 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/adc_cmd.hxx | 134 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/adc_cmd_parse.cxx | 346 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/adc_cmd_parse.hxx | 211 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/adc_cmds.cxx | 180 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/adc_cmds.hxx | 128 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/adc_msg.cxx | 211 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/cmd_run.cxx | 616 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/cmd_run.hxx | 107 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/cmd_sincedata.cxx | 132 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/cmd_sincedata.hxx | 94 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/main.cxx | 57 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/makefile.mk | 108 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/spec-CommandLine.txt | 181 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/spec-DevGuideReferenceFile.txt | 0 | ||||
-rw-r--r-- | autodoc/source/exes/adc_uni/spec-SinceTag_Handling.txt | 49 |
16 files changed, 3125 insertions, 0 deletions
diff --git a/autodoc/source/exes/adc_uni/adc_cl.cxx b/autodoc/source/exes/adc_uni/adc_cl.cxx new file mode 100644 index 000000000000..ca7255194516 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cl.cxx @@ -0,0 +1,571 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cl.cxx,v $ + * $Revision: 1.14 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <adc_cl.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <algorithm> +#include <cosv/x.hxx> +#include <cosv/file.hxx> +#include <cosv/tpl/tpltools.hxx> +#include <ary/ary.hxx> +#include <tools/tkpchars.hxx> +#include <adc_msg.hxx> +#include "adc_cmds.hxx" +#include "adc_cmd_parse.hxx" +#include "cmd_sincedata.hxx" + + +namespace autodoc +{ + +CommandLine * CommandLine::pTheInstance_ = 0; + +const char * const C_sUserGuide = +"\n\n\n" +" General Use of Autodoc\n" +" ----------------------\n" +"\n" +" Example for C++:\n" +"\n" +" -html <OutputDirectory> -name \"UDK 3.x anything\" -lg c++\n" +" -p <ProjName> <ProjectRootDirectory>\n" +" -t <SourceDir_relativeToProjectRoot>\n" +"\n" +" There may be several projects specified by -p.\n" +"\n" +"\n" +" Example for IDL:\n" +"\n" +" -html <OutputDirectory> -name \"UDK 3.x anything\" -lg idl\n" +" -t <SourceDir1> <SourceDir2>\n" +"\n" +" For both languages, instead of or in addition to -t may be\n" +" used -d (no subdirectories) or -f (just one file). There can\n" +" be multiple arguments after each of these options (-t -d -f).\n" +"\n" +"\n" +" Replacing @since Tag Content\n" +" ----------------------------\n" +"\n" +" In both languages you can give a transformation file to replace\n" +" entries in @since tags by different entries.\n" +" This file is given by the option\n" +" -sincefile <TransformationFilePath>\n" +" This option has to appear between the -html and the -lg option.\n" +" Example:\n" +" -html <OutputDirectory> -sincefile replacesince.txt\n" +" -name \"UDK 3.x anything\" -lg idl -t <SourceDir>\n" +"\n" +"\n"; + + +#if 0 // FUTURE +"\n\n\n" +" Use of Autodoc\n" +" --------------\n" +"\n" +" Basics:\n" +"\n" +" Autodoc may perform different tasks.\n" +"\n" +" Possible tasks are\n" +" - parsing source code\n" +" - creating HTML-output.\n" +" On the command line each task starts with a specific\n" +" option:\n" +" '-parse' for parsing source code,\n" +" '-html' for creating HTML.\n" +" All command line options, related to one task, have to follow before\n" +" the starting option of the next task.\n" +"\n" +" Within the task '-parse', there may be defined different projects.\n" +" A project definition is started with '-p'.\n" +" All not project specific options within the task '-parse' have to\n" +" appear in front of the first '-p'.\n" +" There can be no project at all. Then all options, available for\n" +" projects, can be used like for one nameless default project, without using\n" +" '-p', but these options still have to appear behind all other\n" +" options of the task '-parse'.\n" +"\n" +"\n" +" Legend:\n" +"\n" +" <SomeText> Describes an argument.\n" +" 'SomeText' Within '...' is the literal value of an argument.\n" +" + There can be multiple arguments.\n" +" | Separator for alternative literal values of an argument.\n" +"\n" +"\n" +" Syntax:\n" +"\n" +" -parse\n" +" -name <RepositoryName>]\n" +" -lg 'c++'|'idl'\n" +" -extg <AdditonalExtensions>+\n" +" -docg 'usehtml'\n" +" -p <ProjectName> <ProjectRootDir>\n" +" -l 'c++'|'idl'\n" +" -ext <AdditonalExtensions>+\n" +" -doc 'usehtml'\n" +" -d <SourceDir_relative2ProjectRootDir_nosubdirs>+\n" +" -t <SourceTree_relative2ProjectRootDir>+\n" +" -f <SourceFile_relative2ProjectRootDir>+\n" +" -html <OutputDir>\n" +" -xlinks <Namespace> <ExternLinksRootDir>\n" +" -i <CommandFilePath>\n" +" -v <VerboseNr>\n" +"\n" +"\n" +" Detailed Options Description:\n" +"\n" +" Option Arguments\n" +" ----------------------------------------------------------\n" +"\n" +" -parse \n\n" +" Starts the task \"Parse source code\".\n" +" May be omitted, if it would be the first option on the\n" +" command line.\n" +"\n" +" -name <RepositoryName>\n\n" +" This name is used for naming the repository in\n" +" human readable output. In future it may be used also for\n" +" identifiing a repository in searches.\n" +"\n" +" -lg 'c++|'idl'\n\n" +" Identifies the programming language to be parsed.\n" +" 'c++': C++\n" +" Files with extensions '.h', '.hxx' are parsed.\n" +" 'idl': UNO-IDL\n" +" Files with extensions '.idl' are parsed.\n" +" Here the language is set globally for all projects.\n" +" A project can override this by using '-l'.\n" +"\n" +" -extg <.AdditionalExtension>+\n\n" +" Has to follow immediately behind '-lg'.\n" +" Specifies additional extensions, that will be recognised as\n" +" source code files of the previously specified programming\n" +" language. Each extension has to start with '.'.\n" +" It is possible to include extensionless files, too,\n" +" by the argument '.'\n" +" Here these extensions are set globally for all projects.\n" +" A project can override this by using '-l' and '-ext'.\n" +"\n" +" -docg 'html'|'nohtml'\n\n" +" Specifies the default for all comments in source code, so \n" +" that HTML-tags are interpreted as such or else treated as\n" +" regular text.\n" +" Without this option, the default is 'nohtml'.\n" +" Here the default is set globally for all projects.\n" +" A project can override this by using '-doc'.\n" +"\n" +" -p <ProjectName> <ProjectRootDirectory>\n\n" +" ProjectName is used in output as human readable identifier\n" +" for the project. ProjectRootDirectory is the path,\n" +" where the arguments of '-d', '-t' and '-f' are relative to.\n" +" This option can be omitted, then there is no project name\n" +" and all paths are relative to the current working directory.\n" +"\n" +" -l 'c++|'idl'\n\n" +" Overrides -lg and -extg for the current project, which is\n" +" specified by the last previous '-p'.\n" +" For details see at option '-lg'.\n" +"\n" +" -ext <.AdditionalExtension>+\n\n" +" Can be used only immediately behind '-l'.\n" +" Overrides -extg for the current project, which is\n" +" specified by the last previous '-p'.\n" +" For details see at option '-extg'.\n" +"\n" +" -doc 'html'|'nohtml'\n\n" +" Overrides -docg for the current project, which is\n" +" specified by the last previous '-p'.\n" +" For details see at option '-docg'.\n" +"\n" +" -d <SourceDir_relative2ProjectRootDir_nosubdirs>+\n\n" +" For the current project all files in the given\n" +" directories are parsed, which have valid extensions.\n" +" Subdirectories are NOT parsed.\n" +"\n" +" -t <SourceTree_relative2ProjectRootDir>+\n\n" +" For the current project all files in the given\n" +" directories AND its subdirectories are parsed, which\n" +" have valid extensions.\n" +"\n" +" -f <SourceFile_relative2ProjectRootDir>+\n\n" +" For the current project and language the given files\n" +" are parsed. It doesn't matter, if their extensions match\n" +" the valid extensions.\n" +"\n" +" -html <OutputRootDir>\n\n" +" Starts the task \"Create HTML output\".\n" +"\n" +" -xlinks <Namespace> <ExternLinksRootDir>\n\n" +" This option allows, to create links to external\n" +" HTML-documents.\n" +" For all source code objects (like classes or functions)\n" +" which belong in the given namespace, the given root\n" +" directory is used as a base for links to them.\n" +" Presently, this works only for C++-mappings of IDL-items.\n" +" The given namespace has to be absolute.\n" +"\n" +" -i <CommandFilePath>\n\n" +" This option is replaced by the contents of the given\n" +" file. The file has to be ASCII and each option\n" +" has to start in the first column of a new line.\n" +" So each valid line starts with a '-'.\n" +" Empty lines are allowed.\n" +" Comment lines have to start with '#'\n" +"\n" +" -v <VerboseNumber>\n\n" +" Show details during parsing:\n" +" 2 shows each parsed letter,\n" +" 4 shows stored objects.\n" +" 1 shows recognised tokens.\n" +" These bit-values can be combined.\n" +" This option suppresses errors, because of\n" +" missing output options (no '-html').\n"; +#endif // 0, FUTURE + + +CommandLine::CommandLine() + : nDebugStyle(0), + pSinceTransformator(new command::SinceTagTransformationData), + aCommands(), + bInitOk(false), + pCommand_CreateHtml(0), + pReposy( & ary::Repository::Create_() ), + bCpp(false), + bIdl(false) +{ + csv_assert(pTheInstance_ == 0); + pTheInstance_ = this; +} + +CommandLine::~CommandLine() +{ + csv::erase_container_of_heap_ptrs(aCommands); + pTheInstance_ = 0; +} + +int +CommandLine::Run() const +{ + Cout() << "\nAutodoc version 2.2.5" + << "\n---------------------" + << "\n" << Endl(); + + bool + ok = true; + for ( CommandList::const_iterator it = aCommands.begin(); + ok AND it != aCommands.end(); + ++it ) + { + ok = (*it)->Run(); + } + + if (pCommand_CreateHtml != 0) + { + StreamStr aDiagnosticMessagesFile(700); + aDiagnosticMessagesFile + << pCommand_CreateHtml->OutputDir() + << csv::ploc::Delimiter() + << "Autodoc_DiagnosticMessages.txt"; + TheMessages().WriteFile(aDiagnosticMessagesFile.c_str()); + } + + return ok ? 0 : 1; +} + +CommandLine & +CommandLine::Get_() +{ + csv_assert(pTheInstance_ != 0); + return *pTheInstance_; +} + +bool +CommandLine::DoesTransform_SinceTag() const +{ + return pSinceTransformator->DoesTransform(); +} + +//bool +//CommandLine::Strip_SinceTagText( String & io_sSinceTagValue ) const +//{ +// return pSinceTransformator->StripSinceTagText(io_sSinceTagValue); +//} + +const String & +CommandLine::DisplayOf_SinceTagValue( const String & i_sVersionNumber ) const +{ + return pSinceTransformator->DisplayOf(i_sVersionNumber); +} + +void +CommandLine::do_Init( int argc, + char * argv[] ) +{ + try + { + bInitOk = false; + StringVector aParameters; + + char * * itpEnd = &argv[0] + argc; + for ( char * * itp = &argv[1]; itp != itpEnd; ++itp ) + { + if ( strncmp(*itp, "-I:", 3) != 0 ) + aParameters.push_back(String(*itp)); + else + load_IncludedCommands(aParameters, (*itp)+3); + } + + StringVector::const_iterator itEnd = aParameters.end(); + for ( StringVector::const_iterator it = aParameters.begin(); + it != itEnd; + ) + { + if ( *it == command::C_opt_Verbose ) + do_clVerbose(it,itEnd); + else if ( *it == command::C_opt_LangAll + OR *it == command::C_opt_Name + OR *it == command::C_opt_DevmanFile ) + do_clParse(it,itEnd); + else if (*it == command::C_opt_CreateHtml) + do_clCreateHtml(it,itEnd); + else if (*it == command::C_opt_SinceFile) + do_clSinceFile(it,itEnd); + else if (*it == command::C_opt_ExternNamespace) + { + sExternNamespace = *(++it); + ++it; + if ( strncmp(sExternNamespace.c_str(), "::", 2) != 0) + { + throw command::X_CommandLine( + "-extnsp needs an absolute qualified namespace, starting with \"::\"." + ); + } + } + else if (*it == command::C_opt_ExternRoot) + { + ++it; + StreamLock sl(1000); + if ( csv::compare(*it, 0, "http://", 7) != 0 ) + { + sl() << "http://" << *it; + } + if ( *(sl().end()-1) != '/') + sl() << '/'; + sExternRoot = sl().c_str(); + + ++it; + } +// else if (*it == command::C_opt_CreateXml) +// do_clCreateXml(it,itEnd); +// else if (command::C_opt_Load) +// do_clLoad(it,itEnd); +// else if (*it == command::C_opt_Save) +// do_clSave(it,itEnd); + else if (*it == "-h" OR *it == "-?" OR *it == "?") + // Leads to displaying help, because bInitOk stays on false. + return; + else if ( *it == command::C_opt_Parse ) + // Only for backwards compatibility. + // Just ignore "-parse". + ++it; + else + { + StreamLock sl(200); + throw command::X_CommandLine( + sl() << "Unknown commandline option \"" + << *it + << "\"." + << c_str ); + } + } // end for + sort_Commands(); + + bInitOk = true; + + } // end try + catch ( command::X_CommandLine & xxx ) + { + xxx.Report( Cerr() ); + } + catch ( csv::Exception & xxx ) + { + xxx.GetInfo( Cerr() ); + } +} + +void +CommandLine::do_PrintUse() const +{ + Cout() << C_sUserGuide << Endl(); +} + +bool +CommandLine::inq_CheckParameters() const +{ + if (NOT bInitOk OR aCommands.size() == 0) + return false; + return true; +} + +void +CommandLine::load_IncludedCommands( StringVector & out, + const char * i_filePath ) +{ + CharacterSource + aIncludedCommands; + csv::File + aFile(i_filePath, csv::CFM_READ); + if (NOT aFile.open()) + { + Cerr() << "Command include file \"" + << i_filePath + << "\" not found." + << Endl(); + throw command::X_CommandLine("Invalid file in option -I:<command-file>."); + } + aIncludedCommands.LoadText(aFile); + aFile.close(); + + bool bInToken = false; + StreamLock aTransmit(200); + for ( ; NOT aIncludedCommands.IsFinished(); aIncludedCommands.MoveOn() ) + { + if (bInToken) + { + if (aIncludedCommands.CurChar() <= 32) + { + const char * + pToken = aIncludedCommands.CutToken(); + bInToken = false; + + if ( strncmp(pToken, "-I:", 3) != 0 ) + { + aTransmit().seekp(0); + aTransmit() << pToken; + aTransmit().replace_all('\\', *csv::ploc::Delimiter()); + aTransmit().replace_all('/', *csv::ploc::Delimiter()); + out.push_back(String(aTransmit().c_str())); + } + else + load_IncludedCommands(out, pToken+3); + } + } + else + { + if (aIncludedCommands.CurChar() > 32) + { + aIncludedCommands.CutToken(); + bInToken = true; + } + } // endif (bInToken) else + + } // end while() +} + +namespace +{ +inline int +v_nr(StringVector::const_iterator it) +{ + return int( *(*it).c_str() ) - int('0'); +} +} // anonymous namespace + +void +CommandLine::do_clVerbose( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + if ( it == itEnd ? true : v_nr(it) < 0 OR v_nr(it) > 7 ) + throw command::X_CommandLine( "Missing or invalid number in -v option." ); + nDebugStyle = v_nr(it); + ++it; +} + +void +CommandLine::do_clParse( opt_iter & it, + opt_iter itEnd ) +{ + command::Command * + pCmd_Parse = new command::Parse; + pCmd_Parse->Init(it, itEnd); + aCommands.push_back(pCmd_Parse); +} + +void +CommandLine::do_clCreateHtml( opt_iter & it, + opt_iter itEnd ) +{ + pCommand_CreateHtml = new command::CreateHtml; + pCommand_CreateHtml->Init(it, itEnd); + aCommands.push_back(pCommand_CreateHtml); +} + +void +CommandLine::do_clSinceFile( opt_iter & it, + opt_iter itEnd ) +{ + pSinceTransformator->Init(it, itEnd); +} + + +namespace +{ + +struct Less_RunningRank +{ + bool operator()( + const command::Command * const & + i1, + const command::Command * const & + i2 ) const + { return i1->RunningRank() < i2->RunningRank(); } +}; + +} // anonymous namespace + + + +void +CommandLine::sort_Commands() +{ + std::sort( aCommands.begin(), + aCommands.end(), + Less_RunningRank() ); +} + +} // namespace autodoc diff --git a/autodoc/source/exes/adc_uni/adc_cmd.hxx b/autodoc/source/exes/adc_uni/adc_cmd.hxx new file mode 100644 index 000000000000..13f150d7f0db --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmd.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmd.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_ADC_CMD_HXX +#define ADC_ADC_CMD_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cosv/comdline.hxx> + // COMPONENTS + // PARAMETERS + + +namespace autodoc +{ +namespace command +{ + +/** Context for a command, which can be read from the command line. +*/ +class Context +{ + public: + typedef StringVector::const_iterator opt_iter; + + virtual ~Context() {} + + void Init( + opt_iter & it, + opt_iter itEnd ); + private: + virtual void do_Init( + opt_iter & it, + opt_iter itEnd ) = 0; +}; + +// IMPLEMENTATION +inline void +Context::Init( opt_iter & i_nCurArgsBegin, + opt_iter i_nEndOfAllArgs ) + +{ do_Init(i_nCurArgsBegin, i_nEndOfAllArgs); } + + + +/** Interface for commands, autodoc is able to perform. +*/ +class Command : public Context +{ + public: + /** Running ranks of the commands are to be maintained at one location: + Here! + */ + enum E_Ranks + { + rank_Load = 10, + rank_Parse = 20, + rank_Save = 30, + rank_CreateHtml = 40, + rank_CreateXml = 50 + }; + + + bool Run() const; + int RunningRank() const; + + private: + virtual bool do_Run() const = 0; + virtual int inq_RunningRank() const = 0; +}; + +// IMPLEMENTATION +inline bool +Command::Run() const +{ return do_Run(); } +inline int +Command::RunningRank() const +{ return inq_RunningRank(); } + + + + +/** The exception thrown, if the command line is invalid. +*/ +class X_CommandLine +{ + public: + X_CommandLine( + const char * i_sExplanation ) + : sExplanation(i_sExplanation) {} + + void Report( + std::ostream & o_rOut ) + { o_rOut << "Error in command line: " + << sExplanation << Endl(); } + private: + String sExplanation; +}; + + + + +} // namespace command +} // namespace autodoc +#endif diff --git a/autodoc/source/exes/adc_uni/adc_cmd_parse.cxx b/autodoc/source/exes/adc_uni/adc_cmd_parse.cxx new file mode 100644 index 000000000000..53b8389520c4 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmd_parse.cxx @@ -0,0 +1,346 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmd_parse.cxx,v $ + * $Revision: 1.11 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "adc_cmd_parse.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <adc_cl.hxx> +#include "adc_cmds.hxx" +#include "cmd_run.hxx" + + + +namespace autodoc +{ +namespace command +{ + +namespace +{ + +const String C_FileEnding_hxx("*.hxx"); +const String C_FileEnding_h("*.h"); +const String C_FileEnding_idl("*.idl"); +const String C_FileEnding_java("*.java"); + +inline void +CHECK( bool b, const String & text ) +{ + if (NOT b) + throw X_CommandLine( text ); +} + +} // anonymous namespace + + + +//************************** S_LanguageInfo ***********************// + +S_LanguageInfo::~S_LanguageInfo() +{ +} + +void +S_LanguageInfo::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + ++it; // Cur is language. + CHECKOPT( it != itEnd AND + ( *it == C_arg_Cplusplus OR + *it == C_arg_Idl OR + *it == C_arg_Java ), + "language", + C_opt_LangAll ); + + if ( *it == C_arg_Cplusplus ) { + eLanguage = cpp; + } + else if ( *it == C_arg_Idl ) { + eLanguage = idl; + } + else if ( *it == C_arg_Java ) { + eLanguage = java; + } + else { + csv_assert(false); + } + + switch (eLanguage) + { + case cpp: aExtensions.push_back( C_FileEnding_hxx ); + aExtensions.push_back( C_FileEnding_h ); + CommandLine::Get_().Set_CppUsed(); + break; + case idl: aExtensions.push_back( C_FileEnding_idl ); + CommandLine::Get_().Set_IdlUsed(); + break; + case java: aExtensions.push_back( C_FileEnding_java ); + break; + default: // do nothing. + ; + } + + ++it; // Cur is next option. +} + +void +S_LanguageInfo::InitExtensions( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + CHECKOPT( it != itEnd AND (*it).char_at(0) == '.', + "extensions", + C_opt_ExtensionsAll ); + + StreamLock slCheck(150); + slCheck() << C_opt_ExtensionsAll + << " used without previous " + << C_opt_LangAll; + + CHECK( eLanguage != none, + slCheck().c_str() ); + + do { + aExtensions.push_back(*it); + ++it; + } while (it != itEnd AND (*it).char_at(0) == '.'); +} + + + +//************************** Parse ***********************// + +Parse::Parse() + : sRepositoryName(), + aGlobalLanguage(), + aProjects(), + sDevelopersManual_RefFilePath() +{ +} + +Parse::~Parse() +{ + csv::erase_container_of_heap_ptrs(aProjects); +} + +void +Parse::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + for ( ; it != itEnd; ) + { + if (*it == C_opt_Name) + do_clName(it, itEnd); + else if (*it == C_opt_LangAll) + aGlobalLanguage.Init(it, itEnd); + else if (*it == C_opt_ExtensionsAll) + aGlobalLanguage.InitExtensions(it, itEnd); + else if (*it == C_opt_DevmanFile) + do_clDevManual(it, itEnd); + else if (*it == C_opt_Project) + do_clProject(it, itEnd); + else if ( *it == C_opt_SourceTree + OR *it == C_opt_SourceDir + OR *it == C_opt_SourceFile ) + do_clDefaultProject(it, itEnd); + else + break; + } // for +} + +void +Parse::do_clName( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "name", + C_opt_Name ); + sRepositoryName = *it; + ++it; +} + +void +Parse::do_clDevManual( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "link file path", + C_opt_DevmanFile ); + sDevelopersManual_RefFilePath = *it; + ++it; +} + +void +Parse::do_clProject( opt_iter & it, + opt_iter itEnd ) +{ + if ( aProjects.size() == 1 ) + { + if ( aProjects.front()->IsDefault() ) + throw X_CommandLine( "Both, named projects and a default project, cannot be used together." ); + } + + S_ProjectData * dpProject = new S_ProjectData(aGlobalLanguage); + ++it; + dpProject->Init(it, itEnd); + aProjects.push_back(dpProject); +} + +void +Parse::do_clDefaultProject( opt_iter & it, + opt_iter itEnd ) +{ + if ( aProjects.size() > 0 ) + { + throw X_CommandLine( "Both, named projects and a default project, cannot be used together." ); + } + + S_ProjectData * dpProject = new S_ProjectData( aGlobalLanguage, + S_ProjectData::default_prj ); + dpProject->Init(it, itEnd); + aProjects.push_back(dpProject); +} + +bool +Parse::do_Run() const +{ + run::Parser + aParser(*this); + return aParser.Perform(); +} + +int +Parse::inq_RunningRank() const +{ + return static_cast<int>(rank_Parse); +} + + + +//************************** S_Sources ***********************// + +void +S_Sources::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + StringVector * + pList = 0; + csv_assert((*it)[0] == '-'); + + for ( ; it != itEnd; ++it) + { + if ((*it)[0] == '-') + { + if (*it == C_opt_SourceTree) + pList = &aTrees; + else if (*it == C_opt_SourceDir) + pList = &aDirectories; + else if (*it == C_opt_SourceFile) + pList = &aFiles; + else + return; + } + else + pList->push_back(*it); + } // end for +} + + + +//************************** S_ProjectData ***********************// + + +S_ProjectData::S_ProjectData( const S_LanguageInfo & i_globalLanguage ) + : sName(), + aRootDirectory(), + aLanguage(i_globalLanguage), + aFiles(), + bIsDefault(false) +{ +} + +S_ProjectData::S_ProjectData( const S_LanguageInfo & i_globalLanguage, + E_Default ) + : sName(), + aRootDirectory("."), + aLanguage(i_globalLanguage), + aFiles(), + bIsDefault(true) +{ +} + +S_ProjectData::~S_ProjectData() +{ +} + +void +S_ProjectData::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + if (NOT IsDefault()) + { + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "name", + C_opt_Project ); + sName = *it; + ++it; + + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "root directory", + C_opt_Project ); + aRootDirectory.Set((*it).c_str(), true); + ++it; + } + + for ( ; it != itEnd; ) + { + if ( *it == C_opt_SourceTree + OR *it == C_opt_SourceDir + OR *it == C_opt_SourceFile ) + aFiles.Init(it, itEnd); +// else if (*it == C_opt_Lang) +// aLanguage.Init(it, itEnd); +// else if (*it == C_opt_Extensions) +// aLanguage.InitExtensions(it, itEnd); + else + break; + } // for +} + +} // namespace command +} // namespace autodoc + + + diff --git a/autodoc/source/exes/adc_uni/adc_cmd_parse.hxx b/autodoc/source/exes/adc_uni/adc_cmd_parse.hxx new file mode 100644 index 000000000000..c84e65659a70 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmd_parse.hxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmd_parse.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_ADC_CMD_PARSE_HXX +#define ADC_ADC_CMD_PARSE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "adc_cmd.hxx" + // COMPONENTS +#include <cosv/ploc.hxx> + // PARAMETERS + +namespace autodoc +{ +namespace command +{ + +/** A command context which holds the currently parsed programing language + and its valid file extensions. +*/ +struct S_LanguageInfo : public Context +{ + enum E_ProgrammingLanguage + { + none, + cpp, + idl, + java + }; + S_LanguageInfo() + : eLanguage(none), + aExtensions() {} + ~S_LanguageInfo(); + + void InitExtensions( + opt_iter & it, + opt_iter itEnd ); + // DATA + E_ProgrammingLanguage + eLanguage; + StringVector aExtensions; // An empty string is possible and means exactly that: files without extension. + + private: + // Interface Context: + virtual void do_Init( + opt_iter & it, + opt_iter itEnd ); +}; + + +class S_ProjectData; + + +/** A command that parses source code into the Autodoc Repository. +*/ +class Parse : public Command +{ + public: + typedef std::vector< DYN S_ProjectData * > ProjectList; + typedef ProjectList::const_iterator ProjectIterator; + + Parse(); + ~Parse(); + + // INQUIRY + const String & ReposyName() const; + const S_LanguageInfo & + GlobalLanguage() const; + ProjectIterator ProjectsBegin() const; + ProjectIterator ProjectsEnd() const; + const String & DevelopersManual_RefFilePath() const + { return sDevelopersManual_RefFilePath; } + + private: + // Interface Context: + virtual void do_Init( + opt_iter & i_nCurArgsBegin, + opt_iter i_nEndOfAllArgs ); + // Interface Command: + virtual bool do_Run() const; + virtual int inq_RunningRank() const; + + // Locals + void do_clName( + opt_iter & it, + opt_iter itEnd ); + void do_clDevManual( + opt_iter & it, + opt_iter itEnd ); + void do_clProject( + opt_iter & it, + opt_iter itEnd ); + void do_clDefaultProject( + opt_iter & it, + opt_iter itEnd ); + + // DATA + String sRepositoryName; + S_LanguageInfo aGlobalLanguage; + + ProjectList aProjects; + + String sDevelopersManual_RefFilePath; +}; + +inline const String & +Parse::ReposyName() const + { return sRepositoryName; } +inline const S_LanguageInfo & +Parse::GlobalLanguage() const + { return aGlobalLanguage; } +inline Parse::ProjectIterator +Parse::ProjectsBegin() const + { return aProjects.begin(); } +inline Parse::ProjectIterator +Parse::ProjectsEnd() const + { return aProjects.end(); } +//inline const String & +//Parse::DevelopersManual_RefFilePath() const +// { return sDevelopersManual_RefFilePath; } +//inline const String & +//Parse::DevelopersManual_HtmlRoot() const +// { return sDevelopersManual_HtmlRoot; } + + +struct S_Sources : public Context +{ + StringVector aTrees; + StringVector aDirectories; + StringVector aFiles; + + private: + // Interface Context: + virtual void do_Init( + opt_iter & it, + opt_iter itEnd ); +}; + +class S_ProjectData : public Context +{ + public: + enum E_Default { default_prj }; + + S_ProjectData( + const S_LanguageInfo & + i_globalLanguage ); + S_ProjectData( + const S_LanguageInfo & + i_globalLanguage, + E_Default unused ); + ~S_ProjectData(); + + bool IsDefault() const { return bIsDefault; } + const String & Name() const { return sName; } + const csv::ploc::Path & + RootDirectory() const { return aRootDirectory; } + const S_LanguageInfo & + Language() const { return aLanguage; } + const S_Sources Sources() const { return aFiles; } + + private: + // Interface Context: + virtual void do_Init( + opt_iter & it, + opt_iter itEnd ); + // Locals + + // DATA + String sName; + csv::ploc::Path aRootDirectory; + S_LanguageInfo aLanguage; + S_Sources aFiles; + bool bIsDefault; +}; + + +} // namespace command +} // namespace autodoc + + +#endif diff --git a/autodoc/source/exes/adc_uni/adc_cmds.cxx b/autodoc/source/exes/adc_uni/adc_cmds.cxx new file mode 100644 index 000000000000..8c689e9f6e45 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmds.cxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmds.cxx,v $ + * $Revision: 1.10 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "adc_cmds.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary.hxx> +#include <autodoc/displaying.hxx> +#include <autodoc/dsp_html_std.hxx> +#include <display/corframe.hxx> +#include <adc_cl.hxx> + + +namespace autodoc +{ +namespace command +{ + +extern const String C_opt_Include("-I:"); + +extern const String C_opt_Verbose("-v"); + +extern const String C_opt_Parse("-parse"); +extern const String C_opt_Name("-name"); +extern const String C_opt_LangAll("-lg"); +extern const String C_opt_ExtensionsAll("-extg"); +extern const String C_opt_DevmanFile("-dvgfile"); +extern const String C_opt_SinceFile("-sincefile"); + +extern const String C_arg_Cplusplus("c++"); +extern const String C_arg_Idl("idl"); +extern const String C_arg_Java("java"); + +extern const String C_opt_Project("-p"); +//extern const String C_opt_Lang; +//extern const String C_opt_Extensions; +extern const String C_opt_SourceDir("-d"); +extern const String C_opt_SourceTree("-t"); +extern const String C_opt_SourceFile("-f"); + +extern const String C_opt_CreateHtml("-html"); +extern const String C_opt_DevmanRoot("-dvgroot"); + +//extern const String C_opt_CreateXml("-xml"); +//extern const String C_opt_Load("-load"); +//extern const String C_opt_Save("-save"); + +extern const String C_opt_ExternNamespace("-extnsp"); +extern const String C_opt_ExternRoot("-extroot"); + + + +//************************** CreateHTML ***********************// + +CreateHtml::CreateHtml() + : sOutputRootDirectory(), + sDevelopersManual_HtmlRoot() +{ +} + +CreateHtml::~CreateHtml() +{ +} + +void +CreateHtml::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + ++it; + CHECKOPT( it != itEnd && (*it).char_at(0) != '-', + "output directory", C_opt_CreateHtml ); + sOutputRootDirectory = *it; + + for ( ++it; + it != itEnd AND (*it == C_opt_DevmanRoot); + ++it ) + { + if (*it == C_opt_DevmanRoot) + { + ++it; + CHECKOPT( it != itEnd AND (*it).char_at(0) != '-', + "HTML root directory of Developers Guide", + C_opt_DevmanRoot ); + sDevelopersManual_HtmlRoot = *it; + } + } // end for +} + +bool +CreateHtml::do_Run() const +{ + if ( CommandLine::Get_().IdlUsed() ) + run_Idl(); + if ( CommandLine::Get_().CppUsed() ) + run_Cpp(); + return true; +} + +int +CreateHtml::inq_RunningRank() const +{ + return static_cast<int>(rank_CreateHtml); +} + +void +CreateHtml::run_Idl() const +{ + const ary::idl::Gate & + rGate = CommandLine::Get_().TheRepository().Gate_Idl(); + + Cout() << "Creating HTML-output into the directory " + << sOutputRootDirectory + << "." + << Endl(); + + const DisplayToolsFactory_Ifc & + rToolsFactory = DisplayToolsFactory_Ifc::GetIt_(); + Dyn<autodoc::HtmlDisplay_Idl_Ifc> + pDisplay( rToolsFactory.Create_HtmlDisplay_Idl() ); + + DYN display::CorporateFrame & // KORR_FUTURE: Remove the need for const_cast + drFrame = const_cast< display::CorporateFrame& >(rToolsFactory.Create_StdFrame()); + if (NOT DevelopersManual_HtmlRoot().empty()) + drFrame.Set_DevelopersGuideHtmlRoot( DevelopersManual_HtmlRoot() ); + + pDisplay->Run( sOutputRootDirectory, + rGate, + drFrame ); +} + +void +CreateHtml::run_Cpp() const +{ + const ary::Repository & + rReposy = CommandLine::Get_().TheRepository(); + const ary::cpp::Gate & + rGate = rReposy.Gate_Cpp(); + + const DisplayToolsFactory_Ifc & + rToolsFactory = DisplayToolsFactory_Ifc::GetIt_(); + Dyn< autodoc::HtmlDisplay_UdkStd > + pDisplay( rToolsFactory.Create_HtmlDisplay_UdkStd() ); + + pDisplay->Run( sOutputRootDirectory, + rGate, + rToolsFactory.Create_StdFrame() ); +} + + +} // namespace command +} // namespace autodoc diff --git a/autodoc/source/exes/adc_uni/adc_cmds.hxx b/autodoc/source/exes/adc_uni/adc_cmds.hxx new file mode 100644 index 000000000000..67f2426cae74 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_cmds.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_cmds.hxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_ADC_CMDS_HXX +#define ADC_ADC_CMDS_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "adc_cmd.hxx" + // COMPONENTS + // PARAMETERS + +namespace autodoc +{ +namespace command +{ + + +/** A command that produces HTML output from the Autodoc Repository. +*/ +class CreateHtml : public Command +{ + public: + CreateHtml(); + ~CreateHtml(); + + const String & OutputDir() const; + const String & DevelopersManual_HtmlRoot() const + { return sDevelopersManual_HtmlRoot; } + + private: + // Interface Context: + virtual void do_Init( + opt_iter & i_nCurArgsBegin, + opt_iter i_nEndOfAllArgs ); + // Interface Command: + virtual bool do_Run() const; + virtual int inq_RunningRank() const; + + // Locals + void run_Cpp() const; + void run_Idl() const; + + // DATA + String sOutputRootDirectory; + String sDevelopersManual_HtmlRoot; +}; + +inline const String & +CreateHtml::OutputDir() const + { return sOutputRootDirectory; } + + +extern const String C_opt_Verbose; + +extern const String C_opt_Parse; +extern const String C_opt_Name; +extern const String C_opt_LangAll; +extern const String C_opt_ExtensionsAll; +extern const String C_opt_DevmanFile; +extern const String C_opt_SinceFile; + +extern const String C_arg_Cplusplus; +extern const String C_arg_Idl; +extern const String C_arg_Java; + +extern const String C_opt_Project; +//extern const String C_opt_Lang; +//extern const String C_opt_Extensions; +extern const String C_opt_SourceTree; +extern const String C_opt_SourceDir; +extern const String C_opt_SourceFile; + +extern const String C_opt_CreateHtml; +extern const String C_opt_DevmanRoot; + +//extern const String C_opt_CreateXml; +//extern const String C_opt_Load; +//extern const String C_opt_Save; + +extern const String C_opt_ExternNamespace; +extern const String C_opt_ExternRoot; + + +inline void +CHECKOPT( bool b, const char * miss, const String & opt ) +{ + if ( NOT b ) + { + StreamLock slMsg(100); + throw X_CommandLine( slMsg() << "Missing " << miss <<" after " << opt << "." << c_str ); + } +} + +} // namespace command +} // namespace autodoc + + +#endif diff --git a/autodoc/source/exes/adc_uni/adc_msg.cxx b/autodoc/source/exes/adc_uni/adc_msg.cxx new file mode 100644 index 000000000000..5beaac48b936 --- /dev/null +++ b/autodoc/source/exes/adc_uni/adc_msg.cxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: adc_msg.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <adc_msg.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <cosv/tpl/tpltools.hxx> + + +namespace autodoc +{ + + +Messages::Messages() + : aMissingDocs(), + aParseErrors(), + aInvalidConstSymbols(), + aUnresolvedLinks(), + aTypeVsMemberMisuses() +{ +} + +Messages::~Messages() +{ +} + +void +Messages::WriteFile(const String & i_sOutputFilePath) +{ + csv::File + aOut(i_sOutputFilePath, csv::CFM_CREATE); + aOut.open(); + + // KORR_FUTURE Enable this when appropriate: + WriteParagraph( aOut, + aParseErrors, + "Incompletely Parsed Files", + "Stopped parsing at " ); + + WriteParagraph( aOut, + aMissingDocs, + "Entities Without Documentation", + " in " ); + + WriteParagraph( aOut, + aInvalidConstSymbols, + "Incorrectly Written Const Symbols", + " in " ); + + WriteParagraph( aOut, + aUnresolvedLinks, + "Unresolved Links", + " in\n " ); + + WriteParagraph( aOut, + aTypeVsMemberMisuses, + "Confusion or Misuse of <Type> vs. <Member>", + " in " ); + aOut.close(); +} + +void +Messages::Out_MissingDoc( const String & i_sEntity, + const String & i_sFile, + uintt i_nLine) +{ + AddValue( aMissingDocs, + i_sEntity, + i_sFile, + i_nLine ); +} + +void +Messages::Out_ParseError( const String & i_sFile, + uintt i_nLine) +{ + aParseErrors[Location(i_sFile,i_nLine)] = String::Null_(); +} + +void +Messages::Out_InvalidConstSymbol( const String & i_sText, + const String & i_sFile, + uintt i_nLine) +{ + AddValue( aInvalidConstSymbols, + i_sText, + i_sFile, + i_nLine ); +} + +void +Messages::Out_UnresolvedLink( const String & i_sLinkText, + const String & i_sFile, + uintt i_nLine) +{ + AddValue( aUnresolvedLinks, + i_sLinkText, + i_sFile, + i_nLine ); +} + +void +Messages::Out_TypeVsMemberMisuse( const String & i_sLinkText, + const String & i_sFile, + uintt i_nLine) +{ + AddValue( aTypeVsMemberMisuses, + i_sLinkText, + i_sFile, + i_nLine ); +} + +Messages & +Messages::The_() +{ + static Messages TheMessages_; + return TheMessages_; +} + +void +Messages::AddValue( MessageMap & o_dest, + const String & i_sText, + const String & i_sFile, + uintt i_nLine ) +{ + String & + rDest = o_dest[Location(i_sFile,i_nLine)]; + StreamLock + slDest(2000); + if (NOT rDest.empty()) + slDest() << rDest; + slDest() << "\n " << i_sText; + rDest = slDest().c_str(); +} + +void +Messages::WriteParagraph( csv::File & o_out, + const MessageMap & i_source, + const String & i_title, + const String & ) +{ + StreamStr aLine(2000); + + // Write title of paragraph: + aLine << i_title + << "\n"; + o_out.write(aLine.c_str()); + + aLine.seekp(0); + for (uintt i = i_title.size(); i > 0; --i) + { + aLine << '-'; + } + aLine << "\n\n"; + o_out.write(aLine.c_str()); + + // Write Content + MessageMap::const_iterator it = i_source.begin(); + MessageMap::const_iterator itEnd = i_source.end(); + for ( ; it != itEnd; ++it ) + { + aLine.seekp(0); + aLine << (*it).first.sFile; + // Nobody wants to see this, if we don't know the line: + if ((*it).first.nLine != 0) + { + aLine << ", line " + << (*it).first.nLine; + } + if (NOT (*it).second.empty()) + { + aLine << ':' + << (*it).second + << "\n"; + } + o_out.write(aLine.c_str()); + } + o_out.write("\n\n\n"); +} + +} // namespace autodoc diff --git a/autodoc/source/exes/adc_uni/cmd_run.cxx b/autodoc/source/exes/adc_uni/cmd_run.cxx new file mode 100644 index 000000000000..a346d0df7336 --- /dev/null +++ b/autodoc/source/exes/adc_uni/cmd_run.cxx @@ -0,0 +1,616 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cmd_run.cxx,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "cmd_run.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <cosv/x.hxx> +#include <ary/ary.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ip_ce.hxx> +#include <autodoc/filecoli.hxx> +#include <autodoc/parsing.hxx> +#include <autodoc/prs_code.hxx> +#include <autodoc/prs_docu.hxx> +#include <parser/unoidl.hxx> +#include <adc_cl.hxx> +#include "adc_cmd_parse.hxx" +#include "adc_cmds.hxx" + +namespace autodoc +{ +namespace command +{ +namespace run +{ + +Parser::Parser( const Parse & i_command ) + : rCommand(i_command), + pCppParser(), + pCppDocuInterpreter(), + pIdlParser() +{ +} + +Parser::~Parser() +{ +} + +bool +Parser::Perform() +{ + Cout() << "Parsing the repository " + << rCommand.ReposyName() + << " ..." + << Endl(); + try + { + ::ary::Repository & + rAry = CommandLine::Get_().TheRepository(); + rAry.Set_Title(rCommand.ReposyName()); + + Dyn< FileCollector_Ifc > + pFiles( ParseToolsFactory().Create_FileCollector(6000) ); + + bool bIDL = false; + bool bCpp = false; + + command::Parse::ProjectIterator + itEnd = rCommand.ProjectsEnd(); + for ( command::Parse::ProjectIterator it = rCommand.ProjectsBegin(); + it != itEnd; + ++it ) + { + uintt nCount = GatherFiles( *pFiles, *(*it) ); + Cout() << nCount + << " files found to parse in project " + << (*it)->Name() + << "." + << Endl(); + + switch ( (*it)->Language().eLanguage ) + { + case command::S_LanguageInfo::idl: + { + Get_IdlParser().Run(*pFiles); + bIDL = true; + } break; + case command::S_LanguageInfo::cpp: + { + Get_CppParser().Run( *pFiles ); + bCpp = true; + } break; + default: + Cerr() << "Project in yet unimplemented language skipped." + << Endl(); + } + } // end for + + if (bCpp) + { + rAry.Gate_Cpp().Calculate_AllSecondaryInformation(); + } + if (bIDL) + { + rAry.Gate_Idl().Calculate_AllSecondaryInformation( + rCommand.DevelopersManual_RefFilePath() ); + +// ::ary::idl::SecondariesPilot & +// rIdl2sPilot = rAry.Gate_Idl().Secondaries(); +// +// rIdl2sPilot.CheckAllInterfaceBases( rAry.Gate_Idl() ); +// rIdl2sPilot.Connect_Types2Ces(); +// rIdl2sPilot.Gather_CrossReferences(); +// +// if (NOT rCommand.DevelopersManual_RefFilePath().empty()) +// { +// csv::File +// aFile(rCommand.DevelopersManual_RefFilePath(), csv::CFM_READ); +// if ( aFile.open() ) +// { +// rIdl2sPilot.Read_Links2DevManual(aFile); +// aFile.close(); +// } +// } + } // endif (bIDL) + + return true; + + } // end try + catch (csv::Exception & xx) + { + xx.GetInfo(Cerr()); + Cerr() << " program will exit." << Endl(); + + return false; + } +} + +CodeParser_Ifc & +Parser::Get_CppParser() +{ + if ( NOT pCppParser ) + Create_CppParser(); + return *pCppParser; +} + +IdlParser & +Parser::Get_IdlParser() +{ + if ( NOT pIdlParser ) + Create_IdlParser(); + return *pIdlParser; +} + +void +Parser::Create_CppParser() +{ + pCppParser = ParseToolsFactory().Create_Parser_Cplusplus(); + pCppDocuInterpreter = ParseToolsFactory().Create_DocuParser_AutodocStyle(); + + pCppParser->Setup( CommandLine::Get_().TheRepository(), + *pCppDocuInterpreter ); +} + +void +Parser::Create_IdlParser() +{ + pIdlParser = new IdlParser(CommandLine::Get_().TheRepository()); +} + +const ParseToolsFactory_Ifc & +Parser::ParseToolsFactory() +{ + return ParseToolsFactory_Ifc::GetIt_(); +} + +uintt +Parser::GatherFiles( FileCollector_Ifc & o_rFiles, + const S_ProjectData & i_rProject ) +{ + uintt ret = 0; + o_rFiles.EraseAll(); + + typedef StringVector StrVector; + typedef StrVector::const_iterator StrIterator; + const S_Sources & + rSources = i_rProject.Sources(); + const StrVector & + rExtensions = i_rProject.Language().aExtensions; + + StrIterator it; + StrIterator itTreesEnd = rSources.aTrees.end(); + StrIterator itDirsEnd = rSources.aDirectories.end(); + StrIterator itFilesEnd = rSources.aFiles.end(); + StrIterator itExt; + StrIterator itExtEnd = rExtensions.end(); + + csv::StreamStr aDir(500); + i_rProject.RootDirectory().Get( aDir ); + + uintt nProjectDir_AddPosition = + ( strcmp(aDir.c_str(),".\\") == 0 OR strcmp(aDir.c_str(),"./") == 0 ) + ? 0 + : uintt( aDir.tellp() ); + + for ( it = rSources.aDirectories.begin(); + it != itDirsEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + for ( itExt = rExtensions.begin(); + itExt != itExtEnd; + ++itExt ) + { + ret += o_rFiles.AddFilesFrom( aDir.c_str(), + *itExt, + FileCollector_Ifc::flat ); + } // end for itExt + } // end for it + for ( it = rSources.aTrees.begin(); + it != itTreesEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + for ( itExt = rExtensions.begin(); + itExt != itExtEnd; + ++itExt ) + { + ret += o_rFiles.AddFilesFrom( aDir.c_str(), + *itExt, + FileCollector_Ifc::recursive ); + } // end for itExt + } // end for it + for ( it = rSources.aFiles.begin(); + it != itFilesEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + o_rFiles.AddFile( aDir.c_str() ); + } // end for it + ret += rSources.aFiles.size(); + + return ret; +} + + +} // namespace run +} // namespace command + + +#if 0 +inline const ParseToolsFactory_Ifc & +CommandRunner::ParseToolsFactory() + { return ParseToolsFactory_Ifc::GetIt_(); } + + +inline const command::S_LanguageInfo & +CommandRunner::Get_ProjectLanguage( const command::Parse & i_rCommand, + const command::S_ProjectData & i_rProject ) +{ + if ( i_rProject.pLanguage ) + return *i_rProject.pLanguage; + return *i_rCommand.GlobalLanguageInfo(); +} + +inline bool +CommandRunner::HasParsedCpp() const + { return pCppParser; } +inline bool +CommandRunner::HasParsedIdl() const + { return pIdlParser; } + + + + + +CommandRunner::CommandRunner() + : pCommandLine(0), + pReposy(0), + pNewReposy(0), + nResultCode(0) +{ + Cout() << "\nAutodoc version 2.2.1" + << "\n-------------------" + << "\n" << Endl(); +} + +CommandRunner::~CommandRunner() +{ + ary::Repository::Destroy_(); + Cout() << "\n" << Endl(); +} + +void +CommandRunner::Run( const CommandLine & i_rCL ) +{ + ary::Repository::Destroy_(); +// ary::Repository::Destroy_(); + pReposy = 0; + pNewReposy = 0; + nResultCode = 0; + pCommandLine = &i_rCL; + + pCommandLine->Run(); +} + +void +CommandRunner::Parse() +{ + try + { + + csv_assert( pCommandLine->Cmd_Parse() != 0 ); + const command::Parse & + rCmd = *pCommandLine->Cmd_Parse(); + + Cout() << "Parsing the repository " + << rCmd.ReposyName() + << " ..." + << Endl(); + + if ( pReposy == 0 ) + pReposy = & ary::Repository::Create_( rCmd.ReposyName(), 0 ); + if ( pNewReposy == 0 ) + pNewReposy = & ary::Repository::Create_( rCmd.ReposyName() ); + + Dyn< FileCollector_Ifc > pFiles; + pFiles = ParseToolsFactory().Create_FileCollector(6000); + + bool bCpp = false; + bool bIDL = false; + + command::Parse::ProjectIterator itEnd = rCmd.ProjectsEnd(); + for ( command::Parse::ProjectIterator it = rCmd.ProjectsBegin(); + it != itEnd; + ++it ) + { + + uintt nCount = GatherFiles( *pFiles, rCmd, *(*it) ); + Cout() << nCount + << " files found to parse in project " + << (*it)->Name() + << "." + << Endl(); + + + switch ( Get_ProjectLanguage(rCmd, *(*it)).eLanguage ) + { + case command::S_LanguageInfo::cpp: + { + Get_CppParser().Run( (*it)->Name(), + (*it)->RootDirectory(), + *pFiles ); + bCpp = true; + } break; + case command::S_LanguageInfo::idl: + { + Get_IdlParser().Run(*pFiles); + bIDL = true; + } break; + default: + Cerr() << "Project in yet unimplemented language skipped." + << Endl(); + } + } // end for + + if (bCpp) + pReposy->RwGate_Cpp().Connect_AllTypes_2_TheirRelated_CodeEntites(); + if (bIDL) + { + pNewReposy->Gate_Idl().Secondaries().Connect_Types2Ces(); + pNewReposy->Gate_Idl().Secondaries().Gather_CrossReferences(); + } + + } // end try + catch (csv::Exception & xx) + { + xx.GetInfo(Cerr()); + Cerr() << " program will exit." << Endl(); + nResultCode = 1; + } + catch (...) + { + Cerr() << "Unknown exception - program will exit." << Endl(); + nResultCode = 1; + } +} + +void +CommandRunner::Load() +{ + Cout() << "This would load the repository from the directory " + << pCommandLine->Cmd_Load()->ReposyDir() + << "." + << Endl(); +} + + +void +CommandRunner::Save() +{ + Cout() << "This would save the repository into the directory " + << pCommandLine->Cmd_Save()->ReposyDir() + << "." + << Endl(); +} + + +void +CommandRunner::CreateHtml() +{ + Cout() << "Creating HTML-output into the directory " + << pCommandLine->Cmd_CreateHtml()->OutputDir() + << "." + << Endl(); + + if ( HasParsedCpp() ) + CreateHtml_NewStyle(); + if ( HasParsedIdl() ) + CreateHtml_OldIdlStyle(); +} + + + +void +CommandRunner::CreateXml() +{ + Cout() << "This would create the XML-output into the directory " + << pCommandLine->Cmd_CreateXml()->OutputDir() + << "." + << Endl(); +} + +CodeParser_Ifc & +CommandRunner::Get_CppParser() +{ + if ( NOT pCppParser ) + Create_CppParser(); + return *pCppParser; +} + +IdlParser & +CommandRunner::Get_IdlParser() +{ + if ( NOT pIdlParser ) + Create_IdlParser(); + return *pIdlParser; +} + +void +CommandRunner::Create_CppParser() +{ + pCppParser = ParseToolsFactory().Create_Parser_Cplusplus(); + pCppDocuInterpreter = ParseToolsFactory().Create_DocuParser_AutodocStyle(); + + pCppParser->Setup( *pReposy, + *pCppDocuInterpreter ); +} + +void +CommandRunner::Create_IdlParser() +{ + pIdlParser = new IdlParser(*pNewReposy); +} + +uintt +CommandRunner::GatherFiles( FileCollector_Ifc & o_rFiles, + const command::Parse & i_rCommand, + const command::S_ProjectData & i_rProject ) +{ + uintt ret = 0; + o_rFiles.EraseAll(); + + typedef StringVector StrVector; + typedef StrVector::const_iterator StrIterator; + const command::S_Sources & + rSources = i_rProject.aFiles; + const StrVector & + rExtensions = Get_ProjectLanguage(i_rCommand,i_rProject).aExtensions; + + StrIterator it; + StrIterator itDirsEnd = rSources.aDirectories.end(); + StrIterator itTreesEnd = i_rProject.aFiles.aTrees.end(); + StrIterator itFilesEnd = i_rProject.aFiles.aFiles.end(); + StrIterator itExt; + StrIterator itExtEnd = rExtensions.end(); + + csv::StreamStr aDir(500); + i_rProject.aRootDirectory.Get( aDir ); + + uintt nProjectDir_AddPosition = + ( strcmp(aDir.c_str(),".\\") == 0 OR strcmp(aDir.c_str(),"./") == 0 ) + ? 0 + : uintt( aDir.tellp() ); + + for ( it = rSources.aDirectories.begin(); + it != itDirsEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + for ( itExt = rExtensions.begin(); + itExt != itExtEnd; + ++itExt ) + { + ret += o_rFiles.AddFilesFrom( aDir.c_str(), + *itExt, + FileCollector_Ifc::flat ); + } // end for itExt + } // end for it + for ( it = rSources.aTrees.begin(); + it != itTreesEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + for ( itExt = rExtensions.begin(); + itExt != itExtEnd; + ++itExt ) + { + ret += o_rFiles.AddFilesFrom( aDir.c_str(), + *itExt, + FileCollector_Ifc::recursive ); + } // end for itExt + } // end for it + for ( it = rSources.aFiles.begin(); + it != itFilesEnd; + ++it ) + { + aDir.seekp( nProjectDir_AddPosition ); + aDir << *it; + + o_rFiles.AddFile( aDir.c_str() ); + } // end for it + ret += rSources.aFiles.size(); + + return ret; +} + +void +CommandRunner::CreateHtml_NewStyle() +{ + const ary::cpp::DisplayGate & + rGate = pReposy->DisplayGate_Cpp(); + + Dyn< autodoc::HtmlDisplay_UdkStd > pHtmlDisplay; + pHtmlDisplay = DisplayToolsFactory_Ifc::GetIt_() + .Create_HtmlDisplay_UdkStd(); + + pHtmlDisplay->Run( pCommandLine->Cmd_CreateHtml()->OutputDir(), + rGate, + DisplayToolsFactory_Ifc::GetIt_().Create_StdFrame() ); +} + +void +CommandRunner::CreateHtml_OldIdlStyle() +{ + ary::idl::Gate & + rAryGate = pNewReposy->Gate_Idl(); + + // Read DevManualLinkFile: + // KORR_FUTURE + csv::File + aFile("devmanref.txt", csv::CFM_READ); + if ( aFile.open() ) + { + rAryGate.Secondaries().Read_Links2DevManual(aFile); + aFile.close(); + } + + // New Style Output + Dyn<autodoc::HtmlDisplay_Idl_Ifc> pNewDisplay; + pNewDisplay = DisplayToolsFactory_Ifc::GetIt_() + .Create_HtmlDisplay_Idl(); + pNewDisplay->Run( pCommandLine->Cmd_CreateHtml()->OutputDir(), + rAryGate, + DisplayToolsFactory_Ifc::GetIt_().Create_StdFrame() ); +} +#endif // 0 + +} // namespace autodoc + + + + diff --git a/autodoc/source/exes/adc_uni/cmd_run.hxx b/autodoc/source/exes/adc_uni/cmd_run.hxx new file mode 100644 index 000000000000..4e4cbf7f23b8 --- /dev/null +++ b/autodoc/source/exes/adc_uni/cmd_run.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cmd_run.hxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_CMD_RUN_HXX +#define ADC_CMD_RUN_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cosv/comdline.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ + class Repository; +} + +namespace autodoc +{ + class FileCollector_Ifc; + class ParseToolsFactory_Ifc; + class CodeParser_Ifc; + class DocumentationParser_Ifc; + class IdlParser; + + +namespace command +{ + class Parse; + class S_ProjectData; + struct S_LanguageInfo; + +namespace run +{ + +/** Performs an ::autodoc::command::Parse . +*/ +class Parser +{ + public: + Parser( + const Parse & i_command ); + ~Parser(); + + bool Perform(); + + private: + // Locals + CodeParser_Ifc & Get_CppParser(); + IdlParser & Get_IdlParser(); + void Create_CppParser(); + void Create_IdlParser(); + const ParseToolsFactory_Ifc & + ParseToolsFactory(); + uintt GatherFiles( + FileCollector_Ifc & o_rFiles, + const S_ProjectData & + i_rProject ); + // DATA + const Parse & rCommand; + + Dyn<CodeParser_Ifc> pCppParser; + Dyn<DocumentationParser_Ifc> + pCppDocuInterpreter; + Dyn<IdlParser> pIdlParser; +}; + + + + +// IMPLEMENTATION + + +} // namespace run +} // namespace command +} // namespace autodoc + +#endif diff --git a/autodoc/source/exes/adc_uni/cmd_sincedata.cxx b/autodoc/source/exes/adc_uni/cmd_sincedata.cxx new file mode 100644 index 000000000000..0a577eb8ef8f --- /dev/null +++ b/autodoc/source/exes/adc_uni/cmd_sincedata.cxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cmd_sincedata.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "cmd_sincedata.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <cosv/tpl/tpltools.hxx> +#include "adc_cmds.hxx" + + + +namespace autodoc +{ +namespace command +{ + +SinceTagTransformationData::SinceTagTransformationData() + : aTransformationTable() +{ +} + +SinceTagTransformationData::~SinceTagTransformationData() +{ +} + +bool +SinceTagTransformationData::DoesTransform() const +{ + return NOT aTransformationTable.empty(); +} + +const String & +SinceTagTransformationData::DisplayOf( const String & i_versionNumber ) const +{ + if (DoesTransform()) + { + StreamLock + sl(200); + sl() << i_versionNumber; + sl().strip_frontback_whitespace(); + String + sVersionNumber(sl().c_str()); + + const String * + ret = csv::find_in_map(aTransformationTable, sVersionNumber); + return ret != 0 + ? *ret + : String::Null_(); + } + else + { + return i_versionNumber; + } +} + +void +SinceTagTransformationData::do_Init( opt_iter & it, + opt_iter itEnd ) +{ + ++it; // Cur is since-file path. + + CHECKOPT( it != itEnd , + "file path", + C_opt_SinceFile ); + + csv::File aSinceFile(*it); + csv::OpenCloseGuard aSinceFileGuard(aSinceFile); + StreamStr sLine(200); + + if (aSinceFileGuard) + { + for ( sLine.operator_read_line(aSinceFile); + NOT sLine.empty(); + sLine.operator_read_line(aSinceFile) ) + { + + if (*sLine.begin() != '"') + continue; + + const char * pVersion = sLine.c_str() + 1; + const char * pVersionEnd = strchr(pVersion, '"'); + if (pVersionEnd == 0) + continue; + const char * pDisplay = strchr(pVersionEnd+1, '"'); + if (pDisplay == 0) + continue; + ++pDisplay; + const char * pDisplayEnd = strchr(pDisplay, '"'); + if (pDisplayEnd == 0) + continue; + + aTransformationTable[ String(pVersion,pVersionEnd) ] + = String(pDisplay,pDisplayEnd); + sLine.clear(); + } // end for + } // end if + + ++it; // Cur is next option. +} + +} // namespace command +} // namespace autodoc diff --git a/autodoc/source/exes/adc_uni/cmd_sincedata.hxx b/autodoc/source/exes/adc_uni/cmd_sincedata.hxx new file mode 100644 index 000000000000..5c539d2d813d --- /dev/null +++ b/autodoc/source/exes/adc_uni/cmd_sincedata.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cmd_sincedata.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_CMD_SINCEDATA_HXX +#define ADC_CMD_SINCEDATA_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "adc_cmd.hxx" + // COMPONENTS + // PARAMETERS + +namespace autodoc +{ +namespace command +{ + + +/** Provides replacements for the contents of the @@since documentation tag. + + Because the @@since tag is part of the source code, it allows only one kind + of version information there. If this is to be mapped for different products + (example: from OpenOffice.org versions in the @@since tag to StarOffice or + StarSuite products), the value of @@since needs a replacement, which is provided + by this class. + +*/ +class SinceTagTransformationData : public Context +{ + public: + /** The key of this map are the version numbers within @since. + The value is the string to display for each version number. + */ + typedef std::map<String,String> Map_Version2Display; + + // LIFECYCLE + SinceTagTransformationData(); + virtual ~SinceTagTransformationData(); + + // INQUIRY + /// False, if no transformation table exists. + bool DoesTransform() const; + + /** Gets the string to display for a version number. + + @param i_sVersionNumber + Usually should be the result of ->StripSinceTagValue(). + */ + const String & DisplayOf( + const String & i_sVersionNumber ) const; + private: + // Interface Context: + virtual void do_Init( + opt_iter & i_nCurArgsBegin, + opt_iter i_nEndOfAllArgs ); + // DATA + Map_Version2Display aTransformationTable; +}; + + +} // namespace command +} // namespace autodoc + + +#endif diff --git a/autodoc/source/exes/adc_uni/main.cxx b/autodoc/source/exes/adc_uni/main.cxx new file mode 100644 index 000000000000..549451e60eaa --- /dev/null +++ b/autodoc/source/exes/adc_uni/main.cxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: main.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> + + +// NOT FULLY DECLARED SERVICES + +#include <adc_cl.hxx> +#include "cmd_run.hxx" + + +int +#ifdef WNT + _cdecl +#endif +main( int argc, + char * argv[] ) +{ + autodoc::CommandLine aCL; + aCL.Init(argc, argv); + if (NOT aCL.CheckParameters() ) + return 1; + + int ret = aCL.Run(); + return ret; +} + + + diff --git a/autodoc/source/exes/adc_uni/makefile.mk b/autodoc/source/exes/adc_uni/makefile.mk new file mode 100644 index 000000000000..01cb0e41cd05 --- /dev/null +++ b/autodoc/source/exes/adc_uni/makefile.mk @@ -0,0 +1,108 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.16 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=autodoc +TARGETTYPE=CUI + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + +UWINAPILIB=$(0) +LIBSALCPPRT=$(0) + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/adc_cl.obj \ + $(OBJ)$/adc_cmd_parse.obj \ + $(OBJ)$/adc_cmds.obj \ + $(OBJ)$/adc_msg.obj \ + $(OBJ)$/cmd_run.obj \ + $(OBJ)$/cmd_sincedata.obj + + +# --- Targets ------------------------------------------------------ + +LIB1TARGET=$(LB)$/atdoc.lib +LIB1FILES= \ + $(LB)$/$(TARGET).lib $(LB)$/autodoc_tools.lib \ + $(LB)$/ary_kernel.lib $(LB)$/ary_cpp.lib $(LB)$/ary_idl.lib \ + $(LB)$/ary_info.lib $(LB)$/ary_loc.lib \ + $(LB)$/parser_kernel.lib $(LB)$/parser_tokens.lib $(LB)$/parser_semantic.lib \ + $(LB)$/parser_cpp.lib $(LB)$/parser_adoc.lib \ + $(LB)$/display_kernel.lib $(LB)$/display_html.lib $(LB)$/display_idl.lib \ + $(LB)$/display_toolkit.lib $(LB)$/parser2_tokens.lib \ + $(LB)$/parser2_s2_luidl.lib $(LB)$/parser2_s2_dsapi.lib \ + $(LB)$/ary2_cinfo.lib $(LB)$/ary_doc.lib + + + +APP1TARGET= $(TARGET) +APP1STACK= 1000000 +APP1OBJS= $(OBJ)$/main.obj + +APP1RPATH=SDK + +.IF "$(GUI)"=="WNT" +APP1STDLIBS= $(LIBSTLPORT) $(COSVLIB) $(UDMLIB) +.ELSE +.IF "$(OS)"=="MACOSX" +# See <http://porting.openoffice.org/servlets/ReadMsg?list=mac&msgNo=6911>: +APP1STDLIBS= $(LIBSTLPORT) -Wl,-all_load -ludm -lcosv +.ELSE +APP1STDLIBS= -lcosv -ludm +.ENDIF +.ENDIF + +APP1LIBS=$(LB)$/atdoc.lib + +DEPOBJFILES += $(APP1OBJS) + +APP1DEPN= $(LB)$/$(TARGET).lib $(LB)$/autodoc_tools.lib \ + $(LB)$/ary_kernel.lib $(LB)$/ary_cpp.lib $(LB)$/ary_idl.lib \ + $(LB)$/ary_info.lib $(LB)$/ary_loc.lib \ + $(LB)$/parser_kernel.lib $(LB)$/parser_tokens.lib $(LB)$/parser_semantic.lib \ + $(LB)$/parser_cpp.lib $(LB)$/parser_adoc.lib \ + $(LB)$/display_kernel.lib $(LB)$/display_html.lib $(LB)$/display_idl.lib \ + $(LB)$/display_toolkit.lib $(LB)$/parser2_tokens.lib \ + $(LB)$/parser2_s2_luidl.lib $(LB)$/parser2_s2_dsapi.lib \ + $(LB)$/ary2_cinfo.lib $(LB)$/ary_doc.lib + + +.INCLUDE : target.mk diff --git a/autodoc/source/exes/adc_uni/spec-CommandLine.txt b/autodoc/source/exes/adc_uni/spec-CommandLine.txt new file mode 100644 index 000000000000..756b3184a2e4 --- /dev/null +++ b/autodoc/source/exes/adc_uni/spec-CommandLine.txt @@ -0,0 +1,181 @@ + Command Line Options + -------------------- + +autodoc [-v <level>] + -html <out> + [-extroot <externroot> -extnsp <externnamespace>] + -lg <proglang> + [-t <sourcetree>[ <sourcetree> ...] + [-d <sourcedir>[ <sourcedir> ...] + [-f <sourcefile>[ <sourcefile> ...] + + + -html <OutputDirectory> + Directory where the output will be created. + + -lg <ProgrammingLanguage> + Allowed values: "c++" or "idl" + + -extroot <externroot> + Only together with "-lg idl" and -extnsp. + Links to code entities not found within the current parsed + code, will be linked there, but only if -extnsp is given and + the linked entity is in the given namespace. + <externroot> is a http link, it needs no "http://" at the + beginning nor slash at the end. + + -extnsp <externnamespace> + Only together with "-lg idl" and -extroot. + If a code entity is not found in the current parsed code, but + dwells in the namespace (or its children) given here, it is + linked into the locátion given by -extroot. + <externnamespace> is an absolute qualified namespace, + starting with "::". + + -t <SourceTree>* + Directory with all subdirectories. + + -d <SourceDirectory>* + Directory without subdirectories. + + -f <SourceFile>* + Any file. Here also files with extensions not matching the + language are accepted. + + -I:<ResponseFile> + Each line in the response file has to have one command line + option. No whitespace at start of line. + + -C:<ConfigurationFile> + Format see below. + + -v <VerboseLevel> + Only for debugging. Bits 1, 2 and 4 in any combination give + different output. + + -h + Displays help. + -? + Displays help. + + + + + + Command Line Options especially for the OpenOffice.org SDK + ---------------------------------------------------------- + + -dvgroot <DevelopersGuide> + Root directory of the SDK Developers Guide. + + -dvgfile <ReferenceFile> + File with references to the SDK Developers Guide. + + -sincefile <@since-AssociationFile> + File that maps OpenOffice versions to the wished displayed version names. + + -idlref <IdlDocumentationRoot> <Namespace[,Namespace ...]> + Gives the outputdirectory of an IDL documentation, where + symbols not found in the currently parsed namespaces of C++ + or Java can be found. + + + + Configure File Format + --------------------- + +<AutodocConfiguration> + <RepositoryName></RepositoryName> + // Base name of the binary repository files. + // Has to be a valid file name. + + <HtmlOutputTitle></HtmlOutputTitle> + // Title on the "welcome page" of the created HTML documentation. + // Can be any text. + + <CppExtensions></CppExtensions> + // Overwrites the default. Default is: .hxx .h .hpp + // Format: File extensions with a dot in front, like ".hcc". + + <IdlExtensions></IdlExtensions> + // Overwrites the default. Default is: .idl + // Format: File extensions with a dot in front, like ".txt". + + <CppDocu html="(on|off) off"/> + + <IdlDocu html="(on|off) on"/> + +</AutodocConfiguration> + + + + + + + Historical Command Line Options + ------------------------------- + +autodoc.exe + [ -v <VerboseNr> ] + -html <OutputDirectory> + { + [ -parse ] + [ -name <RepositoryName> ] + -lg <ProgrammingLanguage> + { + [ -p <ProjectName> <ProjectRootDirectory> ] + { + -t <SourceDirectory>* + -d <SourceDirectory>* + -f <SourceFile>* + }+ + }+ + } + +Legend: + <Text> + command line parameter + [ ] + optional + { } + Block of connected options. + The sequence of not connected options does not matter. So the -html or -v options can be used before or after all the parsing options. + + + once or more times + * + none or more times + + +Explanation of the Options + -v <VerboseNr> Only for debugging. Bits 1, 2 and 4 in any combination give different output. + -html <OutputDirectory> + Gives the directory, where a HTML version of the docu shall be generated. + -parse Starts the block, where all the parse options are given. This can be omitted, because the parse options are identifiable without it, but it may make a commandline more readable. + -name <RepositoryName> This name appears as title of the documentation (currently only in the in the C++ version). + -lg <ProgrammingLanguage> + + + Possible values are: + + c++ + This parses all files with the endings .hxx and .h . + idl + This parses all files with the ending .idl . + + -p with -t/-d/-f: If there are more than one project, the -p option is required for each one. + + The directory given wit the -p option is the root directory of the project. + If there is no -p option, the working directory is seen as root. + + All paths given with -t/-d/-f are relative to that root directory. It is possible to use "." as argument for -t or -d. + + Each of -t/-d/-f can have several arguments: + One could write "-f file1.hxx file2.hxx file_xyz.hxx" + After each -p (or after -lg, if there is no -p option), there has to be at least one of the following three: + -t Tree, which means: include subdirectories + -d Directory, which means: no subdirectories + -f File", which means: single file name with ending. + This option also allows to parse some files with an ending different from those, the -lg option implies. + + + diff --git a/autodoc/source/exes/adc_uni/spec-DevGuideReferenceFile.txt b/autodoc/source/exes/adc_uni/spec-DevGuideReferenceFile.txt new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/autodoc/source/exes/adc_uni/spec-DevGuideReferenceFile.txt diff --git a/autodoc/source/exes/adc_uni/spec-SinceTag_Handling.txt b/autodoc/source/exes/adc_uni/spec-SinceTag_Handling.txt new file mode 100644 index 000000000000..7cf264e76be3 --- /dev/null +++ b/autodoc/source/exes/adc_uni/spec-SinceTag_Handling.txt @@ -0,0 +1,49 @@ + General Handling + ---------------- + +- The developer inserts the OpenOffice.org version into the @since tag. + +- @since-Tag may contain any string which needs to end with a Version number. + The first cipher following immediately on a white space is interpreted as start of the version number. + +- The @since Tag must stay completely within one line to allow tool support for retargeting. + +- To replace @since entries in the generated documentation, one needs to use + the command line option + + -sincefile <TransformationFile-path> + + This option has to occur immediately after the -html option. + If this option is not given, the original text of the @since tag is + displayed. + + If the TransformationFile does not contain a specific entry, + nothing is displayed for this entry. + + + + Format of the @since Tag Transformation File + -------------------------------------------- + +Example +------- + +***** BEGIN OF FILE ****** +"1.1" "StarOffice 7.0" +"2.0" "StarOffice 8.0" +"2.1" "StarOffice 9.0" +***** END OF FILE ****** + + + +Rules and Restrictions +---------------------- + +* Each line contains two strings within "". + The first string is the OpenOffice.org version number which is found in the @since tag. + The second string is the string to display for this version. +* No specific order among product versions is needed. +* Empty lines and whitespaces are allowed, except: + - Non empty lines must not start with white space. + - Within OpenOffice.org version strings, no whitespace is allowed. +* Whitespace within display strings is displayed as it is. |