function splitarray: splightly more abstract version that accomodates older bashes;
authorwenzelm
Sat Aug 22 17:08:06 2009 +0200 (2009-08-22)
changeset 32390468eff174a77
parent 32389 cb3c5189ea85
child 32391 5b9d7e578756
function splitarray: splightly more abstract version that accomodates older bashes;
bin/isabelle
bin/isabelle-process
lib/Tools/doc
lib/Tools/document
lib/Tools/findlogics
lib/Tools/makeall
lib/scripts/getsettings
     1.1 --- a/bin/isabelle	Fri Aug 21 19:06:12 2009 +0200
     1.2 +++ b/bin/isabelle	Sat Aug 22 17:08:06 2009 +0200
     1.3 @@ -17,7 +17,7 @@
     1.4  ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
     1.5  source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
     1.6  
     1.7 -ORIG_IFS="$IFS"; IFS=":"; declare -a TOOLS=($ISABELLE_TOOLS); IFS="$ORIG_IFS"
     1.8 +splitarray ":" "$ISABELLE_TOOLS"; TOOLS=("${SPLITARRAY[@]}")
     1.9  
    1.10  
    1.11  ## diagnostics
     2.1 --- a/bin/isabelle-process	Fri Aug 21 19:06:12 2009 +0200
     2.2 +++ b/bin/isabelle-process	Sat Aug 22 17:08:06 2009 +0200
     2.3 @@ -160,7 +160,7 @@
     2.4      INFILE=""
     2.5      ISA_PATH=""
     2.6  
     2.7 -    ORIG_IFS="$IFS"; IFS=":"; declare -a PATHS=($ISABELLE_PATH); IFS="$ORIG_IFS"
     2.8 +    splitarray ":" "$ISABELLE_PATH"; PATHS=("${SPLITARRAY[@]}")
     2.9      for DIR in "${PATHS[@]}"
    2.10      do
    2.11        DIR="$DIR/$ML_IDENTIFIER"
     3.1 --- a/lib/Tools/doc	Fri Aug 21 19:06:12 2009 +0200
     3.2 +++ b/lib/Tools/doc	Sat Aug 22 17:08:06 2009 +0200
     3.3 @@ -34,7 +34,7 @@
     3.4  
     3.5  ## main
     3.6  
     3.7 -ORIG_IFS="$IFS"; IFS=":"; declare -a DOCS=($ISABELLE_DOCS); IFS="$ORIG_IFS"
     3.8 +splitarray ":" "$ISABELLE_DOCS"; DOCS=("${SPLITARRAY[@]}")
     3.9  
    3.10  if [ -z "$DOC" ]; then
    3.11    for DIR in "${DOCS[@]}"
     4.1 --- a/lib/Tools/document	Fri Aug 21 19:06:12 2009 +0200
     4.2 +++ b/lib/Tools/document	Sat Aug 22 17:08:06 2009 +0200
     4.3 @@ -53,7 +53,7 @@
     4.4        OUTFORMAT="$OPTARG"
     4.5        ;;
     4.6      t)
     4.7 -      ORIG_IFS="$IFS"; IFS=","; TAGS=($OPTARG); IFS="$ORIG_IFS"
     4.8 +      splitarray "," "$OPTARG"; TAGS=("${SPLITARRAY[@]}")
     4.9        ;;
    4.10      \?)
    4.11        usage
     5.1 --- a/lib/Tools/findlogics	Fri Aug 21 19:06:12 2009 +0200
     5.2 +++ b/lib/Tools/findlogics	Sat Aug 22 17:08:06 2009 +0200
     5.3 @@ -25,7 +25,7 @@
     5.4  declare -a LOGICS=()
     5.5  declare -a ISABELLE_PATHS=()
     5.6  
     5.7 -ORIG_IFS="$IFS"; IFS=":"; ISABELLE_PATHS=($ISABELLE_PATH); IFS=$ORIG_IFS
     5.8 +splitarray ":" "$ISABELLE_PATH"; ISABELLE_PATHS=("${SPLITARRAY[@]}")
     5.9  
    5.10  for DIR in "${ISABELLE_PATHS[@]}"
    5.11  do
     6.1 --- a/lib/Tools/makeall	Fri Aug 21 19:06:12 2009 +0200
     6.2 +++ b/lib/Tools/makeall	Sat Aug 22 17:08:06 2009 +0200
     6.3 @@ -34,7 +34,7 @@
     6.4  echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))"
     6.5  . "$ISABELLE_HOME/lib/scripts/timestart.bash"
     6.6  
     6.7 -ORIG_IFS="$IFS"; IFS=":"; declare -a COMPONENTS=($ISABELLE_COMPONENTS); IFS="$ORIG_IFS"
     6.8 +splitarray ":" "$ISABELLE_COMPONENTS"; COMPONENTS=("${SPLITARRAY[@]}")
     6.9  
    6.10  for DIR in "${COMPONENTS[@]}"
    6.11  do
     7.1 --- a/lib/scripts/getsettings	Fri Aug 21 19:06:12 2009 +0200
     7.2 +++ b/lib/scripts/getsettings	Sat Aug 22 17:08:06 2009 +0200
     7.3 @@ -68,6 +68,17 @@
     7.4    done
     7.5  }
     7.6  
     7.7 +#arrays
     7.8 +function splitarray ()
     7.9 +{
    7.10 +  SPLITARRAY=()
    7.11 +  local IFS="$1"; shift
    7.12 +  for X in $*
    7.13 +  do
    7.14 +    SPLITARRAY["${#SPLITARRAY[@]}"]="$X"
    7.15 +  done
    7.16 +}
    7.17 +
    7.18  #nested components
    7.19  ISABELLE_COMPONENTS=""
    7.20  function init_component ()