home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
communicat.tcl
< prev
next >
Wrap
Text File
|
1997-07-21
|
3KB
|
116 lines
#---------------------------------------------------------------------------
#
# (c) Westmount Technology 1994
#
# File: @(#)communicat.tcl /main/titanic/3
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)communicat.tcl /main/titanic/3 21 Jul 1997 Copyright 1994 Westmount Technology
# Start user added include file section
require "systemutil.tcl"
# End user added include file section
# Definition of Communicator class that contains
# utilities to communicate with wictk tools.
Class Communicator : {Object} {
method destructor
constructor
method stop
}
method Communicator::destructor {this} {
# Start destructor user section
# End destructor user section
}
constructor Communicator {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
# Return the M4 variables in a list.
#
proc Communicator::getEnv {} {
global env
set environment ""
# read all env variables
if {[info exists env]} {
foreach i [array names env] {
lappend environment [list $i $env($i)]
}
}
if [isCommand ORB::currentProcessId] {
lappend environment [list M4_parent_pid [ORB::currentProcessId]]
}
return $environment
}
# Return the M4 variables and their values in a list.
#
proc Communicator::getM4Env {} {
set M4environment ""
m4_var foreach m4var {
lappend M4environment [list $m4var [m4_var get $m4var]]
}
return $M4environment
}
# Set the environment and M4 variables according to 'environment'.
#
#
proc Communicator::setEnv {environment} {
global env
if {[info exists env]} {
foreach i [array names env] {
unset env($i)
}
}
foreach envVar $environment {
set env([lindex $envVar 0]) [lindex $envVar 1]
}
}
proc Communicator::setM4Env {m4env} {
# No longer necessary: child processes construct their M4 env
# correctly when all os-env variables are transmitted.
}
# Syntax: interp <name> [<host>]
# Find a (running) interpreter specified by <name> (and <host>).
#
proc Communicator::interp {name {host ""}} {
set myInterp "[get_comm_name]"
if {"$name" == ""} {return ""}
if {"$host" == ""} {set host "[lindex $myInterp 1]"}
set tools [interps]
foreach tool $tools {
if {("[lindex $tool 0]" != "$name") ||
("[lindex $tool 1]" != "$host") ||
("[lindex $tool 2]" != "[lindex $myInterp 2]") ||
(! [isRunning "$tool"])} continue
return "$tool"
}
return "$name $host [lindex $myInterp 2]"
}
method Communicator::stop {this} {
$this delete
exit
}
# Do not delete this line -- regeneration end marker