1/*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6==============================================================================*/
7#ifndef BOOST_PHOENIX_CORE_LIMITS_HPP
8#define BOOST_PHOENIX_CORE_LIMITS_HPP
9
10#include <boost/config.hpp>
11#include <boost/detail/workaround.hpp>
12#include <boost/preprocessor/arithmetic/add.hpp>
13#include <boost/preprocessor/inc.hpp>
14#include <boost/preprocessor/dec.hpp>
15#include <boost/preprocessor/stringize.hpp>
16#include <boost/phoenix/version.hpp>
17#include <boost/phoenix/support/preprocessor/round.hpp>
18
19
20#if defined(BOOST_PHOENIX_LIMIT)
21# if !defined( BOOST_PROTO_MAX_ARITY )
22# define BOOST_PROTO_MAX_ARITY BOOST_PHOENIX_LIMIT
23# elif (BOOST_PROTO_MAX_ARITY < BOOST_PHOENIX_LIMIT)
24# error "BOOST_PROTO_MAX_ARITY is set too low"
25# endif
26#include <boost/proto/proto_fwd.hpp>
27#else
28#include <boost/proto/proto_fwd.hpp>
29#define BOOST_PHOENIX_LIMIT BOOST_PROTO_MAX_ARITY
30#endif
31
32#if !defined(PHOENIX_LIMIT)
33#define PHOENIX_LIMIT BOOST_PHOENIX_LIMIT
34#endif
35
36#define BOOST_PHOENIX_LIMIT_STR BOOST_PP_STRINGIZE(BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT))
37
38#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
39# define BOOST_PHOENIX_NO_VARIADIC_ACTOR
40# define BOOST_PHOENIX_NO_VARIADIC_CALL
41# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EQUAL
42# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
43# define BOOST_PHOENIX_NO_VARIADIC_EXPRESSION
44# define BOOST_PHOENIX_NO_VARIADIC_BIND
45# define BOOST_PHOENIX_NO_VARIADIC_SCOPE
46#endif
47#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
48# define BOOST_PHOENIX_NO_VARIADIC_ACTOR
49# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
50#endif
51
52#if BOOST_WORKAROUND(BOOST_MSVC, == 1800)
53// FIXME: temporary disable on MSVC 2013.
54# define BOOST_PHOENIX_NO_VARIADIC_SCOPE
55#endif
56
57#ifdef BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
58// FIXME: Due to proto, some compilers cannot expand parameter pack.
59# define BOOST_PHOENIX_NO_VARIADIC_ACTOR
60# define BOOST_PHOENIX_NO_VARIADIC_CALL
61# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
62# define BOOST_PHOENIX_NO_VARIADIC_EXPRESSION
63# define BOOST_PHOENIX_NO_VARIADIC_BIND
64# define BOOST_PHOENIX_NO_VARIADIC_SCOPE
65#endif
66
67# define BOOST_PHOENIX_NO_VARIADIC_OBJECT
68# define BOOST_PHOENIX_NO_VARIADIC_OPERATOR
69# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION
70
71#if !defined(BOOST_PHOENIX_ARG_LIMIT)
72# define BOOST_PHOENIX_ARG_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
73#elif (BOOST_PHOENIX_ARG_LIMIT < 5)
74# error "BOOST_PHOENIX_ARG_LIMIT is set too low"
75#elif BOOST_PHOENIX_ARG_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
76# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
77#endif
78
79#if !defined(BOOST_PHOENIX_ACTOR_LIMIT)
80# define BOOST_PHOENIX_ACTOR_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
81#elif (BOOST_PHOENIX_ACTOR_LIMIT > BOOST_PHOENIX_ARG_LIMIT)
82# error "BOOST_PHOENIX_ACTOR_LIMIT > BOOST_PHOENIX_ARG_LIMIT"
83#elif (BOOST_PHOENIX_ACTOR_LIMIT < 3)
84# error "BOOST_PHOENIX_ACTOR_LIMIT is set too low"
85#elif BOOST_PHOENIX_ACTOR_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
86# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
87#endif
88
89#if !defined(BOOST_PHOENIX_PERFECT_FORWARD_LIMIT)
90# define BOOST_PHOENIX_PERFECT_FORWARD_LIMIT 3
91#elif (BOOST_PHOENIX_PERFECT_FORWARD_LIMIT > BOOST_PHOENIX_ACTOR_LIMIT)
92# error "BOOST_PHOENIX_PERFECT_FORWARD_LIMIT > BOOST_PHOENIX_ACTOR_LIMIT"
93#elif (BOOST_PHOENIX_PERFECT_FORWARD_LIMIT < 3)
94# error "BOOST_PHOENIX_PERFECT_FORWARD_LIMIT is set too low"
95#elif BOOST_PHOENIX_PERFECT_FORWARD_LIMIT != 3 && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
96# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
97#endif
98
99#if !defined(BOOST_PHOENIX_COMPOSITE_LIMIT)
100# define BOOST_PHOENIX_COMPOSITE_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
101#elif (BOOST_PHOENIX_COMPOSITE_LIMIT < 5)
102# error "BOOST_PHOENIX_COMPOSITE_LIMIT is set too low"
103#elif BOOST_PHOENIX_COMPOSITE_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
104# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
105#endif
106
107#if !defined(BOOST_PHOENIX_MEMBER_LIMIT)
108# define BOOST_PHOENIX_MEMBER_LIMIT BOOST_PP_DEC(BOOST_PHOENIX_COMPOSITE_LIMIT)
109#elif (BOOST_PHOENIX_MEMBER_LIMIT > BOOST_PHOENIX_COMPOSITE_LIMIT)
110# error "BOOST_PHOENIX_MEMBER_LIMIT > BOOST_PHOENIX_COMPOSITE_LIMIT"
111#elif (BOOST_PHOENIX_MEMBER_LIMIT < 3)
112# error "BOOST_PHOENIX_MEMBER_LIMIT is set too low"
113#elif BOOST_PHOENIX_MEMBER_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
114# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
115#endif
116
117#if !defined(BOOST_PHOENIX_CATCH_LIMIT)
118# define BOOST_PHOENIX_CATCH_LIMIT BOOST_PHOENIX_COMPOSITE_LIMIT
119#elif (BOOST_PHOENIX_CATCH_LIMIT < 1)
120# error "BOOST_PHOENIX_CATCH_LIMIT is set too low"
121#elif BOOST_PHOENIX_CATCH_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
122# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
123#endif
124
125#if !defined(BOOST_PHOENIX_DYNAMIC_LIMIT)
126# define BOOST_PHOENIX_DYNAMIC_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
127#elif (BOOST_PHOENIX_DYNAMIC_LIMIT < 1)
128# error "BOOST_PHOENIX_DYNAMIC_LIMIT is set too low"
129#elif BOOST_PHOENIX_DYNAMIC_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
130# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
131#endif
132
133#if !defined(BOOST_PHOENIX_LOCAL_LIMIT)
134# define BOOST_PHOENIX_LOCAL_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
135#elif (BOOST_PHOENIX_LOCAL_LIMIT < 3)
136# error "BOOST_PHOENIX_LOCAL_LIMIT is set too low"
137#elif BOOST_PHOENIX_LOCAL_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
138# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
139#endif
140
141#endif
142