~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to libslparse/parsenode.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
////---------------------------------------------------------------------
 
2
////    Associated header file: PARSENODE.H
 
3
////    Class definition file:  PARSENODE.CPP
 
4
////
 
5
////    Author:                                 Paul C. Gregory
 
6
////    Creation date:                  17/07/99
 
7
////---------------------------------------------------------------------
 
8
 
 
9
//? Is .h included already?
 
10
#ifndef PARSENODE_H_INCLUDED
 
11
#define PARSENODE_H_INCLUDED 1
 
12
 
 
13
#include        <vector>
 
14
 
 
15
#include        "aqsis.h"
 
16
 
 
17
#include        "sstring.h"
 
18
#include        "vardef.h"
 
19
#include        "iparsenode.h"
 
20
#include        "funcdef.h"
 
21
#include        "list.h"
 
22
 
 
23
START_NAMESPACE( Aqsis )
 
24
 
 
25
extern char* gShaderTypeNames[];
 
26
extern TqInt gcShaderTypeNames;
 
27
 
 
28
///----------------------------------------------------------------------
 
29
/** \class CqParseNode
 
30
 * Abstract base class from which all parse nodes are define.
 
31
 */
 
32
 
 
33
class CqParseNodeShader;
 
34
class CqParseNode : public CqListEntry<CqParseNode>, public IqParseNode
 
35
{
 
36
public:
 
37
    CqParseNode() : m_pChild( 0 ), m_pParent( 0 ), m_fVarying( TqFalse ), m_LineNo( -1 )
 
38
    {}
 
39
    virtual     ~CqParseNode()
 
40
    {
 
41
        if ( m_pParent && m_pParent->m_pChild == this )
 
42
            m_pParent->m_pChild = pNext();
 
43
    }
 
44
 
 
45
 
 
46
    // Overridden from IqParseNode
 
47
    virtual     IqParseNode* pChild() const
 
48
    {
 
49
        return ( m_pChild );
 
50
    }
 
51
    virtual     IqParseNode* pParent() const
 
52
    {
 
53
        return ( m_pParent );
 
54
    }
 
55
    virtual     IqParseNode* pNextSibling() const
 
56
    {
 
57
        return ( pNext() );
 
58
    }
 
59
    virtual     IqParseNode* pPrevSibling() const
 
60
    {
 
61
        return ( pPrevious() );
 
62
    }
 
63
    virtual     TqInt   LineNo() const
 
64
    {
 
65
        return ( m_LineNo );
 
66
    }
 
67
    virtual     const char*     strFileName() const
 
68
    {
 
69
        return ( m_strFileName.c_str() );
 
70
    }
 
71
    virtual     TqBool  IsVariableRef() const
 
72
    {
 
73
        return ( TqFalse );
 
74
    }
 
75
    virtual     TqInt   ResType() const
 
76
    {
 
77
        if ( m_pChild == 0 )
 
78
            return ( Type_Nil );
 
79
        else
 
80
            return ( m_pChild->ResType() );
 
81
    }
 
82
    virtual     TqBool  fVarying() const
 
83
    {
 
84
        return ( m_fVarying );
 
85
    }
 
86
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
87
    {
 
88
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNode>( this, type ) ) != 0 ) return ( TqTrue );
 
89
        return ( TqFalse );
 
90
    }
 
91
    virtual     TqInt   NodeType() const
 
92
    {
 
93
        return ( IqParseNode::m_ID );
 
94
    }
 
95
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(*this); }
 
96
 
 
97
 
 
98
 
 
99
    CqParseNode* pFirstChild() const
 
100
    {
 
101
        return ( m_pChild );
 
102
    }
 
103
    CqParseNode* pLastChild() const
 
104
    {
 
105
        CqParseNode * pChild = m_pChild;
 
106
        while ( pChild->pNext() != 0 ) pChild = pChild->pNext();
 
107
        return ( pChild );
 
108
    }
 
109
    void        AddLastChild( CqParseNode* pChild )
 
110
    {
 
111
        pChild->UnLink();
 
112
        if ( m_pChild == 0 )
 
113
            m_pChild = pChild;
 
114
        else
 
115
        {
 
116
            CqParseNode* pLastC = m_pChild;
 
117
            while ( pLastC->pNext() ) pLastC = pLastC->pNext();
 
118
            pChild->LinkAfter( pLastC );
 
119
        }
 
120
        m_fVarying |= pChild->m_fVarying;
 
121
        pChild->m_pParent = this;
 
122
    }
 
123
    void        AddFirstChild( CqParseNode* pChild )
 
124
    {
 
125
        pChild->UnLink();
 
126
        if ( m_pChild == 0 )
 
127
            m_pChild = pChild;
 
128
        else
 
129
        {
 
130
            pChild->LinkBefore( m_pChild );
 
131
            m_pChild = pChild;
 
132
        }
 
133
        m_fVarying |= pChild->m_fVarying;
 
134
        pChild->m_pParent = this;
 
135
    }
 
136
    void        LinkAfter( CqParseNode* pN )
 
137
    {
 
138
        CqListEntry<CqParseNode>::LinkAfter( pN );
 
139
        m_pParent = pN->m_pParent;
 
140
    }
 
141
    void        LinkParent( CqParseNode* pN )
 
142
    {
 
143
        pN->UnLink();
 
144
        // If I have a prev sibling, link pN after it.
 
145
        if ( pPrevious() != 0 )
 
146
            pN->LinkAfter( pPrevious() );
 
147
        else
 
148
        {
 
149
            // Else if I have a parent, link pN as its first child.
 
150
            if ( m_pParent != 0 )
 
151
                m_pParent->AddFirstChild( pN );
 
152
        }
 
153
        // Unlink myself from the tree, and then relink under pN
 
154
        UnLink();
 
155
        pN->AddLastChild( this );
 
156
    }
 
157
    void        UnLink()
 
158
    {
 
159
        // Relink the next node into the parent.
 
160
        if ( pPrevious() == 0 && m_pParent != 0 )
 
161
            m_pParent->m_pChild = pNext();
 
162
        CqListEntry<CqParseNode>::UnLink();
 
163
        m_pParent = 0;
 
164
    }
 
165
    void        ClearChild()
 
166
    {
 
167
        m_pChild = 0;
 
168
    }
 
169
    void        SetPos( TqInt LineNo, const char* strFileName )
 
170
    {
 
171
        m_LineNo = LineNo;
 
172
        m_strFileName = strFileName;
 
173
    }
 
174
 
 
175
    virtual     TqBool  Optimise();
 
176
    virtual TqInt       TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse )
 
177
    {
 
178
        TqInt NewType = Type_Nil;
 
179
        CqParseNode* pChild = pFirstChild();
 
180
        while ( pChild != 0 )
 
181
        {
 
182
            // Get the next pointer nowm, incase the TypeCheck inserts a Cast operator.
 
183
            CqParseNode * pNext = pChild->pNext();
 
184
            NewType = pChild->TypeCheck( pTypes, Count, CheckOnly );
 
185
            pChild = pNext;
 
186
        }
 
187
        return ( NewType );
 
188
    }
 
189
    virtual     void    NoDup()
 
190
    {}
 
191
    virtual     CqParseNode* Clone( CqParseNode* pParent = 0 )
 
192
    {
 
193
        CqParseNode * pNew = new CqParseNode();
 
194
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
195
        pNew->m_pParent = pParent;
 
196
        return ( pNew );
 
197
    }
 
198
    virtual     TqBool  UpdateStorageStatus()
 
199
    {
 
200
        m_fVarying = TqFalse;
 
201
        CqParseNode* pChild = m_pChild;
 
202
        while ( pChild != 0 )
 
203
        {
 
204
            if ( pChild->UpdateStorageStatus() )
 
205
                m_fVarying = TqTrue;
 
206
            pChild = pChild->pNext();
 
207
        }
 
208
        return ( m_fVarying );
 
209
    }
 
210
 
 
211
    CqParseNodeShader* pShaderNode();
 
212
 
 
213
    static      char*   TypeIdentifier( int Type );
 
214
    static      TqInt   TypeFromIdentifier( char Id );
 
