1*f7c60c9cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f7c60c9cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f7c60c9cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f7c60c9cSAndrew Rist * distributed with this work for additional information 6*f7c60c9cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f7c60c9cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f7c60c9cSAndrew Rist * "License"); you may not use this file except in compliance 9*f7c60c9cSAndrew Rist * with the License. You may obtain a copy of the License at 10*f7c60c9cSAndrew Rist * 11*f7c60c9cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f7c60c9cSAndrew Rist * 13*f7c60c9cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f7c60c9cSAndrew Rist * software distributed under the License is distributed on an 15*f7c60c9cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f7c60c9cSAndrew Rist * KIND, either express or implied. See the License for the 17*f7c60c9cSAndrew Rist * specific language governing permissions and limitations 18*f7c60c9cSAndrew Rist * under the License. 19*f7c60c9cSAndrew Rist * 20*f7c60c9cSAndrew Rist *************************************************************/ 21*f7c60c9cSAndrew Rist 22*f7c60c9cSAndrew Rist 23cdf0e10cSrcweir #ifndef _RSCRSC_HXX 24cdf0e10cSrcweir #define _RSCRSC_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #ifndef RSCALL_H 27cdf0e10cSrcweir #include <rscall.h> 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir #ifndef RSCERROR_H 30cdf0e10cSrcweir #include <rscerror.h> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #ifndef RSCTOOLS_HXX 33cdf0e10cSrcweir #include <rsctools.hxx> 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <list> 37cdf0e10cSrcweir 38cdf0e10cSrcweir class RscTypCont; 39cdf0e10cSrcweir class DirEntry; 40cdf0e10cSrcweir 41cdf0e10cSrcweir /****************** T Y P E S ********************************************/ 42cdf0e10cSrcweir 43cdf0e10cSrcweir #define MAX_INPUTFILES 100 44cdf0e10cSrcweir #define MAX_SYMBOLS 10 45cdf0e10cSrcweir #define MAX_INCLUDES 10 46cdf0e10cSrcweir 47cdf0e10cSrcweir /****************** R s c C m d L i n e **********************************/ 48cdf0e10cSrcweir class RscCmdLine 49cdf0e10cSrcweir { 50cdf0e10cSrcweir void Init(); 51cdf0e10cSrcweir 52cdf0e10cSrcweir public: 53cdf0e10cSrcweir 54cdf0e10cSrcweir RscStrList aInputList; // Liste der Quelldateien 55cdf0e10cSrcweir RscStrList aSymbolList; // Liste der Symbole 56cdf0e10cSrcweir ByteString aPath; // Liste der Pfade 57cdf0e10cSrcweir RSCBYTEORDER_TYPE nByteOrder; 58cdf0e10cSrcweir unsigned short nCommands; // Steuerbits 59cdf0e10cSrcweir ByteString aOutputLst; // Name der List-Ausgabedatei 60cdf0e10cSrcweir ByteString aOutputSrs; // Name der Srs-Ausgabedatei 61cdf0e10cSrcweir ByteString aOutputSrc; // Name der Src-Ausgabedatei 62cdf0e10cSrcweir ByteString aOutputRcCtor; // Name der Ctor-Ausgabedatei 63cdf0e10cSrcweir ByteString aOutputCxx; // Name der Cxx-Ausgabedatei 64cdf0e10cSrcweir ByteString aOutputHxx; // Name der Hxx-Ausgabedatei 65cdf0e10cSrcweir ByteString aTouchFile; // create this file when done in rsc2 66cdf0e10cSrcweir ByteString aILDir; 67cdf0e10cSrcweir 68cdf0e10cSrcweir struct OutputFile 69cdf0e10cSrcweir { 70cdf0e10cSrcweir ByteString aLangName; // language name 71cdf0e10cSrcweir ByteString aOutputRc; // target file 72cdf0e10cSrcweir ByteString aLangSearchPath; // language specific search path 73cdf0e10cSrcweir ::std::list< ByteString > aSysSearchDirs; // pathes to search for images 74cdf0e10cSrcweir OutputFileRscCmdLine::OutputFile75cdf0e10cSrcweir OutputFile() {} 76cdf0e10cSrcweir }; 77cdf0e10cSrcweir 78cdf0e10cSrcweir std::list<OutputFile> m_aOutputFiles; 79cdf0e10cSrcweir std::list< std::pair< rtl::OString, rtl::OString > > m_aReplacements; 80cdf0e10cSrcweir 81cdf0e10cSrcweir RscCmdLine( int argc, char ** argv, RscError * pEH ); 82cdf0e10cSrcweir RscCmdLine(); 83cdf0e10cSrcweir 84cdf0e10cSrcweir ~RscCmdLine(); 85cdf0e10cSrcweir 86cdf0e10cSrcweir ::rtl::OString substitutePaths( const ::rtl::OString& rIn ); 87cdf0e10cSrcweir }; 88cdf0e10cSrcweir /****************** R s c ************************************************/ 89cdf0e10cSrcweir 90cdf0e10cSrcweir struct WriteRcContext; 91cdf0e10cSrcweir 92cdf0e10cSrcweir class RscCompiler 93cdf0e10cSrcweir { 94cdf0e10cSrcweir private: 95cdf0e10cSrcweir RscStrList aTmpFileList; // Liste der Tmp-Dateien 96cdf0e10cSrcweir ByteString aTmpOutputHxx; // Name der TempHxx-Ausgabedatei 97cdf0e10cSrcweir ByteString aTmpOutputCxx; // Name der TempCxx-Ausgabedatei 98cdf0e10cSrcweir ByteString aTmpOutputRcCtor; // Name der Temp Ctor-Ausgabedatei 99cdf0e10cSrcweir ByteString aTmpOutputSrc; // Name der TempSrc-Ausgabedatei 100cdf0e10cSrcweir 101cdf0e10cSrcweir void CreateResFile( const char * pRc ); 102cdf0e10cSrcweir void Append( const ByteString& rOutputSrs, const ByteString& rTmpFile ); 103cdf0e10cSrcweir void OpenInput( const ByteString& rInput ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir bool GetImageFilePath( const RscCmdLine::OutputFile& rOutputFile, 106cdf0e10cSrcweir const WriteRcContext& rContext, 107cdf0e10cSrcweir const ByteString& rBaseFileName, 108cdf0e10cSrcweir ByteString& rImagePath, 109cdf0e10cSrcweir FILE* pSysListFile ); 110cdf0e10cSrcweir void PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, 111cdf0e10cSrcweir const WriteRcContext& rContext, 112cdf0e10cSrcweir const DirEntry& rSrsInPath, 113cdf0e10cSrcweir const DirEntry& rSrsOutPath ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir public: 116cdf0e10cSrcweir RscTypCont* pTC; // String und Id-Verwalter 117cdf0e10cSrcweir RscCmdLine* pCL; // Kommandozeile 118cdf0e10cSrcweir FILE * fListing; // Ausgabedatei fuer Listings 119cdf0e10cSrcweir FILE * fExitFile; // bei Abbruch muss diese Datei geschlossen werden 120cdf0e10cSrcweir 121cdf0e10cSrcweir RscCompiler( RscCmdLine *, RscTypCont * ); 122cdf0e10cSrcweir ~RscCompiler(); 123cdf0e10cSrcweir 124cdf0e10cSrcweir ERRTYPE Start(); 125cdf0e10cSrcweir ByteString GetTmpFileName(); // Die Dateien werden geloescht 126cdf0e10cSrcweir 127cdf0e10cSrcweir // Include Statements lesen 128cdf0e10cSrcweir ERRTYPE IncludeParser( sal_uLong lFileKey ); 129cdf0e10cSrcweir ERRTYPE ParseOneFile( sal_uLong lFileKey, const RscCmdLine::OutputFile* pOutputFile, const WriteRcContext* pContext ); 130cdf0e10cSrcweir ERRTYPE Link(); 131cdf0e10cSrcweir void EndCompile(); 132cdf0e10cSrcweir }; 133cdf0e10cSrcweir 134cdf0e10cSrcweir #endif //_RSCRSC_HXX 135