ACT Library
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions | Variables
types.h File Reference
#include <act/basetype.h>
#include <act/namespaces.h>
#include <act/act_array.h>
#include <act/expr.h>
#include <act/expr_extra.h>
#include <common/mstring.h>
#include <act/inst.h>
#include <string.h>
#include <act/typecheck.h>

Go to the source code of this file.

Classes

class  PInt
 Integer parameter type. More...
 
class  PInts
 Unused. Originally pint and pints were supposed to be unsigned and signed integers. Now pint is a signed integer. More...
 
class  PBool
 Used for Boolean parameters. More...
 
class  PReal
 Used for real parameters. More...
 
class  PType
 Used for ptype( ) parameters. ptype parameters take an interface type as a template parameter. More...
 
class  Bool
 Used to represent the built-in ACT bool datatype. More...
 
class  Int
 Used to represent the built-in ACT int< > datatype. This is also used to represent enumerations. More...
 
class  Chan
 Used to represent the built-in ACT Paramterized chan(foo) type or chan(foo,foo) bi-directional/exchange channel. More...
 
class  UserDef
 UserDef stores information that is common to all user-defined types. User-defined types are more complex, because they can have definitions and template parameters. To handle this complexity and to reduce storage requirements, the "shared" part of a user-defined type is factored out into this class. That way the body of a channel x1of2 is shared with x1of2? and x1of2!, as well as an array of x1of2 (for example). More...
 
class  Interface
 Holds the interface definition. Looks like a process. Body is empty. More...
 
class  Process
 User-defined processes. More...
 
class  Function
 This holds information about ACT functions. ACT functions are of two types: More...
 
class  Data
 A user-defined data types. More...
 
class  Channel
 User-defined channel type. Channels can be unidirectional or bi-directional (sometimes called exchange channels). More...
 
class  UserMacro
 Used to hold a user-defined macro. These macros provide more convenient methods to interface with processes and data types. More...
 
class  TypeFactory
 This is the class used to create all instance types. It also caches types to reduce memory usage. More...
 

Macros

#define ACT_NUM_STD_METHODS   8
 
#define ACT_NUM_EXPR_METHODS   2
 
#define ACT_EXPR_EXFLAG_ISLVAL   0x1
 
#define ACT_EXPR_EXFLAG_PARTIAL   0x2
 
#define ACT_EXPR_EXFLAG_CHPEX   0x4
 
#define ACT_EXPR_EXFLAG_DUPONLY   0x8
 this just duplicates the expression
 
#define expr_dup(e)   expr_expand ((e), NULL, NULL, ACT_EXPR_EXFLAG_DUPONLY)
 

Enumerations

enum  datatype_methods {
  ACT_METHOD_SET = 0 , ACT_METHOD_GET = 1 , ACT_METHOD_SEND_REST = 2 , ACT_METHOD_RECV_REST = 3 ,
  ACT_METHOD_SEND_UP = 4 , ACT_METHOD_RECV_UP = 5 , ACT_METHOD_SEND_INIT = 6 , ACT_METHOD_RECV_INIT = 7 ,
  ACT_METHOD_SEND_PROBE = 0 + ACT_NUM_STD_METHODS , ACT_METHOD_RECV_PROBE = 1 + ACT_NUM_STD_METHODS
}
 

Functions

int expr_equal (const Expr *a, const Expr *b)
 
void print_expr (FILE *fp, const Expr *e)
 
void sprint_expr (char *buf, int sz, const Expr *e)
 
void print_uexpr (FILE *fp, const Expr *e)
 
void sprint_uexpr (char *buf, int sz, const Expr *e)
 
int expr_is_a_const (Expr *e)
 
Exprexpr_dup_const (Expr *e)
 
const char * expr_op_name (int)
 
Exprexpr_expand (Expr *e, ActNamespace *ns, Scope *s, unsigned int flag=0x2)
 
void expr_ex_free (Expr *)
 
