1 2print ''' 3# Generated file `python boost_contract_no.jam-gen.py > boost_contract_no.jam`. 4 5# Copyright (C) 2008-2018 Lorenzo Caminiti 6# Distributed under the Boost Software License, Version 1.0 (see accompanying 7# file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). 8# See: https://lcaminiti.github.io/boost-contract 9''' 10 11import collections 12import itertools 13 14defs = collections.OrderedDict([ 15 # Short keys (1-2 chars) as MSVC gives linker errors on long file names. 16 ('y', 'BOOST_CONTRACT_NO_ENTRY_INVARIANTS'), 17 ('r', 'BOOST_CONTRACT_NO_PRECONDITIONS'), 18 ('x', 'BOOST_CONTRACT_NO_EXIT_INVARIANTS'), 19 ('s', 'BOOST_CONTRACT_NO_POSTCONDITIONS'), 20 ('e', 'BOOST_CONTRACT_NO_EXCEPTS'), 21 ('k', 'BOOST_CONTRACT_NO_CHECKS') 22 # Add more macros here. 23]) 24separator = '' # Might want to set to '_' if keys longer than 1 char. 25 26print 'module boost_contract_no {\n' 27s = '' 28exit 29for r in range(len(defs.keys())): 30 for comb in itertools.combinations(defs.keys(), r + 1): 31 c = '' 32 d = '' 33 sep = '' 34 for cond in comb: 35 c += sep + cond 36 sep = separator 37 d += " <define>" + defs[cond] 38 s += ' ' + c 39 print 'rule defs_{0} {{ return {1} ; }}\n'.format(c, d[1:]) 40 41print '''rule combinations {{ return {0} ; }} 42 43}} # module 44 45# All combinations: {1} 46'''.format(s[1:], s.replace(" ", ",")[1:]) 47 48