215
    static      char*   TypeName( int Type );
 
216
    static      TqInt   FindCast( TqInt CurrType, TqInt* pTypes, TqInt Count );
 
217
    static      TqInt*  pAllTypes()
 
218
    {
 
219
        return ( m_aAllTypes );
 
220
    }
 
221
 
 
222
protected:
 
223
    CqParseNode*        m_pChild;
 
224
    CqParseNode*        m_pParent;
 
225
    TqBool      m_fVarying;
 
226
    TqInt       m_LineNo;
 
227
    CqString    m_strFileName;
 
228
 
 
229
    static      TqInt   m_cLabels;
 
230
    static      TqInt   m_aaTypePriorities[ Type_Last ][ Type_Last ];
 
231
    static      TqInt   m_aAllTypes[ Type_Last - 1 ];
 
232
};
 
233
 
 
234
 
 
235
///----------------------------------------------------------------------
 
236
/// CqParseShader
 
237
/// Parsenode specifying a shader definition.
 
238
 
 
239
class CqParseNodeShader : public CqParseNode, public IqParseNodeShader
 
240
{
 
241
public:
 
242
    CqParseNodeShader( const CqParseNodeShader& from ) :
 
243
            CqParseNode( from ),
 
244
            m_strName( from.m_strName ),
 
245
            m_ShaderType( from.m_ShaderType )
 
246
    {}
 
247
    CqParseNodeShader( const char* strName = "", const EqShaderType Type = Type_Surface ) :
 
248
            CqParseNode(),
 
249
            m_strName( strName ),
 
250
            m_ShaderType( Type )
 
251
    {}
 
252
    virtual     ~CqParseNodeShader()
 
253
    {}
 
254
 
 
255
    // Overridden from IqParseNodeShader
 
256
 
 
257
 
 
258
 
 
259
    virtual     const char*     strName() const
 
260
    {
 
261
        return ( m_strName.c_str() );
 
262
    }
 
263
    virtual     const char*     strShaderType() const
 
264
    {
 
265
        assert( m_ShaderType < gcShaderTypeNames );
 
266
        return ( gShaderTypeNames[ m_ShaderType ] );
 
267
    }
 
268
    virtual     const EqShaderType ShaderType() const
 
269
    {
 
270
        return( m_ShaderType );
 
271
    }
 
272
 
 
273
    // Overridden from IqParseNode
 
274
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
275
    {
 
276
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeShader>( this, type ) ) != 0 ) return ( TqTrue );
 
277
        return ( CqParseNode::GetInterface( type, pNode ) );
 
278
    }
 
279
    virtual     TqInt   NodeType() const
 
280
    {
 
281
        return ( IqParseNodeShader::m_ID );
 
282
    }
 
283
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeShader&>(*this)); }
 
284
 
 
285
 
 
286
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
287
    {
 
288
        CqParseNodeShader * pNew = new CqParseNodeShader( *this );
 
289
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
290
        pNew->m_pParent = pParent;
 
291
        return ( pNew );
 
292
    }
 
293
protected:
 
294
    CqString    m_strName;
 
295
    EqShaderType m_ShaderType;
 
296
};
 
297
 
 
298
 
 
299
///----------------------------------------------------------------------
 
300
/// CqParseNodeFunctionCall
 
301
/// Parsenode specifying a function call.
 
302
 
 
303
class CqParseNodeFunctionCall : public CqParseNode, public IqParseNodeFunctionCall
 
304
{
 
305
public:
 
306
    CqParseNodeFunctionCall( const CqParseNodeFunctionCall& from ) :
 
307
            CqParseNode( from )
 
308
    {
 
309
        m_aFuncRef.resize( from.m_aFuncRef.size() );
 
310
        for ( TqUint i = 0; i < m_aFuncRef.size(); i++ )
 
311
            m_aFuncRef[ i ] = from.m_aFuncRef[ i ];
 
312
    }
 
313
    CqParseNodeFunctionCall( std::vector<SqFuncRef>& aFuncRef ) :
 
314
            CqParseNode()
 
315
    {
 
316
        m_aFuncRef.resize( aFuncRef.size() );
 
317
        for ( TqUint i = 0; i < m_aFuncRef.size(); i++ )
 
318
            m_aFuncRef[ i ] = aFuncRef[ i ];
 
319
    }
 
320
    virtual     ~CqParseNodeFunctionCall()
 
321
{}
 
322
 
 
323
    // Overridden from IqParseNodeFunctionCall
 
324
 
 
325
 
 
326
 
 
327
    virtual     const char*     strName() const;
 
328
    virtual     const IqFuncDef* pFuncDef() const;
 
329
    virtual     IqFuncDef* pFuncDef();
 
330
 
 
331
    // Overridden from IqParseNode
 
332
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
333
    {
 
334
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeFunctionCall>( this, type ) ) != 0 ) return ( TqTrue );
 
335
        return ( CqParseNode::GetInterface( type, pNode ) );
 
336
    }
 
337
    virtual     TqInt   NodeType() const
 
338
    {
 
339
        return ( IqParseNodeFunctionCall::m_ID );
 
340
    }
 
341
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeFunctionCall&>(*this)); }
 
342
 
 
343
 
 
344
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
345
    virtual     TqBool  Optimise();
 
346
    virtual     TqInt   ResType() const;
 
347
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
348
    {
 
349
        CqParseNodeFunctionCall * pNew = new CqParseNodeFunctionCall( *this );
 
350
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
351
        pNew->m_pParent = pParent;
 
352
        return ( pNew );
 
353
    }
 
354
    std::vector<SqFuncRef>&     aFuncRef()
 
355
    {
 
356
        return ( m_aFuncRef );
 
357
    }
 
358
    void        CheckArgCast( std::vector<TqInt>& aRes );
 
359
    void        ArgCast( TqInt iIndex );
 
360
 
 
361
protected:
 
362
    std::vector<SqFuncRef>      m_aFuncRef;
 
363
};
 
364
 
 
365
 
 
366
///----------------------------------------------------------------------
 
367
/// CqParseNodeUnresolvedCall
 
368
/// Parsenode specifying an unresolved call., to be handled by a DSO.
 
369
 
 
370
class CqParseNodeUnresolvedCall : public CqParseNode, public IqParseNodeUnresolvedCall
 
371
{
 
372
public:
 
373
    CqParseNodeUnresolvedCall( CqFuncDef& aFuncDef) :
 
374
            CqParseNode()
 
375
    {
 
376
        m_aFuncDef = aFuncDef ;
 
377
    }
 
378
 
 
379
    virtual     ~CqParseNodeUnresolvedCall()
 
380
    {}
 
381
 
 
382
    // Overridden from IqParseNodeUnresolvedCall
 
383
 
 
384
    virtual     const char*     strName() const;
 
385
    virtual     const IqFuncDef* pFuncDef() const;
 
386
    virtual     IqFuncDef* pFuncDef();
 
387
 
 
388
    // Overridden from IqParseNode
 
389
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
390
    {
 
391
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeUnresolvedCall>( this, type ) ) != 0 ) return ( TqTrue );
 
392
        return ( CqParseNode::GetInterface( type, pNode ) );
 
393
    }
 
394
    virtual     TqInt   NodeType() const
 
395
    {
 
396
        return ( IqParseNodeUnresolvedCall::m_ID );
 
397
    }
 
398
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeUnresolvedCall&>(*this)); }
 
399
 
 
400
 
 
401
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
402
    virtual     TqBool  Optimise();
 
403
    virtual     TqInt   ResType() const;
 
404
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
405
    {
 
406
        CqParseNodeUnresolvedCall * pNew = new CqParseNodeUnresolvedCall( *this );
 
407
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
408
        pNew->m_pParent = pParent;
 
409
        return ( pNew );
 
410
    }
 
411
    CqFuncDef&  pFuncDefInt()
 
412
    {
 
413
        return ( m_aFuncDef );
 
414
    }
 
415
    //void      CheckArgCast( std::vector<TqInt>& aRes );
 
416
    //void      ArgCast( TqInt iIndex );
 
417
 
 
418
protected:
 
