Home | History | Annotate | Line # | Download | only in ksh
      1 /*	$NetBSD: edit.h,v 1.5 2017/07/01 23:12:08 joerg Exp $	*/
      2 
      3 /* NAME:
      4  *      edit.h - globals for edit modes
      5  *
      6  * DESCRIPTION:
      7  *      This header defines various global edit objects.
      8  *
      9  * SEE ALSO:
     10  *
     11  *
     12  * RCSid:
     13  *      $NetBSD: edit.h,v 1.5 2017/07/01 23:12:08 joerg Exp $
     14  *
     15  */
     16 
     17 #include <stdbool.h>
     18 
     19 /* some useful #defines */
     20 #ifdef EXTERN
     21 # define I__(i) = i
     22 #else
     23 # define I__(i)
     24 # define EXTERN extern
     25 # define EXTERN_DEFINED
     26 #endif
     27 
     28 #define	BEL		0x07
     29 
     30 /* tty driver characters we are interested in */
     31 typedef struct {
     32 	int erase;
     33 	int kill;
     34 	int werase;
     35 	int intr;
     36 	int quit;
     37 	int eof;
     38 } X_chars;
     39 
     40 EXTERN X_chars edchars;
     41 
     42 /* x_fc_glob() flags */
     43 #define XCF_COMMAND	BIT(0)	/* Do command completion */
     44 #define XCF_FILE	BIT(1)	/* Do file completion */
     45 #define XCF_FULLPATH	BIT(2)	/* command completion: store full path */
     46 #define XCF_COMMAND_FILE (XCF_COMMAND|XCF_FILE)
     47 
     48 /* edit.c */
     49 int 	x_getc		ARGS((void));
     50 void 	x_flush		ARGS((void));
     51 void 	x_putc		ARGS((int c));
     52 void 	x_puts		ARGS((const char *s));
     53 bool 	x_mode(bool onoff);
     54 int 	promptlen	ARGS((const char *cp, const char **spp));
     55 int	x_do_comment	ARGS((char *buf, int bsize, int *lenp));
     56 void	x_print_expansions ARGS((int nwords, char *const *words, int is_command));
     57 int	x_cf_glob ARGS((int flags, const char *buf, int buflen, int pos, int *startp,
     58 			  int *endp, char ***wordsp, int *is_commandp));
     59 int	x_longest_prefix ARGS((int nwords, char *const *words));
     60 int	x_basename ARGS((const char *s, const char *se));
     61 void	x_free_words ARGS((int nwords, char **words));
     62 int	x_escape ARGS((const char *, size_t, int (*)(const char *s, size_t len)));
     63 /* emacs.c */
     64 int 	x_emacs		ARGS((char *buf, size_t len));
     65 void 	x_init_emacs	ARGS((void));
     66 void	x_emacs_keys	ARGS((X_chars *ec));
     67 /* vi.c */
     68 int 	x_vi		ARGS((char *buf, size_t len));
     69 
     70 
     71 #ifdef DEBUG
     72 # define D__(x) x
     73 #else
     74 # define D__(x)
     75 #endif
     76 
     77 /* This lot goes at the END */
     78 /* be sure not to interfere with anyone else's idea about EXTERN */
     79 #ifdef EXTERN_DEFINED
     80 # undef EXTERN_DEFINED
     81 # undef EXTERN
     82 #endif
     83 #undef I__
     84 /*
     85  * Local Variables:
     86  * version-control:t
     87  * comment-column:40
     88  * End:
     89  */
     90