Copyright (c) 2012-2016 Hyperion Entertainment and contributors.

AmigaOS Manual: ARexx Introducing ARexx

From AmigaOS Documentation Wiki
Jump to: navigation, search

The ARexx programming language can act as a central hub through which applications - even those created by different companies - can exchange data and commands. For example, using ARexx you can instruct a telecommunications package to dial an electronic bulletin board, download financial data from the bulletin board, and then automatically pass the data to a spreadsheet program for statistical analysis - without any user intervention.

ARexx is an interpreted language that uses ASCII file input. The ARexx interpreter is the RexxMast program, located in the System drawer of Workbench. RexxMast monitors the execution of an ARexx program. If RexxMast finds an error while translating or executing a line, it halts and displays an error message on the screen. This interactive testing is both a learning tool and an aid in debugging programs because it immediately highlights when and where an error has occurred.

Who is ARexx For?

You do not need extensive Amiga experience to use ARexx programs and scripts, but you do need to know how:

  • To open a Shell and enter AmigaDOS commands
  • To use a text editor, such as Notepad
  • To edit the User-startup file

However, to change the scripts or create your own ARexx scripts, you should have a basic understanding of both the Amiga Workbench and AmigaDOS environments. Experienced Amiga users may find ARexx easier and more powerful than AmigaDOS. In fact, ARexx can be used to enhance or replace existing AmigaDOS commands and scripts, as well as to create integrated applications.

ARexx on the Amiga

ARexx is supported on all Amiga hardware configurations. Beginning with the release of Amiga Workbench Version 2.0, ARexx has been integrated into the Amiga operating system. Specifically, ARexx uses two important features of the Amiga operating system: multitasking and interprocess communication.

Multitasking is the ability to run more than one program at a time. For example, you can simultaneously edit a file, format a disk, and adjust your screen's colors.

Interprocess communication (IPC) is the ability to allow the exchange of information between applications. Interprocess communication is accomplished through the use of message ports, an address contained in an application that can receive and send messages, attached to each program. Each message port has a name and sending a message to an application requires the use of the port's name in an ARexx script.

The sequence of events in sending and receiving a message is:

  1. On initialization an application opens its message port.
  2. The application waits to receive a message.
  3. The Amiga operating system notifies the application that a message has arrived at its port.
  4. The application acts on that message.
  5. The application notifies the message's sender (ARexx) that the message has been received and processed.

This transfer of messages is not limited to one application and ARexx. Several applications can send messages back and forth using ARexx as the central transfer location. However, all the applications must be ARexx-compatible.

ARexx Features

Features of the ARexx programming language are:

  • Typeless Data - Data is treated as individual character strings and variable values are undeclared.
  • Interpreted Execution - The read-and-execute ability of ARexx skips the extra step of program compilation.
  • Automatic Resource Management - Automatic internal memory allocation removes unnecessary strings and data.
  • Tracing, Trapping, and Debugging - Tracing and trapping permit handling of errors that would normally abort the program. The debugging facilities allow you to view your entire program, reducing development and testing time.
  • Function Libraries - External function libraries provide extended, pre-programmed functions.