• Keine Ergebnisse gefunden

PREVIOUS VERSIONS OF ALPHA PASCAL

Im Dokument Alpha PASCAL (Seite 28-33)

Previous versions of AlphaPascal were based on the UCSD Pascal programming system, Version 1.4. In order to provide a PascaL that is more fuLLy integrated with the ALpha Micro operating system and fiLe system, we now offer this new version of ALphaPascaL that was expressLy deveLoped for the ALpha Micro computer.

To make Life easier for programmers who have written programs using previous versions of ALphaPascaL, we have tried to keep many of the same features and functions, while adding a number of new extensions and abiLities. Most of the changes between this version and earlier versions are added features that do not require that Y9U rewrite your earLier programs.

SeveraL of the most important difference are:

The operating instructions for ALphaPascaL have changed. An important difference is that you wiLL use the ALpha Micro screen-oriented text editor, VUE, to create your programs. You must aLso use the Linker,

PLINK, to Link any compiLed program, whether or not it consists of more than one fiLe. See Chapter 4, "Operating Instructions and Characteristics," for compLete instructions.

Expression handLing has been considerabLy enhanced:

1. You may now incLude the assignment operator in an expression.

For exampLe:

5 + X := 7

The expression above is equivaLent to 5 + (X := 7), and means

"Let X assume the vaLue of 7, and then be added to 5."

2. Wherever an expression is LegaL, you may incLude an IF-THEN expression of the form:

II

condition THEN expression ELSE expression For exampLe:

Year := (IF Feb = Leap THEN 29 ELSE 28)+337;

If Feb equaLs the vaLue Leap, then Year assumes the vaLue 29+337; otherwise it assumes the vaLue 28+337.

3. Wherever an expression is LegaL, you may incLude a CASE expression of the form:

CASE vaLue OF vaLue1 vaLue2

expression;

expression;

ELSE expression For exampLe:

WRITE(CASE Errorcode OF -1- 'IlLegaL input';

2 : 'Number too Large';

3 : 'Number too smaLL';

ELSE 'undefined error');

ALphaPascaL now recognizes modifying assignment operators.

operators are:

+= Adding assignment operator -= Subtracting assignment operator

*= MuLtipLying assignment operator

1= Dividing assignment operator

These

These operators tell the compiler to modify (instead of replace) the value of, the variable on the left of the assignment operator with the value of the expression on the right of the operator.

For example, 'in the case of the adding assignment operator:

X += 1

tells the compiler to let X assume the value information on these oper~tors, see Section Assignment Operators."

of X+1.

8.1.2.1,

For more

"Modifying

- Operator precedence has been changed to make it more compatible with operator precedence in other language processors on the Alpha Micro system. The relational operators have been made of hiqher precedence than the Boolean operators. (See Section 8.1.1, "Operator Precedence,"

for more information.)

AlphaPascal allows you to label BEGIN-END blocks by following the BEGIN and END keywords with a colon followed by an indentifier. These labels allow you to tell the compiler which BEGINs and ENDS should match. If the structure of your program is such that they do not match, the compiler will tell you so.

For example:

BEGIN Block1

BEGIN : Block2

END : Block2

END : Block1

The compiler checks these labels to make sure that the designated pairs of BEGIN-END keywords are indeed properly matched. For example, the following program would cause an error because the BEGIN-END blocks are not properly nested:

BEGIN Block1

BEGIN : Block2

END Block1

END : Block2

(Changed 30 April 1981)

- Two new keywords have been added to AlphaPascaL: EXTERNAL and MODULE.

These words may no longer be used as identifiers. If they do appear in your programs, you see an error message (e.g., "[TRYSCANJ VAR, PROCEDURE, or FUNCTION expected -- scanning") when you compile the programs.

EXTERNAL alLows you to access variabLes, procedures, and functions in an external library~ and allows a file in a muLtiple-file program to access variables, procedures, and functions in another fiLe. See Section 6.7, "External Declarations," for more information.

The MODULE keyword designates a fil~ that does ,not contain the main program portion of the program. Modules may contain decLaration and definition statements, but may not contain the final BEGIN-END bLock.

(That is, BEGIN-END blocks may only appear in function or procedure definitions if they appear in modules.) See Section 6.1, "Program Declarations," for more information.

- The SEGMENT keyword and segment procedures are no longer supported.

(See the discussions of EXTERNAL and MODULE, above.) Remove the SEGMENT keyword from your programs.

Floating point numbers are now three words in length (i.e., 12 digits).

(They used to be two words, and could only represent six digits.)

You may call assembly language subroutines from within your Pascal programs. For information on writing assembly language subroutines, see Chapter 15, "Assembly Language Subroutines."

- Opening, closing, and specifying files have changed. You may now access AMOS files, and make full use of the Alpha Micro file system.

Refer to Chapter 10, "Input/Output Functions and Procedures," for more information on the procedures and functions that alLow you to search for, open, and read and write sequential and random fiLes. (NOTE: Those of you who have done assembly language programming using monitor calls on the AMOS system wilL recognize some of the new procedure names such as FSPEC, OPF.N, OPENI, OPENO, and OPENR.)

AlphaPascaL supports an external procedure Library. This library contains a series of procedures and functions availabLe to your programs. You may write your own external Libraries that make use of the library provided. See Section 16.1, "STDLlB," for a list of procedures and functions in the Library. If you wish to access these routines in your programs, your programs may not use these names in globaL identifier definitions, since such definitions will override the standard library definitions.

If you wish to access these procedures and functions, simpLy invoke them in your pr~gram. If they are not defined within that program, AlphaPascal assumes that they are in the external library.

(Changed 30 April 1981)

SeveraL procedures and identifiers used by previous versions of ALphaPascaL are not supported by the current version:

BLOCKREAD BLOCKWRITE UNITREAD UNITWRITE UNITWAIT UNITBUSY UNITCLEAR GOTOXY HALT

(Refer to Section 11.2.2, "CRT," for information on cursor positioning.) IORESULT

INTERACTIVE fiLes

PROGRAM (the main program) may not be caLLed recursiveLy.

You shouLd be aware of these changes to the standard procedures:

1. RESET and REWRITE accept onLy one argument: a variabLe of type FILE. You may not specify a fiLename after that argument.

2. The fiLe type INTERACTIVE is no Longer supported or needed; repLace it with the standard fiLe type TEXT.

3. In earLier versions of ALphaPascaL, CLOSE took an option as an argument in addition to a variabLe of type FILE; it now accepts onLy a singLe argument-- a variabLe of type FILE.

4. When you use the EXIT statement to exit a program, you must suppLy the PROGRAM keyword as the argument, not the program-name. (That is, EXIT(PROGRAM) is vaLid, but EXIT(NewProgram) is not.) You may, however, exit a procedure or function by giving the name of that procedure or function (e.g., EXIT(EvaLError».

5. WRITE and WRITELN do not accept a BooLean variabLe as an argument.

That is, if NewFiLe is a BooLean variabLe which evaLuates to TRUE:

WRITELN(NewFiLe);

does not print TRUE, but instead generates an error.

Im Dokument Alpha PASCAL (Seite 28-33)