PDP++ (TypeAccess and CSS)

From emergent
Jump to: navigation, search

Updated: 4/21/03

INFO: Copyright, Online Documentation, Gziped Postscript 239K, PDF 890K, PDP++

FTP: USA: Colorado (Most Frequently Updated), USA: Pittsburgh (Official Release), UK

TypeAccess (TA) is a RTTI (run-time type information) system for C++. It scans header files for 'typedef' and 'class' definitions and produces a compilable file that will allow classes to access their own type information.

CSS is a C/C++ interpreter with a built-in command interface for controlling the execution and debugging of programs. It can be used as a stand-alone C/C++ interpreter for tasks where Perl, TCL, or compiled C/C++ would otherwise be used, and as a script interface to a specific C or C++ application. Its primary advantages over existing languages are the use of a standard language syntax (C/C++), and its ability to automatically interface with hard-coded C++ objects via TypeAccess.

TA/CSS was developed for a neural network simulation system called PDP++. It can be obtained either with the entire PDP++ software distribution (which gives you lots of example code..) or as a subset that just has TA and CSS related files.

The current version is 3.0, released May, 2003. It has been extensively tested and should be completely usable.

Features Added in Release 3.0

Just bug fixes for this release. See the ChangeLog file for details.

Features Added in Release 2.0

  • do loop now fixed (couldn't use continue, break before).
  • added demo for compiling css into c++ (css/hard_of_css/hofcss_demo.css).
  • added demo for using ta/css outside of PDP++ context (src/xcss).
  • argument count checking done at parse ("compile") time, catches difficult-to-diagnose bugs.
  • added ws, flush, endl, ends, dec, hex, oct, lock and unlock stream functions.

Features Added in Release 1.1

  • Cleaned up compilation and execution control structures in CSS, fixing bugs associated with execution errors, single stepping, debugging, etc.
  • Classes now much more robust, can have array members, arrays of classes work.
  • 'new' can create arrays.
  • 'const' types can now be declared, and used anywhere a literal value can.

Features Added in Release 1.01

  • Added awk-like functionality through the new 'ReadLine' command, which reads one line of a data file and returns an array of string columns, which can then be processed, etc.
  • Fixed several bugs.

Features of TypeAccess and CSS

TA/CSS implements what might be called a unified WYCIWYG (What You Code Is What You Get) model of programming. Basically, you get a graphical and script-level interface to whatever objects you have coded in C++ "for free". All the functions, variables, etc are accessible and can be dynamically and interactively called by the user, who can also code new classes and functions in the script language to build off of a core of hard-coded functionality.

What makes TypeAccess different from other RTTI systems is that it has an extensive "automatic" interface system build around it. This interface includes a GUI "edit dialog" system based on the InterViews toolkit that allows the user to view and modify class members, and call class methods via buttons and pull-down menus. The properties of this interface are controlled by "Comment directives" that can be placed by the programmer in the source-code comments next to class, member, and method definitions/declarations. These directives are parsed by the TypeAccess system and recorded along with the type information. They are also available for application-specific uses.

TypeAccess interfaces with CSS to allow "automatic" access to hard-coded classes via a script interface. Since CSS is C/C++, code can initially be developed in the interpreter and then compiled into the application once debugged and tested with little or no modification.

Essentially, TA and CSS together provide a flexible GUI and script interface to C++ objects. This makes it possible for the programmer to develop a set of C++ classes that just perform application-specific functions, without having to worry about the interface much at all. The user of such an application has the advantage of being able to access all of the functionality of the hard-coded objects, and to extend this functionality by writing their own script code in CSS.

TA/CSS provides a "type-aware" base class type, and a number of container classes (Arrays, Lists, Groups) that use the type information from TypeAccess to perform various specialized interface and other functions. By using such classes, one can also take advantage of automatic "dump" file saving and loading functions. Thus, complex structures of C++ objects can be saved to an ASCII file and loaded back in later. This takes care of yet another bothersome programming task.

CSS "compiles" source code into a machine code of C++ objects, which then know how to run themselves. The range of functions that any object can perform is defined in a 'cssEl' base class, and derived types implement functions for specific data and function types. This object-oriented machine implementation straightforward, and offers reasonable performance since different data types are implemented directly (e.g., everything is not a string like in TCL). The code for CSS compiles into a 800K library on a SUN sparc station.

Comparison to Other Languages


CSS has some of the robustness and simplicity advantages of Java, including protection from the dangers of pointers, a simplified range of types, and reasonable automatic type casting. Also, it shares the familiarity factor with C++, and goes further by preserving the full range of C style programming for those who are more comfortable with it. However, it does not have many of the advanced features like multithreading, security, and networking. Nevertheless, it is completely free and comes with all the source code, and is probably much simpler to integrate into an existing application, especially due to its ability to access existing hard-coded types (WYCIWYG), and the availability of the source code.


The primary advantage of CSS over TCL is the familiarity of the language syntax, and it probably offers a performance advantage as well. The Tk widget set is much more flexible than the one included with TA/CSS, which does not allow one to design the interface in an ad-hoc fashion (since it is designed specifically to free the programmer from having to spend time designing the interface). However, it would be relatively straightforward to type-scan a graphical toolkit written in C++ and thereby provide that kind of flexibility.


The TypeAccess and CSS software was written by Randall C. O'Reilly (now at Department of Psychology, University of Colorado Boulder), and Chadley K. Dawson, under the affiliation of the following entities:

The Fine Print

The software runs on Unix workstations under XWindows, under Microsoft Windows (9x, 2000, NT, XP, etc) using CYGWIN, and on the Macintosh under OSX (with an X11 display server). Binaries are available for Linux, Windows, Mac OSX, Sun, and SGI platforms. Other machine types will require compiling from the source. g++ and proprietary compilers are supported.

The GUI in PDP++ is based on an updated version of the InterViews toolkit, which we have maintained together with Michael Hines (author of NEURON). We distribute pre-compiled libraries for the above architectures. For architectures other than those above, you will have to compile from source, available for download. Click here for more information about InterViews.

CSS does not support all of C++ (does anything?). It does have most of the basic stuff, but does not do operator overloading, function call resolution based on argument types, templates, or exception handling, to name the main ones. It is intended to be used as a script language, not as a major application development platform. See the manual for more information.