Component Pascal Collection

ADen

Algorithms and Data Structures.

The subsystem contains the program examples from N.Wirth's "Algorithms and Data Structures. Oberon version". This version incorporates corrections and modifications introduced in the Russian translation and approved by Niklaus Wirth in April, 2009. The book can be download from website http://www.inr.ac.ru/~info21/ADen/.

To read the sources and run the programs, you need the BlackBox Component Builder (an Oberon derivative) freely available from http://www.oberon.ch/blackbox.html. BlackBox runs under MS Windows and Linux+Wine. All modules must be open and run from the BlackBox Component Builder.

After installing BlackBox, unpack this package into the BlackBox folder (so that ADen and i21sys subfolders appear along with Com, Comm, Ctl ... BlackBox.exe ...). The modules require one external module to run called i21sys/Mod/In.odc . It is included in this package.

Run BlackBox.exe, open the file ADen/Docu/Quick-Start.odc and read the instructions. The document ADen/Docu/Sys-Map.odc contains hyperlinks to all program examples. To run program examples in a module, click on the so-called commanders (the buttons like this one (!)); they are usually located after the end of the module text. Make sure nothing is selected when you click. The commanders should be clicked in the order of their appearance.

Algebra

Computational Algebra library.

Algebra is a subsystem that knows about, but not the theory of, Groups, Rings, and Fields which are defined as ABSTRACT interfaces. It can handle Vectors, Matrices, Polynominals with coefficients of these abstract types (recursively, since for example Matrices form a Ring they can in turn be the coefficients of a Polynominal). It provides many concrete extensions of these abstract types - Integers, Rationals, Gaussian Integers, Galois fields, Quadratic fields, Quaternions, arbitrary precision Complex etc. Algebra supports Rational Functions, Multinominals and Typeset Views of Algebra objects.

Alm01Gather

Source Code Collection and Topological Sort (Gather.Order).

Gather is a program that reads a list of 1 or more module names. It produces a topologically sorted list of all the modules that have source online and are necessary to support the listed modules. It has been in use for more than 10 years in the Oberon V4 environment, and was recently ported to BlackBox. Gather is written in Component Pascal. This version is for use with Oberon Microsystems BlackBox Component Builder v1.5 (BB) or v1.6-rc5.

What it does:

Reads the names of modules provided in the command parameters

Scan the IMPORT lists of the modules

Enter newly discovered imports to the list

Topologically sort the list to correct compile / load order

Open a document with the list

What it does not do:

Scan sym files

Scan code files

Gather is complimentary to DevDependencies. It was inspired by the Builder tool in ETH Oberon, but is written from scratch with different internal structure.

Amisc

Organize Desktop, Taskbar and Toolbar.

Amisc organized your desktop like the original Oberon systems. It divides the desktop into two tracks: the user track and the system track. Furthermore it adds a taskbar at the bottom of the BlackBox windows. The taskbar has a button for every opened (document) window. Clicking on the button brings up the window to the top. At the top of the BlackBox windows it provides a toolbar. You can manipulate the current selection's attributes with that toolbar.

Babel

Babel Compiler Compiler.

Babel is a meta compiler. From a language definition document, it builds the tables of a compiler (lexical, syntactic and semantic) and store them in a binary file. A special module, included in the final program, reads this file and then can compile texts of the language.

Basic

Getting started with Component Pascal.

Here are elementary programs for beginners to learn Component Pascal (Oberon 2). This small and easy modules are written in German. If someone would like to translate them to English please contact me.

Basics

Program library for Bit-Manipulations, Dynamic-Strings, File-I/Os, Run-Parameters and Time.

BasicsAssert The services of the module BasicsAssert are applied to implement design-by-contract. In case of trap the StdLog window will show name and value of the variable causing the trap and the appropriate limits.

BasicsBits offers low level access to bits and bytes using the concept of SETs and avoiding the import of SYSTEM.

BasicsDynStrings provides a class for dynamic strings. It includes useful procedures for string manipulations without limitations of the string lenght. Converters between basic data types and dynamic strings are available too.

BasicsStrings offers the functionality of module Strings plus some additional services for dealing with Hex-Strings. In contrast to module Strings all output strings are delivered as POINTER TO ARRAY OF CHAR.

BasicsFiles deals with ASCII files and binary files as well. It sits on top of module Files and offers traditional file I/O.

