POW!

from Wikipedia, the free encyclopedia
POW!
Influenced by: Oberon
Operating system : Windows

POW! (Programmers Open Workbench) is a programming environment written in Oberon-2 . Oberon and Oberon-2 are consistent further developments of the Pascal programming language , whereby there is also the intermediate step Modula-2 . The integrated development environment is similar to the IDE from its predecessor, Turbo Pascal . POW! was developed in the 1990s at the Johannes Kepler University Linz , mainly by students under the direction of Prof. Mühlbacher for Microsoft Windows . POW! is available free of charge and the source code can be found both on the homepage and on Github . The installer can not be started easily under Windows 10 , but a version installed with Wine (version 4.0) under Linux ( Debian 10, Buster) starts without any problems. POW! supports the programming languages Oberon-2 , C , C ++ and Java .

use

POW! is mainly suitable for programming simple and more complex mathematical programs. Simple graphic options can be programmed in the ColorPlane module, but complex graphic-oriented programs are not possible. The display of objects and graphics requires a lot of computing power and therefore takes a lot of time. POW! Despite its simple structure, it is suitable for object-oriented and recursive programming. This enables the program to resolve issues more quickly. The strength of this programming language lies in the fulfillment of tasks, even of complex programs. The presentation, however, is more difficult because there are no options for tables or similar templates. By using simple and complex data types, the required storage space can be kept very low. By dividing it into different modules, the task can be carried out in various ways with the existing resources. Only the functions required are activated. This saves working memory and time for solving the algorithms .

Functions

simple math program in the module display

A program can be split into several sub-programs, which in turn contain different modules. A module can be an existing part program or a self-written program. Each program unit can consist of individual procedures that can be called in other modules or only accessible to the module in which it is contained.

Modules

Oberon-POW! has a number of simple as well as more complex modules . With the help of simple modules such as display, import, export, characters, numbers and texts can be output. Objects can be displayed graphically using the ColorPlane module. Complex graphic objects such as circles must be calculated and output point by point (pixel by pixel). This leads to a long computing time. Therefore, POW! rather unsuitable for the output of such objects. By using additional modules, functions such as extracting the root, determining time, saving, loading or determining random numbers are possible. With POW! some modules are already available. Some modules create their own window and are used for display purposes, while others are only intended for pure arithmetic operations.

Four wins in the ColorPlane module

The so-called "basic building blocks" are:

  • Strings
  • Float
  • Utils
  • OOBase
  • Param
  • Process

Then there are certain "user interfaces". These are the modules that are required for the output of characters and graphics:

  • Display
  • ColorPlane

There are also modules for saving and loading the files entered. This "file system access" includes:

  • File
  • Volume
Output of the ASCII code in the module Out

POW! also has a module that enables the output to be printed out. This is included in the following module:

  • Print

Last but not least, POW! via further modules, which can be assigned to the so-called "compatibility modules according to Oakwook guidelines". These include:

  • In
  • Out
  • XYplane

There are other modules that are not from POW! are available, but they can be downloaded, used and even changed for free. These programs were developed by Michael W. Kühn and run under the name MK Software . The following modules are available:

  • MK Turtle
  • stopwatch
  • Random generator

Procedures

Procedures are used to make the source text clearer and so that recurring tasks do not have to be written several times. A procedure can receive and output information and change certain states. The more parameters are accepted, the more extensive the procedure can be used.

Each procedure can access its local and global variables or data types. A procedure results from the sensible stringing together of individual commands provided by the programming language. Such commands can be output or input commands, arithmetic operations or loops . Loops, arithmetic operations and conversion commands are the same in each module, but output and input commands can be different. In addition, there are commands that are only contained in individual modules, such as pulling the root or transferring a certain coordinate.

Procedures can either be internal or external to the module. Internal procedures can be used throughout the module. To do this, the corresponding procedure must be called in the main program. There is also the option of using procedures in the main program, even if they are contained in other modules. The corresponding procedure must be approved for this. This is done using the star symbol (*). In addition, the module in which the visited procedure is located must be imported into the module which contains the main program.

The most important procedure in a POW! Program is the main program (ProgMain *). This program is responsible for the output. In the main program, the procedures used must be called directly or indirectly by other procedures in which they are used. The main program communicates with the compiler and the Windows user interface. It must therefore also be published and is therefore also expanded with the star symbol.

Commands

Every programming language consists of commands which, if put together, result in the procedures and the source text. Such commands can either be module-dependent or specified by the programming language. Read-in or output commands are module-dependent. These differed among the various modules. Repetition instructions, value assignments and selection instructions, however, are independent. When assigning values, the variables are assigned a certain status or value, depending on the data type. The repetition instructions are used to wait for a certain condition or to repeat themselves until the termination condition applies. The simplest of these statements is the FOR loop. A certain number of runs is specified from the outset. The content of the loop is repeated until the number of repetitions is reached. A second type of repeat statement is the REPEAT statement. This loop runs through until the termination condition for UNTIL applies. It should be noted that this loop runs through at least once. In contrast, there is the WHILE loop. This checks right at the beginning whether the condition for a loop pass is true or not. This instruction cannot be run through either. If the selection condition is met, the loop does not run. The last option is the LOOP. This statement has no termination condition and must be terminated by a separate check. If the test produces a result, the command EXIT is issued, which ends this loop.

