17c478bd9Sstevel@tonic-gate #ifndef getline_h
27c478bd9Sstevel@tonic-gate #define getline_h
37c478bd9Sstevel@tonic-gate 
47c478bd9Sstevel@tonic-gate /*
57c478bd9Sstevel@tonic-gate  * Copyright (c) 2000, 2001, 2002, 2003, 2004 by Martin C. Shepherd.
6*1da57d55SToomas Soome  *
77c478bd9Sstevel@tonic-gate  * All rights reserved.
8*1da57d55SToomas Soome  *
97c478bd9Sstevel@tonic-gate  * Permission is hereby granted, free of charge, to any person obtaining a
107c478bd9Sstevel@tonic-gate  * copy of this software and associated documentation files (the
117c478bd9Sstevel@tonic-gate  * "Software"), to deal in the Software without restriction, including
127c478bd9Sstevel@tonic-gate  * without limitation the rights to use, copy, modify, merge, publish,
137c478bd9Sstevel@tonic-gate  * distribute, and/or sell copies of the Software, and to permit persons
147c478bd9Sstevel@tonic-gate  * to whom the Software is furnished to do so, provided that the above
157c478bd9Sstevel@tonic-gate  * copyright notice(s) and this permission notice appear in all copies of
167c478bd9Sstevel@tonic-gate  * the Software and that both the above copyright notice(s) and this
177c478bd9Sstevel@tonic-gate  * permission notice appear in supporting documentation.
18*1da57d55SToomas Soome  *
197c478bd9Sstevel@tonic-gate  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
207c478bd9Sstevel@tonic-gate  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
217c478bd9Sstevel@tonic-gate  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
227c478bd9Sstevel@tonic-gate  * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
237c478bd9Sstevel@tonic-gate  * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
247c478bd9Sstevel@tonic-gate  * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
257c478bd9Sstevel@tonic-gate  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
267c478bd9Sstevel@tonic-gate  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
277c478bd9Sstevel@tonic-gate  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28*1da57d55SToomas Soome  *
297c478bd9Sstevel@tonic-gate  * Except as contained in this notice, the name of a copyright holder
307c478bd9Sstevel@tonic-gate  * shall not be used in advertising or otherwise to promote the sale, use
317c478bd9Sstevel@tonic-gate  * or other dealings in this Software without prior written authorization
327c478bd9Sstevel@tonic-gate  * of the copyright holder.
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Set the name of the getline configuration file.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate #define TECLA_CONFIG_FILE "~/.teclarc"
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * The following macro returns non-zero if a character is
427c478bd9Sstevel@tonic-gate  * a control character.
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate #define IS_CTRL_CHAR(c) ((unsigned char)(c) < ' ' || (unsigned char)(c)=='\177')
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * The following macro returns non-zero if a character is
487c478bd9Sstevel@tonic-gate  * a meta character.
497c478bd9Sstevel@tonic-gate  */
507c478bd9Sstevel@tonic-gate #define IS_META_CHAR(c) (((unsigned char)(c) & 0x80) && !isprint((int)(unsigned char)(c)))
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /*
537c478bd9Sstevel@tonic-gate  * Return the character that would be produced by pressing the
547c478bd9Sstevel@tonic-gate  * specified key plus the control key.
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate #define MAKE_CTRL(c) ((c)=='?' ? '\177' : ((unsigned char)toupper(c) & ~0x40))
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * Return the character that would be produced by pressing the
607c478bd9Sstevel@tonic-gate  * specified key plus the meta key.
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate #define MAKE_META(c) ((unsigned char)(c) | 0x80)
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * Given a binary control character, return the character that
667c478bd9Sstevel@tonic-gate  * had to be pressed at the same time as the control key.
677c478bd9Sstevel@tonic-gate  */
687c478bd9Sstevel@tonic-gate #define CTRL_TO_CHAR(c) (toupper((unsigned char)(c) | 0x40))
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * Given a meta character, return the character that was pressed
727c478bd9Sstevel@tonic-gate  * at the same time as the meta key.
737c478bd9Sstevel@tonic-gate  */
747c478bd9Sstevel@tonic-gate #define META_TO_CHAR(c) ((unsigned char)(c) & ~0x80)
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate /*
777c478bd9Sstevel@tonic-gate  * Specify the string of characters other than the alphanumeric characters,
787c478bd9Sstevel@tonic-gate  * that are to be considered parts of words.
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate #define GL_WORD_CHARS "_*\?\\[]"
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate /*
837c478bd9Sstevel@tonic-gate  * Define the escape character, both as a string and as a character.
847c478bd9Sstevel@tonic-gate  */
857c478bd9Sstevel@tonic-gate #define GL_ESC_STR "\033"
867c478bd9Sstevel@tonic-gate #define GL_ESC_CHAR '\033'
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #endif
89