#
# ~cvs/scrib/app_example/procedures.tcl
#
# author: jason aftosmis (jason@icemcfd.com)
# date:   april 2002  
# 
#--------------------------------------------------------------------

## This is where the app-configurer puts his procs,
## which ought to be connected to buttons defined in ./config.tcl.
## Arguments to this functions should never be elements of proc_scrib_data!

# this is for using scrib_app_data_entry with option
#    -compute_cmd "app_ex_compute_harder 2"

proc app_ex_compute_harder {val} {
    global proc_scrib_data
        
    if [info exists proc_scrib_data(number_rings)] {
	set stuff $proc_scrib_data(number_rings)
    } else { set stuff 3 }
    
    return [expr $val * $stuff]
}

proc app_ex_procedure_test {} {
    #
    # proc_scrib_data all data in the Scrib App is stored
    # in this array at hash location as given by the var
    # (first arg in scrib_app_data_entry in data_column.tcl)
    #
    global proc_scrib_data
    #
    # scrib_app_data_get THIS IS NO LONGER NECESSARY!!
    #
    # get can use the stdout proc and print data from proc_scrib_data
    #
    stdout "\nYou have just called scrib_app_example_test!\n\n"
    stdout "You have access to the following variable values:\n"
    foreach i [array names proc_scrib_data] {
	stdout "\t$i: $proc_scrib_data($i)\n"
    }
    #
    # show all those scrib_* commands to which this proc has access
    #
    stdout "\nNow you can safely do stuff with these commands!:\n"
    set accesssible_commands [lsort [info commands scrib_*]]
    foreach i $accesssible_commands {
	stdout "\t$i\n"
    }
    stdout "as well as those in, or sourced in, procedures.tcl\n"
    #
    # even these procs should return a value
    #
    return 0
}