void * act_find_dl_func (struct ExtLibs *el, ActNamespace *ns, const char *f)
 
struct ExtLibs * act_read_extern_table (const char *prefix)
 
void act_error_push (const char *s, const char *file, int line)
 
void act_error_update (const char *file, int line)
 
void act_error_pop ()
 
void act_error_ctxt (FILE *)
 
const char * act_error_top ()
 
void act_error_setline (int line)
 set the current line number
 

Variables

const char * act_builtin_method_name [ACT_NUM_STD_METHODS]
 
const char * act_builtin_method_expr [ACT_NUM_EXPR_METHODS]
 
const int act_builtin_method_boolret [ACT_NUM_EXPR_METHODS]
 
int _act_chp_is_synth_flag
 

Macro Definition Documentation

◆ ACT_EXPR_EXFLAG_CHPEX

#define ACT_EXPR_EXFLAG_CHPEX   0x4

if set, this uses CHP expansion mode

◆ ACT_EXPR_EXFLAG_DUPONLY

#define ACT_EXPR_EXFLAG_DUPONLY   0x8

this just duplicates the expression

◆ ACT_EXPR_EXFLAG_ISLVAL

#define ACT_EXPR_EXFLAG_ISLVAL   0x1

if set, this expression must be an lvalue (i.e. a variable)

◆ ACT_EXPR_EXFLAG_PARTIAL

#define ACT_EXPR_EXFLAG_PARTIAL   0x2

if set, partial constant propagation during expansion is used

◆ ACT_NUM_EXPR_METHODS

#define ACT_NUM_EXPR_METHODS   2

number of "expression" methods that can be specified

◆ ACT_NUM_STD_METHODS

#define ACT_NUM_STD_METHODS   8

number of standard methods for data/channel types

◆ expr_dup

#define expr_dup (   e)    expr_expand ((e), NULL, NULL, ACT_EXPR_EXFLAG_DUPONLY)

A macro that just calls expr_expand() with the right flags.

Enumeration Type Documentation

◆ datatype_methods

This is used as an index into a methods table for channel and user-defined types.

Enumerator
ACT_METHOD_SET 

the set method used for channel and data types

ACT_METHOD_GET 

the get method used for channel and data types

ACT_METHOD_SEND_REST 

the reset part of the sender handshake, if any

ACT_METHOD_RECV_REST 

the reset part of the receive handshake, if any

ACT_METHOD_SEND_UP 

the second part of the first half of the send handshake, if any

ACT_METHOD_RECV_UP 

the second part of the first half of the receive handshake, if any

ACT_METHOD_SEND_INIT 

on Reset, the initialization for the sender end of the channel

ACT_METHOD_RECV_INIT 

on Reset, the initialization for the receiver end of the channel

ACT_METHOD_SEND_PROBE 

expression method for sender probe

ACT_METHOD_RECV_PROBE 

expression method for recver probe

Function Documentation

◆ act_error_ctxt()

void act_error_ctxt ( FILE *  )

print the error context to the output stream

◆ act_error_pop()

void act_error_pop ( )

pop the error context

◆ act_error_push()

void act_error_push ( const char *  s,
const char *  file,
int  line 
)

Push expansion error context

Parameters
sis the context (process name, instance name, etc)
fileis the file name
lineis the line number

◆ act_error_setline()

void act_error_setline ( int  line)

set the current line number

◆ act_error_top()

const char * act_error_top ( )

return the message for the top-level error

◆ act_error_update()

void act_error_update ( const char *  file,
int  line 
)

Update the file name and line number for the top-level error context. If the file pointer is NULL, then the previous one is preserved.

Parameters
fileis the updated file name
lineis the updated line number

◆ act_find_dl_func()

void * act_find_dl_func ( struct ExtLibs *  el,
ActNamespace ns,
const char *  f 
)

Given an external library sturcture, look up the function within the specified namespace in the external library

Parameters
elis the external library structure
nsis the namespace in which the function exists
fis the name of the function
Returns
the function pointer, if found, and NULL otherwise

◆ act_read_extern_table()

struct ExtLibs * act_read_extern_table ( const char *  prefix)

Query the ACT configuration to see if an external function table exists given the configuration prefix string

Parameters
prefixis the configuration prefix string
Returns
the list of external libraries available according to the configuration file

◆ expr_dup_const()

Expr * expr_dup_const ( Expr e)

Duplicate an expression that is a constant. Some constant expressions are cached by the TypeFactory. If that is the case, then this simply returns the same pointer. Otherwise, it actually allocates new memory and returns a duplicate of the constant expression.

Parameters
ethe constant expression to be duplicated
Returns
the duplicated expression (may or may not be a deep copy)

◆ expr_equal()

int expr_equal ( const Expr a,
const Expr b 
)

Check if two expressions are equal. This is a structural test.

Parameters
ais the first expression
bis the second expression
Returns
1 if they are equal, 0 otherwise

◆ expr_ex_free()

void expr_ex_free ( Expr )

Free an expanded expression

◆ expr_expand()

Expr * expr_expand ( Expr e,
ActNamespace ns,
Scope s,
unsigned int  flag = 0x2 
)

Used to expand an expression. The flags are used to specify how the expansion is performed. A duplicate expression is returned that corresponds to the expanded expression. Parameter constants are substituted, and for CHP/dataflow expressions, a BigInt is attached to each constant value with the appropriate bit-width.

Parameters
eis the expression to be expanded
nsis the namespace
sis the evaluation scope
flagis the ACT_EXPR_EXFLAG_... flag
Returns
the expanded expression

◆ expr_is_a_const()

int expr_is_a_const ( Expr e)

Check if the expression is a simple constant leaf expression

Parameters
eis the expression to be checked
Returns
1 if it is a constant, 0 otherwise

◆ expr_op_name()

const char * expr_op_name ( int  )

This translates the E_... options into the string corresponding to the expression operator

Returns
a string constant for the expression operator

◆ print_expr()

void print_expr ( FILE *  fp,
const Expr e 
)

Print an expression to a file. This is used to print parameter expressions (e.g. in the core ACT language), and not chp/dataflow expressions.

Parameters
fpis the output file
eis the expression

◆ print_uexpr()

void print_uexpr ( FILE *  fp,
const Expr e 
)

Print an expression to a file. This is used to print unsigned expressions from chp/dataflow expressions.

Parameters
fpis the output file
eis the expression

◆ sprint_expr()

void sprint_expr ( char *  buf,
int  sz,
const Expr e 
)

Print an expression to a string buffer. This is used to print parameter expressions (e.g. in the core ACT language), and not chp/dataflow expressions.

Parameters
bufis the output buffer
szis the size of the output buffer
eis the expression

◆ sprint_uexpr()

void sprint_uexpr ( char *  buf,
int  sz,
const Expr e 
)

Print an expression to an output buffer. This is used to print unsigned expressions from chp/dataflow expressions.

Parameters
bufis the output buffer
szis the size of the output buffer
eis the expression

Variable Documentation

◆ _act_chp_is_synth_flag

int _act_chp_is_synth_flag
extern

this flag is set as a side-effect of expression expansion. Set to 0 if the expression calls a non-synthesizable function.

◆ act_builtin_method_boolret

const int act_builtin_method_boolret[ACT_NUM_EXPR_METHODS]
extern

For each built-in method that returns an expression, this is 1 if the expression return type is Boolean, 0 otherwise.

◆ act_builtin_method_expr

const char* act_builtin_method_expr[ACT_NUM_EXPR_METHODS]
extern

A pre-defined array that holds all the method names corresponding to methods that return an expression

◆ act_builtin_method_name

const char* act_builtin_method_name[ACT_NUM_STD_METHODS]
extern

A pre-defined array that holds all the method names supported for channel and data types.