1
////---------------------------------------------------------------------
2
//// Associated header file: PARSENODE.H
3
//// Class definition file: PARSENODE.CPP
5
//// Author: Paul C. Gregory
6
//// Creation date: 17/07/99
7
////---------------------------------------------------------------------
9
//? Is .h included already?
10
#ifndef PARSENODE_H_INCLUDED
11
#define PARSENODE_H_INCLUDED 1
19
#include "iparsenode.h"
23
START_NAMESPACE( Aqsis )
25
extern char* gShaderTypeNames[];
26
extern TqInt gcShaderTypeNames;
28
///----------------------------------------------------------------------
29
/** \class CqParseNode
30
* Abstract base class from which all parse nodes are define.
33
class CqParseNodeShader;
34
class CqParseNode : public CqListEntry<CqParseNode>, public IqParseNode
37
CqParseNode() : m_pChild( 0 ), m_pParent( 0 ), m_fVarying( TqFalse ), m_LineNo( -1 )
39
virtual ~CqParseNode()
41
if ( m_pParent && m_pParent->m_pChild == this )
42
m_pParent->m_pChild = pNext();
46
// Overridden from IqParseNode
47
virtual IqParseNode* pChild() const
51
virtual IqParseNode* pParent() const
55
virtual IqParseNode* pNextSibling() const
59
virtual IqParseNode* pPrevSibling() const
61
return ( pPrevious() );
63
virtual TqInt LineNo() const
67
virtual const char* strFileName() const
69
return ( m_strFileName.c_str() );
71
virtual TqBool IsVariableRef() const
75
virtual TqInt ResType() const
80
return ( m_pChild->ResType() );
82
virtual TqBool fVarying() const
84
return ( m_fVarying );
86
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
88
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNode>( this, type ) ) != 0 ) return ( TqTrue );
91
virtual TqInt NodeType() const
93
return ( IqParseNode::m_ID );
95
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(*this); }
99
CqParseNode* pFirstChild() const
103
CqParseNode* pLastChild() const
105
CqParseNode * pChild = m_pChild;
106
while ( pChild->pNext() != 0 ) pChild = pChild->pNext();
109
void AddLastChild( CqParseNode* pChild )
116
CqParseNode* pLastC = m_pChild;
117
while ( pLastC->pNext() ) pLastC = pLastC->pNext();
118
pChild->LinkAfter( pLastC );
120
m_fVarying |= pChild->m_fVarying;
121
pChild->m_pParent = this;
123
void AddFirstChild( CqParseNode* pChild )
130
pChild->LinkBefore( m_pChild );
133
m_fVarying |= pChild->m_fVarying;
134
pChild->m_pParent = this;
136
void LinkAfter( CqParseNode* pN )
138
CqListEntry<CqParseNode>::LinkAfter( pN );
139
m_pParent = pN->m_pParent;
141
void LinkParent( CqParseNode* pN )
144
// If I have a prev sibling, link pN after it.
145
if ( pPrevious() != 0 )
146
pN->LinkAfter( pPrevious() );
149
// Else if I have a parent, link pN as its first child.
150
if ( m_pParent != 0 )
151
m_pParent->AddFirstChild( pN );
153
// Unlink myself from the tree, and then relink under pN
155
pN->AddLastChild( this );
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();
169
void SetPos( TqInt LineNo, const char* strFileName )
172
m_strFileName = strFileName;
175
virtual TqBool Optimise();
176
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse )
178
TqInt NewType = Type_Nil;
179
CqParseNode* pChild = pFirstChild();
180
while ( pChild != 0 )
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 );
191
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
193
CqParseNode * pNew = new CqParseNode();
194
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
195
pNew->m_pParent = pParent;
198
virtual TqBool UpdateStorageStatus()
200
m_fVarying = TqFalse;
201
CqParseNode* pChild = m_pChild;
202
while ( pChild != 0 )
204
if ( pChild->UpdateStorageStatus() )
206
pChild = pChild->pNext();
208
return ( m_fVarying );
211
CqParseNodeShader* pShaderNode();
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()
219
return ( m_aAllTypes );
223
CqParseNode* m_pChild;
224
CqParseNode* m_pParent;
227
CqString m_strFileName;
229
static TqInt m_cLabels;
230
static TqInt m_aaTypePriorities[ Type_Last ][ Type_Last ];
231
static TqInt m_aAllTypes[ Type_Last - 1 ];
235
///----------------------------------------------------------------------
237
/// Parsenode specifying a shader definition.
239
class CqParseNodeShader : public CqParseNode, public IqParseNodeShader
242
CqParseNodeShader( const CqParseNodeShader& from ) :
244
m_strName( from.m_strName ),
245
m_ShaderType( from.m_ShaderType )
247
CqParseNodeShader( const char* strName = "", const EqShaderType Type = Type_Surface ) :
249
m_strName( strName ),
252
virtual ~CqParseNodeShader()
255
// Overridden from IqParseNodeShader
259
virtual const char* strName() const
261
return ( m_strName.c_str() );
263
virtual const char* strShaderType() const
265
assert( m_ShaderType < gcShaderTypeNames );
266
return ( gShaderTypeNames[ m_ShaderType ] );
268
virtual const EqShaderType ShaderType() const
270
return( m_ShaderType );
273
// Overridden from IqParseNode
274
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
276
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeShader>( this, type ) ) != 0 ) return ( TqTrue );
277
return ( CqParseNode::GetInterface( type, pNode ) );
279
virtual TqInt NodeType() const
281
return ( IqParseNodeShader::m_ID );
283
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeShader&>(*this)); }
286
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
288
CqParseNodeShader * pNew = new CqParseNodeShader( *this );
289
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
290
pNew->m_pParent = pParent;
295
EqShaderType m_ShaderType;
299
///----------------------------------------------------------------------
300
/// CqParseNodeFunctionCall
301
/// Parsenode specifying a function call.
303
class CqParseNodeFunctionCall : public CqParseNode, public IqParseNodeFunctionCall
306
CqParseNodeFunctionCall( const CqParseNodeFunctionCall& from ) :
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 ];
313
CqParseNodeFunctionCall( std::vector<SqFuncRef>& aFuncRef ) :
316
m_aFuncRef.resize( aFuncRef.size() );
317
for ( TqUint i = 0; i < m_aFuncRef.size(); i++ )
318
m_aFuncRef[ i ] = aFuncRef[ i ];
320
virtual ~CqParseNodeFunctionCall()
323
// Overridden from IqParseNodeFunctionCall
327
virtual const char* strName() const;
328
virtual const IqFuncDef* pFuncDef() const;
329
virtual IqFuncDef* pFuncDef();
331
// Overridden from IqParseNode
332
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
334
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeFunctionCall>( this, type ) ) != 0 ) return ( TqTrue );
335
return ( CqParseNode::GetInterface( type, pNode ) );
337
virtual TqInt NodeType() const
339
return ( IqParseNodeFunctionCall::m_ID );
341
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeFunctionCall&>(*this)); }
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 )
349
CqParseNodeFunctionCall * pNew = new CqParseNodeFunctionCall( *this );
350
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
351
pNew->m_pParent = pParent;
354
std::vector<SqFuncRef>& aFuncRef()
356
return ( m_aFuncRef );
358
void CheckArgCast( std::vector<TqInt>& aRes );
359
void ArgCast( TqInt iIndex );
362
std::vector<SqFuncRef> m_aFuncRef;
366
///----------------------------------------------------------------------
367
/// CqParseNodeUnresolvedCall
368
/// Parsenode specifying an unresolved call., to be handled by a DSO.
370
class CqParseNodeUnresolvedCall : public CqParseNode, public IqParseNodeUnresolvedCall
373
CqParseNodeUnresolvedCall( CqFuncDef& aFuncDef) :
376
m_aFuncDef = aFuncDef ;
379
virtual ~CqParseNodeUnresolvedCall()
382
// Overridden from IqParseNodeUnresolvedCall
384
virtual const char* strName() const;
385
virtual const IqFuncDef* pFuncDef() const;
386
virtual IqFuncDef* pFuncDef();
388
// Overridden from IqParseNode
389
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
391
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeUnresolvedCall>( this, type ) ) != 0 ) return ( TqTrue );
392
return ( CqParseNode::GetInterface( type, pNode ) );
394
virtual TqInt NodeType() const
396
return ( IqParseNodeUnresolvedCall::m_ID );
398
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeUnresolvedCall&>(*this)); }
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 )
406
CqParseNodeUnresolvedCall * pNew = new CqParseNodeUnresolvedCall( *this );
407
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
408
pNew->m_pParent = pParent;
411
CqFuncDef& pFuncDefInt()
413
return ( m_aFuncDef );
415
//void CheckArgCast( std::vector<TqInt>& aRes );
416
//void ArgCast( TqInt iIndex );
419
CqFuncDef m_aFuncDef;
422
///----------------------------------------------------------------------
423
/// CqParseNodeVariable
424
/// Parsenode specifying a variable access.
426
class CqParseNodeVariable : public CqParseNode, public IqParseNodeVariable
429
CqParseNodeVariable( const CqParseNodeVariable& from ) :
431
m_VarRef( from.m_VarRef ),
432
m_Extra( from.m_Extra )
434
CqParseNodeVariable( SqVarRef VarRef );
435
CqParseNodeVariable( CqParseNodeVariable* pVar );
436
virtual ~CqParseNodeVariable()
439
// Overridden from IqParseNodeVariable
443
virtual const char* strName() const;
444
virtual SqVarRef VarRef() const
448
virtual CqString Extra() const
452
virtual TqBool IsLocal() const
454
return ( m_VarRef.m_Type == VarTypeLocal );
457
// Overridden from IqParseNode
458
virtual TqBool IsVariableRef() const
462
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
464
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeVariable>( this, type ) ) != 0 ) return ( TqTrue );
465
return ( CqParseNode::GetInterface( type, pNode ) );
467
virtual TqInt NodeType() const
469
return ( IqParseNodeVariable::m_ID );
471
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeVariable&>(*this)); }
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 )
480
CqParseNodeVariable * pNew = new CqParseNodeVariable( *this );
481
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
482
pNew->m_pParent = pParent;
487
IqVarDef * pVarDef = CqVarDef::GetVariablePtr( m_VarRef );
488
if ( pVarDef != 0 ) pVarDef->SetParam();
492
IqVarDef * pVarDef = CqVarDef::GetVariablePtr( m_VarRef );
493
if ( pVarDef != 0 ) pVarDef->SetOutput();
495
void SetDefaultStorage( TqInt Storage )
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 );
508
///----------------------------------------------------------------------
509
/// CqParseNodeVariableArray
510
/// Parsenode specifying an array variable access.
512
class CqParseNodeVariableArray : public CqParseNodeVariable, public IqParseNodeArrayVariable
515
CqParseNodeVariableArray( const CqParseNodeVariableArray& from ) :
516
CqParseNodeVariable( from )
518
CqParseNodeVariableArray( SqVarRef VarRef );
519
CqParseNodeVariableArray( CqParseNodeVariableArray* pVar );
520
virtual ~CqParseNodeVariableArray()
523
// Overridden from IqParseNode
527
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
529
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeArrayVariable>( this, type ) ) != 0 ) return ( TqTrue );
530
return ( CqParseNodeVariable::GetInterface( type, pNode ) );
532
virtual TqInt NodeType() const
534
return ( IqParseNodeArrayVariable::m_ID );
536
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeArrayVariable&>(*this)); }
539
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
540
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
542
CqParseNodeVariableArray * pNew = new CqParseNodeVariableArray( *this );
543
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
544
pNew->m_pParent = pParent;
551
///----------------------------------------------------------------------
552
/// CqParseNodeAssign
553
/// Parsenode specifying an assignment operation.
555
class CqParseNodeAssign : public CqParseNodeVariable, public IqParseNodeVariableAssign
558
CqParseNodeAssign( const CqParseNodeAssign& from ) :
559
CqParseNodeVariable( from ),
560
m_fNoDup( from.m_fNoDup )
562
CqParseNodeAssign( SqVarRef VarRef ) :
563
CqParseNodeVariable( VarRef ),
566
CqParseNodeAssign( CqParseNodeVariable* pVar ) :
567
CqParseNodeVariable( pVar )
569
virtual ~CqParseNodeAssign()
572
// Overridden from IqParseNodeVariableAssign
576
virtual TqBool fDiscardResult() const
580
// Overridden from IqParseNode
581
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
583
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeVariableAssign>( this, type ) ) != 0 ) return ( TqTrue );
584
return ( CqParseNodeVariable::GetInterface( type, pNode ) );
586
virtual TqInt NodeType() const
588
return ( IqParseNodeVariableAssign::m_ID );
590
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeVariableAssign&>(*this)); }
594
virtual TqBool Optimise();
595
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
600
virtual TqInt ResType() const;
601
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
603
CqParseNodeAssign * pNew = new CqParseNodeAssign( *this );
604
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
605
pNew->m_pParent = pParent;
608
virtual TqBool UpdateStorageStatus()
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 );
616
m_fVarying = ( pVarDef->Type() & Type_Varying ) != 0;
618
m_fVarying = ( ( fVarying ) || ( m_fVarying ) );
620
return ( m_fVarying );
628
///----------------------------------------------------------------------
629
/// CqParseNodeAssignArray
630
/// Parsenode specifying an assignment operation to an indexed array.
632
class CqParseNodeAssignArray : public CqParseNodeAssign, public IqParseNodeArrayVariableAssign
635
CqParseNodeAssignArray( const CqParseNodeAssignArray& from ) :
636
CqParseNodeAssign( from )
638
CqParseNodeAssignArray( SqVarRef VarRef ) :
639
CqParseNodeAssign( VarRef )
641
CqParseNodeAssignArray( CqParseNodeVariable* pVar ) :
642
CqParseNodeAssign( pVar )
644
virtual ~CqParseNodeAssignArray()
647
// Overridden from IqParseNode
651
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
653
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeArrayVariableAssign>( this, type ) ) != 0 ) return ( TqTrue );
654
return ( CqParseNodeAssign::GetInterface( type, pNode ) );
656
virtual TqInt NodeType() const
658
return ( IqParseNodeArrayVariableAssign::m_ID );
660
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeArrayVariableAssign&>(*this)); }
664
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
665
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
667
CqParseNodeAssignArray * pNew = new CqParseNodeAssignArray( *this );
668
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
669
pNew->m_pParent = pParent;
676
///----------------------------------------------------------------------
678
/// Base parsenode specifying an operation.
680
class CqParseNodeOp : public CqParseNode, public IqParseNodeOperator
683
CqParseNodeOp( const CqParseNodeOp& from ) :
689
virtual ~CqParseNodeOp()
692
// Overridden from IqParseNode
696
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
698
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeOperator>( this, type ) ) != 0 ) return ( TqTrue );
699
return ( CqParseNode::GetInterface( type, pNode ) );
701
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeOperator&>(*this)); }
703
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
707
///----------------------------------------------------------------------
708
/// CqParseNodeMathOp
709
/// Parsenode specifying a mathematical operation.
711
class CqParseNodeMathOp : public CqParseNodeOp, public IqParseNodeMathOp
714
CqParseNodeMathOp( const CqParseNodeMathOp& from ) :
715
CqParseNodeOp( from ),
716
m_Operator( from.m_Operator )
718
CqParseNodeMathOp() :
722
CqParseNodeMathOp( EqMathOp Operator ) :
724
m_Operator( Operator )
726
virtual ~CqParseNodeMathOp()
729
// Overridden from IqParseNodeOperator
733
virtual TqInt Operator() const
735
return ( m_Operator );
737
// Overridden from IqParseNode
738
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
740
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeMathOp>( this, type ) ) != 0 ) return ( TqTrue );
741
return ( CqParseNodeOp::GetInterface( type, pNode ) );
743
virtual TqInt NodeType() const
745
return ( IqParseNodeMathOp::m_ID );
747
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeMathOp&>(*this)); }
751
virtual TqInt ResType() const;
752
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
754
CqParseNodeMathOp * pNew = new CqParseNodeMathOp( *this );
755
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
756
pNew->m_pParent = pParent;
765
///----------------------------------------------------------------------
766
/// CqParseNodeMathOpDot
767
/// Parsenode specifying a dot (dot product) operation.
769
class CqParseNodeMathOpDot : public CqParseNodeMathOp
772
CqParseNodeMathOpDot( const CqParseNodeMathOpDot& from ) :
773
CqParseNodeMathOp( from )
775
CqParseNodeMathOpDot() :
776
CqParseNodeMathOp( Op_Dot )
778
virtual ~CqParseNodeMathOpDot()
781
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
785
///----------------------------------------------------------------------
787
/// Parsenode specifying a relational operation.
789
class CqParseNodeRelOp : public CqParseNodeOp, public IqParseNodeRelationalOp
792
CqParseNodeRelOp( const CqParseNodeRelOp& from ) :
793
CqParseNodeOp( from ),
794
m_Operator( from.m_Operator )
796
CqParseNodeRelOp( EqRelOp Operator ) :
798
m_Operator( Operator )
800
virtual ~CqParseNodeRelOp()
803
// Overridden from IqParseNodeOperator
807
virtual TqInt Operator() const
809
return ( m_Operator );
811
// Overridden from IqParseNode
812
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
814
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeRelationalOp>( this, type ) ) != 0 ) return ( TqTrue );
815
return ( CqParseNodeOp::GetInterface( type, pNode ) );
817
virtual TqInt NodeType() const
819
return ( IqParseNodeRelationalOp::m_ID );
821
virtual TqInt ResType() const
823
return ( Type_Float );
825
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeRelationalOp&>(*this)); }
829
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
831
CqParseNodeRelOp * pNew = new CqParseNodeRelOp( *this );
832
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
833
pNew->m_pParent = pParent;
836
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
843
///----------------------------------------------------------------------
844
/// CqParseNodeUnaryop
845
/// Parsenode specifying a unary operation.
847
class CqParseNodeUnaryOp : public CqParseNodeOp, public IqParseNodeUnaryOp
850
CqParseNodeUnaryOp( const CqParseNodeUnaryOp& from ) :
851
CqParseNodeOp( from ),
852
m_Operator( from.m_Operator )
854
CqParseNodeUnaryOp( EqUnaryOp Operator ) :
856
m_Operator( Operator )
858
virtual ~CqParseNodeUnaryOp()
861
// Overridden from IqParseNodeOperator
865
virtual TqInt Operator() const
867
return ( m_Operator );
869
// Overridden from IqParseNode
870
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
872
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeUnaryOp>( this, type ) ) != 0 ) return ( TqTrue );
873
return ( CqParseNodeOp::GetInterface( type, pNode ) );
875
virtual TqInt NodeType() const
877
return ( IqParseNodeUnaryOp::m_ID );
879
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeUnaryOp&>(*this)); }
882
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
883
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
885
CqParseNodeUnaryOp * pNew = new CqParseNodeUnaryOp( *this );
886
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
887
pNew->m_pParent = pParent;
892
EqUnaryOp m_Operator;
896
///----------------------------------------------------------------------
897
/// CqParseNodeLogicalop
898
/// Parsenode specifying a logical operation.
900
class CqParseNodeLogicalOp : public CqParseNodeOp, public IqParseNodeLogicalOp
903
CqParseNodeLogicalOp( const CqParseNodeLogicalOp& from ) :
904
CqParseNodeOp( from ),
905
m_Operator( from.m_Operator )
907
CqParseNodeLogicalOp( EqLogicalOp Operator ) :
909
m_Operator( Operator )
911
virtual ~CqParseNodeLogicalOp()
914
// Overridden from IqParseNodeOperator
918
virtual TqInt Operator() const
920
return ( m_Operator );
922
// Overridden from IqParseNode
923
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
925
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeLogicalOp>( this, type ) ) != 0 ) return ( TqTrue );
926
return ( CqParseNodeOp::GetInterface( type, pNode ) );
928
virtual TqInt NodeType() const
930
return ( IqParseNodeLogicalOp::m_ID );
932
virtual TqInt ResType() const
934
return ( Type_Float );
936
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeLogicalOp&>(*this)); }
940
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
942
CqParseNodeLogicalOp * pNew = new CqParseNodeLogicalOp( *this );
943
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
944
pNew->m_pParent = pParent;
949
EqLogicalOp m_Operator;
953
///----------------------------------------------------------------------
955
/// Parsenode specifying an assignment operation.
957
class CqParseNodeDrop : public CqParseNode, public IqParseNodeDiscardResult
960
CqParseNodeDrop( const CqParseNodeDrop& from ) :
966
virtual ~CqParseNodeDrop()
969
// Overridden from IqParseNode
973
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
975
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeDiscardResult>( this, type ) ) != 0 ) return ( TqTrue );
976
return ( CqParseNode::GetInterface( type, pNode ) );
978
virtual TqInt NodeType() const
980
return ( IqParseNodeDiscardResult::m_ID );
982
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeDiscardResult&>(*this)); }
985
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
987
CqParseNodeDrop * pNew = new CqParseNodeDrop( *this );
988
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
989
pNew->m_pParent = pParent;
997
///----------------------------------------------------------------------
999
/// Base class for all const types.
1001
class CqParseNodeConst : public CqParseNode
1004
CqParseNodeConst() :
1007
CqParseNodeConst( const CqParseNodeConst& from ) :
1010
virtual ~CqParseNodeConst()
1013
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
1018
///----------------------------------------------------------------------
1019
/// CqParseNodeFloatConst
1020
/// Parsenode specifying a float constant value.
1022
class CqParseNodeFloatConst : public CqParseNodeConst, public IqParseNodeConstantFloat
1025
CqParseNodeFloatConst( const CqParseNodeFloatConst& from ) :
1026
CqParseNodeConst( from ),
1027
m_Value( from.m_Value )
1029
CqParseNodeFloatConst( TqFloat Val ) :
1033
virtual ~CqParseNodeFloatConst()
1036
// Overridden from IqParseNodeConstantFloat
1040
virtual TqFloat Value() const
1044
// Overridden from IqParseNode
1045
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1047
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeConstantFloat>( this, type ) ) != 0 ) return ( TqTrue );
1048
return ( CqParseNode::GetInterface( type, pNode ) );
1050
virtual TqInt NodeType() const
1052
return ( IqParseNodeConstantFloat::m_ID );
1054
virtual TqInt ResType() const
1056
return ( Type_Float );
1058
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeConstantFloat&>(*this)); }
1061
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1063
CqParseNodeFloatConst * pNew = new CqParseNodeFloatConst( *this );
1064
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1065
pNew->m_pParent = pParent;
1074
///----------------------------------------------------------------------
1075
/// CqParseNodeStringConst
1076
/// Parsenode specifying a string constant value.
1078
class CqParseNodeStringConst : public CqParseNodeConst, public IqParseNodeConstantString
1081
CqParseNodeStringConst( const CqParseNodeStringConst& from ) :
1082
CqParseNodeConst( from ),
1083
m_Value( from.m_Value )
1085
CqParseNodeStringConst( const char* Val ) :
1089
virtual ~CqParseNodeStringConst()
1092
// Overridden from IqParseNodeConstantString
1096
virtual const char* strValue() const
1098
return ( m_Value.c_str() );
1100
// Overridden from IqParseNode
1101
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1103
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeConstantString>( this, type ) ) != 0 ) return ( TqTrue );
1104
return ( CqParseNode::GetInterface( type, pNode ) );
1106
virtual TqInt NodeType() const
1108
return ( IqParseNodeConstantString::m_ID );
1110
virtual TqInt ResType() const
1112
return ( Type_String );
1114
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeConstantString&>(*this)); }
1118
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1120
CqParseNodeStringConst * pNew = new CqParseNodeStringConst( *this );
1121
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1122
pNew->m_pParent = pParent;
1131
///----------------------------------------------------------------------
1132
/// CqParseNodeWhileConstruct
1133
/// Parsenode specifying an assignment operation.
1135
class CqParseNodeWhileConstruct : public CqParseNode, public IqParseNodeWhileConstruct
1138
CqParseNodeWhileConstruct( const CqParseNodeWhileConstruct& from ) :
1141
CqParseNodeWhileConstruct() :
1144
virtual ~CqParseNodeWhileConstruct()
1147
// Overridden fromIqParseNode
1151
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1153
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeWhileConstruct>( this, type ) ) != 0 ) return ( TqTrue );
1154
return ( CqParseNode::GetInterface( type, pNode ) );
1156
virtual TqInt NodeType() const
1158
return ( IqParseNodeWhileConstruct::m_ID );
1160
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeWhileConstruct&>(*this)); }
1163
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1165
CqParseNodeWhileConstruct * pNew = new CqParseNodeWhileConstruct( *this );
1166
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1167
pNew->m_pParent = pParent;
1175
///----------------------------------------------------------------------
1176
/// CqParseNodeIlluminateConstruct
1177
/// Parsenode an illuminate construct.
1179
class CqParseNodeIlluminateConstruct : public CqParseNode, public IqParseNodeIlluminateConstruct
1182
CqParseNodeIlluminateConstruct( const CqParseNodeIlluminateConstruct& from ) :
1183
CqParseNode( from ),
1184
m_fAxisAngle( from.m_fAxisAngle )
1186
CqParseNodeIlluminateConstruct( TqBool fAxisAngle = TqFalse ) :
1188
m_fAxisAngle( fAxisAngle )
1190
virtual ~CqParseNodeIlluminateConstruct()
1193
// Overridden from IqParseNode
1197
virtual TqBool fHasAxisAngle() const
1199
return ( m_fAxisAngle );
1201
// Overridden from IqParseNode
1202
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1204
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeIlluminateConstruct>( this, type ) ) != 0 ) return ( TqTrue );
1205
return ( CqParseNode::GetInterface( type, pNode ) );
1207
virtual TqInt NodeType() const
1209
return ( IqParseNodeIlluminateConstruct::m_ID );
1211
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeIlluminateConstruct&>(*this)); }
1214
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1216
CqParseNodeIlluminateConstruct * pNew = new CqParseNodeIlluminateConstruct( *this );
1217
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1218
pNew->m_pParent = pParent;
1223
TqBool m_fAxisAngle;
1227
///----------------------------------------------------------------------
1228
/// CqParseNodeIlluminanceConstruct
1229
/// Parsenode an illuminance construct.
1231
class CqParseNodeIlluminanceConstruct : public CqParseNode, public IqParseNodeIlluminanceConstruct
1234
CqParseNodeIlluminanceConstruct( const CqParseNodeIlluminanceConstruct& from ) :
1235
CqParseNode( from ),
1236
m_fAxisAngle( from.m_fAxisAngle )
1238
CqParseNodeIlluminanceConstruct( TqBool fAxisAngle = TqFalse ) :
1240
m_fAxisAngle( fAxisAngle )
1242
virtual ~CqParseNodeIlluminanceConstruct()
1245
// Overridden from IqParseNode
1249
virtual TqBool fHasAxisAngle() const
1251
return ( m_fAxisAngle );
1253
// Overridden from IqParseNode
1254
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1256
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeIlluminanceConstruct>( this, type ) ) != 0 ) return ( TqTrue );
1257
return ( CqParseNode::GetInterface( type, pNode ) );
1259
virtual TqInt NodeType() const
1261
return ( IqParseNodeIlluminanceConstruct::m_ID );
1263
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeIlluminanceConstruct&>(*this)); }
1266
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1268
CqParseNodeIlluminanceConstruct * pNew = new CqParseNodeIlluminanceConstruct( *this );
1269
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1270
pNew->m_pParent = pParent;
1275
TqBool m_fAxisAngle;
1279
///----------------------------------------------------------------------
1280
/// CqParseNodeSolarConstruct
1281
/// Parsenode an solar construct.
1283
class CqParseNodeSolarConstruct : public CqParseNode, public IqParseNodeSolarConstruct
1286
CqParseNodeSolarConstruct( const CqParseNodeSolarConstruct& from ) :
1287
CqParseNode( from ),
1288
m_fAxisAngle( from.m_fAxisAngle )
1290
CqParseNodeSolarConstruct( TqBool fAxisAngle = TqFalse ) :
1292
m_fAxisAngle( fAxisAngle )
1294
virtual ~CqParseNodeSolarConstruct()
1297
// Overridden from IqParseNode
1301
virtual TqBool fHasAxisAngle() const
1303
return ( m_fAxisAngle );
1305
// Overridden from IqParseNode
1306
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1308
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeSolarConstruct>( this, type ) ) != 0 ) return ( TqTrue );
1309
return ( CqParseNode::GetInterface( type, pNode ) );
1311
virtual TqInt NodeType() const
1313
return ( IqParseNodeSolarConstruct::m_ID );
1315
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeSolarConstruct&>(*this)); }
1318
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1320
CqParseNodeSolarConstruct * pNew = new CqParseNodeSolarConstruct( *this );
1321
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1322
pNew->m_pParent = pParent;
1327
TqBool m_fAxisAngle;
1331
///----------------------------------------------------------------------
1332
/// CqParseNodeConditional
1333
/// Parsenode specifying an assignment operation.
1335
class CqParseNodeConditional : public CqParseNode, public IqParseNodeConditional
1338
CqParseNodeConditional( const CqParseNodeConditional& from ) :
1341
CqParseNodeConditional() :
1344
virtual ~CqParseNodeConditional()
1348
// Overridden from IqParseNode
1352
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1354
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeConditional>( this, type ) ) != 0 ) return ( TqTrue );
1355
return ( CqParseNode::GetInterface( type, pNode ) );
1357
virtual TqInt NodeType() const
1359
return ( IqParseNodeConditional::m_ID );
1361
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeConditional&>(*this)); }
1364
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1366
CqParseNodeConditional * pNew = new CqParseNodeConditional( *this );
1367
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1368
pNew->m_pParent = pParent;
1371
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse )
1373
TqInt Types = Type_Float;
1374
TqInt NewType = Type_Nil;
1375
CqParseNode* pChild = pFirstChild();
1377
// Typecheck the conditional
1378
pChild->TypeCheck( &Types, 1, CheckOnly );
1380
// Now typecheck the conditional statements
1381
pChild = pChild->pNext();
1382
while ( pChild != 0 )
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 );
1395
///----------------------------------------------------------------------
1396
/// CqParseNodeQCond
1397
/// Parsenode specifying ? conditional.
1399
class CqParseNodeQCond : public CqParseNode, public IqParseNodeConditionalExpression
1402
CqParseNodeQCond( const CqParseNodeQCond& from ) :
1405
CqParseNodeQCond() :
1408
virtual ~CqParseNodeQCond()
1411
// Overridden from IqParseNode
1415
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1417
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeConditionalExpression>( this, type ) ) != 0 ) return ( TqTrue );
1418
return ( CqParseNode::GetInterface( type, pNode ) );
1420
virtual TqInt NodeType() const
1422
return ( IqParseNodeConditionalExpression::m_ID );
1424
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeConditionalExpression&>(*this)); }
1427
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
1428
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1430
CqParseNodeQCond * pNew = new CqParseNodeQCond( *this );
1431
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1432
pNew->m_pParent = pParent;
1441
///----------------------------------------------------------------------
1443
/// Parsenode specifying type cast operation.
1445
class CqParseNodeCast : public CqParseNode, public IqParseNodeTypeCast
1448
CqParseNodeCast( const CqParseNodeCast& from ) :
1449
CqParseNode( from ),
1452
CqParseNodeCast( TqInt tto ) :
1456
virtual ~CqParseNodeCast()
1460
// Overridden from IqParseNodeTypeCast
1464
virtual TqInt CastTo() const
1468
// Overridden from IqParseNode
1469
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1471
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeTypeCast>( this, type ) ) != 0 ) return ( TqTrue );
1472
return ( CqParseNode::GetInterface( type, pNode ) );
1474
virtual TqInt NodeType() const
1476
return ( IqParseNodeTypeCast::m_ID );
1478
virtual TqInt ResType() const
1482
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeTypeCast&>(*this)); }
1486
virtual TqBool Optimise();
1487
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
1488
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1490
CqParseNodeCast * pNew = new CqParseNodeCast( *this );
1491
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1492
pNew->m_pParent = pParent;
1500
///----------------------------------------------------------------------
1501
/// CqParseNodeTriple
1502
/// Parsenode specifying a float constant value.
1504
class CqParseNodeTriple : public CqParseNode, public IqParseNodeTriple
1507
CqParseNodeTriple( const CqParseNodeTriple& from ) :
1510
CqParseNodeTriple() :
1513
virtual ~CqParseNodeTriple()
1516
// Overridden from IqParseNode
1520
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1522
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeTriple>( this, type ) ) != 0 ) return ( TqTrue );
1523
return ( CqParseNode::GetInterface( type, pNode ) );
1525
virtual TqInt NodeType() const
1527
return ( IqParseNodeTriple::m_ID );
1529
virtual TqInt ResType() const
1531
return ( Type_Triple );
1533
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeTriple&>(*this)); }
1536
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
1537
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1539
CqParseNodeTriple * pNew = new CqParseNodeTriple( *this );
1540
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1541
pNew->m_pParent = pParent;
1549
///----------------------------------------------------------------------
1550
/// CqParseNodeHexTuple
1551
/// Parsenode specifying a matrix as 16 float values.
1553
class CqParseNodeHexTuple : public CqParseNode, public IqParseNodeSixteenTuple
1556
CqParseNodeHexTuple( const CqParseNodeHexTuple& from ) :
1559
CqParseNodeHexTuple() :
1562
virtual ~CqParseNodeHexTuple()
1565
// Overridden from IqParseNode
1569
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1571
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeSixteenTuple>( this, type ) ) != 0 ) return ( TqTrue );
1572
return ( CqParseNode::GetInterface( type, pNode ) );
1574
virtual TqInt NodeType() const
1576
return ( IqParseNodeSixteenTuple::m_ID );
1578
virtual TqInt ResType() const
1580
return ( Type_HexTuple );
1582
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeSixteenTuple&>(*this)); }
1585
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
1586
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1588
CqParseNodeHexTuple * pNew = new CqParseNodeHexTuple( *this );
1589
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1590
pNew->m_pParent = pParent;
1598
///----------------------------------------------------------------------
1599
/// CqParseNodeCommFunction
1600
/// Parsenode specifying a special comm function.
1602
class CqParseNodeCommFunction : public CqParseNode, public IqParseNodeMessagePassingFunction
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 )
1611
CqParseNodeCommFunction( TqInt Type, CqString vrExtra, SqVarRef vrVariable ) :
1613
m_vrVariable( vrVariable ),
1614
m_vrExtra( vrExtra ),
1617
CqParseNodeCommFunction( TqInt Type, SqVarRef vrVariable ) :
1619
m_vrVariable( vrVariable ),
1624
virtual ~CqParseNodeCommFunction()
1627
// Overridden from IqParseNodeMessagePassingFunction
1631
virtual SqVarRef VarRef() const
1633
return ( m_vrVariable );
1635
virtual CqString Extra() const
1637
return ( m_vrExtra );
1639
virtual TqInt CommType() const
1641
return ( m_commType );
1643
// Overridden from IqParseNode
1644
virtual TqBool GetInterface( EqParseNodeType type, void** pNode ) const
1646
if ( ( *pNode = ( void* ) QueryNodeType<IqParseNodeMessagePassingFunction>( this, type ) ) != 0 ) return ( TqTrue );
1647
return ( CqParseNode::GetInterface( type, pNode ) );
1649
virtual TqInt NodeType() const
1651
return ( IqParseNodeMessagePassingFunction::m_ID );
1653
virtual TqInt ResType() const
1655
return ( Type_Float );
1657
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(static_cast<IqParseNodeMessagePassingFunction&>(*this)); }
1660
virtual TqInt TypeCheck( TqInt* pTypes, TqInt Count = 1, TqBool CheckOnly = TqFalse );
1661
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1663
CqParseNodeCommFunction * pNew = new CqParseNodeCommFunction( *this );
1664
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1665
pNew->m_pParent = pParent;
1670
SqVarRef m_vrVariable;
1676
///----------------------------------------------------------------------
1677
/// CqParseDeclaration
1678
/// Parsenode specifying a variable declaration.
1680
class CqParseNodeDeclaration : public CqParseNode
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 )
1689
CqParseNodeDeclaration( const char* strName = "", TqInt Type = Type_Nil ) :
1691
m_strName( strName ),
1695
m_fVarying = ( m_Type & Type_Varying ) != 0;
1697
virtual ~CqParseNodeDeclaration()
1699
const char* strName()
1701
return ( m_strName.c_str() );
1707
void SetType( TqInt Type )
1711
TqBool Output() const
1713
return ( m_Output );
1715
void SetOutput( TqBool Output )
1719
virtual void Accept( IqParseNodeVisitor &V) { V.Visit(*this); }
1723
virtual CqParseNode* Clone( CqParseNode* pParent = 0 )
1725
CqParseNodeDeclaration * pNew = new CqParseNodeDeclaration( *this );
1726
if ( m_pChild ) pNew->m_pChild = m_pChild->Clone( pNew );
1727
pNew->m_pParent = pParent;
1737
//-----------------------------------------------------------------------
1739
END_NAMESPACE( Aqsis )
1741
#endif // !PARSENODE_H_INCLUDED