From 3fc8228cd805b448e6282ecb449879ac4c6ce76d Mon Sep 17 00:00:00 2001 From: cascade Date: Fri, 17 Oct 2003 22:21:58 +0000 Subject: [PATCH] Windows style line brakes in NCollection_Vector.hxx have been removed, some modifications in WOK sources for its automatic building --- src/WOKsite/CreateFactory.tcl | 334 +++++++++++++++++----------------- src/WOKsite/FILES | 3 +- src/WOKsite/tclshrc_Wok | 18 +- 3 files changed, 184 insertions(+), 171 deletions(-) diff --git a/src/WOKsite/CreateFactory.tcl b/src/WOKsite/CreateFactory.tcl index 14e7418..8192ec7 100755 --- a/src/WOKsite/CreateFactory.tcl +++ b/src/WOKsite/CreateFactory.tcl @@ -1,166 +1,168 @@ -;# -;# This file is used to create from scratch a minimal set of WOK entities -;# A Factory, a warehouse, a workshop and a workbench. It can be used to import -;# sources files from a previously Cascade download. -;# this script has 5 arguments: -;# HOME_ENTITIES is a directory name. This is the name where all further entities -;# will be created. -;# FNAM is a factory name ( a factory is a set of workshop and a warehouse) -;# WSNAM is a workshop name ( a workshop is dedicated to contains a workbenches tree) -;# WBNAM is a workbench name. Typically it will be the name of the root workbench. -;# IMPORT_DIR is a directory name. If IMPORT_DIR is /dev/null no import is done -;# and WBNAM is created as empty workbench. To populate it with development units -;# please refer to the Wok documentation. -;# -proc FileToList { path {sort 0} {trim 0} {purge 0} {emptl 1} } { - if ![ catch { set id [ open $path r ] } ] { - set l {} - while {[gets $id line] >= 0 } { - if { $trim } { - regsub -all {[ ]+} $line " " line - } - if { $emptl } { - if { [string length ${line}] != 0 } { - lappend l $line - } - } else { - lappend l $line - } - } - close $id - if { $sort } { - return [lsort $l] - } else { - return $l - } - } else { - return {} - } -} -;# -;# -;# -proc lreplace { fin fout ls1s2 } { - if { [catch { set in [ open $fin r ] } errin] == 0 } { - if { [catch { set out [ open $fout w ] } errout] == 0 } { - set strin [read $in [file size $fin]] - close $in - foreach [list s1 s2] $ls1s2 { - set done 0 - if { [set nbsub [regsub -all -- $s1 $strin $s2 strout]] != 0 } { - set done 1 - } - set strin $strout - } - puts $out $strout - close $out - return $done - } else { - puts stderr "Error: $errout" - return 0 - } - } else { - puts stderr "Error: $errin" - return 0 - } -} -;# -;# -proc CreateFactory { HOME_ENTITIES FNAM WSNAM WBNAM IMPORT_DIR } { - - package require Wok - package require Ms - global env - - if [catch { package require Tclx } TclXHere] { - puts stderr "Warning : You'll need package TclX to correctly use WOK." - puts stderr " Check for variable TCLLIBPATH" - } - if [catch { package require Expect } ExpectHere] { - puts stderr "Warning : You'll need package Expect to use WOK integration package.." - puts stderr " Check for variable TCLLIBPATH" - } - - ;# - set savpwd [pwd] - - ;# - ;# Create factory FNAM and warehouse attached to it - ;# - if { ![wokinfo -x ${FNAM}] } { - puts "Creating the factory : ${FNAM}" - if ![catch {fcreate -DHome=$HOME_ENTITIES/${FNAM} -d ${FNAM} } astatus ] { - wokcd ${FNAM} - if { ![wokinfo -x ${FNAM}:BAG] } { - puts "Creating the WareHouse in $HOME_ENTITIES/${FNAM}/BAG" - if [ catch {Wcreate -DHome=$HOME_ENTITIES/${FNAM}/BAG -d -DAdm=$HOME_ENTITIES/${FNAM}/BAG/adm BAG } astatus ] { - puts $astatus - cd $savpwd - } - } - } else { - puts $astatus - cd $savpwd - } - } - - ;# - ;# Create workshop WSNAM - ;# - if { ![wokinfo -x ${FNAM}:${WSNAM}] } { - puts "Creating the workshop : ${FNAM}:${WSNAM}" - if ![ catch {screate -DHome=$HOME_ENTITIES/${FNAM}/${WSNAM} -d ${WSNAM} } astatus] { - wokcd -PAdm ${FNAM}:${WSNAM} - catch { mkdir Repository } - lreplace $env(WOK_LIBRARY)/VC.example [pwd]/VC.edl [list /dev/null [pwd]/Repository SCCS NOBASE] - exec cp $env(WOK_LIBRARY)/VC.tcldef [pwd]/VC.tcl - } else { - puts $astatus - cd $savpwd - } - } - ;# - ;# Create workbench WBNAM - ;# - if { ![wokinfo -x ${FNAM}:${WSNAM}:${WBNAM}] } { - puts "Creating the workbench : ${FNAM}:${WSNAM}:${WBNAM}" - wokcd ${FNAM}:${WSNAM} - set WBROOT $HOME_ENTITIES/${FNAM}/${WSNAM}/${WBNAM} - if { "$IMPORT_DIR" != {} } { - set WBROOT [file join [file dirname $IMPORT_DIR] ${WBNAM}] - puts "Renaming $IMPORT_DIR to $WBROOT" - frename $IMPORT_DIR $WBROOT - puts " the Home directory of your ${WBNAM} WorkBench is now : ${WBROOT}" - } - if [ catch {wcreate -DHome=$WBROOT -d ${WBNAM} } astatus] { - puts $astatus - cd $savpwd - exit - } - } - - - if { "$IMPORT_DIR" != {} } { - wokcd -PAdm ${FNAM}:${WSNAM}:${WBNAM} - foreach udl [glob -nocomplain *.UDLIST] { - puts "Importing units from module $udl" - foreach unit [FileToList $udl] { - if [ catch { ucreate -[lindex $unit 0] [lindex $unit 1] } astatus] { - puts $astatus - } - } - } - } - cd $savpwd -} - -set HOME_ENTITIES [lindex $argv 0] -set FNAM [lindex $argv 1] -set WSNAM [lindex $argv 2] -set WBNAM [lindex $argv 3] -set IMPORT_DIR [lindex $argv 4] - -CreateFactory $HOME_ENTITIES $FNAM $WSNAM $WBNAM $IMPORT_DIR - -exit - +;# +;# This file is used to create from scratch a minimal set of WOK entities +;# A Factory, a warehouse, a workshop and a workbench. It can be used to import +;# sources files from a previously Cascade download. +;# this script has 5 arguments: +;# HOME_ENTITIES is a directory name. This is the name where all further entities +;# will be created. +;# FNAM is a factory name ( a factory is a set of workshop and a warehouse) +;# WSNAM is a workshop name ( a workshop is dedicated to contains a workbenches tree) +;# WBNAM is a workbench name. Typically it will be the name of the root workbench. +;# IMPORT_DIR is a directory name. If IMPORT_DIR is /dev/null no import is done +;# and WBNAM is created as empty workbench. To populate it with development units +;# please refer to the Wok documentation. +;# +source $env(WOKHOME)/site/tclshrc_Wok +proc FileToList { path {sort 0} {trim 0} {purge 0} {emptl 1} } { + if ![ catch { set id [ open $path r ] } ] { + set l {} + while {[gets $id line] >= 0 } { + if { $trim } { + regsub -all {[ ]+} $line " " line + } + if { $emptl } { + if { [string length ${line}] != 0 } { + lappend l $line + } + } else { + lappend l $line + } + } + close $id + if { $sort } { + return [lsort $l] + } else { + return $l + } + } else { + return {} + } +} +;# +;# +;# +proc lreplace { fin fout ls1s2 } { + if { [catch { set in [ open $fin r ] } errin] == 0 } { + if { [catch { set out [ open $fout w ] } errout] == 0 } { + set strin [read $in [file size $fin]] + close $in + foreach [list s1 s2] $ls1s2 { + set done 0 + if { [set nbsub [regsub -all -- $s1 $strin $s2 strout]] != 0 } { + set done 1 + } + set strin $strout + } + puts $out $strout + close $out + return $done + } else { + puts stderr "Error: $errout" + return 0 + } + } else { + puts stderr "Error: $errin" + return 0 + } +} +;# +;# +proc CreateFactory { HOME_ENTITIES FNAM WSNAM WBNAM IMPORT_DIR } { + + package require Wok + package require Ms + global env + + if [catch { package require Tclx } TclXHere] { + puts stderr "Warning : You'll need package TclX to correctly use WOK." + puts stderr " Check for variable TCLLIBPATH" + } + if [catch { package require Expect } ExpectHere] { + puts stderr "Warning : You'll need package Expect to use WOK integration package.." + puts stderr " Check for variable TCLLIBPATH" + } + + ;# + set savpwd [pwd] + + ;# + ;# Create factory FNAM and warehouse attached to it + ;# + if { ![wokinfo -x ${FNAM}] } { + puts "Creating the factory : ${FNAM}" + if ![catch {fcreate -DHome=$HOME_ENTITIES/${FNAM} -d ${FNAM} } astatus ] { + wokcd ${FNAM} + if { ![wokinfo -x ${FNAM}:BAG] } { + puts "Creating the WareHouse in $HOME_ENTITIES/${FNAM}/BAG" + if [ catch {Wcreate -DHome=$HOME_ENTITIES/${FNAM}/BAG -d -DAdm=$HOME_ENTITIES/${FNAM}/BAG/adm BAG } astatus ] { + puts $astatus + cd $savpwd + } + } + } else { + puts $astatus + cd $savpwd + } + } + + ;# + ;# Create workshop WSNAM + ;# + if { ![wokinfo -x ${FNAM}:${WSNAM}] } { + puts "Creating the workshop : ${FNAM}:${WSNAM}" + if ![ catch {screate -DHome=$HOME_ENTITIES/${FNAM}/${WSNAM} -d ${WSNAM} } astatus] { + wokcd -PAdm ${FNAM}:${WSNAM} + catch { mkdir Repository } + lreplace $env(WOK_LIBRARY)/VC.example [pwd]/VC.edl [list /dev/null [pwd]/Repository SCCS NOBASE] + exec cp $env(WOK_LIBRARY)/VC.tcldef [pwd]/VC.tcl + } else { + puts $astatus + cd $savpwd + } + } + ;# + ;# Create workbench WBNAM + ;# + if { ![wokinfo -x ${FNAM}:${WSNAM}:${WBNAM}] } { + puts "Creating the workbench : ${FNAM}:${WSNAM}:${WBNAM}" + wokcd ${FNAM}:${WSNAM} + set WBROOT $HOME_ENTITIES/${FNAM}/${WSNAM}/${WBNAM} + #if { "$IMPORT_DIR" != {} } { + #set WBROOT [file join [file dirname $IMPORT_DIR] ${WBNAM}] + #puts "Renaming $IMPORT_DIR to $WBROOT" + #frename $IMPORT_DIR $WBROOT + #puts " the Home directory of your ${WBNAM} WorkBench is now : ${WBROOT}" + #} + if [ catch {wcreate -DHome=$IMPORT_DIR -d ${WBNAM} } astatus] { + puts $astatus + cd $savpwd + exit + } + } + + + if { "$IMPORT_DIR" != {} } { + wokcd -PAdm ${FNAM}:${WSNAM}:${WBNAM} + foreach udl [glob -nocomplain *.UDLIST] { + puts "Importing units from module $udl" + foreach unit [FileToList $udl] { + if [ catch { ucreate -[lindex $unit 0] [lindex $unit 1] } astatus] { + puts $astatus + } + } + } + } + cd $savpwd +} + +#set HOME_ENTITIES [lindex $argv 0] +#set FNAM [lindex $argv 1] +#set WSNAM [lindex $argv 2] +#set WBNAM [lindex $argv 3] +#set IMPORT_DIR [lindex $argv 4] +set CASHOME [file dirname $env(CASROOT)/.] + +CreateFactory $env(WOK_ROOTADMDIR) OS OCC51 ros $CASHOME + +#exit + diff --git a/src/WOKsite/FILES b/src/WOKsite/FILES index 06c29fe..551122d 100755 --- a/src/WOKsite/FILES +++ b/src/WOKsite/FILES @@ -8,4 +8,5 @@ srcinc:::wokcfg srcinc:::INSTALL srcinc:::wok.csh srcinc:::wok.bat - +srcinc:::wokinit.bat +srcinc:::cmd-input.tcl diff --git a/src/WOKsite/tclshrc_Wok b/src/WOKsite/tclshrc_Wok index 696f60c..609afe5 100755 --- a/src/WOKsite/tclshrc_Wok +++ b/src/WOKsite/tclshrc_Wok @@ -42,12 +42,13 @@ ;# choose. ;# global env tcl_platform +set env(PATH) $env(Path) 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)] } { +if { "$tcl_platform(platform)" == "windows" && ![info exists env(Path)] } { puts stderr "You must set PATH to point where you have installed Wok" exit } @@ -64,7 +65,7 @@ if { "$tcl_platform(platform)" == "unix" } { if { "$tcl_platform(platform)" == "windows" } { set sprtor ";" set fmtshr "%s.dll" - set wrk [split $env(PATH) $sprtor] + set wrk [split $env(Path) $sprtor] set msgnotfound "Please check your variable PATH" } ;# @@ -91,6 +92,10 @@ set wok_ptfm [file tail $wokfound] lappend auto_path $wok_library package require Wok package require Ms +package require Tclx +if { "$tcl_platform(os)" == "SunOS" } { + package require Expect +} ;# ;# Where tcl and edl file of wok reside. ;# @@ -120,14 +125,14 @@ if {![info exists env(WOK_ROOTADMDIR)] } { return } } else { - puts stderr "Using $env(WOKHOME)/wok_entities for working entities." + #puts stderr "Using $env(WOKHOME)/wok_entities for working entities." } } else { if ![file exists $env(WOK_ROOTADMDIR)] { puts stderr "The directory $env(WOK_ROOTADMDIR) can not be found" return } - puts stderr "Using variable WOK_ROOTADMDIR = $env(WOK_ROOTADMDIR) for working entities." + #puts stderr "Using variable WOK_ROOTADMDIR = $env(WOK_ROOTADMDIR) for working entities." } ;# @@ -162,3 +167,8 @@ set env(WOK_SESSIONID) $env(HOME)/.wok set tcl_prompt1 {if {[info commands wokcd] != ""} then \ {puts -nonewline stdout "[wokcd]> "} else \ {puts -nonewline stdout "tclsh> "}} +if { "$tcl_platform(platform)" == "windows" } { + source $env(WOKHOME)/lib/cmd-input.tcl +} +cd $env(WOK_ROOTADMDIR) +wokclose -a -- 2.39.5