# ---------------------------------------------------------------------- # LANGUAGE: Tcl API # ====================================================================== # AUTHOR: Michael McLennan, Purdue University # Copyright (c) 2004-2012 HUBzero Foundation, LLC # # See the file "license.terms" for information on usage and # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. # ====================================================================== language "Tcl" { extension ".tcl" command {tclsh @tool/@@FILENAME@@ @driver} main {# ---------------------------------------------------------------------- # MAIN PROGRAM - generated by the Rappture Builder # ---------------------------------------------------------------------- package require Rappture package require Img # open the XML file containing the run parameters set io [Rappture::library [lindex $argv 0]] ######################################################### # Get input values from Rappture ######################################################### @@INPUTS@@ ######################################################### # Add your code here for the main body of your program ######################################################### # spit out progress messages as you go along... Rappture::Utils::progress 0 -mesg "Starting..." Rappture::Utils::progress 5 -mesg "Loading data..." Rappture::Utils::progress 50 -mesg "Half-way there" Rappture::Utils::progress 100 -mesg "Done" ######################################################### # Save output values back to Rappture ######################################################### @@OUTPUTS@@ Rappture::result $io exit 0 } input boolean { code "\n# get input value for $path" code "# returns value as string \"yes\" or \"no\"" code "set $id \[\$io get $path.current\]" } input image { code "\n# get input value for $path" code "# returns base64-encoded image data" code "set imdata \[\$io get $path.current\]" code "set $id \[image create photo -data \$imdata\]" } input number { set units [attr get units] if {$units ne ""} { code "\n# get input value for $path and convert to $units" code "set str \[\$io get $path.current\]" code "set $id \[Rappture::Units::convert \$str -to $units -units off\]" } else { code "\n# get input value for $path" code "set $id \[\$io get $path.current\]" } } input * { code "\n# get input value for $path" code "set $id \[\$io get $path.current\]" } output curve { code "\n# save output value for $path" code "# this shows just one (x,y) point -- modify as needed" code "\$io put -append yes $path.component.xy \"\$x \$y\\n\"" } output histogram { code "\n# save output value for $path" code "# this shows just one point -- modify as needed" code "# (x,h,w) = x-coord, height of bar, and width of bar (optional)" code "\$io put -append yes $path.component.xy \"\$x \$h \$w\\n\"" } output image { code "\n# save output value for $path" code "# this assumes that \$imh is the handle for a Tk photo image" code "\$io put $path.current \[\$imh data -format gif\]" } output * { code "\n# save output value for $path" code "\$io put $path.current \$$id" } }