419
    CqFuncDef   m_aFuncDef;
 
420
};
 
421
 
 
422
///----------------------------------------------------------------------
 
423
/// CqParseNodeVariable
 
424
/// Parsenode specifying a variable access.
 
425
 
 
426
class CqParseNodeVariable : public CqParseNode, public IqParseNodeVariable
 
427
{
 
428
public:
 
429
    CqParseNodeVariable( const CqParseNodeVariable& from ) :
 
430
            CqParseNode( from ),
 
431
            m_VarRef( from.m_VarRef ),
 
432
            m_Extra( from.m_Extra )
 
433
    {}
 
434
    CqParseNodeVariable( SqVarRef VarRef );
 
435
    CqParseNodeVariable( CqParseNodeVariable* pVar );
 
436
    virtual     ~CqParseNodeVariable()
 
437
    {}
 
438
 
 
439
    // Overridden from IqParseNodeVariable
 
440
 
 
441
 
 
442
 
 
443
    virtual     const char*     strName() const;
 
444
    virtual     SqVarRef        VarRef() const
 
445
    {
 
446
        return ( m_VarRef );
 
447
    }
 
448
    virtual CqString Extra() const
 
449
    {
 
450
        return ( m_Extra );
 
451
    }
 
452
    virtual     TqBool  IsLocal() const
 
453
    {
 
454
        return ( m_VarRef.m_Type == VarTypeLocal );
 
455
    }
 
456
 
 
457
    // Overridden from IqParseNode
 
458
    virtual     TqBool  IsVariableRef() const
 
459
    {
 
460
        return ( TqTrue );
 
461
    }
 
462
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
463
    {
 
464
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeVariable>( this, type ) ) != 0 ) return ( TqTrue );
 
465
        return ( CqParseNode::GetInterface( type, pNode ) );
 
466
    }
 
467
    virtual     TqInt   NodeType() const
 
468
    {
 
469
        return ( IqParseNodeVariable::m_ID );
 
470
    }
 
471
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeVariable&>(*this)); }
 
472
 
 
473
 
 
474
 
 
475
    virtual     TqBool  Optimise();
 
476
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
477
    virtual     TqInt   ResType() const;
 
478
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
479
    {
 
480
        CqParseNodeVariable * pNew = new CqParseNodeVariable( *this );
 
481
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
482
        pNew->m_pParent = pParent;
 
483
        return ( pNew );
 
484
    }
 
485
    void        SetParam()
 
486
    {
 
487
        IqVarDef * pVarDef = CqVarDef::GetVariablePtr( m_VarRef );
 
488
        if ( pVarDef != 0 ) pVarDef->SetParam();
 
489
    }
 
490
    void        SetOutput()
 
491
    {
 
492
        IqVarDef * pVarDef = CqVarDef::GetVariablePtr( m_VarRef );
 
493
        if ( pVarDef != 0 ) pVarDef->SetOutput();
 
494
    }
 
495
    void        SetDefaultStorage( TqInt Storage )
 
496
    {
 
497
        // If a storage method has not been specified, default to the specified type.
 
498
        IqVarDef * pVarDef = CqVarDef::GetVariablePtr( m_VarRef );
 
499
        if ( pVarDef != 0 ) pVarDef->SetDefaultStorage( Storage );
 
500
    }
 
501
 
 
502
protected:
 
503
    SqVarRef    m_VarRef;
 
504
    CqString m_Extra;
 
505
};
 
506
 
 
507
 
 
508
///----------------------------------------------------------------------
 
509
/// CqParseNodeVariableArray
 
510
/// Parsenode specifying an array variable access.
 
511
 
 
512
class CqParseNodeVariableArray : public CqParseNodeVariable, public IqParseNodeArrayVariable
 
513
{
 
514
public:
 
515
    CqParseNodeVariableArray( const CqParseNodeVariableArray& from ) :
 
516
            CqParseNodeVariable( from )
 
517
    {}
 
518
    CqParseNodeVariableArray( SqVarRef VarRef );
 
519
    CqParseNodeVariableArray( CqParseNodeVariableArray* pVar );
 
520
    virtual     ~CqParseNodeVariableArray()
 
521
    {}
 
522
 
 
523
    // Overridden from IqParseNode
 
524
 
 
525
 
 
526
 
 
527
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
528
    {
 
529
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeArrayVariable>( this, type ) ) != 0 ) return ( TqTrue );
 
530
        return ( CqParseNodeVariable::GetInterface( type, pNode ) );
 
531
    }
 
532
    virtual     TqInt   NodeType() const
 
533
    {
 
534
        return ( IqParseNodeArrayVariable::m_ID );
 
535
    }
 
536
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeArrayVariable&>(*this)); }
 
537
 
 
538
 
 
539
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
540
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
541
    {
 
542
        CqParseNodeVariableArray * pNew = new CqParseNodeVariableArray( *this );
 
543
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
544
        pNew->m_pParent = pParent;
 
545
        return ( pNew );
 
546
    }
 
547
protected:
 
548
};
 
549
 
 
550
 
 
551
///----------------------------------------------------------------------
 
552
/// CqParseNodeAssign
 
553
/// Parsenode specifying an assignment operation.
 
554
 
 
555
class CqParseNodeAssign : public CqParseNodeVariable, public IqParseNodeVariableAssign
 
556
{
 
557
public:
 
558
    CqParseNodeAssign( const CqParseNodeAssign& from ) :
 
559
            CqParseNodeVariable( from ),
 
560
            m_fNoDup( from.m_fNoDup )
 
561
    {}
 
562
    CqParseNodeAssign( SqVarRef VarRef ) :
 
563
            CqParseNodeVariable( VarRef ),
 
564
            m_fNoDup( TqFalse )
 
565
    {}
 
566
    CqParseNodeAssign( CqParseNodeVariable* pVar ) :
 
567
            CqParseNodeVariable( pVar )
 
568
    {}
 
569
    virtual     ~CqParseNodeAssign()
 
570
    {}
 
571
 
 
572
    // Overridden from IqParseNodeVariableAssign
 
573
 
 
574
 
 
575
 
 
576
    virtual     TqBool  fDiscardResult() const
 
577
    {
 
578
        return ( m_fNoDup );
 
579
    }
 
580
    // Overridden from IqParseNode
 
581
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
582
    {
 
583
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeVariableAssign>( this, type ) ) != 0 ) return ( TqTrue );
 
584
        return ( CqParseNodeVariable::GetInterface( type, pNode ) );
 
585
    }
 
586
    virtual     TqInt   NodeType() const
 
587
    {
 
588
        return ( IqParseNodeVariableAssign::m_ID );
 
589
    }
 
590
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeVariableAssign&>(*this)); }
 
591
 
 
592
 
 
593
 
 
594
    virtual     TqBool  Optimise();
 
595
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
596
    virtual     void    NoDup()
 
597
    {
 
598
        m_fNoDup = TqTrue;
 
599
    }
 
600
    virtual     TqInt   ResType() const;
 
601
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
602
    {
 
603
        CqParseNodeAssign * pNew = new CqParseNodeAssign( *this );
 
604
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
605
        pNew->m_pParent = pParent;
 
606
        return ( pNew );
 
607
    }
 
608
    virtual     TqBool  UpdateStorageStatus()
 
609
    {
 
610
        // Varying status is a combination of the varying status of all chidren
 
611
        // and the varying status of the variable to which we are assigning.
 
612
        TqBool fVarying = CqParseNode::UpdateStorageStatus();
 
613
        m_fVarying = TqFalse;
 
614
        IqVarDef* pVarDef = CqVarDef::GetVariablePtr( m_VarRef );
 
615
        if ( pVarDef != 0 )
 
616
            m_fVarying = ( pVarDef->Type() & Type_Varying ) != 0;
 
617
 
 
618
        m_fVarying = ( ( fVarying ) || ( m_fVarying ) );
 
619
 
 
620
        return ( m_fVarying );
 
621
    }
 
622
 
 
623
protected:
 
624
    TqBool      m_fNoDup;
 
625
};
 
626
 
 
627
 
 
628
///----------------------------------------------------------------------
 
