#!/bin/bash unset DISPLAY; unset LUI; if [ -z "${LOGONROOT}" ]; then # # determine the LOGON root directory, assuming this script resides in the # top-level directory of the tree. # path=$(dirname $0) if [ "${path#./}" != "${path}" ]; then path="$(pwd)/${path#./}" fi if [ "${path#/}" = "${path}" ]; then if [ "${path}" = "." ]; then path="$(pwd)"; else path="$(pwd)/${path}" fi fi LOGONROOT="${path}"; export LOGONROOT fi # # include a shared set of shell functions and global parameters, including the # architecture identifier .LOGONOS. # . ${LOGONROOT}/etc/library.bash; target=analysis source="--source" while [ $# -gt 0 -a "${1#-}" != "$1" ]; do case ${1} in --binary) source=""; shift 1; ;; --source) source="--source"; shift 1; ;; --cat) cat="--cat"; shift 1; ;; --all) all=yes; shift 1; ;; -a|--analysis) target=analysis; shift 1; ;; -t|--transfer) target=transfer; shift 1; ;; -r|--realization) target=realization; shift 1; ;; -o|--outputs) target=outputs; limit=${2}; if [ "${limit}" = "all" ]; then limit=100000; fi shift 2; ;; --noen) target=noen; shift 1; ;; --hiking) target=hiking; shift 1; ;; --iula) target=iula; shift 1; ;; --wescience) target=wescience; shift 1; ;; --bioscope) target=bioscope; shift 1; ;; *) echo "usage: summarize { -a | -t | -r } file"; exit 1; esac done case ${target} in noen|hiking|iula|wescience|bioscope) { loadup; # # make sure to initialize [incr tsdb()] against our own start-up file # echo "(tsdb::initialize-tsdb nil :rc \"${LOGONROOT}/dot.tsdbrc\")"; case ${target} in noen) echo "(load \"$LOGONROOT/uio/${target}/lists.lisp\")"; ;; hiking) echo "(load \"$LOGONROOT/uio/data/skeletons.lisp\")"; ;; iula) echo "(load \"$LOGONROOT/upf/data/skeletons.lisp\")"; ;; wescience) echo "(load \"$LOGONROOT/uio/wescience/skeletons.lisp\")"; ;; bioscope) echo "(load \"$LOGONROOT/uio/bioscope/txt/skeletons.lisp\")"; esac; echo "(excl:exit)"; } | ${LOGONROOT}/bin/logon ${source} ${cat} -I base -locale no_NO.UTF-8 -qq ;; analysis) egrep '^\[' ${1} \ | grep 'SEM-I predicates: ' \ | sed 's/^.* --- error: [^ ]* SEM-I predicates: //g' \ | sed -e 's/, /\n/g' -e 's/\.//g' | sort -u ;; transfer) egrep '^\|-' ${1} \ | grep 'transfer predicates: ' \ | sed 's/^.* --- error: [^ ]* transfer predicates: //g' \ | sed -e 's/, /\n/g' -e 's/\.//g' | sort -u ;; realization) egrep '^\| \|-' ${1} \ | grep 'invalid predicates: ' \ | sed 's/^.* --- error: invalid predicates: //g' \ | sed -e 's/, /\n/g' -e 's/\.//g' | sort -u ;; outputs) gawk \ '/^\|< / { if(output && (!'${limit}' || "'${all}'" == "yes")) \ printf("%s", output); count = 0; output = sprintf("\n%s\n", $0); } \ /^\|@ / { if(!count) output = (output sprintf("%s\n", $0)); } \ /^\|> / { if ('${limit}' && !count) printf("%s", output); output = ""; \ count++; if(count <= '${limit}') print $0; } \ END { if(output && (!'${limit}' || "'${all}'" == "yes")) \ printf("%s", output); }' \ ${1} | \ sed -e 's@/\([^/]*\)/@\1@g' -e 's@ ||@@g' ;; esac