The Tcl Interface to Ical

This document contains a brief description of the Tcl interface to ical. Part of this interface is implemented in C++ and the rest is implemented by Tcl support libraries.

The C++ code exports calendar and item objects to tcl code. A number of operations are provided to create such objects and to manipulate dates and times. In addition, the calendar and item objects have various methods that can be called from tcl code.

Computation Model

Calendars and items are stored persistently on file systems. Copies of these calendars and items are read into ical's address space. The Tcl code operates on these copies through well-defined interfaces. These interfaces contain special operations for saving pending modifications to persistent storage on the file system.

Each user has a main calendar. This main calendar is represented as a calendar object in Tcl code, and persistently as a file stored on the file system. The main calendar contains a list of names of included calendar files. The main calendar file and the included calendar files all contain items. Each item in the main calendar file and the included calendar files is visible as an item object to the Tcl code.

Calendars

The following calendar operations raise errors if the user does not have sufficient permission to perform the required operation. Errors are also raised if specified files do not contain a calendar. Some of these operations also take a calendar file name as an optional argument. If the file name is omitted, then the main calendar file is used.

Arguments named file in the following list are names of Unix files. Arguments named cal are calendar objects created by the ``calendar'' command.

Files and Includes

This section lists the operations for creating and deleting calendar objects from calendar files, and also operations for handling included calendars.

Adding and Removing Items

This section describes the operations for adding and removing items from calendars.

Input and Output

This section describes the operations for reading and writing calendars to persistent storage.

User Preferences

Each calendar file contains a general mapping from option names to string values. This mapping is typically used to store user preferences for ical. Sometimes, however this mapping contains miscellaneous properties of the calendar file.

Queries

The following operations can be used to get listings of various items in a calendar. The range of most of these queries can be controlled by specifying one of the following options: The actual query methods are as follows:

Items

Item objects come in two flavors - appointments and notices. An appointment occurs at a specific time of the day. A notice does not have any associated time of day. For example, a meeting at 3pm on March 27th will be recorded as an appointment while somebody's birthday on March 28th will be recorded as a notice.

Each item object also has associated text and a set of dates on which the item occurs.

Creation and Deletion

The following operations can be used to create and delete items.

Item Occurrences

The following operations can be used to manipulate and query the set of dates on which an item occurs.

Item Properties

The following operations can be used to examine and manipulate various properties of an item. The first few operations apply only to appointments. The remaining operations apply to both appointments and notices.

Dates

Dates are represented in Tcl code as integers from some unspecified date. Therefore the ``expr'' command can be used to manipulate dates by addition and subtraction. Here is a list of other supported operations on dates.

Times

Times are represented in Tcl code as real numbers that give the number of seconds since some unspecified time. Therefore the ``expr'' command can be used to manipulate time values by addition and subtraction. Here is a list of other supported operations on times.

Customization via Hooks

Ical provides a number of hooks. Users can attach code to these hooks to customize ical behavior. Code is attached to hooks by one of the following commands.

General Hooks

Here is a list of some general hooks for ical.

Day Window Hooks

The following hooks are invoked when interesting things happen to a window that displays the items for a particular day. These windows are referred to as dayviews in the rest of the document. The object representing the dayview is passed as the first argument to these hooks. The dayview interface is described in more detail later in this document.

Day Windows

This section is incomplete!

This section describes the operations available on objects that represent the main ical windows. These windows display the items for a particular day.

Common Editing Actions

This section is incomplete!

This section describes the common editing operations that can be invoked from user customizations. These operations build on the calendar and item interfaces described in earlier sections. Use these operations when you customize ical's user interface because these operations provide a consistent editing interface to the user. For example, the operations described in this section produce friendly messages if the user tries to edit an item in a read-only calendar. By contrast, the low-level interfaces described in the sections on calendars and items generate a stack trace if they are passed invalid arguments.

Miscellaneous Commands

The C++ code exports a few miscellaneous commands to tcl code. A few more commands are implemented in C++ to speed-up some frequent computations. The specifications for these commands are given in the C++ code itself.

Author

Sanjay Ghemawat (sanjay@pa.dec.com)
http://www.research.digital.com/SRC/personal/Sanjay_Ghemawat/home.html

Copyright

Copyright (c) 1995 by Sanjay Ghemawat. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

See Also

Ical documentation at http://www.research.digital.com/SRC/personal/Sanjay_Ghemawat/ical/home.html