ACT Library
|
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) |
UserMacro * | Expand (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 |
InstType * | getPortType (int i) const |
void | setBody (struct act_chp_lang *) |
struct act_chp_lang * | substitute (ActId *instnm, act_inline_table *tab) |
Private Attributes | |
const char * | _nm |
name of the macro | |
UserDef * | parent |
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_lang * | c |
body | |
Used to hold a user-defined macro. These macros provide more convenient methods to interface with processes and data types.
UserMacro::UserMacro | ( | UserDef * | u, |
const char * | name | ||
) |
Create a new user-defined macro associated with a user-defined type.
u | is the user-defined type that holds the macro |
name | is the name of the macro |
UserMacro::~UserMacro | ( | ) |
int UserMacro::addPort | ( | InstType * | it, |
const char * | name | ||
) |
Add a port to the macro
it | is the type of the macro port |
name | is the name of the port |
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
|
inline |
|
inline |
|
inline |
Returns the name of a port for this macro
i | is the port number |
|
inline |
Returns the type of a port for this macro
i | is the port number |
void UserMacro::Print | ( | FILE * | fp | ) |
void UserMacro::setBody | ( | struct act_chp_lang * | ) |
Sets the body of the macro to be the specified value
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
instnm | is the name of the instance |
tab | is the binding table |
|
private |
name of the macro
|
private |
body
|
private |
number of ports
|
private |
user-defined type with this macro
|
private |
port names
|
private |
port types