Version 35 of application_runner_&_wrapper

Updated 2009-02-02 19:18:35 by gold

A runner or wrapper is slang for a program that uses or services a computation engine, usually in another or second computer language. Runners have been used to port or extend the use of legacy fortran codes, although there is some controversy on the efficiency of these applications.

Here is a stater on an application_runner in TCL.gold


 # application_runner_&_wrapper.tcl --
 # goldshell7, tcl wiki script on 20060601
 # modified to
 # demo script in Expect 5.21
 # TCL8 distribution, for Win95 use
 # modified to  TCL8 distribution
 #start of deck
 # SCCS: @(#)   1.16 97/03/02 16:25:05
 # GLOBAL VARIABLES
 #

 global filex
 set filex "1"
 global obj; set obj {1}
 global widget; 
    set widget {TEST}


 #################################
 # USER DEFINED PROCEDURES
 #
 proc init {argc argv} {

 }

 init $argc $argv


 proc main {argc argv} {
 global widget
 # $widget insert end "forced text"
 .list insert end "end of show!!!"
 .sorted insert end "end of show!!!"
 }

 proc Window {args} {
 global vTcl
    set cmd [lindex $args 0]
    set name [lindex $args 1]
    set rest [lrange $args 2 end]
    if {$name == "" || $cmd == ""} {return}
    set exists [winfo exists $name]
    switch $cmd {
        show {
            if {[info procs vTclWindow(pre)$name] != ""} {
                vTclWindow(pre)$name $rest
            }
            if {[info procs vTclWindow$name] != ""} {
                vTclWindow$name
            }
            if {[info procs vTclWindow(post)$name] != ""} {
                vTclWindow(post)$name $rest
            }
        }
        hide    { if $exists {wm withdraw $name; return} }
        iconify { if $exists {wm iconify $name; return} }
        destroy { if $exists {destroy $name; return} }
    }
 }
 proc browse {dir file} {
    global env
    #global file
    global filex
    global dirx
    set filex ""
    set dirx ""
    catch {if {[string compare $dir "."] != 0} {set file $dir/$file }}
   set filex $file
                #exec "\"C:/program files/microsoft office/office/winword\"" $file &
          #exec "\C:\/ ted\ " &
          # exec "ted" &
          #exec [C:\/Program\ Files \
 /Microsoft\ Office/Office/Winword] $file &
 #exec [C:\\Program\ Files\\Microsoft\ Office\\Office\\Winword] $file &
 #.entry01 insert end " "
 # .entry02 insert end " "
 set clipped_directory "2";
 set clipped_directory [file dirname $dir]
 .entry01 delete 0 end

 .entry02 delete 0 end

 #  .entry01 insert end $dir
 .entry01 insert end [file dirname $dir]
 .entry01 insert end [eval file dirname  [eval file dirname $dir]]
 .entry02 insert end $filex
 }
 #################################
 # VTCL GENERATED GUI PROCEDURES
 #

 button .button01 -text APPLICATION -command {C:\/Program\ Files\/Microsoft\ Office\/Office\/Winword}  
 # TCL has long noses for Microsoft
 button .button02 -text EDIT -command \
 {C:\/Program\ Files\/Microsoft\ Office\/Office\/Winword} 

 button .button03 -text EXIT -command {exit} 
 button .button04 -text RESET -command {browse $dir $i} 
  pack .button01 .button02 .button03 \
 .button04  
  entry .entry01 \
       -font   \
 ----
   -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
 ----
     -textvariable $filex -justify left -width 50 -state normal
 label .label02 \
       -text "target directory" -justify center -width 20 
 label .label01 \
       -text "target file" -justify center -width 20 
 entry .entry02 \
       -font   \
 -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
     -textvariable $filex -justify left -width 50 -state normal
 pack .label01 -side bottom -fill y
 pack .entry01 -side bottom -fill y
 pack .label02 -side bottom -fill y
 pack .entry02 -side bottom -fill y
 # Create a scrollbar on the right side of the main window and a listbox
 # on the left side.

 scrollbar .scroll -command ".list yview"


 listbox .list -yscroll ".scroll set" -relief sunken -width 20 -height 20 \
        -setgrid yes


 pack .list -side left -fill both -expand yes

 listbox .sorted -yscroll ".scroll set" \
      -width 20 -height 20

   pack .sorted -side right


   scrollbar .scrollx -command \
      ".sorted yview"



 pack .scrollx -side right -fill y
 pack .scroll -side right -fill y

 # Fill the listbox with a list of all the files in the directory (run
 # the "ls" command to get that information).
 if {$argc > 0} {
      set dir [lindex $argv 0]
   } else {
      set dir .
   }
   foreach i [lsort [glob * .*]] {
      #.list insert end $i

      .sorted insert end $i
 }
  foreach i [lsort [glob  {\*}]] {

   .list insert end $i

      #.sorted insert end $i
 }


 # Set up bindings for the browser.

 bind all <Control-c> {destroy .}
 bind .list <Double-Button-1> {foreach i [selection get] {browse $dir $i} }

 bind .sorted <Double-Button-1> {foreach i [selection get] {browse $dir $i} }


 main $argc $argv
 # loaded on tcl wiki tcl8
 # 2JUn2006, goldshell7
 # end of deck

 #application_runner_&_wrapper!  

Screenshots Section

http://img175.imageshack.us/img175/5109/ichinggenerator5ab5.jpg http://img87.imageshack.us/img87/4645/tclwikiapplicationrunneeu7.png Comments Section

Please put useful comments in this section, thank you.

References

Web References

  • Google Tutorials, [L4 ]

Category Toys