ACT Library
Loading...
Searching...
No Matches
act_id.h
Go to the documentation of this file.
1/*************************************************************************
2 *
3 * Copyright (c) 2021 Rajit Manohar
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program 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
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; 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#ifndef __ACT_ID_H__
23#define __ACT_ID_H__
24
25#include <stdio.h>
26#include <common/mstring.h>
27#include <act/expr.h>
28
29class Array;
30class Scope;
31class ActNamespace;
32class act_connection;
33class ValueIdx;
34class UserDef;
35class Process;
36
56class ActId {
57 public:
58
66 ActId (const char *s, Array *_a = NULL);
67
68 ~ActId ();
69
76 int isRange();
77
83 int isDeref() { return !!(!isRange () && (a != NULL)); }
84
91 Array *arrayInfo() { return a; }
92
101 void Append (ActId *id);
102
106 const char *getName () { return string_char (name); }
107
114 ActId *Rest () { return next; }
115
128 void Print (FILE *fp, ActId *stop = NULL, int style = 0);
129
138 void sPrint (char *buf, int sz, ActId *stop = NULL, int style = 0);
139
147
158
170
194 Expr *Eval (ActNamespace *ns, Scope *s, int is_lval = 0, int is_chp = 0);
195
204 Expr *EvalCHP (ActNamespace *ns, Scope *s, int is_lval = 0) {
205 return Eval (ns, s, is_lval, 1);
206 }
207
218
233
234
242 void setArray (Array *_a) { a = _a; }
243
247 void prune () { next = NULL; }
248
255 int isEqual (ActId *other);
256
261
266
274
283
294
302
303
312
320
325 int isNonLocal (Scope *s);
326
327 static ActId *parseId (char *s, const char delim1, const char arrayL,
328 const char arrayR, const char delim2);
329 static ActId *parseId (const char *s, const char delim1, const char arrayL,
330 const char arrayR, const char delim2);
331
332 static ActId *parseId (const char *s);
333 static ActId *parseId (char *s);
334
351
358
366
373
380
381 private:
382 mstring_t *name;
391};
392
393
394// WARNING: for internal use only.
395// When extending sparse arrays, the init flag used for connection
396// initialization only applies to the existing array blocks. Some
397// additional initialization is needed for uesr-defined types.
398// elem_num = element # to be initialized, -1 = nothing
399void _act_int_import_connections (act_connection *cx, UserDef *ux, Array *a, int elem_num);
400
401#endif /* __ACT_ID_H__ */
void _act_int_import_connections(act_connection *cx, UserDef *ux, Array *a, int elem_num)
This class is used to store Act identifiers that correspond to instances. Identifiers have an optiona...
Definition: act_id.h:56
int isEqual(ActId *other)
int isExpanded()
Expr * Eval(ActNamespace *ns, Scope *s, int is_lval=0, int is_chp=0)
ActId * Rest()
Definition: act_id.h:114
Expr * EvalCHP(ActNamespace *ns, Scope *s, int is_lval=0)
Definition: act_id.h:204
static ActId * parseId(const char *s)
Array * arrayInfo()
Definition: act_id.h:91
ActId * Clone()
ValueIdx * rootVx(Scope *)
int isNonLocal(Scope *s)
int isNamespace()
act_connection * myConnection(Scope *s)
void sPrint(char *buf, int sz, ActId *stop=NULL, int style=0)
ActId * unFragment(Scope *)
ActId * Expand(ActNamespace *ns, Scope *s)
mstring_t * name
Definition: act_id.h:382
ActNamespace * getNamespace()
UserDef * isFragmented(Scope *)
int isRange()
~ActId()
release storage
void prune()
Definition: act_id.h:247
void Append(ActId *id)
static ActId * parseId(char *s)
ActId(const char *s, Array *_a=NULL)
int validateDeref(Scope *sc)
static ActId * parseId(char *s, const char delim1, const char arrayL, const char arrayR, const char delim2)
ValueIdx * rawValueIdx(Scope *)
const char * getName()
Definition: act_id.h:106
act_connection * rootCanonical(Scope *)
Array * a
Definition: act_id.h:383
void setArray(Array *_a)
Definition: act_id.h:242
ActId * ExpandCHP(ActNamespace *ns, Scope *s)
int isDynamicDeref()
UserDef * canFragment(Scope *)
ActId * Tail()
ActId * nonProcSuffix(Process *p, Process **ret)
int isDeref()
Definition: act_id.h:83
ActId * stripArray()
static ActId * parseId(const char *s, const char delim1, const char arrayL, const char arrayR, const char delim2)
ActId * next
Definition: act_id.h:384
void Print(FILE *fp, ActId *stop=NULL, int style=0)
act_connection * Canonical(Scope *s)
The ActNamespace class holds all the information about a namespace.
Definition: namespaces.h:469
Dense arrays, sparse arrays, and array dereferences.
Definition: act_array.h:65
User-defined processes.
Definition: types.h:750
This is the data structure that holds all instances and their associated types within a scope....
Definition: namespaces.h:77
UserDef stores information that is common to all user-defined types. User-defined types are more comp...
Definition: types.h:310
This class is used to create an instance in a scope. The name comes from the fact that this is used t...
Definition: value.h:342
Connections.
Definition: value.h:113
Definition: expr.h:79