#!/bin/sh
#
# COPYRIGHT (c) 2026 The Fellowship of SML/NJ (https://smlnj.org)
# All rights reserved.
#
# Wrapper for ml-ulex heap image; this scrit is for debugging the tool
# during devlopment
#

mlulexdir=$0
scripthome=${mlulexdir%ml-ulex}

case `uname -s` in
  Darwin)
    case `uname -p` in
      i386) heap=${scripthome}ml-ulex.amd64-darwin ;;
      arm) heap=${scripthome}ml-ulex.arm64-darwin ;;
    esac ;;
  *) heap=${scripthome}ml-ulex.amd64-linux ;;
esac

if test ! -r $heap ; then
  echo "ml-ulex: no heap image!"
  exit 1
fi

exec sml @SMLload=$heap "$@"
