1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoidl.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <parser/unoidl.hxx>
35 // NOT FULLY DECLARED SERVICES
37 #include <cosv/file.hxx>
38 #include <ary/ary.hxx>
39 #include <ary/idl/i_gate.hxx>
40 #include <ary/doc/d_oldidldocu.hxx>
41 #include <../parser/inc/x_docu.hxx>
42 #include <parser/parserinfo.hxx>
43 #include <tools/filecoll.hxx>
44 #include <tools/tkpchars.hxx>
45 #include <s2_luidl/tkp_uidl.hxx>
46 #include <s2_luidl/distrib.hxx>
47 #include <s2_luidl/pe_file2.hxx>
48 #include <s2_dsapi/cx_dsapi.hxx>
49 #include <adc_msg.hxx>
50 #include <x_parse2.hxx>
58 class FileParsePerformers
64 ParserInfo
& io_rParserInfo
);
67 const char * i_sFullPath
);
72 CharacterSource aFileLoader
;
73 Dyn
<csi::uidl::TokenParser_Uidl
>
75 csi::uidl::TokenDistributor
77 Dyn
<csi::uidl::PE_File
>
78 pFileParseEnvironment
;
81 ParserInfo
& rParserInfo
;
85 IdlParser::IdlParser( ary::Repository
& io_rRepository
)
86 : pRepository(&io_rRepository
)
91 IdlParser::Run( const autodoc::FileCollector_Ifc
& i_rFiles
)
93 Dyn
<FileParsePerformers
>
95 new FileParsePerformers(*pRepository
,
96 static_cast< ParserInfo
& >(*this)) );
98 FileCollector::const_iterator iEnd
= i_rFiles
.End();
99 for ( FileCollector::const_iterator iter
= i_rFiles
.Begin();
103 Cout() << (*iter
) << " ..."<< Endl();
107 pFileParsePerformers
->ParseFile(*iter
);
109 catch (X_AutodocParser
&)
112 TheMessages().Out_ParseError(CurFile(), CurLine());
114 = new FileParsePerformers(*pRepository
,
115 static_cast< ParserInfo
& >(*this));
119 // Currently thic catches only wrong since tags, while since tags are
120 // transformed. In this case the program shall be terminated.
121 Cerr() << xd
<< Endl();
126 Cout() << "Unknown error." << Endl();
128 // pFileParsePerformers = new FileParsePerformers( *pRepository );
132 pFileParsePerformers
->ConnectLinks();
135 FileParsePerformers::FileParsePerformers( ary::Repository
& io_rRepository
,
136 ParserInfo
& io_rParserInfo
)
138 aDistributor(io_rRepository
, io_rParserInfo
),
139 rRepository( io_rRepository
),
140 rParserInfo(io_rParserInfo
)
142 DYN
csi::dsapi::Context_Docu
*
144 = new csi::dsapi::Context_Docu( aDistributor
.DocuTokens_Receiver() );
145 pTokens
= new csi::uidl::TokenParser_Uidl( aDistributor
.CodeTokens_Receiver(), *dpDocuContext
);
146 pFileParseEnvironment
147 = new csi::uidl::PE_File(aDistributor
,rParserInfo
);
149 aDistributor
.SetTokenProvider(*pTokens
);
150 aDistributor
.SetTopParseEnvironment(*pFileParseEnvironment
);
154 FileParsePerformers::ParseFile( const char * i_sFullPath
)
156 csv::File
aFile(i_sFullPath
);
158 aFile
.open( csv::CFM_READ
);
159 csv_assert( aFile
.is_open() );
160 aFileLoader
.LoadText(aFile
);
163 rParserInfo
.Set_CurFile(i_sFullPath
, true); // true = count lines
164 pTokens
->Start(aFileLoader
);
165 aDistributor
.Reset();
168 aDistributor
.TradeToken();
169 } while ( NOT aFileLoader
.IsFinished() );
173 FileParsePerformers::ConnectLinks()
176 // rRepository.RwGate_Idl().ConnectAdditionalLinks();
179 } // namespace autodoc