vrq
cport.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (C) 1997-2007, Mark Hummel
3  * This file is part of Vrq.
4  *
5  * Vrq is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * Vrq is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301 USA
19  *****************************************************************************
20  */
21 /******************************************************************************
22  *
23  *
24  * cport.hpp
25  * - class definition of port
26  * definition nodes
27  *
28  ******************************************************************************
29  */
30 
31 #ifndef CPORT_HPP
32 #define CPORT_HPP
33 
34 #include <stdio.h>
35 #include "glue.h"
36 #include "cdecl.h"
37 
38 
39 class CNode;
40 
44 class CPort : public CDecl
45 {
46 private:
47  CNode* connection;
48  int dotted;
49  Decl_t direction;
50  bool wildcard;
51 public:
58  CPort( CSymbol* symbol, int dotted, Coord_t* aLoc );
64  virtual CDecl* Clone( CObstack* heap );
69  virtual void Dump( FILE* f );
74  CNode* GetConnection( void );
79  void SetConnection( CNode* decl );
84  bool GetWildcard( void ) { return wildcard; }
89  void SetWildcard( bool v ) { wildcard = v; }
94  int IsDotted( void ){ return dotted; };
99  void Direction( Decl_t d ) { direction = d; }
104  Decl_t Direction() { return direction; }
109  void PreVisit1( int (*func)(CNode*,void*), void* data );
110  void PostVisit1( void (*func)(CNode*, void*), void* data );
111  void PostSubVisit1( CNode* (*func)(CNode*, void*), void* data );
112 protected:
116  virtual INT32 GetWidth( void ) { MASSERT( FALSE ); }
117  virtual CNode* GetWidthExp( void ) { MASSERT( FALSE ); }
121  void Copy( CObstack* heap, const CPort& port );
122 private:
123  /*
124  * Disable copy constructor.
125  */
126  CPort( const CPort& port );
130 };
131 
132 #endif // CPORT_HPP
Decl_t
Declaration types.
Definition: cdecl.h:74
virtual void PreVisit1(int(*func)(CNode *, void *), void *data)
void Direction(Decl_t d)
Set port direction.
Definition: cport.h:99
long INT32
Short cut for signed 32 bit integer.
Definition: glue.h:38
virtual CNode * GetWidthExp(void) const
Get expression representing width of declaration.
Definition: cdecl.h:274
CPort(CSymbol *symbol, int dotted, Coord_t *aLoc)
Create port.
Structure to hold file coordinates.
Definition: cdecl.h:47
Holder for character strings.
Definition: csymbol.h:44
void Copy(CObstack *heap, const CDecl &o)
Perform deep copy of given object to this one This should never be call directly, only by subclasses...
Declaration object for module/function/task ports.
Definition: cport.h:44
int IsDotted(void)
Get dotted attribute.
Definition: cport.h:94
Bulk object allocation object.
Definition: cobstack.h:46
bool GetWildcard(void)
Get wildcard flag.
Definition: cport.h:84
Primary data structure representing parse tree nodes.
Definition: cnode.h:197
void SetConnection(CNode *decl)
Set connection expression for port.
Decl_t Direction()
Get port direction.
Definition: cport.h:104
virtual void PostSubVisit1(CNode *(*func)(CNode *, void *), void *data)
virtual void Dump(FILE *f)
Dump port info to file descriptor.
Base class for describing declaration objects.
Definition: cdecl.h:164
void SetWildcard(bool v)
Set wildcard flag.
Definition: cport.h:89
virtual void PostVisit1(void(*func)(CNode *, void *), void *data)
CNode * GetConnection(void)
Get connection expression for port.
virtual INT32 GetWidth(void) const
Evaluate packed width of declaration.
Definition: cdecl.h:263
virtual CDecl * Clone(CObstack *heap)
Create a clone of this declaration.