ACT Library
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
UserMacro Class Reference

Used to hold a user-defined macro. These macros provide more convenient methods to interface with processes and data types. More...

#include <types.h>

Public Member Functions

 UserMacro (UserDef *u, const char *name)
 
 ~UserMacro ()
 
void Print (FILE *fp)
 
UserMacroExpand (UserDef *ux, ActNamespace *ns, Scope *s, int is_proc)
 
int addPort (InstType *it, const char *name)
 
const char * getName ()
 
int getNumPorts () const
 
const char * getPortName (int i) const
 
InstTypegetPortType (int i) const
 
void setBody (struct act_chp_lang *)
 
struct act_chp_langsubstitute (ActId *instnm, act_inline_table *tab)
 

Private Attributes

const char * _nm
 name of the macro
 
UserDefparent
 user-defined type with this macro
 
int nports
 number of ports
 
InstType ** port_t
 port types
 
const char ** port_n
 port names
 
struct act_chp_langc
 body
 

Detailed Description

Used to hold a user-defined macro. These macros provide more convenient methods to interface with processes and data types.

Constructor & Destructor Documentation

◆ UserMacro()

UserMacro::UserMacro ( UserDef u,
const char *  name 
)

Create a new user-defined macro associated with a user-defined type.

Parameters
uis the user-defined type that holds the macro
nameis the name of the macro

◆ ~UserMacro()

UserMacro::~UserMacro ( )

Member Function Documentation

◆ addPort()

int UserMacro::addPort ( InstType it,
const char *  name 
)

Add a port to the macro

Parameters
itis the type of the macro port
nameis the name of the port

◆ Expand()

UserMacro * UserMacro::Expand ( UserDef ux,
ActNamespace ns,
Scope s,
int  is_proc 
)

Expand a user-defined macro. The is_proc flag is used because process user-macros and data type user-macros are slightly different: a process macro inherits direction flags for the environment of the process rather than the process itself

◆ getName()

const char * UserMacro::getName ( )
inline
Returns
the name of the macro

◆ getNumPorts()

int UserMacro::getNumPorts ( ) const
inline
Returns
the number of ports for the macro

◆ getPortName()

const char * UserMacro::getPortName ( int  i) const
inline

Returns the name of a port for this macro

Parameters
iis the port number
Returns
the name of the specified port

◆ getPortType()

InstType * UserMacro::getPortType ( int  i) const
inline

Returns the type of a port for this macro

Parameters
iis the port number
Returns
the type of the specified port

◆ Print()

void UserMacro::Print ( FILE *  fp)

◆ setBody()

void UserMacro::setBody ( struct act_chp_lang )

Sets the body of the macro to be the specified value

◆ substitute()

struct act_chp_lang * UserMacro::substitute ( ActId instnm,
act_inline_table *  tab 
)

Given an instance name and bindings for all the macro ports in the act_inline_table, return the CHP body fragment that is the result of the macro expansion

Parameters
instnmis the name of the instance
tabis the binding table
Returns
the chp body fragment that results from the substitution.

Member Data Documentation

◆ _nm

const char* UserMacro::_nm
private

name of the macro

◆ c

struct act_chp_lang* UserMacro::c
private

body

◆ nports

int UserMacro::nports
private

number of ports

◆ parent

UserDef* UserMacro::parent
private

user-defined type with this macro

◆ port_n

const char** UserMacro::port_n
private

port names

◆ port_t

InstType** UserMacro::port_t
private

port types


The documentation for this class was generated from the following file: