Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

yada.tcl

Go to the documentation of this file.
00001 #!/bin/sh 00002 #\ 00003 exec wish "$0" "$@" # ---------------------------------------------------------------------------- # Copyright (C) 1997-2004 The CDG Team <cdg@nats.informatik.uni-hamburg.de> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # ---------------------------------------------------------------------------- ## ---------------------------------------------------------------------------- ## \mainpage The YADA Reference Manual ## \image html yadalogo-white.gif ## $Id: yada.tcl,v 1.19 2004/02/25 14:42:10 micha Exp $ ## \section Overview Overview ## YADA is Yet Another Data Analyser for the CDG parsing environment. Its purpose ## is to ease the task of parser evaluation by allowing the user to configure ## series of experiments where problem instances are computed and the resulting ## data is presented in a pleasent way. The data generated can be exported ## into an external spredsheat application or converted into raw data for gnuplot, or ## what ever one likes. ## ## YADA offers a document oriented interface where \a documents of certain types ## are loadable in order to generate and display the data with them. During ## runtime an arbitrary number of documents is loadeable each of which can ## visualize different data or even the same data from a different perspectivity. ## Thus YADA is easily extensible by implementing new document types which the ## user then can instanciate. At the time of this writing the following document ## types are implemented: ## - YadaRunner: this is the most frequently used document type for a straight ## forward experiment setup. ## - YadaGlsStats: this document type allows the user to examin experiments with ## a specific focus on the GLS parsing flavour displaying additional ## statistics only meaningfull for GLS ## - YadaDifference: this also is a runnable document type as the YadaRunner ## where two experiments are run alternatingly in one document. ## Results from both experiments might be compared immediately. ## - YadaRanking: this document type allows the user to load the data from more than ## one experiment per document and therefor visualize complete ## experimental series. ## ## In terms of the implementation there are more document types as can be seen in ## the \link YadaDocuments YadaDocuments module documentation \endlink . ## ## \section Reading How to read this document ## To make your way thru this reference document you might start at the ## modules section, i.e. ## \link YadaDocuments YadaDocuments \endlink and the ## \link YadaScheduler YadaScheduler \endlink. ## These try to divide the application into logical parts. Understanding ## the applications architecture might also be cleared by reading \ref yada.tcl and ## YadaMain. Take a glimpse at the ## class hierarchy afterwards and this reference manual hopefully becomes understandeable. ## ## \section Requirements Requirements ## YADA is implemented in Tcl/Tk, more precisely in Itcl/Itk, the object oriented extension ## to Tcl/Tk (comment: no more tcl without itcl;), also using the Iwidgets set of megawidges. ## In addition we use the TkTable widget by Jeffrey Hobbs, and the TDom extension by Jochen Loewer. ## YADA is known to run with ## - tcl-8.3, tk-8.3: http://tcl.sourceforge.net ## - tktable-2.7: http://tktable.sourceforge.net ## - tdom-0.5apha: loewerj@hotmail.com ## ## I know there are already more recent versions of that software but, you know, ## never touch a running system. You might try YADA with new versions of the components. ## Tell me if that was successfull. ## ## By the way, YADA is developed on linux and is \a not intended to run on MS Windows ## although TclTk is available on MS Windows. Note that I will not try to code tcl ## platform-independent in order to support MS Windows. YADA will be kept in a shape ## that it runs on unices, no MS Windows. ## ## \section Environment Environment Variables ## As you might already have look at the YADA startup script yada.sh there are a few ## shell environment varialbes which you might be interested in: ## - \b YADA_LIB : ## This is the location where the YADA application scripts are located. Obviously, a ## correct value of this variable is obligatory. ## - \b YADA_IMAGES : ## This is the location where the images are put. If the variable is not set, it defaults ## to \c $YADA_LIB/images. Still not a valid location results in a programm abortion. ## - \b YADA_PATH : ## This variable points to the location, where the yada data is stored needed for ## your experiments, that is the cdgp binary, configuration files, logfiles and xml files. ## If this directory does not exist the first time you start YADA, it is created. ## - \b YADA_ETC : ## This variable points to the location where your configuration are, that is where ## \c experiments.tcl, \c grammar.tcl and machines.tcl are. If not set it defaults to ## \c $YADA_PATH/etc. If the directory is not existing it will be created. ## - \b YADA_DATA : ## This is the path where the database of your experiments is put. Use the value of ## this variable in \c experiments.tcl to organize the data hierarchy properly from here on. ## If this variable is not set it defaults to \c $YADA_PATH/data. A non existing ## directory location is tried to be created. ## - \b YADA_GRAMMARS : ## This is the location where your dedicated CDG grammar copies might be put to. If ## the variable is not set, it defaults to \c $YADA_PATH/grammars. If the location ## still does not exist, YADA will refuse to start. ## - \b YADA_TMP : ## Here YADA and possibly you, the user might put temporarily files. Could easily be ## of the value /tmp but defaults to \c $YADA_PATH/tmp if not set. ## - \b YADA_CDGP : ## This is the full path to a default cdgp binary. ## - \b YADA_EDITOR : ## This is the command to start your favorit editor, that YADA should adress in case of. ## ## \section BugTracking Bug Tracking ## See http://nats-wiki.informatik.uni-hamburg.de/twiki/bin/view/Papa/YadaTracking ## ## \section Coding Coding and documenting style ## Ok, what's to say about coding? Most of the time too much and oneself is leaving ## such a guide over the time. Here are my 2cent coding style guidelines I tried ## to follow til now in YADA: ## - all classes are defined in a separate file, no two or more classes in one ## file. ## - yada classes are named using the \c Yada prefix ## - if a class used in YADA is not named with the prefix \c Yada, then this ## has the simple reason that these clases are borowed from somewhere else ## or are useable outside of YADA aswell (example: FileSelector) ## - private class members, i.e. methods, procs and variables start with a _ ## (underscore) ## - try to think about the logical entity a new class belongs to and add it to ## a module (using the grouping commands in doxygen) ## ## Hm, I'll add more if I come accross something important enuf to be mentioned here. ## ## \section Copyright Copyright ## Copyright (C) 1997-2004 The CDG Team <cdg@nats.informatik.uni-hamburg.de> ## ## \verbatim ## YADA is licensed under the GPL. ## ## This application is free software; as a special exception the author gives ## unlimited permission to copy and/or distribute it, with or without ## modifications, as long as this notice is preserved. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY, to the extent permitted by law; without even the ## implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ## \endverbatim ## ---------------------------------------------------------------------------- ## ## ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Module definitions # ---------------------------------------------------------------------------- ## ---------------------------------------------------------------------------- ## \defgroup YadaDocuments YadaDocuments - embedded objects ## This module groups together all classes that form the so called YadaDocuments ## In here we'd like to further separate two groups of documents: ## the YadaConfiguration, dealing with configuration and the YadaRunnableDocuments ## which are in a way active as they are used to generate the data they consist ## of. The YadaDocuments left here are either abstract or not in the sence ## active as runnable documents are ment to be. So the YadaRanking for example ## does not spawn YadaJobs on its own but collects all the data that once has ## been produced by YadaRunnableDocuments. Well and the YadaStartUp splash screen ## simply is temporarily embedded and removed at startup time in the same way ## as the normal documents are embedded into the gui. ## ---------------------------------------------------------------------------- ## ---------------------------------------------------------------------------- ## \defgroup YadaConfiguration YadaConfiguration - managing configurations ## \ingroup YadaDocuments ## This submodule spans the YadaDocuments that are used for configuring a set of ## YadaConfigItem objects like the YadaExperiment, YadaGrammar or YadaMachine objects. ## YadaConfigDocument objects are not embedded into the application directly like the ## other YadaDocuments but first into a YadaConfig object. ## The YadaConfigDocument objects themselves are therefore ## not freely instanciateable as the YadaRunnableDocuments as we always need ## access to the objects starting via the YadaConfig gui. ## YadaConfigDocument contain a set of YadaConfigItem objects. And in the case ## of the CDG grammars we have configurations object inside the YadaGrammar, that ## is the YadaWordgraph objects. ## ---------------------------------------------------------------------------- ## ---------------------------------------------------------------------------- ## \defgroup YadaRunnableDocuments YadaRunnableDocuments - also called active documents ## \ingroup YadaDocuments ## This group of classes are implementing so called documents that are \a runnable, ## that is with their help YadaJob objects are generated and started on YadaMachine ## objects. ## ---------------------------------------------------------------------------- ## ---------------------------------------------------------------------------- ## \defgroup YadaScheduler YadaScheduler - the data workhorse ## This module bundles the classes involved to start YadaJob objects on ## problem instances (YadaWordgraph objects), and span the workload on ## a set of machines. ##---------------------------------------------------------------------------- ## \file yada.tcl ## The yada startup script. ## From here on the shell environment is examined and the YadaMain object is ## created. Afterwards the application is initialized via YadaMain::init(). ##---------------------------------------------------------------------------- # the yada prefix in YADA_PATH if {![info exists env(YADA_PATH)]} { set env(YADA_PATH) "~/yada" 00004 } 00005 if {![file exists $env(YADA_PATH)]} { 00006 puts "INFO: YADA_PATH not set, creating directory $env(YADA_PATH)" 00007 file mkdir $env(YADA_PATH) 00008 } 00009 00010 # the yada lib in YADA_LIB 00011 if {![info exists env(YADA_LIB)]} { 00012 set env(YADA_LIB) [file join $env(YADA_PATH) lib] 00013 } 00014 if {![file exists $env(YADA_LIB)]} { 00015 set env(YADA_LIB) [pwd] 00016 puts "ERROR: yada installation not found" 00017 puts " please set the YADA_LIB environment variable" 00018 puts " or link it to [file $env(YADA_PATH) lib]" 00019 exit 1 00020 } 00021 00022 # the yada images in YADA_IMAGES 00023 if {![info exists env(YADA_IMAGES)]} { 00024 set env(YADA_IMAGES) [file join $env(YADA_LIB) images] 00025 } 00026 if {![file exists $env(YADA_IMAGES)]} { 00027 puts "ERROR: can't locate the yada images" 00028 puts " please set the YADA_IMAGES environment variable" 00029 puts " or link them to [file join $env(YADA_LIB) images" 00030 exit 1 00031 } 00032 00033 # the yada temp in YADA_TMP 00034 if {![info exists env(YADA_TMP)]} { 00035 set env(YADA_TMP) [file join $env(YADA_PATH) tmp] 00036 } 00037 if {![file exists $env(YADA_TMP)]} { 00038 puts "INFO: YADA_TMP not set, creating directory $env(YADA_TMP)" 00039 file mkdir $env(YADA_TMP) 00040 } 00041 00042 # the yada etc in YADA_ETC 00043 if {![info exists env(YADA_ETC)]} { 00044 set env(YADA_ETC) [file join $env(YADA_PATH) etc] 00045 } 00046 if {![file exists $env(YADA_ETC)]} { 00047 puts "INFO: YADA_ETC not set, creating directory $env(YADA_ETC)" 00048 file mkdir $env(YADA_ETC) 00049 } 00050 00051 # the yada data" 00052 if {![info exists env(YADA_DATA)]} { 00053 set env(YADA_DATA) [file join $env(YADA_PATH) data] 00054 } 00055 if {![file exists $env(YADA_DATA)]} { 00056 puts "INFO: YADA_DATA not set, creating directory $env(YADA_DATA)" 00057 file mkdir $env(YADA_DATA) 00058 } 00059 00060 00061 # the yada editor in YADA_EDITOR 00062 if {![info exists env(YADA_EDITOR)]} { 00063 set env(YADA_EDITOR) "gvim" 00064 puts "INFO: YADA_EDITOR not set, using $env(YADA_EDITOR)" 00065 } 00066 00067 # the grammars 00068 if {![info exists env(YADA_GRAMMARS)]} { 00069 set env(YADA_GRAMMARS) [file join $YADA_PATH grammars] 00070 } 00071 if {![file exists $env(YADA_GRAMMARS)]} { 00072 puts "ERROR: don't know where your grammars are" 00073 puts " please set the YADA_GRAMMARS environment variable" 00074 puts " or link them to [file join $YADA_PATH grammars]." 00075 exit 1 00076 } 00077 00078 # the cdgp default binary 00079 if {![info exists env(YADA_CDGP)]} { 00080 set env(YADA_CDGP) [file join $YADA_PATH bin cdgp ] 00081 } 00082 00083 #---------------------------------------------------------------------------- 00084 # load additional packages 00085 #---------------------------------------------------------------------------- 00086 lappend auto_path $env(YADA_LIB) 00087 00088 package require tdom 00089 package require Iwidgets 00090 package require Tktable 00091 set tk_strictMotif 1 00092 00093 00094 #---------------------------------------------------------------------------- 00095 # build the application 00096 #---------------------------------------------------------------------------- 00097 00098 source [file join $env(YADA_LIB) YadaOptions.tcl] 00099 00100 wm withdraw . 00101 scan [wm maxsize .] "%d %d" maxx maxy 00102 set maxy [expr $maxy - 50] 00103 wm geometry . ${maxx}x${maxy}+0+0 00104 wm minsize . 800 600 00105 wm title . Yada 00106 00107 # the main window 00108 set yadaMain [YadaMain .main -labelfont {-adobe-helvetica-bold-r-normal--12-*-*-*-*-*-*-*} ] 00109 pack $yadaMain -expand 1 -fill both 00110 00111 # the fileselector 00112 FileSelector .fileSelector \ 00113 -title "File Selector" \ 00114 -width 500 \ 00115 -height 400 \ 00116 -master "." \ 00117 -modality application 00118 00119 # the tooltip balloon 00120 Balloon .balloon \ 00121 -textforeground black \ 00122 -textbackground lightyellow \ 00123 -anchor nw \ 00124 -delay 100 \ 00125 -font {-adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-*} \ 00126 -padx 9 \ 00127 -pady 3 \ 00128 -relief raised \ 00129 -borderwidth 1 00130 00131 source [file join $env(YADA_LIB) bugfixes.tcl] 00132 00133 # if we run on mosix then lock the yada to the homenode 00134 set lockFileName "/proc/[pid]/lock" 00135 if {[file exists $lockFileName]} { 00136 set lockFile [open $lockFileName w] 00137 puts -nonewline $lockFile 1 00138 close $lockFile 00139 } 00140 00141 wm deiconify . 00142 .main init 00143

YADA 2.0-alpha (20 Oct 2004)