Annotation of 43BSDReno/usr.bin/window/tt.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1983 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * This code is derived from software contributed to Berkeley by
                      6:  * Edward Wang at The University of California, Berkeley.
                      7:  *
                      8:  * Redistribution and use in source and binary forms are permitted provided
                      9:  * that: (1) source distributions retain this entire copyright notice and
                     10:  * comment, and (2) distributions including binaries display the following
                     11:  * acknowledgement:  ``This product includes software developed by the
                     12:  * University of California, Berkeley and its contributors'' in the
                     13:  * documentation or other materials provided with the distribution and in
                     14:  * all advertising materials mentioning features or use of this software.
                     15:  * Neither the name of the University nor the names of its contributors may
                     16:  * be used to endorse or promote products derived from this software without
                     17:  * specific prior written permission.
                     18:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     19:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     20:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     21:  *
                     22:  *     @(#)tt.h        3.27 (Berkeley) 6/6/90
                     23:  */
                     24: 
                     25: /*
                     26:  * Interface structure for the terminal drivers.
                     27:  */
                     28: struct tt {
                     29:                /* startup and cleanup */
                     30:        int (*tt_start)();
                     31:        int (*tt_end)();
                     32: 
                     33:                /* terminal functions */
                     34:        int (*tt_move)();
                     35:        int (*tt_insline)();
                     36:        int (*tt_delline)();
                     37:        int (*tt_inschar)();
                     38:        int (*tt_insspace)();
                     39:        int (*tt_delchar)();
                     40:        int (*tt_write)();              /* write a whole block */
                     41:        int (*tt_putc)();               /* write one character */
                     42:        int (*tt_clreol)();
                     43:        int (*tt_clreos)();
                     44:        int (*tt_clear)();
                     45:        int (*tt_scroll_down)();
                     46:        int (*tt_scroll_up)();
                     47:        int (*tt_setscroll)();          /* set scrolling region */
                     48:        int (*tt_setmodes)();           /* set display modes */
                     49:        int (*tt_set_token)();          /* define a token */
                     50:        int (*tt_put_token)();          /* refer to a defined token */
                     51: 
                     52:                /* internal variables */
                     53:        char tt_modes;                  /* the current display modes */
                     54:        char tt_nmodes;                 /* the new modes for next write */
                     55:        char tt_insert;                 /* currently in insert mode */
                     56:        int tt_row;                     /* cursor row */
                     57:        int tt_col;                     /* cursor column */
                     58:        int tt_scroll_top;              /* top of scrolling region */
                     59:        int tt_scroll_bot;              /* bottom of scrolling region */
                     60: 
                     61:                /* terminal info */
                     62:        int tt_nrow;                    /* number of display rows */
                     63:        int tt_ncol;                    /* number of display columns */
                     64:        char tt_availmodes;             /* the display modes supported */
                     65:        char tt_wrap;                   /* has auto wrap around */
                     66:        char tt_retain;                 /* can retain below (db flag) */
                     67:        short tt_padc;                  /* the pad character */
                     68:        int tt_ntoken;                  /* number of compression tokens */
                     69:        int tt_token_min;               /* minimun token size */
                     70:        int tt_token_max;               /* maximum token size */
                     71:        int tt_set_token_cost;          /* cost in addition to string */
                     72:        int tt_put_token_cost;          /* constant cost */
                     73: 
                     74:                /* the frame characters */
                     75:        short *tt_frame;
                     76: 
                     77:                /* the output routine */
                     78:        int (*tt_flush)();
                     79: };
                     80: struct tt tt;
                     81: 
                     82: /*
                     83:  * tt_padc is used by the compression routine.
                     84:  * It is a short to allow the driver to indicate that there is no padding.
                     85:  */
                     86: #define TT_PADC_NONE 0x100
                     87: 
                     88: /*
                     89:  * List of terminal drivers.
                     90:  */
                     91: struct tt_tab {
                     92:        char *tt_name;
                     93:        int tt_len;
                     94:        int (*tt_func)();
                     95: };
                     96: extern struct tt_tab tt_tab[];
                     97: 
                     98: /*
                     99:  * Clean interface to termcap routines.
                    100:  * Too may t's.
                    101:  */
                    102: char tt_strings[1024];         /* string buffer */
                    103: char *tt_strp;                 /* pointer for it */
                    104: 
                    105: struct tt_str {
                    106:        char *ts_str;
                    107:        int ts_n;
                    108: };
                    109: 
                    110: struct tt_str *tttgetstr();
                    111: struct tt_str *ttxgetstr();    /* tgetstr() and expand delays */
                    112: 
                    113: int tttputc();
                    114: #define tttputs(s, n)  tputs((s)->ts_str, (n), tttputc)
                    115: #define ttxputs(s)     ttwrite((s)->ts_str, (s)->ts_n)
                    116: 
                    117: /*
                    118:  * Buffered output without stdio.
                    119:  * These variables have different meanings from the ww_ob* variables.
                    120:  * But I'm too lazy to think up different names.
                    121:  */
                    122: char *tt_ob;
                    123: char *tt_obp;
                    124: char *tt_obe;
                    125: #define ttputc(c)      (tt_obp < tt_obe ? (*tt_obp++ = (c)) \
                    126:                                : ((*tt.tt_flush)(), *tt_obp++ = (c)))
                    127: 
                    128: /*
                    129:  * Convenience macros for the drivers
                    130:  * They require char.h
                    131:  */
                    132: #define ttctrl(c)      ttputc(ctrl(c))
                    133: #define ttesc(c)       (ttctrl('['), ttputc(c))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.