#!/bin/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; ;; *) echo "usage: summarize { -a | -t | -r } file"; exit 1; esac done case ${target} in noen) { # # when running from source, configure and compile the LOGON system # if [ -n "${source}" ]; then echo "(load \"${LOGONROOT}/lingo/lkb/src/general/loadup.lisp\")"; echo "(pushnew :lkb *features*)"; echo "(pushnew :mrs *features*)"; echo "(pushnew :tsdb *features*)"; echo "(pushnew :mt *features*)"; echo "(pushnew :logon *features*)"; echo "(setf (system:getenv \"DISPLAY\") nil)"; echo "(compile-system \"tsdb\")"; fi # # make sure to initialize [incr tsdb()] against our own start-up file # echo "(tsdb::initialize-tsdb nil :rc \"${LOGONROOT}/dot.tsdbrc\")"; echo "(load \"$LOGONROOT/uio/${target}/lists.lisp\")"; 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