CL-SCREEN - A Slang-based Console I/O library


 

Abstract

The code comes with a BSD-style license so you can basically do with it whatever you want.

Download shortcut: http://weitz.de/files/cl-screen.tar.gz.


 

Contents

  1. Download
  2. The CL-SCREEN dictionary
    1. *backgrounds*
    2. *color-hash*
    3. *color-names*
    4. *screen-cols*
    5. *screen-resize-hook*
    6. *screen-rows*
    7. *sl_key_a1*
    8. *sl_key_a3*
    9. *sl_key_b2*
    10. *sl_key_backspace*
    11. *sl_key_c1*
    12. *sl_key_c3*
    13. *sl_key_delete*
    14. *sl_key_down*
    15. *sl_key_end*
    16. *sl_key_enter*
    17. *sl_key_f0*
    18. *sl_key_f1*
    19. *sl_key_f2*
    20. *sl_key_f3*
    21. *sl_key_f4*
    22. *sl_key_f5*
    23. *sl_key_f6*
    24. *sl_key_f7*
    25. *sl_key_f8*
    26. *sl_key_f9*
    27. *sl_key_home*
    28. *sl_key_ic*
    29. *sl_key_left*
    30. *sl_key_npage*
    31. *sl_key_ppage*
    32. *sl_key_redo*
    33. *sl_key_right*
    34. *sl_key_undo*
    35. *sl_key_up*
    36. add-char
    37. add-char-to-history-line
    38. add-char-to-window
    39. add-line
    40. add-space-to-history-line
    41. add-string-to-window
    42. at-screen-rc
    43. background-color-of
    44. background-of
    45. bottom-y-of
    46. clear-line-in-window
    47. clear-screen
    48. clear-screen-resize-hook
    49. code-color
    50. color-code
    51. current-char-of
    52. cursor-back
    53. cursor-of
    54. cursor-x-of
    55. cursor-y-of
    56. decode-key
    57. draw-line-at-cursor
    58. encode-key
    59. erase-from-cursor-to-eol
    60. erase-from-cursor-to-eos
    61. finish-screen
    62. foreground-color-of
    63. foreground-of
    64. get-color-pair-number
    65. get-cursor
    66. get-decoded-key
    67. get-key
    68. get-screen-size
    69. goto-screen-rc
    70. height-of
    71. initialize-color-hash
    72. initialize-screen
    73. last-line-of
    74. left-x-of
    75. lines-of
    76. make-attribute
    77. parse-float
    78. position-window-cursor
    79. previous-char-of
    80. print-history-line-to-window
    81. prompt-of
    82. random-element
    83. refresh-window
    84. release-screen
    85. remove-char-from-history-line
    86. resize-handler
    87. right-x-of
    88. row-of
    89. screen-of
    90. screen-resize-hook
    91. set-color
    92. set-colors-from-attribute
    93. set-cursor
    94. set-cursor-visibility
    95. set-to-default-color
    96. slang-flush-input
    97. slang-getkey
    98. slang-init-tty
    99. slang-input-pending
    100. slang-process-keystring
    101. slang-reset-tty
    102. slang-unget-key
    103. slkp-define-keysym
    104. slkp-getkey
    105. slkp-init
    106. slsmg-cls
    107. slsmg-draw-hline
    108. slsmg-draw-vline
    109. slsmg-erase-eol
    110. slsmg-erase-eos
    111. slsmg-get-column
    112. slsmg-get-row
    113. slsmg-gotorc
    114. slsmg-init-smg
    115. slsmg-refresh
    116. slsmg-reinit-smg
    117. slsmg-reset-smg
    118. slsmg-set-char-set
    119. slsmg-set-color
    120. slsmg-write-char
    121. slsmg-write-string
    122. sltt-beep
    123. sltt-get-screen-size
    124. sltt-get-terminfo
    125. sltt-set-color
    126. sltt-set-cursor-visibility
    127. sltt-tgetstr
    128. text-of
    129. top-y-of
    130. use-ansi-colors-p
    131. valid-color-p
    132. valid-colors
    133. valid-key-p
    134. wait-key
    135. whitespacep
    136. width-of
    137. write-string-at-cursor
  3. Acknowledgements

 

Download

CL-SCREEN together with this documentation can be downloaded from http://weitz.de/files/cl-screen.tar.gz. The current version is 0.1.0.
 

The CL-SCREEN dictionary


[Special variable]
*backgrounds*



[Special variable]
*color-hash*



[Special variable]
*color-names*



[Special variable]
*screen-cols*



[Special variable]
*screen-resize-hook*



[Special variable]
*screen-rows*



[Special variable]
*sl_key_a1*



[Special variable]
*sl_key_a3*



[Special variable]
*sl_key_b2*



[Special variable]
*sl_key_backspace*



[Special variable]
*sl_key_c1*



[Special variable]
*sl_key_c3*



[Special variable]
*sl_key_delete*



[Special variable]
*sl_key_down*



[Special variable]
*sl_key_end*



[Special variable]
*sl_key_enter*



[Special variable]
*sl_key_f0*



[Special variable]
*sl_key_f1*



[Special variable]
*sl_key_f2*



[Special variable]
*sl_key_f3*



[Special variable]
*sl_key_f4*



[Special variable]
*sl_key_f5*



[Special variable]
*sl_key_f6*



[Special variable]
*sl_key_f7*



[Special variable]
*sl_key_f8*



[Special variable]
*sl_key_f9*



[Special variable]
*sl_key_home*



[Special variable]
*sl_key_ic*



[Special variable]
*sl_key_left*



[Special variable]
*sl_key_npage*



[Special variable]
*sl_key_ppage*



[Special variable]
*sl_key_redo*



[Special variable]
*sl_key_right*



[Special variable]
*sl_key_undo*



[Special variable]
*sl_key_up*



[Generic function]
add-char s chr => result



[Method]
add-char (s cl-screen-window-stream) chr => result


(add-char cl-screen-window-stream chr) Add a sigle character to the stream window


[Generic function]
add-char-to-history-line line chr => result



[Method]
add-char-to-history-line (line history-line) chr => result


(add-char-to-history-line line chr column) Add a character to a logical line, positioned at the given column index.


[Generic function]
add-char-to-window window chr => result



[Method]
add-char-to-window (window cl-screen-window) chr => result


(add-char-to-window window chr) Place chr at the cursor position in the window and advance the cursor position accordingly


[Generic function]
add-line s => result



[Method]
add-line (s cl-screen-window-stream) => result


(add-line cl-screen-window-stream) Add a new line to the history buffer stream


[Generic function]
add-space-to-history-line line => result



[Method]
add-space-to-history-line (line history-line) => result


(add-space-to-history-line line) Pad a logical line with a space on the end


[Generic function]
add-string-to-window window str => result



[Method]
add-string-to-window (window cl-screen-window) str => result


(add-string-to-window window str) Places the characters in str onto the window by repeated calls to add-char-to-window


[Generic function]
at-screen-rc window ix iy => result



[Method]
at-screen-rc (window cl-screen-window) ix iy => result


Translate a pair of window indices to screen indices


[Generic accessor]
background-color-of cl-screen-stream => result
(setf (background-color-of cl-screen-stream) new-value)



[Specialized accessor]
background-color-of (cl-screen-stream cl-screen-stream) => result
(setf (background-color-of (cl-screen-stream cl-screen-stream)) new-value)


Foreground colour currently being used for characters writen to the stream


[Generic accessor]
background-of cl-screen-window => result
(setf (background-of cl-screen-window) new-value)



[Specialized accessor]
background-of (cl-screen-window cl-screen-window) => result
(setf (background-of (cl-screen-window cl-screen-window)) new-value)


Background color of window


[Generic accessor]
bottom-y-of cl-screen-window => result
(setf (bottom-y-of cl-screen-window) new-value)



