Ncurses terminal screen control functions LXVIII_ Ncurses terminal screen control functions Introducción
ncurses (new curses) is a free software emulation of curses in
System V Rel 4_0 (and above)_ It uses terminfo format, supports pads,
colors, multiple highlights, form characters and function key mapping_
Because of the interactive nature of this library, it will be of little
use for writing Web applications, but may be useful when writing scripts meant
using PHP from the command line _
Aviso Esta extensión es
EXPERIMENTAL _ Esto significa que el
comportamiento de esta extensión, los nombre de sus funciones y
en definitiva TODO lo documentado sobre esta extensión, puede
cambiar en una futura versión de PHP SIN AVISO_ La advertencia
queda hecha, y utilizar esta extensión queda bajo su propia
responsabiliad_
Ncurses is available for the following platforms:
AIX
BeOS
Cygwin
Digital Unix (aka OSF1)
FreeBSD
GNU/Linux
HPUX
IRIX
OS/2
SCO OpenServer
Solaris
SunOS
Instalación
To get these functions to work, you have to compile the CGI or CLI
version of PHP with __with_ncurses[=DIR] _
Configuración en tiempo de
ejecuciónEl comportamiento de estas
funciones está afectado por los valores definidos en
php_ini _
Tabla 1_ Ncurses configuration options
Name Default Changeable ncurses_value "42" PHP_INI_ALL ncurses_string "foobar" PHP_INI_ALL
For further details and definition of the PHP_INI_* constants see
ini_set() _
Tipos de recursosEsta extensión no tiene
ningún tipo de recurso definido_
Constantes predefinidasEstas constantes están
definidas por esta extensión y estarán disponibles
solamente cuando la extensión ha sido o bien compilada dentro
de PHP o grabada dinámicamente en tiempo de ejecución_
Error codes
On error ncurses functions return NCURSES_ERR_
ColorsTabla 2_ ncurses color constants
constant meaning NCURSES_COLOR_BLACK no color (black) NCURSES_COLOR_WHITE white NCURSES_COLOR_RED red _ supported when terminal is in color mode NCURSES_COLOR_GREEN green _ supported when terminal is in color mod NCURSES_COLOR_YELLOW yellow _ supported when terminal is in color mod NCURSES_COLOR_BLUE blue _ supported when terminal is in color mod NCURSES_COLOR_CYAN cyan _ supported when terminal is in color mod NCURSES_COLOR_MAGENTA magenta _ supported when terminal is in color mod
KeysTabla 3_ ncurses key constants
constant meaning NCURSES_KEY_F0 _ NCURSES_KEY_F64 function keys F1 _ F64 NCURSES_KEY_DOWN down arrow NCURSES_KEY_UP up arrow NCURSES_KEY_LEFT left arrow NCURSES_KEY_RIGHT right arrow NCURSES_KEY_HOME home key (upward+left arrow) NCURSES_KEY_BACKSPACE backspace NCURSES_KEY_DL delete line NCURSES_KEY_IL insert line NCURSES_KEY_DC delete character NCURSES_KEY_IC insert char or enter insert mode NCURSES_KEY_EIC exit insert char mode NCURSES_KEY_CLEAR clear screen NCURSES_KEY_EOS clear to end of screen NCURSES_KEY_EOL clear to end of line NCURSES_KEY_SF scroll one line forward NCURSES_KEY_SR scroll one line backward NCURSES_KEY_NPAGE next page NCURSES_KEY_PPAGE previous page NCURSES_KEY_STAB set tab NCURSES_KEY_CTAB clear tab NCURSES_KEY_CATAB clear all tabs NCURSES_KEY_SRESET soft (partial) reset NCURSES_KEY_RESET reset or hard reset NCURSES_KEY_PRINT print NCURSES_KEY_LL lower left NCURSES_KEY_A1 upper left of keypad NCURSES_KEY_A3 upper right of keypad NCURSES_KEY_B2 center of keypad NCURSES_KEY_C1 lower left of keypad NCURSES_KEY_C3 lower right of keypad NCURSES_KEY_BTAB back tab NCURSES_KEY_BEG beginning NCURSES_KEY_CANCEL cancel NCURSES_KEY_CLOSE close NCURSES_KEY_COMMAND cmd (command) NCURSES_KEY_COPY copy NCURSES_KEY_CREATE create NCURSES_KEY_END end NCURSES_KEY_EXIT exit NCURSES_KEY_FIND find NCURSES_KEY_HELP help NCURSES_KEY_MARK mark NCURSES_KEY_MESSAGE message NCURSES_KEY_MOVE move NCURSES_KEY_NEXT next NCURSES_KEY_OPEN open NCURSES_KEY_OPTIONS options NCURSES_KEY_PREVIOUS previous NCURSES_KEY_REDO redo NCURSES_KEY_REFERENCE ref (reference) NCURSES_KEY_REFRESH refresh NCURSES_KEY_REPLACE replace NCURSES_KEY_RESTART restart NCURSES_KEY_RESUME resume NCURSES_KEY_SAVE save NCURSES_KEY_SBEG shiftet beg (beginning) NCURSES_KEY_SCANCEL shifted cancel NCURSES_KEY_SCOMMAND shifted command NCURSES_KEY_SCOPY shifted copy NCURSES_KEY_SCREATE shifted create NCURSES_KEY_SDC shifted delete char NCURSES_KEY_SDL shifted delete line NCURSES_KEY_SELECT select NCURSES_KEY_SEND shifted end NCURSES_KEY_SEOL shifted end of line NCURSES_KEY_SEXIT shifted exit NCURSES_KEY_SFIND shifted find NCURSES_KEY_SHELP shifted help NCURSES_KEY_SHOME shifted home NCURSES_KEY_SIC shifted input NCURSES_KEY_SLEFT shifted left arrow NCURSES_KEY_SMESSAGE shifted message NCURSES_KEY_SMOVE shifted move NCURSES_KEY_SNEXT shifted next NCURSES_KEY_SOPTIONS shifted options NCURSES_KEY_SPREVIOUS shifted previous NCURSES_KEY_SPRINT shifted print NCURSES_KEY_SREDO shifted redo NCURSES_KEY_SREPLACE shifted replace NCURSES_KEY_SRIGHT shifted right arrow NCURSES_KEY_SRSUME shifted resume NCURSES_KEY_SSAVE shifted save NCURSES_KEY_SSUSPEND shifted suspend NCURSES_KEY_UNDO undo NCURSES_KEY_MOUSE mouse event has occured NCURSES_KEY_MAX maximum key value
MouseTabla 4_ mouse constants
Constant meaning NCURSES_BUTTON1_RELEASED _ NCURSES_BUTTON4_RELEASED button (1_4) released NCURSES_BUTTON1_PRESSED _ NCURSES_BUTTON4_PRESSED button (1_4) pressed NCURSES_BUTTON1_CLICKED _ NCURSES_BUTTON4_CLICKED button (1_4) clicked NCURSES_BUTTON1_DOUBLE_CLICKED _
NCURSES_BUTTON4_DOUBLE_CLICKED button (1_4) double clicked NCURSES_BUTTON1_TRIPLE_CLICKED _
NCURSES_BUTTON4_TRIPLE_CLICKED button (1_4) triple clicked NCURSES_BUTTON_CTRL ctrl pressed during click NCURSES_BUTTON_SHIFT shift pressed during click NCURSES_BUTTON_ALT alt pressed during click NCURSES_ALL_MOUSE_EVENTS report all mouse events NCURSES_REPORT_MOUSE_POSITION report mouse position
Tabla de contenidos ncurses_addch __ Add character at current position and advance cursor ncurses_addchnstr __ Add attributed string with specified length at current position ncurses_addchstr __ Add attributed string at current position ncurses_addnstr __ Add string with specified length at current position ncurses_addstr __ Output text at current position ncurses_assume_default_colors __ Define default colors for color 0 ncurses_attroff __ Turn off the given attributes ncurses_attron __ Turn on the given attributes ncurses_attrset __ Set given attributes ncurses_baudrate __ Returns baudrate of terminal ncurses_beep __ Let the terminal beep ncurses_bkgd __ Set background property for terminal screen ncurses_bkgdset __ Control screen background ncurses_border __ Draw a border around the screen using attributed characters ncurses_bottom_panel __
Moves a visible panel to the bottom of the stack
ncurses_can_change_color __ Check if we can change terminals colors ncurses_cbreak __ Switch of input buffering ncurses_clear __ Clear screen ncurses_clrtobot __ Clear screen from current position to bottom ncurses_clrtoeol __ Clear screen from current position to end of line ncurses_color_content __
Gets the RGB value for color
ncurses_color_set __ Set fore_ and background color ncurses_curs_set __ Set cursor state ncurses_def_prog_mode __ Saves terminals (program) modencurses_def_shell_mode __ Saves terminals (shell) modencurses_define_key __ Define a keycode ncurses_del_panel __
Remove panel from the stack and delete it (but not the associated window)
ncurses_delay_output __ Delay output on terminal using padding characters ncurses_delch __ Delete character at current position, move rest of line left ncurses_deleteln __ Delete line at current position, move rest of screen up ncurses_delwin __ Delete a ncurses window ncurses_doupdate __ Write all prepared refreshes to terminal ncurses_echo __ Activate keyboard input echo ncurses_echochar __ Single character output including refresh ncurses_end __ Stop using ncurses, clean up the screen ncurses_erase __ Erase terminal screen ncurses_erasechar __ Returns current erase character ncurses_filter __ ncurses_flash __ Flash terminal screen (visual bell) ncurses_flushinp __ Flush keyboard input buffer ncurses_getch __ Read a character from keyboard ncurses_getmaxyx __
Returns the size of a window
ncurses_getmouse __ Reads mouse eventncurses_getyx __
Returns the current cursor position for a window
ncurses_halfdelay __ Put terminal into halfdelay mode ncurses_has_colors __ Check if terminal has colors ncurses_has_ic __ Check for insert_ and delete_capabilities ncurses_has_il __ Check for line insert_ and delete_capabilities ncurses_has_key __ Check for presence of a function key on terminal keyboard ncurses_hide_panel __
Remove panel from the stack, making it invisible
ncurses_hline __ Draw a horizontal line at current position using an attributed character and max_ n characters long ncurses_inch __ Get character and attribute at current position ncurses_init_color __ Set new RGB value for color ncurses_init_pair __ Allocate a color pair ncurses_init __ Initialize ncurses ncurses_insch __ Insert character moving rest of line including character at current position ncurses_insdelln __ Insert lines before current line scrolling down (negative numbers delete and scroll up) ncurses_insertln __ Insert a line, move rest of screen down ncurses_insstr __ Insert string at current position, moving rest of line right ncurses_instr __ Reads string from terminal screen ncurses_isendwin __ Ncurses is in endwin mode, normal screen output may be performed ncurses_keyok __ Enable or disable a keycode ncurses_keypad __
Turns keypad on or off
ncurses_killchar __ Returns current line kill character ncurses_longname __ Returns terminals descriptionncurses_meta __
Enables/Disable 8_bit meta key information
ncurses_mouse_trafo __
Transforms coordinates
ncurses_mouseinterval __ Set timeout for mouse button clicks ncurses_mousemask __ Sets mouse optionsncurses_move_panel __
Moves a panel so that it's upper_left corner is at [startx, starty]
ncurses_move __ Move output position ncurses_mvaddch __ Move current position and add character ncurses_mvaddchnstr __ Move position and add attrributed string with specified length ncurses_mvaddchstr __ Move position and add attributed string ncurses_mvaddnstr __ Move position and add string with specified length ncurses_mvaddstr __ Move position and add string ncurses_mvcur __ Move cursor immediately ncurses_mvdelch __ Move position and delete character, shift rest of line left ncurses_mvgetch __ Move position and get character at new position ncurses_mvhline __ Set new position and draw a horizontal line using an attributed character and max_ n characters long ncurses_mvinch __ Move position and get attributed character at new position ncurses_mvvline __ Set new position and draw a vertical line using an attributed character and max_ n characters long ncurses_mvwaddstr __ Add string at new position in window ncurses_napms __ Sleep ncurses_new_panel __
Create a new panel and associate it with window
ncurses_newpad __
Creates a new pad (window)
ncurses_newwin __ Create a new window ncurses_nl __ Translate newline and carriage return / line feed ncurses_nocbreak __ Switch terminal to cooked mode ncurses_noecho __ Switch off keyboard input echo ncurses_nonl __ Do not translate newline and carriage return / line feed ncurses_noqiflush __ Do not flush on signal charactersncurses_noraw __ Switch terminal out of raw mode ncurses_pair_content __
Gets the RGB value for color
ncurses_panel_above __
Returns the panel above panel_ If panel is null, returns the bottom panel in the stack
ncurses_panel_below __
Returns the panel below panel_ If panel is null, returns the top panel in the stack
ncurses_panel_window __
Returns the window associated with panel
ncurses_pnoutrefresh __
Copys a region from a pad into the virtual screen
ncurses_prefresh __
Copys a region from a pad into the virtual screen
ncurses_putp __ ncurses_qiflush __ Flush on signal characters ncurses_raw __ Switch terminal into raw mode ncurses_refresh __ Refresh screen ncurses_replace_panel __
Replaces the window associated with panel
ncurses_reset_prog_mode __
Resets the prog mode saved by def_prog_mode
ncurses_reset_shell_mode __
Resets the shell mode saved by def_shell_mode
ncurses_resetty __ Restores saved terminal state ncurses_savetty __ Saves terminal state ncurses_scr_dump __ Dump screen content to file ncurses_scr_init __ Initialize screen from file dump ncurses_scr_restore __ Restore screen from file dump ncurses_scr_set __ Inherit screen from file dump ncurses_scrl __ Scroll window content up or down without changing current position ncurses_show_panel __
Places an invisible panel on top of the stack, making it visible
ncurses_slk_attr __ Returns current soft label key attributencurses_slk_attroff __ ncurses_slk_attron __ ncurses_slk_attrset __ ncurses_slk_clear __ Clears soft labels from screenncurses_slk_color __ Sets color for soft label keysncurses_slk_init __ Initializes soft label key functionsncurses_slk_noutrefresh __ Copies soft label keys to virtual screenncurses_slk_refresh __ Copies soft label keys to screenncurses_slk_restore __ Restores soft label keysncurses_slk_set __
Sets function key labels
ncurses_slk_touch __ Fources output when ncurses_slk_noutrefresh is performedncurses_standend __ Stop using 'standout' attribute ncurses_standout __ Start using 'standout' attribute ncurses_start_color __ Start using colors ncurses_termattrs __ Returns a logical OR of all attribute flags supported by terminal ncurses_termname __ Returns terminals (short)_namencurses_timeout __ Set timeout for special key sequences ncurses_top_panel __
Moves a visible panel to the top of the stack
ncurses_typeahead __ Specify different filedescriptor for typeahead checking ncurses_ungetch __ Put a character back into the input stream ncurses_ungetmouse __ Pushes mouse event to queuencurses_update_panels __
Refreshes the virtual screen to reflect the relations between panels in the stack_
ncurses_use_default_colors __ Assign terminal default colors to color id _1 ncurses_use_env __ Control use of environment information about terminal size ncurses_use_extended_names __ Control use of extended names in terminfo descriptions ncurses_vidattr __ ncurses_vline __ Draw a vertical line at current position using an attributed character and max_ n characters long ncurses_waddch __
Adds character at current position in a window and advance cursor
ncurses_waddstr __
Outputs text at current postion in window
ncurses_wattroff __
Turns off attributes for a window
ncurses_wattron __
Turns on attributes for a window
ncurses_wattrset __
Set the attributes for a window
ncurses_wborder __
Draws a border around the window using attributed characters
ncurses_wclear __
Clears window
ncurses_wcolor_set __
Sets windows color pairings
ncurses_werase __
Erase window contents
ncurses_wgetch __
Reads a character from keyboard (window)
ncurses_whline __
Draws a horizontal line in a window at current position using an attributed character and max_ n characters long
ncurses_wmouse_trafo __
Transforms window/stdscr coordinates
ncurses_wmove __
Moves windows output position
ncurses_wnoutrefresh __
Copies window to virtual screen
ncurses_wrefresh __ Refresh window on terminal screen ncurses_wstandend __
End standout mode for a window
ncurses_wstandout __
Enter standout mode for a window
ncurses_wvline __
Draws a vertical line in a window at current position using an attributed character and max_ n characters long