4 #include "xi-Construct.h"
9 /****************** Template Support **************/
10 /* Template Instantiation Parameter */
11 class TParam
: public Printable
{
13 virtual void genSpec(XStr
& str
) = 0;
16 /* List of Template Instantiation parameters */
17 class TParamList
: public Printable
{
22 TParamList(TParam
* t
, TParamList
* n
= 0);
23 void print(XStr
& str
);
24 void genSpec(XStr
& str
);
25 std::string
to_string();
28 /* A type instantiation parameter */
29 class TParamType
: public TParam
{
34 void print(XStr
& str
);
35 void genSpec(XStr
& str
);
38 /* A Value instantiation parameter */
39 class TParamVal
: public TParam
{
43 TParamVal(const char* v
);
44 void print(XStr
& str
);
45 void genSpec(XStr
& str
);
48 class Scope
: public ConstructList
{
53 Scope(const char* name
, ConstructList
* contents
);
54 void genDecls(XStr
& str
);
55 void genDefs(XStr
& str
);
56 void genReg(XStr
& str
);
57 void genGlobalCode(XStr scope
, XStr
& decls
, XStr
& defs
);
58 void print(XStr
& str
);
59 void outputClosuresDecl(XStr
& str
);
60 void outputClosuresDef(XStr
& str
);
63 class UsingScope
: public Construct
{
69 UsingScope(const char* name
, bool symbol
= false);
70 virtual void genDecls(XStr
& str
);
71 virtual void print(XStr
& str
);
74 /* A template construct */
78 class Template
: public Construct
{
83 Template(TVarList
* t
, TEntity
* e
) : tspec(t
), entity(e
) {}
84 virtual void setExtern(int e
);
85 void print(XStr
& str
);
86 void genDecls(XStr
& str
);
87 void genDefs(XStr
& str
);
88 void genSpec(XStr
& str
, bool printDefault
= true);
89 void genVars(XStr
& str
);
90 void genGlobalCode(XStr scope
, XStr
& decls
, XStr
& defs
);
91 void outputClosuresDecl(XStr
& str
);
92 void outputClosuresDef(XStr
& str
);
96 // DMK - Accel Support
97 int genAccels_spe_c_funcBodies(XStr
& str
);
98 void genAccels_spe_c_regFuncs(XStr
& str
);
99 void genAccels_spe_c_callInits(XStr
& str
);
100 void genAccels_spe_h_includes(XStr
& str
);
101 void genAccels_spe_h_fiCountDefs(XStr
& str
);
102 void genAccels_ppe_c_regFuncs(XStr
& str
);
105 /* An entity that could be templated, i.e. chare, group or a message */
106 class TEntity
: public Construct
{
111 void setTemplate(Template
* t
);
112 virtual XStr
tspec(bool printDefault
= true) const;
113 virtual XStr
tvars(void) const;
115 /* A formal argument of a template */
116 class TVar
: public Printable
{
118 virtual void genLong(XStr
& str
, bool printDefault
= true) = 0;
119 virtual void genShort(XStr
& str
) = 0;
122 /* a formal type argument with parameter pack */
123 class TTypeEllipsis
: public TVar
{
124 NamedEllipsisType
* type
;
128 TTypeEllipsis(NamedEllipsisType
* t
, Type
* i
= 0);
129 void print(XStr
& str
);
130 void genLong(XStr
& str
, bool printDefault
= true);
131 void genShort(XStr
& str
);
134 /* a formal type argument */
135 class TType
: public TVar
{
140 TType(Type
* t
, Type
* i
= 0);
141 void print(XStr
& str
);
142 void genLong(XStr
& str
, bool printDefault
= true);
143 void genShort(XStr
& str
);
146 /* a formal function argument */
147 class TFunc
: public TVar
{
152 TFunc(FuncType
* t
, const char* v
= 0);
153 void print(XStr
& str
);
154 void genLong(XStr
& str
, bool printDefault
= true);
155 void genShort(XStr
& str
);
158 /* A formal variable argument */
159 class TName
: public TVar
{
165 TName(Type
* t
, const char* n
, const char* v
= 0);
166 void print(XStr
& str
);
167 void genLong(XStr
& str
, bool printDefault
= true);
168 void genShort(XStr
& str
);
171 /* A list of formal arguments to a template */
172 class TVarList
: public Printable
{
177 TVarList(TVar
* v
, TVarList
* n
= 0);
178 void print(XStr
& str
);
179 void genLong(XStr
& str
, bool printDefault
= true);
180 void genShort(XStr
& str
);
185 #endif // ifndef _TEMPLATE_H