[Specialized accessor]
bottom-y-of (cl-screen-window cl-screen-window) => result
(setf (bottom-y-of (cl-screen-window cl-screen-window)) new-value)


Bottom row index of window on screen


[Generic function]
clear-line-in-window window => result



[Generic function]
clear-screen screen => result


Lambda-list: screen Clear the given screen.


[Method]
clear-screen (screen cl-screen) => result



[Function]
clear-screen-resize-hook => result



[Function]
code-color code type => result


(code-color code type) returns the symbol for the given :foreground or :background type colour given as a symbol name. eg (code-color 0 :foreground)->gray


[Function]
color-code sym type => result


(color-code sym type). Given the colour symbol for a :foreground or :background colour, return the numeric colour-code of the colour


[Generic accessor]
current-char-of cl-screen-input-stream => result
(setf (current-char-of cl-screen-input-stream) new-value)



[Specialized accessor]
current-char-of (cl-screen-input-stream cl-screen-input-stream) => result
(setf (current-char-of (cl-screen-input-stream cl-screen-input-stream)) new-value)


Character currently typed by user


[Specialized accessor]
current-char-of (cl-screen-input-stream cl-screen-stream) => result
(setf (current-char-of (cl-screen-input-stream cl-screen-stream)) new-value)


Char currently read from this stream


[Generic function]
cursor-back screen => result



[Method]
cursor-back (screen cl-screen) => result



[Generic accessor]
cursor-of history-line => result
(setf (cursor-of history-line) new-value)



[Specialized accessor]
cursor-of (history-line history-line) => result
(setf (cursor-of (history-line history-line)) new-value)


The position the next character will be printed at in this line


[Generic accessor]
cursor-x-of cl-screen-window => result
(setf (cursor-x-of cl-screen-window) new-value)



[Specialized accessor]
cursor-x-of (cl-screen-window cl-screen-window) => result
(setf (cursor-x-of (cl-screen-window cl-screen-window)) new-value)


Position of cursor relative to left of window


[Generic accessor]
cursor-y-of cl-screen-window => result
(setf (cursor-y-of cl-screen-window) new-value)



[Specialized accessor]
cursor-y-of (cl-screen-window cl-screen-window) => result
(setf (cursor-y-of (cl-screen-window cl-screen-window)) new-value)


Position of cursor relative to top of window


[Generic function]
decode-key screen keysym => result


Lambda-list: screen key Decode the given number into a representation of it as a key.


[Method]
decode-key (screen cl-screen) keysym => result



[Generic function]
draw-line-at-cursor screen direction length => result


Lambda-list: screen direction length If possible, draw a line of the given length and running in the supplied direction on the screen. Valid directions are :horizontal and :vertical.


[Method]
draw-line-at-cursor (screen cl-screen) direction length => result



[Generic function]
encode-key screen key => result


Lambda-list: screen key Encode the given representation of a key into a numeric value.


[Method]
encode-key (screen cl-screen) key => result



[Generic function]
erase-from-cursor-to-eol screen => result


Lambda-list: screen Erase the screen between the cursor point and the end of the row.


[Method]
erase-from-cursor-to-eol (screen cl-screen) => result



[Generic function]
erase-from-cursor-to-eos screen => result


Lambda-list: screen Erase the screen between the cursor point and the end of the screen.


[Method]
erase-from-cursor-to-eos (screen cl-screen) => result



[Generic function]
finish-screen screen => result


Lambda-list: screen Finish all output operations to the given screen.


[Method]
finish-screen (screen cl-screen) => result



[Generic accessor]
foreground-color-of cl-screen-stream => result
(setf (foreground-color-of cl-screen-stream) new-value)



[Specialized accessor]
foreground-color-of (cl-screen-stream cl-screen-stream) => result
(setf (foreground-color-of (cl-screen-stream cl-screen-stream)) new-value)


Foreground colour currently being used for chararcters written to the stream


[Generic accessor]
foreground-of cl-screen-window => result
(setf (foreground-of cl-screen-window) new-value)



[Specialized accessor]
foreground-of (cl-screen-window cl-screen-window) => result
(setf (foreground-of (cl-screen-window cl-screen-window)) new-value)


Foreground colour of window


[Function]
get-color-pair-number fg bg => result



[Generic function]
get-cursor screen => result


Lambda-list: screen Return, in multiple values, the row and column that the user's insertion point is at.


[Method]
get-cursor (screen cl-screen) => result



[Generic function]
get-decoded-key screen => result


Lambda-list: screen Return the decoded name of the keystroke available from the keyboard buffer or nil if nothing available


[Method]
get-decoded-key (screen cl-screen) => result



[Function]
get-key => result



[Generic function]
get-screen-size screen => result


Lambda-list: screen Return multiple values containing the number of rows and columns of the screen's current size.


[Method]
get-screen-size (screen cl-screen) => result



[Generic function]
goto-screen-rc window ix iy => result



[Method]
goto-screen-rc (window cl-screen-window) ix iy => result


Translate a pair of window indices to screen indices and set the cursor there.


[Generic function]
height-of window => result



[Method]
height-of (window cl-screen-window) => result


(height-of cl-screen-window) Returns the height of the given window


[Function]
initialize-color-hash => result



[Generic function]
initialize-screen screen &key abort-char-code => result


Lambda-list: screen &key &allow-other-keys Initialize the screen for the given screen object. Extra keyword arguments are defined by the given screen object type.


[Method]
initialize-screen (screen cl-screen) &key abort-char-code => result



[Generic function]
last-line-of s => result



[Method]
last-line-of (s cl-screen-window-stream) => result


(last-line-of cl-screen-window-stream) Return the last line in the array of logical lines (the one we write to)


[Generic accessor]
left-x-of cl-screen-window => result
(setf (left-x-of cl-screen-window) new-value)



[Specialized accessor]
left-x-of (cl-screen-window cl-screen-window) => result
(setf (left-x-of (cl-screen-window cl-screen-window)) new-value)


Leftmost column index of window on screen


[Generic accessor]
lines-of cl-screen-window-stream => result
(setf (lines-of cl-screen-window-stream) new-value)



[Specialized accessor]
lines-of (cl-screen-window-stream cl-screen-window-stream) => result
(setf (lines-of (cl-screen-window-stream cl-screen-window-stream)) new-value)


Stream that prints to a history buffer for window


[Function]
make-attribute fore-sym back-sym => result


(make-attribute fore-sym back-sym) Given foreground symbol and background symbol for colour, return the attribute value e.g (make-attribute 'black 'red)


[Function]
parse-float string &key start end radix junk-allowed => result


Converts a substring of STRING, as delimited by START and END, to a floating point number, if possible. START and END default to the beginning and end of the string. RADIX must be between 2 and 36. A floating point number will be returned if the string consists of an optional string of spaces and an optional sign, followed by a string of digits optionally containing a decimal point, and an optional e or E followed by an optionally signed integer. The use of e/E to indicate an exponent only works for RADIX = 10. Returns the floating point number, if any, and the index for the first character after the number.


[Generic function]
position-window-cursor window column row => result



[Method]
position-window-cursor (window cl-screen-window) column row => result


(position-window-cursor ((window cl-screen-window) column row)) Sets the windows cursor to be at the colum, row offset from its top left hand corner


[Generic accessor]
previous-char-of cl-screen-input-stream => result
(setf (previous-char-of cl-screen-input-stream) new-value)



[Specialized accessor]
previous-char-of (cl-screen-input-stream cl-screen-input-stream) => result
(setf (previous-char-of (cl-screen-input-stream cl-screen-input-stream)) new-value)


Character previously typed by user


[Specialized accessor]
previous-char-of (cl-screen-input-stream cl-screen-stream) => result
(setf (previous-char-of (cl-screen-input-stream cl-screen-stream)) new-value)


Char previously read from this stream


[Generic function]
print-history-line-to-window line window row => result