629
/// CqParseNodeAssignArray
 
630
/// Parsenode specifying an assignment operation to an indexed array.
 
631
 
 
632
class CqParseNodeAssignArray : public CqParseNodeAssign, public IqParseNodeArrayVariableAssign
 
633
{
 
634
public:
 
635
    CqParseNodeAssignArray( const CqParseNodeAssignArray& from ) :
 
636
            CqParseNodeAssign( from )
 
637
    {}
 
638
    CqParseNodeAssignArray( SqVarRef VarRef ) :
 
639
            CqParseNodeAssign( VarRef )
 
640
    {}
 
641
    CqParseNodeAssignArray( CqParseNodeVariable* pVar ) :
 
642
            CqParseNodeAssign( pVar )
 
643
    {}
 
644
    virtual     ~CqParseNodeAssignArray()
 
645
    {}
 
646
 
 
647
    // Overridden from IqParseNode
 
648
 
 
649
 
 
650
 
 
651
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
652
    {
 
653
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeArrayVariableAssign>( this, type ) ) != 0 ) return ( TqTrue );
 
654
        return ( CqParseNodeAssign::GetInterface( type, pNode ) );
 
655
    }
 
656
    virtual     TqInt   NodeType() const
 
657
    {
 
658
        return ( IqParseNodeArrayVariableAssign::m_ID );
 
659
    }
 
660
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeArrayVariableAssign&>(*this)); }
 
661
 
 
662
 
 
663
 
 
664
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
665
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
666
    {
 
667
        CqParseNodeAssignArray * pNew = new CqParseNodeAssignArray( *this );
 
668
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
669
        pNew->m_pParent = pParent;
 
670
        return ( pNew );
 
671
    }
 
672
private:
 
673
};
 
674
 
 
675
 
 
676
///----------------------------------------------------------------------
 
677
/// CqParseNodeop
 
678
/// Base parsenode specifying an operation.
 
679
 
 
680
class CqParseNodeOp : public CqParseNode, public IqParseNodeOperator
 
681
{
 
682
public:
 
683
    CqParseNodeOp( const CqParseNodeOp& from ) :
 
684
            CqParseNode( from )
 
685
    {}
 
686
    CqParseNodeOp() :
 
687
            CqParseNode()
 
688
    {}
 
689
    virtual     ~CqParseNodeOp()
 
690
    {}
 
691
 
 
692
    // Overridden from IqParseNode
 
693
 
 
694
 
 
695
 
 
696
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
697
    {
 
698
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeOperator>( this, type ) ) != 0 ) return ( TqTrue );
 
699
        return ( CqParseNode::GetInterface( type, pNode ) );
 
700
    }
 
701
virtual void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeOperator&>(*this)); }
 
702
 
 
703
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
704
};
 
705
 
 
706
 
 
707
///----------------------------------------------------------------------
 
708
/// CqParseNodeMathOp
 
709
/// Parsenode specifying a mathematical operation.
 
710
 
 
711
class CqParseNodeMathOp : public CqParseNodeOp, public IqParseNodeMathOp
 
712
{
 
713
public:
 
714
    CqParseNodeMathOp( const CqParseNodeMathOp& from ) :
 
715
            CqParseNodeOp( from ),
 
716
            m_Operator( from.m_Operator )
 
717
    {}
 
718
    CqParseNodeMathOp() :
 
719
            CqParseNodeOp(),
 
720
            m_Operator( Op_Nil )
 
721
    {}
 
722
    CqParseNodeMathOp( EqMathOp Operator ) :
 
723
            CqParseNodeOp(),
 
724
            m_Operator( Operator )
 
725
    {}
 
726
    virtual     ~CqParseNodeMathOp()
 
727
    {}
 
728
 
 
729
    // Overridden from IqParseNodeOperator
 
730
 
 
731
 
 
732
 
 
733
    virtual     TqInt   Operator() const
 
734
    {
 
735
        return ( m_Operator );
 
736
    }
 
737
    // Overridden from IqParseNode
 
738
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
739
    {
 
740
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeMathOp>( this, type ) ) != 0 ) return ( TqTrue );
 
741
        return ( CqParseNodeOp::GetInterface( type, pNode ) );
 
742
    }
 
743
    virtual     TqInt   NodeType() const
 
744
    {
 
745
        return ( IqParseNodeMathOp::m_ID );
 
746
    }
 
747
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeMathOp&>(*this)); }
 
748
 
 
749
 
 
750
 
 
751
    virtual     TqInt   ResType() const;
 
752
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
753
    {
 
754
        CqParseNodeMathOp * pNew = new CqParseNodeMathOp( *this );
 
755
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
756
        pNew->m_pParent = pParent;
 
757
        return ( pNew );
 
758
    }
 
759
 
 
760
protected:
 
761
    EqMathOp    m_Operator;
 
762
};
 
763
 
 
764
 
 
765
///----------------------------------------------------------------------
 
766
/// CqParseNodeMathOpDot
 
767
/// Parsenode specifying a dot (dot product) operation.
 
768
 
 
769
class CqParseNodeMathOpDot : public CqParseNodeMathOp
 
770
{
 
771
public:
 
772
    CqParseNodeMathOpDot( const CqParseNodeMathOpDot& from ) :
 
773
            CqParseNodeMathOp( from )
 
774
    {}
 
775
    CqParseNodeMathOpDot() :
 
776
            CqParseNodeMathOp( Op_Dot )
 
777
    {}
 
778
    virtual     ~CqParseNodeMathOpDot()
 
779
    {}
 
780
 
 
781
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
782
};
 
783
 
 
784
 
 
785
///----------------------------------------------------------------------
 
786
/// CqParseNodeRelop
 
787
/// Parsenode specifying a relational operation.
 
788
 
 
789
class CqParseNodeRelOp : public CqParseNodeOp, public IqParseNodeRelationalOp
 
790
{
 
791
public:
 
792
    CqParseNodeRelOp( const CqParseNodeRelOp& from ) :
 
793
            CqParseNodeOp( from ),
 
794
            m_Operator( from.m_Operator )
 
795
    {}
 
796
    CqParseNodeRelOp( EqRelOp Operator ) :
 
797
            CqParseNodeOp(),
 
798
            m_Operator( Operator )
 
799
    {}
 
800
    virtual     ~CqParseNodeRelOp()
 
801
    {}
 
802
 
 
803
    // Overridden from IqParseNodeOperator
 
804
 
 
805
 
 
806
 
 
807
    virtual     TqInt   Operator() const
 
808
    {
 
809
        return ( m_Operator );
 
810
    }
 
811
    // Overridden from IqParseNode
 
812
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
813
    {
 
814
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeRelationalOp>( this, type ) ) != 0 ) return ( TqTrue );
 
815
        return ( CqParseNodeOp::GetInterface( type, pNode ) );
 
816
    }
 
817
    virtual     TqInt   NodeType() const
 
818
    {
 
819
        return ( IqParseNodeRelationalOp::m_ID );
 
820
    }
 
821
    virtual     TqInt   ResType() const
 
822
    {
 
823
        return ( Type_Float );
 
824
    }
 
825
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeRelationalOp&>(*this)); }
 
826
 
 
827
 
 
828
 
 
829
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
830
    {
 
831
        CqParseNodeRelOp * pNew = new CqParseNodeRelOp( *this );
 
832
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
833
        pNew->m_pParent = pParent;
 
834
        return ( pNew );
 
835
    }
 
836
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
837
 
 
838
protected:
 
839
    EqRelOp     m_Operator;
 
840
};
 
841
 
 
842
 
 
843
///----------------------------------------------------------------------
 
844
/// CqParseNodeUnaryop
 
845
/// Parsenode specifying a unary operation.
 
846
 
 
847
class CqParseNodeUnaryOp : public CqParseNodeOp, public IqParseNodeUnaryOp
 