Another type of command is the selection statement. CASE and IF belong to them. With the CASE instruction a variable is checked whether it fulfills one of the corresponding conditions. Depending on the solution, the said "branch" is executed. The IF statement is to check whether a condition applies or not. If the condition is met, the content of the IF statement is executed. Otherwise the ELSE branch is executed. If this is not available, the instruction is skipped.

Data types

In contrast to some other programming languages , with Oberon-POW! the data type in which the information is stored can be specified. Similar to procedures, data types can also be released for other modules. There are three ways of agreeing the variables. The first option is local agreement. Here the variable can only be used for the procedure. Above all, auxiliary variables (run variables) are agreed locally. The second possibility is the global determination of the data type. The variables must be specified in the main program or before the first procedure. These variables can be used in the entire module and represent the majority of the memory allocation. The third type of variable can be used in all modules. Proceed as with the procedures for this. The variable must be enabled with the star symbol (*) and the module in which the variable is determined must be imported. This type of assignment is used for long programs that work across several modules.

Simple data types

Simple data types are those in which only one value can be stored. A distinction is made here according to the type of file.

The following structures are simple data types:

Type Area Memory requirements Type of file structure
Short integer −128 to 127 1 byte whole numbers
Integer −32768 to 32767 2 bytes whole numbers
Longinteger −2.15 * e9 to 2.15 * e9 4 bytes whole numbers
real −3.4 * e28 to 3.4 * e28 4 bytes real numbers
Longreal −1.79 * e308 to 1.79 * e308 8 bytes real numbers
Boolean TRUE / FALSE 1 byte Truth value
character ASCII CODE 32-255 1 byte Character of the ASCII code
set Set of numbers from 0 to 31 Max. 64 bytes Is required for certain operations

There is the possibility of converting the individual, simple data structures into other abstract data structures. These commands are external to the module and can always be used.

Abstract data types

Complex data types can contain both simple and complex data types. This can be

Array

An ARRAY is a series of simple data types of the same type . Arrays, lists, matrices, and strings are such complex data types. An array consists of a predetermined number of elements, which are systematically numbered, whereby a number can be assigned to each element. The content of this element is the saved file. A list, on the other hand, only contains as many elements as are "occupied". This can save storage space. However, the elements are not numbered. To get to the content of an element, you first have to go through the whole list up to the said element. A string can be a word, a phrase, or even text. It is a series of characters, i.e. individual characters. The length of this field is predetermined by the type of field. Each character can be accessed by their number. The string is thus an array of characters. The content of each field in this array is the character. A matrix is ​​an array in which each element contains an array. A one-dimensional storage space determination becomes a two-dimensional one. The type of data must be specified beforehand.

TYPE Kette = ARRAY 20 OF CHAR;

The present file type is a chain of 20 elements, the numbering starting at 0, of which each element is a character. This data type must then be declared as a variable

VAR Kettenelement:Kette;

The call takes place, for example, in the following way:

Kettenelement[2]:= "W";

The value "W" is assigned to the 2nd element in the chain.

matrix

A matrix is ​​two arrays that span a field. Each field is precisely defined by two numbers, for example ([1,3] or [45,2]). The matrix is ​​particularly useful when a system with columns and rows is required. All data of this data type must have the same format. This must be specified in advance and corresponds to a simple data type. The number of columns can differ from the number of rows. The matrix is ​​an extended array and can be counted among the arrays. The matrix can be agreed as follows:

TYPE Kette = ARRAY 20,14 OF INTEGER;

Each individual element can be precisely accessed here. This is the actual matrix. It is also possible to assign an array as a data type to each array. However, only the element can be accessed. The individual member of the array that makes up each element cannot be accessed. This data type of a kind of connection between array and matrix is ​​declared as follows:

TYPE Element = ARRAY 20 OF INTEGER;
     Matrixarray = ARRAY 14 OF Element;
VAR Hybrid:Matrixarray;

What you should note here is what kind of data type can be stored in each element. In this case it is the integer. The advantage is that the "Element" array can also be used independently.

VAR Elementarray:Element;

With an agreement, the "Element" array can be used for various purposes.

Record

The RECORD, on the other hand, is a combination of different data types. It can also contain ARRAYs or simple data structures. The RECORD is the most complex of the existing data structures. It can contain the different data types and can be narrowed down precisely. A record is always called with the .Record-member variable. The point creates the separation between the variable that contains the record and the variable that is contained in the record.

