13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

o Each corresponding dimension must have the same index size.o However, the corresponding index types need not be the same.For example, these three array types are congruent even though they arenot identical:TYPE A ARRAY [0 •. 25, 0 •• 18l OF INTEGER;B =ARRAY [10 •• 35, 1!l •• 28l OFC =ARRAY C'A' •. 'Z', 0 •• 181 OFINTEGER;INTEGER;Each of these types is a two-dimensional 26-by-18 array of integers, andhence congruent. On the other hand, the two array typesTYPE D = ARRAY[ 1 •• 5, 1 •• 10 J OF REAL;E =ARRAY [1 .. 50l OF REAL;are not congruent, even though they both contain 50 REAL elements. TypeDis a two-dimensional 5-by-10 array and type Eis one-dimensional.BYTESTREAM and WOR.DSTREAMBYTESTREAM and WORDSTREAM are two special Apple Pascal datatypes. They allow you to pass arrays of unspecified length to proceduresand functions. They act within a procedure or function as if the following(normally illegal) type declarations had been made:TYPE BYTESTREAM =PACKED ARRAYC0 •• ?l OF CHAR;WORDSTREAM = ARRAY [0 •. ?l OF INTEGER;The following rules apply to using BYTESTREAM and WORDSTREAM:o They may be used only to type variable parameters in procedure orfunction parameter lists. They may not be used as general variable types.For a discussion of variable parameters, see Chapter 8.o BYTESTREAM parameters will accept strings and one-dimensionalpacked arrays whose elements are type CHAR, or integer subranges thathave at least one value greater than 127 and none greater than 255.o WORDSTREAM parameters will accept one-dimensional unpackedarrays whose elements are type CHAR, INTEGER, BOOLEAN, or anyCHAR or integer subrange.o Within the procedure or function, variables of type BYTESTREAM mustbe treated as if they were PACKED ARRAY OF CHAR; variables of typeWORDSTREAM must be treated as if they were ARRAY OF INTEGER.The ARRAY TypeIII-49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!