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