summaryrefslogtreecommitdiffstats
path: root/research/research2.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-23 14:03:45 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-23 14:03:45 (EST)
commit695252738cb9d28feef590588a53f2de183e6def (patch)
tree572941b2b9405a73ceb146a5371ee17078c3d38f /research/research2.sh
parent23c04846378d7861a1afa6edeaa94f6d151bbb53 (diff)
downloadeggshell-695252738cb9d28feef590588a53f2de183e6def.zip
eggshell-695252738cb9d28feef590588a53f2de183e6def.tar.gz
eggshell-695252738cb9d28feef590588a53f2de183e6def.tar.bz2
...Now you don't
Diffstat (limited to 'research/research2.sh')
-rw-r--r--research/research2.sh111
1 files changed, 0 insertions, 111 deletions
diff --git a/research/research2.sh b/research/research2.sh
deleted file mode 100644
index 9908495..0000000
--- a/research/research2.sh
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/sh
-
-################################################################################
-# shld
-################################################################################
-__last_tu=''
-
-static()
-{
- local arg=
- local var=
- local val=
- local exp=
-
- for arg in "${@}"; do
- case "${arg}" in
- *=*)
- var="${arg%%=*}"
- val="$(printf "${arg#*=}" | \
- sed "s|'|'\\\\''|g")"
- ;;
- *)
- var="${arg}"
- val=''
- ;;
- esac
- # Sanitize variable name.
- case "${var}" in
- [!A-Za-z_]* | *[!0-9A-Za-z_]*)
- printf 'Syntax error: %s %s\n' \
- 'illegal static variable name:' \
- "${var}" >&2
- ;;
- esac
- # Set up static variable assignments to be evaluated on scope
- # change.
- exp="__${__tu}_static_var_vals="
- exp="${exp}\"\${__${__tu}_static_var_vals} ${var}='${val}'\""
- eval "${exp}"
- # Set up list of static variables to be cleaned up on scope
- # change.
- exp="__${__tu}_static_vars=\"\${__${__tu}_static_vars} ${var}\""
- eval "${exp}"
- # Set up static variables for current scope.
- eval "${var}='${val}'"
- done
-
- # Clean up static variables from previous scope.
- if ! [ "x${__last_tu}" = 'x' ]; then
- eval "unset \${__${__last_tu}_static_vars}"
- fi
- __last_tu="${__tu}"
-}
-
-__set_up_static_vars()
-{
- local tu="${1}"
-
- # Clean up static variables from previous scope.
- if ! [ "x${__last_tu}" = 'x' ]; then
- eval "unset \${__${__last_tu}_static_vars}"
- fi
- __last_tu="${tu}"
-
- # Set up static variables for specified scope.
- eval "$(eval printf '%s' "\"$(eval printf '%s' \
- "'\${__${tu}_static_var_vals}'")\"")"
-}
-
-################################################################################
-# TU 0
-################################################################################
-__tu='tu0'
-__tu0_locals=''
-
-static static_var0='tu0 static_var0'
-
-tu0_fn0()
-{ __set_up_static_vars 'tu0'
- echo "tu0"
- echo "\tstatic_var0: $static_var0"
- echo "\tstatic_var1: $static_var1"
-}
-
-################################################################################
-# TU 1
-################################################################################
-__tu='tu1'
-__tu1_locals=''
-
-static static_var0='tu1 static_var0'
-static static_var1='tu1 static_var1'
-
-tu1_fn0()
-{ __set_up_static_vars 'tu1'
- echo "tu1"
- echo "\tstatic_var0: $static_var0"
- echo "\tstatic_var1: $static_var1"
-}
-
-################################################################################
-# TU 2
-################################################################################
-main()
-{
- tu0_fn0
- tu1_fn0
- tu0_fn0
-}
-
-main "${@}"