From 3d3644015459fe18555f3b020a1833bacfa1b36a Mon Sep 17 00:00:00 2001 From: cas Date: Wed, 18 Jul 2001 18:23:40 +0000 Subject: [PATCH] No comments --- src/WOKsite/FILES | 10 +-- src/WOKsite/tclshrc_Wok | 159 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 146 insertions(+), 23 deletions(-) diff --git a/src/WOKsite/FILES b/src/WOKsite/FILES index c58b2d8..06c29fe 100755 --- a/src/WOKsite/FILES +++ b/src/WOKsite/FILES @@ -2,14 +2,10 @@ srcinc:::CreateFactory.tcl srcinc:::WOKSESSION.edl srcinc:::DEFAULT.edl srcinc:::FILES -srcinc:::InstallJava.csh -srcinc:::InstallMesa.csh -srcinc:::InstallTcl.csh -srcinc:::examples.bck.Z srcinc:::tclshrc_Wok srcinc:::wokcfg.bat srcinc:::wokcfg srcinc:::INSTALL -srcinc:::wokfac1.html -srcinc:::wokfac2.html -srcinc:::wokfac3.html +srcinc:::wok.csh +srcinc:::wok.bat + diff --git a/src/WOKsite/tclshrc_Wok b/src/WOKsite/tclshrc_Wok index 877a031..2f8c6d5 100755 --- a/src/WOKsite/tclshrc_Wok +++ b/src/WOKsite/tclshrc_Wok @@ -1,22 +1,149 @@ -;# This file should be inserted in your .tclshrc file -;# in order to launch wok properly. ;# -if { ! [info exists env(WOK_SESSIONID)] } { - set env(WOK_SESSIONID) "$env(HOME)/.wok" -} - -if { [info exists env(WOK_LIBRARY)] } { - lappend auto_path $env(WOK_LIBRARY) +;# This is a template file for a Tcl/Tk user startup file. +;# +;# To use it you must : +;# +;# On Unix/Linux system, place or invoke it in a file named .wishrc on your +;# home directory. Wish, the Tcl/Tk windowing shell will automatically invoke +;# this file. +;# +;# On Windows system, place this file in the directory pointed to by the variable HOME. +;# Name it tclshrc.tcl or wishrc.tcl depending on the shell you want to use. +;# You can then click on the Tclsh or Wish icon to start Wok. +;# +;# This file assumes that : +;# +;# On Linux platforms the variable LD_LIBRARY_PATH is setted to the name +;# of the directory where Wok shareable resides. For example if you have +;# downloaded Wok on /home/me/wok-C40 of a Linux system, you must set +;# LD_LIBRARY_PATH to /home/me/wok-C40/lib/lin because wok shareable resides +;# in this directory. See also the INSTALL file. +;# +;# In the same way: +;# +;# On SunOS platforms you set LD_LIBRARY_PATH to /home/me/wok-C40/lib/sun. +;# On Windows system you set the variable PATH to C:\home\me\wok-C40\lib\lin. +;# +;# The following operation are done : +;# +;# 1. Traversing the LD_LIBRARY_PATH or PATH variable we find where you have installed +;# Wok. +;# 2. We can : +;# a) Compute the location of EDL files Wok needs for working. +;# b) Modify the Tcl variable auto_path in order to add our packages: Wok and Ms +;# c) In the case of a first installation, setup the directory wok_entities where +;# Wok will manage to create its entities. +;# +;# IMPORTANT RESTRICTIONS: +;# +;# The purpose of this file is to provide a simple and uniform way of using Wok on Unix/Linux +;# and on Windows. Be aware that if you use other Tcl tools, this can be conflicting. +;# In this case you can make up a Tcl proc from this file and invoke it at the moment you +;# choose. +;# +proc RUNWOK { } { + global env tcl_platform + if { "$tcl_platform(platform)" == "unix" && ![info exists env(LD_LIBRARY_PATH)] } { + puts stderr "You must set LD_LIBRARY_PATH to point where you have installed Wok" + exit + } + + if { "$tcl_platform(platform)" == "windows" && ![info exists env(PATH)] } { + puts stderr "You must set PATH to point where you have installed Wok" + exit + } + if [info exists wm] { + wm withdraw . + } + if { "$tcl_platform(platform)" == "unix" } { + set wrk [split $env(LD_LIBRARY_PATH) :] + set fmtshr "lib%s.so" + if { $tcl_platform(os) == "HP-UX" } { set fmtshr "lib%s.sl" } + } + if { "$tcl_platform(platform)" == "windows" } { + set wrk [split $env(PATH) ";"] + set fmtshr "%s.dll" + } + ;# + ;# Find out in wrk where wok resides. That is : where the file libTKWOK resides. + ;# + set wokso [format $fmtshr TKWOK] + foreach d $wrk { + if { [file exists [file join $d $wokso]] && ![info exists wokfound] } { + set wokfound $d + } + } + if ![info exists wokfound] { + puts stderr "Wok (actually $wokso) was not found in the directory(ies) $d" + puts stderr "Please check your variable LD_LIBRARY_PATH(Unix) or PATH (windows)" + return + } + ;# + ;# Wok's here we can set up our niche. + ;# + set wok_library [file dirname $wokfound] + set wok_ptfm [file tail $wokfound] + ;# + ;# + lappend auto_path $wok_library package require Wok package require Ms + ;# + ;# Where tcl and edl file of wok reside. + ;# + set env(WOK_LIBRARY) $wok_library + set env(WOK_LIBPATH) $wok_library:[file join $wok_library $wok_ptfm] + set env(WOKSTATION) $wok_ptfm + set env(WOKHOME) [file dirname $wok_library] + set env(WOKSITE) [file join $env(WOKHOME) site] + ;# + ;# Where the files ATLIST , DEFAULT.edl and SESSION.edl reside + ;# + if {![info exists env(WOK_ROOTADMDIR)] } { + set env(WOK_ROOTADMDIR) $env(WOKHOME)/wok_entities + } + if ![file exists $env(WOK_ROOTADMDIR)] { + puts stderr "Creating directory $env(WOK_ROOTADMDIR) for wok entities..." + if [catch { wokUtils:FILES:mkdir $env(WOK_ROOTADMDIR) } status] { + puts stderr "Error : $status" + exit + } + if ![file exists $env(WOK_ROOTADMDIR)] { + exit + } + } + ;# + ;# Check if Wok stuff is correct. If not set it up silently. + ;# + if ![file exists [set woksession [file join $env(WOK_ROOTADMDIR) WOKSESSION.edl]]] { + set str1 [wokUtils:FILES:FileToString [file join $env(WOKSITE) WOKSESSION.edl]] + regsub -all -- {TOSUBSTITUTE} "$str1" "$env(WOK_ROOTADMDIR)" result1 + wokUtils:FILES:StringToFile $result1 $woksession + if [file exists $woksession] { + puts stderr "File $session has been created. " + } + } + ;# + ;# + ;# + if ![file exists [set default [file join $env(WOK_ROOTADMDIR) DEFAULT.edl]]] { + set str2 [wokUtils:FILES:FileToString [file join $env(WOKSITE) DEFAULT.edl]] + regsub -all -- {dp_xx} "$str2" "$env(WOK_ROOTADMDIR)" result2 + wokUtils:FILES:StringToFile $result2 $default + if [file exists $default] { + puts stderr "File $default has been created. " + } + } + ;# + ;# Where to read/write the current working entity + ;# + set env(WOK_SESSIONID) $env(HOME)/.wok + ;# + ;# Every thing seems OK. Display a nice prompt: + ;# set tcl_prompt1 {if {[info commands wokcd] != ""} then \ {puts -nonewline stdout "[wokcd]> "} else \ - {puts -nonewline stdout "tclsh> "}} -} else { - puts stderr "Warning: The environment variable WOK_LIBRARY is mandatory to" - puts stderr " load the package Wok." - puts stderr " " + {puts -nonewline stdout "tclsh> "}} + } - - - +RUNWOK -- 2.39.5