-# just saying this is an array...
-#declare -a PRIOR_TERMINAL_TITLES
-#and that whole approach fails; arrays aren't passed to subshells, so any commands
-# that execute in a subshell don't know about the contents and thus don't do what we want.
-#hmmm: revise back to single level memory.
-
-# set the stack position if not already set.
-if [ -z "$PTT_STACK_INDEX" ]; then
- # this variable records where we will push new items on the stack.
- PTT_STACK_INDEX=0
-fi
-
-# returns okay (0) if the stack is empty, or non-zero if not empty.
-function ptt_stack_empty()
-{
- if [ -z "$PTT_STACK_INDEX" ]; then
- # fix the index value.
- PTT_STACK_INDEX=0
- true
- else
- test $PTT_STACK_INDEX -le 0
- fi
-}
-
-# a debugging function that should never have been necessary.
-# a little bit furious the restore is failing during regenerate right now.
-function show_terminal_titles()
-{
- sep 14
- echo "[terminal title list now has...]"
- local i=${#PRIOR_TERMINAL_TITLES[@]}
- if ptt_stack_empty; then
- echo the terminal title list is empty.
- else
- while ((i--)); do
- echo "ent #$i: '${PRIOR_TERMINAL_TITLES[$i]}'"
- done
- fi
- sep 14
-}
-
-# adds an entry into the stack of terminal titles.
-function push_ptt_stack()
-{
- PRIOR_TERMINAL_TITLES[$PTT_STACK_INDEX]="$*"
- ((PTT_STACK_INDEX++))
-echo stack index incremented and now at $PTT_STACK_INDEX
-show_terminal_titles
-}
-
-function pop_ptt_stack()
-{
- if [ $PTT_STACK_INDEX -le 0 ]; then
- echo nothing to pop from prior terminal titles stack.
- else
- ((PTT_STACK_INDEX--))
-echo stack index decremented and now at $PTT_STACK_INDEX
- CURRENT_TERM_TITLE="${PRIOR_TERMINAL_TITLES[$PTT_STACK_INDEX]}"
-echo "got the last title as '$CURRENT_TERM_TITLE'"
-show_terminal_titles
- fi
-}