home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
moduledb.tcl
< prev
next >
Wrap
Text File
|
1997-10-03
|
4KB
|
135 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)moduledb.tcl /main/titanic/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)moduledb.tcl /main/titanic/2 3 Oct 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
OtkRegister::license
require "moduledbdi.tcl"
require "selmodfilt.tcl"
# End user added include file section
Class ModuleDB : {GCObject} {
constructor
method destructor
method getModulePropDict
method getModulePropNames
method getModulePaths
method getFilteredModulePaths
method isValidModule
method getModuleDBDirInfo
method getModuleDBPathInfo
method getModDirInfo
method setModDirInfo
method removeModDirInfo
attribute defaultModDir
attribute modDirInfo
}
global ModuleDB::instance
set ModuleDB::instance ""
constructor ModuleDB {class this} {
set this [GCObject::constructor $class $this]
$this modDirInfo [Dictionary new]
# Start constructor user section
$this defaultModDir [path_name concat [m4_var get M4_home] modules]
# End constructor user section
return $this
}
method ModuleDB::destructor {this} {
# Start destructor user section
# End destructor user section
}
proc ModuleDB::global {} {
global ModuleDB::instance
if {${ModuleDB::instance} == ""} {
set ModuleDB::instance [ModuleDB new]
}
return ${ModuleDB::instance}
}
proc ModuleDB::rehash {} {
global ModuleDB::instance
set ModuleDB::instance [ModuleDB new]
}
method ModuleDB::getModulePropDict {this modulePath} {
set modPathInfo [$this getModuleDBPathInfo $modulePath]
return [$modPathInfo propValue]
}
method ModuleDB::getModulePropNames {this modulePath} {
set modPathInfo [$this getModuleDBPathInfo $modulePath]
return [$modPathInfo propNameSet]
}
method ModuleDB::getModulePaths {this moduleDir} {
set modDirInfo [$this getModuleDBDirInfo $moduleDir]
set pathList [List new]
[$modDirInfo modPathInfo] foreach key modPathInfo {
if ![$modPathInfo isValidModule] {
continue
}
$pathList append [$modPathInfo modulePath]
}
return $pathList
}
method ModuleDB::getFilteredModulePaths {this moduleDir filter} {
set pathList [$this getModulePaths $moduleDir]
set filteredPathList [List new]
$pathList foreach modulePath {
if [$filter passes $modulePath] {
$filteredPathList append $modulePath
}
}
return $filteredPathList
}
method ModuleDB::isValidModule {this modulePath} {
set modPathInfo [$this getModuleDBPathInfo $modulePath]
return [$modPathInfo isValidModule]
}
method ModuleDB::getModuleDBDirInfo {this moduleDir} {
set modDirInfo [$this getModDirInfo $moduleDir]
if {$modDirInfo == ""} {
set modDirInfo [ModuleDBDirInfo new $moduleDir]
$this setModDirInfo $moduleDir $modDirInfo
}
return $modDirInfo
}
method ModuleDB::getModuleDBPathInfo {this modulePath} {
set moduleDir [path_name directory $modulePath]
set modDirInfo [$this getModuleDBDirInfo $moduleDir]
set moduleName [path_name file $modulePath]
return [$modDirInfo getModuleDBPathInfo $moduleName]
}
# Do not delete this line -- regeneration end marker
method ModuleDB::getModDirInfo {this moduleDir} {
return [[$this modDirInfo] set $moduleDir]
}
method ModuleDB::setModDirInfo {this moduleDir newModDirInfo} {
[$this modDirInfo] set $moduleDir $newModDirInfo
}
method ModuleDB::removeModDirInfo {this moduleDir} {
[$this modDirInfo] unset $moduleDir
}