summaryrefslogtreecommitdiff
path: root/ext/curses/curses.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/curses/curses.c')
-rw-r--r--ext/curses/curses.c1037
1 files changed, 976 insertions, 61 deletions
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index 5d8f2c535a..c060eee8f1 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -11,6 +11,9 @@
*
* maintainers:
* - Takaaki Tateishi (ttate@kt.jaist.ac.jp)
+ *
+ * doumentation:
+ * - Vincent Batts (vbatts@hashbangbash.com)
*/
#include "ruby.h"
@@ -114,7 +117,13 @@ prep_window(VALUE class, WINDOW *window)
/*-------------------------- module Curses --------------------------*/
-/* def init_screen */
+/*
+ * Document-method: Curses.init_screen
+ *
+ * Initialize a standard screen
+ *
+ * see also Curses.stdscr
+ */
static VALUE
curses_init_screen(void)
{
@@ -129,10 +138,17 @@ curses_init_screen(void)
return rb_stdscr;
}
-/* def stdscr */
+/*
+ * Document-method: Curses.stdscr
+ *
+ * The Standard Screen.
+ * Upon initializing curses, a default window called stdscr,
+ * which is the size of the terminal screen, is created.
+ *
+ * Many curses functions use this window.
+ */
#define curses_stdscr curses_init_screen
-/* def close_screen */
static VALUE
curses_close_screen(void)
{
@@ -159,7 +175,6 @@ curses_finalize(VALUE dummy)
}
#ifdef HAVE_ISENDWIN
-/* def closed? */
static VALUE
curses_closed(void)
{
@@ -173,7 +188,6 @@ curses_closed(void)
#define curses_closed rb_f_notimplement
#endif
-/* def clear */
static VALUE
curses_clear(VALUE obj)
{
@@ -182,7 +196,6 @@ curses_clear(VALUE obj)
return Qnil;
}
-/* def clrtoeol */
static VALUE
curses_clrtoeol(void)
{
@@ -191,7 +204,6 @@ curses_clrtoeol(void)
return Qnil;
}
-/* def refresh */
static VALUE
curses_refresh(VALUE obj)
{
@@ -200,7 +212,6 @@ curses_refresh(VALUE obj)
return Qnil;
}
-/* def doupdate */
static VALUE
curses_doupdate(VALUE obj)
{
@@ -213,7 +224,6 @@ curses_doupdate(VALUE obj)
return Qnil;
}
-/* def echo */
static VALUE
curses_echo(VALUE obj)
{
@@ -222,7 +232,6 @@ curses_echo(VALUE obj)
return Qnil;
}
-/* def noecho */
static VALUE
curses_noecho(VALUE obj)
{
@@ -231,7 +240,6 @@ curses_noecho(VALUE obj)
return Qnil;
}
-/* def raw */
static VALUE
curses_raw(VALUE obj)
{
@@ -240,7 +248,6 @@ curses_raw(VALUE obj)
return Qnil;
}
-/* def noraw */
static VALUE
curses_noraw(VALUE obj)
{
@@ -249,7 +256,6 @@ curses_noraw(VALUE obj)
return Qnil;
}
-/* def cbreak */
static VALUE
curses_cbreak(VALUE obj)
{
@@ -258,7 +264,6 @@ curses_cbreak(VALUE obj)
return Qnil;
}
-/* def nocbreak */
static VALUE
curses_nocbreak(VALUE obj)
{
@@ -267,7 +272,6 @@ curses_nocbreak(VALUE obj)
return Qnil;
}
-/* def nl */
static VALUE
curses_nl(VALUE obj)
{
@@ -276,7 +280,6 @@ curses_nl(VALUE obj)
return Qnil;
}
-/* def nonl */
static VALUE
curses_nonl(VALUE obj)
{
@@ -285,7 +288,6 @@ curses_nonl(VALUE obj)
return Qnil;
}
-/* def beep */
static VALUE
curses_beep(VALUE obj)
{
@@ -296,7 +298,6 @@ curses_beep(VALUE obj)
return Qnil;
}
-/* def flash */
static VALUE
curses_flash(VALUE obj)
{
@@ -329,7 +330,15 @@ curses_char(VALUE c)
}
#ifdef HAVE_UNGETCH
-/* def ungetch */
+/*
+ * Document-method: Curses.ungetch
+ * call-seq: ungetch(ch)
+ *
+ * Places +ch+ back onto the input queue to be returned by
+ * the next call to Curses.getch.
+ *
+ * There is just one input queue for all windows.
+ */
static VALUE
curses_ungetch(VALUE obj, VALUE ch)
{
@@ -342,7 +351,6 @@ curses_ungetch(VALUE obj, VALUE ch)
#define curses_ungetch rb_f_notimplement
#endif
-/* def setpos(y, x) */
static VALUE
curses_setpos(VALUE obj, VALUE y, VALUE x)
{
@@ -351,7 +359,6 @@ curses_setpos(VALUE obj, VALUE y, VALUE x)
return Qnil;
}
-/* def standout */
static VALUE
curses_standout(VALUE obj)
{
@@ -360,7 +367,6 @@ curses_standout(VALUE obj)
return Qnil;
}
-/* def standend */
static VALUE
curses_standend(VALUE obj)
{
@@ -369,7 +375,6 @@ curses_standend(VALUE obj)
return Qnil;
}
-/* def inch */
static VALUE
curses_inch(VALUE obj)
{
@@ -377,7 +382,6 @@ curses_inch(VALUE obj)
return CH2FIX(inch());
}
-/* def addch(ch) */
static VALUE
curses_addch(VALUE obj, VALUE ch)
{
@@ -386,7 +390,6 @@ curses_addch(VALUE obj, VALUE ch)
return Qnil;
}
-/* def insch(ch) */
static VALUE
curses_insch(VALUE obj, VALUE ch)
{
@@ -395,7 +398,13 @@ curses_insch(VALUE obj, VALUE ch)
return Qnil;
}
-/* def addstr(str) */
+/*
+ * Document-method: Curses.addstr
+ * call-seq: addstr(str)
+ *
+ * add a string of characters +str+, to the window and advance cursor
+ *
+ */
static VALUE
curses_addstr(VALUE obj, VALUE str)
{
@@ -416,7 +425,14 @@ getch_func(void *arg)
return Qnil;
}
-/* def getch */
+/*
+ * Document-method: Curses.getch
+ *
+ * Read and returns a character from the window.
+ *
+ * See Curses::Key to all the function KEY_* available
+ *
+ */
static VALUE
curses_getch(VALUE obj)
{
@@ -448,7 +464,6 @@ getstr_func(void *arg)
return Qnil;
}
-/* def getstr */
static VALUE
curses_getstr(VALUE obj)
{
@@ -459,7 +474,6 @@ curses_getstr(VALUE obj)
return rb_locale_str_new_cstr(rtn);
}
-/* def delch */
static VALUE
curses_delch(VALUE obj)
{
@@ -468,7 +482,6 @@ curses_delch(VALUE obj)
return Qnil;
}
-/* def delelteln */
static VALUE
curses_deleteln(VALUE obj)
{
@@ -479,7 +492,6 @@ curses_deleteln(VALUE obj)
return Qnil;
}
-/* def insertln */
static VALUE
curses_insertln(VALUE obj)
{
@@ -490,7 +502,6 @@ curses_insertln(VALUE obj)
return Qnil;
}
-/* def keyname */
static VALUE
curses_keyname(VALUE obj, VALUE c)
{
@@ -581,6 +592,12 @@ curses_attron(VALUE obj, VALUE attrs)
/* return INT2FIX(attroff(NUM2INT(attrs))); */
}
+/*
+ * call-seq: attrset(attrs)
+ *
+ * see also Curses::Window.attrset
+ *
+ */
static VALUE
curses_attrset(VALUE obj, VALUE attrs)
{
@@ -589,6 +606,19 @@ curses_attrset(VALUE obj, VALUE attrs)
/* return INT2FIX(attroff(NUM2INT(attrs))); */
}
+/*
+ * Document-method: Curses.bkgdset
+ * call-seq: bkgdset(ch)
+ *
+ * Manipulate the background of the named window
+ * with character Integer +ch+
+ *
+ * The background becomes a property of the character
+ * and moves with the character through any scrolling
+ * and insert/delete line/character operations.
+ *
+ * see also the system manual for curs_bkgd(3)
+ */
static VALUE
curses_bkgdset(VALUE obj, VALUE ch)
{
@@ -599,6 +629,17 @@ curses_bkgdset(VALUE obj, VALUE ch)
return Qnil;
}
+/*
+ * call-seq: bkgd(ch)
+ *
+ * Window background manipulation routines.
+ *
+ * Set the background property of the current
+ * and then apply the character Integer +ch+ setting
+ * to every character position in that window.
+ *
+ * see also the system manual for curs_bkgd(3)
+ */
static VALUE
curses_bkgd(VALUE obj, VALUE ch)
{
@@ -611,6 +652,11 @@ curses_bkgd(VALUE obj, VALUE ch)
}
#if defined(HAVE_USE_DEFAULT_COLORS)
+/*
+ * tells the curses library to use terminal's default colors.
+ *
+ * see also the system manual for default_colors(3)
+ */
static VALUE
curses_use_default_colors(VALUE obj)
{
@@ -623,6 +669,12 @@ curses_use_default_colors(VALUE obj)
#endif
#if defined(HAVE_TABSIZE)
+/*
+ * Document-method: TABSIZE=
+ * call-seq: TABSIZE=(value)
+ *
+ * Sets the TABSIZE to Integer +value+
+ */
static VALUE
curses_tabsize_set(VALUE obj, VALUE val)
{
@@ -634,6 +686,9 @@ curses_tabsize_set(VALUE obj, VALUE val)
#endif
#if defined(HAVE_TABSIZE)
+/*
+ * Returns the number of positions in a tab.
+ */
static VALUE
curses_tabsize_get(VALUE ojb)
{
@@ -644,6 +699,11 @@ curses_tabsize_get(VALUE ojb)
#endif
#if defined(HAVE_ESCDELAY)
+/*
+ * call-seq: ESCDELAY=(value)
+ *
+ * Sets the ESCDELAY to Integer +value+
+ */
static VALUE
curses_escdelay_set(VALUE obj, VALUE val)
{
@@ -655,6 +715,10 @@ curses_escdelay_set(VALUE obj, VALUE val)
#endif
#if defined(HAVE_ESCDELAY)
+/*
+ * Returns the total time, in milliseconds, for which
+ * curses will await a character sequence, e.g., a function key
+ */
static VALUE
curses_escdelay_get(VALUE obj)
{
@@ -664,6 +728,21 @@ curses_escdelay_get(VALUE obj)
#define curses_escdelay_get rb_f_notimplement
#endif
+/*
+ * Document-method: Curses.resize
+ * call-seq: resize(lines, cols)
+ *
+ * alias for Curses.resizeterm
+ *
+ */
+
+/*
+ * Document-method: Curses.resizeterm
+ * call-seq: resizeterm(lines, cols)
+ *
+ * Resize the current term to Fixnum +lines+ and Fixnum +cols+
+ *
+ */
static VALUE
curses_resizeterm(VALUE obj, VALUE lin, VALUE col)
{
@@ -795,6 +874,11 @@ curses_mousedata_free(struct mousedata *mdata)
xfree(mdata->mevent);
}
+/*
+ * Document-method: Curses.getmouse
+ *
+ * Returns the current mouse or nil
+ */
static VALUE
curses_getmouse(VALUE obj)
{
@@ -840,15 +924,52 @@ static VALUE func_name (VALUE mouse) \
return (UINT2NUM(mdata->mevent -> mem)); \
}
+/*
+ * Document-method: Curses::MouseEvent.eid
+ *
+ * Returns the current mouse id
+ */
DEFINE_MOUSE_GET_MEMBER(curs_mouse_id, id)
+/*
+ * Document-method: Curses::MouseEvent.x
+ *
+ * Returns the current mouse's X coordinate
+ */
DEFINE_MOUSE_GET_MEMBER(curs_mouse_x, x)
+/*
+ * Document-method: Curses::MouseEvent.y
+ *
+ * Returns the current mouse's Y coordinate
+ */
DEFINE_MOUSE_GET_MEMBER(curs_mouse_y, y)
+/*
+ * Document-method: Curses::MouseEvent.z
+ *
+ * Returns the current mouse's Z coordinate
+ */
DEFINE_MOUSE_GET_MEMBER(curs_mouse_z, z)
+/*
+ * Document-method: Curses::MouseEvent.bstate
+ *
+ * Returns the current mouse's B state.
+ *
+ * ???
+ */
DEFINE_MOUSE_GET_MEMBER(curs_mouse_bstate, bstate)
#undef define_curs_mouse_member
#endif /* USE_MOUSE */
#ifdef HAVE_TIMEOUT
+/*
+ * Document-method: Curses.timeout=
+ * call-seq: timeout=(delay)
+ *
+ * Sets block and non-blocking reads for the window.
+ * - If delay is negative, blocking read is used (i.e., waits indefinitely for input).
+ * - If delay is zero, then non-blocking read is used (i.e., read returns ERR if no input is waiting).
+ * - If delay is positive, then read blocks for delay milliseconds, and returns ERR if there is still no input.
+ *
+ */
static VALUE
curses_timeout(VALUE obj, VALUE delay)
{
@@ -884,7 +1005,7 @@ curses_reset_prog_mode(VALUE obj)
/*-------------------------- class Window --------------------------*/
-/* def self.allocate */
+/* returns a Curses::Window object */
static VALUE
window_s_allocate(VALUE class)
{
@@ -893,7 +1014,17 @@ window_s_allocate(VALUE class)
return Data_Make_Struct(class, struct windata, 0, free_window, winp);
}
-/* def initialize(h, w, top, left) */
+/*
+ * Document-method: Curses::Window.new
+ * call-seq: new(height, width, top, left)
+ *
+ * Contruct a new Curses::Window with constraints of
+ * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column.
+ *
+ * A new window using full screen is called as
+ * Curses::Window.new(0,0,0,0)
+ *
+ */
static VALUE
window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left)
{
@@ -911,7 +1042,14 @@ window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left)
return obj;
}
-/* def subwin(height, width, top, left) */
+/*
+ * Document-method: Curses::Window.subwin
+ * call-seq: subwin(height, width, top, left)
+ *
+ * Contruct a new subwindow with constraints of
+ * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column.
+ *
+ */
static VALUE
window_subwin(VALUE obj, VALUE height, VALUE width, VALUE top, VALUE left)
{
@@ -931,7 +1069,11 @@ window_subwin(VALUE obj, VALUE height, VALUE width, VALUE top, VALUE left)
return win;
}
-/* def close */
+/*
+ * Document-method: Curses::Window.close
+ *
+ * Deletes the window, and frees the memory
+ */
static VALUE
window_close(VALUE obj)
{
@@ -944,7 +1086,11 @@ window_close(VALUE obj)
return Qnil;
}
-/* def clear */
+/*
+ * Document-method: Curses::Window.clear
+ *
+ * Clear the window.
+ */
static VALUE
window_clear(VALUE obj)
{
@@ -956,7 +1102,11 @@ window_clear(VALUE obj)
return Qnil;
}
-/* def clrtoeol */
+/*
+ * Document-method: Curses::Window.clrtoeol
+ *
+ * Clear the window to the end of line, that the cursor is currently on.
+ */
static VALUE
window_clrtoeol(VALUE obj)
{
@@ -968,7 +1118,12 @@ window_clrtoeol(VALUE obj)
return Qnil;
}
-/* def refresh */
+/*
+ * Document-method: Curses::Window.refresh
+ *
+ * Refreshes the windows and lines.
+ *
+ */
static VALUE
window_refresh(VALUE obj)
{
@@ -980,7 +1135,14 @@ window_refresh(VALUE obj)
return Qnil;
}
-/* def noutrefresh */
+/*
+ * Document-method: Curses::Window.noutrefresh
+ *
+ * Refreshes the windows and lines.
+ *
+ * Curses::Window.noutrefresh allows multiple updates with
+ * more efficiency than Curses::Window.refresh alone.
+ */
static VALUE
window_noutrefresh(VALUE obj)
{
@@ -996,7 +1158,12 @@ window_noutrefresh(VALUE obj)
return Qnil;
}
-/* def move(y, x) */
+/*
+ * Document-method: Curses::Window.move
+ * call-seq: move(y,x)
+ *
+ * Moves the window so that the upper left-hand corner is at position (+y+, +x+)
+ */
static VALUE
window_move(VALUE obj, VALUE y, VALUE x)
{
@@ -1008,7 +1175,14 @@ window_move(VALUE obj, VALUE y, VALUE x)
return Qnil;
}
-/* def setpos(y, x) */
+/*
+ * Document-method: Curses::Window.setpos
+ * call-seq: setpos(y, x)
+ *
+ * A setter for the position of the window,
+ * using coordinates +x+ and +y+
+ *
+ */
static VALUE
window_setpos(VALUE obj, VALUE y, VALUE x)
{
@@ -1019,7 +1193,11 @@ window_setpos(VALUE obj, VALUE y, VALUE x)
return Qnil;
}
-/* def cury */
+/*
+ * Document-method: Curses::Window.cury
+ *
+ * A getter for the current line (Y coord) of the window
+ */
static VALUE
window_cury(VALUE obj)
{
@@ -1031,7 +1209,11 @@ window_cury(VALUE obj)
return INT2FIX(y);
}
-/* def curx */
+/*
+ * Document-method: Curses::Window.curx
+ *
+ * A getter for the current column (X coord) of the window
+ */
static VALUE
window_curx(VALUE obj)
{
@@ -1043,7 +1225,11 @@ window_curx(VALUE obj)
return INT2FIX(x);
}
-/* def maxy */
+/*
+ * Document-method: Curses::Window.maxy
+ *
+ * A getter for the maximum lines for the window
+ */
static VALUE
window_maxy(VALUE obj)
{
@@ -1063,7 +1249,11 @@ window_maxy(VALUE obj)
#endif
}
-/* def maxx */
+/*
+ * Document-method: Curses::Window.maxx
+ *
+ * A getter for the maximum columns for the window
+ */
static VALUE
window_maxx(VALUE obj)
{
@@ -1083,7 +1273,11 @@ window_maxx(VALUE obj)
#endif
}
-/* def begy */
+/*
+ * Document-method: Curses::Window.begy
+ *
+ * A getter for the beginning line (Y coord) of the window
+ */
static VALUE
window_begy(VALUE obj)
{
@@ -1099,7 +1293,11 @@ window_begy(VALUE obj)
#endif
}
-/* def begx */
+/*
+ * Document-method: Curses::Window.begx
+ *
+ * A getter for the beginning column (X coord) of the window
+ */
static VALUE
window_begx(VALUE obj)
{
@@ -1115,7 +1313,17 @@ window_begx(VALUE obj)
#endif
}
-/* def box(vert, hor) */
+/*
+ * Document-method: Curses::Window.box
+ * call-seq: box(vert, hor)
+ *
+ * set the characters to frame the window in.
+ * The vertical +vert+ and horizontal +hor+ character.
+ *
+ * win = Curses::Window.new(5,5,5,5)
+ * win.box(?|, ?-)
+ *
+ */
static VALUE
window_box(int argc, VALUE *argv, VALUE self)
{
@@ -1149,7 +1357,15 @@ window_box(int argc, VALUE *argv, VALUE self)
return Qnil;
}
-/* def standout */
+/*
+ * Document-method: Curses::Window.standout
+ *
+ * Enables the best highlighting mode of the terminal.
+ *
+ * This is equivalent to Curses::Window.attron(A_STANDOUT)
+ *
+ * see also Curses::Window.attrset
+ */
static VALUE
window_standout(VALUE obj)
{
@@ -1160,7 +1376,15 @@ window_standout(VALUE obj)
return Qnil;
}
-/* def standend */
+/*
+ * Document-method: Curses::Window.standend
+ *
+ * Enables the Normal display (no highlight)
+ *
+ * This is equivalent to Curses::Window.attron(A_NORMAL)
+ *
+ * see also Curses::Window.attrset
+ */
static VALUE
window_standend(VALUE obj)
{
@@ -1171,7 +1395,11 @@ window_standend(VALUE obj)
return Qnil;
}
-/* def inch */
+/*
+ * Document-method: Curses::Window.inch
+ *
+ * Returns the character at the current position of the window.
+ */
static VALUE
window_inch(VALUE obj)
{
@@ -1181,7 +1409,14 @@ window_inch(VALUE obj)
return CH2FIX(winch(winp->window));
}
-/* def addch(ch) */
+/*
+ * Document-method: Curses::Window.addch
+ * call-seq: addch(ch)
+ *
+ * Add a character +ch+, with attributes, to the window, then advance the cursor.
+ *
+ * see also the system manual for curs_addch(3)
+ */
static VALUE
window_addch(VALUE obj, VALUE ch)
{
@@ -1193,7 +1428,13 @@ window_addch(VALUE obj, VALUE ch)
return Qnil;
}
-/* def insch(ch) */
+/*
+ * Document-method: Curses::Window.insch
+ * call-seq: insch(ch)
+ *
+ * Insert a character +ch+, before the cursor, in the current window
+ *
+ */
static VALUE
window_insch(VALUE obj, VALUE ch)
{
@@ -1205,7 +1446,13 @@ window_insch(VALUE obj, VALUE ch)
return Qnil;
}
-/* def addstr(str) */
+/*
+ * Document-method: Curses::Window.addstr
+ * call-seq: addstr(str)
+ *
+ * add a string of characters +str+, to the window and advance cursor
+ *
+ */
static VALUE
window_addstr(VALUE obj, VALUE str)
{
@@ -1220,7 +1467,14 @@ window_addstr(VALUE obj, VALUE str)
return Qnil;
}
-/* def <<(str) */
+/*
+ * Document-method: Curses::Window.<<
+ * call-seq: <<(str)
+ *
+ * Add String +str+ to the current string.
+ *
+ * See also Curses::Window.addstr
+ */
static VALUE
window_addstr2(VALUE obj, VALUE str)
{
@@ -1241,7 +1495,14 @@ wgetch_func(void *_arg)
return Qnil;
}
-/* def getch */
+/*
+ * Document-method: Curses::Window.getch
+ *
+ * Read and returns a character from the window.
+ *
+ * See Curses::Key to all the function KEY_* available
+ *
+ */
static VALUE
window_getch(VALUE obj)
{
@@ -1279,7 +1540,12 @@ wgetstr_func(void *_arg)
return Qnil;
}
-/* def getstr */
+/*
+ * Document-method: Curses::Window.getstr
+ *
+ * This is equivalent to a series f Curses::Window.getch calls
+ *
+ */
static VALUE
window_getstr(VALUE obj)
{
@@ -1292,7 +1558,12 @@ window_getstr(VALUE obj)
return rb_locale_str_new_cstr(arg.rtn);
}
-/* def delch */
+/*
+ * Document-method: Curses::Window.delch
+ *
+ * Delete the character under the cursor
+ *
+ */
static VALUE
window_delch(VALUE obj)
{
@@ -1303,7 +1574,12 @@ window_delch(VALUE obj)
return Qnil;
}
-/* def delelteln */
+/*
+ * Document-method: Curses::Window.deleteln
+ *
+ * Delete the line under the cursor.
+ *
+ */
static VALUE
window_deleteln(VALUE obj)
{
@@ -1316,7 +1592,12 @@ window_deleteln(VALUE obj)
return Qnil;
}
-/* def insertln */
+/*
+ * Document-method: Curses::Window.insertln
+ *
+ * Inserts a line above the cursor, and the bottom line is lost
+ *
+ */
static VALUE
window_insertln(VALUE obj)
{
@@ -1329,6 +1610,21 @@ window_insertln(VALUE obj)
return Qnil;
}
+/*
+ * Document-method: Curses::Window.scrollok
+ * call-seq: scrollok(bool)
+ *
+ * Controls what happens when the cursor of a window
+ * is moved off the edge of the window or scrolling region,
+ * either as a result of a newline action on the bottom line,
+ * or typing the last character of the last line.
+ *
+ * If disabled, (+bool+ is false), the cursor is left on the bottom line.
+ *
+ * If enabled, (+bool+ is true), the window is scrolled up one line
+ * (Note that to get the physical scrolling effect on the terminal,
+ * it is also necessary to call Curses::Window.idlok)
+ */
static VALUE
window_scrollok(VALUE obj, VALUE bf)
{
@@ -1339,6 +1635,22 @@ window_scrollok(VALUE obj, VALUE bf)
return Qnil;
}
+/*
+ * Document-method: Curses::Window.idlok
+ * call-seq: idlok(bool)
+ *
+ * If +bool+ is +true+ curses considers using the hardware insert/delete
+ * line feature of terminals so equipped.
+ *
+ * If +bool+ is +false+, disables use of line insertion and deletion.
+ * This option should be enabled only if the application needs insert/delete
+ * line, for example, for a screen editor.
+ *
+ * It is disabled by default because insert/delete line tends to be visually
+ * annoying when used in applications where it is not really needed.
+ * If insert/delete line cannot be used, curses redraws the changed portions of all lines.
+ *
+ */
static VALUE
window_idlok(VALUE obj, VALUE bf)
{
@@ -1349,6 +1661,19 @@ window_idlok(VALUE obj, VALUE bf)
return Qnil;
}
+/*
+ * Document-method: Curses::Window.setscrreg
+ * call-seq: setscrreg(top, bottom)
+ *
+ * Set a software scrolling region in a window.
+ * +top+ and +bottom+ are lines numbers of the margin.
+ *
+ * If this option and Curses::Window.scrollok are enabled, an attempt to move off
+ * the bottom margin line causes all lines in the scrolling region
+ * to scroll one line in the direction of the first line.
+ * Only the text of the window is scrolled.
+ *
+ */
static VALUE
window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
{
@@ -1366,6 +1691,13 @@ window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
}
#if defined(USE_COLOR) && defined(HAVE_WCOLOR_SET)
+/*
+ * Document-method: Curses::Window.color_set
+ * call-seq: color_set(col)
+ *
+ * Sets the current color of the given window to the
+ * foreground/background combination described by the Fixnum +col+.
+ */
static VALUE
window_color_set(VALUE obj, VALUE col)
{
@@ -1378,6 +1710,11 @@ window_color_set(VALUE obj, VALUE col)
}
#endif /* defined(USE_COLOR) && defined(HAVE_WCOLOR_SET) */
+/*
+ * Document-method: Curses::Window.scroll
+ *
+ * Scrolls the current window up one line.
+ */
static VALUE
window_scroll(VALUE obj)
{
@@ -1388,6 +1725,18 @@ window_scroll(VALUE obj)
return (scroll(winp->window) == OK) ? Qtrue : Qfalse;
}
+/*
+ * Document-method: Curses::Window.scrl
+ * call-seq: scrl(num)
+ *
+ * Scrolls the current window Fixnum +num+ lines.
+ * The current cursor position is not changed.
+ *
+ * For positive +num+, it scrolls up.
+ *
+ * For negative +num+, it scrolls down.
+ *
+ */
static VALUE
window_scrl(VALUE obj, VALUE n)
{
@@ -1402,6 +1751,14 @@ window_scrl(VALUE obj, VALUE n)
#endif
}
+/*
+ * Document-method: Curses::Window.attroff
+ * call-seq: attroff(attrs)
+ *
+ * Turns on the named attributes +attrs+ without affecting any others.
+ *
+ * See also Curses::Window.attrset
+ */
static VALUE
window_attroff(VALUE obj, VALUE attrs)
{
@@ -1415,6 +1772,15 @@ window_attroff(VALUE obj, VALUE attrs)
#endif
}
+/*
+ * Document-method: Curses::Window.attron
+ * call-seq: attron(attrs)
+ *
+ * Turns off the named attributes +attrs+
+ * without turning any other attributes on or off.
+ *
+ * See also Curses::Window.attrset
+ */
static VALUE
window_attron(VALUE obj, VALUE attrs)
{
@@ -1437,6 +1803,32 @@ window_attron(VALUE obj, VALUE attrs)
#endif
}
+/*
+ * Document-method: Curses::Window.attrset
+ * call-seq: attrset(attrs)
+ *
+ * Sets the current attributes of the given window to +attrs+.
+ *
+ * The following video attributes, defined in <curses.h>, can
+ * be passed to the routines Curses::Window.attron, Curses::Window.attroff,
+ * and Curses::Window.attrset, or OR'd with the characters passed to addch.
+ * A_NORMAL Normal display (no highlight)
+ * A_STANDOUT Best highlighting mode of the terminal.
+ * A_UNDERLINE Underlining
+ * A_REVERSE Reverse video
+ * A_BLINK Blinking
+ * A_DIM Half bright
+ * A_BOLD Extra bright or bold
+ * A_PROTECT Protected mode
+ * A_INVIS Invisible or blank mode
+ * A_ALTCHARSET Alternate character set
+ * A_CHARTEXT Bit-mask to extract a character
+ * COLOR_PAIR(n) Color-pair number n
+ *
+ * TODO: provide some examples here.
+ *
+ * see also system manual curs_attr(3)
+ */
static VALUE
window_attrset(VALUE obj, VALUE attrs)
{
@@ -1450,6 +1842,15 @@ window_attrset(VALUE obj, VALUE attrs)
#endif
}
+/*
+ * Document-method: Curses::Window.bkgdset
+ * call-seq: bkgdset(ch)
+ *
+ * Manipulate the background of the current window
+ * with character Integer +ch+
+ *
+ * see also Curses.bkgdset
+ */
static VALUE
window_bkgdset(VALUE obj, VALUE ch)
{
@@ -1462,6 +1863,15 @@ window_bkgdset(VALUE obj, VALUE ch)
return Qnil;
}
+/*
+ * Document-method: Curses::Window.bkgd
+ * call-seq: bkgd(ch)
+ *
+ * Set the background of the current window
+ * and apply character Integer +ch+ to every character.
+ *
+ * see also Curses.bkgd
+ */
static VALUE
window_bkgd(VALUE obj, VALUE ch)
{
@@ -1475,6 +1885,11 @@ window_bkgd(VALUE obj, VALUE ch)
#endif
}
+/*
+ * Document-method: Curses::Window.getbkgd
+ *
+ * Returns an Interer (+ch+) for the character property in the current window.
+ */
static VALUE
window_getbkgd(VALUE obj)
{
@@ -1489,6 +1904,13 @@ window_getbkgd(VALUE obj)
#endif
}
+/*
+ * Document-method: Curses::Window.resize
+ * call-seq: resize(lines, cols)
+ *
+ * Resize the current window to Fixnum +lines+ and Fixnum +cols+
+ *
+ */
static VALUE
window_resize(VALUE obj, VALUE lin, VALUE col)
{
@@ -1504,6 +1926,30 @@ window_resize(VALUE obj, VALUE lin, VALUE col)
#ifdef HAVE_KEYPAD
+/*
+ * Document-method: Curses::Window.keypad=
+ * call-seq: keypad=(bool)
+ *
+ * see Curses::Window.keypad
+ */
+
+/*
+ * Document-method: Curses::Window.keypad
+ * call-seq: keypad(bool)
+ *
+ * Enables the keypad of the user's terminal.
+ * If enabled (+bool+ is +true+), the user can press a function key
+ * (such as an arrow key) and wgetch returns a single value representing
+ * the function key, as in KEY_LEFT. If disabled (+bool+ is +false+),
+ * curses does not treat function keys specially and the program has to
+ * interpret the escape sequences itself. If the keypad in the terminal
+ * can be turned on (made to transmit) and off (made to work locally),
+ * turning on this option causes the terminal keypad to be turned on when
+ * Curses::Window.getch is called.
+ *
+ * The default value for keypad is false.
+ *
+ */
static VALUE
window_keypad(VALUE obj, VALUE val)
{
@@ -1525,6 +1971,15 @@ window_keypad(VALUE obj, VALUE val)
#endif
#ifdef HAVE_NODELAY
+/*
+ * Document-method: Curses::Window.nodelay
+ * call-seq: nodelay(bool)
+ *
+ * Causes Curses::Window.getch to be a non-blocking call. If no input is ready, getch returns ERR.
+ *
+ * If disabled (+bool+ is +false+), Curses::Window.getch waits until a key is pressed.
+ *
+ */
static VALUE
window_nodelay(VALUE obj, VALUE val)
{
@@ -1544,6 +1999,16 @@ window_nodelay(VALUE obj, VALUE val)
#endif
#ifdef HAVE_WTIMEOUT
+/*
+ * Document-method: Curses::Window.timeout=
+ * call-seq: timeout=(delay)
+ *
+ * Sets block and non-blocking reads for the window.
+ * - If delay is negative, blocking read is used (i.e., waits indefinitely for input).
+ * - If delay is zero, then non-blocking read is used (i.e., read returns ERR if no input is waiting).
+ * - If delay is positive, then read blocks for delay milliseconds, and returns ERR if there is still no input.
+ *
+ */
static VALUE
window_timeout(VALUE obj, VALUE delay)
{
@@ -1558,15 +2023,67 @@ window_timeout(VALUE obj, VALUE delay)
#endif
/*------------------------- Initialization -------------------------*/
+
+/*
+ * Document-module: Curses
+ *
+ * == Description
+ * An implementation of the CRT screen handling and optimization library.
+ *
+ * == Structures
+ *
+ * === Classes
+ *
+ * * Curses::Window - class with the means to draw a window or box
+ * * Curses::MouseEvent - class for collecting mouse events
+ *
+ * === Modules
+ *
+ * * Curses - basis for the curses implementation
+ * * Curses::Key - the collection of constants
+ *
+ * == Examples
+ *
+ * * hello.rb
+ * :include: hello.rb
+ *
+ *
+ * * rain.rb
+ * :include: rain.rb
+ *
+ */
void
Init_curses(void)
{
mCurses = rb_define_module("Curses");
+
+ /*
+ * Document-module: Curses::Key
+ *
+ *
+ * a container for the KEY_* values.
+ *
+ * See also system manual for getch(3)
+ *
+ */
mKey = rb_define_module_under(mCurses, "Key");
rb_gc_register_address(&rb_stdscr);
#ifdef USE_MOUSE
+ /*
+ * Document-class: Curses::MouseEvent
+ *
+ * == Description
+ *
+ * Curses::MouseEvent
+ *
+ * == Example
+ *
+ * * mouse.rb
+ * :include: mouse.rb
+ *
+ */
cMouseEvent = rb_define_class_under(mCurses,"MouseEvent",rb_cObject);
rb_undef_method(CLASS_OF(cMouseEvent),"new");
rb_define_method(cMouseEvent, "eid", curs_mouse_id, 0);
@@ -1653,6 +2170,36 @@ Init_curses(void)
rb_define_module_function(mCurses, "def_prog_mode", curses_def_prog_mode, 0);
rb_define_module_function(mCurses, "reset_prog_mode", curses_reset_prog_mode, 0);
+ /*
+ * Document-class: Curses::Window
+ *
+ * == Description
+ *
+ * The means by which to create and manage frames or windows.
+ * While there may be more than one window at a time, only one window
+ * receive the input.
+ *
+ * == Usage
+ *
+ * require 'curses'
+ *
+ * Curses.init_screen()
+ *
+ * my_str = "LOOK! PONIES!"
+ * win = Curses::Window.new( 8, (my_str.length + 10),
+ * (Curses.lines - 8) / 2,
+ * (Curses.cols - (my_str.length + 10)) / 2 )
+ * win.box("|", "-")
+ * win.setpos(2,3)
+ * win.addstr(my_str)
+ * # or even
+ * win << "\nORLY"
+ * win << "\nYES!! " + my_str
+ * win.refresh
+ * win.getch
+ * win.close
+ *
+ */
cWindow = rb_define_class_under(mCurses, "Window", rb_cData);
rb_define_alloc_func(cWindow, window_s_allocate);
rb_define_method(cWindow, "initialize", window_initialize, 4);
@@ -1835,38 +2382,74 @@ Init_curses(void)
#endif /* USE_MOUSE */
#if defined(KEY_MOUSE) && defined(USE_MOUSE)
+ /* Document-const: MOUSE
+ *
+ * Mouse event read
+ */
rb_curses_define_const(KEY_MOUSE);
rb_define_const(mKey, "MOUSE", INT2NUM(KEY_MOUSE));
#endif
#ifdef KEY_MIN
+ /* Document-const: MIN
+ *
+ * ???
+ */
rb_curses_define_const(KEY_MIN);
rb_define_const(mKey, "MIN", INT2NUM(KEY_MIN));
#endif
#ifdef KEY_BREAK
+ /* Document-const: BREAK
+ *
+ * Break key
+ */
rb_curses_define_const(KEY_BREAK);
rb_define_const(mKey, "BREAK", INT2NUM(KEY_BREAK));
#endif
#ifdef KEY_DOWN
+ /* Document-const: DOWN
+ *
+ * the down arrow key
+ */
rb_curses_define_const(KEY_DOWN);
rb_define_const(mKey, "DOWN", INT2NUM(KEY_DOWN));
#endif
#ifdef KEY_UP
+ /* Document-const: UP
+ *
+ * the up arrow key
+ */
rb_curses_define_const(KEY_UP);
rb_define_const(mKey, "UP", INT2NUM(KEY_UP));
#endif
#ifdef KEY_LEFT
+ /* Document-const: LEFT
+ *
+ * the left arrow key
+ */
rb_curses_define_const(KEY_LEFT);
rb_define_const(mKey, "LEFT", INT2NUM(KEY_LEFT));
#endif
#ifdef KEY_RIGHT
+ /* Document-const: RIGHT
+ *
+ * the right arrow key
+ */
rb_curses_define_const(KEY_RIGHT);
rb_define_const(mKey, "RIGHT", INT2NUM(KEY_RIGHT));
#endif
#ifdef KEY_HOME
+ /* Document-const: HOME
+ *
+ * Home key (upward+left arrow)
+ */
rb_curses_define_const(KEY_HOME);
rb_define_const(mKey, "HOME", INT2NUM(KEY_HOME));
#endif
#ifdef KEY_BACKSPACE
+ /* Document-const: BACKSPACE
+ *
+ * Backspace
+ */
rb_curses_define_const(KEY_BACKSPACE);
rb_define_const(mKey, "BACKSPACE", INT2NUM(KEY_BACKSPACE));
#endif
@@ -1884,334 +2467,666 @@ Init_curses(void)
}
#endif
#ifdef KEY_DL
+ /* Document-const: DL
+ *
+ * Delete line
+ */
rb_curses_define_const(KEY_DL);
rb_define_const(mKey, "DL", INT2NUM(KEY_DL));
#endif
#ifdef KEY_IL
+ /* Document-const: IL
+ *
+ * Insert line
+ */
rb_curses_define_const(KEY_IL);
rb_define_const(mKey, "IL", INT2NUM(KEY_IL));
#endif
#ifdef KEY_DC
+ /* Document-const: DC
+ *
+ * Delete character
+ */
rb_curses_define_const(KEY_DC);
rb_define_const(mKey, "DC", INT2NUM(KEY_DC));
#endif
#ifdef KEY_IC
+ /* Document-const: IC
+ *
+ * Insert char or enter insert mode
+ */
rb_curses_define_const(KEY_IC);
rb_define_const(mKey, "IC", INT2NUM(KEY_IC));
#endif
#ifdef KEY_EIC
+ /* Document-const: EIC
+ *
+ * Enter insert char mode
+ */
rb_curses_define_const(KEY_EIC);
rb_define_const(mKey, "EIC", INT2NUM(KEY_EIC));
#endif
#ifdef KEY_CLEAR
+ /* Document-const: CLEAR
+ *
+ * Clear Screen
+ */
rb_curses_define_const(KEY_CLEAR);
rb_define_const(mKey, "CLEAR", INT2NUM(KEY_CLEAR));
#endif
#ifdef KEY_EOS
+ /* Document-const: EOS
+ *
+ * Clear to end of screen
+ */
rb_curses_define_const(KEY_EOS);
rb_define_const(mKey, "EOS", INT2NUM(KEY_EOS));
#endif
#ifdef KEY_EOL
+ /* Document-const: EOL
+ *
+ * Clear to end of line
+ */
rb_curses_define_const(KEY_EOL);
rb_define_const(mKey, "EOL", INT2NUM(KEY_EOL));
#endif
#ifdef KEY_SF
+ /* Document-const: SF
+ *
+ * Scroll 1 line forward
+ */
rb_curses_define_const(KEY_SF);
rb_define_const(mKey, "SF", INT2NUM(KEY_SF));
#endif
#ifdef KEY_SR
+ /* Document-const: SR
+ *
+ * Scroll 1 line backware (reverse)
+ */
rb_curses_define_const(KEY_SR);
rb_define_const(mKey, "SR", INT2NUM(KEY_SR));
#endif
#ifdef KEY_NPAGE
+ /* Document-const: NPAGE
+ *
+ * Next page
+ */
rb_curses_define_const(KEY_NPAGE);
rb_define_const(mKey, "NPAGE", INT2NUM(KEY_NPAGE));
#endif
#ifdef KEY_PPAGE
+ /* Document-const: PPAGE
+ *
+ * Previous page
+ */
rb_curses_define_const(KEY_PPAGE);
rb_define_const(mKey, "PPAGE", INT2NUM(KEY_PPAGE));
#endif
#ifdef KEY_STAB
+ /* Document-const: STAB
+ *
+ * Set tab
+ */
rb_curses_define_const(KEY_STAB);
rb_define_const(mKey, "STAB", INT2NUM(KEY_STAB));
#endif
#ifdef KEY_CTAB
+ /* Document-const: CTAB
+ *
+ * Clear tab
+ */
rb_curses_define_const(KEY_CTAB);
rb_define_const(mKey, "CTAB", INT2NUM(KEY_CTAB));
#endif
#ifdef KEY_CATAB
+ /* Document-const: CATAB
+ *
+ * Clear all tabs
+ */
rb_curses_define_const(KEY_CATAB);
rb_define_const(mKey, "CATAB", INT2NUM(KEY_CATAB));
#endif
#ifdef KEY_ENTER
+ /* Document-const: ENTER
+ *
+ * Enter or send
+ */
rb_curses_define_const(KEY_ENTER);
rb_define_const(mKey, "ENTER", INT2NUM(KEY_ENTER));
#endif
#ifdef KEY_SRESET
+ /* Document-const: SRESET
+ *
+ * Soft (partial) reset
+ */
rb_curses_define_const(KEY_SRESET);
rb_define_const(mKey, "SRESET", INT2NUM(KEY_SRESET));
#endif
#ifdef KEY_RESET
+ /* Document-const: RESET
+ *
+ * Reset or hard reset
+ */
rb_curses_define_const(KEY_RESET);
rb_define_const(mKey, "RESET", INT2NUM(KEY_RESET));
#endif
#ifdef KEY_PRINT
+ /* Document-const: PRINT
+ *
+ * Print or copy
+ */
rb_curses_define_const(KEY_PRINT);
rb_define_const(mKey, "PRINT", INT2NUM(KEY_PRINT));
#endif
#ifdef KEY_LL
+ /* Document-const: LL
+ *
+ * Home down or bottom (lower left)
+ */
rb_curses_define_const(KEY_LL);
rb_define_const(mKey, "LL", INT2NUM(KEY_LL));
#endif
#ifdef KEY_A1
+ /* Document-const: A1
+ *
+ * Upper left of keypad
+ */
rb_curses_define_const(KEY_A1);
rb_define_const(mKey, "A1", INT2NUM(KEY_A1));
#endif
#ifdef KEY_A3
+ /* Document-const: A3
+ *
+ * Upper right of keypad
+ */
rb_curses_define_const(KEY_A3);
rb_define_const(mKey, "A3", INT2NUM(KEY_A3));
#endif
#ifdef KEY_B2
+ /* Document-const: B2
+ *
+ * Center of keypad
+ */
rb_curses_define_const(KEY_B2);
rb_define_const(mKey, "B2", INT2NUM(KEY_B2));
#endif
#ifdef KEY_C1
+ /* Document-const: C1
+ *
+ * Lower left of keypad
+ */
rb_curses_define_const(KEY_C1);
rb_define_const(mKey, "C1", INT2NUM(KEY_C1));
#endif
#ifdef KEY_C3
+ /* Document-const: C3
+ *
+ * Lower right of keypad
+ */
rb_curses_define_const(KEY_C3);
rb_define_const(mKey, "C3", INT2NUM(KEY_C3));
#endif
#ifdef KEY_BTAB
+ /* Document-const: BTAB
+ *
+ * Back tab key
+ */
rb_curses_define_const(KEY_BTAB);
rb_define_const(mKey, "BTAB", INT2NUM(KEY_BTAB));
#endif
#ifdef KEY_BEG
+ /* Document-const: BEG
+ *
+ * Beginning key
+ */
rb_curses_define_const(KEY_BEG);
rb_define_const(mKey, "BEG", INT2NUM(KEY_BEG));
#endif
#ifdef KEY_CANCEL
+ /* Document-const: CANCEL
+ *
+ * Cancel key
+ */
rb_curses_define_const(KEY_CANCEL);
rb_define_const(mKey, "CANCEL", INT2NUM(KEY_CANCEL));
#endif
#ifdef KEY_CLOSE
+ /* Document-const: CLOSE
+ *
+ * Close key
+ */
rb_curses_define_const(KEY_CLOSE);
rb_define_const(mKey, "CLOSE", INT2NUM(KEY_CLOSE));
#endif
#ifdef KEY_COMMAND
+ /* Document-const: COMMAND
+ *
+ * Cmd (command) key
+ */
rb_curses_define_const(KEY_COMMAND);
rb_define_const(mKey, "COMMAND", INT2NUM(KEY_COMMAND));
#endif
#ifdef KEY_COPY
+ /* Document-const: COPY
+ *
+ * Copy key
+ */
rb_curses_define_const(KEY_COPY);
rb_define_const(mKey, "COPY", INT2NUM(KEY_COPY));
#endif
#ifdef KEY_CREATE
+ /* Document-const: CREATE
+ *
+ * Create key
+ */
rb_curses_define_const(KEY_CREATE);
rb_define_const(mKey, "CREATE", INT2NUM(KEY_CREATE));
#endif
#ifdef KEY_END
+ /* Document-const: END
+ *
+ * End key
+ */
rb_curses_define_const(KEY_END);
rb_define_const(mKey, "END", INT2NUM(KEY_END));
#endif
#ifdef KEY_EXIT
+ /* Document-const: EXIT
+ *
+ * Exit key
+ */
rb_curses_define_const(KEY_EXIT);
rb_define_const(mKey, "EXIT", INT2NUM(KEY_EXIT));
#endif
#ifdef KEY_FIND
+ /* Document-const: FIND
+ *
+ * Find key
+ */
rb_curses_define_const(KEY_FIND);
rb_define_const(mKey, "FIND", INT2NUM(KEY_FIND));
#endif
#ifdef KEY_HELP
+ /* Document-const: HELP
+ *
+ * Help key
+ */
rb_curses_define_const(KEY_HELP);
rb_define_const(mKey, "HELP", INT2NUM(KEY_HELP));
#endif
#ifdef KEY_MARK
+ /* Document-const: MARK
+ *
+ * Mark key
+ */
rb_curses_define_const(KEY_MARK);
rb_define_const(mKey, "MARK", INT2NUM(KEY_MARK));
#endif
#ifdef KEY_MESSAGE
+ /* Document-const: MESSAGE
+ *
+ * Message key
+ */
rb_curses_define_const(KEY_MESSAGE);
rb_define_const(mKey, "MESSAGE", INT2NUM(KEY_MESSAGE));
#endif
#ifdef KEY_MOVE
+ /* Document-const: MOVE
+ *
+ * Move key
+ */
rb_curses_define_const(KEY_MOVE);
rb_define_const(mKey, "MOVE", INT2NUM(KEY_MOVE));
#endif
#ifdef KEY_NEXT
+ /* Document-const: NEXT
+ *
+ * Next object key
+ */
rb_curses_define_const(KEY_NEXT);
rb_define_const(mKey, "NEXT", INT2NUM(KEY_NEXT));
#endif
#ifdef KEY_OPEN
+ /* Document-const: OPEN
+ *
+ * Open key
+ */
rb_curses_define_const(KEY_OPEN);
rb_define_const(mKey, "OPEN", INT2NUM(KEY_OPEN));
#endif
#ifdef KEY_OPTIONS
+ /* Document-const: OPTIONS
+ *
+ * Options key
+ */
rb_curses_define_const(KEY_OPTIONS);
rb_define_const(mKey, "OPTIONS", INT2NUM(KEY_OPTIONS));
#endif
#ifdef KEY_PREVIOUS
+ /* Document-const: PREVIOUS
+ *
+ * Previous object key
+ */
rb_curses_define_const(KEY_PREVIOUS);
rb_define_const(mKey, "PREVIOUS", INT2NUM(KEY_PREVIOUS));
#endif
#ifdef KEY_REDO
+ /* Document-const: REDO
+ *
+ * Redo key
+ */
rb_curses_define_const(KEY_REDO);
rb_define_const(mKey, "REDO", INT2NUM(KEY_REDO));
#endif
#ifdef KEY_REFERENCE
+ /* Document-const: REFERENCE
+ *
+ * Reference key
+ */
rb_curses_define_const(KEY_REFERENCE);
rb_define_const(mKey, "REFERENCE", INT2NUM(KEY_REFERENCE));
#endif
#ifdef KEY_REFRESH
+ /* Document-const: REFRESH
+ *
+ * Refresh key
+ */
rb_curses_define_const(KEY_REFRESH);
rb_define_const(mKey, "REFRESH", INT2NUM(KEY_REFRESH));
#endif
#ifdef KEY_REPLACE
+ /* Document-const: REPLACE
+ *
+ * Replace key
+ */
rb_curses_define_const(KEY_REPLACE);
rb_define_const(mKey, "REPLACE", INT2NUM(KEY_REPLACE));
#endif
#ifdef KEY_RESTART
+ /* Document-const: RESTART
+ *
+ * Restart key
+ */
rb_curses_define_const(KEY_RESTART);
rb_define_const(mKey, "RESTART", INT2NUM(KEY_RESTART));
#endif
#ifdef KEY_RESUME
+ /* Document-const: RESUME
+ *
+ * Resume key
+ */
rb_curses_define_const(KEY_RESUME);
rb_define_const(mKey, "RESUME", INT2NUM(KEY_RESUME));
#endif
#ifdef KEY_SAVE
+ /* Document-const: SAVE
+ *
+ * Save key
+ */
rb_curses_define_const(KEY_SAVE);
rb_define_const(mKey, "SAVE", INT2NUM(KEY_SAVE));
#endif
#ifdef KEY_SBEG
+ /* Document-const: SBEG
+ *
+ * Shifted beginning key
+ */
rb_curses_define_const(KEY_SBEG);
rb_define_const(mKey, "SBEG", INT2NUM(KEY_SBEG));
#endif
#ifdef KEY_SCANCEL
+ /* Document-const: SCANCEL
+ *
+ * Shifted cancel key
+ */
rb_curses_define_const(KEY_SCANCEL);
rb_define_const(mKey, "SCANCEL", INT2NUM(KEY_SCANCEL));
#endif
#ifdef KEY_SCOMMAND
+ /* Document-const: SCOMMAND
+ *
+ * Shifted command key
+ */
rb_curses_define_const(KEY_SCOMMAND);
rb_define_const(mKey, "SCOMMAND", INT2NUM(KEY_SCOMMAND));
#endif
#ifdef KEY_SCOPY
+ /* Document-const: SCOPY
+ *
+ * Shifted copy key
+ */
rb_curses_define_const(KEY_SCOPY);
rb_define_const(mKey, "SCOPY", INT2NUM(KEY_SCOPY));
#endif
#ifdef KEY_SCREATE
+ /* Document-const: SCREATE
+ *
+ * Shifted create key
+ */
rb_curses_define_const(KEY_SCREATE);
rb_define_const(mKey, "SCREATE", INT2NUM(KEY_SCREATE));
#endif
#ifdef KEY_SDC
+ /* Document-const: SDC
+ *
+ * Shifted delete char key
+ */
rb_curses_define_const(KEY_SDC);
rb_define_const(mKey, "SDC", INT2NUM(KEY_SDC));
#endif
#ifdef KEY_SDL
+ /* Document-const: SDL
+ *
+ * Shifted delete line key
+ */
rb_curses_define_const(KEY_SDL);
rb_define_const(mKey, "SDL", INT2NUM(KEY_SDL));
#endif
#ifdef KEY_SELECT
+ /* Document-const: SELECT
+ *
+ * Select key
+ */
rb_curses_define_const(KEY_SELECT);
rb_define_const(mKey, "SELECT", INT2NUM(KEY_SELECT));
#endif
#ifdef KEY_SEND
+ /* Document-const: SEND
+ *
+ * Shifted end key
+ */
rb_curses_define_const(KEY_SEND);
rb_define_const(mKey, "SEND", INT2NUM(KEY_SEND));
#endif
#ifdef KEY_SEOL
+ /* Document-const: SEOL
+ *
+ * Shifted clear line key
+ */
rb_curses_define_const(KEY_SEOL);
rb_define_const(mKey, "SEOL", INT2NUM(KEY_SEOL));
#endif
#ifdef KEY_SEXIT
+ /* Document-const: SEXIT
+ *
+ * Shifted exit key
+ */
rb_curses_define_const(KEY_SEXIT);
rb_define_const(mKey, "SEXIT", INT2NUM(KEY_SEXIT));
#endif
#ifdef KEY_SFIND
+ /* Document-const: SFIND
+ *
+ * Shifted find key
+ */
rb_curses_define_const(KEY_SFIND);
rb_define_const(mKey, "SFIND", INT2NUM(KEY_SFIND));
#endif
#ifdef KEY_SHELP
+ /* Document-const: SHELP
+ *
+ * Shifted help key
+ */
rb_curses_define_const(KEY_SHELP);
rb_define_const(mKey, "SHELP", INT2NUM(KEY_SHELP));
#endif
#ifdef KEY_SHOME
+ /* Document-const: SHOME
+ *
+ * Shifted home key
+ */
rb_curses_define_const(KEY_SHOME);
rb_define_const(mKey, "SHOME", INT2NUM(KEY_SHOME));
#endif
#ifdef KEY_SIC
+ /* Document-const: SIC
+ *
+ * Shifted input key
+ */
rb_curses_define_const(KEY_SIC);
rb_define_const(mKey, "SIC", INT2NUM(KEY_SIC));
#endif
#ifdef KEY_SLEFT
+ /* Document-const: SLEFT
+ *
+ * Shifted left arrow key
+ */
rb_curses_define_const(KEY_SLEFT);
rb_define_const(mKey, "SLEFT", INT2NUM(KEY_SLEFT));
#endif
#ifdef KEY_SMESSAGE
+ /* Document-const: SMESSAGE
+ *
+ * Shifted message key
+ */
rb_curses_define_const(KEY_SMESSAGE);
rb_define_const(mKey, "SMESSAGE", INT2NUM(KEY_SMESSAGE));
#endif
#ifdef KEY_SMOVE
+ /* Document-const: SMOVE
+ *
+ * Shifted move key
+ */
rb_curses_define_const(KEY_SMOVE);
rb_define_const(mKey, "SMOVE", INT2NUM(KEY_SMOVE));
#endif
#ifdef KEY_SNEXT
+ /* Document-const: SNEXT
+ *
+ * Shifted next key
+ */
rb_curses_define_const(KEY_SNEXT);
rb_define_const(mKey, "SNEXT", INT2NUM(KEY_SNEXT));
#endif
#ifdef KEY_SOPTIONS
+ /* Document-const: SOPTIONS
+ *
+ * Shifted options key
+ */
rb_curses_define_const(KEY_SOPTIONS);
rb_define_const(mKey, "SOPTIONS", INT2NUM(KEY_SOPTIONS));
#endif
#ifdef KEY_SPREVIOUS
+ /* Document-const: SPREVIOUS
+ *
+ * Shifted previous key
+ */
rb_curses_define_const(KEY_SPREVIOUS);
rb_define_const(mKey, "SPREVIOUS", INT2NUM(KEY_SPREVIOUS));
#endif
#ifdef KEY_SPRINT
+ /* Document-const: SPRINT
+ *
+ * Shifted print key
+ */
rb_curses_define_const(KEY_SPRINT);
rb_define_const(mKey, "SPRINT", INT2NUM(KEY_SPRINT));
#endif
#ifdef KEY_SREDO
+ /* Document-const: SREDO
+ *
+ * Shifted redo key
+ */
rb_curses_define_const(KEY_SREDO);
rb_define_const(mKey, "SREDO", INT2NUM(KEY_SREDO));
#endif
#ifdef KEY_SREPLACE
+ /* Document-const: SREPLACE
+ *
+ * Shifted replace key
+ */
rb_curses_define_const(KEY_SREPLACE);
rb_define_const(mKey, "SREPLACE", INT2NUM(KEY_SREPLACE));
#endif
#ifdef KEY_SRIGHT
+ /* Document-const: SRIGHT
+ *
+ * Shifted right arrow key
+ */
rb_curses_define_const(KEY_SRIGHT);
rb_define_const(mKey, "SRIGHT", INT2NUM(KEY_SRIGHT));
#endif
#ifdef KEY_SRSUME
+ /* Document-const: SRSUME
+ *
+ * Shifted resume key
+ */
rb_curses_define_const(KEY_SRSUME);
rb_define_const(mKey, "SRSUME", INT2NUM(KEY_SRSUME));
#endif
#ifdef KEY_SSAVE
+ /* Document-const: SSAVE
+ *
+ * Shifted save key
+ */
rb_curses_define_const(KEY_SSAVE);
rb_define_const(mKey, "SSAVE", INT2NUM(KEY_SSAVE));
#endif
#ifdef KEY_SSUSPEND
+ /* Document-const: SSUSPEND
+ *
+ * Shifted suspend key
+ */
rb_curses_define_const(KEY_SSUSPEND);
rb_define_const(mKey, "SSUSPEND", INT2NUM(KEY_SSUSPEND));
#endif
#ifdef KEY_SUNDO
+ /* Document-const: SUNDO
+ *
+ * Shifted undo key
+ */
rb_curses_define_const(KEY_SUNDO);
rb_define_const(mKey, "SUNDO", INT2NUM(KEY_SUNDO));
#endif
#ifdef KEY_SUSPEND
+ /* Document-const: SUSPEND
+ *
+ * Suspend key
+ */
rb_curses_define_const(KEY_SUSPEND);
rb_define_const(mKey, "SUSPEND", INT2NUM(KEY_SUSPEND));
#endif
#ifdef KEY_UNDO
+ /* Document-const: UNDO
+ *
+ * Undo key
+ */
rb_curses_define_const(KEY_UNDO);
rb_define_const(mKey, "UNDO", INT2NUM(KEY_UNDO));
#endif
#ifdef KEY_RESIZE
+ /* Document-const: RESIZE
+ *
+ * Screen Resized
+ */
rb_curses_define_const(KEY_RESIZE);
rb_define_const(mKey, "RESIZE", INT2NUM(KEY_RESIZE));
#endif
#ifdef KEY_MAX
+ /* Document-const: MAX
+ *
+ * ???
+ */
rb_curses_define_const(KEY_MAX);
rb_define_const(mKey, "MAX", INT2NUM(KEY_MAX));
#endif