chared.h

Go to the documentation of this file.
00001 // @(#)root/editline:$Id: chared.h 30194 2009-09-16 12:19:46Z axel $
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: chared.fH,v 1.6 2001/01/10 07:45:41 jdolecek 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.chared.fH: Character editor interface
00048  */
00049 #ifndef _h_el_chared
00050 #define _h_el_chared
00051 
00052 #include <ctype.h>
00053 #include <string.h>
00054 
00055 #include "histedit.h"
00056 
00057 #define EL_MAXMACRO 10
00058 
00059 /*
00060  * This is a issue of basic "vi" look-and-feel. Defining VI_MOVE works
00061  * like real vi: i.e. the transition from command<->insert modes moves
00062  * the cursor.
00063  *
00064  * On the other hand we really don't want to move the cursor, because
00065  * all the editing commands don't include the character under the cursor.
00066  * Probably the best fix is to make all the editing commands aware of
00067  * this fact.
00068  */
00069 #define VI_MOVE
00070 
00071 
00072 typedef struct CMacro_t {
00073    int fLevel;
00074    char** fMacro;
00075    char* fNLine;
00076 } CMacro_t;
00077 
00078 /*
00079  * Undo information for both vi and emacs
00080  */
00081 typedef struct CUndo_t {
00082    int fAction;
00083    size_t fISize;
00084    size_t fDSize;
00085    char* fPtr;
00086    char* fBuf;
00087 } CUndo_t;
00088 
00089 /*
00090  * Current action information for vi
00091  */
00092 typedef struct CVCmd_t {
00093    int fAction;
00094    char* fPos;
00095    char* fIns;
00096 } CVCmd_t;
00097 
00098 /*
00099  * Kill buffer for emacs
00100  */
00101 typedef struct CKill_t {
00102    char* fBuf;
00103    char* fLast;
00104    char* fMark;
00105 } CKill_t;
00106 
00107 /*
00108  * Note that we use both data structures because the user can bind
00109  * commands from both editors!
00110  */
00111 typedef struct ElCharEd_t {
00112    CUndo_t fUndo;
00113    CKill_t fKill;
00114    CVCmd_t fVCmd;
00115    CMacro_t fMacro;
00116 } ElCharEd_t;
00117 
00118 
00119 #define STReof "^D\b\b"
00120 #define STRQQ "\"\""
00121 
00122 #define isglob(a) (strchr("*[]?", (a)) != NULL)
00123 #define isword(a) (isprint(a))
00124 
00125 #define NOP 0x00
00126 #define DELETE 0x01
00127 #define INSERT 0x02
00128 #define CHANGE 0x04
00129 
00130 #define CHAR_FWD 0
00131 #define CHAR_BACK 1
00132 
00133 #define MODE_INSERT 0
00134 #define MODE_REPLACE 1
00135 #define MODE_REPLACE_1 2
00136 
00137 #include "common.h"
00138 #ifdef EL_USE_VI
00139 # include "vi.h"
00140 #endif
00141 #include "emacs.h"
00142 #include "search.h"
00143 #include "fcns.h"
00144 
00145 
00146 el_protected int cv__isword(int);
00147 el_protected void cv_delfini(EditLine_t*);
00148 el_protected char* cv__endword(char*, char*, int);
00149 el_protected int ce__isword(int);
00150 el_protected void cv_undo(EditLine_t *, int, size_t, char*);
00151 el_protected char* cv_next_word(EditLine_t *, char*, char*, int, int(*) (int));
00152 el_protected char* cv_prev_word(EditLine_t *, char*, char*, int, int(*) (int));
00153 el_protected char* c__next_word(char*, char*, int, int(*) (int));
00154 el_protected char* c__prev_word(char*, char*, int, int(*) (int));
00155 el_protected void c_insert(EditLine_t*, int);
00156 el_protected void c_delbefore(EditLine_t*, int);
00157 el_protected void c_delafter(EditLine_t*, int);
00158 el_protected int c_gets(EditLine_t*, char*);
00159 el_protected int c_hpos(EditLine_t*);
00160 
00161 el_protected int ch_init(EditLine_t*);
00162 el_protected void ch_reset(EditLine_t*);
00163 /* el_protected int      ch_enlargebufs __P((EditLine_t *, size_t)); */
00164 el_protected int ch_enlargebufs(EditLine_t *, size_t);
00165 el_protected void ch_end(EditLine_t*);
00166 
00167 #endif /* _h_el_chared */

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