#!/bin/sh
# the next line is not read by tcl \
TCLBINARY=tclsh; source `dirname $0`/configuration
# the next line restarts using tclsh \
exec $TCLBINARY "$0" "$@"

if { ![file readable [lindex $argv 0]] } {
    puts "Can't read file \"[lindex $argv 0]\""
    exit 1
}

set nameOfThisScript [file normalize $argv0]
set homeOfThisScript [file dirname $nameOfThisScript]
source [file join $homeOfThisScript opetopes.tcl]

puts [lindex $argv 0]
puts [lindex $argv 1]
puts [lindex $argv 2]

if { [llength $argv] < 2 || ([llength $argv] > 2 && [lindex $argv 2] ne "-o") } {
    puts "Wrong number of arguments.  Usage: \"[file tail $argv0] XMLFILE SOURCENAME ?-o OUTPUTPATH?\""
    exit 1
} 

puts [eval computeOneSource $argv]


