File: AST.h

package info (click to toggle)
nescc 1.3.5-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 11,604 kB
  • sloc: ansic: 72,471; sh: 4,474; yacc: 2,171; perl: 2,109; java: 1,699; makefile: 1,535; lisp: 693; xml: 182; lex: 95; cpp: 28
file content (96 lines) | stat: -rw-r--r-- 2,841 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* This file is part of the nesC compiler.

This file is derived from the RC Compiler. It is thus
   Copyright (C) 2000-2001 The Regents of the University of California.
Changes for nesC are
   Copyright (C) 2002 Intel Corporation

The attached "nesC" software is provided to you under the terms and
conditions of the GNU General Public License Version 2 as published by the
Free Software Foundation.

nesC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with nesC; see the file COPYING.  If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */

#ifndef AST_H
#define AST_H

typedef int id_declaration_list;
typedef struct typelist *typelist;
typedef struct type *type;
typedef struct known_cst *known_cst;
typedef struct ivalue *ivalue;
typedef struct edge *edge;

#ifdef NODEREFINT
typedef unsigned short noderef;
#else
struct node;
typedef struct AST_node *noderef;
#endif

#include "sd_list.h"
#include "dd_list.h"
#include "graph.h"
#include "dhash.h"

#include "c-lex.h"
#include "nesc-ndoc.h"
#include "AST_types.h"
#include "AST_list_node.h"
#include "decls.h"
#include "env.h"
#include "types.h"
#include "cval.h"
#include "utils.h"

enum { struct_type, union_type, enum_type };

typedef enum { command_call, event_signal, post_task, normal_call } nesc_call_kind;

typedef enum {
  ATOMIC_ANY,    /* atomic come what may */
  ATOMIC_SINGLE, /* atomic as long as the only such operation */
  NOT_ATOMIC
} atomic_t;

#include "AST_defs.h"

#define CAST AST_CAST
#define CASTPTR AST_CASTPTR
#define CASTSRPTR AST_CASTSRPTR

unary newkind_unary(region r, AST_kind kind, location location, expression arg1);
binary newkind_binary(region r, AST_kind kind, location location,
		      expression arg1, expression arg2);
tag_ref newkind_tag_ref(region r, AST_kind kind, location location, word word1, attribute attributes, declaration fields, bool defined);
void insert_before(node sameregion *list, node before, node n);

void AST_set_parents(node n);
void set_parent(node sameregion *nptr, node parent);
void set_parent_list(node sameregion *list, node parent);

node AST_clone(region r, node n);

void AST_print(node n);

#define AST_SET(parent, ptr, value) \
  (*(ptr) = (value), (value) ? (set_parent(CASTSRPTR(node, (ptr)), CAST(node, (parent))), 0) : 0)

#define AST_SET_FIELD(parent, field, value) \
  AST_SET((parent), &(parent)->field, (value))

#define AST_SET_NEXT(previous, value) \
  AST_SET((previous)->parent, &(previous)->next, (value))

#define AST_REPLACE(n, value) \
  AST_SET((n)->parent_ptr, (n)->parent, (value))

#endif