home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)vwinterfac.tcl /main/hindenburg/3
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)vwinterfac.tcl /main/hindenburg/3 27 Aug 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- require stgenerato.tcl
- require stfilehand.tcl
- require platform.tcl
- # End user added include file section
-
- require "stinterfac.tcl"
-
- Class VWInterface : {STInterface} {
- constructor
- method destructor
- method startST
- }
-
- constructor VWInterface {class this name} {
- set this [STInterface::constructor $class $this $name]
- # Start constructor user section
- $this fileHandler [STFileHandler new]
- $this generator [STGenerator new]
- # End constructor user section
- return $this
- }
-
- method VWInterface::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this STInterface::destructor
- }
-
-
- # Starts Visualworks. Tries to locate the VisualWorks
- # installation directory by scanning the PATH. If that is found
- # tries to locate the image by reading VWIMAGEPATH.
- # If it is not set the standard image is used.
- # File name handling is Unix specific.
- #
- method VWInterface::startST {this} {
- if [catch { set envPath $env(PATH) }] {
- wmtkerror "environment variable PATH not found"
- return
- }
-
- set visualPath ""
- # visualKey is used to recognize the VW installation in the PATH
- set visualKey "visual"
-
- if $win95 {
- set pathSep "\\"
- set envPathSep ";"
- set visualExecName "vw.exe"
- } else {
- set pathSep "/"
- set envPathSep ":"
- set visualExecName "visualworks"
- }
-
- foreach pathSpec [split $envPath $envPathSep] {
- set dirList [split $pathSpec $pathSep]
- set index [lsearch -exact $dirList $visualKey]
- if { $index == -1 } {
- set index [lsearch -exact $dirList [string toupper $visualKey]]
- }
- if { $index != -1 } {
- # found it! find root: directories up to and including key
- set visualPath [join [lrange $dirList 0 $index] $pathSep]
- }
- }
-
- if { $visualPath == "" } {
- wmtkerror "VisualWorks not found in PATH"
- return
- }
-
- set visualExec [path_name concat [path_name concat $visualPath bin] \
- $visualExecName]
-
- if { ![file exists $visualExec] } {
- wmtkerror "VisualWorks executable not found"
- return
- }
-
- if [catch { set imagePath $env(VWIMAGEPATH) }] {
- wmtkwarning "VWIMAGEPATH not set, using standard image"
- set imagePath [path_name concat $visualPath image]
- }
-
- if { ![file exists $imagePath] } {
- wmtkerror "Image path not found"
- return
- }
-
- set imageFile [path_name concat $imagePath visual im]
-
- if { ![file exists $imageFile] } {
- wmtkerror "Image file not found"
- return
- }
-
- # All set, do it
- system "$visualExec $imageFile &"
- }
-
- # Do not delete this line -- regeneration end marker
-
- VWInterface new .main.vw
-
-