#!/usr/bin/sh
# *****************************************************************************
# *****************************************************************************
# strm2oa
#
# This script is wrapper for strm2oa.  You can set the following options
# depending on how you would like to use strm2oa.
#
# Mode:
# The default use is to run the optimized mode.  To specify debug mode
# for all programs, you should set the OA_MODE environment variable to 'dbg'.
#
# To set the mode to 'dbg' on an individual program you should
# set the BINARYNAME_MODE environment variable to 'dbg'.
#
# Bit:
# The default use is to run 64bit code.  To specify 32bit for all
# programs, set the OA_BIT environment variable to '32'.
#
# To specify the bit as '32' for a specific program, you should
# set the BINARYNAME_BIT environment variable to '32'.
#
# *****************************************************************************
# Except as specified in the OpenAccess terms of use of Cadence or Silicon
# Integration Initiative, this material may not be copied, modified,
# re-published, uploaded, executed, or distributed in any way, in any medium,
# in whole or in part, without prior written permission from Cadence.
#
#                Copyright 2002-2005 Cadence Design Systems, Inc.
#                           All Rights Reserved.
#
# $Author: dell $
# $Revision: #2 $
# $Date: 2017/05/16 $
# $State: Exp $
#
# *****************************************************************************
# *****************************************************************************



PROGRAM=strm2oa
INSTALL_ROOT=`dirname $0`
unset cdpath
INSTALL_ROOT=`cd $INSTALL_ROOT/..;pwd`

BIT=${OA_BIT:-64}
BIT=${STRM2OA_BIT:-$BIT}

MODE=${OA_MODE:-opt}
MODE=${STRM2OA_MODE:-$MODE}

echo "$@" | egrep -e '-dataModel ' > /dev/null
if [ $? -ne 0 ]
then
  if [ -n "$OA_DATAMODEL" ] ; then
    ARGS="-dataModel $OA_DATAMODEL"
  else
    if [ -r $INSTALL_ROOT/data/OA.DATAMODEL ] ; then
      ARGS="-dataModel `cat $INSTALL_ROOT/data/OA.DATAMODEL`"
    fi
  fi
fi

exec $INSTALL_ROOT/bin/runExe $PROGRAM $INSTALL_ROOT $BIT $MODE $ARGS "$@"