848
{
 
849
public:
 
850
    CqParseNodeUnaryOp( const CqParseNodeUnaryOp& from ) :
 
851
            CqParseNodeOp( from ),
 
852
            m_Operator( from.m_Operator )
 
853
    {}
 
854
    CqParseNodeUnaryOp( EqUnaryOp Operator ) :
 
855
            CqParseNodeOp(),
 
856
            m_Operator( Operator )
 
857
    {}
 
858
    virtual     ~CqParseNodeUnaryOp()
 
859
    {}
 
860
 
 
861
    // Overridden from IqParseNodeOperator
 
862
 
 
863
 
 
864
 
 
865
    virtual     TqInt   Operator() const
 
866
    {
 
867
        return ( m_Operator );
 
868
    }
 
869
    // Overridden from IqParseNode
 
870
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
871
    {
 
872
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeUnaryOp>( this, type ) ) != 0 ) return ( TqTrue );
 
873
        return ( CqParseNodeOp::GetInterface( type, pNode ) );
 
874
    }
 
875
    virtual     TqInt   NodeType() const
 
876
    {
 
877
        return ( IqParseNodeUnaryOp::m_ID );
 
878
    }
 
879
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeUnaryOp&>(*this)); }
 
880
 
 
881
 
 
882
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
883
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
884
    {
 
885
        CqParseNodeUnaryOp * pNew = new CqParseNodeUnaryOp( *this );
 
886
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
887
        pNew->m_pParent = pParent;
 
888
        return ( pNew );
 
889
    }
 
890
 
 
891
protected:
 
892
    EqUnaryOp   m_Operator;
 
893
};
 
894
 
 
895
 
 
896
///----------------------------------------------------------------------
 
897
/// CqParseNodeLogicalop
 
898
/// Parsenode specifying a logical operation.
 
899
 
 
900
class CqParseNodeLogicalOp : public CqParseNodeOp, public IqParseNodeLogicalOp
 
901
{
 
902
public:
 
903
    CqParseNodeLogicalOp( const CqParseNodeLogicalOp& from ) :
 
904
            CqParseNodeOp( from ),
 
905
            m_Operator( from.m_Operator )
 
906
    {}
 
907
    CqParseNodeLogicalOp( EqLogicalOp Operator ) :
 
908
            CqParseNodeOp(),
 
909
            m_Operator( Operator )
 
910
    {}
 
911
    virtual     ~CqParseNodeLogicalOp()
 
912
    {}
 
913
 
 
914
    // Overridden from IqParseNodeOperator
 
915
 
 
916
 
 
917
 
 
918
    virtual     TqInt   Operator() const
 
919
    {
 
920
        return ( m_Operator );
 
921
    }
 
922
    // Overridden from IqParseNode
 
923
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
924
    {
 
925
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeLogicalOp>( this, type ) ) != 0 ) return ( TqTrue );
 
926
        return ( CqParseNodeOp::GetInterface( type, pNode ) );
 
927
    }
 
928
    virtual     TqInt   NodeType() const
 
929
    {
 
930
        return ( IqParseNodeLogicalOp::m_ID );
 
931
    }
 
932
    virtual     TqInt   ResType() const
 
933
    {
 
934
        return ( Type_Float );
 
935
    }
 
936
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeLogicalOp&>(*this)); }
 
937
 
 
938
 
 
939
 
 
940
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
941
    {
 
942
        CqParseNodeLogicalOp * pNew = new CqParseNodeLogicalOp( *this );
 
943
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
944
        pNew->m_pParent = pParent;
 
945
        return ( pNew );
 
946
    }
 
947
 
 
948
protected:
 
949
    EqLogicalOp m_Operator;
 
950
};
 
951
 
 
952
 
 
953
///----------------------------------------------------------------------
 
954
/// CqParseNodeDrop
 
955
/// Parsenode specifying an assignment operation.
 
956
 
 
957
class CqParseNodeDrop : public CqParseNode, public IqParseNodeDiscardResult
 
958
{
 
959
public:
 
960
    CqParseNodeDrop( const CqParseNodeDrop& from ) :
 
961
            CqParseNode( from )
 
962
    {}
 
963
    CqParseNodeDrop() :
 
964
            CqParseNode()
 
965
    {}
 
966
    virtual     ~CqParseNodeDrop()
 
967
    {}
 
968
 
 
969
    // Overridden from IqParseNode
 
970
 
 
971
 
 
972
 
 
973
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
974
    {
 
975
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeDiscardResult>( this, type ) ) != 0 ) return ( TqTrue );
 
976
        return ( CqParseNode::GetInterface( type, pNode ) );
 
977
    }
 
978
    virtual     TqInt   NodeType() const
 
979
    {
 
980
        return ( IqParseNodeDiscardResult::m_ID );
 
981
    }
 
982
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeDiscardResult&>(*this)); }
 
983
 
 
984
 
 
985
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
986
    {
 
987
        CqParseNodeDrop * pNew = new CqParseNodeDrop( *this );
 
988
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
989
        pNew->m_pParent = pParent;
 
990
        return ( pNew );
 
991
    }
 
992
 
 
993
private:
 
994
};
 
995
 
 
996
 
 
997
///----------------------------------------------------------------------
 
998
/// CqParseNodeConst
 
999
/// Base class for all const types.
 
1000
 
 
1001
class CqParseNodeConst : public CqParseNode
 
1002
{
 
1003
public:
 
1004
    CqParseNodeConst() :
 
1005
            CqParseNode()
 
1006
    {}
 
1007
    CqParseNodeConst( const CqParseNodeConst& from ) :
 
1008
            CqParseNode( from )
 
1009
    {}
 
1010
    virtual     ~CqParseNodeConst()
 
1011
    {}
 
1012
 
 
1013
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
1014
private:
 
1015
};
 
1016
 
 
1017
 
 
1018
///----------------------------------------------------------------------
 
1019
/// CqParseNodeFloatConst
 
1020
/// Parsenode specifying a float constant value.
 
1021
 
 
1022
class CqParseNodeFloatConst : public CqParseNodeConst, public IqParseNodeConstantFloat
 
1023
{
 
1024
public:
 
1025
    CqParseNodeFloatConst( const CqParseNodeFloatConst& from ) :
 
1026
            CqParseNodeConst( from ),
 
1027
            m_Value( from.m_Value )
 
1028
    {}
 
1029
    CqParseNodeFloatConst( TqFloat Val ) :
 
1030
            CqParseNodeConst(),
 
1031
            m_Value( Val )
 
1032
    {}
 
1033
    virtual     ~CqParseNodeFloatConst()
 
1034
    {}
 
1035
 
 
1036
    // Overridden from IqParseNodeConstantFloat
 
1037
 
 
1038
 
 
1039
 
 
1040
    virtual     TqFloat Value() const
 
1041
    {
 
1042
        return ( m_Value );
 
1043
    }
 
1044
    // Overridden from IqParseNode
 
1045
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1046
    {
 
1047
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeConstantFloat>( this, type ) ) != 0 ) return ( TqTrue );
 
1048
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1049
    }
 
1050
    virtual     TqInt   NodeType() const
 
1051
    {
 
1052
        return ( IqParseNodeConstantFloat::m_ID );
 
1053
    }
 
1054
    virtual     TqInt   ResType() const
 
1055
    {
 
1056
        return ( Type_Float );
 
1057
    }
 
1058
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeConstantFloat&>(*this)); }
 
1059
 
 
1060
 
 
1061
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1062
    {
 
1063
        CqParseNodeFloatConst * pNew = new CqParseNodeFloatConst( *this );
 
1064
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1065
        pNew->m_pParent = pParent;
 
1066
        return ( pNew );
 
1067
    }
 
1068
 
 
1069
private:
 
1070
    TqFloat     m_Value;
 
1071
};
 
1072
 
 
1073
 
 
1074
///----------------------------------------------------------------------
 
1075
/// CqParseNodeStringConst
 
1076
/// Parsenode specifying a string constant value.
 
1077
 
 
1078
class CqParseNodeStringConst : public CqParseNodeConst, public IqParseNodeConstantString
 
