The APL Character Set, and Describes the Full-Screen APL Input Editor
Total Page:16
File Type:pdf, Size:1020Kb
----- ------- Personal Computer -------_.---- - - --- Computer Language Series APL by IBM Madrid Scientific Center First Edition (May 1983) This product could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of this publication. The foHowing paragraph appiies only to the United States and Puerto Rico: International Business Machines Corporation provides this manual "as is" without warranty of any kind, either express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. IBM may make improvements and/or changes in the product( s ) and/or the program(s) described in this manual at any time and without notice. Products are not stocked at the address below. Requests for copies of this product and for technical information about the system should be made to your authorized IBM Personal Computer dealer. A Reader's Comment Form is provided at the back of this publication. If this form has been removed, address comments to: IBM Corporation, Personal Computer, P.O. Box 1328-C, Boca Raton, Florida 33432. IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligations whatever. © Copyright International Business Machines Corporation 1983 Preface APL is a general-purpose language that can be used in many applications, such as commercial data processing, system design, mathematical and scientific computation, and the teaching of mathematics and other subjects. This book describes the IBM Personal Computer APL system. The book consists of two parts. Part 1, "Operation Guide," has four chapters that describe the use of the system. Part 2, "APL Reference Guide," has eight chapters that explain, in detail, the APL language as implemented on the IBM Personal Computer. Part 1 assumes some familiarity with computing, as well as a basic knowledge of APL which can be obtained from Part 2. Chapter 1, "Introduction," describes the use of the IBM Personal Computer devices under APL, and should be read by all who use the system. The chapter contains information about the use of diskette drives and fixed disks, the keyboard, display monitors, and the IBM Graphics Printer. This chapter also introduces the APL character set, and describes the full-screen APL input editor. Chapter 2, "Application Workspaces," describes a number of functions provided with the system that allow a person with a basic understanding of APL to use the IBM Personal Computer's devices. A set of workspaces has been provided to help you with the following operations: • Printer management • Full-screen editing of APL defined functions • Disk Operating System file management • Asynchronous communications with an IBM System/370 host • Music samples iii Chapter 3, "Auxiliary Processors," describes, in detail, the auxiliary processors provided with the system, which allow a knowledgeable APL user to create specific application workspaces. The following auxiliary processors have been included to help you obtain greater control of the IBM Personal Computer's devices: • AP80: IBM Graphics Printer Control • APIOO: BIOSIDOS interrupt handling • AP205: Full-screen display management • AP210: DOS file management • AP232: Asynchronous communications • AP440: Music generator Chapter 4, "How to Build an Auxiliary Processor," describes auxiliary processors that can exchange information with APL. A person who has both a good knowledge of APL and the ability to program in the IBM Macro Assembler language can use this chapter to help produce his own auxiliary processor to perform a specific application not currently supported by the APL system. Chapter 5, "Using APL," describes the major characteristics of the APL language. Chapter 6, "Fundamentals," shows some typical APL statements, lists error messages with recommended corrective actions, describes the APL character set, and explains the terms used in APL. Chapter 7, "Primitive Functions and Operators," describes the scalar and mixed primitive functions of APL and the operators that may be used with them. Chapter 8, "System Functions and System Variables ," describes the interaction between the APL language and the system implementing it. Chapter 9, "Shared Variables," describes the interface that allows two independently operating processors to exchange information. iv Chapter 10, "Function Definition," describes the various methods by which a defined function can be established in an APL workspace. Ambi-valent functions, localization of names, branching, labels, comments, and the del (V) function editor are all discussed in this chapter. Chapter 11, "Function Execution," describes the execution of defined functions, including the related topics of halted execution, the state indicator, stop control, trace control, locked functions, recursive functions, and console input and output. Chapter 12, "System Commands," describes the various APL system commands that are used to control the work session and to manage workspaces. Three appendixes, "Alt Codes and Associated Characters," "Printer Control Codes," and "Internal Representation of Displayed Characters" are also included. v Notes: vi Contents Part 1. Operation Guide Chapter 1. Introduction .................. 1-1 Backing Up Your Diskette .................. 1-8 Before You Begin ..................... 1-8 Protecting Your Original Diskette ....... 1-8 Backing Up Diskette with One Drive .... 1-9 Backing Up Diskette with Two Drives ... 1-11 Installing APL on Your Fixed Disk .......... 1-14 Getting APL Started from Either Diskette or Fixed Disk ........................... 1-15 Including Options in the APL Command ...... 1-16 The APL Character Set .................... 1-17 The Keyboard ............................ 1-18 Function Keys ....................... 1-18 Typewriter Keyboard .................. 1-19 Numeric Keypad ..................... 1-21 Special Key Combinations ............. 1-22 Use of Displays ........................... 1-25 Disk( ette) Drives .......................... 1-26 The Printer ............................... 1-27 The APL Input Editor ..................... 1-28 APL Input Editor Special Keys ......... 1-29 How to Make Corrections on the Current Line ........................ 1-31 Chapter 2. Application Works paces ........ 2-1 The PRINT Workspace .................... 2-4 The EDIT Workspace ..................... 2-5 The FILE Workspace ..................... 2-8 Functions ........................... 2-9 Examples of Use ..................... 2-22 vii The VM232 Workspace3 .................. 2-23 Selecting a Terminal .................. 2-24 Saving Your Line Parameter Definition .......................... 2-31 Connection with the Host .............. 2-32 Functions ........................... 2-34 Example of Connection with the Host .... 2-38 Auxiliary Files on the Host ............ 2-43 The :ivlUSIC Workspace ................... 2-57 Chapter 3. Auxiliary Processors ........... 3-1 The Printer Auxiliary Processor: AP80 ...... 3-4 BIOS/DOS Interrupt Auxiliary Processor: AP 100 ....................... 3-6 The Full-Screen Auxiliary Processor: AP205 ....................... 3-10 Screen Formatting .................... 3-12 Control Commands ................... 3-15 Interactive Use of the Screen ........... 3-1 7 Return Codes ........................ 3-19 The File Auxiliary Processor: AP210 ........ 3-21 Control Commands ................... 3-22 Control Subcommands ................ 3-25 Return Codes ........................ 3-26 The Asynchronous Communications Auxiliary Processor: AP232 ....................... 3-28 Control Commands ................... 3-29 The Music Auxiliary Processor: AP440 ...... 3-35 AP440 Command Syntax .............. 3-36 Chapter 4. How to Build an Auxiliary Processor ............................... 4-1 Access Control ........................... 4-4 Shared Variable Processor Services and Return Codes ............................ 4-5 Format of Shared Data .................... 4-9 Internal Structure of APL Variables .......... 4-11 Information about Shared Variables .......... 4-12 Auxiliary Processor Example with One Shared Variable .......................... 4-12 Auxiliary Processor Example with Two Shared Variables ......................... 4-15 APL Data Segment and Macros for Auxiliary Processors .............................. 4-20 viii Part 2. APL Reference Guide Chapter 5. Using APL .................... 5-1 Two Examples of the Use of APL ........... 5-3 An Isolated Calculation ................ 5-4 A Prepared Workspace ................ 5-4 Characteristics of APL ..................... 5-5 Chapter 6. Fundamentals ................. 6-1 Character Set ............... .. 6-7 Spaces .................................. 6-8 Function ................................. 6-8 Order of Execution ........................ 6-9 Data .................................... 6-10 Arrays .............................. 6-10 Constants ........................... 6-13 W orkspaces and Libraries .................. 6-14 Names .................................. 6-14 Implementation Limits ..................... 6-15 Chapter 7. Primitive Functions and Operators .............................. 7-1 Scalar Functions .......................... 7-3 Plus, Minus, Times, Divide, and Residue ............................ 7-7 Conjugate, Negative, Signum, Reciprocal, and Magnitude ...................... 7-7 Boolean and Relational Functions ....... 7-8 Minimum and Maximum ..............