BasicsParameters implements a scanner for analyzing parameters usually passed to programs via a command line. The parameter string ist passed to the module by calling ScanParameterString. Subsequently names and values of the parameters will be available by calling the according procedures.

BasicsTime offers procedures for getting current date and time strings and time stamps in milli seconds as well.

BasicsUtils offers some helpful procedures for programmatic compiling and unloading of modules.

Bbt

You can convert modules from code page to Unicode with the Unicode module converter tools. This tool is very useful for the migration from BlackBox 1.5 Russian version to BlackBox 1.7 CPC edition.

With a new subsystem you may have the following questions: "Which modules must I compile?" and "Which other subsystems I need for using this new subsystem?" Now you get the answer very easily. You can create compile list and import list with the compiler helper tools. Looking thru the import list you can checking your system of consistency and found missing or misspelling modules even the source is not available.

Benchmark

A Benchmark Suite to Measure Computer Performance.

Benchmarks provide a method of comparing the performance of various computer systems. All my old benchmark programs doesn't run on a computer today. So I downloaded some sources from internet and changed them to my need accordently. You find here in this subsystem some well-known benchmark programs: Counter, Sieve, Dhrystone, Whetstone, Livermore Loops and Hennessy.

Bnf7

(Bnf7)Ebnf.atg: Ebnf Pretty-Printer. A sample use of Coco.

This example grammar is similar to the Ebnf3.atg file provided with BB Coco. The main difference between Ebnf3.atg and this grammar is the addition of semantics to create a translator and pretty-printer.

An unattributed ATG grammar supplied as input to Coco will create a syntax-analyzer, assuming no errors have occurred. The output of Coco will be a scanner, parser and a main driver that will need to be compiled by BlackBox.

Such a syntax analyzer only accepts or rejects the input that the ATG grammar itself defines. The main driver will output (to the StdLog) the message "Parsed correctly" if there are no syntax errors in the input the ATG grammar expects. Otherwise the number of detected errors is output to the StdLog.

The input for sample runs are an EBNF definition for EBNF itself and an EBNF definition for Oberon. Errors are marked in the input focus view. All the previously discussed syntax-checking actions still occur. In addition, a pretty-printed version of the input grammar is output to a separate window.

C2cp

C to Component Pascal Translator.

This software converts C source program to Component Pascal (Oberon-2). All identifier collected into one symbol table. The symbol table is used for name translation. The original translator was written a very long time ago in Turbo Pascal. It has no syntax analysis. The translator recognize patterns only. If it doesn't find a matching pattern the output is equal the input.

Cam

Subsystem Cam comprises of a few handy "low-level" modules, which I use extensively. Most of them where build before I discovered the CPC website. The modules consist of:

CamTools: A wrapper around the Sequencers of BlackBox, which makes it possible to implement multiple undo/redo actions. E.g.: undoing/redoing a set of actions in stead of one at a time.

CamLightupButtons: Picture buttons that light up when you move your mouse over the button

CamLists: The module CamLists defines the data types List and ListReader. Any storable object (extension of Stores.Store) can be added to a list. All manipulations to a list (adding and removing objects) which alter the contents of the list are implemented as operations. This means that all manipulation actions are undoable and redoable.

CamToolBars: Toolbars with "hot" buttons, that light up when the mouse moves over them.

CamProcScan: A simple program to quickly get an overview of all implemented procedures in a module and a tool to quickly jump to the one you want to go to. This module also contains a procedure to make all keywords bold and to make all comments blue and italic.

Casket

Casket provides a flexible Bitmap type and various utilities (examples below) that use it:

CasketRtfConv provides RTF (Rich Text Format) import and export by file or cut-&-paste. It has more accurate paragraph formatting than HostTextConv, and significantly it supports Links, Tables, and Pictures as Bitmaps.

CasketBitmaps provides interfaces to other BlackBox Bitmap types and facilities (HostBitmaps, CpcBitmaps, FreeImage, Windows Bitmaps). It supports writing compressed BlackBox Bitmap Views (using Pac, or another Compressor), interfacing to FreeImage, and is designed to support other applications.

CasketReferences is not required by CasketLatex, but could compliment it by providing equation numbering in a large document. It may also have uses unconnected with CasketLatex.

Casket uses the services of CpcCompressor, Ctls, Free, Lib and Pac (but if you only need CasketRtfConv Free, Lib, and Pac are not essential).

Chill

Chill_09 'Docu-Pack'.

I have now published on CPC several subsystems, and contributions to others. The current version control number of these is called Chill_09, and 'Chill' is sometimes used as a generic name for these subsystems.

