Seppo Mustonen : Programming Survo in C

1. Introduction

SURVO 84C is an open system. It provides tools for making extensions in different ways. Many of the enhancements can be accomplished by means of sucros described in "Sucros in SURVO 84C" by Mustonen (1988). Also the matrix interpreter (MATRUN operations), the touch mode and the editorial computing mode, for example, are useful when making such extensions. Furthermore, some of the general SURVO 84C operations (like PRINT and PLOT) provide their own special programming tools.
     In the most demanding tasks, the only general way for making extensions is to use the programming language C since the entire SURVO 84C system has been programmed in C.

SURVO 84C is a modular system consisting of one main program (the editor) and of numerous modules which are called by the main program when needed. Each module itself is written like any independent program, but it can be executed only as a child process when its parent process (main program) is present and delivers all input information to the module. When a SURVO 84C module terminates, it disappears from the memory and the control returns to the main program. It is up to the module how it renders its results. Usually results are printed on the screen and saved in an output file or they are displayed in the edit field. Each module in turn may have children which are written independently but receive sustenance from their mother.

An important link between the main program and the modules (and thus also between different modules) is the edit field, which among other things carries vital input information to the modules. The main program selects the module needed for each particular task according to the activation procedure initiated by the user. In most cases the activated line in the edit field holds that information. For example, when the user activates a line starting with the word PRINT, the main program `knows' that a program !PRINT.EXE should do the job and calls it immediately. Thereafter it is the task of !PRINT.EXE to read parameters and other input information (like specifications written around the activated line).
     This convention guarantees that there can be as many modules in the system as there are permitted program file names (starting with `!'). Since each module visits the central memory in turn, it is only the disk capacity that may limit the size of the system.

Instead of one large program, we have a family of smaller programs which can cooperate. Such a system is easier to maintain. For example, each module usually consists of several compilands which are compiled separately and then linked together. There is no need to link the modules to each other or to the main program. However, the environment created for the programmer guarantees that making a SURVO 84C module is like extending one large uniform system which could be one huge program.

When programming a new module, it is not necessary to know about the requirements of other modules (assuming that we are not using conflicting names for modules). In many cases, however, it is good to be familiar with other solutions and use ready-made tools generated earlier for similar purposes.
     In fact, programming is highly simplified when various tools which have been developed earlier are employed whenever possible. The standard tools of SURVO 84C are available as libraries. The main program and all existing modules have been written in the C language. In principle, any other language producing executable program files (like Pascal, Fortran, Assembler) could be used as well, but for the time being they are lacking the SURVO 84C library support.

The main purpose of this paper is to provide information for those people who would like to make more SURVO 84C modules. We give some rules which should observed and a great deal of recommendations. Finally, we describe the tools available and give examples of their use.

Although anyone who writing a SURVO 84C compatible program can select the tools as he/she wishes, there are clear advantages to following the recommendations. Generally adopted tools create a common style in the system structure that in many ways helps the user. For example, when the user tries to test a new operation of SURVO 84C, he has the right to expect it to work according to patterns encountered earlier in similar operations. The parts of the SURVO 84C `world' should resemble each other as much as possible, at least formally. This increases the confidence of the user to the system. On the other hand, we don't wish to spoil the joy of inventing new approaches. As an open system SURVO 84C will permit and tolerate several alternative solutions in any application area.

The prerequisities for a SURVO 84C programmer are that he/she is able to use the C language and knows the idea and basic solutions of SURVO 84C from the user's point of view.
     The current technical requirements are the Microsoft C Compiler (Ver. 5.10 or newer), the SURVO 84C libraries and the SURVO 84C system itself. The present implementation of SURVO 84C is for the MS-DOS operating system. Due to the origin and portability of the C language, it is obvious that versions for Unix-like operating systems at least are not difficult to develop.

Next: SURVO 84C processes

Front page of Programming Survo in C