XOTclIDE User Guide | ||
---|---|---|
<<< Previous | Extended Features | Next >>> |
In XOTclIDE there are 3 ways to import your Tcl sources in XOTclIDE components. The section describes how these importing function works and what are their limits. Generally if your Tcl program is good structured and have no or a few commands in global script context beside class or procedure definitions when the importing works out the box.
There are 2 main importing function in XOTclIDE both accessible from Component Browser
Component->Load Package With this function you can load every Tcl package accessible in your Tcl system per package require name.
Component->Import Source This importing function can evaluate every script from file system. It is the same as using command source filename.
Lets see on same example of Tcl script in file myapp.tcl that should be imported
# This is great script that I want to reuse in XOTclIDE # Author: old Tcl'er # Revision: package require Tk # set debug 1 set color red set configfile myapp.conf if {![file exists $myapp.conf]} { # error "can not find config file $configfile" } # Starting Applikation # parameters: None proc startApp {} { buton .re -text "Quit" -command "quite" # ... your programm } ... many other defined procedures # next line start the application startApp |
# automatically generated from XOTclIDE package provide importExample 0.1 @ tclproc startApp idemeta struct importExample default proc startApp {} { # button .re -text "Quit" -command "quite" # ... your programm } |
Another problem is the evaluation of Tcl commands in global context. In XOTclIDE you should have one one line of such evaluation that is coded in configuration map (see the Section called Configurations Management). To enable proper import the definition block should be moved to special new procedure. The Example above could see as follow.
# This is great script that I want to reuse in XOTclIDE # Author: old Tcl'er # Revision: package require Tk # set debug 1 proc defineGlobalConstans {} { global color configfile set color red set configfile myapp.conf } proc checkConfigFile {} { global configfile if {![file exists $configfile]} { # error "can not find config file $configfile" } } # Starting Applikation # parameters: None proc startApp {} { buton .re -text "Quit" -command "quite" # ... your programm } proc basicStartApp {} { defineGlobalConstans checkConfigFile startApp } ... many other defined procedures # next line start the application basicStartApp |
To import a regular tcl package use menu Component->Load Package in Component Browser. The new components with name of imported package are created. Also nested packages (That are loaded from package with package require).
The new created components have names that correspond to script file names (without extension). Also nested script evaluation or package require commands are respected. Before sourcing the script XOTclIDE change the working directory to path of script file. The application will normal start. The problem can appears when the application use toplevel window. Toplevel window is already used by XOTclIDE Transcript window. If an error occurs while evaluation the importing is interrupted with error message.
If procedures are defined in :: namespace then their are added to Tcl-Proc-Group named "default". The procedure with name "mynamespace::myname" with be added to Tcl-Proc-Group with name "mynamespace".
The another way to importing your application is to start XOTclIDE from your application and introspect it with XOTclIDE. XOTclIDE can import procedures and XOTcl object classes directly from Tcl interpreter. To start XOTclIDE from your application you can use START.tcl script in XOTclIDE directory. Please change the working directory to the XOTclIDE directory (with START.tcl script).
For importing code from your application you must create first new component where you want to import all procedures and classes from Interpreter. To import Tcl procedure from Tcl interpreter select the component first where you want to import to and use menu Command->Low Level Functions->Register Tcl Proc from Interp in Component Browser
To import XOTcl Classes from Interpreter select the component and choose menu Command->Low level Functions->Register Class from Interp in Component Browser
Importing application on this way demand more work but if you want to import only a part of application or the application is in format that you can not read it, it is good chose
Consider the example below
# This procedure make magic initialization of # X Module. # Warning: proc initModuleX {{path {}} { # # } |
One of main advantages of XOTclIDE is ease customizing of XOTclIDE for users needs. Indeed XOTclIDE was developed with itself. It is no problem to develop change XOTclIDE in runing time. Many of XOTclIDE components are loaded dynamic at runing time only on demand. In menu System->Plug Ins are all currently registered plug-ins accesible. The plug ins are normal components the registration and start scripts are specified per file pluginslist.txt in XOTclIDE directory.
Following Plug-Ins are currently delivered with XOTclIDE
Unit Test Framework programmed after Smalltalk SUnit (JUnit, NUnit). See also Unit Tests Homepage
Tests of XOTclIDE itself
Small XOTcl Application taken from Tcl Wiki
Generate HTML Source Code Documentation from Source Comments
Importing tool described in the Section called Importing Tcl comments
Can import code sniplets form Tcl wiki Tcl Wiki
This tool extend the functionality of Application Deployer Wizard. It can generate TclKit Distributions or standalone Starpacks directly from XOTclIDE. It work properly only form XOTclIDE TclKit version or if TclKit envirorment are installed properly in your Tcl system
This tool can inspect all Tk windows. It can be used to view and change all configuration of every Tk window. Tk Inspector includes also widget serializator that can be used to serialize every windows and their descend to Tcl script that can be used as code snippet.
Ideal for edit and test short Tcl-scripts that all contents are evaluated in global context. You can use all advantages of XOTclIDE: syntax highlighting, syntax check, code completion. The script can be evaluated in slave interpreter.
GUI helper to SQL access to all databases supported by XOTclIDE. Additional 2 Lists-Views show all table names and columns names (schema of DB). The result will be displayed in TkTable-Widget. Every cell can be also viewed in separately view.
This plug-in is adapted GPL program written by L. Riesterer original source
<<< Previous | Home | Next >>> |
Extended Debugger | Up | Additional Informations |