#!/bin/sh IOTTA=/usr/bin/iotta mods="" # We need TEMP as the `eval set --' would nuke the return value of getopt. TEMP=`getopt -o f:o:m:iC --long file:output:module:init -n 'copp2' -- "$@"` if [ $? != 0 ] ; then echo "terminating..." >&2 ; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" out="-" sum="checksum;" while true ; do case "$1" in -m|--module) files="$files,$2" module="$2" chain="copp" echo "module: $2" shift 2 ;; -i|--init) chain="init" echo "init!" shift ;; -f|--file) files="$files,$2" echo "file: $2" shift 2 ;; -s|--suffix) suff="$2" echo "suffix: $2" shift 2 ;; -C|--no-checksum) sum="" shift ;; -o|--output) out="$2" echo "out: $2" shift 2 ;; --) shift for f in "$@"; do files="$files,$f" done break ;; *) echo "Internal error!" ; exit 1 ;; esac done perl -I../utils/ $IOTTA --conf " ctrl=Iotta::Ctrl::Chain chain=$chain chain/copp=feed;initmeta;read;cclean;${sum}p-objs;p-meth;p-ids;collect;cg-ids;cg-objs;cg-meth;templ;mko;write chain/init=feed;initmeta;read;cclean;${sum}cg-init;mko;write mod/feed=Iotta::Feeder::Files mod/feed/files=$files mod/initmeta=Iotta::Copp::InitMeta mod/collect=Iotta::Copp::Collect mod/collect/module=$module mod/p-ids=Iotta::Copp::Parse::IDs mod/p-objs=Iotta::Copp::Parse::Objs mod/p-meth=Iotta::Copp::Parse::Meth mod/cg-ids=Iotta::Copp::CodeGen::IDs mod/cg-meth=Iotta::Copp::CodeGen::Meth mod/cg-objs=Iotta::Copp::CodeGen::Objs mod/cg-init=Iotta::Copp::CodeGen::InitFunc mod/cg-init/suffix=$suff mod/templ=Iotta::Copp::Template mod/read=Iotta::Input::File mod/cclean=Iotta::Copp::CClean mod/checksum=Iotta::Input::Checksum mod/write=Iotta::Output::File mod/mko=Iotta::Output::MkName mod/mko/template=$out "