/usr/include/xview_private/tty_impl.h is in xviewg-dev 3.2p1.4-28.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | /* @(#)tty_impl.h 20.37 93/06/28 SMI */
/*
* (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
* pending in the U.S. and foreign countries. See LEGAL NOTICE
* file for terms of the license.
*/
#ifndef _xview_private_ttysw_impl_h_already_included
#define _xview_private_ttysw_impl_h_already_included
/*
* A tty subwindow is a subwindow type that is used to provide a
* terminal emulation for teletype based programs.
*/
#include <xview_private/portable.h> /* tty and pty configuration info */
#ifdef XV_USE_TERMIOS
#include <termios.h> /* for POSIX-style tty state structure */
#else
#include <sys/ioctl.h> /* for BSD-style tty state structures */
#endif
#include <xview/tty.h>
#include <xview/sel_svc.h>
#include <xview_private/i18n_impl.h>
#define TTY_PRIVATE(_t) XV_PRIVATE(Ttysw, Xv_tty, _t)
#define TTY_PUBLIC(_tty_folio) XV_PUBLIC(_tty_folio)
#define TTY_VIEW_PRIVATE(_t) XV_PRIVATE(Ttysw_view_object, Xv_tty_view, _t)
#define TTY_VIEW_PUBLIC(_tty_view) XV_PUBLIC(_tty_view)
#define IS_TTY(_t) \
(((Xv_base *)(_t))->pkg == TTY)
#define IS_TTY_VIEW(_t) \
(((Xv_base *)(_t))->pkg == TTY_VIEW)
/* BUG: This could be made cleaner. See
* TERMSW_FOLIO_FROM_TERMSW_VIEW_HANDLE in termsw_impl.h
*/
#define TTY_VIEW_HANDLE_FROM_TTY_FOLIO(_tty_folio_private) \
((Ttysw_view_handle)(((Ttysw_folio)_tty_folio_private)->view))
#define TTY_FOLIO_FROM_TTY_VIEW_HANDLE(_tty_view_private) \
((Ttysw_folio)(((Ttysw_view_handle)_tty_view_private)->folio))
#define TTY_FOLIO_FROM_TTY_VIEW(_tty_view_public) \
((Ttysw_folio) \
(((Ttysw_view_handle) TTY_VIEW_PRIVATE(_tty_view_public))->folio))
#define TTY_FROM_TTY_VIEW(_tty_view_public) \
((Tty) TTY_PUBLIC(TTY_FOLIO_FROM_TTY_VIEW(_tty_view_public)))
/*
* These are the data structures internal to the tty subwindow
* implementation. They are considered private to the implementation.
*/
struct cbuf {
CHAR *cb_rbp; /* read pointer */
CHAR *cb_wbp; /* write pointer */
CHAR *cb_ebp; /* end of buffer */
CHAR cb_buf[2048];
};
struct input_cbuf {
CHAR *cb_rbp; /* read pointer */
CHAR *cb_wbp; /* write pointer */
CHAR *cb_ebp; /* end of buffer */
CHAR cb_buf[8192];
};
struct keymaptab {
int kmt_key;
int kmt_output;
char *kmt_to;
};
struct textselpos {
int tsp_row;
int tsp_col;
#ifdef OW_I18N
int tsp_charpos;
#endif
};
struct ttyselection {
int sel_made; /* a selection has been made */
int sel_null; /* the selection is null */
int sel_level; /* see below */
int sel_anchor;/* -1 = left, 0 = none, 1 = right */
struct textselpos sel_begin; /* beginning of selection */
struct textselpos sel_end; /* end of selection */
struct timeval sel_time; /* time selection was made */
Seln_rank sel_rank; /* type of selection. primary or secondary */
int dehilite_op; /* Operation for taking down selection */
};
/* selection levels */
#define SEL_CHAR 0
#define SEL_WORD 1
#define SEL_LINE 2
#define SEL_PARA 3
#define SEL_MAX 3
extern struct ttyselection null_ttyselection;
enum ttysw_hdrstate { HS_BEGIN, HS_HEADER, HS_ICON, HS_ICONFILE, HS_FLUSH };
typedef struct ttysubwindow {
Tty public_self; /* Back pointer to the object*/
struct ttysw_view_object /* View window */
*view; /* (Pure tty has only one view) */
Tty_view current_view_public; /* This keep trace of the view become ttysw */
unsigned ttysw_flags;
/* common */
int ttysw_opt; /* option mask; see ttysw.h */
struct input_cbuf ttysw_ibuf; /* input buffer */
struct cbuf ttysw_obuf; /* output buffer */
/* pty and subprocess */
int ttysw_pty; /* master (pty) file descriptor */
int ttysw_tty; /* slave (tty) file descriptor */
char tty_name[20]; /* slave (tty) file name */
int ttysw_ttyslot; /* ttyslot in utmp for tty */
/* saved tty mode information: see access functions below */
# ifdef XV_USE_TERMIOS
struct termios termios;
# else /* XV_USE_TERMIOS */
struct sgttyb sgttyb;
struct tchars tchars;
struct ltchars ltchars;
# endif /* XV_USE_TERMIOS */
/*
* The next two fields record the current pty remote mode state and the
* remote mode state to which it should be set before processing the next
* input character.
*/
int remote;
int pending_remote;
/* page mode */
int ttysw_lpp; /* page mode: lines per page */
/* subprocess */
int ttysw_pidchild; /* pid of the child */
/* Caps Lock */
int ttysw_capslocked;
#define TTYSW_CAPSLOCKED 0x01 /* capslocked on mask bit */
#define TTYSW_CAPSSAWESC 0x02 /* saw escape while caps locked */
/* stuff from old ttytlsw */
enum ttysw_hdrstate hdrstate; /* string trying to load */
CHAR *nameptr; /* namebuf ptr */
CHAR namebuf[256]; /* accumulates esc string */
/* selection */
int ttysw_butdown; /* which button is down */
struct ttyselection ttysw_caret;
struct ttyselection ttysw_primary;
struct ttyselection ttysw_secondary;
struct ttyselection ttysw_shelf;
caddr_t ttysw_seln_client;
/* replaceable ops (return TTY_OK or TTY_DONE) */
int (*ttysw_escapeop) (); /* handle escape sequences */
int (*ttysw_stringop) (); /* handle accumulated string */
int (*ttysw_eventop) (); /* handle input event */
/* kbd translation */
struct keymaptab ttysw_kmt[3 * 16 + 2]; /* Key map list */
struct keymaptab *ttysw_kmtp; /* next empty ttysw_kmt slot */
int (*layout_proc)(); /* interposed window layout proc */
#ifdef OW_I18N
int im_first_col;
int im_first_row;
int im_len;
wchar_t *im_store;
XIMFeedback *im_attr;
Bool preedit_state;
XIC ic;
int implicit_commit;
XIMCallback start_pecb_struct;
XIMCallback draw_pecb_struct;
XIMCallback done_pecb_struct;
#ifdef FULL_R5
XIMStyle xim_style;
#endif /* FULL_R5 */
#endif
int pass_thru_modifiers; /* Modifiers we don't interpret */
int eight_bit_output; /* Print eight bit characters? */
} Ttysw;
typedef Ttysw *Ttysw_folio;
typedef struct ttysw_view_object {
Tty_view public_self;
Ttysw_folio folio;
} Ttysw_view_object;
typedef Ttysw_view_object* Ttysw_view_handle;
/* Values for ttysw_flags */
#define TTYSW_FL_FROZEN 0x1
#define TTYSW_FL_IS_TERMSW 0x2
#define TTYSW_FL_IN_PRIORITIZER 0x4
/*
* Functions, macros, and typedefs for abstracting away differences between
* termios and old BSD-style tty mode representations.
*/
/*
* Access functions for tty characteristics.
*/
#ifdef XV_USE_TERMIOS
#define tty_gettabs(t) ((t)->termios.c_oflag & XTABS)
#if !defined(__linux__) || defined(VDSUSP)
#define tty_getdsuspc(t) ((int) ((t)->termios.c_cc[VDSUSP]))
#else
#define tty_getdsuspc(t) ((int) -1)
#endif
#define tty_geteofc(t) ((int) ((t)->termios.c_cc[VEOF]))
#define tty_geteolc(t) ((int) ((t)->termios.c_cc[VEOL]))
#define tty_geteol2c(t) ((int) ((t)->termios.c_cc[VEOL2]))
#define tty_getintrc(t) ((int) ((t)->termios.c_cc[VINTR]))
#define tty_getlnextc(t) ((int) ((t)->termios.c_cc[VLNEXT]))
#define tty_getquitc(t) ((int) ((t)->termios.c_cc[VQUIT]))
#define tty_getrprntc(t) ((int) ((t)->termios.c_cc[VREPRINT]))
#define tty_getstartc(t) ((int) ((t)->termios.c_cc[VSTART]))
#define tty_getstopc(t) ((int) ((t)->termios.c_cc[VSTOP]))
#define tty_getsuspc(t) ((int) ((t)->termios.c_cc[VSUSP]))
#else /* XV_USE_TERMIOS */
#define tty_gettabs(t) ((t)->sgttyb.sg_flags & XTABS)
#define tty_getdsuspc(t) ((int) ((t)->ltchars.t_dsuspc))
#define tty_geteofc(t) ((int) ((t)->tchars.t_eofc))
#define tty_geteolc(t) ((int) ((t)->tchars.t_brkc))
#define tty_geteol2c(t) ((int) ((t)->tchars.t_brkc))
#define tty_getintrc(t) ((int) ((t)->tchars.t_intrc))
#define tty_getlnextc(t) ((int) ((t)->ltchars.t_lnextc))
#define tty_getquitc(t) ((int) ((t)->tchars.t_quitc))
#define tty_getrprntc(t) ((int) ((t)->ltchars.t_rprntc))
#define tty_getstartc(t) ((int) ((t)->tchars.t_startc))
#define tty_getstopc(t) ((int) ((t)->tchars.t_stopc))
#define tty_getsuspc(t) ((int) ((t)->ltchars.t_suspc))
#endif /* XV_USE_TERMIOS */
/*
* Predicates for tty characteristics.
*/
#ifdef XV_USE_TERMIOS
#define tty_iscanon(t) (((t)->termios.c_lflag & ICANON) != 0)
#define tty_isecho(t) (((t)->termios.c_lflag & ECHO ) != 0)
#define tty_issig(t) (((t)->termios.c_lflag & ISIG ) != 0)
#else /* XV_USE_TERMIOS */
#define tty_iscanon(t) (((t)->sgttyb.sg_flags & (RAW|CBREAK)) == 0)
#define tty_isecho(t) (((t)->sgttyb.sg_flags & ECHO) != 0)
#define tty_issig(t) (((t)->sgttyb.sg_flags & RAW) == 0)
#endif /* XV_USE_TERMIOS */
/*
* Capture fd's current tty modes and store them in *mode.
*/
#ifdef XV_USE_TERMIOS
#define tty_mode termios /* Ttysw field alias (ugh!) */
typedef struct termios tty_mode_t;
#else /* XV_USE_TERMIOS */
#define tty_mode sgttyb /* Ttysw field alias (ugh!) */
typedef struct sgttyb tty_mode_t;
#endif /* XV_USE_TERMIOS */
/*
* Determine where to store tty characteristics in the environment. To avoid
* possible misinterpretation, we use different locations depending on whether
* or not XV_USE_TERMIOS is set.
*/
#ifdef XV_USE_TERMIOS
#define WE_TTYPARMS "WINDOW_TERMIOS"
#define WE_TTYPARMS_E "WINDOW_TERMIOS="
#else /* XV_USE_TERMIOS */
#define WE_TTYPARMS "WINDOW_TTYPARMS"
#define WE_TTYPARMS_E "WINDOW_TTYPARMS="
#endif /* XV_USE_TERMIOS */
#define TTYSW_NULL ((Ttysw *)0)
/*
* Possible return codes from replaceable ops.
*/
#define TTY_OK (0) /* args should be handled as normal */
#define TTY_DONE (1) /* args have been fully handled */
#define ttysw_handleevent(ttysw, ie) \
(*(ttysw)->ttysw_eventop)(TTY_PUBLIC(ttysw), (ie))
#define ttysw_handleescape(_ttysw_view, c, ac, av) \
(*(ttysw)->ttysw_escapeop)(TTY_VIEW_PUBLIC(_ttysw_view), (c), (ac), (av))
#define ttysw_handlestring(ttysw, strtype, c) \
(*(ttysw)->ttysw_stringop)(TTY_PUBLIC(ttysw), (strtype), (c))
/*** XView private routines ***/
Xv_private void
tty_background(),
tty_copyarea(),
tty_newtext(),
tty_clear_clip_rectangles();
#define MAX_LINES 128
typedef struct {
int caret_line_exposed:1;
int caret_line;
int leftmost;
char line_exposed[MAX_LINES];
} Tty_exposed_lines;
Xv_private Tty_exposed_lines *tty_calc_exposed_lines();
Xv_private int ttysw_view_obscured;
/*** Package private routines ***/
Pkg_private void
csr_resize(), /* BUG ALERT: No XView prefix */
delete_lines(), /* BUG ALERT: No XView prefix */
termsw_caret_cleared(),
termsw_menu_set(),
termsw_menu_clr(),
ttynullselection(), /* BUG ALERT: No XView prefix */
ttysetselection(), /* BUG ALERT: No XView prefix */
ttysel_acquire(),
ttysel_adjust(),
ttysel_deselect(),
ttysel_destroy(),
ttysel_getselection(),
ttysel_init_client(),
ttysel_make(),
ttysel_nullselection(),
ttysel_setselection(),
ttysw_ansiinit(),
ttysw_blinkscreen(),
ttysw_bold_mode(),
ttysw_cim_clear(),
ttysw_cim_scroll(),
ttysw_clear(),
ttysw_clear_mode(),
ttysw_consume_output(),
ttysw_deleteChar(),
ttysw_display(),
ttysw_display_capslock(),
ttysw_doing_pty_insert(),
ttysw_drawCursor(),
ttysw_flush_input(),
ttysw_getp(),
ttysw_handle_itimer(),
ttysw_imagerepair(),
ttysw_implicit_commit(),
ttysw_insertChar(),
ttysw_insert_lines(),
ttysw_interpose(),
ttysw_interpose_on_textsw(),
ttysw_inverse_mode(),
ttysw_lighten_cursor(),
ttysw_move_mark(),
ttysw_pclearline(),
ttysw_pclearscreen(),
ttysw_pcopyline(),
ttysw_pcopyscreen(),
ttysw_pdisplayscreen(),
ttysw_pos(),
ttysw_prepair(),
ttysw_pselectionhilite(),
ttysw_pstring(),
ttysw_pty_input(),
ttysw_readrc(),
ttysw_removeCursor(),
ttysw_reset_conditions(),
ttysw_resize(),
ttysw_restore_cursor(),
ttysw_restoreCursor(), /* BUG ALERT: unnecessary routine */
ttysw_saveCursor(), /* BUG ALERT: unnecessary routine */
ttysw_screencomp(), /* BUG ALERT: unnecessary routine */
ttysw_sendsig(),
ttysw_set_inverse_mode(),
ttysw_set_menu(),
ttysw_set_underline_mode(),
ttysw_setleftmargin(),
ttysw_setopt(),
ttysw_show_walkmenu(),
ttysw_sigwinch(),
ttysw_textsw_changed(),
ttysw_underscore_mode(),
ttysw_vpos(),
ttysw_writePartialLine(),
we_setptyparms(), /* BUG ALERT: No XView prefix */
xv_new_tty_chr_font(),
xv_tty_free_image_and_mode(),
xv_tty_imagealloc(),
xv_tty_new_size(),
ttysw_pty_output(); /* mbuck@debian.org: Moved here from int-returning functions */
#ifdef OW_I18N
Pkg_private void
tty_column_wchar_type();
#endif
Pkg_private int
tty_folio_init(),
tty_getmode(),
tty_view_init(),
ttysw_ansi_escape(),
ttysw_ansi_string(),
ttysw_be_termsw(),
ttysw_be_ttysw(),
ttysw_cooked_echo_mode(),
ttysw_destroy(),
ttysw_do_copy(),
ttysw_do_paste(),
ttysw_domap(),
ttysw_fork_it(),
ttysw_freeze(),
ttysw_getboldstyle(),
ttysw_getopt(),
ttysw_input_it(),
ttysw_lookup_boldstyle(),
ttysw_mapsetim(),
ttysw_output_it(),
ttysw_print_bold_options(),
/* ttysw_pty_output(), mbuck@debian.org: moved to void-returning functions */
ttysw_pty_output_ok(),
ttysw_restoreparms(),
ttysw_saveparms(),
ttysw_scan_for_completed_commands(),
ttysw_setboldstyle(),
ttytlsw_escape(), /* BUG ALERT: No XView prefix */
ttytlsw_string(), /* BUG ALERT: No XView prefix */
wininit(), /* BUG ALERT: No XView prefix */
xv_tty_imageinit();
#ifdef OW_I18N
Pkg_private int
tty_character_size(),
tty_get_nchars(),
ttysw_input_it_wcs();
#endif
Pkg_private Notify_value
ttysw_itimer_expired(),
ttysw_pty_input_pending(),
ttysw_text_event();
Pkg_private Xv_opaque
ts_create(), /* BUG ALERT: No XView prefix */
ttysw_init_folio_internal(),
ttysw_init_view_internal(),
ttysw_walkmenu();
#ifdef cplus
/*
* C Library routines specifically related to private ttysw subwindow
* functions. ttysw_output and ttysw_input return the number of characters
* accepted/processed (usually equal to len).
*/
int
ttysw_output(Tty ttysw_public, char *addr, int len);
/* Interpret string in terminal emulator. */
int
ttysw_input(Tty ttysw_public, char *addr, int len);
/* Add string to the input queue. */
#endif /* cplus */
#endif /* _xview_private_ttysw_impl_h_already_included */
|