File mttroot/gino/create_gino.sh artifact df77946783 part of check-in fc177d09e6


#! /bin/sh
## Creates gino functions by querying ginsh
# Copyright (C) 2002 by Peter J. Gawthrop

prefix="g_"			# Prefix function names by this
subdir=${prefix}funs		# Where the generated functions live
ginsh="/usr/bin/ginsh"		# Location of ginsh

create_fun() {
    funname=${prefix}$1
    filename=${funname}.m

    ## Creates an octave function
    echo Creating ${subdir}/${filename}

    ## Find usage string

    usage=`echo "?$1" | ginsh | head -1`

    ## The octave function
    cat<<EOF > ${subdir}/${filename}
function res = ${funname} (arg1,arg2,arg3)

  ## usage:  res = ${prefix}${usage}

  ## Generated by create_gino.sh on `date`
  ## DO NOT EDIT ME

  if nargin<1
    arg1 = "";
  endif

  if nargin<2
    arg2 = "";
  endif

  if nargin<3
    arg3 = "";
  endif

  res = gino("$1", arg1, arg2, arg3);

endfunction
EOF
}

create_readme() {
    cat > ${subdir}/README <<EOF
These files were generated automatically by create_gino.sh
on `date`.

DO NOT EDIT THEM
EOF
}

## Find available ops
ops=`echo "??" | ginsh | gawk '{if(i++==1) {gsub(",",""); print $0}}'`

## Does ginsh exist?
if [ -x "${ginsh}" ]; then
    echo $ginsh exists - ok
else
    echo $ginsh does not exist, exiting
    exit
fi

## Create the corresponding octave funs.
mkdir -p ${subdir}
create_readme;
for op in ${ops}; do
    create_fun ${op}
done



MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]