From 3e33de25ebbf4043f86a56f58459e3e45fcbe746 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Fri, 20 Sep 2013 16:38:27 +0900 Subject: [PATCH] fix bashscript --- example/darkroom/two_spheres.hpp | 2 +- testspr/test.sh | 12 ++++----- tools/darkroom/darkcult.sh | 44 ++++++++++++++++---------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/example/darkroom/two_spheres.hpp b/example/darkroom/two_spheres.hpp index 94011580..7a370ff2 100644 --- a/example/darkroom/two_spheres.hpp +++ b/example/darkroom/two_spheres.hpp @@ -18,7 +18,7 @@ namespace darkcult { // SPROUT_STATIC_CONSTEXPR auto object = sprout::make_tuple( objects::make_aa_plane( - sprout::darkroom::objects::aa_plane_direction::y, + objects::aa_plane_direction::y, -2.0, materials::make_plaid_material_image( colors::rgb_f(1.0, 0.0, 0.0), diff --git a/testspr/test.sh b/testspr/test.sh index 3488d6a6..db9b89c5 100755 --- a/testspr/test.sh +++ b/testspr/test.sh @@ -20,7 +20,7 @@ version_specific_options=( compile() { echo ": $1-$2 compile..." /usr/local/$1-$2/bin/${1/%cc}++ -Wall -pedantic -std=c++11 -o ${stagedir}/test_$1${2//.} $4 $3 - let "succ_$1${2//.} = $?" + let "succ_$1${2//.}=$?" } execute() { @@ -36,15 +36,15 @@ execute() { fi } -args=`getopt -o d:D:f -l stagedir:,gcc-version:,clang-version:,define:,force -- "$@"` +args=`getopt -o S:D:f -l stagedir:,gcc-version:,clang-version:,define:,force -- "$@"` if [ "$?" -ne 0 ]; then - echo >&2 -e ": \e[31musage: $0 [-d|--stagedir=path] [--gcc-version=versions] [--clang-version=versions] [-D|--define=identifier]* [-f|-force]\e[m" + echo >&2 -e ": \e[31musage: $0 [-S|--stagedir=path] [--gcc-version=versions] [--clang-version=versions] [-D|--define=identifier]* [-f|-force]\e[m" exit 1 fi eval set -- ${args} while [ -n "$1" ]; do case $1 in - -d|--stagedir) stagedir=$2; shift 2;; + -S|--stagedir) stagedir=$2; shift 2;; --gcc-version) gcc_version="$2"; shift 2;; --clang-version) clang_version="$2"; shift 2;; -D|--define) user_macros=(${user_macros[@]} "$2"); shift 2;; @@ -54,7 +54,7 @@ while [ -n "$1" ]; do esac done echo ": settings" -echo ": stagedir = ${stagedir}" +echo ": stagedir = \"${stagedir}\"" echo ": gcc-version = (${gcc_version})" echo ": clang-version = (${clang_version})" echo ": user-macros = (${user_macros[*]})" @@ -62,7 +62,7 @@ echo ": force = ${force}" if [ -d "${stagedir}" ]; then if [ ${force} -eq 0 ]; then - echo >&2 -e ": \e[31mstagedir(${stagedir}) is already exist.\e[m" + echo >&2 -e ": \e[31mstagedir(${stagedir}) already exists.\e[m" exit 1 else rm -f -r ${stagedir}/* diff --git a/tools/darkroom/darkcult.sh b/tools/darkroom/darkcult.sh index 41809be3..2b05dbff 100755 --- a/tools/darkroom/darkcult.sh +++ b/tools/darkroom/darkcult.sh @@ -17,16 +17,16 @@ tile_width=16 tile_height=16 force=0 -args=`getopt -o s:d:w:h:W:H:f -l source:,stagedir:,width:,height:,tile-width:,tile-height:,force -- "$@"` +args=`getopt -o s:S:w:h:W:H:f -l source:,stagedir:,width:,height:,tile-width:,tile-height:,force -- "$@"` if [ "$?" -ne 0 ]; then - echo >&2 -e ": \e[31musage: $0 -s|--source=file [-d|--stagedir=path] [-w|--width=value] [-h|--height=value] [-W|--tile-width=value] [-H|--tile-height=value] [-f|-force]\e[m" + echo >&2 -e ": \e[31musage: $0 [-s|--source=file] [-S|--stagedir=path] [-w|--width=value] [-h|--height=value] [-W|--tile-width=value] [-H|--tile-height=value] [-f|-force]\e[m" exit 1 fi eval set -- ${args} while [ -n "$1" ]; do case $1 in -s|--source) src=$2; shift 2;; - -d|--stagedir) stagedir=$2; shift 2;; + -S|--stagedir) stagedir=$2; shift 2;; -w|--width) width=$2; shift 2;; -h|--height) height=$2; shift 2;; -W|--tile-width) tile_width=$2; shift 2;; @@ -38,8 +38,8 @@ while [ -n "$1" ]; do done echo ": settings" -echo ": source = ${src}" -echo ": stagedir = ${stagedir}" +echo ": source = \"${src}\"" +echo ": stagedir = \"${stagedir}\"" echo ": width = ${width}" echo ": height = ${height}" echo ": tile-width = ${tile_width}" @@ -47,13 +47,13 @@ echo ": tile-height = ${tile_height}" echo ": force = ${force}" if [ ! -f "${src}" -a ! -f "$(cd $(dirname $0); pwd)/${src}" ]; then - echo >&2 -e ": \e[31msource(${src}) is not exist.\e[m" + echo >&2 -e ": \e[31msource(${src}) not exists.\e[m" exit 1 fi if [ -d "${stagedir}" ]; then if [ ${force} -eq 0 ]; then - echo >&2 -e ": \e[31mstagedir(${stagedir}) is already exist.\e[m" + echo >&2 -e ": \e[31mstagedir(${stagedir}) already exists.\e[m" exit 1 else rm -f -r ${stagedir}/* @@ -62,15 +62,16 @@ else mkdir -p ${stagedir} fi -echo ": rendering..." -start=$SECONDS +echo ": start." +start=${SECONDS} for ((y=0; y ${stagedir}/${y}/${x}.ppm # rm ${binname} - done; - pushd ${stagedir}/${y}/ + done + pushd ${stagedir}/${y}/ > /dev/null convert +append $(ls *.ppm | sort -n) ../${y}.ppm - popd + popd > /dev/null - let y_elapsed=$SECONDS-$y_start - echo ": elapsed(${y}) = ${y_elapsed}s" -done; -pushd ${stagedir} + let "y_elapsed=${SECONDS}-${y_start}" + echo ": elapsed = ${y_elapsed}s" +done +pushd ${stagedir} > /dev/null convert -append $(ls *.ppm | sort -n) out.ppm -popd - -let elapsed=$SECONDS-$start -echo ": elapsed = ${elapsed}s" +popd > /dev/null +let "elapsed=${SECONDS}-${start}" +echo ": elapsed(total) = ${elapsed}s" echo ": finished."