This Docu-Pack is a set of 'overview' (e.g. 'Map's etc) documentation files that is recommended should you choose to install several, or all, of these subsystems. It provides convenient access to several subsystems and Tools from the Help Menu. It also gives guidance on installing the Chill_09 subsystems, as there are some dependencies between them.

Co_

Coroutines, Tasks and Schedulers.

The subsystem Co_ is suitable for suspending and resuming execution on certain locations. A list of tasks can be built upon: cooperative multitasking, state machines, infinite lists, pipes, etc. Task represent the simplest form for periodic execution. Scheduler is for runtime control of both.

Coco

A BlackBox port of Hanspeter Mössenböck's Coco/R Compiler Compiler.

Coco/R is a language for generating compilers from attributed EBNF grammars. You find more information about this topic at Prof. Pat Terry's Coco/R page. The original port of Coco is from the Stewart Greenhill's website BlackBox Resources. I adapt Coco to the BlackBox subsystem and use BlackBox IO directly.

CommTCPAsync

Non-blocking TCP Streams Module.

This module implements true non-blocking TCP streams using the CommStreams framework. The reference implementation (CommTCP) is only non-blocking AFTER a connection has been established, and can block the framework for a significant time during the establishment of a TCP connection. In some situations (eg. web proxy servers) this is unacceptable.

The solution to this problem is to use the asynchronous functions provided by Winsock. Module CommTCPAsync allows TCP host-name resolution and connection establishment to be performed as background tasks. This is done in a way that is compatible with the CommStreams framework.

Cookbook

This Cookbook is designed to supplement the documentation produced by Oberon Microsystems, Inc for the BlackBox programing environment. The guiding principle of the Cookbook is "Show me how to do something quickly and efficiently". If greater detail is need then the reader is urged to consult the BlackBox documentation.

Cow

Cow is a subsystem aimed at compiler writers.

Cow is subsystem aimed at compiler writers. When finished, it will contain generators of lexical and syntax analysers. As completed, various modules will be added to this subsystem.

This is alpha release of Cow, framework intended for compiler writers. At the moment, only scanner generator exists, but as time passes more elements will be added. Whole project is intended to be my graduation thesis, and I would be very grateful to anyone that could point me to existing errors, omits and possible improvements.

CpcBitmaps

Bitmaps.

This module allows an arbitrary View to be converted to a Bitmap.

These Views are intended to be embedded in BlackBox Documents. The particular advantage of these Views is that when they are saved to disc they are compressed (using CpcCompressors), so typically take much less disc space than uncompressed Bitmaps.

CpcBookmarks

Bookmarks for text documents.

When you edit a source code file it is often necessary to jump back and forth between two or three different areas making changes simultaneously. A valid solution would be to open the appropriate number of windows with the same document and to switch between them. BlackBox supports this with the command "Window - New Window (F2)". For example, you may open one window with TYPE declaration in view to add properties to an object, and the second window with a method implementation. Now you may add new properties while writing code that uses them. Unfortunately, in BlackBox all these windows will share the same text cursor position, so if you start typing right after you switch to another window, you will immediately be brought back to the place where you were typing in the previous view, effectively losing all the advantages of having two windows. To place the text cursor at a new position you have to use the mouse, and switch from keyboard to mouse and back again which slows you down and distracts you.

Another problem with the approach of using multiple windows, is that you end up having a) many windows open to same file, b) very small amount of text in each window without its context, and c) very limited navigation capabilities using the "Window" menu, so you cannot quickly find the window you need.

