diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-07-07 10:57:56 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-07-07 10:57:56 -0700 |
commit | ebe2bda37b74bc73550a051895b1831f8c2441ca (patch) | |
tree | 00e214e4ef8b2167e00f8d7066225ce03ed87117 | |
parent | 37b3206e49572cf245ef7ee13d5bd24845f6a2e8 (diff) | |
download | mu-ebe2bda37b74bc73550a051895b1831f8c2441ca.tar.gz |
4321
Modify helpers to run either external examples in the subx/teensy/ directory, or my own examples in subx/ directory. Now I have to say `run test5` instead of `run 5`, and so on.
-rwxr-xr-x | subx/g | 11 | ||||
-rwxr-xr-x | subx/gen | 20 | ||||
-rwxr-xr-x | subx/gg | 11 | ||||
-rwxr-xr-x | subx/nrun | 11 | ||||
-rwxr-xr-x | subx/run | 9 |
5 files changed, 46 insertions, 16 deletions
diff --git a/subx/g b/subx/g index dc57cceb..25da2232 100755 --- a/subx/g +++ b/subx/g @@ -3,12 +3,17 @@ if [ $# -eq 0 ] then - echo "g <git command> <args> <suffix>" + echo "g <git command> <args> <target>" exit 1 fi arg=( $* ) -suffix=$arg[${#arg[@]}] +target=$arg[${#arg[@]}] unset "arg[${#arg[@]}]" -git ${arg[@]} ./teensy/test$suffix*.[cs] +if [[ $target == 'test'* ]] +then + git ${arg[@]} ./teensy/$target*.[cs] +else + git ${arg[@]} ./$target*.subx +fi diff --git a/subx/gen b/subx/gen index d8465bc0..e551fa3f 100755 --- a/subx/gen +++ b/subx/gen @@ -1,43 +1,49 @@ #!/usr/bin/env zsh # Build a specific example. -if [ $1 -eq 1 ] +if [[ $1 == 'ex'* ]] +then + CFLAGS=-g subx translate $1.subx `echo $1 |sed 's/\..*//'` + exit $? +fi + +if [ $1 = test1 ] then gcc -Wall -s teensy/test1.c -o teensy/test1 exit $? fi -if [ $1 -eq 2 ] +if [ $1 = test2 ] then nasm -f elf teensy/test2.s && gcc -Wall -s teensy/test2.o -o teensy/test2 exit $? fi -if [ $1 -eq 3 ] +if [ $1 = test3 ] then nasm -f elf teensy/test3.s && gcc -Wall -s -nostartfiles teensy/test3.o -o teensy/test3 exit $? fi -if [ $1 -eq 4 ] +if [ $1 = test4 ] then nasm -f elf teensy/test4.s && gcc -Wall -s -nostdlib teensy/test4.o -o teensy/test4 exit $? fi -if [ $1 -eq 5 ] +if [ $1 = test5 ] then nasm -f bin teensy/test5.s -o teensy/test5 && chmod +x teensy/test5 exit $? fi -if [ $1 -eq 6 ] +if [ $1 = test6 ] then nasm -f elf teensy/test6-global.s && gcc -Wall -s teensy/test6-global.o -o teensy/test6 exit $? fi -if [ $1 -eq 7 ] +if [ $1 = test7 ] then nasm -f bin teensy/test7-global.s -o teensy/test7 && chmod +x teensy/test7 exit $? diff --git a/subx/gg b/subx/gg index 03b356f3..b733a58d 100755 --- a/subx/gg +++ b/subx/gg @@ -3,12 +3,17 @@ if [ $# -eq 0 ] then - echo "g <git command> <args> <suffix>" + echo "g <git command> <args> <target>" exit 1 fi arg=( $* ) -suffix=$arg[${#arg[@]}] +target=$arg[${#arg[@]}] unset "arg[${#arg[@]}]" -git ${arg[@]} ./teensy/test$suffix +if [[ $target == 'test'* ]] +then + git ${arg[@]} ./teensy/$target +else + git ${arg[@]} ./$target +fi diff --git a/subx/nrun b/subx/nrun index f5c22dee..01658574 100755 --- a/subx/nrun +++ b/subx/nrun @@ -3,8 +3,15 @@ if [ $# -eq 0 ] then - echo "nrun <suffix>" + echo "nrun <binary>" exit 1 fi -./teensy/test$1 +if [[ $1 == 'test'* ]] +then + ./teensy/$1 + exit $? +fi + +./$1 +exit $? diff --git a/subx/run b/subx/run index bc55c720..332d5786 100755 --- a/subx/run +++ b/subx/run @@ -7,4 +7,11 @@ then exit 1 fi -CFLAGS=-g subx run teensy/test$1 +if [[ $1 == 'test'* ]] +then + CFLAGS=-g subx run teensy/$1 + exit $? +fi + +CFLAGS=-g subx run $1 +exit $? |