1) ad stem arrays
==============
Stem arrays have been conceived and used since the inception of Rexx.
The pattern is simple: the tail is an integer number from 1 on, the tail with the value 0 keeps the
current number of total stem array elements. E.g.:
a.1="one"
a.2="two"
a.0=2
say "there are" a.0 "items"
Turning such a stem array into an ooRexx array should yield an array that omits the element with the
tail 0 and uses the tail's number as index in the ooRexx array. E.g. turning the above stem array
into an ooRexx array:
a[1]="one"
a[2]="two"
say "there are" a~itmes "items"
1a) In order to create an ooRexx array from a stem array the following method should be added to the
stem class:
makeArrayFromStemArray
This name makes it clear that a stem array is to be processed and that the resulting array should
not have the stem value with the tail 0.
(The existting stem method makeArray continues to create an array that represents all tails of a
stem, including a tail with the value 0.)
1b) In order to create a stem from an ooRexx array the following method should be added to the array
class:
makeStemArray
This name makes it clear that a stem array is to be created from the array items (using the array
index values as tails) and adding the 0 tail to indicate the number of stem elements.
---
2) ad using the array class for reading and writing files/streams directly
==========================================================
The ooRexx stream class has a method arrayin to allow reading the content of a stream into an ooRexx
array, and arrayout to write the content of an array to a stream. In order to use these methods a
stream instance must be created first before being able to use the arrayin and arrayout methods and
closing the stream thereafter. As the purpose of these two methods is to simply get the content into
and from an array, it may be cumbersome to explicitly have to open and close streams in order to
just read into or write the content of an array.
In order to forego the need to create stream instances in order to read the content into an array or
an array into a stream or file two class methods for the ooRexx array class are proposed:
2a) In order to read the content of a stream or a file with a single message into an array the
following method should be added to the array class:
arrayin(filename|stream|file[, Lines|chars)
This allows for supplying either a filename (string), an instance of .File or .Stream and optionally
"Lines" (default, one array element per text line) or "chars" (one array element per character).
2b) In order to write the content of an array to a file or a stream the following method should be
added to the array class:
arrayOut(filename|stream|file[, Lines|chars)
This allows for supplying either a filename (string), an instance of .File or .Stream and optionally
"Lines" (default, a text line per per array element) or "chars" (the characters of all array
elements, without appending endoflines).
---
Any comments, thoughts?
---rony
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel