24#ifndef __ACT_TYPES_H__
25#define __ACT_TYPES_H__
32#include <common/mstring.h>
65 int isEqual (
const Type *t)
const {
return t ==
this ? 1 : 0; }
80 int isEqual (
const Type *t)
const {
return t ==
this ? 1 : 0; }
601 Assert (0,
"Don't call this ever");
989#define ACT_NUM_STD_METHODS 8
992#define ACT_NUM_EXPR_METHODS 2
1118 for (listitem_t *li = list_first (
enum_vals); li; li = list_next (li)) {
1119 if (strcmp ((
const char *)list_value (li), s) == 0) {
1298 Assert (
parent,
"what?");
1305 Assert (p,
"What?");
1315struct act_inline_table;
1509 void *
operator new (size_t);
1510 void operator delete (
void *);
2020#define ACT_EXPR_EXFLAG_ISLVAL 0x1
2023#define ACT_EXPR_EXFLAG_PARTIAL 0x2
2027#define ACT_EXPR_EXFLAG_CHPEX 0x4
2030#define ACT_EXPR_EXFLAG_DUPONLY 0x8
2056#define expr_dup(e) expr_expand ((e), NULL, NULL, ACT_EXPR_EXFLAG_DUPONLY)
This class is used to hold the contents of the body of any user-defined type or namespace....
Definition: body.h:52
This class is used to store Act identifiers that correspond to instances. Identifiers have an optiona...
Definition: act_id.h:56
The ActNamespace class holds all the information about a namespace.
Definition: namespaces.h:469
Used to represent the built-in ACT bool datatype.
Definition: types.h:182
int isEqual(const Type *t) const
Definition: types.h:191
const char * getName()
Definition: types.h:186
Type * Expand(ActNamespace *, Scope *, int, inst_param *)
Definition: types.h:188
Used to represent the built-in ACT Paramterized chan(foo) type or chan(foo,foo) bi-directional/exchan...
Definition: types.h:237
InstType * ack
second data type for exchange channel
Definition: types.h:263
Chan * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *u)
InstType * p
data type for expanded channel
Definition: types.h:262
int isEqual(const Type *t) const
InstType * acktype() const
Definition: types.h:274
int isBiDirectional()
Definition: types.h:279
const char * name
the string name for the type
Definition: types.h:261
InstType * datatype() const
Definition: types.h:269
User-defined channel type. Channels can be unidirectional or bi-directional (sometimes called exchang...
Definition: types.h:1215
void copyMethods(Channel *c)
Expr * emethods[ACT_NUM_EXPR_METHODS]
emethods table
Definition: types.h:1311
struct act_chp_lang * methods[ACT_NUM_STD_METHODS]
methods table
Definition: types.h:1310
void setMethod(int t, act_chp_lang *h)
Definition: types.h:1223
act_chp_lang * getMethod(int t)
Definition: types.h:1236
Expr * geteMethod(int t)
Definition: types.h:1242
void setMethod(int t, Expr *e)
Definition: types.h:1231
int isBiDirectional()
Definition: types.h:1297
int chanDir(ActId *id, int isinput)
Channel * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *u)
A user-defined data types.
Definition: types.h:1062
int enumVal(const char *s) const
Definition: types.h:1115
int getStructOffset(ActId *field, int *sz)
Data * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *u)
struct act_chp_lang * methods[ACT_NUM_STD_METHODS]
Definition: types.h:1199
void copyMethods(Data *d)
int numEnums() const
Definition: types.h:1102
unsigned int is_eint
1 if this enum can be treated as an int
Definition: types.h:1197
void _get_struct_count(int *nbools, int *nints)
void addEnum(const char *s)
Definition: types.h:1092
list_t * enum_vals
Definition: types.h:1204
int isEnum() const
Definition: types.h:1080
unsigned int is_enum
Definition: types.h:1195
int isEqual(const Type *t) const
equality test
int isPureEnum() const
Definition: types.h:1086
void getStructCount(int *nbools, int *nints)
struct act_chp_lang * getMethod(int t)
Definition: types.h:1138
ActId ** getStructFields(int **types)
void setMethod(int t, struct act_chp_lang *h)
Definition: types.h:1132
void MkEnum(int is_int)
Definition: types.h:1075
void _get_struct_fields(ActId **a, int *types, int *pos, ActId *prefix)
This holds information about ACT functions. ACT functions are of two types:
Definition: types.h:912
InstType * ret_type
holds return type
Definition: types.h:981
int isSimpleInline()
Definition: types.h:973
Expr ** toInline(int nargs, Expr **args)
int is_simple_inline
holds the simple inline flag
Definition: types.h:982
void _chk_inline(struct act_chp_lang *c)
used to check simple inline
void setRetType(InstType *i)
Definition: types.h:921
void _chk_inline(Expr *e)
used to check simple inline
InstType * getRetType()
Definition: types.h:926
Function * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *u)
Expr * eval(ActNamespace *ns, int nargs, Expr **args)
An instance type.
Definition: inst.h:92
Type * BaseType() const
Definition: inst.h:181
Used to represent the built-in ACT int< > datatype. This is also used to represent enumerations.
Definition: types.h:201
int w
Definition: types.h:223
Int * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *u)
unsigned int kind
0 = unsigned, 1 = signed, 2 = enum
Definition: types.h:222
const char * name
string name for the type (for printing)
Definition: types.h:226
int isEqual(const Type *t) const
Holds the interface definition. Looks like a process. Body is empty.
Definition: types.h:734
Interface * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *u)
Used for Boolean parameters.
Definition: types.h:89
Type * Expand(ActNamespace *, Scope *, int, inst_param *)
Definition: types.h:98
int isEqual(const Type *t) const
Definition: types.h:105
const char * getName()
Definition: types.h:93
Integer parameter type.
Definition: types.h:49
const char * getName()
Definition: types.h:53
Type * Expand(ActNamespace *, Scope *, int, inst_param *)
Definition: types.h:58
int isEqual(const Type *t) const
Definition: types.h:65
Unused. Originally pint and pints were supposed to be unsigned and signed integers....
Definition: types.h:75
const char * getName()
destructor
Definition: types.h:76
int isEqual(const Type *t) const
Definition: types.h:80
Type * Expand(ActNamespace *, Scope *, int, inst_param *)
Definition: types.h:77
Used for real parameters.
Definition: types.h:114
const char * getName()
Definition: types.h:118
Type * Expand(ActNamespace *, Scope *, int, inst_param *)
Definition: types.h:123
int isEqual(const Type *t) const
Definition: types.h:130
Used for ptype( ) parameters. ptype parameters take an interface type as a template parameter.
Definition: types.h:139
InstType * i
Definition: types.h:168
PType()
Definition: types.h:157
const char * name
Definition: types.h:171
int isEqual(const Type *t) const
Definition: types.h:160
PType * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *u)
InstType * getType()
Definition: types.h:165
User-defined processes.
Definition: types.h:750
int hasIface(InstType *x, int weak)
void MkCell()
Definition: types.h:762
void addIface(InstType *iface, list_t *imap)
const char * addBuffer(Process *buf, list_t *inst_ports)
bool updateInst(char *name, Process *t)
int findGlobal(const char *s)
const char * addBuffer(char *name, ActId *port, Process *buf)
Process * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *u)
unsigned int is_cell
1 if this is a defcell, 0 otherwise
Definition: types.h:875
list_t * ifaces
Definition: types.h:876
void recordGlobal(ActId *id)
int bufcnt
Definition: types.h:883
int isCell()
Definition: types.h:767
list_t * used_globals
Definition: types.h:880
int findGlobal(ActId *id)
list_t * findMap(InstType *iface)
Process * getUnexpanded()
This is the data structure that holds all instances and their associated types within a scope....
Definition: namespaces.h:77
InstType * Lookup(const char *s)
This is the class used to create all instance types. It also caches types to reduce memory usage.
Definition: types.h:1415
static struct cHashtable * chanhash
Definition: types.h:1495
static int isBoolType(const InstType *it)
static int isValidChannelDataType(const InstType *t)
InstType * NewPType(Scope *s, InstType *t)
InstType * NewPInts()
Definition: types.h:1520
static int isInterfaceType(const Type *t)
Chan * NewChan(InstType *l, InstType *ack)
static void chanfreefn(void *)
static int intmatchfn(void *, void *)
static InstType * getChanAckType(const InstType *t)
static int isInterfaceType(const InstType *it)
static int isPTypeType(const Type *t)
InstType * NewBool(Type::direction dir)
static InstType * pint
Definition: types.h:1424
static int isBoolType(const Type *t)
static int isValidChannelDataType(const Type *t)
static int isUserPureEnum(const Type *t)
static int isExactChanType(const InstType *it)
static TypeFactory * Factory()
Definition: types.h:1614
static int boolType(const InstType *t)
static struct cHashtable * enumhash
Definition: types.h:1475
static Expr * expr_true
Definition: types.h:1452
static int isBaseIntType(const Type *t)
static int isPIntsType(const Type *t)
static int chanmatchfn(void *, void *)
static int isParamType(const InstType *it)
static int isProcessType(const Type *t)
static int enumNum(const Type *t)
static InstType * pbool
Definition: types.h:1442
InstType * NewInt(Scope *s, Type::direction dir, int sig, Expr *w)
static int isBaseBoolType(const InstType *t)
static int isIntType(const Type *t)
static struct cHashtable * inthash
Definition: types.h:1469
static int isDataType(const Type *t)
static InstType * bools[5]
Definition: types.h:1447
static int isPBoolType(const InstType *it)
static int bitWidthTwo(const Type *t)
static int isDataType(const InstType *t)
static void intfreefn(void *)
static int isEnum(const InstType *t)
static int isProcessType(const InstType *it)
static Expr * NewExpr(Expr *e)
static void * chandupfn(void *)
Int * NewInt(int sig, int w)
static int bitWidthTwo(const InstType *t)
static int isBaseIntType(const InstType *t)
InstType * NewChan(Scope *s, Type::direction dir, InstType *l, InstType *ack)
static struct iHashtable * expr_int
Definition: types.h:1463
static int isPIntType(const Type *t)
static InstType * pints
Definition: types.h:1430
static int isUserType(const Type *t)
static struct cHashtable * ptypehash
Definition: types.h:1480
static int isPIntsType(const InstType *t)
static InstType * getChanDataType(const InstType *t)
static int isParamType(const Type *t)
static TypeFactory * tf
Definition: types.h:1417
static void * intdupfn(void *)
InstType * NewPInt()
Definition: types.h:1515
static int isPIntType(const InstType *t)
static InstType * preal
Definition: types.h:1436
static int inthashfn(int, void *)
static int bitWidth(const InstType *t)
static int isUserEnum(const InstType *it)
InstType * NewPBool()
Definition: types.h:1525
static int boolType(const Type *t)
InstType * NewUserDef(Scope *s, InstType *it)
static int isPRealType(const InstType *it)
static int isPRealType(const Type *t)
static int isBaseBoolType(const Type *t)
static int isIntType(const InstType *t)
InstType * NewPReal()
Definition: types.h:1530
static int isChanType(const InstType *it)
static int isEnum(const Type *t)
static int isChanType(const Type *t)
static int bitWidth(const Type *t)
InstType * NewEnum(Scope *s, Type::direction dir, Expr *w)
static int enumNum(const InstType *t)
static Expr * expr_false
Definition: types.h:1457
static int isStructure(const Type *t)
static int isStructure(const InstType *it)
static int isUserEnum(const Type *t)
static int isUserType(const InstType *it)
PType * NewPType(InstType *t)
static int isFuncType(const Type *t)
static int isExactChanType(const Type *t)
static int isPBoolType(const Type *t)
static int chanhashfn(int, void *)
static int isPTypeType(const InstType *it)
static int isFuncType(const InstType *it)
static int isUserPureEnum(const InstType *it)
The abstract base class for all types in the system.
Definition: basetype.h:45
direction
Definition: basetype.h:87
UserDef stores information that is common to all user-defined types. User-defined types are more comp...
Definition: types.h:310
Scope * I
instances
Definition: types.h:697
int isDefined()
Definition: types.h:499
int isPort(const char *name)
void AppendBody(ActBody *x)
void PrintHeader(FILE *fp, const char *type)
void setName(const char *s)
Definition: types.h:464
InstType * Lookup(ActId *id)
Definition: types.h:541
int isEqual(const Type *t) const
UserMacro * newMacro(const char *name)
int getNumParams() const
Definition: types.h:517
int nports
number of ports
Definition: types.h:693
void SetParent(InstType *t)
int inherited_templ
number of inherited template parameters
Definition: types.h:712
InstType * parent
implementation relationship, if any
Definition: types.h:678
UserDef * Expand(ActNamespace *, Scope *, int, inst_param *)
Definition: types.h:600
int getNumPorts() const
Definition: types.h:532
act_languages * getlang()
Definition: types.h:645
ActBody * b
body of user-defined type
Definition: types.h:701
const char ** port_n
port names
Definition: types.h:695
int getRemainingParams() const
Definition: types.h:527
int isStrictPort(const char *name)
void printActName(FILE *fp)
UserDef * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *u, int *cache_hit, int is_process=0)
ActNamespace * _ns
namespace within which this type is defined
Definition: types.h:702
unsigned int defined
1 if this has been defined, 0 otherwise
Definition: types.h:680
UserDef(ActNamespace *ns)
inst_param ** inherited_param
the inherited parameters
Definition: types.h:713
InstType ** pt
parameter types
Definition: types.h:690
void refinePortType(int pos, InstType *u)
act_languages * lang
sub-languages within this type
Definition: types.h:687
ActBody * getBody()
Definition: types.h:595
virtual void Print(FILE *)
Definition: types.h:568
virtual ~UserDef()
destructor, releases storage
int hasRefinement()
Definition: types.h:661
InstType * getParent() const
Definition: types.h:491
void setFile(const char *s)
Definition: types.h:336
unsigned int expanded
1 if this has been expanded, 0 otherwise
Definition: types.h:681
void setLine(int num)
Definition: types.h:347
int AddPort(InstType *t, const char *id)
void MkDefined()
Definition: types.h:504
int FindPort(const char *id)
int AddMetaParam(InstType *t, const char *id)
int level
default modeling level for the type
Definition: types.h:706
int isExpanded() const
Definition: types.h:364
InstType * getPortType(int pos) const
const char * getPortName(int pos) const
int lineno
line number (if known) where this was defined
Definition: types.h:709
int nt
number of template parameters
Definition: types.h:689
const char ** pn
parameter names
Definition: types.h:691
unsigned int exported
1 if the type is exported, 0 otherwise
Definition: types.h:685
int IsExported()
Definition: types.h:354
void MkExported()
Definition: types.h:359
A_DECL(UserMacro *, um)
user-defined macros
ActNamespace * getns()
Definition: types.h:621
Scope * CurScope()
Definition: types.h:555
int isEqual(const UserDef *u) const
const char * name
Name of the user-defined type.
Definition: types.h:699
const char * file
file name (if known) where this was defined
Definition: types.h:708
int getLine()
Definition: types.h:341
void mkRefined()
Definition: types.h:656
const char * getFile()
Definition: types.h:330
unsigned int pending
1 if this is currently being expanded, 0 otherwise
Definition: types.h:683
InstType ** port_t
port types
Definition: types.h:694
UserMacro * getMacro(const char *name)
UserDef * unexpanded
unexpanded type, if any
Definition: types.h:704
int has_refinement
1 if there is a refinement body
Definition: types.h:710
void setBody(ActBody *x)
Definition: types.h:584
InstType * Lookup(const char *nm)
Definition: types.h:550
Used to hold a user-defined macro. These macros provide more convenient methods to interface with pro...
Definition: types.h:1324
int getNumPorts() const
Definition: types.h:1360
int nports
number of ports
Definition: types.h:1395
const char ** port_n
port names
Definition: types.h:1397
UserMacro(UserDef *u, const char *name)
const char * getName()
Definition: types.h:1355
InstType * getPortType(int i) const
Definition: types.h:1374
const char * _nm
name of the macro
Definition: types.h:1392
UserDef * parent
user-defined type with this macro
Definition: types.h:1393
InstType ** port_t
port types
Definition: types.h:1396
struct act_chp_lang * substitute(ActId *instnm, act_inline_table *tab)
int addPort(InstType *it, const char *name)
const char * getPortName(int i) const
Definition: types.h:1367
UserMacro * Expand(UserDef *ux, ActNamespace *ns, Scope *s, int is_proc)
struct act_chp_lang * c
body
Definition: types.h:1399
void setBody(struct act_chp_lang *)
This holds all the sub-langugae bodies in a namespace/user-defined type definition.
Definition: lang.h:641
This contains the definition of InstType, the core data structure used to hold the type of any instan...
This contains the defintions of the ActNamespace class as well as the Scope classes....
Attribute list associated with an instance.
Definition: lang.h:44
Data structure for the chp sub-language body.
Definition: lang.h:286
Holds a CHP sub-language.
Definition: lang.h:367
Structure that holds all the prs { } blocks in a particular scope. This is a linked-list of blocks,...
Definition: lang.h:194
The specification sub-language.
Definition: lang.h:397
This holds a single template parameter. A template parameter is either an array expression,...
Definition: inst.h:52
Typechecking identifiers and expression.
void act_error_setline(int line)
set the current line number
#define ACT_NUM_STD_METHODS
Definition: types.h:989
const char * act_error_top()
void act_error_push(const char *s, const char *file, int line)
int _act_chp_is_synth_flag
void print_uexpr(FILE *fp, const Expr *e)
int expr_equal(const Expr *a, const Expr *b)
void sprint_expr(char *buf, int sz, const Expr *e)
void act_error_update(const char *file, int line)
void act_error_ctxt(FILE *)
void print_expr(FILE *fp, const Expr *e)
#define ACT_NUM_EXPR_METHODS
Definition: types.h:992
Expr * expr_expand(Expr *e, ActNamespace *ns, Scope *s, unsigned int flag=0x2)
Expr * expr_dup_const(Expr *e)
const char * expr_op_name(int)
int expr_is_a_const(Expr *e)
const int act_builtin_method_boolret[ACT_NUM_EXPR_METHODS]
struct ExtLibs * act_read_extern_table(const char *prefix)
const char * act_builtin_method_name[ACT_NUM_STD_METHODS]
void * act_find_dl_func(struct ExtLibs *el, ActNamespace *ns, const char *f)
const char * act_builtin_method_expr[ACT_NUM_EXPR_METHODS]
void expr_ex_free(Expr *)
datatype_methods
Definition: types.h:1018
@ ACT_METHOD_SET
Definition: types.h:1019
@ ACT_METHOD_RECV_INIT
Definition: types.h:1040
@ ACT_METHOD_RECV_REST
Definition: types.h:1028
@ ACT_METHOD_RECV_PROBE
Definition: types.h:1047
@ ACT_METHOD_SEND_UP
Definition: types.h:1031
@ ACT_METHOD_SEND_INIT
Definition: types.h:1037
@ ACT_METHOD_SEND_PROBE
Definition: types.h:1043
@ ACT_METHOD_RECV_UP
Definition: types.h:1034
@ ACT_METHOD_SEND_REST
Definition: types.h:1025
@ ACT_METHOD_GET
Definition: types.h:1022
void sprint_uexpr(char *buf, int sz, const Expr *e)