Presentation space

The presentation space is a data structure that contains an element for each row and column position in the session window (but not including the last row of the session window, which is used for the Operator Information Area). The size of the presentation space depends on the size of the session window. For example, if the session window has 80 rows and 25 columns, then the size of the presentation space is 80 * 24 = 1920.

The position of the elements in the presentation space corresponds serially to the row and column positions in the session window, reading from left to right, top to bottom. For example, if the session window has 80 rows and 25 columns, then:
Figure 1. Correspondence of row and column location in the session window to the position in the presentation space
     Row of    Column of  Corresponds to
     Session   Session    element at this
     Window:   Window:    position in PS:
         1          1             1
         1          2             2
         1          3             3
      ...
         1         80            80
         2          1            81
         2          2            82
         2          3            83
      ...
        24         79          1919
        24         80          1920
Z and I Emulator for Web uses the presentation space to store the characters that are to be displayed in the session window. Each element in the presentation space is used to store one character (and information about that character, such as intensity). For example, if the string Message appears at row 1 and column 1 of the session window, then:
Figure 2. Layout when 'Message' appears in row 1, column 1
     Row of    Column of  Corresponds    Character
     Session   Session    to element     stored in
     Window:   Window:    at this pos-   this element:
                          ition in PS:
         1          1          1          M
         1          2          2          e
         1          3          3          s
         1          4          4          s
         1          5          5          a
         1          6          6          g
         1          7          7          e
Although you normally will not need to use them, Table 1 show the formulas for calculating various values. The meanings of the symbols used in these formulas is as follows:
  • row - A row location in the session window
  • col - A column location in the session window
  • pos - A position in the presentation space
  • NUMROWS - The number of rows in the session window, not including the last row used for the Operator Information Area (OIA).
  • NUMCOLS - The number of columns in the session window.
Table 1. Formulas for calculating values related to presentation space
Value: Formula for calculating:
Size of the PS
 NUMROWS * NUMCOLS

    Example:
    24 * 80 = 1920
row
 (pos + NUMCOLS - 1) / NUMCOLS

    Example:
    (81 + 80 - 1) / 80 = 2 
col
 pos - ((row - 1) * NUMCOLS)

    Example:
    1920 - ((24 - 1) * 80) = 80
pos
 ((row - 1) * NUMCOLS) + col

    Example:
    ((24 - 1) * 80) + 1 = 1641