Skip to content
Permalink
Browse files

let scripts save compilation work

  • Loading branch information...
jtolds committed Dec 2, 2011
1 parent d13c3db commit f68b08e2c2e1c24652f4da1bc7019ed705da2893
Showing with 22 additions and 7 deletions.
  1. +1 −0 .gitignore
  2. +2 −2 samples/sort.p
  3. +19 −5 tools/script_wrapper.sh
@@ -4,3 +4,4 @@ src/*.o
src/*.pyc
src/assets.h
src/assets.cpp
samples/*.pc
@@ -1,10 +1,10 @@
#!../tools/script_wrapper.sh ../src/pants

quicksort = function { |return, list|
quicksort = { |list| return = cont
if (<= list.size() 1) { return list }
left_side = []
right_side = []
list @each_with_index { |item, i|
list @each-with-index { |item, i|
{(if (< item list[0]) {left_side} {right_side}).append item} @if (> i 0)
}
result = quicksort left_side
@@ -2,8 +2,22 @@

set -e

cat $2 | $1 > /tmp/pants-$$.c
gcc -o /tmp/pants-$$ /tmp/pants-$$.c -lgc
rm -f /tmp/pants-$$.c
/tmp/pants-$$
rm -f /tmp/pants-$$
compilation_needed=false
if [ -x "${2}c" ]; then
if [ "$2" -nt "${2}c" ]; then
compilation_needed=true
fi
if [ "$1" -nt "${2}c" ]; then
compilation_needed=true
fi
else
compilation_needed=true
fi

if $compilation_needed; then
cat $2 | $1 > /tmp/pants-$$.c
gcc -o "${2}c" /tmp/pants-$$.c -lgc
rm -f /tmp/pants-$$.c
fi

${2}c

0 comments on commit f68b08e

Please sign in to comment.
You can’t perform that action at this time.