term.h

Go to the documentation of this file.
00001 // @(#)root/editline:$Id: term.h 30440 2009-09-25 10:48:50Z rdm $
00002 // Author: Mary-Louise Gill, 2009
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 /*      $NetBSD: term.fH,v 1.12 2001/01/04 15:56:32 christos Exp $      */
00013 
00014 /*-
00015  * Copyright (c) 1992, 1993
00016  *      The Regents of the University of California.  All rights reserved.
00017  *
00018  * This code is derived from software contributed to Berkeley by
00019  * Christos Zoulas of Cornell University.
00020  *
00021  * Redistribution and use in source and binary forms, with or without
00022  * modification, are permitted provided that the following conditions
00023  * are met:
00024  * 1. Redistributions of source code must retain the above copyright
00025  *    notice, this list of conditions and the following disclaimer.
00026  * 2. Redistributions in binary form must reproduce the above copyright
00027  *    notice, this list of conditions and the following disclaimer in the
00028  *    documentation and/or other materials provided with the distribution.
00029  * 3. Neither the name of the University nor the names of its contributors
00030  *    may be used to endorse or promote products derived from this software
00031  *    without specific prior written permission.
00032  *
00033  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00034  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00035  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00036  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00037  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00038  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00039  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00040  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00041  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00042  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00043  * SUCH DAMAGE.
00044  */
00045 
00046 /*
00047  * el.term.fH: Termcap header
00048  */
00049 #ifndef _h_el_term
00050 #define _h_el_term
00051 
00052 #include "histedit.h"
00053 
00054 typedef struct {                /* Symbolic function key bindings       */
00055    const char* fName;                  /* name of the key                       */
00056    int fKey;                     /* Index in termcap table              */
00057    KeyValue_t fFun;             /* Function bound to it                 */
00058    int fType;                    /* Type of function                    */
00059 } FKey_t;
00060 
00061 typedef struct {
00062    ElCoord_t fSize;                      /* # lines and cols    */
00063    int fFlags;
00064 #define TERM_CAN_INSERT 0x001           /* Has insert cap       */
00065 #define TERM_CAN_DELETE 0x002           /* Has delete cap       */
00066 #define TERM_CAN_CEOL 0x004             /* Has CEOL cap         */
00067 #define TERM_CAN_TAB 0x008              /* Can use tabs         */
00068 #define TERM_CAN_ME 0x010               /* Can turn all attrs.  */
00069 #define TERM_CAN_UP 0x020               /* Can move up          */
00070 #define TERM_HAS_META 0x040             /* Has a meta key       */
00071 #define TERM_HAS_AUTO_MARGINS 0x080     /* Has auto margins     */
00072 #define TERM_HAS_MAGIC_MARGINS 0x100    /* Has magic margins    */
00073    char* fBuf;                         /* Termcap buffer        */
00074    int fLoc;                           /* location used */
00075    char** fStr;                        /* termcap strings       */
00076    int* fVal;                          /* termcap values        */
00077    char* fCap;                         /* Termcap buffer        */
00078    FKey_t* fFKey;                      /* Array of keys */
00079 } ElTerm_t;
00080 
00081 /*
00082  * fKey indexes
00083  */
00084 #define A_K_DN 0
00085 #define A_K_UP 1
00086 #define A_K_LT 2
00087 #define A_K_RT 3
00088 #define A_K_HO 4
00089 #define A_K_EN 5
00090 #define A_K_DE 6
00091 #define A_K_NKEYS 7
00092 
00093 el_protected void term_move_to_line(EditLine_t*, int);
00094 el_protected void term_move_to_char(EditLine_t*, int);
00095 el_protected void term_clear_EOL(EditLine_t*, int);
00096 el_protected void term_overwrite(EditLine_t*, const char*, ElColor_t*, int);
00097 el_protected void term_insertwrite(EditLine_t*, const char*, ElColor_t*, int);
00098 el_protected void term_deletechars(EditLine_t*, int);
00099 el_protected void term_clear_screen(EditLine_t*);
00100 el_protected void term_beep(EditLine_t*);
00101 el_protected int term_change_size(EditLine_t*, int, int);
00102 el_protected int term_get_size(EditLine_t*, int*, int*);
00103 el_protected int term_init(EditLine_t*);
00104 el_protected void term_bind_arrow(EditLine_t*);
00105 el_protected void term_print_arrow(EditLine_t*, const char*);
00106 el_protected int term_clear_arrow(EditLine_t*, char*);
00107 el_protected int term_set_arrow(EditLine_t*, char*, KeyValue_t*, int);
00108 el_protected void term_end(EditLine_t*);
00109 el_protected int term_set(EditLine_t*, const char*);
00110 el_protected int term_settc(EditLine_t*, int, const char**);
00111 el_protected int term_telltc(EditLine_t*, int, const char**);
00112 el_protected int term_echotc(EditLine_t*, int, const char**);
00113 el_protected extern "C" int term__putc(int);
00114 el_protected int term__putcolorch(int, ElColor_t*);
00115 el_protected void term__setcolor(int fgcol);
00116 el_protected int  term__atocolor(const char* name);
00117 el_protected void term__resetcolor(void);
00118 el_protected void term__repaint(EditLine_t* el, int index);
00119 el_protected void term__flush(void);
00120 
00121 /*
00122  * Easy access macros
00123  */
00124 #define EL_FLAGS (el)->fTerm.fFlags
00125 
00126 #define EL_CAN_UP (EL_FLAGS & TERM_CAN_UP)
00127 #define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT)
00128 #define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE)
00129 #define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL)
00130 #define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB)
00131 #define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME)
00132 #define EL_HAS_META (EL_FLAGS & TERM_HAS_META)
00133 #define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS)
00134 #define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS)
00135 
00136 #endif /* _h_el_term */

Generated on Tue Jul 5 14:11:39 2011 for ROOT_528-00b_version by  doxygen 1.5.1