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