File: nesc-semantics.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 (140 lines) | stat: -rw-r--r-- 4,916 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* This file is part of the nesC compiler.
   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 NESC_SEMANTICS_H
#define NESC_SEMANTICS_H

struct environment;

#include "nesc-decls.h"

void init_internal_nesc_attributes(void);
/* Effects: Define internal nesC @-style attributes
 */

bool nesc_filename(const char *name);

const char *element_name(region r, const char *path);
/* Returns: Return the "identifier part"
     of path, i.e., remove any directory and extension
     The returned string is allocated in region r.
*/

node compile(location loc, nesc_declaration container,
	     const char *name, bool name_is_path);

nesc_declaration load(source_language sl, location l,
		      const char *name, bool name_is_path);

type get_actual_function_type(type t);
/* Returns: The actual function type for a (possibly generic) type t
     representing the type of a function/command/event
 */

function_declarator ddecl_get_fdeclarator(data_declaration fndecl);
/* Effects: Returns fndecl's function_declarator
   Requires: fndecl represent a function
*/

declaration ddecl_get_gparms(data_declaration fndecl);
/* Effects: Returns the declaration list for fndecl's generic parameters 
   Requires: fndecl represent a function
*/

bool ddecl_is_command_or_event(data_declaration decl);

bool nesc_attributep(gcc_attribute a);
/* Returns: TRUE if a is a nesc-specific attribute
 */

const char *language_name(source_language l);

nesc_decl dummy_nesc_decl(location loc, nesc_declaration ndecl);
void build(nesc_decl ast);
nesc_declaration start_nesc_entity(source_language sl, word name);

bool is_module_variable(data_declaration ddecl);
/* Returns: TRUE if ddecl is a module variable
   (this includes is_module_local_static)
 */

bool is_module_local_static(data_declaration ddecl);
/* Returns: TRUE if ddecl is a local static variable inside a module
 */

const char *make_intf_printname(const char *iname, const char *fname);
/* Returns: string "iname.fname" allocated in current.fileregion
 */

const char *decl_printname(data_declaration ddecl);
/* Returns: The printable name for ddecl 
     (interface.name for commands or events in interfaces,
      just the name otherwise)
     Any necessary memory is allocated in current.fileregion
*/

data_declaration get_function_ddecl(expression e);
/* Returns: If e denotes a specific function, return its data_declaration
     Otherwise return NULL
*/

void handle_combine_attribute(location loc, const char *combiner, type *t);
/* Effects: handle combine attribute specifying function 'combiner', 
     modifying *t as appropriate
 */

void handle_nxbase_attribute(location loc, bool be, bool allow_bf,
			     const char *fnbasename, data_declaration ddecl);
/* Effects: handle network type attribute specifying functions 
     ntoh_fnbasename and hton_fnbasename as the decoding and encoding
     functions respectively.
     If allow_bf is true, then ntohbf_fnbasename and htonbf_fnbasename
     are the bitfield decoding and encoding functions repsectively.
     If be is true, this is a big endian type (transitions between
     big and little-endian bitfields cause alignemnt to the next byte
     inside a struct).
     Modifies ddecl to reflect it's status as a base network type.
 */

declaration declare_template_parameter(declarator d, type_element elements,
				       attribute attributes);
declaration declare_type_parameter(location l, cstring id, attribute attribs,
				   dd_list extra_attr);

expression make_type_argument(asttype t);

nesc_declaration original_component(nesc_declaration c);

/* Some macros to make nesc_error easier to deal with */
#define nesc_warning (nesc_error ? error : warning)
#define nesc_warning_with_location (nesc_error ? error_with_location : warning_with_location)

data_declaration declare_function(location loc, const char *name, type signature);
/* Effects: If 'name' is already declared, check that it is a function with
     the specified signature.
     If it isn't declared, declare it as a function with the specified
     signature.
   Returns: data_declaration for the function, or NULL if an error was
     reported to the user.
*/

nesc_declaration ddecl_container(data_declaration ddecl);
nesc_declaration tdecl_container(tag_declaration tdecl);

void check_name(const char *name);

#endif