[Method]
print-history-line-to-window (line history-line) (window cl-screen-window) row => result


(print-history-line-to-window history-line cl-screen-window) Print max-length chars of a given logical line on a cl-screen window starting from the given column


[Generic accessor]
prompt-of cl-screen-input-stream => result
(setf (prompt-of cl-screen-input-stream) new-value)



[Specialized accessor]
prompt-of (cl-screen-input-stream cl-screen-input-stream) => result
(setf (prompt-of (cl-screen-input-stream cl-screen-input-stream)) new-value)


Prompt for input


[Function]
random-element l &key not => result



[Generic function]
refresh-window s &key position-cursor => result



[Method]
refresh-window (s cl-screen-window-stream) &key position-cursor => result


(refresh-window cl-screen-window :position-cursor p) Send the history lines to the window, then write the text of the window to the main screen. If p is non nil position the screen cursor at the window cursors position.


[Method]
refresh-window (s cl-screen-window) &key position-cursor => result


(refresh-window cl-screen-window :position-cursor p) Write the text of the window to the main screen. If p is non nil position the screen cursor at the window cursors position.


[Generic function]
release-screen screen => result


Lambda-list: screen Release the given screen object. What this means is defined by the type of the supplied screen object.


[Method]
release-screen (screen cl-screen) => result



[Generic function]
remove-char-from-history-line line => result



[Method]
remove-char-from-history-line (line history-line) => result


(remove-char-from-history-line chr column) Remove the character from the line at column from history


[Function]
resize-handler => result



[Generic accessor]
right-x-of cl-screen-window => result
(setf (right-x-of cl-screen-window) new-value)



[Specialized accessor]
right-x-of (cl-screen-window cl-screen-window) => result
(setf (right-x-of (cl-screen-window cl-screen-window)) new-value)


Rightmost column index of window on screen


[Generic accessor]
row-of cl-screen-input-stream => result
(setf (row-of cl-screen-input-stream) new-value)



[Specialized accessor]
row-of (cl-screen-input-stream cl-screen-input-stream) => result
(setf (row-of (cl-screen-input-stream cl-screen-input-stream)) new-value)


Row on screen at which input appears


[Generic accessor]
screen-of cl-screen-input-stream => result
(setf (screen-of cl-screen-input-stream) new-value)



[Specialized accessor]
screen-of (cl-screen-input-stream cl-screen-input-stream) => result
(setf (screen-of (cl-screen-input-stream cl-screen-input-stream)) new-value)


Screen that this stream interacts with


[Specialized accessor]
screen-of (cl-screen-input-stream cl-screen-window) => result
(setf (screen-of (cl-screen-input-stream cl-screen-window)) new-value)


Screen that this window interacts with


[Specialized accessor]
screen-of (cl-screen-input-stream cl-screen-stream) => result
(setf (screen-of (cl-screen-input-stream cl-screen-stream)) new-value)


Screen that this stream interacts with


[Generic accessor]
screen-resize-hook screen => result
(setf (screen-resize-hook screen) new-hook)


Lambda-list: screen Return the current hook which is invoked when the window is resized. Use (setf screen-resize-hook) to set the hook or remove it (by setting it to nil).


[Specialized accessor]
screen-resize-hook (screen cl-screen) => result
(setf (screen-resize-hook (screen cl-screen)) new-hook)



[Generic function]
set-color screen foreground background => result


Lambda-list: screen foreground background Set the color of the following text drawing operations to the given colors named by the symbols foreground and background.


[Method]
set-color (screen cl-screen) foreground background => result



[Function]
set-colors-from-attribute attribute => result


(set-colors-from-attribute attribute) Given an attribute code with the high byte being the index of the background and the low byte the foreground, set the appropiate color.


[Generic function]
set-cursor screen row col => result


Lambda-list: screen row col Move the user's insertion cursor to the given row and column.


[Method]
set-cursor (screen cl-screen) row col => result



[Function]
set-cursor-visibility visible => result



[Generic function]
set-to-default-color screen => result


