xref: /aoo42x/main/rsc/source/parser/rsclex.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 #include <tools/stack.hxx>
24 
25 #include <hash_set>
26 #include <rtl/strbuf.hxx>
27 #include <rtl/string.hxx>
28 
29 // a buffer for unique strings
30 class StringContainer
31 {
32     std::hash_set< rtl::OString, rtl::OStringHash >		m_aStrings;
33 public:
34     StringContainer() {}
35     ~StringContainer() {}
36 
37     const char* putString( const char* pString );
38 };
39 
40 
41 enum MODE_ENUM { MODE_MODELESS, MODE_APPLICATIONMODAL, MODE_SYSTEMMODAL };
42 
43 enum JUSTIFY_ENUM { JUST_CENTER, JUST_RIGHT, JUST_LEFT };
44 
45 enum SHOW_ENUM { SHOW_NORMAL, SHOW_MINIMIZED, SHOW_MAXIMIZED };
46 
47 enum ENUMHEADER { HEADER_NAME, HEADER_NUMBER };
48 
49 enum REF_ENUM { TYPE_NOTHING, TYPE_REF, TYPE_COPY };
50 
51 struct RSCHEADER {
52     RscTop *    pClass;
53     RscExpType  nName1;
54     REF_ENUM    nTyp;
55     RscTop *    pRefClass;
56     RscExpType  nName2;
57 };
58 
59 /************** O b j e c t s t a c k ************************************/
60 struct Node {
61     Node*   pPrev;
62     RSCINST aInst;
63     sal_uInt32  nTupelRec;  // Rekursionstiefe fuer Tupel
64     Node() { pPrev = NULL; nTupelRec = 0; };
65 };
66 
67 class ObjectStack {
68     private :
69         Node* pRoot;
70     public :
71 
72         ObjectStack ()   { pRoot = NULL; }
73 
74         const RSCINST & Top  ()     { return pRoot->aInst; }
75         sal_Bool        IsEmpty()   { return( pRoot == NULL ); }
76 		void		IncTupelRec() { pRoot->nTupelRec++; }
77 		void		DecTupelRec() { pRoot->nTupelRec--; }
78 		sal_uInt32	TupelRecCount() const { return pRoot->nTupelRec; }
79         void        Push( RSCINST aInst )
80                     {
81                         Node* pTmp;
82 
83                         pTmp         = pRoot;
84                         pRoot        = new Node;
85                         pRoot->aInst = aInst;
86                         pRoot->pPrev = pTmp;
87                     }
88         void        Pop()
89                     {
90                        Node* pTmp;
91 
92                        pTmp  = pRoot;
93                        pRoot = pTmp->pPrev;
94                        delete pTmp;
95                     }
96 };
97 
98 /****************** F o r w a r d s **************************************/
99 #if defined( RS6000 )
100 extern "C" int yyparse();   // forward Deklaration fuer erzeugte Funktion
101 extern "C" void yyerror( char * );
102 extern "C" int  yylex( void );
103 #elif defined( HP9000 ) || defined( SCO ) || defined ( SOLARIS )
104 extern "C" int yyparse();   // forward Deklaration fuer erzeugte Funktion
105 extern "C" void yyerror( const char * );
106 extern "C" int  yylex( void );
107 #else
108 #if defined ( WTC ) || defined ( GCC ) || (_MSC_VER >= 1400)
109 int yyparse();              // forward Deklaration fuer erzeugte Funktion
110 #else
111 yyparse();              // forward Deklaration fuer erzeugte Funktion
112 #endif
113 void yyerror( char * );
114 int  yylex( void );
115 #endif
116 
117 class RscTypCont;
118 class RscFileInst;
119 
120 extern RscTypCont*              pTC;
121 extern RscFileInst *            pFI;
122 extern RscExpression *          pExp;
123 extern ObjectStack              S;
124 extern StringContainer*			pStringContainer;
125