about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx')
-rwxr-xr-xsubx/edit10
-rwxr-xr-xsubx/g14
-rwxr-xr-xsubx/g214
-rwxr-xr-xsubx/gen46
-rwxr-xr-xsubx/nrun10
-rwxr-xr-xsubx/run10
-rw-r--r--subx/teensy/vimrc.vim1
7 files changed, 105 insertions, 0 deletions
diff --git a/subx/edit b/subx/edit
new file mode 100755
index 00000000..39aa9d38
--- /dev/null
+++ b/subx/edit
@@ -0,0 +1,10 @@
+#!/usr/bin/env zsh
+# Open a specific example.
+
+if [ $# -eq 0 ]
+then
+  echo "edit <suffix>"
+  exit 1
+fi
+
+$EDITOR ./teensy/test$1*.[cs]
diff --git a/subx/g b/subx/g
new file mode 100755
index 00000000..dc57cceb
--- /dev/null
+++ b/subx/g
@@ -0,0 +1,14 @@
+#!/usr/bin/env zsh
+# Run git commands on a specific example's source.
+
+if [ $# -eq 0 ]
+then
+  echo "g <git command> <args> <suffix>"
+  exit 1
+fi
+
+arg=( $* )
+suffix=$arg[${#arg[@]}]
+unset "arg[${#arg[@]}]"
+
+git ${arg[@]} ./teensy/test$suffix*.[cs]
diff --git a/subx/g2 b/subx/g2
new file mode 100755
index 00000000..03b356f3
--- /dev/null
+++ b/subx/g2
@@ -0,0 +1,14 @@
+#!/usr/bin/env zsh
+# Run git commands on a specific example's generated binary.
+
+if [ $# -eq 0 ]
+then
+  echo "g <git command> <args> <suffix>"
+  exit 1
+fi
+
+arg=( $* )
+suffix=$arg[${#arg[@]}]
+unset "arg[${#arg[@]}]"
+
+git ${arg[@]} ./teensy/test$suffix
diff --git a/subx/gen b/subx/gen
new file mode 100755
index 00000000..d8465bc0
--- /dev/null
+++ b/subx/gen
@@ -0,0 +1,46 @@
+#!/usr/bin/env zsh
+# Build a specific example.
+
+if [ $1 -eq 1 ]
+then
+  gcc -Wall -s teensy/test1.c -o teensy/test1
+  exit $?
+fi
+
+if [ $1 -eq 2 ]
+then
+  nasm -f elf teensy/test2.s  &&  gcc -Wall -s teensy/test2.o -o teensy/test2
+  exit $?
+fi
+
+if [ $1 -eq 3 ]
+then
+  nasm -f elf teensy/test3.s  &&  gcc -Wall -s -nostartfiles teensy/test3.o -o teensy/test3
+  exit $?
+fi
+
+if [ $1 -eq 4 ]
+then
+  nasm -f elf teensy/test4.s  &&  gcc -Wall -s -nostdlib teensy/test4.o -o teensy/test4
+  exit $?
+fi
+
+if [ $1 -eq 5 ]
+then
+  nasm -f bin teensy/test5.s -o teensy/test5  &&  chmod +x teensy/test5
+  exit $?
+fi
+
+if [ $1 -eq 6 ]
+then
+  nasm -f elf teensy/test6-global.s  &&  gcc -Wall -s teensy/test6-global.o -o teensy/test6
+  exit $?
+fi
+
+if [ $1 -eq 7 ]
+then
+  nasm -f bin teensy/test7-global.s -o teensy/test7  &&  chmod +x teensy/test7
+  exit $?
+fi
+
+exit 127
diff --git a/subx/nrun b/subx/nrun
new file mode 100755
index 00000000..f5c22dee
--- /dev/null
+++ b/subx/nrun
@@ -0,0 +1,10 @@
+#!/usr/bin/env zsh
+# Natively run a specific example.
+
+if [ $# -eq 0 ]
+then
+  echo "nrun <suffix>"
+  exit 1
+fi
+
+./teensy/test$1
diff --git a/subx/run b/subx/run
new file mode 100755
index 00000000..bc55c720
--- /dev/null
+++ b/subx/run
@@ -0,0 +1,10 @@
+#!/usr/bin/env zsh
+# Simulate a specific example using subx.
+
+if [ $# -eq 0 ]
+then
+  echo "run <suffix>"
+  exit 1
+fi
+
+CFLAGS=-g subx run teensy/test$1
diff --git a/subx/teensy/vimrc.vim b/subx/teensy/vimrc.vim
new file mode 100644
index 00000000..68b63640
--- /dev/null
+++ b/subx/teensy/vimrc.vim
@@ -0,0 +1 @@
+command! -nargs=1 EE exec "vert split teensy/test" . <args> . "*.[cs]"