The
ArrayPrinter is implemented according to the specifications of the
Lisp Hyperspec. For detailed information and examples of Array formatting, visit the following links:
22.1.3.8 Printing Other Arrays
22.1.3.9 Examples of Printing Arrays
Implementation
Setting the Stage
The first step for printing Arrays is to check the values of
*PRINT-ARRAY*,
*PRINT-READABLY*,
*PRINT-LENGTH*, and
*PRINT-LEVEL*. The values of these symbols are stored in instance variables. In order to effectively print multi-dimensional Arrays, we chose a recursive solution. If the Array is does not have a rank of zero, the
PrintThis? method is called and is passed the Array, the axis number of the subarray currently being looked at, the value of
*PRINT-LENGTH*, the value of
*PRINT-LEVEL*, an instance of the printObject function, and the stream that is being printed to. The axis number is equal to the magnitude of the Array axis currently being looked at. Subarray contains the values of the axes that have not yet been processed.
PrintThis?
PrintThis? first checks to see if the length of subarray is zero. A length of zero indicates that we have arrived at leaf nodes, the area where the data resides. Checks are made to the
*PRINT-LENGTH* value, and the data is printed appropriately. If subarray's length is not zero,
PrintThis? is called on the next axis of the Array.
--
RyanBuff - 28 Apr 2006