1079
{
 
1080
public:
 
1081
    CqParseNodeStringConst( const CqParseNodeStringConst& from ) :
 
1082
            CqParseNodeConst( from ),
 
1083
            m_Value( from.m_Value )
 
1084
    {}
 
1085
    CqParseNodeStringConst( const char* Val ) :
 
1086
            CqParseNodeConst(),
 
1087
            m_Value( Val )
 
1088
    {}
 
1089
    virtual     ~CqParseNodeStringConst()
 
1090
    {}
 
1091
 
 
1092
    // Overridden from IqParseNodeConstantString
 
1093
 
 
1094
 
 
1095
 
 
1096
    virtual     const char*     strValue() const
 
1097
    {
 
1098
        return ( m_Value.c_str() );
 
1099
    }
 
1100
    // Overridden from IqParseNode
 
1101
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1102
    {
 
1103
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeConstantString>( this, type ) ) != 0 ) return ( TqTrue );
 
1104
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1105
    }
 
1106
    virtual     TqInt   NodeType() const
 
1107
    {
 
1108
        return ( IqParseNodeConstantString::m_ID );
 
1109
    }
 
1110
    virtual     TqInt   ResType() const
 
1111
    {
 
1112
        return ( Type_String );
 
1113
    }
 
1114
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeConstantString&>(*this)); }
 
1115
 
 
1116
 
 
1117
 
 
1118
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1119
    {
 
1120
        CqParseNodeStringConst * pNew = new CqParseNodeStringConst( *this );
 
1121
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1122
        pNew->m_pParent = pParent;
 
1123
        return ( pNew );
 
1124
    }
 
1125
 
 
1126
private:
 
1127
    CqString    m_Value;
 
1128
};
 
1129
 
 
1130
 
 
1131
///----------------------------------------------------------------------
 
1132
/// CqParseNodeWhileConstruct
 
1133
/// Parsenode specifying an assignment operation.
 
1134
 
 
1135
class CqParseNodeWhileConstruct : public CqParseNode, public IqParseNodeWhileConstruct
 
1136
{
 
1137
public:
 
1138
    CqParseNodeWhileConstruct( const CqParseNodeWhileConstruct& from ) :
 
1139
            CqParseNode( from )
 
1140
    {}
 
1141
    CqParseNodeWhileConstruct() :
 
1142
            CqParseNode()
 
1143
    {}
 
1144
    virtual     ~CqParseNodeWhileConstruct()
 
1145
    {}
 
1146
 
 
1147
    // Overridden fromIqParseNode
 
1148
 
 
1149
 
 
1150
 
 
1151
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1152
    {
 
1153
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeWhileConstruct>( this, type ) ) != 0 ) return ( TqTrue );
 
1154
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1155
    }
 
1156
    virtual     TqInt   NodeType() const
 
1157
    {
 
1158
        return ( IqParseNodeWhileConstruct::m_ID );
 
1159
    }
 
1160
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeWhileConstruct&>(*this)); }
 
1161
 
 
1162
 
 
1163
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1164
    {
 
1165
        CqParseNodeWhileConstruct * pNew = new CqParseNodeWhileConstruct( *this );
 
1166
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1167
        pNew->m_pParent = pParent;
 
1168
        return ( pNew );
 
1169
    }
 
1170
 
 
1171
private:
 
1172
};
 
1173
 
 
1174
 
 
1175
///----------------------------------------------------------------------
 
1176
/// CqParseNodeIlluminateConstruct
 
1177
/// Parsenode an illuminate construct.
 
1178
 
 
1179
class CqParseNodeIlluminateConstruct : public CqParseNode, public IqParseNodeIlluminateConstruct
 
1180
{
 
1181
public:
 
1182
    CqParseNodeIlluminateConstruct( const CqParseNodeIlluminateConstruct& from ) :
 
1183
            CqParseNode( from ),
 
1184
            m_fAxisAngle( from.m_fAxisAngle )
 
1185
    {}
 
1186
    CqParseNodeIlluminateConstruct( TqBool fAxisAngle = TqFalse ) :
 
1187
            CqParseNode(),
 
1188
            m_fAxisAngle( fAxisAngle )
 
1189
    {}
 
1190
    virtual     ~CqParseNodeIlluminateConstruct()
 
1191
    {}
 
1192
 
 
1193
    // Overridden from IqParseNode
 
1194
 
 
1195
 
 
1196
 
 
1197
    virtual     TqBool  fHasAxisAngle() const
 
1198
    {
 
1199
        return ( m_fAxisAngle );
 
1200
    }
 
1201
    // Overridden from IqParseNode
 
1202
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1203
    {
 
1204
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeIlluminateConstruct>( this, type ) ) != 0 ) return ( TqTrue );
 
1205
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1206
    }
 
1207
    virtual     TqInt   NodeType() const
 
1208
    {
 
1209
        return ( IqParseNodeIlluminateConstruct::m_ID );
 
1210
    }
 
1211
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeIlluminateConstruct&>(*this)); }
 
1212
 
 
1213
 
 
1214
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1215
    {
 
1216
        CqParseNodeIlluminateConstruct * pNew = new CqParseNodeIlluminateConstruct( *this );
 
1217
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1218
        pNew->m_pParent = pParent;
 
1219
        return ( pNew );
 
1220
    }
 
1221
 
 
1222
private:
 
1223
    TqBool      m_fAxisAngle;
 
1224
};
 
1225
 
 
1226
 
 
1227
///----------------------------------------------------------------------
 
1228
/// CqParseNodeIlluminanceConstruct
 
1229
/// Parsenode an illuminance construct.
 
1230
 
 
1231
class CqParseNodeIlluminanceConstruct : public CqParseNode, public IqParseNodeIlluminanceConstruct
 
1232
{
 
1233
public:
 
1234
    CqParseNodeIlluminanceConstruct( const CqParseNodeIlluminanceConstruct& from ) :
 
1235
            CqParseNode( from ),
 
1236
            m_fAxisAngle( from.m_fAxisAngle )
 
1237
    {}
 
1238
    CqParseNodeIlluminanceConstruct( TqBool fAxisAngle = TqFalse ) :
 
1239
            CqParseNode(),
 
1240
            m_fAxisAngle( fAxisAngle )
 
1241
    {}
 
1242
    virtual     ~CqParseNodeIlluminanceConstruct()
 
1243
    {}
 
1244
 
 
1245
    // Overridden from IqParseNode
 
1246
 
 
1247
 
 
1248
 
 
1249
    virtual     TqBool  fHasAxisAngle() const
 
1250
    {
 
1251
        return ( m_fAxisAngle );
 
1252
    }
 
1253
    // Overridden from IqParseNode
 
1254
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1255
    {
 
1256
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeIlluminanceConstruct>( this, type ) ) != 0 ) return ( TqTrue );
 
1257
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1258
    }
 
1259
    virtual     TqInt   NodeType() const
 
1260
    {
 
1261
        return ( IqParseNodeIlluminanceConstruct::m_ID );
 
1262
    }
 
1263
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeIlluminanceConstruct&>(*this)); }
 
1264
 
 
1265
 
 
1266
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1267
    {
 
1268
        CqParseNodeIlluminanceConstruct * pNew = new CqParseNodeIlluminanceConstruct( *this );
 
1269
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1270
        pNew->m_pParent = pParent;
 
1271
        return ( pNew );
 
1272
    }
 
1273
 
 
1274
private:
 
1275
    TqBool      m_fAxisAngle;
 
1276
};
 
1277
 
 
1278
 
 
1279
///----------------------------------------------------------------------
 
1280
/// CqParseNodeSolarConstruct
 
1281
/// Parsenode an solar construct.
 
1282
 
 
1283
class CqParseNodeSolarConstruct : public CqParseNode, public IqParseNodeSolarConstruct
 
1284
{
 
1285
public:
 
1286
    CqParseNodeSolarConstruct( const CqParseNodeSolarConstruct& from ) :
 
1287
            CqParseNode( from ),
 
1288
            m_fAxisAngle( from.m_fAxisAngle )
 
1289
    {}
 
1290
    CqParseNodeSolarConstruct( TqBool fAxisAngle = TqFalse ) :
 
1291
            CqParseNode(),
 
1292
            m_fAxisAngle( fAxisAngle )
 
1293
    {}
 
1294
    virtual     ~CqParseNodeSolarConstruct()
 
1295
    {}
 
1296
 
 
1297
    // Overridden from IqParseNode
 
1298
 
 
1299
 
 
1300
 
 
1301
    virtual     TqBool  fHasAxisAngle() const
 
1302
    {
 
1303
        return ( m_fAxisAngle );
 
1304
    }
 
1305
    // Overridden from IqParseNode
 
1306
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1307
    {
 
1308
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeSolarConstruct>( this, type ) ) != 0 ) return ( TqTrue );
 