The record must also be predetermined.

TYPE Beispiele = RECORD Name:Kette;
                        Alter:INTEGER;
                        aktiv:BOOLEAN;
                 END;

The RECORD must then be assigned to a variable again. The variable can again be an ARRAY. This is possible because the ARRAY would contain the same data type, a RECORD, every time.

TYPE Recordarray = ARRAY-10-OF-Beispiele;
VAR Wikirecord:Recordarray;

This creates a chain of 10 RECORDs, which in turn contain ARRAYs. The call is initially made like an ARRAY, to which the call of a RECORDS is appended.

Wikirecord[5].Name[2]:= "G";
Wikirecord[5].Alter:= 23;

The fifth element of the chain that contains the record is selected. The record element "Name" is selected from this element. Since only one character is to be determined, this can be addressed precisely ([2]). It is also possible to write down a word. It would look like this:

Wikirecord[5].Name:= "Hallo Wiki";

With the help of such complex data structures it is possible to solve very complex problems. With the example shown, for example, card files can be created.

list

The last form of the abstract (or complex) data types is the list. It is based on the ARRAY but differs fundamentally. There are only as many elements as needed. With a list, the elements are not numbered and the element cannot be accessed directly.

In POW! the declaration of a list looks like this:

TYPE ListenzeigerT = POINTER TO DatenelemenT;
     DatenelemenT = RECORD Inhalt:INTEGER;
                           next:ListenzeigerT;
                    END;

The "pointer" is the pointer that points to the data element. The pointer tells the program with which element it should start, which memory location is the first. The "next" variable is always the pointer that points to the next element. The file is saved in "Contents". The last pointer must point to the end. This is in POW! given at the fixed complex "NIL". To output an element, it must first be found. Each element is checked whether it contains the content you are looking for. This way of searching makes access slower and more complicated. Only as much space is reserved for this as is needed.

PROCEDURE Elementsuchen(VAR a:ListenzeigerT; n: INTEGER);
VAR lauf,hilf:ListenzeigerT;
BEGIN
    lauf:=a;
    WHILE lauf.next#NIL DO
        IF lauf.Inhalt=n THEN
            Display.WriteStr("Element gefunden");
            Display.WriteLn;
        END;
        lauf:=lauf.next;
    END;
END Elementsuchen;
PROCEDURE Elementsuchen(VAR a:ListenzeigerT; n: INTEGER);
VAR lauf,hilf:ListenzeigerT; e:INTEGER;
BEGIN
    lauf:=a; e:=0;
    WHILE lauf.next#NIL DO
        IF lauf.Inhalt=n THEN
            e:=e+1;
        END;
        lauf:=lauf.next;
    END;
    D.WriteStr("Der gesuchte Wert wurde");
    D.WriteInt(e,3);
    D.WriteStr(" mal gefunden");
END Elementsuchen;

An element is searched for here. The user can enter the value / state they are looking for. The variable "n" is assigned to this value. The list is then systematically searched to determine whether an element has the content you are looking for. Every time such an element was found, the sentence "Element found" is displayed and moved down one line. In the 2nd variant, the number of "hits" is counted and output. The use of this type of list is particularly useful if the number of files stored is constantly changing or if the number of files is to be continuously extended without having to change the source text.

Limits

There are some limits to this programming language or to its application:

  • Only a limited number of characters are possible per module. If this number is exceeded, the compiler program fails and it cannot be checked whether the written program contains errors. It can still be started by switching off the compiler function, but this is not recommended. The program should be split into part programs and individual modules.
  • The division into data types can lead to problems with the calculation. When you pull a square root from an integer, you can turn it into a real number.
  • Saving and loading files that have been entered in the program is very time-consuming. It is therefore mainly only suitable for programs in which the results of previous calculations are unimportant.
  • The display of images is possible, but each individual pixel is calculated for it. The same applies to complex mathematical figures or diagrams.
  • A recursion that is too complex can cause the program to crash.
  • Infinite loops are not detected by the compiler and inevitably lead to a crash.
  • The compiler can sometimes, especially for highly complex programs, display incorrect spelling suggestions.

literature

  • Mühlbacher, Leisch, Kreuzeder: Programming with Oberon-2 under Windows . Hanser, Munich / Vienna 1995, ISBN 3-446-18406-6

Web links

Individual evidence

  1. a b POW! - Programmers Open Workbench
  2. Github / Spirit of Oberon / POW accessed July 2020
  3. The POW! ( Microsoft Word ; 1.5 MB) Retrieved June 2011
  4. Modules in POW!
  5. Michael Kühn Software
  6. MK Turtle
  7. POW! Random generator
  8. Display of image files ( Memento of the original from January 1st, 2010 in the Internet Archive ) Info: The archive link was inserted automatically and not yet checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / www.cz.j.th.schule.de