That is why you may find bookmarks useful. A bookmark is a small visible object (of type CpcBookmarks.View) which can be pasted into any text document. It looks like a little grey square with a digit in it. Bookmarks are numbered from 1 to 9, so you may have up to nine bookmarks per document. After you have placed a bookmark, you may quickly jump to that exact cursor position from anywhere in the document (the document's window must be active). Bookmarks are saved within the document, so the state is preserved between editing sessions.

Like any other View object bookmarks are ignored by the compiler, so you don't have to put them in comments. They may be anywhere in your source code. Right where you need them.

The disadvantage of bookmarks is that you have to remember the number location correspondence. You'll have to think up your own scheme for using those numbers. You won't be using more than three most of the time, so it won't be very hard to simply poke through numbers from 1 to 3 to find the place you need.

CpcFloat

Diagnosing floating point calculations precision.

Do you have numeric problems with real numbers? This is not a specific problem of Component Pascal. All programming languages have the same kind of problem. Here is a little module to determine the precision of floating point calculations. The result depends on the floating point implementation on your machine and not of the programming language definition.

Testing REAL numbers for equality should be done with the statement:
IF (ABS (real1 - real2) < epsilon) THEN ... END;

The problem above is what value of epsilon should I use. After running this test you know which epsilon you can use on your machine. Remark: Math.Eps() gives the same value, but with less information.

CpcFormTidy

Control layout tools for use in constructing Forms.

FormTidy provides an additional set of commands that complement those provided in the Layout menu. They are used to help arrange the size and positioning of Controls in a graphical user interface Form. These commands are virtually essential for Forms with more than a few Controls.

CpcFormTidy uses the services of Ctls. It is a member of the Chill group.

CpcIndex

Cross reference builder and pretty printer.

CpcIndex parses a text according to a grammar, with the help of Babel. It uses this analyze to pretty print the text and extract an index. The result is ready to print or can be used on screen for quick searching. Grammars for Oberon2, Modula2, Component Pascal and Babel are included.

CpcLangMapper

Language Mapper from / to Excel tables.

Very often programmers and language translators are not the same person. This is easier for doing the translation outside the BlackBox in an Excel table. CpcLangMapper allows you to transform rows of alias/language pairs from Excel tables into a BlackBox (Subfolder)Strings.odc document or vice-versa. CpcLangMapper enhances the possibilities of CpcLanguage by introducing transformation of languages between MS Excel and BlackBox.

CpcLanguage

Language for Component Pascal.

BlackBox 1.5 has many facilities. One of them is changing the language during the BlackBox session. Here is the module for accomplish this task. You can switch to any language which you like. But before you can use your favourite language you have to translate all the resource files. It would be nice to share your translations here.

CpcMenus

Switching Menus.

Certainly you have installed some or all modules from the Component Pascal Collection. Now you get a very long menu bar at the top of the BlackBox's window. I'm sure that you needn't the complete menu all the time. Would you like to switch the menu item off and on again? Here is a program which can do it.

CpcPreprocessor

Named Integers in Component Pascal.

Here you found an implementation of named integers for Component Pascal without changing the original compiler. The benefit of named integers is self-documentation. Named integers are eliminating the need to explicitly assign constants to symbols. It makes the declarations simpler and more clear. It also reduces the likelihood of the programmer accidentally assigning the same constant to two symbols.

In general

TYPE Color* = (red, blue, green);

is defined to be _exactly_ equivalent to

TYPE Color* = INTEGER; CONST red* = 0; blue* = 1; green* = 2;

Named integers have none of the implementation problems of enumerated types. They are simply a syntactic sugar that provide an immense benefit of self-documentation for a very small price. They do not introduce a new type. Named integers are integers.

CpcRegul

Regular Lexical Analyzer.

CpcRegul is a lexical analyzer that can find and/or replace regular expressions in a text. It provides an application programming interface as well as a user interface. It is an advanced example of the Babel metacompiler.

Here, Babel is used three times at each request: firstly to analyze the regular expression, check possible syntax errors and generate a Babel definition document for this expression; secondly to compile the previous definition document and produce a compiler (in fact, one or two compilers, according to the expression); thirdly to parse the user text with this compiler and find occurrences of the regular expression. All this process is accomplished in a flash behind the screen.

CpcSearch

Search & Replace with wildcards and text attributes.

Module (Cpc)Search is a simple to use Text Search & Replace tool. It augments the supplied Find/Replace tool in two main ways: it keeps a record of the last few Search and Replace strings used, and it supports a rich set of wildcard search & replace options.

With this module you can find red 'cats' and replace them with italic 'dogs'.

CpcSpell

A minimalistic Spelling checker.

Spell is a minor modification of a module originally written by Oms (ToolSpell). It is published here by kind permission of Oms.

As well as actually checking spelling, Spell has the following set of features: {} .

It is already useful (I do use it), but I also publish it in the hope that someone will find the time to add some more features to it. I would like it to display a list of suggested corrections (which requires some knowledge of Excel and OLE automation, which I do not have), and to offer to make a selected correction (which requires some knowledge of TextModels and TextControllers; this I can possibly manage).

CpcSpell doesn't use any other CPC services. It is a member of the Chill group.

CpcSplitter

Split a window and scroll the two panes independently.

The module CpcSplitter splits a window horizontally, and provides independent scrolling of the two panes. Programmers may find this useful: you can view the declaration section of a module in one pane while editing a procedure of that same module in the other pane.

CpcStylists

A Stylist is an object used to organise Rulers (TextRulers.Ruler) in a Document.

A Stylist is essentially a list of Rulers Styles and associated StdProps. A Stylist object offers three main facilities:

It allows several Rulers to belong to a Style Set. Rulers are said to belong to the same Set if they are the SAME (which means that they have the same Style, and, optionally, equal StdProps). When Rulers share their Style not only do they have their tabs etc in the same place, but moving one Rulers tabs immediately moves the tabs of all the other Rulers in the Set.

It allows each Set to be 'named' . It can be helpful to give each Set a meaningful name, such as 'Tabs @ 2 & 5 cm', or 'Main heading Ruler'.

It can manage a Text's StdProps. These are associated with each Ruler and with each Style in the Stylist. They can then be automatically applied to the text immediately after each Ruler in a flexible variety of ways.

CpcStylists uses the services of Ctls. It is a member of the Chill group.

CpcUtf8Conv

UTF-8 File Importer & Exporter.

A lot of websites are encoded in UTF-8 format. UTF-8 stands for 8-bit Unicode Transformation Format. It uses one to three bytes per character. It is a variable length character encoding for Unicode. UTF-8 is the default encoding for XML. There is no converter for reading such files into BlackBox. With this little module you can read (via File -> Open) and write (via File -> Save) UTF-8 encoded files.

You may realize that the first 128 characters encoded identically to the 7 bit ASCII code and can be loaded via the txt converter. But even you use the 7 bit ASCII character set only, you can't write them back via the txt converter because ASCII uses CR & LF for new line and UTF-8 uses LF only.

Views Buttons are controls that use other singleton views to display the current state. They have primarily been implemented to create picture buttons but they are not limited to displaying pictures only. In fact any singleton view can be used as a button state. This implements Command Button Controls whose appearance is an arbitrary BlackBox View. It features an easy-to-use graphical interface for configuring the Buttons.

A set of sample Arrow Buttons has been included. It provides 9 preconfigured versions of Views Buttons. The arrow forms included are top, up, down, bottom, start, left, right, end, and circle (well, we know a circle is not exactly an arrow, but it's still useful).

There are also controls for to display and handle simple Progress Bars as seen in many applications for long running commands. And last but not least there is a Track bar & Mixer control.

Sliders contains a simple Slider Control, a TwinSlider for specifying INTEGER ranges, and a simple CHARacter Edit Field.

Figures can be thought of as simplified inert Controls. Their main use to go onto Forms, but there is no reason why they shouldn't be used in any Container or Document. Their function is decoration.

Colour is a simple 'Property Editor' for updating the Color Property (part of Properties.StdProp) of items.

RealField and UnitField are modules that implements a Field, or 'Edit Field', Control similar to the standard BlackBox Field Control. This Control is limited in that it can only be linked to variables of type REAL, however it allows more options for formatting the REAL number.

In addition the value in the variable can be associated with a (physical) Dimension (such as Length or Mass). With the chosen Dimension (say Length) there can be associated a set of Units (eg metre, foot, inch, mile, etc.). The UnitField Control can display a chosen Unit, and automatically scale the value to preserve its meaning. The Control also supports further scaling by the standard SI prefixes (e.g. k for × 1000, or µ for ÷ by a million), and representation in logarithmic units (e.g. decibel).

Ctls doesn't use any other CPC services. Part of Ctls is a member of the Chill group.

Ctlsx

Tables and other Controls Extensions.

CtlsxButtons work as CtlsButtonsV, but it is also possible to use them as radio buttons. A radio button has to be linked to an integer variable. In this case, the command of the button must be integrated into the notifier procedure.

CtlsxCalendars includes a Calendar Control that shows one month. It is possible to define the range of the calendar and toggle from month to month. Special days e.g. holidays can be defined by mouse clicks.

CtlsxCaptions adds color to the caption and allows changing the color to red, when the caption is linked to an integer variable and the corresponding number equals level property.

CtlsxColorIndicators just show a color. The form of the control can be changed by the properities inspector (Rect / Oval).

CtlsxFields allows formatation of integers and reals and a more convenient input of real numbers with the German keyboard. Also character variables can be linked to CtlsxFields.

CtlsxHourCtlsx is a control which allows selection of hours of one week, including different types of special days, e.g. holidays.