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 _RSCPAR_HXX 28 #define _RSCPAR_HXX 29 30 #include <rsctools.hxx> 31 #include <rscerror.h> 32 33 /****************** C L A S S E S ****************************************/ 34 class RscTypCont; 35 class RscExpression; 36 /*********** R s c F i l e I n s t ***************************************/ 37 38 #define READBUFFER_MAX 256 39 class RscFileInst 40 { 41 ERRTYPE aFirstError;// Erster Fehler 42 sal_uInt32 nErrorLine; // Zeile des ersten Fehlers 43 sal_uInt32 nErrorPos; // Position des ersten Fehlers 44 sal_Bool bIncLine; // Muss Zeilennummer incrementiert werden 45 sal_uInt32 nLineNo; // Zeile in der Eingabedatei 46 sal_uLong lFileIndex; // Index auf Eingabedatei 47 sal_uLong lSrcIndex; // Index auf Basisdatei 48 FILE * fInputFile; // Eingabedatei 49 char * pInput; // Lesepuffer 50 sal_uInt32 nInputBufLen; // Laenge des Lesepuffers 51 sal_uInt32 nInputPos; // Position im Lesepuffer 52 sal_uInt32 nInputEndPos;// Ende im Lesepuffer 53 char * pLine; // Zeile 54 sal_uInt32 nLineBufLen;//Lange des Zeilenpuffres 55 sal_uInt32 nScanPos; // Position in der Zeile 56 int cLastChar; 57 sal_Bool bEof; 58 59 public: 60 RscTypCont * pTypCont; 61 void Init(); // ctor initialisieren 62 RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, 63 sal_uLong lFileIndex, FILE * fFile ); 64 RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, 65 sal_uLong lFileIndex, const ByteString & ); 66 ~RscFileInst(); 67 sal_Bool IsEof() const { return bEof; } 68 void SetFileIndex( sal_uLong lFIndex ) { lFileIndex = lFIndex; } 69 sal_uLong GetFileIndex() { return( lFileIndex ); } 70 sal_uLong GetSrcIndex() { return( lSrcIndex ); } 71 void SetLineNo( sal_uInt32 nLine ) { nLineNo = nLine; } 72 sal_uInt32 GetLineNo() { return( nLineNo ); } 73 sal_uInt32 GetScanPos() { return( nScanPos ); } 74 char * GetLine() { return( pLine ); } 75 int GetChar(); 76 int GetFastChar() { return pLine[ nScanPos ] ? 77 pLine[ nScanPos++ ] : GetChar(); 78 } 79 void GetNewLine(); 80 // Fehlerbehandlung 81 void SetError( ERRTYPE aError ); 82 ERRTYPE GetError() { return aFirstError; } 83 sal_uInt32 GetErrorLine() { return nErrorLine; } 84 sal_uInt32 GetErrorPos() { return nErrorPos; } 85 }; 86 87 /******************* F u n c t i o n *************************************/ 88 void IncludeParser( RscFileInst * pFileInst ); 89 ERRTYPE parser( RscFileInst * pFileInst ); 90 RscExpression * MacroParser( RscFileInst & rFileInst ); 91 92 #endif // _RSCPAR_HXX 93