1*1c78a5d6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1c78a5d6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1c78a5d6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1c78a5d6SAndrew Rist  * distributed with this work for additional information
6*1c78a5d6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1c78a5d6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1c78a5d6SAndrew Rist  * "License"); you may not use this file except in compliance
9*1c78a5d6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1c78a5d6SAndrew Rist  *
11*1c78a5d6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1c78a5d6SAndrew Rist  *
13*1c78a5d6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1c78a5d6SAndrew Rist  * software distributed under the License is distributed on an
15*1c78a5d6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1c78a5d6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1c78a5d6SAndrew Rist  * specific language governing permissions and limitations
18*1c78a5d6SAndrew Rist  * under the License.
19*1c78a5d6SAndrew Rist  *
20*1c78a5d6SAndrew Rist  *************************************************************/
21*1c78a5d6SAndrew Rist 
22*1c78a5d6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #ifndef ADC_CPP_PE_VAFU_HXX
26cdf0e10cSrcweir #define ADC_CPP_PE_VAFU_HXX
27cdf0e10cSrcweir 
28cdf0e10cSrcweir // BASE CLASSES
29cdf0e10cSrcweir #include "cpp_pe.hxx"
30cdf0e10cSrcweir // USED SERVICES
31cdf0e10cSrcweir #include <semantic/callf.hxx>
32cdf0e10cSrcweir #include <semantic/sub_peu.hxx>
33cdf0e10cSrcweir #include <ary/cpp/c_types4cpp.hxx>
34cdf0e10cSrcweir #include <ary/cpp/c_vfflag.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace cpp
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class PE_Type;
42cdf0e10cSrcweir class PE_Variable;
43cdf0e10cSrcweir class PE_Function;
44cdf0e10cSrcweir class PE_Ignore;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class PE_VarFunc : public Cpp_PE
50cdf0e10cSrcweir {
51cdf0e10cSrcweir   public:
52cdf0e10cSrcweir 	enum E_State
53cdf0e10cSrcweir 	{
54cdf0e10cSrcweir 		start,
55cdf0e10cSrcweir 		expectCtor,
56cdf0e10cSrcweir 		afterClassDecl,     // Also used for after enum declaration.
57cdf0e10cSrcweir 		expectName,
58cdf0e10cSrcweir 		afterName,
59cdf0e10cSrcweir         afterName_inErraneousTemplate,
60cdf0e10cSrcweir 		finished,
61cdf0e10cSrcweir         finishedIncludingFunctionImplementation,
62cdf0e10cSrcweir 		size_of_states
63cdf0e10cSrcweir 	};
64cdf0e10cSrcweir     enum E_ResultType
65cdf0e10cSrcweir     {
66cdf0e10cSrcweir         result_unknown = 0,
67cdf0e10cSrcweir 		result_ignore,         	/// Used for class and enum declarations and predeclarations and for extern variables and functions.
68cdf0e10cSrcweir 		result_variable,
69cdf0e10cSrcweir 		result_function
70cdf0e10cSrcweir     };
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	typedef ary::cpp::E_Protection 				E_Protection;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 						PE_VarFunc(
76cdf0e10cSrcweir 							Cpp_PE *			i_pParent );
77cdf0e10cSrcweir 						~PE_VarFunc();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	virtual void		Call_Handler(
80cdf0e10cSrcweir 							const cpp::Token &	i_rTok );
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	const std::vector<ary::cpp::Ce_id> &
83cdf0e10cSrcweir             			Result_Ids() const;
84cdf0e10cSrcweir 	ary::cpp::Type_id   Result_FrontType() const;
85cdf0e10cSrcweir 	const StringVector &
86cdf0e10cSrcweir             			Result_Names() const;
87cdf0e10cSrcweir 	E_ResultType		Result_CeType() const;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir   private:
90cdf0e10cSrcweir 	typedef SubPe< PE_VarFunc, PE_Type >		SP_Type;
91cdf0e10cSrcweir 	typedef SubPeUse< PE_VarFunc, PE_Type >		SPU_Type;
92cdf0e10cSrcweir 	typedef SubPe< PE_VarFunc, PE_Variable >	SP_Variable;
93cdf0e10cSrcweir 	typedef SubPeUse< PE_VarFunc, PE_Variable >	SPU_Variable;
94cdf0e10cSrcweir 	typedef SubPe< PE_VarFunc, PE_Function >	SP_Function;
95cdf0e10cSrcweir 	typedef SubPeUse< PE_VarFunc, PE_Function >	SPU_Function;
96cdf0e10cSrcweir 	typedef SubPe< PE_VarFunc, PE_Ignore >		SP_Ignore;
97cdf0e10cSrcweir 	typedef SubPeUse< PE_VarFunc, PE_Ignore >   SPU_Ignore;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	void				Setup_StatusFunctions();
100cdf0e10cSrcweir 	virtual void		InitData();
101cdf0e10cSrcweir 	virtual void		TransferData();
102cdf0e10cSrcweir 	void  				Hdl_UnknownToken( const char *);
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	void				SpInit_FunctionStd();
105cdf0e10cSrcweir 	void				SpInit_FunctionCtor();
106cdf0e10cSrcweir 	void				SpInit_FunctionDtor();
107cdf0e10cSrcweir 	void				SpInit_FunctionCastOperator();
108cdf0e10cSrcweir 	void				SpInit_FunctionNormalOperator();
109cdf0e10cSrcweir 	void				SpReturn_Type();
110cdf0e10cSrcweir 	void				SpReturn_Variable();
111cdf0e10cSrcweir 	void				SpReturn_FunctionStd();
112cdf0e10cSrcweir 	void				SpReturn_Ignore();
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	void				On_start_Identifier(const char * i_sText);
115cdf0e10cSrcweir 	void				On_start_operator(const char * i_sText);
116cdf0e10cSrcweir 	void				On_start_TypeKey(const char * i_sText);
117cdf0e10cSrcweir 	void				On_start_virtual(const char * i_sText);
118cdf0e10cSrcweir 	void				On_start_Tilde(const char * i_sText);
119cdf0e10cSrcweir 	void				On_start_const(const char * i_sText);
120cdf0e10cSrcweir 	void				On_start_volatile(const char * i_sText);
121cdf0e10cSrcweir 	void				On_start_extern(const char * i_sText);
122cdf0e10cSrcweir 	void				On_start_static(const char * i_sText);
123cdf0e10cSrcweir 	void				On_start_mutable(const char * i_sText);
124cdf0e10cSrcweir 	void				On_start_register(const char * i_sText);
125cdf0e10cSrcweir 	void				On_start_inline(const char * i_sText);
126cdf0e10cSrcweir 	void				On_start_explicit(const char * i_sText);
127cdf0e10cSrcweir 	void				On_start_Bracket_Right(const char * i_sText);
128cdf0e10cSrcweir 	void                On_start_typename(const char * i_sText);
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 	void				On_expectCtor_Bracket_Left(const char * i_sText);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	void				On_afterClassDecl_Semicolon(const char * i_sText);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	void				On_expectName_Identifier(const char * i_sText);
135cdf0e10cSrcweir 	void				On_expectName_operator(const char * i_sText);
136cdf0e10cSrcweir 	void				On_expectName_Bracket_Left(const char * i_sText);
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 	void				On_afterName_ArrayBracket_Left(const char * i_sText);
139cdf0e10cSrcweir 	void				On_afterName_Bracket_Left(const char * i_sText);
140cdf0e10cSrcweir     void                On_afterName_DoubleColon(const char * i_sText);
141cdf0e10cSrcweir 	void				On_afterName_Semicolon(const char * i_sText);
142cdf0e10cSrcweir 	void				On_afterName_Comma(const char * i_sText);
143cdf0e10cSrcweir 	void				On_afterName_Assign(const char * i_sText);
144cdf0e10cSrcweir 	void				On_afterName_Less(const char * i_sText);
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     void                On_afterName_inErraneousTemplate_Less(const char * i_sText);
147cdf0e10cSrcweir     void                On_afterName_inErraneousTemplate_Greater(const char * i_sText);
148cdf0e10cSrcweir     void                On_afterName_inErraneousTemplate_Default(const char * i_sText);
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	void				On_finished_Semicolon(const char * i_sText);
151cdf0e10cSrcweir 	void				On_finished_Comma(const char * i_sText);
152cdf0e10cSrcweir 	void				On_finished_Default(const char * i_sText);
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     void                On_finishedIncludingFunctionImplementation_Default(const char * i_sText);
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     ary::cpp::FunctionFlags
157cdf0e10cSrcweir                         CreateFunctionFlags();
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     // DATA
160cdf0e10cSrcweir 	Dyn< PeStatusArray<PE_VarFunc> >
161cdf0e10cSrcweir 						pStati;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	Dyn<SP_Type>	    pSpType;
164cdf0e10cSrcweir 	Dyn<SPU_Type>	 	pSpuType;
165cdf0e10cSrcweir 	Dyn<SP_Variable>	pSpVariable;
166cdf0e10cSrcweir 	Dyn<SPU_Variable>	pSpuVariable;
167cdf0e10cSrcweir 	Dyn<SP_Function>	pSpFunction;
168cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionStd;
169cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionCtor;
170cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionDtor;
171cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionCastOperator;
172cdf0e10cSrcweir 	Dyn<SPU_Function> 	pSpuFunctionNormalOperator;
173cdf0e10cSrcweir 	Dyn<SP_Ignore>	    pSpIgnore;
174cdf0e10cSrcweir 	Dyn<SPU_Ignore>	 	pSpuIgnore;
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     intt                nCounter_TemplateBrackets;
177cdf0e10cSrcweir     bool                bInDestructor;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     std::vector<ary::cpp::Ce_id>
180cdf0e10cSrcweir                         aResultIds;
181cdf0e10cSrcweir 	ary::cpp::Type_id	nResultFrontType;
182cdf0e10cSrcweir     E_ResultType        eResultType;
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 	// Pre-Results
185cdf0e10cSrcweir     String              sName;
186cdf0e10cSrcweir 
187cdf0e10cSrcweir     bool                bVirtual;
188cdf0e10cSrcweir     bool                bStatic;
189cdf0e10cSrcweir     bool                bExtern;
190cdf0e10cSrcweir     bool                bExternC;
191cdf0e10cSrcweir     bool                bMutable;
192cdf0e10cSrcweir     bool                bInline;
193cdf0e10cSrcweir     bool                bRegister;
194cdf0e10cSrcweir     bool                bExplicit;
195cdf0e10cSrcweir };
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 
199cdf0e10cSrcweir // IMPLEMENTATION
200cdf0e10cSrcweir 
201cdf0e10cSrcweir inline const std::vector<ary::cpp::Ce_id> &
Result_Ids() const202cdf0e10cSrcweir PE_VarFunc::Result_Ids() const
203cdf0e10cSrcweir     { return aResultIds; }
204cdf0e10cSrcweir inline ary::cpp::Type_id
Result_FrontType() const205cdf0e10cSrcweir PE_VarFunc::Result_FrontType() const
206cdf0e10cSrcweir     { return nResultFrontType; }
207cdf0e10cSrcweir inline PE_VarFunc::E_ResultType
Result_CeType() const208cdf0e10cSrcweir PE_VarFunc::Result_CeType() const
209cdf0e10cSrcweir     { return eResultType; }
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 
213cdf0e10cSrcweir }   // namespace cpp
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 
218cdf0e10cSrcweir #endif
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 
221cdf0e10cSrcweir /*	// Overview of Stati
222cdf0e10cSrcweir 
223cdf0e10cSrcweir Undecided
224cdf0e10cSrcweir ---------
225cdf0e10cSrcweir 
226cdf0e10cSrcweir start			// vor und w�hrend storage class specifiern
227cdf0e10cSrcweir     any         ->stay
228cdf0e10cSrcweir     operaator   ->goto Function
229cdf0e10cSrcweir 
230cdf0e10cSrcweir ->Typ
231cdf0e10cSrcweir 
232cdf0e10cSrcweir expectName
233cdf0e10cSrcweir     Identifier  ->stay
234cdf0e10cSrcweir     operator    ->goto Function
235cdf0e10cSrcweir 
236cdf0e10cSrcweir afterName       ->goto Variable or Function
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 
241cdf0e10cSrcweir Variable
242cdf0e10cSrcweir --------
243cdf0e10cSrcweir 
244cdf0e10cSrcweir start			// vor und w�hrend storage class specifiern
245cdf0e10cSrcweir 
246cdf0e10cSrcweir ->Typ
247cdf0e10cSrcweir 
248cdf0e10cSrcweir expectName		// Typ ist da  -> im Falle von '(': notyetimplemented
249cdf0e10cSrcweir afterName
250cdf0e10cSrcweir 
251cdf0e10cSrcweir expectSize  	// after [
252cdf0e10cSrcweir expectFinish
253cdf0e10cSrcweir 				// vor ; oder ,
254cdf0e10cSrcweir expectNextVarName  // anders als bei expectName kann hier auch * oder & kommen
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 
259cdf0e10cSrcweir 
260cdf0e10cSrcweir Function
261cdf0e10cSrcweir --------
262cdf0e10cSrcweir 
263cdf0e10cSrcweir start				// vor und w�hrend storage class specifiern
264cdf0e10cSrcweir 
265cdf0e10cSrcweir ->Typ
266cdf0e10cSrcweir 
267cdf0e10cSrcweir expectName			// Typ ist da
268cdf0e10cSrcweir expectBracket		// Nach Name
269cdf0e10cSrcweir expectParameter		// nach ( oder ,
270cdf0e10cSrcweir -> Parameter
271cdf0e10cSrcweir after Parameters    // before const, volatile throw or = 0.
272cdf0e10cSrcweir after throw			// expect (
273cdf0e10cSrcweir expectException		// after (
274cdf0e10cSrcweir after exceptions	// = 0 oder ; oder ,
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 
277cdf0e10cSrcweir expectNextVarName  // anders als bei expectName kann hier auch * oder & kommen
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 
285cdf0e10cSrcweir */
286