diff --git a/example/inv_fizzbuzz/main.cpp b/example/inv_fizzbuzz/main.cpp index 990c4ef9..c5882924 100644 --- a/example/inv_fizzbuzz/main.cpp +++ b/example/inv_fizzbuzz/main.cpp @@ -14,7 +14,7 @@ #include #include -static constexpr auto token_table = sprout::to_string_array >( +static constexpr auto token_table = sprout::make_array >( "Fizz", "Buzz", "Fizz", "Fizz", "Buzz", "Fizz", "FizzBuzz", "Fizz", "Buzz", "Fizz", "Fizz", "Buzz", "Fizz" ); @@ -65,7 +65,7 @@ void print(ForwardRange const& input, Pair const& answer) { int main() { { - constexpr auto input = sprout::to_string_array >( + constexpr auto input = sprout::make_array >( "Fizz", "FizzBuzz", "Fizz", "Buzz" ); constexpr auto answer = inv_fizzbuzz(input); @@ -74,7 +74,7 @@ int main() { print(input, answer); } { - constexpr auto input = sprout::to_string_array >( + constexpr auto input = sprout::make_array >( "FizzBuzz", "Fizz", "Buzz", "Fizz", "Fizz", "Buzz", "Fizz", "FizzBuzz", "Fizz", "Buzz", "Fizz", "Fizz", "Buzz", "Fizz", "FizzBuzz", "Fizz", "Buzz" @@ -85,7 +85,7 @@ int main() { print(input, answer); } { - constexpr auto input = sprout::to_string_array >( + constexpr auto input = sprout::make_array >( "Fizz", "FizzBuzz", "Buzz" ); constexpr auto answer = inv_fizzbuzz(input); diff --git a/tools/darkroom/darkcult.cpp b/tools/darkroom/darkcult.cpp index c92cec26..20e69afd 100644 --- a/tools/darkroom/darkcult.cpp +++ b/tools/darkroom/darkcult.cpp @@ -47,6 +47,15 @@ # define DARKROOM_OFFSET_Y 0 #endif +// +// DARKROOM_RUNTIME/DARKROOM_VARIABLE +// +#ifndef DARKROOM_RUNTIME +# define DARKROOM_VARIABLE SPROUT_STATIC_CONSTEXPR +#else +# define DARKROOM_VARIABLE +#endif + #include #include #include @@ -64,7 +73,7 @@ int main() { using namespace sprout::darkroom; typedef pixels::color_pixels::type image_type; - SPROUT_STATIC_CONSTEXPR auto image = pixels::generate( + DARKROOM_VARIABLE auto image = pixels::generate( darkcult::raytracer, darkcult::renderer, darkcult::camera, darkcult::object, darkcult::light, darkcult::offset_x, darkcult::offset_y, diff --git a/tools/darkroom/darkcult.sh b/tools/darkroom/darkcult.sh index 4191b5ff..8a392de9 100755 --- a/tools/darkroom/darkcult.sh +++ b/tools/darkroom/darkcult.sh @@ -28,11 +28,12 @@ declare -a include_paths=() max_procs= force=0 continuable=0 +runtime=0 use_help=0 darkcult_cpp=$(cd $(dirname $0); pwd)/darkcult.cpp darkcult_py=$(cd $(dirname $0); pwd)/darkcult.py -args=`getopt -o s:S:o:C:w:h:W:H:l:t:r:b:O:D:I:P:fc -l source:,stagedir:,output:,compiler:,width:,height:,tile-width:,tile-height:,left:,top:,right:,bottom:,option:,define:,include:,max-procs:,force,continuable,help -- "$@"` +args=`getopt -o s:S:o:C:w:h:W:H:l:t:r:b:O:D:I:P:fc -l source:,stagedir:,output:,compiler:,width:,height:,tile-width:,tile-height:,left:,top:,right:,bottom:,option:,define:,include:,max-procs:,force,continuable,runtime,help -- "$@"` if [ "$?" -ne 0 ]; then echo >&2 "error: options parse error. See 'darkcult.sh --help'" exit 1 @@ -58,6 +59,7 @@ while [ -n "$1" ]; do -P|--max-procs) max_procs=$2; shift 2;; -f|--force) force=1; shift;; -c|--continuable) continuable=1; shift;; + --runtime) runtime=1; shift;; --help) use_help=1; shift;; --) shift; break;; *) echo >&2 "error: unknown option($1) used."; exit 1;; @@ -121,6 +123,8 @@ if [ ${use_help} -ne 0 ]; then echo " Press ; check finished." echo " Press 'q' ; terminate compile." echo "" + echo " --runtime Enable runtime mode." + echo "" echo " --help This message." exit 0 fi @@ -143,6 +147,7 @@ echo " include-paths = (${include_paths[*]})" echo " max-procs = ${max_procs}" echo " force = ${force}" echo " continuable = ${continuable}" +echo " runtime = ${runtime}" if [ ! -f "${src}" -a ! -f "$(cd $(dirname $0); pwd)/${src}" ]; then echo >&2 "error: source(${src}) not exists." @@ -156,6 +161,9 @@ for include_path in ${include_paths}; do include_options="${include_options} -I${include_path}" done compile_options="-std=c++11 ${define_options} ${include_options} ${common_options[*]}" +if [ ${runtime} -ne 0 ]; then + compile_options="${compile_options} -DDARKROOM_RUNTIME" +fi if [ -d "${stagedir}" ]; then if [ ${force} -eq 0 ]; then