3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef SLICC_GLOBAL_H
31 #define SLICC_GLOBAL_H
33 #include <assert.h> /* slicc needs to include this in order to use classes in
34 * ../common directory.
37 #include "std-includes.hh"
40 typedef unsigned char uint8;
41 typedef unsigned int uint32;
42 typedef unsigned long long uint64;
44 typedef signed char int8;
46 typedef long long int64;
48 typedef long long integer_t;
49 typedef unsigned long long uinteger_t;
51 const bool ASSERT_FLAG = true;
53 // when CHECK_RESOURCE_DEADLOCK is enabled, slicc will generate additional code
54 // that works in conjuction with the resources rank value specified in the protocol
55 // to detect invalid resource stalls as soon as they occur.
56 const bool CHECK_INVALID_RESOURCE_STALLS = false;
59 #define assert(EXPR) ASSERT(EXPR)
65 cerr << "failed assertion '"\
66 << #EXPR << "' at fn "\
67 << __PRETTY_FUNCTION__ << " in "\
70 if(isatty(STDIN_FILENO)) {\
71 cerr << "At this point you might want to attach a debug to ";\
72 cerr << "the running and get to the" << endl;\
73 cerr << "crash site; otherwise press enter to continue" << endl;\
74 cerr << "PID: " << getpid();\
75 cerr << endl << flush; \
90 template <> struct hash<State*>
92 size_t operator()(State* s) const { return (size_t) s; }
94 template <> struct hash<Event*>
96 size_t operator()(Event* s) const { return (size_t) s; }
98 template <> struct hash<Symbol*>
100 size_t operator()(Symbol* s) const { return (size_t) s; }
102 template <> struct hash<Var*>
104 size_t operator()(Var* s) const { return (size_t) s; }
106 } // namespace __gnu_cxx
109 template <> struct equal_to<Event*>
111 bool operator()(Event* s1, Event* s2) const { return s1 == s2; }
113 template <> struct equal_to<State*>
115 bool operator()(State* s1, State* s2) const { return s1 == s2; }
117 template <> struct equal_to<Symbol*>
119 bool operator()(Symbol* s1, Symbol* s2) const { return s1 == s2; }
121 template <> struct equal_to<Var*>
123 bool operator()(Var* s1, Var* s2) const { return s1 == s2; }
127 #endif //SLICC_GLOBAL_H