#!/bin/sh
# --------------------------------------------------------------------------
# Copyright 1992-1994 by Forschungszentrum Informatik (FZI)
# All rights reserved.
#
# You can use and distribute this software under the terms of the license
# you should have received along with this software; either version 1.1 of
# the license, or (at your option) any later version.
# For a copy of the license or for additional information about this software,
# write to Xcc Software, Durlacher Allee 53, D-76131 Karlsruhe, Germany;
# Email: obst@xcc-ka.de.
# --------------------------------------------------------------------------
# 'obst-gen - 27:02:91 - Jochen'
#
# obst-gen [-I] [-L <language>] <schema>
#
# Interface to the OBST host language generators. 
# The generator operates on the meta schema to produce a host language 
# interface to the classes and types defined in the given schema.
#
# The "-L" option specifies the host language interface to be generated. Up to
# now there exists only a C++ binding, which is also the default.
#
 self='obst-gen'
usage='[-I] [-L language] <schema name>'

[ -n "$OBSTdir" ] || { OBSTdir="`cd \`dirname $0\`;pwd`/"; export OBSTdir; }

if [ -z "$OBSTCONTAINER" -a -z "$SOSCONTAINER" ] ; then
  echo >&2 "*** $self: environment variable OBSTCONTAINER not defined"
  exit 1
fi

language='CC'
  genopt=

while [ $# -gt 0 ]
do
   case "$1" in
      -I) genopt='-I'	;;
      -L) shift
	  language="$1"	;;
       *) break		;;
   esac
   shift
done
   schema="$1"
generator="gen$language"

[ "$schema" = '^' ] || {
   rm -f ${schema}_obst.[Cch] ${schema}_use.h
   ${OBSTdir}$generator $genopt $schema || exit 1
}

exit 0
