#!/usr/bin/tclsh

##############################################################################
#
# Copyright (c) 1999-2001 by Wayne C. Gramlich.
# All rights reserved.
#
# Permission to use, copy, modify, distribute, and sell this software
# for any purpose is hereby granted without fee provided that the above
# copyright notice and this permission are retained.  The author makes
# no representations about the suitability of this software for any purpose.
#
##############################################################################

##############################################################################
#
# uCL stands for Micro Controller Language, where "u" is the greek
# letter micron.  Further documentation about uCL can be found at:
#
#    http://web.gramlich.net/projects/ucl/index.html
#
##############################################################################

set directory [file dirname $argv0]
source [file join $directory "compiler.tcl"]

proc main {} {
    global argv path version

    set path ""
    set argc [llength $argv]
    if {$argc == 0} {
	puts stderr "uCL version $version"
	puts stderr "Usage ucl ucl_file ..."
    } else {
	set calibrate ""
	set option ""
	foreach arg $argv {
	    if {[string index $arg 0] == "-"} {
		set option $arg
	    } else {
		if {$option != ""} {
		    if {$option == "-c"} {
			set calibrate $arg
		    } else {
			puts "Unrecognized option $option"
		    }
		    set option ""
		} else {
		    compile_base $arg $calibrate
		}
	    }
	}
    }
}

main
