Chapter 4. Extended Features

Table of Contents

Version Control System
Benefits of Version Control
Base Characteristics
Database Schema of Version System
Definitions (Editions,Versions)
Using Version System, Main Functions
Changes Browser
Component Loader
Installing Version Control System
Syntax Checking
Reason for syntax checking in Tcl/XOTcl
Syntax checker implementation
Example Tcl procedures
Example XOTcl methods
Syntax Checking while editing
Syntax Checker Browser
Tcl/XOTcl Parser
How to extend syntax interpretation
Magic strings for checker
Checking Referenced Object Calls
Configurations Management
Main Features
Configuration Map - Without Version Control System
Using Configurations Maps
Deploying Application
Configuration Browser - with Version Control System
Debugger Browser
Stack Error Browser
Tracker Browser
Variable access tracking and watching
Importing Tcl Projects into XOTclIDE Components
Importing by definition tracking
Importing by System Introspection
Importing Tcl comments
Plug-ins Architecture

Version Control System

As soon as you develop more than “Hallo World” programs you need a version control system. You need it to save and archive your code and follow the code changes. Version Control gives you a guarantee of returning to a former code state so you can experiment with your code. Version control is an implicit requirement for many extreme programming practices. In XOTclIDE all code changes are updated in version control immediately so you need not worry about saving your source. The Version Control System is also a code repository that can be centralized for many developers. Components can be loaded and executed directly from the version control repository without the need to save them as files in a file system.

Benefits of Version Control

  • database oriented - all information is stored in database

  • central code repository - no file copying

  • suitable for big projects - able to browse in thousands of lines of code

  • multiuser capable

  • flexible as XOTcl - no locks, no commit, developed specially for object oriented languages like XOTcl.

Base Characteristics

  • based on relational database (currently mysql, postgres, sqlite or odbc)

  • XOTcl programs are stored and managed corresponding to their structure. (Components, Classes/Objects, Methods).

  • Every change in your system is stored on the fly. You need not ask the system to update the structures.

  • If you add or modify any method, a new row is inserted into the database. The old method version is normally not deleted. You can always return to every state in the past (no comment and uncomment of code pieces).

  • Stores not only sources but also additional data as documentation, comments, meta data.


Figure 4.1. Version System Principle

Version System Principle

XOTclIDE Programs are structured in Components (a concept specific to XOTclIDE), Classes/Objects and Methods (see the section called “Building an Application”). All these structure elements are stored and managed separately in the database. A class can have many versions without having to store a complete class definition in a separate text file (as is usual in cvs if a class is one file) with many redundant copies even though only one method differs. Normally the programmer doesn't care about version control. He just develops. The version control uses so called optimistic locking. If the programmer thinks the state of a component or class is stable and ready to be marked he can “version” this component or class. After this he can return to this state or recognize changes among different versions.

Database Schema of Version System

Figure 4.2. Version System ER Diagram

Version System ER Diagram

There are m:n relationship between Components, Objects/Classes and Methods, meaning one method version can belong to m object-versions. This diagram does not include configuration maps. If you know this schema you can formulate queries on the repository directly in SQL. It is quite easy to find the newest methods or statistics about code development with simple SQL queries.

The object attribute “deforder” specifies the order of loading Objects/Classes into an interpreter.

The ComponentRequire entity maps the requirements for a single component version. The information that a special component version needs a special version of another component is not stored.

Version info attributes are intended to store short text information for developer about the version and are not used to identify entities.

Definitions (Editions,Versions)

An Edition is a piece you can work on. There are Component, Object and Method editions. Editions can be changed. Methods can only have editions.

Versions are frozen editions which means they cannot be modified. A single class version always has the same methods. To freeze an edition you have to version it. To modify a versioned class you must open a new edition of the class. This new class edition is based on the last version of the class.

Using Version System, Main Functions

The following functions are available on the menu for most structure items (Components, Objects, Methods).

  • Available - Show all items in database. All Components, all objects, and all methods that belong to the selected object. You can choose a edition and load it into the system so you can find and reload the methods you have deleted.

  • Editions - show all editions of currently selected item (Component, Object, Method). You can load your chosen version into the system.

  • Changes - start the Changes Browser to show changes compared to another edition in the database.

  • Load Previous - you can return to a previous edition. For methods you can simply discard the latest changes.

  • Version - Freeze current selected edition. (cvs tag or labels) You can version only components and classes/objects. (It makes no sense for methods). You can always return to this state of the class or component.

  • New Edition - to develop a versioned edition you must make a new edition. The system makes a working copy of a version.

  • Version Info - Show a small info dialog. You can specify the version string which can be 30 characters long. The first number will be automatically incremented by opening a new edition. This number is used as version number for Tcl packages.

The functions below are available only for components:

  • Import - Install a package into repository. Probably loaded per load package by package require into database.

  • Requirements - Show and edit the required components for a selected component. The requirements are set automatically. Normally you do not need to change them.

Changes Browser

You can see the differences between this version and another version. It is diff command for XOTclIDE. In figure Figure 4.3, “Changes Browser” we can see the changes between class versions of class IDECore. In the method list are shown all instance methods with differences. Since the method rekBuildDefList is selected in the text area we can see (yellow selection) the exact differences.

Figure 4.3. Changes Browser

Changes Browser

Component Loader

You can execute programs directly by loading them from the Version Control System. It is not necessary to deploy your application as a set of files. This makes the management of many client systems very easy but the loading time can increase. CompLoader.tcl is a small independent script that can connect to repository, load the components specified by a configuration map and execute them.

Usage: CompLoader.tcl [-nodialog] {-ignoreprefs] {-nosynchronize] [-help] [-preferences list]


do not read preferences


no IDE self developing mode


no user interaction while connecting to db

-preferences string

overwrite preferences (use keyed list)


show all options

Installing Version Control System

XOTclIDE supports the following databases as repository

  • mysql

  • postgres

  • odbc

  • sqlite

The Tclkit distribution (Starpack) comes with sqlite. I recommend using mysql because it is my primary developing system and the best tested.

To get version control on a Linux system you must:

  • Install mysql database. I recommend using RPM packages for your distribution.

  • Install mysqltcl extension to access mysql from tcl. To compile it yourself you need header files for mysql database (for redhat the package mysql-devel). There are also RPMs for Linux available on the mysqltcl site.

  • Run the installer tool installVC.tcl. It can check the database connection, specify the connect parameter, install tables and copy components to repository. Then you can start XotclIDE with XotclIDEDB or XotclIDEFromDB. The first connects to the database after loading itself using package require. XotclIDEFromDB tries to load the entire application from DB.