File: gencstc.pm

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 (39 lines) | stat: -rw-r--r-- 1,271 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
# 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.

true;

sub gen() {
    print "/**\n";
    print " * This file is automatically generated by ncg. DO NOT EDIT THIS FILE.\n";
    print " * It includes values of some nesC constants from\n";
    print " * $cfile.\n";
    print " */\n\n";

    print "enum {\n";
    foreach $name (keys %csts) {
	$val = $csts{$name};
	# Find smallest type that will hold val to avoid annoying
	# java "loss of precision" errors
	print ",\n" if $notfirst;
	$notfirst = 1;
	$name = "${c_prefix}_$name" if $c_prefix;
	print "    $name = $val";
    }

    print "\n};\n";
}