1309
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1310
    }
 
1311
    virtual     TqInt   NodeType() const
 
1312
    {
 
1313
        return ( IqParseNodeSolarConstruct::m_ID );
 
1314
    }
 
1315
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeSolarConstruct&>(*this)); }
 
1316
 
 
1317
 
 
1318
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1319
    {
 
1320
        CqParseNodeSolarConstruct * pNew = new CqParseNodeSolarConstruct( *this );
 
1321
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1322
        pNew->m_pParent = pParent;
 
1323
        return ( pNew );
 
1324
    }
 
1325
 
 
1326
private:
 
1327
    TqBool      m_fAxisAngle;
 
1328
};
 
1329
 
 
1330
 
 
1331
///----------------------------------------------------------------------
 
1332
/// CqParseNodeConditional
 
1333
/// Parsenode specifying an assignment operation.
 
1334
 
 
1335
class CqParseNodeConditional : public CqParseNode, public IqParseNodeConditional
 
1336
{
 
1337
public:
 
1338
    CqParseNodeConditional( const CqParseNodeConditional& from ) :
 
1339
            CqParseNode( from )
 
1340
    {}
 
1341
    CqParseNodeConditional() :
 
1342
            CqParseNode()
 
1343
    {}
 
1344
    virtual     ~CqParseNodeConditional()
 
1345
    {}
 
1346
 
 
1347
 
 
1348
    // Overridden from IqParseNode
 
1349
 
 
1350
 
 
1351
 
 
1352
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1353
    {
 
1354
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeConditional>( this, type ) ) != 0 ) return ( TqTrue );
 
1355
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1356
    }
 
1357
    virtual     TqInt   NodeType() const
 
1358
    {
 
1359
        return ( IqParseNodeConditional::m_ID );
 
1360
    }
 
1361
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeConditional&>(*this)); }
 
1362
 
 
1363
 
 
1364
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1365
    {
 
1366
        CqParseNodeConditional * pNew = new CqParseNodeConditional( *this );
 
1367
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1368
        pNew->m_pParent = pParent;
 
1369
        return ( pNew );
 
1370
    }
 
1371
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse )
 
1372
    {
 
1373
        TqInt Types = Type_Float;
 
1374
        TqInt NewType = Type_Nil;
 
1375
        CqParseNode* pChild = pFirstChild();
 
1376
 
 
1377
        // Typecheck the conditional
 
1378
        pChild->TypeCheck( &Types, 1, CheckOnly );
 
1379
 
 
1380
        // Now typecheck the conditional statements
 
1381
        pChild = pChild->pNext();
 
1382
        while ( pChild != 0 )
 
1383
        {
 
1384
            // Get the next pointer nowm, incase the TypeCheck inserts a Cast operator.
 
1385
            CqParseNode * pNext = pChild->pNext();
 
1386
            pChild->TypeCheck( pAllTypes(), Type_Last - 1, CheckOnly );
 
1387
            pChild = pNext;
 
1388
        }
 
1389
        return ( NewType );
 
1390
    }
 
1391
 
 
1392
private:
 
1393
};
 
1394
 
 
1395
///----------------------------------------------------------------------
 
1396
/// CqParseNodeQCond
 
1397
/// Parsenode specifying ? conditional.
 
1398
 
 
1399
class CqParseNodeQCond : public CqParseNode, public IqParseNodeConditionalExpression
 
1400
{
 
1401
public:
 
1402
    CqParseNodeQCond( const CqParseNodeQCond& from ) :
 
1403
            CqParseNode( from )
 
1404
    {}
 
1405
    CqParseNodeQCond() :
 
1406
            CqParseNode()
 
1407
    {}
 
1408
    virtual     ~CqParseNodeQCond()
 
1409
    {}
 
1410
 
 
1411
    // Overridden from IqParseNode
 
1412
 
 
1413
 
 
1414
 
 
1415
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1416
    {
 
1417
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeConditionalExpression>( this, type ) ) != 0 ) return ( TqTrue );
 
1418
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1419
    }
 
1420
    virtual     TqInt   NodeType() const
 
1421
    {
 
1422
        return ( IqParseNodeConditionalExpression::m_ID );
 
1423
    }
 
1424
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeConditionalExpression&>(*this)); }
 
1425
 
 
1426
 
 
1427
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
1428
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1429
    {
 
1430
        CqParseNodeQCond * pNew = new CqParseNodeQCond( *this );
 
1431
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1432
        pNew->m_pParent = pParent;
 
1433
        return ( pNew );
 
1434
    }
 
1435
 
 
1436
private:
 
1437
};
 
1438
 
 
1439
 
 
1440
 
 
1441
///----------------------------------------------------------------------
 
1442
/// CqParseNodeCast
 
1443
/// Parsenode specifying type cast operation.
 
1444
 
 
1445
class CqParseNodeCast : public CqParseNode, public IqParseNodeTypeCast
 
1446
{
 
1447
public:
 
1448
    CqParseNodeCast( const CqParseNodeCast& from ) :
 
1449
            CqParseNode( from ),
 
1450
            m_tTo( from.m_tTo )
 
1451
    {}
 
1452
    CqParseNodeCast( TqInt tto ) :
 
1453
            CqParseNode(),
 
1454
            m_tTo( tto )
 
1455
    {}
 
1456
    virtual     ~CqParseNodeCast()
 
1457
    {}
 
1458
 
 
1459
 
 
1460
    // Overridden from IqParseNodeTypeCast
 
1461
 
 
1462
 
 
1463
 
 
1464
    virtual     TqInt   CastTo() const
 
1465
    {
 
1466
        return ( m_tTo );
 
1467
    }
 
1468
    // Overridden from IqParseNode
 
1469
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1470
    {
 
1471
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeTypeCast>( this, type ) ) != 0 ) return ( TqTrue );
 
1472
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1473
    }
 
1474
    virtual     TqInt   NodeType() const
 
1475
    {
 
1476
        return ( IqParseNodeTypeCast::m_ID );
 
1477
    }
 
1478
    virtual     TqInt   ResType() const
 
1479
    {
 
1480
        return ( m_tTo );
 
1481
    }
 
1482
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeTypeCast&>(*this)); }
 
1483
 
 
1484
 
 
1485
 
 
1486
    virtual     TqBool  Optimise();
 
1487
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
1488
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1489
    {
 
1490
        CqParseNodeCast * pNew = new CqParseNodeCast( *this );
 
1491
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1492
        pNew->m_pParent = pParent;
 
1493
        return ( pNew );
 
1494
    }
 
1495
private:
 
1496
    TqInt       m_tTo;
 
1497
};
 
1498
 
 
1499
 
 
1500
///----------------------------------------------------------------------
 
1501
/// CqParseNodeTriple
 
1502
/// Parsenode specifying a float constant value.
 
1503
 
 
1504
class CqParseNodeTriple : public CqParseNode, public IqParseNodeTriple
 
1505
{
 
1506
public:
 
1507
    CqParseNodeTriple( const CqParseNodeTriple& from ) :
 
1508
            CqParseNode( from )
 
1509
    {}
 
1510
    CqParseNodeTriple() :
 
1511
            CqParseNode()
 
1512
    {}
 
1513
    virtual     ~CqParseNodeTriple()
 
1514
    {}
 
1515
 
 
1516
    // Overridden from IqParseNode
 
1517
 
 
1518
 
 
1519
 
 
1520
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1521
    {
 
1522
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeTriple>( this, type ) ) != 0 ) return ( TqTrue );
 
1523
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1524
    }
 
1525
    virtual     TqInt   NodeType() const
 
1526
    {
 
1527
        return ( IqParseNodeTriple::m_ID );
 
1528
    }
 
