#!/bin/ksh

#
# %Z%%W% %I%
# ===========================================================================
# Licensed Materials - Property of IBM
# "Restricted Materials of IBM"
#
# IBM Object Request Broker Edition, 2.00
# (C) Copyright IBM Corp. 1998, 2013. All Rights Reserved
# ===========================================================================
#

# idlj script which uses the IBM IDL compiler
#

PRG=$(whence $0) >/dev/null 2>&1

# Resolve symbolic links
while [[ -L "$PRG" ]]
do
    src=$(ls -l $PRG | awk '{print $NF}')
    print $src | grep -q '^/'
    if [[ $? = 1 ]]
    then
	PRG=${PRG%/*}/$src
    else
	PRG=$src
    fi
done
APPHOME=$(""cd ${PRG%/*}/..; pwd)

# Sort out the java options from the idlj options
java_args=
idlj_args=
while [[ $# > 0 ]]
do
    arg="${1#-J}"
    if [[ "$arg" = "$1" ]]
    then
	idlj_args="$idlj_args $arg"
    else
	java_args="$java_args $arg"
    fi
    shift
done

# Invoke the IBM IDL compiler
$APPHOME/bin/java $java_args -classpath "$APPHOME/lib/ibmorbtools.jar" com.ibm.idl.toJavaPortable.Compile $idlj_args
