PROCEDURE dum$display_console_screens, display_console_screens, discs (
  output, o: file = $output
  display_options, do:
    key
      full, f
      partial, p
    keyend = partial
  status)

  set_file_attributes f=output fc=legible pf=continuous
  output_file = output.$eoi

  window_p = $memory($symbol_address(dpv$top_window_p))
  WHILE NOT $nil_pva(window_p) DO

    " Display the window information.

    put_line l=  ' *******************************************************************************' o=output_file

    window_kind = $memory(window_p+14 1)
    present_window_line_number = $memory(window_p+39 1)

    IF (display_options = 'F') OR (display_options = 'FULL') THEN
      put_line l=' WINDOW ID = '//$strrep($memory(window_p+6 4)) o=output_file
      put_line l='        Starting console row number = '//$strrep($memory(window_p+10 1)) o=output_file
      put_line l='        Ending console row number = '//$strrep($memory(window_p+11 1)) o=output_file
      put_line l='        True window class = '//$strrep($memory(window_p+12 1)) o=output_file
      put_line l='        Actual window class = '//$strrep($memory(window_p+13 1)) o=output_file
      put_line l='        Window kind = '//$strrep(window_kind) o=output_file
      put_line l='        Table: starting line in window = '//$strrep($memory(window_p+15 8)) o=output_file
      put_line l='        Table: last line used in window = '//$strrep($memory(window_p+23 8)) o=output_file
      put_line l='        Table: next available line = '//$strrep($memory(window_p+31 8)) o=output_file
      put_line l='        Present window line number = '//$strrep(present_window_line_number) o=output_file
      put_line l=' -------------------------------------------------------------------------------' o=output_file
    IFEND

    " Display the title line of the window.

    line_p = window_p + 40
    line_size = $memory(line_p+2 1)
    IF line_size <> 0 THEN
      put_line l=' TITLE LINE:' o=output_file
      put_line l=' '//$trim($memory_string(line_p+8, line_size)) o=output_file
    ELSE
      put_line l=' TITLE LINE:' o=output_file
      put_line l=' ' o=output_file
    IFEND

    " Retrieve the input line of the window.

    line_p = line_p + 96
    input_line_exists = ($memory(window_p+14 1) = 2)
    IF input_line_exists THEN
      line_size = $memory(line_p+2 1)
      IF line_size <> 0 THEN
        input_line = ' '//$trim($memory_string(line_p+8, line_size))
      ELSE
        input_line = ' '
      IFEND
    IFEND

    " Display the lines of the window.

    line_p = line_p + 96
    IF window_kind = 1 THEN

      " Display the lines on a table.

      FOR line_index = 1 TO 30 DO
        IF $memory(line_p 2) <> 0 THEN
          line_size = $memory(line_p+2 1)
          IF line_size <> 0 THEN
            put_line l=' '//$trim($memory_string(line_p+8 line_size)) o=output_file
          IFEND
        IFEND
        line_p = line_p + 96
      FOREND

    ELSE
      save_line_p = line_p
      FOR line_index = 1 TO present_window_line_number DO
        line_p = line_p + 96
      FOREND

      FOR line_index = (present_window_line_number+1) TO 30 DO
        IF $memory(line_p 2) <> 0 THEN
          line_size = $memory(line_p+2 1)
          IF line_size <> 0 THEN
            put_line l=' '//$trim($memory_string(line_p+8 line_size)) o=output_file
          IFEND
        IFEND
        line_p = line_p + 96
      FOREND

      line_p = save_line_p
      FOR line_index = 1 TO present_window_line_number DO
        IF $memory(line_p 2) <> 0 THEN
          line_size = $memory(line_p+2 1)
          IF line_size <> 0 THEN
            put_line l=' '//$trim($memory_string(line_p+8 line_size)) o=output_file
          IFEND
        IFEND
        line_p = line_p + 96
      FOREND
    IFEND

    " Display the input line of the window.

    IF input_line_exists THEN
      put_line l=' INPUT LINE:' o=output_file
      put_line l=input_line o=output_file
    IFEND

    window_p = $memory(window_p 6)
  WHILEND

PROCEND dum$display_console_screens