1529
    virtual     TqInt   ResType() const
 
1530
    {
 
1531
        return ( Type_Triple );
 
1532
    }
 
1533
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeTriple&>(*this)); }
 
1534
 
 
1535
 
 
1536
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
1537
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1538
    {
 
1539
        CqParseNodeTriple * pNew = new CqParseNodeTriple( *this );
 
1540
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1541
        pNew->m_pParent = pParent;
 
1542
        return ( pNew );
 
1543
    }
 
1544
 
 
1545
private:
 
1546
};
 
1547
 
 
1548
 
 
1549
///----------------------------------------------------------------------
 
1550
/// CqParseNodeHexTuple
 
1551
/// Parsenode specifying a matrix as 16 float values.
 
1552
 
 
1553
class CqParseNodeHexTuple : public CqParseNode, public IqParseNodeSixteenTuple
 
1554
{
 
1555
public:
 
1556
    CqParseNodeHexTuple( const CqParseNodeHexTuple& from ) :
 
1557
            CqParseNode( from )
 
1558
    {}
 
1559
    CqParseNodeHexTuple() :
 
1560
            CqParseNode()
 
1561
    {}
 
1562
    virtual     ~CqParseNodeHexTuple()
 
1563
    {}
 
1564
 
 
1565
    // Overridden from IqParseNode
 
1566
 
 
1567
 
 
1568
 
 
1569
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1570
    {
 
1571
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeSixteenTuple>( this, type ) ) != 0 ) return ( TqTrue );
 
1572
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1573
    }
 
1574
    virtual     TqInt   NodeType() const
 
1575
    {
 
1576
        return ( IqParseNodeSixteenTuple::m_ID );
 
1577
    }
 
1578
    virtual     TqInt   ResType() const
 
1579
    {
 
1580
        return ( Type_HexTuple );
 
1581
    }
 
1582
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeSixteenTuple&>(*this)); }
 
1583
 
 
1584
 
 
1585
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
1586
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1587
    {
 
1588
        CqParseNodeHexTuple * pNew = new CqParseNodeHexTuple( *this );
 
1589
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1590
        pNew->m_pParent = pParent;
 
1591
        return ( pNew );
 
1592
    }
 
1593
 
 
1594
private:
 
1595
};
 
1596
 
 
1597
 
 
1598
///----------------------------------------------------------------------
 
1599
/// CqParseNodeCommFunction
 
1600
/// Parsenode specifying a special comm function.
 
1601
 
 
1602
class CqParseNodeCommFunction : public CqParseNode, public IqParseNodeMessagePassingFunction
 
1603
{
 
1604
public:
 
1605
    CqParseNodeCommFunction( const CqParseNodeCommFunction& from ) :
 
1606
            CqParseNode( from ),
 
1607
            m_vrVariable( from.m_vrVariable ),
 
1608
            m_vrExtra( from.m_vrExtra ),
 
1609
            m_commType( from.m_commType )
 
1610
    {}
 
1611
    CqParseNodeCommFunction( TqInt Type, CqString vrExtra, SqVarRef vrVariable ) :
 
1612
            CqParseNode(),
 
1613
            m_vrVariable( vrVariable ),
 
1614
            m_vrExtra( vrExtra ),
 
1615
            m_commType( Type )
 
1616
    {}
 
1617
    CqParseNodeCommFunction( TqInt Type, SqVarRef vrVariable ) :
 
1618
            CqParseNode(),
 
1619
            m_vrVariable( vrVariable ),
 
1620
            m_vrExtra( "" ),
 
1621
            m_commType( Type )
 
1622
    {}
 
1623
 
 
1624
    virtual     ~CqParseNodeCommFunction()
 
1625
    {}
 
1626
 
 
1627
    // Overridden from IqParseNodeMessagePassingFunction
 
1628
 
 
1629
 
 
1630
 
 
1631
    virtual     SqVarRef        VarRef() const
 
1632
    {
 
1633
        return ( m_vrVariable );
 
1634
    }
 
1635
    virtual CqString Extra() const
 
1636
    {
 
1637
        return ( m_vrExtra );
 
1638
    }
 
1639
    virtual     TqInt   CommType() const
 
1640
    {
 
1641
        return ( m_commType );
 
1642
    }
 
1643
    // Overridden from IqParseNode
 
1644
    virtual     TqBool  GetInterface( EqParseNodeType type, void** pNode ) const
 
1645
    {
 
1646
        if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeMessagePassingFunction>( this, type ) ) != 0 ) return ( TqTrue );
 
1647
        return ( CqParseNode::GetInterface( type, pNode ) );
 
1648
    }
 
1649
    virtual     TqInt   NodeType() const
 
1650
    {
 
1651
        return ( IqParseNodeMessagePassingFunction::m_ID );
 
1652
    }
 
1653
    virtual     TqInt   ResType() const
 
1654
    {
 
1655
        return ( Type_Float );
 
1656
    }
 
1657
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(static_cast<IqParseNodeMessagePassingFunction&>(*this)); }
 
1658
 
 
1659
 
 
1660
    virtual     TqInt   TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
 
1661
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1662
    {
 
1663
        CqParseNodeCommFunction * pNew = new CqParseNodeCommFunction( *this );
 
1664
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1665
        pNew->m_pParent = pParent;
 
1666
        return ( pNew );
 
1667
    }
 
1668
 
 
1669
private:
 
1670
    SqVarRef    m_vrVariable;
 
1671
    CqString m_vrExtra;
 
1672
    TqInt       m_commType;
 
1673
};
 
1674
 
 
1675
 
 
1676
///----------------------------------------------------------------------
 
1677
/// CqParseDeclaration
 
1678
/// Parsenode specifying a variable declaration.
 
1679
 
 
1680
class CqParseNodeDeclaration : public CqParseNode
 
1681
{
 
1682
public:
 
1683
    CqParseNodeDeclaration( const CqParseNodeDeclaration& from ) :
 
1684
            CqParseNode( from ),
 
1685
            m_strName( from.m_strName ),
 
1686
            m_Type( from.m_Type ),
 
1687
            m_Output( from.m_Output )
 
1688
    {}
 
1689
    CqParseNodeDeclaration( const char* strName = "", TqInt Type = Type_Nil ) :
 
1690
            CqParseNode(),
 
1691
            m_strName( strName ),
 
1692
            m_Type( Type ),
 
1693
            m_Output( TqFalse )
 
1694
    {
 
1695
        m_fVarying = ( m_Type & Type_Varying ) != 0;
 
1696
    }
 
1697
    virtual     ~CqParseNodeDeclaration()
 
1698
    {}
 
1699
    const char* strName()
 
1700
    {
 
1701
        return ( m_strName.c_str() );
 
1702
    }
 
1703
    TqInt       Type() const
 
1704
    {
 
1705
        return ( m_Type );
 
1706
    }
 
1707
    void        SetType( TqInt Type )
 
1708
    {
 
1709
        m_Type = Type;
 
1710
    }
 
1711
    TqBool      Output() const
 
1712
    {
 
1713
        return ( m_Output );
 
1714
    }
 
1715
    void        SetOutput( TqBool Output )
 
1716
    {
 
1717
        m_Output = Output;
 
1718
    }
 
1719
    virtual     void    Accept( IqParseNodeVisitor &V)  { V.Visit(*this); }
 
1720
 
 
1721
 
 
1722
 
 
1723
    virtual     CqParseNode*    Clone( CqParseNode* pParent = 0 )
 
1724
    {
 
1725
        CqParseNodeDeclaration * pNew = new CqParseNodeDeclaration( *this );
 
1726
        if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
 
1727
        pNew->m_pParent = pParent;
 
1728
        return ( pNew );
 
1729
    }
 
1730
protected:
 
1731
    CqString    m_strName;
 
1732
    TqInt       m_Type;
 
1733
    TqBool      m_Output;
 
1734
};
 
1735
 
 
1736
 
 
1737
//-----------------------------------------------------------------------
 
1738
 
 
1739
END_NAMESPACE( Aqsis )
 
1740
 
 
1741
#endif  // !PARSENODE_H_INCLUDED