# ***************************************************************************
# * FC2 PACKAGE SOURCE FILE
# * 
# * xeve-src.tcl -- Tcl Script that sources the scripts for Xeve
# *
# * WARNING: the order in which the file are sourced is important.
# * Changing the order may not work.
# ***************************************************************************
global env

if {![info exist env(XEVE_LIB)]} {
    set env(XEVE_LIB) [pwd]
}

proc ScriptLoadError {file error} {
    global env
    global errorInfo

    set errorMessage \
        "*** xeve: Error while loading script files from $env(XEVE_LIB).\n\
             Please send a bug report to Amar.Bouali@sophia.inria.fr\n\
             by giving the result of the call \"xeve -info\" and including\n\
             the following message:\n\
             Error while loading script file $file.\n\
             Interpretor says:\n\
             $error\n$errorInfo\n\nThank you."

    puts stderr $errorMessage
}

set scriptFileList {
    xeve-win.tcl
    xeve-import.tcl
    xeve-help.tcl
    xeve-proc.tcl
    xeve-result.tcl
}

set scriptFileList2 {
    xeve-win.tcl
    xeve-import.tcl
    xeve-help.tcl
    xeve-msg.tcl
    xeve-start.tcl
    xeve-signal.tcl
    xeve-file.tcl
    xeve-verif.tcl
    xeve-result.tcl
}

foreach scriptFile $scriptFileList {

    if {[catch "source $env(XEVE_LIB)/$scriptFile" sourceError]} {
        ScriptLoadError $scriptFile $sourceError
        return -code error -errorinfo $sourceError -errorcode TCL_ERROR
    }
}


uplevel \#0 {
    if {[info exists XeveInitHook]} {
	if {[catch {eval $XeveInitHook} evalError]} {
	    return -code error -errorinfo $evalError -errorcode TCL_ERROR
	}
    }
}
