/* $NetBSD: el.h,v 1.48 2025/01/03 00:40:08 rillig Exp $ */12/*-3* Copyright (c) 1992, 19934* The Regents of the University of California. All rights reserved.5*6* This code is derived from software contributed to Berkeley by7* Christos Zoulas of Cornell University.8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17* 3. Neither the name of the University nor the names of its contributors18* may be used to endorse or promote products derived from this software19* without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND22* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE25* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)28* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY30* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF31* SUCH DAMAGE.32*33* @(#)el.h 8.1 (Berkeley) 6/4/9334*/3536/*37* el.h: Internal structures.38*/39#ifndef _h_el40#define _h_el41/*42* Local defaults43*/44#define KSHVI45#define VIDEFAULT46#define ANCHOR4748#include "histedit.h"49#include "chartype.h"5051#define EL_BUFSIZ ((size_t)1024) /* Maximum line size */5253#define HANDLE_SIGNALS 0x00154#define NO_TTY 0x00255#define EDIT_DISABLED 0x00456#define UNBUFFERED 0x00857#define NARROW_HISTORY 0x04058#define NO_RESET 0x08059#define FIXIO 0x10060#define FROM_ELLINE 0x2006162typedef unsigned char el_action_t; /* Index to command array */6364typedef struct coord_t { /* Position on the screen */65int h;66int v;67} coord_t;6869typedef struct el_line_t {70wchar_t *buffer; /* Input line */71wchar_t *cursor; /* Cursor position */72wchar_t *lastchar; /* Last character */73const wchar_t *limit; /* Max position */74} el_line_t;7576/*77* Editor state78*/79typedef struct el_state_t {80int inputmode; /* What mode are we in? */81int doingarg; /* Are we getting an argument? */82int argument; /* Numeric argument */83int metanext; /* Is the next char a meta char */84el_action_t lastcmd; /* Previous command */85el_action_t thiscmd; /* this command */86wchar_t thisch; /* char that generated it */87} el_state_t;8889/*90* Until we come up with something better...91*/92#define el_malloc(a) malloc(a)93#define el_calloc(a,b) calloc(a, b)94#define el_realloc(a,b) realloc(a, b)95#define el_free(a) free(a)9697#include "tty.h"98#include "prompt.h"99#include "literal.h"100#include "keymacro.h"101#include "terminal.h"102#include "refresh.h"103#include "chared.h"104#include "search.h"105#include "hist.h"106#include "map.h"107#include "sig.h"108109struct el_read_t;110111struct editline {112wchar_t *el_prog; /* the program name */113FILE *el_infile; /* Stdio stuff */114FILE *el_outfile; /* Stdio stuff */115FILE *el_errfile; /* Stdio stuff */116int el_infd; /* Input file descriptor */117int el_outfd; /* Output file descriptor */118int el_errfd; /* Error file descriptor */119int el_flags; /* Various flags. */120coord_t el_cursor; /* Cursor location */121wint_t **el_display; /* Real screen image = what is there */122wint_t **el_vdisplay; /* Virtual screen image = what we see */123void *el_data; /* Client data */124el_line_t el_line; /* The current line information */125el_state_t el_state; /* Current editor state */126el_terminal_t el_terminal; /* Terminal dependent stuff */127el_tty_t el_tty; /* Tty dependent stuff */128el_refresh_t el_refresh; /* Refresh stuff */129el_prompt_t el_prompt; /* Prompt stuff */130el_prompt_t el_rprompt; /* Prompt stuff */131el_literal_t el_literal; /* prompt literal bits */132el_chared_t el_chared; /* Characted editor stuff */133el_map_t el_map; /* Key mapping stuff */134el_keymacro_t el_keymacro; /* Key binding stuff */135el_history_t el_history; /* History stuff */136el_search_t el_search; /* Search stuff */137el_signal_t el_signal; /* Signal handling stuff */138struct el_read_t *el_read; /* Character reading stuff */139ct_buffer_t el_visual; /* Buffer for displayable str */140ct_buffer_t el_scratch; /* Scratch conversion buffer */141ct_buffer_t el_lgcyconv; /* Buffer for legacy wrappers */142LineInfo el_lgcylinfo; /* Legacy LineInfo buffer */143};144145libedit_private int el_editmode(EditLine *, int, const wchar_t **);146libedit_private EditLine *el_init_internal(const char *, FILE *, FILE *,147FILE *, int, int, int, int);148149#ifdef DEBUG150#define EL_ABORT(a) do { \151fprintf(el->el_errfile, "%s, %d: ", \152__FILE__, __LINE__); \153fprintf a; \154abort(); \155} while (0)156#else157#define EL_ABORT(a) abort()158#endif159#endif /* _h_el */160161162