xref: /trunk/main/rsc/inc/rscrsc.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _RSCRSC_HXX
28*cdf0e10cSrcweir #define _RSCRSC_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #ifndef RSCALL_H
31*cdf0e10cSrcweir #include <rscall.h>
32*cdf0e10cSrcweir #endif
33*cdf0e10cSrcweir #ifndef RSCERROR_H
34*cdf0e10cSrcweir #include <rscerror.h>
35*cdf0e10cSrcweir #endif
36*cdf0e10cSrcweir #ifndef RSCTOOLS_HXX
37*cdf0e10cSrcweir #include <rsctools.hxx>
38*cdf0e10cSrcweir #endif
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include <list>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir class RscTypCont;
43*cdf0e10cSrcweir class DirEntry;
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir /****************** T Y P E S ********************************************/
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #define MAX_INPUTFILES	100
48*cdf0e10cSrcweir #define MAX_SYMBOLS 	10
49*cdf0e10cSrcweir #define MAX_INCLUDES	10
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir /****************** R s c C m d L i n e **********************************/
52*cdf0e10cSrcweir class RscCmdLine
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir 	void		Init();
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir public:
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir     RscStrList			aInputList; 	// Liste der Quelldateien
59*cdf0e10cSrcweir 	RscStrList			aSymbolList;	// Liste der Symbole
60*cdf0e10cSrcweir 	ByteString			aPath;		    // Liste der Pfade
61*cdf0e10cSrcweir 	RSCBYTEORDER_TYPE	nByteOrder;
62*cdf0e10cSrcweir 	unsigned short		nCommands;		// Steuerbits
63*cdf0e10cSrcweir     ByteString			aOutputLst; 	// Name der List-Ausgabedatei
64*cdf0e10cSrcweir     ByteString			aOutputSrs; 	// Name der Srs-Ausgabedatei
65*cdf0e10cSrcweir     ByteString			aOutputSrc; 	// Name der Src-Ausgabedatei
66*cdf0e10cSrcweir     ByteString			aOutputRcCtor;	// Name der Ctor-Ausgabedatei
67*cdf0e10cSrcweir     ByteString			aOutputCxx; 	// Name der Cxx-Ausgabedatei
68*cdf0e10cSrcweir     ByteString			aOutputHxx; 	// Name der Hxx-Ausgabedatei
69*cdf0e10cSrcweir     ByteString			aTouchFile;		// create this file when done in rsc2
70*cdf0e10cSrcweir     ByteString			aILDir;
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     struct OutputFile
73*cdf0e10cSrcweir     {
74*cdf0e10cSrcweir         ByteString			         aLangName;			// language name
75*cdf0e10cSrcweir         ByteString			         aOutputRc;			// target file
76*cdf0e10cSrcweir         ByteString			         aLangSearchPath;	// language specific search path
77*cdf0e10cSrcweir         ::std::list< ByteString >    aSysSearchDirs;    // pathes to search for images
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir         OutputFile() {}
80*cdf0e10cSrcweir     };
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir     std::list<OutputFile>						            m_aOutputFiles;
83*cdf0e10cSrcweir     std::list< std::pair< rtl::OString, rtl::OString > >    m_aReplacements;
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir                     RscCmdLine( int argc, char ** argv, RscError * pEH );
86*cdf0e10cSrcweir 			        RscCmdLine();
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir 			        ~RscCmdLine();
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir   ::rtl::OString     substitutePaths( const ::rtl::OString& rIn );
91*cdf0e10cSrcweir };
92*cdf0e10cSrcweir /****************** R s c ************************************************/
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir struct WriteRcContext;
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir class RscCompiler
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir private:
99*cdf0e10cSrcweir 	RscStrList		aTmpFileList;	// Liste der Tmp-Dateien
100*cdf0e10cSrcweir 	ByteString		aTmpOutputHxx;	// Name der TempHxx-Ausgabedatei
101*cdf0e10cSrcweir 	ByteString		aTmpOutputCxx;	// Name der TempCxx-Ausgabedatei
102*cdf0e10cSrcweir 	ByteString		aTmpOutputRcCtor; // Name der Temp Ctor-Ausgabedatei
103*cdf0e10cSrcweir 	ByteString		aTmpOutputSrc;	// Name der TempSrc-Ausgabedatei
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 	void			CreateResFile( const char * pRc );
106*cdf0e10cSrcweir 	void			Append( const ByteString& rOutputSrs, const ByteString& rTmpFile );
107*cdf0e10cSrcweir 	void			OpenInput( const ByteString& rInput );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	bool 			GetImageFilePath( const RscCmdLine::OutputFile& rOutputFile,
110*cdf0e10cSrcweir  							      	const WriteRcContext& rContext,
111*cdf0e10cSrcweir 									const ByteString& rBaseFileName,
112*cdf0e10cSrcweir 									ByteString& rImagePath,
113*cdf0e10cSrcweir 									FILE* pSysListFile );
114*cdf0e10cSrcweir 	void			PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
115*cdf0e10cSrcweir  							      	   const WriteRcContext& rContext,
116*cdf0e10cSrcweir 								  	   const DirEntry& rSrsInPath,
117*cdf0e10cSrcweir 								  	   const DirEntry& rSrsOutPath );
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir public:
120*cdf0e10cSrcweir 	RscTypCont* 	pTC;		// String und Id-Verwalter
121*cdf0e10cSrcweir 	RscCmdLine* 	pCL;		// Kommandozeile
122*cdf0e10cSrcweir 	FILE *			fListing;	// Ausgabedatei fuer Listings
123*cdf0e10cSrcweir 	FILE *			fExitFile;	// bei Abbruch muss diese Datei geschlossen werden
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 					RscCompiler( RscCmdLine *, RscTypCont * );
126*cdf0e10cSrcweir 					~RscCompiler();
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	ERRTYPE 		Start();
129*cdf0e10cSrcweir 	ByteString		GetTmpFileName();	// Die Dateien werden geloescht
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 					// Include Statements lesen
132*cdf0e10cSrcweir 	ERRTYPE 		IncludeParser( sal_uLong lFileKey );
133*cdf0e10cSrcweir 	ERRTYPE 		ParseOneFile( sal_uLong lFileKey, const RscCmdLine::OutputFile* pOutputFile, const WriteRcContext* pContext );
134*cdf0e10cSrcweir 	ERRTYPE 		Link();
135*cdf0e10cSrcweir 	void			EndCompile();
136*cdf0e10cSrcweir };
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir #endif //_RSCRSC_HXX
139