1*d291ea28SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*d291ea28SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d291ea28SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*d291ea28SAndrew Rist * distributed with this work for additional information
6*d291ea28SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*d291ea28SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d291ea28SAndrew Rist * "License"); you may not use this file except in compliance
9*d291ea28SAndrew Rist * with the License. You may obtain a copy of the License at
10*d291ea28SAndrew Rist *
11*d291ea28SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*d291ea28SAndrew Rist *
13*d291ea28SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d291ea28SAndrew Rist * software distributed under the License is distributed on an
15*d291ea28SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d291ea28SAndrew Rist * KIND, either express or implied. See the License for the
17*d291ea28SAndrew Rist * specific language governing permissions and limitations
18*d291ea28SAndrew Rist * under the License.
19*d291ea28SAndrew Rist *
20*d291ea28SAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "adc_cmds.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <ary/ary.hxx>
28cdf0e10cSrcweir #include <autodoc/displaying.hxx>
29cdf0e10cSrcweir #include <autodoc/dsp_html_std.hxx>
30cdf0e10cSrcweir #include <display/corframe.hxx>
31cdf0e10cSrcweir #include <adc_cl.hxx>
32cdf0e10cSrcweir
33cdf0e10cSrcweir
34cdf0e10cSrcweir namespace autodoc
35cdf0e10cSrcweir {
36cdf0e10cSrcweir namespace command
37cdf0e10cSrcweir {
38cdf0e10cSrcweir
39cdf0e10cSrcweir extern const String C_opt_Include("-I:");
40cdf0e10cSrcweir
41cdf0e10cSrcweir extern const String C_opt_Verbose("-v");
42cdf0e10cSrcweir
43cdf0e10cSrcweir extern const String C_opt_Parse("-parse");
44cdf0e10cSrcweir extern const String C_opt_Name("-name");
45cdf0e10cSrcweir extern const String C_opt_LangAll("-lg");
46cdf0e10cSrcweir extern const String C_opt_ExtensionsAll("-extg");
47cdf0e10cSrcweir extern const String C_opt_DevmanFile("-dvgfile");
48cdf0e10cSrcweir extern const String C_opt_SinceFile("-sincefile");
49cdf0e10cSrcweir
50cdf0e10cSrcweir extern const String C_arg_Cplusplus("c++");
51cdf0e10cSrcweir extern const String C_arg_Idl("idl");
52cdf0e10cSrcweir extern const String C_arg_Java("java");
53cdf0e10cSrcweir
54cdf0e10cSrcweir extern const String C_opt_Project("-p");
55cdf0e10cSrcweir //extern const String C_opt_Lang;
56cdf0e10cSrcweir //extern const String C_opt_Extensions;
57cdf0e10cSrcweir extern const String C_opt_SourceDir("-d");
58cdf0e10cSrcweir extern const String C_opt_SourceTree("-t");
59cdf0e10cSrcweir extern const String C_opt_SourceFile("-f");
60cdf0e10cSrcweir
61cdf0e10cSrcweir extern const String C_opt_CreateHtml("-html");
62cdf0e10cSrcweir extern const String C_opt_DevmanRoot("-dvgroot");
63cdf0e10cSrcweir
64cdf0e10cSrcweir //extern const String C_opt_CreateXml("-xml");
65cdf0e10cSrcweir //extern const String C_opt_Load("-load");
66cdf0e10cSrcweir //extern const String C_opt_Save("-save");
67cdf0e10cSrcweir
68cdf0e10cSrcweir extern const String C_opt_ExternNamespace("-extnsp");
69cdf0e10cSrcweir extern const String C_opt_ExternRoot("-extroot");
70cdf0e10cSrcweir
71cdf0e10cSrcweir
72cdf0e10cSrcweir
73cdf0e10cSrcweir //************************** CreateHTML ***********************//
74cdf0e10cSrcweir
CreateHtml()75cdf0e10cSrcweir CreateHtml::CreateHtml()
76cdf0e10cSrcweir : sOutputRootDirectory(),
77cdf0e10cSrcweir sDevelopersManual_HtmlRoot()
78cdf0e10cSrcweir {
79cdf0e10cSrcweir }
80cdf0e10cSrcweir
~CreateHtml()81cdf0e10cSrcweir CreateHtml::~CreateHtml()
82cdf0e10cSrcweir {
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
85cdf0e10cSrcweir void
do_Init(opt_iter & it,opt_iter itEnd)86cdf0e10cSrcweir CreateHtml::do_Init( opt_iter & it,
87cdf0e10cSrcweir opt_iter itEnd )
88cdf0e10cSrcweir {
89cdf0e10cSrcweir ++it;
90cdf0e10cSrcweir CHECKOPT( it != itEnd && (*it).char_at(0) != '-',
91cdf0e10cSrcweir "output directory", C_opt_CreateHtml );
92cdf0e10cSrcweir sOutputRootDirectory = *it;
93cdf0e10cSrcweir
94cdf0e10cSrcweir for ( ++it;
95cdf0e10cSrcweir it != itEnd AND (*it == C_opt_DevmanRoot);
96cdf0e10cSrcweir ++it )
97cdf0e10cSrcweir {
98cdf0e10cSrcweir if (*it == C_opt_DevmanRoot)
99cdf0e10cSrcweir {
100cdf0e10cSrcweir ++it;
101cdf0e10cSrcweir CHECKOPT( it != itEnd AND (*it).char_at(0) != '-',
102cdf0e10cSrcweir "HTML root directory of Developers Guide",
103cdf0e10cSrcweir C_opt_DevmanRoot );
104cdf0e10cSrcweir sDevelopersManual_HtmlRoot = *it;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir } // end for
107cdf0e10cSrcweir }
108cdf0e10cSrcweir
109cdf0e10cSrcweir bool
do_Run() const110cdf0e10cSrcweir CreateHtml::do_Run() const
111cdf0e10cSrcweir {
112cdf0e10cSrcweir if ( CommandLine::Get_().IdlUsed() )
113cdf0e10cSrcweir run_Idl();
114cdf0e10cSrcweir if ( CommandLine::Get_().CppUsed() )
115cdf0e10cSrcweir run_Cpp();
116cdf0e10cSrcweir return true;
117cdf0e10cSrcweir }
118cdf0e10cSrcweir
119cdf0e10cSrcweir int
inq_RunningRank() const120cdf0e10cSrcweir CreateHtml::inq_RunningRank() const
121cdf0e10cSrcweir {
122cdf0e10cSrcweir return static_cast<int>(rank_CreateHtml);
123cdf0e10cSrcweir }
124cdf0e10cSrcweir
125cdf0e10cSrcweir void
run_Idl() const126cdf0e10cSrcweir CreateHtml::run_Idl() const
127cdf0e10cSrcweir {
128cdf0e10cSrcweir const ary::idl::Gate &
129cdf0e10cSrcweir rGate = CommandLine::Get_().TheRepository().Gate_Idl();
130cdf0e10cSrcweir
131cdf0e10cSrcweir Cout() << "Creating HTML-output into the directory "
132cdf0e10cSrcweir << sOutputRootDirectory
133cdf0e10cSrcweir << "."
134cdf0e10cSrcweir << Endl();
135cdf0e10cSrcweir
136cdf0e10cSrcweir const DisplayToolsFactory_Ifc &
137cdf0e10cSrcweir rToolsFactory = DisplayToolsFactory_Ifc::GetIt_();
138cdf0e10cSrcweir Dyn<autodoc::HtmlDisplay_Idl_Ifc>
139cdf0e10cSrcweir pDisplay( rToolsFactory.Create_HtmlDisplay_Idl() );
140cdf0e10cSrcweir
141cdf0e10cSrcweir DYN display::CorporateFrame & // KORR_FUTURE: Remove the need for const_cast
142cdf0e10cSrcweir drFrame = const_cast< display::CorporateFrame& >(rToolsFactory.Create_StdFrame());
143cdf0e10cSrcweir if (NOT DevelopersManual_HtmlRoot().empty())
144cdf0e10cSrcweir drFrame.Set_DevelopersGuideHtmlRoot( DevelopersManual_HtmlRoot() );
145cdf0e10cSrcweir
146cdf0e10cSrcweir pDisplay->Run( sOutputRootDirectory,
147cdf0e10cSrcweir rGate,
148cdf0e10cSrcweir drFrame );
149cdf0e10cSrcweir }
150cdf0e10cSrcweir
151cdf0e10cSrcweir void
run_Cpp() const152cdf0e10cSrcweir CreateHtml::run_Cpp() const
153cdf0e10cSrcweir {
154cdf0e10cSrcweir const ary::Repository &
155cdf0e10cSrcweir rReposy = CommandLine::Get_().TheRepository();
156cdf0e10cSrcweir const ary::cpp::Gate &
157cdf0e10cSrcweir rGate = rReposy.Gate_Cpp();
158cdf0e10cSrcweir
159cdf0e10cSrcweir const DisplayToolsFactory_Ifc &
160cdf0e10cSrcweir rToolsFactory = DisplayToolsFactory_Ifc::GetIt_();
161cdf0e10cSrcweir Dyn< autodoc::HtmlDisplay_UdkStd >
162cdf0e10cSrcweir pDisplay( rToolsFactory.Create_HtmlDisplay_UdkStd() );
163cdf0e10cSrcweir
164cdf0e10cSrcweir pDisplay->Run( sOutputRootDirectory,
165cdf0e10cSrcweir rGate,
166cdf0e10cSrcweir rToolsFactory.Create_StdFrame() );
167cdf0e10cSrcweir }
168cdf0e10cSrcweir
169cdf0e10cSrcweir
170cdf0e10cSrcweir } // namespace command
171cdf0e10cSrcweir } // namespace autodoc
172