xref: /aoo41x/main/rsc/source/parser/rsclex.hxx (revision b6d138aa)
1f7c60c9cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f7c60c9cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f7c60c9cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f7c60c9cSAndrew Rist  * distributed with this work for additional information
6f7c60c9cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f7c60c9cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f7c60c9cSAndrew Rist  * "License"); you may not use this file except in compliance
9f7c60c9cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10f7c60c9cSAndrew Rist  *
11f7c60c9cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f7c60c9cSAndrew Rist  *
13f7c60c9cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f7c60c9cSAndrew Rist  * software distributed under the License is distributed on an
15f7c60c9cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f7c60c9cSAndrew Rist  * KIND, either express or implied.  See the License for the
17f7c60c9cSAndrew Rist  * specific language governing permissions and limitations
18f7c60c9cSAndrew Rist  * under the License.
19f7c60c9cSAndrew Rist  *
20f7c60c9cSAndrew Rist  *************************************************************/
21f7c60c9cSAndrew Rist 
22f7c60c9cSAndrew Rist 
23cdf0e10cSrcweir #include <tools/stack.hxx>
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <hash_set>
26cdf0e10cSrcweir #include <rtl/strbuf.hxx>
27cdf0e10cSrcweir #include <rtl/string.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir // a buffer for unique strings
30cdf0e10cSrcweir class StringContainer
31cdf0e10cSrcweir {
32cdf0e10cSrcweir     std::hash_set< rtl::OString, rtl::OStringHash >		m_aStrings;
33cdf0e10cSrcweir public:
StringContainer()34cdf0e10cSrcweir     StringContainer() {}
~StringContainer()35cdf0e10cSrcweir     ~StringContainer() {}
36cdf0e10cSrcweir 
37cdf0e10cSrcweir     const char* putString( const char* pString );
38cdf0e10cSrcweir };
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir enum MODE_ENUM { MODE_MODELESS, MODE_APPLICATIONMODAL, MODE_SYSTEMMODAL };
42cdf0e10cSrcweir 
43cdf0e10cSrcweir enum JUSTIFY_ENUM { JUST_CENTER, JUST_RIGHT, JUST_LEFT };
44cdf0e10cSrcweir 
45cdf0e10cSrcweir enum SHOW_ENUM { SHOW_NORMAL, SHOW_MINIMIZED, SHOW_MAXIMIZED };
46cdf0e10cSrcweir 
47cdf0e10cSrcweir enum ENUMHEADER { HEADER_NAME, HEADER_NUMBER };
48cdf0e10cSrcweir 
49cdf0e10cSrcweir enum REF_ENUM { TYPE_NOTHING, TYPE_REF, TYPE_COPY };
50cdf0e10cSrcweir 
51cdf0e10cSrcweir struct RSCHEADER {
52cdf0e10cSrcweir     RscTop *    pClass;
53cdf0e10cSrcweir     RscExpType  nName1;
54cdf0e10cSrcweir     REF_ENUM    nTyp;
55cdf0e10cSrcweir     RscTop *    pRefClass;
56cdf0e10cSrcweir     RscExpType  nName2;
57cdf0e10cSrcweir };
58cdf0e10cSrcweir 
59cdf0e10cSrcweir /************** O b j e c t s t a c k ************************************/
60cdf0e10cSrcweir struct Node {
61cdf0e10cSrcweir     Node*   pPrev;
62cdf0e10cSrcweir     RSCINST aInst;
63cdf0e10cSrcweir     sal_uInt32  nTupelRec;  // Rekursionstiefe fuer Tupel
NodeNode64cdf0e10cSrcweir     Node() { pPrev = NULL; nTupelRec = 0; };
65cdf0e10cSrcweir };
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class ObjectStack {
68cdf0e10cSrcweir     private :
69cdf0e10cSrcweir         Node* pRoot;
70cdf0e10cSrcweir     public :
71cdf0e10cSrcweir 
ObjectStack()72cdf0e10cSrcweir         ObjectStack ()   { pRoot = NULL; }
73cdf0e10cSrcweir 
Top()74cdf0e10cSrcweir         const RSCINST & Top  ()     { return pRoot->aInst; }
IsEmpty()75cdf0e10cSrcweir         sal_Bool        IsEmpty()   { return( pRoot == NULL ); }
IncTupelRec()76cdf0e10cSrcweir 		void		IncTupelRec() { pRoot->nTupelRec++; }
DecTupelRec()77cdf0e10cSrcweir 		void		DecTupelRec() { pRoot->nTupelRec--; }
TupelRecCount() const78cdf0e10cSrcweir 		sal_uInt32	TupelRecCount() const { return pRoot->nTupelRec; }
Push(RSCINST aInst)79cdf0e10cSrcweir         void        Push( RSCINST aInst )
80cdf0e10cSrcweir                     {
81cdf0e10cSrcweir                         Node* pTmp;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir                         pTmp         = pRoot;
84cdf0e10cSrcweir                         pRoot        = new Node;
85cdf0e10cSrcweir                         pRoot->aInst = aInst;
86cdf0e10cSrcweir                         pRoot->pPrev = pTmp;
87cdf0e10cSrcweir                     }
Pop()88cdf0e10cSrcweir         void        Pop()
89cdf0e10cSrcweir                     {
90cdf0e10cSrcweir                        Node* pTmp;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir                        pTmp  = pRoot;
93cdf0e10cSrcweir                        pRoot = pTmp->pPrev;
94cdf0e10cSrcweir                        delete pTmp;
95cdf0e10cSrcweir                     }
96cdf0e10cSrcweir };
97cdf0e10cSrcweir 
98cdf0e10cSrcweir /****************** F o r w a r d s **************************************/
99cdf0e10cSrcweir #if defined( RS6000 )
100cdf0e10cSrcweir extern "C" int yyparse();   // forward Deklaration fuer erzeugte Funktion
101cdf0e10cSrcweir extern "C" void yyerror( char * );
102cdf0e10cSrcweir extern "C" int  yylex( void );
103cdf0e10cSrcweir #elif defined( HP9000 ) || defined( SCO ) || defined ( SOLARIS )
104cdf0e10cSrcweir extern "C" int yyparse();   // forward Deklaration fuer erzeugte Funktion
105cdf0e10cSrcweir extern "C" void yyerror( const char * );
106cdf0e10cSrcweir extern "C" int  yylex( void );
107cdf0e10cSrcweir #else
108*b6d138aaSHerbert Dürr int yyparse();              // forward declaration for generated function
109cdf0e10cSrcweir void yyerror( char * );
110cdf0e10cSrcweir int  yylex( void );
111cdf0e10cSrcweir #endif
112cdf0e10cSrcweir 
113cdf0e10cSrcweir class RscTypCont;
114cdf0e10cSrcweir class RscFileInst;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir extern RscTypCont*              pTC;
117cdf0e10cSrcweir extern RscFileInst *            pFI;
118cdf0e10cSrcweir extern RscExpression *          pExp;
119cdf0e10cSrcweir extern ObjectStack              S;
120cdf0e10cSrcweir extern StringContainer*			pStringContainer;
121