lib/scripts/getfunctions
changeset 62413 c6111df4a4f8
parent 62412 ffdc5cf36dc5
child 62414 1abd90afe387
equal deleted inserted replaced
62412:ffdc5cf36dc5 62413:c6111df4a4f8
    13 elif type splitarray >/dev/null 2>/dev/null
    13 elif type splitarray >/dev/null 2>/dev/null
    14 then
    14 then
    15   :
    15   :
    16 else
    16 else
    17 
    17 
    18 set -o allexport
       
    19 
       
    20 if [ "$OSTYPE" = cygwin ]; then
    18 if [ "$OSTYPE" = cygwin ]; then
    21   function platform_path() { cygpath -i -C UTF8 -w -p "$@"; }
    19   function platform_path() { cygpath -i -C UTF8 -w -p "$@"; }
    22 else
    20 else
    23   function platform_path() { echo "$@"; }
    21   function platform_path() { echo "$@"; }
    24 fi
    22 fi
       
    23 export -f platform_path
    25 
    24 
    26 #GNU tar (notably on Mac OS X)
    25 #GNU tar (notably on Mac OS X)
    27 if [ -x /usr/bin/gnutar ]; then
    26 if [ -x /usr/bin/gnutar ]; then
    28   function tar() { /usr/bin/gnutar "$@"; }
    27   function tar() { /usr/bin/gnutar "$@"; }
       
    28   export -f tar
    29 fi
    29 fi
    30 
    30 
    31 #main executables
    31 #main executables
    32 function isabelle ()
    32 function isabelle ()
    33 {
    33 {
    34   "$ISABELLE_TOOL" "$@"
    34   "$ISABELLE_TOOL" "$@"
    35 }
    35 }
       
    36 export -f isabelle
       
    37 
    36 function isabelle_process ()
    38 function isabelle_process ()
    37 {
    39 {
    38   "$ISABELLE_PROCESS" "$@"
    40   "$ISABELLE_PROCESS" "$@"
    39 }
    41 }
       
    42 export -f isabelle_process
       
    43 
    40 function isabelle_scala_script ()
    44 function isabelle_scala_script ()
    41 {
    45 {
    42   "$ISABELLE_SCALA_SCRIPT" "$@"
    46   "$ISABELLE_SCALA_SCRIPT" "$@"
    43 }
    47 }
       
    48 export -f isabelle_scala_script
    44 
    49 
    45 #shared library convenience
    50 #shared library convenience
    46 function librarypath ()
    51 function librarypath ()
    47 {
    52 {
    48   for X in "$@"
    53   for X in "$@"
    65         export LD_LIBRARY_PATH
    70         export LD_LIBRARY_PATH
    66         ;;
    71         ;;
    67     esac
    72     esac
    68   done
    73   done
    69 }
    74 }
       
    75 export -f librarypath
    70 
    76 
    71 #robust invocation via ISABELLE_JDK_HOME
    77 #robust invocation via ISABELLE_JDK_HOME
    72 function isabelle_jdk ()
    78 function isabelle_jdk ()
    73 {
    79 {
    74   if [ -z "$ISABELLE_JDK_HOME" ]; then
    80   if [ -z "$ISABELLE_JDK_HOME" ]; then
    77   else
    83   else
    78     local PRG="$1"; shift
    84     local PRG="$1"; shift
    79     "$ISABELLE_JDK_HOME/bin/$PRG" "$@"
    85     "$ISABELLE_JDK_HOME/bin/$PRG" "$@"
    80   fi
    86   fi
    81 }
    87 }
       
    88 export -f isabelle_jdk
    82 
    89 
    83 #robust invocation via JAVA_HOME
    90 #robust invocation via JAVA_HOME
    84 function isabelle_java ()
    91 function isabelle_java ()
    85 {
    92 {
    86   if [ -z "$JAVA_HOME" ]; then
    93   if [ -z "$JAVA_HOME" ]; then
    89   else
    96   else
    90     local PRG="$1"; shift
    97     local PRG="$1"; shift
    91     "$JAVA_HOME/bin/$PRG" "$@"
    98     "$JAVA_HOME/bin/$PRG" "$@"
    92   fi
    99   fi
    93 }
   100 }
       
   101 export -f isabelle_java
    94 
   102 
    95 #robust invocation via SCALA_HOME
   103 #robust invocation via SCALA_HOME
    96 function isabelle_scala ()
   104 function isabelle_scala ()
    97 {
   105 {
    98   if [ -z "$JAVA_HOME" ]; then
   106   if [ -z "$JAVA_HOME" ]; then
   104   else
   112   else
   105     local PRG="$1"; shift
   113     local PRG="$1"; shift
   106     "$SCALA_HOME/bin/$PRG" "$@"
   114     "$SCALA_HOME/bin/$PRG" "$@"
   107   fi
   115   fi
   108 }
   116 }
       
   117 export -f isabelle_scala
   109 
   118 
   110 #classpath
   119 #classpath
   111 function classpath ()
   120 function classpath ()
   112 {
   121 {
   113   for X in "$@"
   122   for X in "$@"
   118       ISABELLE_CLASSPATH="$ISABELLE_CLASSPATH:$X"
   127       ISABELLE_CLASSPATH="$ISABELLE_CLASSPATH:$X"
   119     fi
   128     fi
   120   done
   129   done
   121   export ISABELLE_CLASSPATH
   130   export ISABELLE_CLASSPATH
   122 }
   131 }
       
   132 export -f classpath
   123 
   133 
   124 #administrative build
   134 #administrative build
   125 if [ -e "$ISABELLE_HOME/Admin/build" ]; then
   135 if [ -e "$ISABELLE_HOME/Admin/build" ]; then
   126   function isabelle_admin_build ()
   136   function isabelle_admin_build ()
   127   {
   137   {
   128     "$ISABELLE_HOME/Admin/build" "$@"
   138     "$ISABELLE_HOME/Admin/build" "$@"
   129   }
   139   }
   130 else
   140 else
   131   function isabelle_admin_build () { return 0; }
   141   function isabelle_admin_build () { return 0; }
   132 fi
   142 fi
       
   143 export -f isabelle_admin_build
   133 
   144 
   134 #arrays
   145 #arrays
   135 function splitarray ()
   146 function splitarray ()
   136 {
   147 {
   137   SPLITARRAY=()
   148   SPLITARRAY=()
   139   for X in $*
   150   for X in $*
   140   do
   151   do
   141     SPLITARRAY["${#SPLITARRAY[@]}"]="$X"
   152     SPLITARRAY["${#SPLITARRAY[@]}"]="$X"
   142   done
   153   done
   143 }
   154 }
       
   155 export -f splitarray
   144 
   156 
   145 #init component tree
   157 #init component tree
   146 function init_component ()
   158 function init_component ()
   147 {
   159 {
   148   local COMPONENT="$1"
   160   local COMPONENT="$1"
   179   fi
   191   fi
   180   if [ -f "$COMPONENT/etc/components" ]; then
   192   if [ -f "$COMPONENT/etc/components" ]; then
   181     init_components "$COMPONENT" "$COMPONENT/etc/components"
   193     init_components "$COMPONENT" "$COMPONENT/etc/components"
   182   fi
   194   fi
   183 }
   195 }
       
   196 export -f init_component
   184 
   197 
   185 #init component forest
   198 #init component forest
   186 function init_components ()
   199 function init_components ()
   187 {
   200 {
   188   local BASE="$1"
   201   local BASE="$1"
   209   for COMPONENT in "${COMPONENTS[@]}"
   222   for COMPONENT in "${COMPONENTS[@]}"
   210   do
   223   do
   211     init_component "$COMPONENT"
   224     init_component "$COMPONENT"
   212   done
   225   done
   213 }
   226 }
   214 
   227 export -f init_components
   215 set +o allexport
   228 
   216 
   229 fi
   217 fi