Lambda-list: screen Set the color of the following text drawing operations to the system default foreground and background.


[Method]
set-to-default-color (screen cl-screen) => result



[Function]
slang-flush-input => result



[Function]
slang-getkey => result



[Function]
slang-init-tty abort-char-code flow-control output-processing => result



[Function]
slang-input-pending time => result



[Function]
slang-process-keystring keystring => result



[Function]
slang-reset-tty => result



[Function]
slang-unget-key ch => result



[Function]
slkp-define-keysym key sym => result



[Function]
slkp-getkey => result



[Function]
slkp-init => result



[Function]
slsmg-cls => result



[Function]
slsmg-draw-hline len => result



[Function]
slsmg-draw-vline len => result



[Function]
slsmg-erase-eol => result



[Function]
slsmg-erase-eos => result



[Function]
slsmg-get-column => result



[Function]
slsmg-get-row => result



[Function]
slsmg-gotorc row col => result



[Function]
slsmg-init-smg => result



[Function]
slsmg-refresh => result



[Function]
slsmg-reinit-smg => result



[Function]
slsmg-reset-smg => result



[Function]
slsmg-set-char-set set => result



[Function]
slsmg-set-color obj => result



[Function]
slsmg-write-char ch => result



[Function]
slsmg-write-string string => result



[Function]
sltt-beep => result



[Function]
sltt-get-screen-size => result



[Function]
sltt-get-terminfo => result



[Function]
sltt-set-color obj name fg bg => result



[Function]
sltt-set-cursor-visibility flag => result



[Function]
sltt-tgetstr char => result



[Generic accessor]
text-of history-line => result
(setf (text-of history-line) new-value)



[Specialized accessor]
text-of (history-line history-line) => result
(setf (text-of (history-line history-line)) new-value)


A line of text in a window history


[Specialized accessor]
text-of (history-line cl-screen-window) => result
(setf (text-of (history-line cl-screen-window)) new-value)


Text in window as an array of strings.


[Generic accessor]
top-y-of cl-screen-window => result
(setf (top-y-of cl-screen-window) new-value)



[Specialized accessor]
top-y-of (cl-screen-window cl-screen-window) => result
(setf (top-y-of (cl-screen-window cl-screen-window)) new-value)


Topmost row index of window on screen


[Function]
use-ansi-colors-p => result



[Generic function]
valid-color-p screen sym type => result


Lambda-list: screen name type Returns true iff the color designated by the symbol name names a valid color of the specified type. Valid values for type are :foreground and :background.


[Method]
valid-color-p (screen cl-screen) sym type => result



[Generic function]
valid-colors screen type => result


Lambda-list: screen type Returns a possibly non-exhaustive list of colors which are valid for the given type on the given screen. Valid types are :foreground and :background.


[Method]
valid-colors (screen cl-screen) type => result



[Function]
valid-key-p key-code => result



[Function]
wait-key => result



[Function]
whitespacep char => result



[Generic accessor]
width-of history-line => result
(setf (width-of cl-screen-input-stream) new-value)



[Method]
width-of (history-line history-line) => result


automatically generated reader method


[Specialized accessor]
width-of (history-line cl-screen-input-stream) => result
(setf (width-of (cl-screen-input-stream cl-screen-input-stream)) new-value)


Width allowed for input


[Method]
width-of (history-line cl-screen-window) => result


(width-of cl-screen-window) Returns the width of the given window


[Generic function]
write-string-at-cursor screen string => result


Lambda-list: screen string Write the given string to the screen at the cursor position. If the input includes a newline character or exceeds the number of columns following the cursor position, the output will be truncated, not wrapped.


[Method]
write-string-at-cursor (screen cl-screen) string => result



 

Acknowledgements

This documentation was prepared with DOCUMENTATION-TEMPLATE.

$Header: /usr/local/cvsrep/documentation-template/output.lisp,v 1.13 2007/04/17 19:29:52 edi Exp $

BACK TO MY HOMEPAGE