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