xorp

getline.h

00001 #ifndef getline_h
00002 #define getline_h
00003 
00004 /*
00005  * Copyright (c) 2000, 2001 by Martin C. Shepherd.
00006  * 
00007  * All rights reserved.
00008  * 
00009  * Permission is hereby granted, free of charge, to any person obtaining a
00010  * copy of this software and associated documentation files (the
00011  * "Software"), to deal in the Software without restriction, including
00012  * without limitation the rights to use, copy, modify, merge, publish,
00013  * distribute, and/or sell copies of the Software, and to permit persons
00014  * to whom the Software is furnished to do so, provided that the above
00015  * copyright notice(s) and this permission notice appear in all copies of
00016  * the Software and that both the above copyright notice(s) and this
00017  * permission notice appear in supporting documentation.
00018  * 
00019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00020  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00021  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
00022  * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
00023  * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
00024  * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
00025  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
00026  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
00027  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00028  * 
00029  * Except as contained in this notice, the name of a copyright holder
00030  * shall not be used in advertising or otherwise to promote the sale, use
00031  * or other dealings in this Software without prior written authorization
00032  * of the copyright holder.
00033  */
00034 
00035 /*
00036  * Set the name of the getline configuration file.
00037  */
00038 #define TECLA_CONFIG_FILE "~/.teclarc"
00039 
00040 /*
00041  * The following macro returns non-zero if a character is
00042  * a control character.
00043  */
00044 #define IS_CTRL_CHAR(c) ((unsigned char)(c) < ' ' || (unsigned char)(c)=='\177')
00045 
00046 /*
00047  * The following macro returns non-zero if a character is
00048  * a meta character.
00049  */
00050 #define IS_META_CHAR(c) (((unsigned char)(c) & 0x80) && !isprint((int)(unsigned char)(c)))
00051 
00052 /*
00053  * Return the character that would be produced by pressing the
00054  * specified key plus the control key.
00055  */
00056 #define MAKE_CTRL(c) ((c)=='?' ? '\177' : ((unsigned char)toupper((int)(unsigned char)(c)) & ~0x40))
00057 
00058 /*
00059  * Return the character that would be produced by pressing the
00060  * specified key plus the meta key.
00061  */
00062 #define MAKE_META(c) ((unsigned char)(c) | 0x80)
00063 
00064 /*
00065  * Given a binary control character, return the character that
00066  * had to be pressed at the same time as the control key.
00067  */
00068 #define CTRL_TO_CHAR(c) (toupper((int)(unsigned char)(c) | 0x40))
00069 
00070 /*
00071  * Given a meta character, return the character that was pressed
00072  * at the same time as the meta key.
00073  */
00074 #define META_TO_CHAR(c) ((unsigned char)(c) & ~0x80)
00075 
00076 /*
00077  * Specify the string of characters other than the alphanumeric characters,
00078  * that are to be considered parts of words.
00079  */
00080 #define GL_WORD_CHARS "_*\?\\[]"
00081 
00082 /*
00083  * Define the escape character, both as a string and as a character.
00084  */
00085 #define GL_ESC_STR "\033"
00086 #define GL_ESC_CHAR '\033'
00087 
00088 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations