xref: /aoo41x/main/rsc/inc/rscpar.hxx (revision f7c60c9c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _RSCPAR_HXX
24 #define _RSCPAR_HXX
25 
26 #include <rsctools.hxx>
27 #include <rscerror.h>
28 
29 /****************** C L A S S E S ****************************************/
30 class RscTypCont;
31 class RscExpression;
32 /*********** R s c F i l e I n s t ***************************************/
33 
34 #define READBUFFER_MAX	256
35 class RscFileInst
36 {
37 	ERRTYPE 			aFirstError;// Erster Fehler
38 	sal_uInt32				nErrorLine; // Zeile des ersten Fehlers
39 	sal_uInt32				nErrorPos;	// Position des ersten Fehlers
40 	sal_Bool				bIncLine;	// Muss Zeilennummer incrementiert werden
41 	sal_uInt32				nLineNo;	// Zeile in der Eingabedatei
42 	sal_uLong				lFileIndex; // Index auf Eingabedatei
43 	sal_uLong				lSrcIndex;	// Index auf Basisdatei
44 	FILE *				fInputFile; // Eingabedatei
45 	char *				pInput; 	// Lesepuffer
46 	sal_uInt32				nInputBufLen; // Laenge des Lesepuffers
47 	sal_uInt32				nInputPos;	// Position im Lesepuffer
48 	sal_uInt32				nInputEndPos;// Ende im Lesepuffer
49 	char *				pLine;		// Zeile
50 	sal_uInt32				nLineBufLen;//Lange des Zeilenpuffres
51 	sal_uInt32				nScanPos;	// Position in der Zeile
52 	int 				cLastChar;
53 	sal_Bool				bEof;
54 
55 public:
56 	RscTypCont *		pTypCont;
57 	void	Init();  // ctor initialisieren
58 			RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc,
59 						 sal_uLong lFileIndex, FILE * fFile );
60 			RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc,
61 						 sal_uLong lFileIndex, const ByteString & );
62 			~RscFileInst();
IsEof() const63 	sal_Bool	IsEof() const { return bEof; }
SetFileIndex(sal_uLong lFIndex)64 	void	SetFileIndex( sal_uLong lFIndex ) { lFileIndex = lFIndex;  }
GetFileIndex()65 	sal_uLong	GetFileIndex()				  { return( lFileIndex );  }
GetSrcIndex()66 	sal_uLong	GetSrcIndex()				  { return( lSrcIndex );   }
SetLineNo(sal_uInt32 nLine)67 	void	SetLineNo( sal_uInt32 nLine )	  { nLineNo = nLine;	   }
GetLineNo()68 	sal_uInt32	GetLineNo() 				  { return( nLineNo );	   }
GetScanPos()69 	sal_uInt32	GetScanPos()				  { return( nScanPos );    }
GetLine()70 	char *	GetLine()					  { return( pLine );	   }
71 	int 	GetChar();
GetFastChar()72 	int 	GetFastChar() { return pLine[ nScanPos ] ?
73 								pLine[ nScanPos++ ] : GetChar();
74 						  }
75 	void	GetNewLine();
76 			// Fehlerbehandlung
77 	void	SetError( ERRTYPE aError );
GetError()78 	ERRTYPE GetError()					  { return aFirstError;    }
GetErrorLine()79 	sal_uInt32	GetErrorLine()				  { return nErrorLine;	   }
GetErrorPos()80 	sal_uInt32	GetErrorPos()				  { return nErrorPos;	   }
81 };
82 
83 /******************* F u n c t i o n *************************************/
84 void IncludeParser( RscFileInst * pFileInst );
85 ERRTYPE parser( RscFileInst * pFileInst );
86 RscExpression * MacroParser( RscFileInst & rFileInst );
87 
88 #endif // _RSCPAR_HXX
89