[BACK]Return to tmux.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Annotation of src/usr.bin/tmux/tmux.h, Revision 1.507

1.507   ! nicm        1: /* $OpenBSD: tmux.h,v 1.506 2015/05/07 08:08:54 nicm Exp $ */
1.1       nicm        2:
                      3: /*
                      4:  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
                      5:  *
                      6:  * Permission to use, copy, modify, and distribute this software for any
                      7:  * purpose with or without fee is hereby granted, provided that the above
                      8:  * copyright notice and this permission notice appear in all copies.
                      9:  *
                     10:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     11:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     12:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     13:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     14:  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
                     15:  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
                     16:  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     17:  */
                     18:
                     19: #ifndef TMUX_H
                     20: #define TMUX_H
                     21:
1.423     nicm       22: #define PROTOCOL_VERSION 8
1.1       nicm       23:
                     24: #include <sys/time.h>
                     25: #include <sys/queue.h>
                     26: #include <sys/tree.h>
1.75      nicm       27: #include <sys/uio.h>
1.1       nicm       28:
1.6       nicm       29: #include <bitstring.h>
1.159     nicm       30: #include <event.h>
1.222     nicm       31: #include <imsg.h>
1.1       nicm       32: #include <limits.h>
                     33: #include <stdarg.h>
                     34: #include <stdint.h>
                     35: #include <stdio.h>
                     36: #include <termios.h>
                     37:
1.42      nicm       38: extern char    *__progname;
1.73      nicm       39: extern char   **environ;
1.1       nicm       40:
1.409     nicm       41: /* Default global configuration file. */
                     42: #define TMUX_CONF "/etc/tmux.conf"
1.1       nicm       43:
1.195     nicm       44: /*
1.39      nicm       45:  * Minimum layout cell size, NOT including separator line. The scroll region
                     46:  * cannot be one line in height so this must be at least two.
                     47:  */
                     48: #define PANE_MINIMUM 2
1.1       nicm       49:
                     50: /* Automatic name refresh interval, in milliseconds. */
                     51: #define NAME_INTERVAL 500
1.152     nicm       52:
1.55      nicm       53: /*
1.181     nicm       54:  * UTF-8 data size. This must be big enough to hold combined characters as well
                     55:  * as single.
                     56:  */
                     57: #define UTF8_SIZE 9
                     58:
1.1       nicm       59: /* Fatal errors. */
                     60: #define fatal(msg) log_fatal("%s: %s", __func__, msg);
                     61: #define fatalx(msg) log_fatalx("%s: %s", __func__, msg);
                     62:
                     63: /* Definition to shut gcc up about unused arguments. */
                     64: #define unused __attribute__ ((unused))
                     65:
                     66: /* Attribute to make gcc check printf-like arguments. */
1.476     nicm       67: #define printflike(a, b) __attribute__ ((format (printf, a, b)))
1.1       nicm       68:
                     69: /* Number of items in array. */
1.14      nicm       70: #ifndef nitems
1.1       nicm       71: #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
1.14      nicm       72: #endif
1.335     nicm       73:
1.1       nicm       74: /* Bell option values. */
                     75: #define BELL_NONE 0
                     76: #define BELL_ANY 1
                     77: #define BELL_CURRENT 2
                     78:
1.174     nicm       79: /* Special key codes. */
1.54      nicm       80: #define KEYC_NONE 0xfff
1.174     nicm       81: #define KEYC_BASE 0x1000
                     82:
                     83: /* Key modifier bits. */
1.54      nicm       84: #define KEYC_ESCAPE 0x2000
                     85: #define KEYC_CTRL 0x4000
                     86: #define KEYC_SHIFT 0x8000
1.225     nicm       87:
1.275     nicm       88: /* Mask to obtain key w/o modifiers. */
1.493     nicm       89: #define KEYC_MASK_MOD (KEYC_ESCAPE|KEYC_CTRL|KEYC_SHIFT)
1.225     nicm       90: #define KEYC_MASK_KEY (~KEYC_MASK_MOD)
1.41      nicm       91:
1.492     nicm       92: /* Is this a mouse key? */
                     93: #define KEYC_IS_MOUSE(key) (((key) & KEYC_MASK_KEY) >= KEYC_MOUSE &&   \
                     94:     ((key) & KEYC_MASK_KEY) < KEYC_BSPACE)
                     95:
                     96: /* Mouse key codes. */
                     97: #define KEYC_MOUSE_KEY(name)                           \
                     98:        KEYC_ ## name ## _PANE,                         \
                     99:        KEYC_ ## name ## _STATUS,                       \
                    100:        KEYC_ ## name ## _BORDER
                    101: #define KEYC_MOUSE_STRING(name, s)                     \
                    102:        { #s "Pane", KEYC_ ## name ## _PANE },          \
                    103:        { #s "Status", KEYC_ ## name ## _STATUS },      \
                    104:        { #s "Border", KEYC_ ## name ## _BORDER }
                    105:
                    106: /* Special key codes. */
1.41      nicm      107: enum key_code {
1.492     nicm      108:        /* Focus events. */
                    109:        KEYC_FOCUS_IN = KEYC_BASE,
                    110:        KEYC_FOCUS_OUT,
                    111:
                    112:        /* Mouse keys. */
                    113:        KEYC_MOUSE, /* unclassified mouse event */
                    114:        KEYC_MOUSE_KEY(MOUSEDOWN1),
                    115:        KEYC_MOUSE_KEY(MOUSEDOWN2),
                    116:        KEYC_MOUSE_KEY(MOUSEDOWN3),
                    117:        KEYC_MOUSE_KEY(MOUSEUP1),
                    118:        KEYC_MOUSE_KEY(MOUSEUP2),
                    119:        KEYC_MOUSE_KEY(MOUSEUP3),
                    120:        KEYC_MOUSE_KEY(MOUSEDRAG1),
                    121:        KEYC_MOUSE_KEY(MOUSEDRAG2),
                    122:        KEYC_MOUSE_KEY(MOUSEDRAG3),
                    123:        KEYC_MOUSE_KEY(WHEELUP),
                    124:        KEYC_MOUSE_KEY(WHEELDOWN),
1.56      nicm      125:
                    126:        /* Backspace key. */
                    127:        KEYC_BSPACE,
1.41      nicm      128:
                    129:        /* Function keys. */
                    130:        KEYC_F1,
                    131:        KEYC_F2,
                    132:        KEYC_F3,
                    133:        KEYC_F4,
                    134:        KEYC_F5,
                    135:        KEYC_F6,
                    136:        KEYC_F7,
                    137:        KEYC_F8,
                    138:        KEYC_F9,
                    139:        KEYC_F10,
                    140:        KEYC_F11,
                    141:        KEYC_F12,
                    142:        KEYC_IC,
                    143:        KEYC_DC,
                    144:        KEYC_HOME,
                    145:        KEYC_END,
                    146:        KEYC_NPAGE,
                    147:        KEYC_PPAGE,
                    148:        KEYC_BTAB,
                    149:
                    150:        /* Arrow keys. */
                    151:        KEYC_UP,
                    152:        KEYC_DOWN,
                    153:        KEYC_LEFT,
                    154:        KEYC_RIGHT,
                    155:
1.148     nicm      156:        /* Numeric keypad. */
                    157:        KEYC_KP_SLASH,
                    158:        KEYC_KP_STAR,
                    159:        KEYC_KP_MINUS,
                    160:        KEYC_KP_SEVEN,
                    161:        KEYC_KP_EIGHT,
                    162:        KEYC_KP_NINE,
                    163:        KEYC_KP_PLUS,
                    164:        KEYC_KP_FOUR,
                    165:        KEYC_KP_FIVE,
                    166:        KEYC_KP_SIX,
                    167:        KEYC_KP_ONE,
                    168:        KEYC_KP_TWO,
                    169:        KEYC_KP_THREE,
                    170:        KEYC_KP_ENTER,
                    171:        KEYC_KP_ZERO,
                    172:        KEYC_KP_PERIOD,
1.41      nicm      173: };
1.1       nicm      174:
                    175: /* Termcap codes. */
                    176: enum tty_code_code {
                    177:        TTYC_AX = 0,
                    178:        TTYC_ACSC,      /* acs_chars, ac */
1.491     nicm      179:        TTYC_BCE,       /* back_color_erase, ut */
1.1       nicm      180:        TTYC_BEL,       /* bell, bl */
                    181:        TTYC_BLINK,     /* enter_blink_mode, mb */
                    182:        TTYC_BOLD,      /* enter_bold_mode, md */
                    183:        TTYC_CIVIS,     /* cursor_invisible, vi */
                    184:        TTYC_CLEAR,     /* clear_screen, cl */
                    185:        TTYC_CNORM,     /* cursor_normal, ve */
                    186:        TTYC_COLORS,    /* max_colors, Co */
1.287     nicm      187:        TTYC_CR,        /* restore cursor colour, Cr */
1.411     nicm      188:        TTYC_CS,        /* set cursor colour, Cs */
1.1       nicm      189:        TTYC_CSR,       /* change_scroll_region, cs */
1.135     nicm      190:        TTYC_CUB,       /* parm_left_cursor, LE */
                    191:        TTYC_CUB1,      /* cursor_left, le */
1.1       nicm      192:        TTYC_CUD,       /* parm_down_cursor, DO */
                    193:        TTYC_CUD1,      /* cursor_down, do */
1.135     nicm      194:        TTYC_CUF,       /* parm_right_cursor, RI */
                    195:        TTYC_CUF1,      /* cursor_right, nd */
1.1       nicm      196:        TTYC_CUP,       /* cursor_address, cm */
1.135     nicm      197:        TTYC_CUU,       /* parm_up_cursor, UP */
                    198:        TTYC_CUU1,      /* cursor_up, up */
1.485     nicm      199:        TTYC_CVVIS,     /* cursor_visible, vs */
1.1       nicm      200:        TTYC_DCH,       /* parm_dch, DC */
                    201:        TTYC_DCH1,      /* delete_character, dc */
                    202:        TTYC_DIM,       /* enter_dim_mode, mh */
                    203:        TTYC_DL,        /* parm_delete_line, DL */
                    204:        TTYC_DL1,       /* delete_line, dl */
1.297     nicm      205:        TTYC_E3,
1.371     nicm      206:        TTYC_ECH,       /* erase_chars, ec */
1.1       nicm      207:        TTYC_EL,        /* clr_eol, ce */
                    208:        TTYC_EL1,       /* clr_bol, cb */
                    209:        TTYC_ENACS,     /* ena_acs, eA */
1.283     nicm      210:        TTYC_FSL,       /* from_status_line, fsl */
1.135     nicm      211:        TTYC_HOME,      /* cursor_home, ho */
                    212:        TTYC_HPA,       /* column_address, ch */
1.1       nicm      213:        TTYC_ICH,       /* parm_ich, IC */
                    214:        TTYC_ICH1,      /* insert_character, ic */
                    215:        TTYC_IL,        /* parm_insert_line, IL */
                    216:        TTYC_IL1,       /* insert_line, il */
                    217:        TTYC_INVIS,     /* enter_secure_mode, mk */
                    218:        TTYC_IS1,       /* init_1string, i1 */
                    219:        TTYC_IS2,       /* init_2string, i2 */
                    220:        TTYC_IS3,       /* init_3string, i3 */
                    221:        TTYC_KCBT,      /* key_btab, kB */
                    222:        TTYC_KCUB1,     /* key_left, kl */
                    223:        TTYC_KCUD1,     /* key_down, kd */
                    224:        TTYC_KCUF1,     /* key_right, kr */
                    225:        TTYC_KCUU1,     /* key_up, ku */
1.149     nicm      226:        TTYC_KDC2,
                    227:        TTYC_KDC3,
                    228:        TTYC_KDC4,
                    229:        TTYC_KDC5,
                    230:        TTYC_KDC6,
                    231:        TTYC_KDC7,
1.1       nicm      232:        TTYC_KDCH1,     /* key_dc, kD */
1.149     nicm      233:        TTYC_KDN2,
                    234:        TTYC_KDN3,
                    235:        TTYC_KDN4,
                    236:        TTYC_KDN5,
                    237:        TTYC_KDN6,
                    238:        TTYC_KDN7,
1.1       nicm      239:        TTYC_KEND,      /* key_end, ke */
1.149     nicm      240:        TTYC_KEND2,
                    241:        TTYC_KEND3,
                    242:        TTYC_KEND4,
                    243:        TTYC_KEND5,
                    244:        TTYC_KEND6,
                    245:        TTYC_KEND7,
1.466     nicm      246:        TTYC_KF1,
                    247:        TTYC_KF10,
                    248:        TTYC_KF11,
                    249:        TTYC_KF12,
                    250:        TTYC_KF13,
                    251:        TTYC_KF14,
                    252:        TTYC_KF15,
                    253:        TTYC_KF16,
                    254:        TTYC_KF17,
                    255:        TTYC_KF18,
                    256:        TTYC_KF19,
                    257:        TTYC_KF2,
                    258:        TTYC_KF20,
                    259:        TTYC_KF21,
                    260:        TTYC_KF22,
                    261:        TTYC_KF23,
                    262:        TTYC_KF24,
                    263:        TTYC_KF25,
                    264:        TTYC_KF26,
                    265:        TTYC_KF27,
                    266:        TTYC_KF28,
                    267:        TTYC_KF29,
                    268:        TTYC_KF3,
                    269:        TTYC_KF30,
                    270:        TTYC_KF31,
                    271:        TTYC_KF32,
                    272:        TTYC_KF33,
                    273:        TTYC_KF34,
                    274:        TTYC_KF35,
                    275:        TTYC_KF36,
                    276:        TTYC_KF37,
                    277:        TTYC_KF38,
                    278:        TTYC_KF39,
                    279:        TTYC_KF4,
                    280:        TTYC_KF40,
                    281:        TTYC_KF41,
                    282:        TTYC_KF42,
                    283:        TTYC_KF43,
                    284:        TTYC_KF44,
                    285:        TTYC_KF45,
                    286:        TTYC_KF46,
                    287:        TTYC_KF47,
                    288:        TTYC_KF48,
                    289:        TTYC_KF49,
                    290:        TTYC_KF5,
                    291:        TTYC_KF50,
                    292:        TTYC_KF51,
                    293:        TTYC_KF52,
                    294:        TTYC_KF53,
                    295:        TTYC_KF54,
                    296:        TTYC_KF55,
                    297:        TTYC_KF56,
                    298:        TTYC_KF57,
                    299:        TTYC_KF58,
                    300:        TTYC_KF59,
                    301:        TTYC_KF6,
                    302:        TTYC_KF60,
                    303:        TTYC_KF61,
                    304:        TTYC_KF62,
                    305:        TTYC_KF63,
                    306:        TTYC_KF7,
                    307:        TTYC_KF8,
                    308:        TTYC_KF9,
1.149     nicm      309:        TTYC_KHOM2,
                    310:        TTYC_KHOM3,
                    311:        TTYC_KHOM4,
                    312:        TTYC_KHOM5,
                    313:        TTYC_KHOM6,
                    314:        TTYC_KHOM7,
1.1       nicm      315:        TTYC_KHOME,     /* key_home, kh */
1.149     nicm      316:        TTYC_KIC2,
                    317:        TTYC_KIC3,
                    318:        TTYC_KIC4,
                    319:        TTYC_KIC5,
                    320:        TTYC_KIC6,
                    321:        TTYC_KIC7,
1.1       nicm      322:        TTYC_KICH1,     /* key_ic, kI */
1.149     nicm      323:        TTYC_KLFT2,
                    324:        TTYC_KLFT3,
                    325:        TTYC_KLFT4,
                    326:        TTYC_KLFT5,
                    327:        TTYC_KLFT6,
                    328:        TTYC_KLFT7,
1.1       nicm      329:        TTYC_KMOUS,     /* key_mouse, Km */
                    330:        TTYC_KNP,       /* key_npage, kN */
1.149     nicm      331:        TTYC_KNXT2,
                    332:        TTYC_KNXT3,
                    333:        TTYC_KNXT4,
                    334:        TTYC_KNXT5,
                    335:        TTYC_KNXT6,
                    336:        TTYC_KNXT7,
1.1       nicm      337:        TTYC_KPP,       /* key_ppage, kP */
1.149     nicm      338:        TTYC_KPRV2,
                    339:        TTYC_KPRV3,
                    340:        TTYC_KPRV4,
                    341:        TTYC_KPRV5,
                    342:        TTYC_KPRV6,
                    343:        TTYC_KPRV7,
                    344:        TTYC_KRIT2,
                    345:        TTYC_KRIT3,
                    346:        TTYC_KRIT4,
                    347:        TTYC_KRIT5,
                    348:        TTYC_KRIT6,
                    349:        TTYC_KRIT7,
                    350:        TTYC_KUP2,
                    351:        TTYC_KUP3,
                    352:        TTYC_KUP4,
                    353:        TTYC_KUP5,
                    354:        TTYC_KUP6,
                    355:        TTYC_KUP7,
1.286     nicm      356:        TTYC_MS,        /* modify xterm(1) selection */
1.1       nicm      357:        TTYC_OP,        /* orig_pair, op */
                    358:        TTYC_REV,       /* enter_reverse_mode, mr */
                    359:        TTYC_RI,        /* scroll_reverse, sr */
                    360:        TTYC_RMACS,     /* exit_alt_charset_mode */
                    361:        TTYC_RMCUP,     /* exit_ca_mode, te */
                    362:        TTYC_RMKX,      /* keypad_local, ke */
1.411     nicm      363:        TTYC_SE,        /* reset cursor style, Se */
1.1       nicm      364:        TTYC_SETAB,     /* set_a_background, AB */
                    365:        TTYC_SETAF,     /* set_a_foreground, AF */
                    366:        TTYC_SGR0,      /* exit_attribute_mode, me */
1.283     nicm      367:        TTYC_SITM,      /* enter_italics_mode, it */
1.1       nicm      368:        TTYC_SMACS,     /* enter_alt_charset_mode, as */
                    369:        TTYC_SMCUP,     /* enter_ca_mode, ti */
                    370:        TTYC_SMKX,      /* keypad_xmit, ks */
                    371:        TTYC_SMSO,      /* enter_standout_mode, so */
                    372:        TTYC_SMUL,      /* enter_underline_mode, us */
1.411     nicm      373:        TTYC_SS,        /* set cursor style, Ss */
1.283     nicm      374:        TTYC_TSL,       /* to_status_line, tsl */
1.135     nicm      375:        TTYC_VPA,       /* row_address, cv */
1.1       nicm      376:        TTYC_XENL,      /* eat_newline_glitch, xn */
1.283     nicm      377:        TTYC_XT,        /* xterm(1)-compatible title, XT */
1.1       nicm      378: };
1.283     nicm      379: #define NTTYCODE (TTYC_XT + 1)
1.1       nicm      380:
                    381: /* Termcap types. */
                    382: enum tty_code_type {
                    383:        TTYCODE_NONE = 0,
                    384:        TTYCODE_STRING,
                    385:        TTYCODE_NUMBER,
                    386:        TTYCODE_FLAG,
                    387: };
                    388:
                    389: /* Termcap code. */
                    390: struct tty_code {
                    391:        enum tty_code_type      type;
                    392:        union {
1.192     nicm      393:                char           *string;
                    394:                int             number;
                    395:                int             flag;
1.1       nicm      396:        } value;
                    397: };
                    398:
                    399: /* Entry in terminal code table. */
                    400: struct tty_term_code_entry {
                    401:        enum tty_code_code      code;
                    402:        enum tty_code_type      type;
                    403:        const char             *name;
                    404: };
                    405:
                    406: /* Message codes. */
1.64      nicm      407: enum msgtype {
1.423     nicm      408:        MSG_VERSION = 12,
                    409:
                    410:        MSG_IDENTIFY_FLAGS = 100,
                    411:        MSG_IDENTIFY_TERM,
                    412:        MSG_IDENTIFY_TTYNAME,
                    413:        MSG_IDENTIFY_CWD,
                    414:        MSG_IDENTIFY_STDIN,
                    415:        MSG_IDENTIFY_ENVIRON,
                    416:        MSG_IDENTIFY_DONE,
                    417:
                    418:        MSG_COMMAND = 200,
1.1       nicm      419:        MSG_DETACH,
1.423     nicm      420:        MSG_DETACHKILL,
1.1       nicm      421:        MSG_EXIT,
                    422:        MSG_EXITED,
                    423:        MSG_EXITING,
1.423     nicm      424:        MSG_LOCK,
1.1       nicm      425:        MSG_READY,
                    426:        MSG_RESIZE,
1.423     nicm      427:        MSG_SHELL,
1.1       nicm      428:        MSG_SHUTDOWN,
1.423     nicm      429:        MSG_STDERR,
                    430:        MSG_STDIN,
                    431:        MSG_STDOUT,
1.1       nicm      432:        MSG_SUSPEND,
1.423     nicm      433:        MSG_UNLOCK,
1.1       nicm      434:        MSG_WAKEUP,
                    435: };
                    436:
1.55      nicm      437: /*
1.75      nicm      438:  * Message data.
1.55      nicm      439:  *
                    440:  * Don't forget to bump PROTOCOL_VERSION if any of these change!
                    441:  */
1.1       nicm      442: struct msg_command_data {
1.427     nicm      443:        int     argc;
                    444: }; /* followed by packed argv */
1.1       nicm      445:
1.332     nicm      446: struct msg_stdin_data {
                    447:        ssize_t size;
                    448:        char    data[BUFSIZ];
                    449: };
                    450:
                    451: struct msg_stdout_data {
                    452:        ssize_t size;
                    453:        char    data[BUFSIZ];
                    454: };
                    455:
                    456: struct msg_stderr_data {
                    457:        ssize_t size;
                    458:        char    data[BUFSIZ];
                    459: };
                    460:
1.62      nicm      461: /* Mode key commands. */
1.1       nicm      462: enum mode_key_cmd {
1.59      nicm      463:        MODEKEY_NONE,
                    464:        MODEKEY_OTHER,
                    465:
                    466:        /* Editing keys. */
                    467:        MODEKEYEDIT_BACKSPACE,
                    468:        MODEKEYEDIT_CANCEL,
                    469:        MODEKEYEDIT_COMPLETE,
                    470:        MODEKEYEDIT_CURSORLEFT,
                    471:        MODEKEYEDIT_CURSORRIGHT,
                    472:        MODEKEYEDIT_DELETE,
1.84      nicm      473:        MODEKEYEDIT_DELETELINE,
1.59      nicm      474:        MODEKEYEDIT_DELETETOENDOFLINE,
1.299     nicm      475:        MODEKEYEDIT_DELETEWORD,
1.59      nicm      476:        MODEKEYEDIT_ENDOFLINE,
                    477:        MODEKEYEDIT_ENTER,
                    478:        MODEKEYEDIT_HISTORYDOWN,
                    479:        MODEKEYEDIT_HISTORYUP,
1.302     nicm      480:        MODEKEYEDIT_NEXTSPACE,
                    481:        MODEKEYEDIT_NEXTSPACEEND,
1.299     nicm      482:        MODEKEYEDIT_NEXTWORD,
                    483:        MODEKEYEDIT_NEXTWORDEND,
1.59      nicm      484:        MODEKEYEDIT_PASTE,
1.302     nicm      485:        MODEKEYEDIT_PREVIOUSSPACE,
1.299     nicm      486:        MODEKEYEDIT_PREVIOUSWORD,
1.59      nicm      487:        MODEKEYEDIT_STARTOFLINE,
                    488:        MODEKEYEDIT_SWITCHMODE,
                    489:        MODEKEYEDIT_SWITCHMODEAPPEND,
1.318     nicm      490:        MODEKEYEDIT_SWITCHMODEAPPENDLINE,
                    491:        MODEKEYEDIT_SWITCHMODEBEGINLINE,
1.415     nicm      492:        MODEKEYEDIT_SWITCHMODECHANGELINE,
                    493:        MODEKEYEDIT_SWITCHMODESUBSTITUTE,
                    494:        MODEKEYEDIT_SWITCHMODESUBSTITUTELINE,
1.94      nicm      495:        MODEKEYEDIT_TRANSPOSECHARS,
1.192     nicm      496:
1.59      nicm      497:        /* Menu (choice) keys. */
1.350     nicm      498:        MODEKEYCHOICE_BACKSPACE,
1.439     nicm      499:        MODEKEYCHOICE_BOTTOMLINE,
1.59      nicm      500:        MODEKEYCHOICE_CANCEL,
                    501:        MODEKEYCHOICE_CHOOSE,
                    502:        MODEKEYCHOICE_DOWN,
1.439     nicm      503:        MODEKEYCHOICE_ENDOFLIST,
1.59      nicm      504:        MODEKEYCHOICE_PAGEDOWN,
                    505:        MODEKEYCHOICE_PAGEUP,
1.201     nicm      506:        MODEKEYCHOICE_SCROLLDOWN,
                    507:        MODEKEYCHOICE_SCROLLUP,
1.350     nicm      508:        MODEKEYCHOICE_STARTNUMBERPREFIX,
1.439     nicm      509:        MODEKEYCHOICE_STARTOFLIST,
                    510:        MODEKEYCHOICE_TOPLINE,
1.359     nicm      511:        MODEKEYCHOICE_TREE_COLLAPSE,
                    512:        MODEKEYCHOICE_TREE_COLLAPSE_ALL,
                    513:        MODEKEYCHOICE_TREE_EXPAND,
                    514:        MODEKEYCHOICE_TREE_EXPAND_ALL,
                    515:        MODEKEYCHOICE_TREE_TOGGLE,
1.59      nicm      516:        MODEKEYCHOICE_UP,
                    517:
                    518:        /* Copy keys. */
1.441     nicm      519:        MODEKEYCOPY_APPENDSELECTION,
1.82      nicm      520:        MODEKEYCOPY_BACKTOINDENTATION,
1.138     nicm      521:        MODEKEYCOPY_BOTTOMLINE,
1.59      nicm      522:        MODEKEYCOPY_CANCEL,
                    523:        MODEKEYCOPY_CLEARSELECTION,
1.389     nicm      524:        MODEKEYCOPY_COPYPIPE,
1.285     nicm      525:        MODEKEYCOPY_COPYLINE,
                    526:        MODEKEYCOPY_COPYENDOFLINE,
1.59      nicm      527:        MODEKEYCOPY_COPYSELECTION,
                    528:        MODEKEYCOPY_DOWN,
                    529:        MODEKEYCOPY_ENDOFLINE,
1.83      nicm      530:        MODEKEYCOPY_GOTOLINE,
1.82      nicm      531:        MODEKEYCOPY_HALFPAGEDOWN,
                    532:        MODEKEYCOPY_HALFPAGEUP,
1.199     nicm      533:        MODEKEYCOPY_HISTORYBOTTOM,
                    534:        MODEKEYCOPY_HISTORYTOP,
1.212     nicm      535:        MODEKEYCOPY_JUMP,
                    536:        MODEKEYCOPY_JUMPAGAIN,
                    537:        MODEKEYCOPY_JUMPREVERSE,
                    538:        MODEKEYCOPY_JUMPBACK,
1.300     nicm      539:        MODEKEYCOPY_JUMPTO,
                    540:        MODEKEYCOPY_JUMPTOBACK,
1.59      nicm      541:        MODEKEYCOPY_LEFT,
1.138     nicm      542:        MODEKEYCOPY_MIDDLELINE,
1.59      nicm      543:        MODEKEYCOPY_NEXTPAGE,
1.202     nicm      544:        MODEKEYCOPY_NEXTSPACE,
                    545:        MODEKEYCOPY_NEXTSPACEEND,
1.59      nicm      546:        MODEKEYCOPY_NEXTWORD,
1.200     nicm      547:        MODEKEYCOPY_NEXTWORDEND,
1.432     nicm      548:        MODEKEYCOPY_OTHEREND,
1.59      nicm      549:        MODEKEYCOPY_PREVIOUSPAGE,
1.202     nicm      550:        MODEKEYCOPY_PREVIOUSSPACE,
1.59      nicm      551:        MODEKEYCOPY_PREVIOUSWORD,
1.204     nicm      552:        MODEKEYCOPY_RECTANGLETOGGLE,
1.59      nicm      553:        MODEKEYCOPY_RIGHT,
1.120     nicm      554:        MODEKEYCOPY_SCROLLDOWN,
                    555:        MODEKEYCOPY_SCROLLUP,
1.83      nicm      556:        MODEKEYCOPY_SEARCHAGAIN,
                    557:        MODEKEYCOPY_SEARCHDOWN,
1.207     nicm      558:        MODEKEYCOPY_SEARCHREVERSE,
1.83      nicm      559:        MODEKEYCOPY_SEARCHUP,
1.285     nicm      560:        MODEKEYCOPY_SELECTLINE,
1.462     nicm      561:        MODEKEYCOPY_STARTNAMEDBUFFER,
1.209     nicm      562:        MODEKEYCOPY_STARTNUMBERPREFIX,
1.59      nicm      563:        MODEKEYCOPY_STARTOFLINE,
                    564:        MODEKEYCOPY_STARTSELECTION,
1.138     nicm      565:        MODEKEYCOPY_TOPLINE,
1.59      nicm      566:        MODEKEYCOPY_UP,
1.1       nicm      567: };
                    568:
1.62      nicm      569: /* Entry in the default mode key tables. */
1.59      nicm      570: struct mode_key_entry {
                    571:        int                     key;
                    572:
                    573:        /*
                    574:         * Editing mode for vi: 0 is edit mode, keys not in the table are
                    575:         * returned as MODEKEY_OTHER; 1 is command mode, keys not in the table
                    576:         * are returned as MODEKEY_NONE. This is also matched on, allowing some
                    577:         * keys to be bound in edit mode.
                    578:         */
                    579:        int                     mode;
                    580:        enum mode_key_cmd       cmd;
                    581: };
1.62      nicm      582:
                    583: /* Data required while mode keys are in use. */
1.1       nicm      584: struct mode_key_data {
1.62      nicm      585:        struct mode_key_tree   *tree;
                    586:        int                     mode;
1.1       nicm      587: };
                    588: #define MODEKEY_EMACS 0
                    589: #define MODEKEY_VI 1
                    590:
1.62      nicm      591: /* Binding between a key and a command. */
                    592: struct mode_key_binding {
1.389     nicm      593:        int                              key;
1.62      nicm      594:
1.389     nicm      595:        int                              mode;
                    596:        enum mode_key_cmd                cmd;
                    597:        const char                      *arg;
1.62      nicm      598:
1.389     nicm      599:        RB_ENTRY(mode_key_binding)       entry;
1.62      nicm      600: };
1.306     nicm      601: RB_HEAD(mode_key_tree, mode_key_binding);
1.62      nicm      602:
                    603: /* Command to string mapping. */
                    604: struct mode_key_cmdstr {
1.192     nicm      605:        enum mode_key_cmd        cmd;
1.62      nicm      606:        const char              *name;
                    607: };
                    608:
                    609: /* Named mode key table description. */
                    610: struct mode_key_table {
1.261     nicm      611:        const char                      *name;
                    612:        const struct mode_key_cmdstr    *cmdstr;
                    613:        struct mode_key_tree            *tree;
                    614:        const struct mode_key_entry     *table; /* default entries */
1.62      nicm      615: };
                    616:
1.1       nicm      617: /* Modes. */
                    618: #define MODE_CURSOR 0x1
                    619: #define MODE_INSERT 0x2
                    620: #define MODE_KCURSOR 0x4
1.185     nicm      621: #define MODE_KKEYPAD 0x8       /* set = application, clear = number */
1.255     nicm      622: #define MODE_WRAP 0x10         /* whether lines wrap */
                    623: #define MODE_MOUSE_STANDARD 0x20
1.266     nicm      624: #define MODE_MOUSE_BUTTON 0x40
1.485     nicm      625: #define MODE_BLINKING 0x80
1.266     nicm      626: #define MODE_MOUSE_UTF8 0x100
1.384     nicm      627: #define MODE_MOUSE_SGR 0x200
                    628: #define MODE_BRACKETPASTE 0x400
1.393     nicm      629: #define MODE_FOCUSON 0x800
1.255     nicm      630:
1.467     nicm      631: #define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON)
1.1       nicm      632:
1.373     nicm      633: /* A single UTF-8 character. */
1.143     nicm      634: struct utf8_data {
                    635:        u_char  data[UTF8_SIZE];
                    636:
                    637:        size_t  have;
                    638:        size_t  size;
                    639:
                    640:        u_int   width;
                    641: };
1.1       nicm      642:
                    643: /* Grid attributes. */
                    644: #define GRID_ATTR_BRIGHT 0x1
                    645: #define GRID_ATTR_DIM 0x2
                    646: #define GRID_ATTR_UNDERSCORE 0x4
                    647: #define GRID_ATTR_BLINK 0x8
                    648: #define GRID_ATTR_REVERSE 0x10
                    649: #define GRID_ATTR_HIDDEN 0x20
                    650: #define GRID_ATTR_ITALICS 0x40
                    651: #define GRID_ATTR_CHARSET 0x80 /* alternative character set */
                    652:
                    653: /* Grid flags. */
                    654: #define GRID_FLAG_FG256 0x1
                    655: #define GRID_FLAG_BG256 0x2
                    656: #define GRID_FLAG_PADDING 0x4
                    657:
1.72      nicm      658: /* Grid line flags. */
                    659: #define GRID_LINE_WRAPPED 0x1
                    660:
1.1       nicm      661: /* Grid cell data. */
                    662: struct grid_cell {
                    663:        u_char  attr;
                    664:        u_char  flags;
                    665:        u_char  fg;
                    666:        u_char  bg;
                    667:
1.373     nicm      668:        u_char  xstate; /* top 4 bits width, bottom 4 bits size */
                    669:        u_char  xdata[UTF8_SIZE];
1.1       nicm      670: } __packed;
                    671:
1.71      nicm      672: /* Grid line. */
                    673: struct grid_line {
                    674:        u_int   cellsize;
                    675:        struct grid_cell *celldata;
                    676:
1.72      nicm      677:        int     flags;
1.71      nicm      678: } __packed;
                    679:
1.1       nicm      680: /* Entire grid of cells. */
                    681: struct grid {
1.25      nicm      682:        int     flags;
                    683: #define GRID_HISTORY 0x1       /* scroll lines into history */
                    684:
1.1       nicm      685:        u_int   sx;
                    686:        u_int   sy;
                    687:
                    688:        u_int   hsize;
                    689:        u_int   hlimit;
                    690:
1.71      nicm      691:        struct grid_line *linedata;
1.1       nicm      692: };
                    693:
                    694: /* Option data structures. */
                    695: struct options_entry {
                    696:        char            *name;
                    697:
                    698:        enum {
                    699:                OPTIONS_STRING,
                    700:                OPTIONS_NUMBER,
1.435     nicm      701:                OPTIONS_STYLE
1.1       nicm      702:        } type;
1.109     nicm      703:
1.435     nicm      704:        char                    *str;
                    705:        long long                num;
                    706:        struct grid_cell         style;
1.1       nicm      707:
1.306     nicm      708:        RB_ENTRY(options_entry) entry;
1.1       nicm      709: };
                    710:
                    711: struct options {
1.306     nicm      712:        RB_HEAD(options_tree, options_entry) tree;
1.1       nicm      713:        struct options  *parent;
                    714: };
                    715:
1.126     nicm      716: /* Scheduled job. */
                    717: struct job {
                    718:        char            *cmd;
                    719:        pid_t            pid;
1.130     nicm      720:        int              status;
1.126     nicm      721:
                    722:        int              fd;
1.160     nicm      723:        struct bufferevent *event;
1.126     nicm      724:
                    725:        void            (*callbackfn)(struct job *);
                    726:        void            (*freefn)(void *);
                    727:        void            *data;
1.130     nicm      728:
1.270     nicm      729:        LIST_ENTRY(job)  lentry;
1.126     nicm      730: };
1.270     nicm      731: LIST_HEAD(joblist, job);
1.126     nicm      732:
1.1       nicm      733: /* Screen selection. */
                    734: struct screen_sel {
                    735:        int              flag;
1.204     nicm      736:        int              rectflag;
1.480     nicm      737:        enum {
                    738:                LINE_SEL_NONE,
                    739:                LINE_SEL_LEFT_RIGHT,
                    740:                LINE_SEL_RIGHT_LEFT,
                    741:        } lineflag;
                    742:
1.469     nicm      743:        int              modekeys;
1.1       nicm      744:
                    745:        u_int            sx;
                    746:        u_int            sy;
                    747:
                    748:        u_int            ex;
                    749:        u_int            ey;
                    750:
                    751:        struct grid_cell cell;
                    752: };
                    753:
                    754: /* Virtual screen. */
                    755: struct screen {
                    756:        char            *title;
                    757:
1.192     nicm      758:        struct grid     *grid;          /* grid data */
1.1       nicm      759:
                    760:        u_int            cx;            /* cursor x */
                    761:        u_int            cy;            /* cursor y */
                    762:
1.288     nicm      763:        u_int            cstyle;        /* cursor style */
1.287     nicm      764:        char            *ccolour;       /* cursor colour string */
                    765:
1.1       nicm      766:        u_int            rupper;        /* scroll region top */
                    767:        u_int            rlower;        /* scroll region bottom */
                    768:
                    769:        int              mode;
                    770:
1.192     nicm      771:        bitstr_t        *tabs;
1.6       nicm      772:
1.1       nicm      773:        struct screen_sel sel;
                    774: };
                    775:
                    776: /* Screen write context. */
                    777: struct screen_write_ctx {
                    778:        struct window_pane *wp;
                    779:        struct screen   *s;
                    780: };
                    781:
                    782: /* Screen size. */
                    783: #define screen_size_x(s) ((s)->grid->sx)
                    784: #define screen_size_y(s) ((s)->grid->sy)
                    785: #define screen_hsize(s) ((s)->grid->hsize)
                    786: #define screen_hlimit(s) ((s)->grid->hlimit)
                    787:
                    788: /*
                    789:  * Window mode. Windows can be in several modes and this is used to call the
                    790:  * right function to handle input and output.
                    791:  */
1.492     nicm      792: struct client;
1.221     nicm      793: struct session;
1.129     nicm      794: struct mouse_event;
1.1       nicm      795: struct window_mode {
                    796:        struct screen *(*init)(struct window_pane *);
                    797:        void    (*free)(struct window_pane *);
                    798:        void    (*resize)(struct window_pane *, u_int, u_int);
1.492     nicm      799:        void    (*key)(struct window_pane *, struct client *, struct session *,
                    800:                    int, struct mouse_event *);
1.1       nicm      801:        void    (*timer)(struct window_pane *);
                    802: };
                    803:
1.343     nicm      804: /* Structures for choose mode. */
                    805: struct window_choose_data {
1.375     nicm      806:        struct client           *start_client;
                    807:        struct session          *start_session;
                    808:
1.343     nicm      809:        u_int                    idx;
1.359     nicm      810:        int                      type;
1.375     nicm      811: #define TREE_OTHER 0x0
1.359     nicm      812: #define TREE_WINDOW 0x1
                    813: #define TREE_SESSION 0x2
1.375     nicm      814:
                    815:        struct session          *tree_session; /* session of items in tree */
                    816:
                    817:        struct winlink          *wl;
1.355     nicm      818:        int                      pane_id;
1.375     nicm      819:
                    820:        char                    *ft_template;
                    821:        struct format_tree      *ft;
                    822:
                    823:        char                    *command;
1.343     nicm      824: };
                    825:
                    826: struct window_choose_mode_item {
1.350     nicm      827:        struct window_choose_data       *wcd;
                    828:        char                            *name;
                    829:        int                              pos;
1.359     nicm      830:        int                              state;
                    831: #define TREE_EXPANDED 0x1
1.343     nicm      832: };
                    833:
1.1       nicm      834: /* Child window structure. */
1.507   ! nicm      835: struct input_ctx;
1.1       nicm      836: struct window_pane {
1.274     nicm      837:        u_int            id;
1.458     nicm      838:        u_int            active_point;
1.274     nicm      839:
1.1       nicm      840:        struct window   *window;
1.398     nicm      841:
1.39      nicm      842:        struct layout_cell *layout_cell;
1.398     nicm      843:        struct layout_cell *saved_layout_cell;
1.1       nicm      844:
                    845:        u_int            sx;
                    846:        u_int            sy;
                    847:
                    848:        u_int            xoff;
                    849:        u_int            yoff;
                    850:
                    851:        int              flags;
1.28      nicm      852: #define PANE_REDRAW 0x1
1.325     nicm      853: #define PANE_DROP 0x2
1.393     nicm      854: #define PANE_FOCUSED 0x4
1.394     nicm      855: #define PANE_RESIZE 0x8
1.413     nicm      856: #define PANE_FOCUSPUSH 0x10
1.468     nicm      857: #define PANE_INPUTOFF 0x20
1.1       nicm      858:
1.463     nicm      859:        int              argc;
                    860:        char           **argv;
1.93      nicm      861:        char            *shell;
1.428     nicm      862:        int              cwd;
1.1       nicm      863:
                    864:        pid_t            pid;
1.159     nicm      865:        char             tty[TTY_NAME_MAX];
1.484     nicm      866:        int              status;
1.159     nicm      867:
1.325     nicm      868:        u_int            changes;
                    869:        struct event     changes_timer;
                    870:        u_int            changes_redraw;
                    871:
1.1       nicm      872:        int              fd;
1.163     nicm      873:        struct bufferevent *event;
1.1       nicm      874:
1.507   ! nicm      875:        struct input_ctx *ictx;
1.1       nicm      876:
1.491     nicm      877:        struct grid_cell colgc;
                    878:
1.131     nicm      879:        int              pipe_fd;
1.162     nicm      880:        struct bufferevent *pipe_event;
1.131     nicm      881:        size_t           pipe_off;
                    882:
1.1       nicm      883:        struct screen   *screen;
                    884:        struct screen    base;
                    885:
1.25      nicm      886:        /* Saved in alternative screen mode. */
1.192     nicm      887:        u_int            saved_cx;
                    888:        u_int            saved_cy;
1.25      nicm      889:        struct grid     *saved_grid;
1.69      nicm      890:        struct grid_cell saved_cell;
1.25      nicm      891:
1.1       nicm      892:        const struct window_mode *mode;
                    893:        void            *modedata;
                    894:
                    895:        TAILQ_ENTRY(window_pane) entry;
1.274     nicm      896:        RB_ENTRY(window_pane) tree_entry;
1.1       nicm      897: };
                    898: TAILQ_HEAD(window_panes, window_pane);
1.274     nicm      899: RB_HEAD(window_pane_tree, window_pane);
1.1       nicm      900:
                    901: /* Window structure. */
                    902: struct window {
1.309     nicm      903:        u_int            id;
1.1       nicm      904:        char            *name;
1.168     nicm      905:        struct event     name_timer;
1.248     nicm      906:        struct timeval   silence_timer;
1.1       nicm      907:
                    908:        struct window_pane *active;
1.244     nicm      909:        struct window_pane *last;
1.1       nicm      910:        struct window_panes panes;
1.39      nicm      911:
1.61      nicm      912:        int              lastlayout;
1.39      nicm      913:        struct layout_cell *layout_root;
1.398     nicm      914:        struct layout_cell *saved_layout_root;
1.503     nicm      915:        char            *old_layout;
1.1       nicm      916:
                    917:        u_int            sx;
                    918:        u_int            sy;
                    919:
                    920:        int              flags;
                    921: #define WINDOW_BELL 0x1
1.247     nicm      922: #define WINDOW_ACTIVITY 0x2
                    923: #define WINDOW_REDRAW 0x4
1.248     nicm      924: #define WINDOW_SILENCE 0x8
1.481     nicm      925: #define WINDOW_ZOOMED 0x1000
                    926: #define WINDOW_FORCEWIDTH 0x2000
                    927: #define WINDOW_FORCEHEIGHT 0x4000
1.418     nicm      928: #define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE)
1.1       nicm      929:
                    930:        struct options   options;
                    931:
                    932:        u_int            references;
1.496     nicm      933:
                    934:        RB_ENTRY(window) entry;
1.1       nicm      935: };
1.496     nicm      936: RB_HEAD(windows, window);
1.1       nicm      937:
                    938: /* Entry on local window list. */
                    939: struct winlink {
                    940:        int              idx;
                    941:        struct window   *window;
1.184     nicm      942:
                    943:        size_t           status_width;
                    944:        struct grid_cell status_cell;
                    945:        char            *status_text;
1.1       nicm      946:
1.226     nicm      947:        int              flags;
                    948: #define WINLINK_BELL 0x1
                    949: #define WINLINK_ACTIVITY 0x2
1.451     nicm      950: #define WINLINK_SILENCE 0x4
                    951: #define WINLINK_ALERTFLAGS (WINLINK_BELL|WINLINK_ACTIVITY|WINLINK_SILENCE)
1.226     nicm      952:
1.1       nicm      953:        RB_ENTRY(winlink) entry;
1.124     nicm      954:        TAILQ_ENTRY(winlink) sentry;
1.1       nicm      955: };
                    956: RB_HEAD(winlinks, winlink);
1.124     nicm      957: TAILQ_HEAD(winlink_stack, winlink);
1.1       nicm      958:
1.39      nicm      959: /* Layout direction. */
                    960: enum layout_type {
                    961:        LAYOUT_LEFTRIGHT,
                    962:        LAYOUT_TOPBOTTOM,
                    963:        LAYOUT_WINDOWPANE
                    964: };
                    965:
                    966: /* Layout cells queue. */
                    967: TAILQ_HEAD(layout_cells, layout_cell);
                    968:
                    969: /* Layout cell. */
                    970: struct layout_cell {
                    971:        enum layout_type type;
                    972:
                    973:        struct layout_cell *parent;
                    974:
                    975:        u_int            sx;
                    976:        u_int            sy;
                    977:
                    978:        u_int            xoff;
                    979:        u_int            yoff;
                    980:
                    981:        struct window_pane *wp;
                    982:        struct layout_cells cells;
                    983:
                    984:        TAILQ_ENTRY(layout_cell) entry;
                    985: };
                    986:
1.1       nicm      987: /* Paste buffer. */
                    988: struct paste_buffer {
1.187     nicm      989:        char            *data;
1.100     nicm      990:        size_t           size;
1.461     nicm      991:
                    992:        char            *name;
                    993:        int              automatic;
                    994:        u_int            order;
                    995:
                    996:        RB_ENTRY(paste_buffer) name_entry;
                    997:        RB_ENTRY(paste_buffer) time_entry;
1.1       nicm      998: };
                    999:
1.73      nicm     1000: /* Environment variable. */
                   1001: struct environ_entry {
                   1002:        char            *name;
                   1003:        char            *value;
                   1004:
                   1005:        RB_ENTRY(environ_entry) entry;
                   1006: };
                   1007: RB_HEAD(environ, environ_entry);
                   1008:
1.1       nicm     1009: /* Client session. */
1.124     nicm     1010: struct session_group {
                   1011:        TAILQ_HEAD(, session) sessions;
                   1012:
                   1013:        TAILQ_ENTRY(session_group) entry;
                   1014: };
                   1015: TAILQ_HEAD(session_groups, session_group);
                   1016:
1.1       nicm     1017: struct session {
1.402     nicm     1018:        u_int            id;
1.254     nicm     1019:
1.1       nicm     1020:        char            *name;
1.428     nicm     1021:        int              cwd;
1.156     nicm     1022:
                   1023:        struct timeval   creation_time;
                   1024:        struct timeval   activity_time;
1.370     nicm     1025:        struct timeval   last_activity_time;
1.1       nicm     1026:
                   1027:        u_int            sx;
                   1028:        u_int            sy;
                   1029:
                   1030:        struct winlink  *curw;
                   1031:        struct winlink_stack lastw;
                   1032:        struct winlinks  windows;
                   1033:
                   1034:        struct options   options;
                   1035:
                   1036: #define SESSION_UNATTACHED 0x1 /* not attached to any clients */
                   1037:        int              flags;
1.440     nicm     1038:
                   1039:        u_int            attached;
1.73      nicm     1040:
1.105     nicm     1041:        struct termios  *tio;
1.80      nicm     1042:
1.73      nicm     1043:        struct environ   environ;
1.101     nicm     1044:
                   1045:        int              references;
1.124     nicm     1046:
                   1047:        TAILQ_ENTRY(session) gentry;
1.254     nicm     1048:        RB_ENTRY(session)    entry;
1.1       nicm     1049: };
1.254     nicm     1050: RB_HEAD(sessions, session);
1.1       nicm     1051:
                   1052: /* TTY information. */
                   1053: struct tty_key {
1.173     nicm     1054:        char             ch;
1.192     nicm     1055:        int              key;
1.1       nicm     1056:
1.173     nicm     1057:        struct tty_key  *left;
                   1058:        struct tty_key  *right;
                   1059:
                   1060:        struct tty_key  *next;
1.1       nicm     1061: };
                   1062:
                   1063: struct tty_term {
                   1064:        char            *name;
                   1065:        u_int            references;
                   1066:
1.240     nicm     1067:        char             acs[UCHAR_MAX + 1][2];
                   1068:
1.1       nicm     1069:        struct tty_code  codes[NTTYCODE];
                   1070:
1.147     nicm     1071: #define TERM_256COLOURS 0x1
1.407     nicm     1072: #define TERM_EARLYWRAP 0x2
1.1       nicm     1073:        int              flags;
                   1074:
1.270     nicm     1075:        LIST_ENTRY(tty_term) entry;
1.1       nicm     1076: };
1.270     nicm     1077: LIST_HEAD(tty_terms, tty_term);
1.1       nicm     1078:
1.443     nicm     1079: /* Mouse button masks. */
                   1080: #define MOUSE_MASK_BUTTONS 3
                   1081: #define MOUSE_MASK_SHIFT 4
                   1082: #define MOUSE_MASK_META 8
                   1083: #define MOUSE_MASK_CTRL 16
                   1084: #define MOUSE_MASK_DRAG 32
                   1085: #define MOUSE_MASK_WHEEL 64
                   1086:
1.360     nicm     1087: /* Mouse wheel states. */
                   1088: #define MOUSE_WHEEL_UP 0
1.492     nicm     1089: #define MOUSE_WHEEL_DOWN 64
1.459     nicm     1090:
1.492     nicm     1091: /* Mouse helpers. */
                   1092: #define MOUSE_BUTTONS(b) ((b) & MOUSE_MASK_BUTTONS)
                   1093: #define MOUSE_WHEEL(b) ((b) & MOUSE_MASK_WHEEL)
                   1094: #define MOUSE_DRAG(b) ((b) & MOUSE_MASK_DRAG)
                   1095: #define MOUSE_RELEASE(b) (((b) & MOUSE_MASK_BUTTONS) == 3)
1.360     nicm     1096:
1.492     nicm     1097: /* Mouse input. */
                   1098: struct mouse_event {
                   1099:        int     valid;
1.360     nicm     1100:
1.492     nicm     1101:        int     key;
                   1102:        int     statusat;
1.360     nicm     1103:
1.492     nicm     1104:        u_int   x;
                   1105:        u_int   y;
                   1106:        u_int   b;
1.360     nicm     1107:
                   1108:        u_int   lx;
1.492     nicm     1109:        u_int   ly;
                   1110:        u_int   lb;
1.360     nicm     1111:
1.492     nicm     1112:        int     s;
                   1113:        int     w;
                   1114:        int     wp;
1.384     nicm     1115:
1.492     nicm     1116:        u_int   sgr_type;
                   1117:        u_int   sgr_b;
1.360     nicm     1118: };
                   1119:
1.1       nicm     1120: struct tty {
1.337     nicm     1121:        struct client   *client;
                   1122:
1.1       nicm     1123:        char            *path;
1.364     nicm     1124:        u_int            class;
1.1       nicm     1125:
1.192     nicm     1126:        u_int            sx;
                   1127:        u_int            sy;
1.1       nicm     1128:
                   1129:        u_int            cx;
                   1130:        u_int            cy;
1.288     nicm     1131:        u_int            cstyle;
1.287     nicm     1132:        char            *ccolour;
1.1       nicm     1133:
                   1134:        int              mode;
                   1135:
                   1136:        u_int            rlower;
                   1137:        u_int            rupper;
                   1138:
                   1139:        char            *termname;
                   1140:        struct tty_term *term;
                   1141:
                   1142:        int              fd;
1.161     nicm     1143:        struct bufferevent *event;
1.1       nicm     1144:
                   1145:        int              log_fd;
                   1146:
1.192     nicm     1147:        struct termios   tio;
1.1       nicm     1148:
                   1149:        struct grid_cell cell;
                   1150:
                   1151: #define TTY_NOCURSOR 0x1
                   1152: #define TTY_FREEZE 0x2
1.382     nicm     1153: #define TTY_TIMER 0x4
1.1       nicm     1154: #define TTY_UTF8 0x8
1.76      nicm     1155: #define TTY_STARTED 0x10
1.77      nicm     1156: #define TTY_OPENED 0x20
1.414     nicm     1157: #define TTY_FOCUS 0x40
1.192     nicm     1158:        int              flags;
1.1       nicm     1159:
                   1160:        int              term_flags;
                   1161:
1.337     nicm     1162:        struct mouse_event mouse;
1.492     nicm     1163:        int              mouse_drag_flag;
                   1164:        void            (*mouse_drag_update)(struct client *,
                   1165:                            struct mouse_event *);
                   1166:        void            (*mouse_drag_release)(struct client *,
                   1167:                            struct mouse_event *);
1.337     nicm     1168:
1.170     nicm     1169:        struct event     key_timer;
1.173     nicm     1170:        struct tty_key  *key_tree;
1.1       nicm     1171: };
                   1172:
1.47      nicm     1173: /* TTY command context and function pointer. */
                   1174: struct tty_ctx {
                   1175:        struct window_pane *wp;
                   1176:
                   1177:        const struct grid_cell *cell;
                   1178:
1.49      nicm     1179:        u_int            num;
1.196     nicm     1180:        void            *ptr;
1.49      nicm     1181:
1.196     nicm     1182:        /*
1.49      nicm     1183:         * Cursor and region position before the screen was updated - this is
                   1184:         * where the command should be applied; the values in the screen have
                   1185:         * already been updated.
                   1186:         */
                   1187:        u_int            ocx;
                   1188:        u_int            ocy;
                   1189:
                   1190:        u_int            orupper;
                   1191:        u_int            orlower;
1.140     nicm     1192:
1.308     nicm     1193:        u_int            xoff;
                   1194:        u_int            yoff;
                   1195:
1.140     nicm     1196:        /* Saved last cell on line. */
                   1197:        struct grid_cell last_cell;
                   1198:        u_int            last_width;
1.47      nicm     1199: };
                   1200:
1.180     nicm     1201: /* Saved message entry. */
                   1202: struct message_entry {
                   1203:        char   *msg;
1.501     nicm     1204:        u_int   msg_num;
1.180     nicm     1205:        time_t  msg_time;
1.501     nicm     1206:        TAILQ_ENTRY(message_entry) entry;
1.180     nicm     1207: };
                   1208:
1.271     nicm     1209: /* Status output data from a job. */
                   1210: struct status_out {
                   1211:        char   *cmd;
                   1212:        char   *out;
                   1213:
                   1214:        RB_ENTRY(status_out) entry;
                   1215: };
                   1216: RB_HEAD(status_out_tree, status_out);
                   1217:
1.1       nicm     1218: /* Client connection. */
                   1219: struct client {
1.75      nicm     1220:        struct imsgbuf   ibuf;
1.425     nicm     1221:
1.428     nicm     1222:        int              fd;
1.159     nicm     1223:        struct event     event;
1.425     nicm     1224:        int              retval;
1.156     nicm     1225:
                   1226:        struct timeval   creation_time;
1.158     nicm     1227:        struct timeval   activity_time;
1.1       nicm     1228:
1.73      nicm     1229:        struct environ   environ;
                   1230:
1.1       nicm     1231:        char            *title;
1.428     nicm     1232:        int              cwd;
1.1       nicm     1233:
1.428     nicm     1234:        char            *term;
                   1235:        char            *ttyname;
1.192     nicm     1236:        struct tty       tty;
1.236     nicm     1237:
1.332     nicm     1238:        void            (*stdin_callback)(struct client *, int, void *);
                   1239:        void            *stdin_callback_data;
                   1240:        struct evbuffer *stdin_data;
                   1241:        int              stdin_closed;
                   1242:        struct evbuffer *stdout_data;
                   1243:        struct evbuffer *stderr_data;
1.231     nicm     1244:
1.169     nicm     1245:        struct event     repeat_timer;
1.1       nicm     1246:
1.271     nicm     1247:        struct status_out_tree status_old;
                   1248:        struct status_out_tree status_new;
1.126     nicm     1249:        struct timeval   status_timer;
1.1       nicm     1250:        struct screen    status;
                   1251:
                   1252: #define CLIENT_TERMINAL 0x1
1.493     nicm     1253: /* 0x2 unused */
1.236     nicm     1254: #define CLIENT_EXIT 0x4
1.1       nicm     1255: #define CLIENT_REDRAW 0x8
                   1256: #define CLIENT_STATUS 0x10
1.427     nicm     1257: #define CLIENT_REPEAT 0x20
1.1       nicm     1258: #define CLIENT_SUSPENDED 0x40
1.70      nicm     1259: #define CLIENT_BAD 0x80
1.92      nicm     1260: #define CLIENT_IDENTIFY 0x100
1.101     nicm     1261: #define CLIENT_DEAD 0x200
1.197     nicm     1262: #define CLIENT_BORDERS 0x400
1.205     nicm     1263: #define CLIENT_READONLY 0x800
1.307     nicm     1264: #define CLIENT_REDRAWWINDOW 0x1000
1.342     nicm     1265: #define CLIENT_CONTROL 0x2000
1.424     nicm     1266: #define CLIENT_CONTROLCONTROL 0x4000
                   1267: #define CLIENT_FOCUSED 0x8000
                   1268: #define CLIENT_UTF8 0x10000
                   1269: #define CLIENT_256COLOURS 0x20000
                   1270: #define CLIENT_IDENTIFIED 0x40000
1.1       nicm     1271:        int              flags;
1.493     nicm     1272:        struct key_table *keytable;
1.1       nicm     1273:
1.166     nicm     1274:        struct event     identify_timer;
1.92      nicm     1275:
1.1       nicm     1276:        char            *message_string;
1.166     nicm     1277:        struct event     message_timer;
1.501     nicm     1278:        u_int            message_next;
                   1279:        TAILQ_HEAD(, message_entry) message_log;
1.1       nicm     1280:
                   1281:        char            *prompt_string;
                   1282:        char            *prompt_buffer;
                   1283:        size_t           prompt_index;
1.33      nicm     1284:        int              (*prompt_callbackfn)(void *, const char *);
                   1285:        void             (*prompt_freefn)(void *);
1.1       nicm     1286:        void            *prompt_data;
1.249     nicm     1287:        u_int            prompt_hindex;
1.1       nicm     1288:
1.117     nicm     1289: #define PROMPT_SINGLE 0x1
1.1       nicm     1290:        int              prompt_flags;
                   1291:
                   1292:        struct mode_key_data prompt_mdata;
                   1293:
                   1294:        struct session  *session;
1.252     nicm     1295:        struct session  *last_session;
1.101     nicm     1296:
1.316     nicm     1297:        int              wlmouse;
1.284     nicm     1298:
1.397     nicm     1299:        struct cmd_q    *cmdq;
1.101     nicm     1300:        int              references;
1.499     nicm     1301:
                   1302:        TAILQ_ENTRY(client) entry;
1.1       nicm     1303: };
1.499     nicm     1304: TAILQ_HEAD(clients, client);
1.1       nicm     1305:
1.410     nicm     1306: /* Parsed arguments structures. */
                   1307: struct args_entry {
                   1308:        u_char                   flag;
                   1309:        char                    *value;
                   1310:        RB_ENTRY(args_entry)     entry;
                   1311: };
                   1312: RB_HEAD(args_tree, args_entry);
                   1313:
1.264     nicm     1314: struct args {
1.410     nicm     1315:        struct args_tree          tree;
                   1316:        int                       argc;
                   1317:        char                    **argv;
1.264     nicm     1318: };
                   1319:
1.397     nicm     1320: /* Command and list of commands. */
1.1       nicm     1321: struct cmd {
1.264     nicm     1322:        const struct cmd_entry  *entry;
                   1323:        struct args             *args;
1.1       nicm     1324:
1.397     nicm     1325:        char                    *file;
                   1326:        u_int                    line;
1.412     nicm     1327:
                   1328: #define CMD_CONTROL 0x1
                   1329:        int                      flags;
1.397     nicm     1330:
1.264     nicm     1331:        TAILQ_ENTRY(cmd)         qentry;
1.1       nicm     1332: };
1.229     nicm     1333: struct cmd_list {
1.264     nicm     1334:        int                      references;
                   1335:        TAILQ_HEAD(, cmd)        list;
1.229     nicm     1336: };
1.1       nicm     1337:
1.397     nicm     1338: /* Command return values. */
1.348     nicm     1339: enum cmd_retval {
                   1340:        CMD_RETURN_ERROR = -1,
                   1341:        CMD_RETURN_NORMAL = 0,
1.397     nicm     1342:        CMD_RETURN_WAIT,
                   1343:        CMD_RETURN_STOP
                   1344: };
                   1345:
                   1346: /* Command queue entry. */
                   1347: struct cmd_q_item {
                   1348:        struct cmd_list         *cmdlist;
1.492     nicm     1349:
                   1350:        struct mouse_event       mouse;
                   1351:
1.397     nicm     1352:        TAILQ_ENTRY(cmd_q_item)  qentry;
                   1353: };
                   1354: TAILQ_HEAD(cmd_q_items, cmd_q_item);
                   1355:
                   1356: /* Command queue. */
                   1357: struct cmd_q {
                   1358:        int                      references;
                   1359:        int                      dead;
                   1360:
                   1361:        struct client           *client;
                   1362:        int                      client_exit;
                   1363:
                   1364:        struct cmd_q_items       queue;
                   1365:        struct cmd_q_item       *item;
                   1366:        struct cmd              *cmd;
                   1367:
1.403     nicm     1368:        time_t                   time;
                   1369:        u_int                    number;
                   1370:
1.397     nicm     1371:        void                     (*emptyfn)(struct cmd_q *);
                   1372:        void                    *data;
                   1373:
1.401     nicm     1374:        TAILQ_ENTRY(cmd_q)       waitentry;
1.348     nicm     1375: };
                   1376:
1.397     nicm     1377: /* Command definition. */
1.1       nicm     1378: struct cmd_entry {
                   1379:        const char      *name;
                   1380:        const char      *alias;
1.264     nicm     1381:
                   1382:        const char      *args_template;
                   1383:        int              args_lower;
                   1384:        int              args_upper;
                   1385:
1.1       nicm     1386:        const char      *usage;
                   1387:
                   1388: #define CMD_STARTSERVER 0x1
                   1389: #define CMD_CANTNEST 0x2
1.422     nicm     1390: #define CMD_READONLY 0x4
1.27      nicm     1391:        int              flags;
1.1       nicm     1392:
1.397     nicm     1393:        enum cmd_retval  (*exec)(struct cmd *, struct cmd_q *);
1.1       nicm     1394: };
                   1395:
1.493     nicm     1396: /* Key binding and key table. */
1.1       nicm     1397: struct key_binding {
1.493     nicm     1398:        int                      key;
                   1399:        struct cmd_list         *cmdlist;
                   1400:        int                      can_repeat;
1.1       nicm     1401:
1.493     nicm     1402:        RB_ENTRY(key_binding)    entry;
1.1       nicm     1403: };
1.306     nicm     1404: RB_HEAD(key_bindings, key_binding);
1.493     nicm     1405: struct key_table {
                   1406:        const char               *name;
                   1407:        struct key_bindings      key_bindings;
                   1408:
                   1409:        u_int                    references;
                   1410:
                   1411:        RB_ENTRY(key_table)      entry;
                   1412: };
                   1413: RB_HEAD(key_tables, key_table);
1.1       nicm     1414:
1.262     nicm     1415: /*
                   1416:  * Option table entries. The option table is the user-visible part of the
                   1417:  * option, as opposed to the internal options (struct option) which are just
                   1418:  * number or string.
                   1419:  */
                   1420: enum options_table_type {
                   1421:        OPTIONS_TABLE_STRING,
                   1422:        OPTIONS_TABLE_NUMBER,
1.305     nicm     1423:        OPTIONS_TABLE_KEY,
1.262     nicm     1424:        OPTIONS_TABLE_COLOUR,
                   1425:        OPTIONS_TABLE_ATTRIBUTES,
                   1426:        OPTIONS_TABLE_FLAG,
1.435     nicm     1427:        OPTIONS_TABLE_CHOICE,
                   1428:        OPTIONS_TABLE_STYLE
1.262     nicm     1429: };
                   1430:
                   1431: struct options_table_entry {
                   1432:        const char             *name;
                   1433:        enum options_table_type type;
1.1       nicm     1434:
1.262     nicm     1435:        u_int                   minimum;
                   1436:        u_int                   maximum;
                   1437:        const char            **choices;
1.1       nicm     1438:
1.262     nicm     1439:        const char             *default_str;
                   1440:        long long               default_num;
1.435     nicm     1441:
                   1442:        const char             *style;
1.1       nicm     1443: };
                   1444:
1.264     nicm     1445: /* Common command usages. */
                   1446: #define CMD_TARGET_PANE_USAGE "[-t target-pane]"
                   1447: #define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
                   1448: #define CMD_TARGET_SESSION_USAGE "[-t target-session]"
                   1449: #define CMD_TARGET_CLIENT_USAGE "[-t target-client]"
                   1450: #define CMD_SRCDST_PANE_USAGE "[-s src-pane] [-t dst-pane]"
                   1451: #define CMD_SRCDST_WINDOW_USAGE "[-s src-window] [-t dst-window]"
                   1452: #define CMD_SRCDST_SESSION_USAGE "[-s src-session] [-t dst-session]"
                   1453: #define CMD_SRCDST_CLIENT_USAGE "[-s src-client] [-t dst-client]"
1.461     nicm     1454: #define CMD_BUFFER_USAGE "[-b buffer-name]"
1.264     nicm     1455:
1.1       nicm     1456: /* tmux.c */
1.194     nicm     1457: extern struct options global_options;
1.16      nicm     1458: extern struct options global_s_options;
                   1459: extern struct options global_w_options;
1.73      nicm     1460: extern struct environ global_environ;
1.219     nicm     1461: extern struct event_base *ev_base;
1.1       nicm     1462: extern char    *cfg_file;
1.243     nicm     1463: extern char    *shell_cmd;
1.1       nicm     1464: extern int      debug_level;
                   1465: extern time_t   start_time;
1.474     nicm     1466: extern char     socket_path[PATH_MAX];
1.96      nicm     1467: extern int      login_shell;
1.243     nicm     1468: extern char    *environ_path;
1.1       nicm     1469: void            logfile(const char *);
1.93      nicm     1470: const char     *getshell(void);
                   1471: int             checkshell(const char *);
                   1472: int             areshell(const char *);
1.265     nicm     1473: void            setblocking(int, int);
1.243     nicm     1474: __dead void     shell_exec(const char *, const char *);
1.1       nicm     1475:
                   1476: /* cfg.c */
1.397     nicm     1477: extern struct cmd_q *cfg_cmd_q;
                   1478: extern int cfg_finished;
                   1479: extern int cfg_references;
1.431     nicm     1480: extern struct client *cfg_client;
1.397     nicm     1481: int             load_cfg(const char *, struct cmd_q *, char **);
                   1482: void            cfg_default_done(struct cmd_q *);
1.479     nicm     1483: void            cfg_add_cause(const char *, ...);
                   1484: void            cfg_print_causes(struct cmd_q *);
1.397     nicm     1485: void            cfg_show_causes(struct session *);
1.294     nicm     1486:
                   1487: /* format.c */
1.483     nicm     1488: struct format_tree;
1.294     nicm     1489: struct format_tree *format_create(void);
                   1490: void            format_free(struct format_tree *);
1.476     nicm     1491: void printflike(3, 4) format_add(struct format_tree *, const char *,
                   1492:                     const char *, ...);
1.294     nicm     1493: const char     *format_find(struct format_tree *, const char *);
1.489     nicm     1494: char           *format_expand_time(struct format_tree *, const char *, time_t);
1.294     nicm     1495: char           *format_expand(struct format_tree *, const char *);
1.488     nicm     1496: void            format_defaults(struct format_tree *, struct client *,
                   1497:                     struct session *, struct winlink *, struct window_pane *);
                   1498: void            format_defaults_window(struct format_tree *, struct window *);
                   1499: void            format_defaults_pane(struct format_tree *,
1.417     nicm     1500:                     struct window_pane *);
1.488     nicm     1501: void            format_defaults_paste_buffer(struct format_tree *,
1.447     nicm     1502:                     struct paste_buffer *, int);
1.1       nicm     1503:
                   1504: /* mode-key.c */
1.62      nicm     1505: extern const struct mode_key_table mode_key_tables[];
                   1506: extern struct mode_key_tree mode_key_tree_vi_edit;
                   1507: extern struct mode_key_tree mode_key_tree_vi_choice;
                   1508: extern struct mode_key_tree mode_key_tree_vi_copy;
                   1509: extern struct mode_key_tree mode_key_tree_emacs_edit;
                   1510: extern struct mode_key_tree mode_key_tree_emacs_choice;
                   1511: extern struct mode_key_tree mode_key_tree_emacs_copy;
                   1512: int    mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *);
1.306     nicm     1513: RB_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
1.261     nicm     1514: const char *mode_key_tostring(const struct mode_key_cmdstr *,
                   1515:            enum mode_key_cmd);
                   1516: enum mode_key_cmd mode_key_fromstring(const struct mode_key_cmdstr *,
                   1517:            const char *);
1.63      nicm     1518: const struct mode_key_table *mode_key_findtable(const char *);
1.62      nicm     1519: void   mode_key_init_trees(void);
                   1520: void   mode_key_init(struct mode_key_data *, struct mode_key_tree *);
1.389     nicm     1521: enum mode_key_cmd mode_key_lookup(struct mode_key_data *, int, const char **);
1.323     nicm     1522:
                   1523: /* notify.c */
1.349     nicm     1524: void   notify_enable(void);
                   1525: void   notify_disable(void);
1.358     nicm     1526: void   notify_input(struct window_pane *, struct evbuffer *);
1.323     nicm     1527: void   notify_window_layout_changed(struct window *);
                   1528: void   notify_window_unlinked(struct session *, struct window *);
                   1529: void   notify_window_linked(struct session *, struct window *);
                   1530: void   notify_window_renamed(struct window *);
                   1531: void   notify_attached_session_changed(struct client *);
                   1532: void   notify_session_renamed(struct session *);
                   1533: void   notify_session_created(struct session *);
                   1534: void   notify_session_closed(struct session *);
1.1       nicm     1535:
                   1536: /* options.c */
                   1537: int    options_cmp(struct options_entry *, struct options_entry *);
1.306     nicm     1538: RB_PROTOTYPE(options_tree, options_entry, entry, options_cmp);
1.1       nicm     1539: void   options_init(struct options *, struct options *);
                   1540: void   options_free(struct options *);
                   1541: struct options_entry *options_find1(struct options *, const char *);
                   1542: struct options_entry *options_find(struct options *, const char *);
1.44      nicm     1543: void   options_remove(struct options *, const char *);
1.476     nicm     1544: struct options_entry *printflike(3, 4) options_set_string(struct options *,
1.435     nicm     1545:            const char *, const char *, ...);
1.1       nicm     1546: char   *options_get_string(struct options *, const char *);
1.435     nicm     1547: struct options_entry *options_set_number(struct options *, const char *,
                   1548:            long long);
1.1       nicm     1549: long long options_get_number(struct options *, const char *);
1.435     nicm     1550: struct options_entry *options_set_style(struct options *, const char *,
                   1551:            const char *, int);
                   1552: struct grid_cell *options_get_style(struct options *, const char *);
1.1       nicm     1553:
1.262     nicm     1554: /* options-table.c */
                   1555: extern const struct options_table_entry server_options_table[];
                   1556: extern const struct options_table_entry session_options_table[];
                   1557: extern const struct options_table_entry window_options_table[];
1.379     nicm     1558: void   options_table_populate_tree(const struct options_table_entry *,
                   1559:            struct options *);
                   1560: const char *options_table_print_entry(const struct options_table_entry *,
                   1561:            struct options_entry *, int);
                   1562: int    options_table_find(const char *, const struct options_table_entry **,
1.313     nicm     1563:            const struct options_table_entry **);
1.262     nicm     1564:
1.126     nicm     1565: /* job.c */
1.128     nicm     1566: extern struct joblist all_jobs;
1.498     nicm     1567: struct job *job_run(const char *, struct session *, int,
1.405     nicm     1568:            void (*)(struct job *), void (*)(void *), void *);
1.126     nicm     1569: void   job_free(struct job *);
1.160     nicm     1570: void   job_died(struct job *, int);
1.126     nicm     1571:
1.73      nicm     1572: /* environ.c */
                   1573: int    environ_cmp(struct environ_entry *, struct environ_entry *);
                   1574: RB_PROTOTYPE(environ, environ_entry, entry, environ_cmp);
                   1575: void   environ_init(struct environ *);
                   1576: void   environ_free(struct environ *);
                   1577: void   environ_copy(struct environ *, struct environ *);
                   1578: struct environ_entry *environ_find(struct environ *, const char *);
                   1579: void   environ_set(struct environ *, const char *, const char *);
                   1580: void   environ_put(struct environ *, const char *);
                   1581: void   environ_unset(struct environ *, const char *);
1.192     nicm     1582: void   environ_update(const char *, struct environ *, struct environ *);
1.215     nicm     1583: void   environ_push(struct environ *);
1.73      nicm     1584:
1.1       nicm     1585: /* tty.c */
1.322     nicm     1586: void   tty_init_termios(int, struct termios *, struct bufferevent *);
1.115     nicm     1587: void   tty_raw(struct tty *, const char *);
1.491     nicm     1588: void   tty_attributes(struct tty *, const struct grid_cell *,
                   1589:            const struct window_pane *);
1.47      nicm     1590: void   tty_reset(struct tty *);
1.132     nicm     1591: void   tty_region_pane(struct tty *, const struct tty_ctx *, u_int, u_int);
1.133     nicm     1592: void   tty_region(struct tty *, u_int, u_int);
1.134     nicm     1593: void   tty_cursor_pane(struct tty *, const struct tty_ctx *, u_int, u_int);
                   1594: void   tty_cursor(struct tty *, u_int, u_int);
1.47      nicm     1595: void   tty_putcode(struct tty *, enum tty_code_code);
                   1596: void   tty_putcode1(struct tty *, enum tty_code_code, int);
                   1597: void   tty_putcode2(struct tty *, enum tty_code_code, int, int);
1.287     nicm     1598: void   tty_putcode_ptr1(struct tty *, enum tty_code_code, const void *);
1.373     nicm     1599: void   tty_putcode_ptr2(struct tty *, enum tty_code_code, const void *,
                   1600:            const void *);
1.47      nicm     1601: void   tty_puts(struct tty *, const char *);
                   1602: void   tty_putc(struct tty *, u_char);
1.373     nicm     1603: void   tty_putn(struct tty *, const void *, size_t, u_int);
1.337     nicm     1604: void   tty_init(struct tty *, struct client *, int, char *);
1.224     nicm     1605: int    tty_resize(struct tty *);
1.324     nicm     1606: int    tty_set_size(struct tty *, u_int, u_int);
1.364     nicm     1607: void   tty_set_class(struct tty *, u_int);
1.47      nicm     1608: void   tty_start_tty(struct tty *);
                   1609: void   tty_stop_tty(struct tty *);
                   1610: void   tty_set_title(struct tty *, const char *);
1.287     nicm     1611: void   tty_update_mode(struct tty *, int, struct screen *);
                   1612: void   tty_force_cursor_colour(struct tty *, const char *);
1.491     nicm     1613: void   tty_draw_pane(struct tty *, const struct window_pane *, u_int, u_int,
                   1614:            u_int);
                   1615: void   tty_draw_line(struct tty *, const struct window_pane *, struct screen *,
                   1616:            u_int, u_int, u_int);
1.437     nicm     1617: int    tty_open(struct tty *, char **);
1.76      nicm     1618: void   tty_close(struct tty *);
                   1619: void   tty_free(struct tty *);
1.308     nicm     1620: void   tty_write(
                   1621:            void (*)(struct tty *, const struct tty_ctx *), struct tty_ctx *);
1.79      nicm     1622: void   tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *);
                   1623: void   tty_cmd_cell(struct tty *, const struct tty_ctx *);
                   1624: void   tty_cmd_clearendofline(struct tty *, const struct tty_ctx *);
                   1625: void   tty_cmd_clearendofscreen(struct tty *, const struct tty_ctx *);
                   1626: void   tty_cmd_clearline(struct tty *, const struct tty_ctx *);
                   1627: void   tty_cmd_clearscreen(struct tty *, const struct tty_ctx *);
                   1628: void   tty_cmd_clearstartofline(struct tty *, const struct tty_ctx *);
                   1629: void   tty_cmd_clearstartofscreen(struct tty *, const struct tty_ctx *);
                   1630: void   tty_cmd_deletecharacter(struct tty *, const struct tty_ctx *);
1.371     nicm     1631: void   tty_cmd_clearcharacter(struct tty *, const struct tty_ctx *);
1.79      nicm     1632: void   tty_cmd_deleteline(struct tty *, const struct tty_ctx *);
1.282     nicm     1633: void   tty_cmd_erasecharacter(struct tty *, const struct tty_ctx *);
1.79      nicm     1634: void   tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *);
                   1635: void   tty_cmd_insertline(struct tty *, const struct tty_ctx *);
                   1636: void   tty_cmd_linefeed(struct tty *, const struct tty_ctx *);
                   1637: void   tty_cmd_utf8character(struct tty *, const struct tty_ctx *);
                   1638: void   tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
1.286     nicm     1639: void   tty_cmd_setselection(struct tty *, const struct tty_ctx *);
1.273     nicm     1640: void   tty_cmd_rawstring(struct tty *, const struct tty_ctx *);
1.293     nicm     1641: void   tty_bell(struct tty *);
1.1       nicm     1642:
                   1643: /* tty-term.c */
                   1644: extern struct tty_terms tty_terms;
1.260     nicm     1645: extern const struct tty_term_code_entry tty_term_codes[NTTYCODE];
1.437     nicm     1646: struct tty_term *tty_term_find(char *, int, char **);
1.192     nicm     1647: void            tty_term_free(struct tty_term *);
1.1       nicm     1648: int             tty_term_has(struct tty_term *, enum tty_code_code);
                   1649: const char     *tty_term_string(struct tty_term *, enum tty_code_code);
                   1650: const char     *tty_term_string1(struct tty_term *, enum tty_code_code, int);
                   1651: const char     *tty_term_string2(
1.192     nicm     1652:                     struct tty_term *, enum tty_code_code, int, int);
1.287     nicm     1653: const char     *tty_term_ptr1(
                   1654:                     struct tty_term *, enum tty_code_code, const void *);
1.367     nicm     1655: const char     *tty_term_ptr2(struct tty_term *, enum tty_code_code,
                   1656:                     const void *, const void *);
1.1       nicm     1657: int             tty_term_number(struct tty_term *, enum tty_code_code);
                   1658: int             tty_term_flag(struct tty_term *, enum tty_code_code);
1.240     nicm     1659:
                   1660: /* tty-acs.c */
                   1661: const char     *tty_acs_get(struct tty *, u_char);
1.1       nicm     1662:
                   1663: /* tty-keys.c */
1.381     nicm     1664: void   tty_keys_build(struct tty *);
1.47      nicm     1665: void   tty_keys_free(struct tty *);
1.170     nicm     1666: int    tty_keys_next(struct tty *);
1.1       nicm     1667:
                   1668: /* paste.c */
1.461     nicm     1669: struct paste_buffer *paste_walk(struct paste_buffer *);
1.457     nicm     1670: struct paste_buffer *paste_get_top(void);
1.461     nicm     1671: struct paste_buffer *paste_get_name(const char *);
1.457     nicm     1672: int             paste_free_top(void);
1.461     nicm     1673: int             paste_free_name(const char *);
                   1674: void            paste_add(char *, size_t);
                   1675: int             paste_rename(const char *, const char *, char **);
                   1676: int             paste_set(char *, size_t, const char *, char **);
1.447     nicm     1677: char           *paste_make_sample(struct paste_buffer *, int);
1.367     nicm     1678: void            paste_send_pane(struct paste_buffer *, struct window_pane *,
                   1679:                     const char *, int);
1.1       nicm     1680:
1.264     nicm     1681: /* arguments.c */
1.410     nicm     1682: int             args_cmp(struct args_entry *, struct args_entry *);
                   1683: RB_PROTOTYPE(args_tree, args_entry, entry, args_cmp);
1.264     nicm     1684: struct args    *args_create(int, ...);
                   1685: struct args    *args_parse(const char *, int, char **);
                   1686: void            args_free(struct args *);
                   1687: size_t          args_print(struct args *, char *, size_t);
                   1688: int             args_has(struct args *, u_char);
                   1689: void            args_set(struct args *, u_char, const char *);
                   1690: const char     *args_get(struct args *, u_char);
1.502     nicm     1691: long long       args_strtonum(struct args *, u_char, long long, long long,
                   1692:                     char **);
                   1693:
                   1694: /* cmd-find.c */
                   1695: struct session *cmd_find_current(struct cmd_q *);
                   1696: struct session *cmd_find_session(struct cmd_q *, const char *, int);
                   1697: struct winlink *cmd_find_window(struct cmd_q *, const char *,
                   1698:                     struct session **);
                   1699: struct winlink *cmd_find_pane(struct cmd_q *, const char *, struct session **,
                   1700:                     struct window_pane **);
                   1701: struct client  *cmd_find_client(struct cmd_q *, const char *, int);
                   1702: int             cmd_find_index(struct cmd_q *, const char *,
                   1703:                     struct session **);
1.264     nicm     1704:
1.1       nicm     1705: /* cmd.c */
1.55      nicm     1706: int             cmd_pack_argv(int, char **, char *, size_t);
                   1707: int             cmd_unpack_argv(char *, size_t, int, char ***);
1.460     nicm     1708: char          **cmd_copy_argv(int, char **);
1.55      nicm     1709: void            cmd_free_argv(int, char **);
1.463     nicm     1710: char           *cmd_stringify_argv(int, char **);
1.397     nicm     1711: struct cmd     *cmd_parse(int, char **, const char *, u_int, char **);
1.1       nicm     1712: size_t          cmd_print(struct cmd *, char *, size_t);
1.492     nicm     1713: int             cmd_mouse_at(struct window_pane *, struct mouse_event *,
                   1714:                     u_int *, u_int *, int);
                   1715: struct winlink *cmd_mouse_window(struct mouse_event *, struct session **);
                   1716: struct window_pane *cmd_mouse_pane(struct mouse_event *, struct session **,
                   1717:                     struct winlink **);
1.380     nicm     1718: char           *cmd_template_replace(const char *, const char *, int);
1.1       nicm     1719: extern const struct cmd_entry *cmd_table[];
                   1720: extern const struct cmd_entry cmd_attach_session_entry;
                   1721: extern const struct cmd_entry cmd_bind_key_entry;
                   1722: extern const struct cmd_entry cmd_break_pane_entry;
1.190     nicm     1723: extern const struct cmd_entry cmd_capture_pane_entry;
1.228     nicm     1724: extern const struct cmd_entry cmd_choose_buffer_entry;
1.91      nicm     1725: extern const struct cmd_entry cmd_choose_client_entry;
1.1       nicm     1726: extern const struct cmd_entry cmd_choose_session_entry;
1.346     nicm     1727: extern const struct cmd_entry cmd_choose_tree_entry;
1.1       nicm     1728: extern const struct cmd_entry cmd_choose_window_entry;
                   1729: extern const struct cmd_entry cmd_clear_history_entry;
                   1730: extern const struct cmd_entry cmd_clock_mode_entry;
                   1731: extern const struct cmd_entry cmd_command_prompt_entry;
                   1732: extern const struct cmd_entry cmd_confirm_before_entry;
                   1733: extern const struct cmd_entry cmd_copy_mode_entry;
                   1734: extern const struct cmd_entry cmd_delete_buffer_entry;
                   1735: extern const struct cmd_entry cmd_detach_client_entry;
1.36      nicm     1736: extern const struct cmd_entry cmd_display_message_entry;
1.92      nicm     1737: extern const struct cmd_entry cmd_display_panes_entry;
1.1       nicm     1738: extern const struct cmd_entry cmd_down_pane_entry;
                   1739: extern const struct cmd_entry cmd_find_window_entry;
                   1740: extern const struct cmd_entry cmd_has_session_entry;
1.19      nicm     1741: extern const struct cmd_entry cmd_if_shell_entry;
1.198     nicm     1742: extern const struct cmd_entry cmd_join_pane_entry;
1.1       nicm     1743: extern const struct cmd_entry cmd_kill_pane_entry;
                   1744: extern const struct cmd_entry cmd_kill_server_entry;
                   1745: extern const struct cmd_entry cmd_kill_session_entry;
                   1746: extern const struct cmd_entry cmd_kill_window_entry;
1.244     nicm     1747: extern const struct cmd_entry cmd_last_pane_entry;
1.1       nicm     1748: extern const struct cmd_entry cmd_last_window_entry;
                   1749: extern const struct cmd_entry cmd_link_window_entry;
                   1750: extern const struct cmd_entry cmd_list_buffers_entry;
                   1751: extern const struct cmd_entry cmd_list_clients_entry;
                   1752: extern const struct cmd_entry cmd_list_commands_entry;
                   1753: extern const struct cmd_entry cmd_list_keys_entry;
1.127     nicm     1754: extern const struct cmd_entry cmd_list_panes_entry;
1.1       nicm     1755: extern const struct cmd_entry cmd_list_sessions_entry;
                   1756: extern const struct cmd_entry cmd_list_windows_entry;
                   1757: extern const struct cmd_entry cmd_load_buffer_entry;
1.118     nicm     1758: extern const struct cmd_entry cmd_lock_client_entry;
1.1       nicm     1759: extern const struct cmd_entry cmd_lock_server_entry;
1.118     nicm     1760: extern const struct cmd_entry cmd_lock_session_entry;
1.315     nicm     1761: extern const struct cmd_entry cmd_move_pane_entry;
1.1       nicm     1762: extern const struct cmd_entry cmd_move_window_entry;
                   1763: extern const struct cmd_entry cmd_new_session_entry;
                   1764: extern const struct cmd_entry cmd_new_window_entry;
                   1765: extern const struct cmd_entry cmd_next_layout_entry;
                   1766: extern const struct cmd_entry cmd_next_window_entry;
                   1767: extern const struct cmd_entry cmd_paste_buffer_entry;
1.131     nicm     1768: extern const struct cmd_entry cmd_pipe_pane_entry;
1.1       nicm     1769: extern const struct cmd_entry cmd_previous_layout_entry;
                   1770: extern const struct cmd_entry cmd_previous_window_entry;
                   1771: extern const struct cmd_entry cmd_refresh_client_entry;
                   1772: extern const struct cmd_entry cmd_rename_session_entry;
                   1773: extern const struct cmd_entry cmd_rename_window_entry;
                   1774: extern const struct cmd_entry cmd_resize_pane_entry;
1.290     nicm     1775: extern const struct cmd_entry cmd_respawn_pane_entry;
1.1       nicm     1776: extern const struct cmd_entry cmd_respawn_window_entry;
                   1777: extern const struct cmd_entry cmd_rotate_window_entry;
1.107     nicm     1778: extern const struct cmd_entry cmd_run_shell_entry;
1.1       nicm     1779: extern const struct cmd_entry cmd_save_buffer_entry;
                   1780: extern const struct cmd_entry cmd_select_layout_entry;
                   1781: extern const struct cmd_entry cmd_select_pane_entry;
                   1782: extern const struct cmd_entry cmd_select_window_entry;
                   1783: extern const struct cmd_entry cmd_send_keys_entry;
                   1784: extern const struct cmd_entry cmd_send_prefix_entry;
                   1785: extern const struct cmd_entry cmd_server_info_entry;
                   1786: extern const struct cmd_entry cmd_set_buffer_entry;
1.73      nicm     1787: extern const struct cmd_entry cmd_set_environment_entry;
1.1       nicm     1788: extern const struct cmd_entry cmd_set_option_entry;
                   1789: extern const struct cmd_entry cmd_set_window_option_entry;
                   1790: extern const struct cmd_entry cmd_show_buffer_entry;
1.73      nicm     1791: extern const struct cmd_entry cmd_show_environment_entry;
1.180     nicm     1792: extern const struct cmd_entry cmd_show_messages_entry;
1.1       nicm     1793: extern const struct cmd_entry cmd_show_options_entry;
                   1794: extern const struct cmd_entry cmd_show_window_options_entry;
                   1795: extern const struct cmd_entry cmd_source_file_entry;
                   1796: extern const struct cmd_entry cmd_split_window_entry;
                   1797: extern const struct cmd_entry cmd_start_server_entry;
                   1798: extern const struct cmd_entry cmd_suspend_client_entry;
                   1799: extern const struct cmd_entry cmd_swap_pane_entry;
                   1800: extern const struct cmd_entry cmd_swap_window_entry;
                   1801: extern const struct cmd_entry cmd_switch_client_entry;
                   1802: extern const struct cmd_entry cmd_unbind_key_entry;
                   1803: extern const struct cmd_entry cmd_unlink_window_entry;
                   1804: extern const struct cmd_entry cmd_up_pane_entry;
1.401     nicm     1805: extern const struct cmd_entry cmd_wait_for_entry;
1.399     nicm     1806:
                   1807: /* cmd-attach-session.c */
1.428     nicm     1808: enum cmd_retval         cmd_attach_session(struct cmd_q *, const char *, int, int,
                   1809:                     const char *);
1.1       nicm     1810:
                   1811: /* cmd-list.c */
1.397     nicm     1812: struct cmd_list        *cmd_list_parse(int, char **, const char *, u_int, char **);
1.1       nicm     1813: void            cmd_list_free(struct cmd_list *);
                   1814: size_t          cmd_list_print(struct cmd_list *, char *, size_t);
                   1815:
1.397     nicm     1816: /* cmd-queue.c */
                   1817: struct cmd_q   *cmdq_new(struct client *);
                   1818: int             cmdq_free(struct cmd_q *);
1.476     nicm     1819: void printflike(2, 3) cmdq_print(struct cmd_q *, const char *, ...);
                   1820: void printflike(2, 3) cmdq_error(struct cmd_q *, const char *, ...);
1.487     nicm     1821: void            cmdq_guard(struct cmd_q *, const char *, int);
1.492     nicm     1822: void            cmdq_run(struct cmd_q *, struct cmd_list *,
                   1823:                     struct mouse_event *);
                   1824: void            cmdq_append(struct cmd_q *, struct cmd_list *,
                   1825:                     struct mouse_event *);
1.397     nicm     1826: int             cmdq_continue(struct cmd_q *);
                   1827: void            cmdq_flush(struct cmd_q *);
                   1828:
1.1       nicm     1829: /* cmd-string.c */
1.397     nicm     1830: int    cmd_string_parse(const char *, struct cmd_list **, const char *,
                   1831:            u_int, char **);
1.471     nicm     1832:
                   1833: /* cmd-wait-for.c */
                   1834: void   cmd_wait_for_flush(void);
1.1       nicm     1835:
                   1836: /* client.c */
1.243     nicm     1837: int    client_main(int, char **, int);
1.1       nicm     1838:
                   1839: /* key-bindings.c */
1.493     nicm     1840: RB_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
                   1841: RB_PROTOTYPE(key_tables, key_table, entry, key_table_cmp);
                   1842: extern struct key_tables key_tables;
                   1843: int     key_table_cmp(struct key_table *, struct key_table *);
1.1       nicm     1844: int     key_bindings_cmp(struct key_binding *, struct key_binding *);
1.493     nicm     1845: struct          key_table *key_bindings_get_table(const char *, int);
                   1846: void    key_bindings_unref_table(struct key_table *);
                   1847: void    key_bindings_add(const char *, int, int, struct cmd_list *);
                   1848: void    key_bindings_remove(const char *, int);
                   1849: void    key_bindings_remove_table(const char *);
1.1       nicm     1850: void    key_bindings_init(void);
1.492     nicm     1851: void    key_bindings_dispatch(struct key_binding *, struct client *,
                   1852:             struct mouse_event *);
1.1       nicm     1853:
                   1854: /* key-string.c */
                   1855: int     key_string_lookup_string(const char *);
                   1856: const char *key_string_lookup_key(int);
                   1857:
                   1858: /* server.c */
                   1859: extern struct clients clients;
1.101     nicm     1860: extern struct clients dead_clients;
1.319     nicm     1861: int     server_start(int, char *);
1.175     nicm     1862: void    server_update_socket(void);
1.328     nicm     1863: void    server_add_accept(int);
1.1       nicm     1864:
1.146     nicm     1865: /* server-client.c */
1.337     nicm     1866: void    server_client_handle_key(struct client *, int);
1.146     nicm     1867: void    server_client_create(int);
1.437     nicm     1868: int      server_client_open(struct client *, char **);
1.146     nicm     1869: void    server_client_lost(struct client *);
1.159     nicm     1870: void    server_client_callback(int, short, void *);
1.167     nicm     1871: void    server_client_status_timer(void);
1.146     nicm     1872: void    server_client_loop(void);
                   1873:
                   1874: /* server-window.c */
                   1875: void    server_window_loop(void);
1.1       nicm     1876:
                   1877: /* server-fn.c */
1.73      nicm     1878: void    server_fill_environ(struct session *, struct environ *);
1.334     nicm     1879: void    server_write_ready(struct client *);
1.427     nicm     1880: int     server_write_client(struct client *, enum msgtype, const void *,
                   1881:             size_t);
                   1882: void    server_write_session(struct session *, enum msgtype, const void *,
                   1883:             size_t);
1.1       nicm     1884: void    server_redraw_client(struct client *);
                   1885: void    server_status_client(struct client *);
                   1886: void    server_redraw_session(struct session *);
1.124     nicm     1887: void    server_redraw_session_group(struct session *);
1.1       nicm     1888: void    server_status_session(struct session *);
1.124     nicm     1889: void    server_status_session_group(struct session *);
1.1       nicm     1890: void    server_redraw_window(struct window *);
1.197     nicm     1891: void    server_redraw_window_borders(struct window *);
1.1       nicm     1892: void    server_status_window(struct window *);
                   1893: void    server_lock(void);
1.118     nicm     1894: void    server_lock_session(struct session *);
                   1895: void    server_lock_client(struct client *);
1.1       nicm     1896: int     server_unlock(const char *);
1.37      nicm     1897: void    server_kill_window(struct window *);
1.124     nicm     1898: int     server_link_window(struct session *,
1.106     nicm     1899:             struct winlink *, struct session *, int, int, int, char **);
                   1900: void    server_unlink_window(struct session *, struct winlink *);
1.177     nicm     1901: void    server_destroy_pane(struct window_pane *);
1.124     nicm     1902: void    server_destroy_session_group(struct session *);
1.103     nicm     1903: void    server_destroy_session(struct session *);
1.367     nicm     1904: void    server_check_unattached(void);
1.92      nicm     1905: void    server_set_identify(struct client *);
                   1906: void    server_clear_identify(struct client *);
1.165     nicm     1907: void    server_update_event(struct client *);
1.332     nicm     1908: void    server_push_stdout(struct client *);
                   1909: void    server_push_stderr(struct client *);
                   1910: int     server_set_stdin_callback(struct client *, void (*)(struct client *,
                   1911:             int, void *), void *, char **);
1.398     nicm     1912: void    server_unzoom_window(struct window *);
1.1       nicm     1913:
                   1914: /* status.c */
1.271     nicm     1915: int     status_out_cmp(struct status_out *, struct status_out *);
                   1916: RB_PROTOTYPE(status_out_tree, status_out, entry, status_out_cmp);
1.308     nicm     1917: int     status_at_line(struct client *);
1.271     nicm     1918: void    status_free_jobs(struct status_out_tree *);
                   1919: void    status_update_jobs(struct client *);
1.492     nicm     1920: struct window *status_get_window_at(struct client *, u_int);
1.1       nicm     1921: int     status_redraw(struct client *);
1.476     nicm     1922: void printflike(2, 3) status_message_set(struct client *, const char *, ...);
1.1       nicm     1923: void    status_message_clear(struct client *);
                   1924: int     status_message_redraw(struct client *);
1.292     nicm     1925: void    status_prompt_set(struct client *, const char *, const char *,
1.192     nicm     1926:             int (*)(void *, const char *), void (*)(void *), void *, int);
1.1       nicm     1927: void    status_prompt_clear(struct client *);
                   1928: int     status_prompt_redraw(struct client *);
                   1929: void    status_prompt_key(struct client *, int);
1.292     nicm     1930: void    status_prompt_update(struct client *, const char *, const char *);
1.1       nicm     1931:
                   1932: /* resize.c */
                   1933: void    recalculate_sizes(void);
                   1934:
                   1935: /* input.c */
                   1936: void    input_init(struct window_pane *);
                   1937: void    input_free(struct window_pane *);
1.507   ! nicm     1938: void    input_reset(struct window_pane *);
        !          1939: struct evbuffer *input_pending(struct window_pane *);
1.1       nicm     1940: void    input_parse(struct window_pane *);
                   1941:
                   1942: /* input-key.c */
1.492     nicm     1943: void    input_key(struct window_pane *, int, struct mouse_event *);
1.150     nicm     1944:
                   1945: /* xterm-keys.c */
1.192     nicm     1946: char   *xterm_keys_lookup(int);
1.189     nicm     1947: int     xterm_keys_find(const char *, size_t, size_t *, int *);
1.1       nicm     1948:
                   1949: /* colour.c */
1.102     nicm     1950: void    colour_set_fg(struct grid_cell *, int);
                   1951: void    colour_set_bg(struct grid_cell *, int);
                   1952: const char *colour_tostring(int);
1.1       nicm     1953: int     colour_fromstring(const char *);
                   1954: u_char  colour_256to16(u_char);
                   1955:
                   1956: /* attributes.c */
                   1957: const char *attributes_tostring(u_char);
                   1958: int     attributes_fromstring(const char *);
                   1959:
                   1960: /* grid.c */
                   1961: extern const struct grid_cell grid_default_cell;
1.338     nicm     1962: extern const struct grid_cell grid_marker_cell;
1.1       nicm     1963: struct grid *grid_create(u_int, u_int, u_int);
                   1964: void    grid_destroy(struct grid *);
                   1965: int     grid_compare(struct grid *, struct grid *);
1.139     nicm     1966: void    grid_collect_history(struct grid *);
                   1967: void    grid_scroll_history(struct grid *);
                   1968: void    grid_scroll_history_region(struct grid *, u_int, u_int);
1.1       nicm     1969: void    grid_expand_line(struct grid *, u_int, u_int);
                   1970: const struct grid_cell *grid_peek_cell(struct grid *, u_int, u_int);
1.391     nicm     1971: const struct grid_line *grid_peek_line(struct grid *, u_int);
1.1       nicm     1972: struct grid_cell *grid_get_cell(struct grid *, u_int, u_int);
                   1973: void    grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
                   1974: void    grid_clear(struct grid *, u_int, u_int, u_int, u_int);
                   1975: void    grid_clear_lines(struct grid *, u_int, u_int);
                   1976: void    grid_move_lines(struct grid *, u_int, u_int, u_int);
                   1977: void    grid_move_cells(struct grid *, u_int, u_int, u_int, u_int);
1.388     nicm     1978: char   *grid_string_cells(struct grid *, u_int, u_int, u_int,
1.400     nicm     1979:             struct grid_cell **, int, int, int);
1.25      nicm     1980: void    grid_duplicate_lines(
1.192     nicm     1981:             struct grid *, u_int, struct grid *, u_int, u_int);
1.378     nicm     1982: u_int   grid_reflow(struct grid *, struct grid *, u_int);
1.181     nicm     1983:
1.373     nicm     1984: /* grid-cell.c */
                   1985: u_int   grid_cell_width(const struct grid_cell *);
                   1986: void    grid_cell_get(const struct grid_cell *, struct utf8_data *);
                   1987: void    grid_cell_set(struct grid_cell *, const struct utf8_data *);
                   1988: void    grid_cell_one(struct grid_cell *, u_char);
1.1       nicm     1989:
                   1990: /* grid-view.c */
                   1991: const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int);
                   1992: struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int);
                   1993: void    grid_view_set_cell(
1.192     nicm     1994:             struct grid *, u_int, u_int, const struct grid_cell *);
1.269     nicm     1995: void    grid_view_clear_history(struct grid *);
1.1       nicm     1996: void    grid_view_clear(struct grid *, u_int, u_int, u_int, u_int);
                   1997: void    grid_view_scroll_region_up(struct grid *, u_int, u_int);
                   1998: void    grid_view_scroll_region_down(struct grid *, u_int, u_int);
                   1999: void    grid_view_insert_lines(struct grid *, u_int, u_int);
1.18      nicm     2000: void    grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int);
1.1       nicm     2001: void    grid_view_delete_lines(struct grid *, u_int, u_int);
1.18      nicm     2002: void    grid_view_delete_lines_region(struct grid *, u_int, u_int, u_int);
1.1       nicm     2003: void    grid_view_insert_cells(struct grid *, u_int, u_int, u_int);
                   2004: void    grid_view_delete_cells(struct grid *, u_int, u_int, u_int);
1.9       nicm     2005: char   *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
1.1       nicm     2006:
                   2007: /* screen-write.c */
                   2008: void    screen_write_start(
1.192     nicm     2009:             struct screen_write_ctx *, struct window_pane *, struct screen *);
1.1       nicm     2010: void    screen_write_stop(struct screen_write_ctx *);
1.304     nicm     2011: void    screen_write_reset(struct screen_write_ctx *);
1.476     nicm     2012: size_t printflike(2, 3) screen_write_cstrlen(int, const char *, ...);
                   2013: void printflike(5, 6) screen_write_cnputs(struct screen_write_ctx *,
1.192     nicm     2014:             ssize_t, struct grid_cell *, int, const char *, ...);
1.476     nicm     2015: size_t printflike(2, 3) screen_write_strlen(int, const char *, ...);
                   2016: void printflike(3, 4) screen_write_puts(struct screen_write_ctx *,
1.192     nicm     2017:             struct grid_cell *, const char *, ...);
1.476     nicm     2018: void printflike(5, 6) screen_write_nputs(struct screen_write_ctx *,
1.192     nicm     2019:             ssize_t, struct grid_cell *, int, const char *, ...);
1.3       nicm     2020: void    screen_write_vnputs(struct screen_write_ctx *,
1.4       nicm     2021:             ssize_t, struct grid_cell *, int, const char *, va_list);
1.1       nicm     2022: void    screen_write_putc(
1.192     nicm     2023:             struct screen_write_ctx *, struct grid_cell *, u_char);
1.1       nicm     2024: void    screen_write_copy(struct screen_write_ctx *,
                   2025:             struct screen *, u_int, u_int, u_int, u_int);
1.136     nicm     2026: void    screen_write_backspace(struct screen_write_ctx *);
1.383     nicm     2027: void    screen_write_mode_set(struct screen_write_ctx *, int);
                   2028: void    screen_write_mode_clear(struct screen_write_ctx *, int);
1.1       nicm     2029: void    screen_write_cursorup(struct screen_write_ctx *, u_int);
                   2030: void    screen_write_cursordown(struct screen_write_ctx *, u_int);
                   2031: void    screen_write_cursorright(struct screen_write_ctx *, u_int);
                   2032: void    screen_write_cursorleft(struct screen_write_ctx *, u_int);
1.5       nicm     2033: void    screen_write_alignmenttest(struct screen_write_ctx *);
1.1       nicm     2034: void    screen_write_insertcharacter(struct screen_write_ctx *, u_int);
                   2035: void    screen_write_deletecharacter(struct screen_write_ctx *, u_int);
1.371     nicm     2036: void    screen_write_clearcharacter(struct screen_write_ctx *, u_int);
1.1       nicm     2037: void    screen_write_insertline(struct screen_write_ctx *, u_int);
                   2038: void    screen_write_deleteline(struct screen_write_ctx *, u_int);
                   2039: void    screen_write_clearline(struct screen_write_ctx *);
                   2040: void    screen_write_clearendofline(struct screen_write_ctx *);
                   2041: void    screen_write_clearstartofline(struct screen_write_ctx *);
                   2042: void    screen_write_cursormove(struct screen_write_ctx *, u_int, u_int);
                   2043: void    screen_write_reverseindex(struct screen_write_ctx *);
                   2044: void    screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
1.72      nicm     2045: void    screen_write_linefeed(struct screen_write_ctx *, int);
1.137     nicm     2046: void    screen_write_linefeedscreen(struct screen_write_ctx *, int);
1.1       nicm     2047: void    screen_write_carriagereturn(struct screen_write_ctx *);
                   2048: void    screen_write_clearendofscreen(struct screen_write_ctx *);
                   2049: void    screen_write_clearstartofscreen(struct screen_write_ctx *);
                   2050: void    screen_write_clearscreen(struct screen_write_ctx *);
1.297     nicm     2051: void    screen_write_clearhistory(struct screen_write_ctx *);
1.373     nicm     2052: void    screen_write_cell(struct screen_write_ctx *, const struct grid_cell *);
1.286     nicm     2053: void    screen_write_setselection(struct screen_write_ctx *, u_char *, u_int);
1.273     nicm     2054: void    screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int);
1.1       nicm     2055:
                   2056: /* screen-redraw.c */
1.436     nicm     2057: void    screen_redraw_screen(struct client *, int, int, int);
1.1       nicm     2058: void    screen_redraw_pane(struct client *, struct window_pane *);
                   2059:
                   2060: /* screen.c */
                   2061: void    screen_init(struct screen *, u_int, u_int, u_int);
                   2062: void    screen_reinit(struct screen *);
                   2063: void    screen_free(struct screen *);
1.6       nicm     2064: void    screen_reset_tabs(struct screen *);
1.288     nicm     2065: void    screen_set_cursor_style(struct screen *, u_int);
1.287     nicm     2066: void    screen_set_cursor_colour(struct screen *, const char *);
1.1       nicm     2067: void    screen_set_title(struct screen *, const char *);
1.374     nicm     2068: void    screen_resize(struct screen *, u_int, u_int, int);
1.204     nicm     2069: void    screen_set_selection(struct screen *,
                   2070:             u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
1.1       nicm     2071: void    screen_clear_selection(struct screen *);
                   2072: int     screen_check_selection(struct screen *, u_int, u_int);
1.374     nicm     2073: void    screen_reflow(struct screen *, u_int);
1.1       nicm     2074:
                   2075: /* window.c */
                   2076: extern struct windows windows;
1.274     nicm     2077: extern struct window_pane_tree all_window_panes;
1.496     nicm     2078: int             window_cmp(struct window *, struct window *);
                   2079: RB_PROTOTYPE(windows, window, entry, window_cmp);
1.1       nicm     2080: int             winlink_cmp(struct winlink *, struct winlink *);
                   2081: RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp);
1.274     nicm     2082: int             window_pane_cmp(struct window_pane *, struct window_pane *);
                   2083: RB_PROTOTYPE(window_pane_tree, window_pane, tree_entry, window_pane_cmp);
1.1       nicm     2084: struct winlink *winlink_find_by_index(struct winlinks *, int);
1.192     nicm     2085: struct winlink *winlink_find_by_window(struct winlinks *, struct window *);
1.309     nicm     2086: struct winlink *winlink_find_by_window_id(struct winlinks *, u_int);
1.81      nicm     2087: int             winlink_next_index(struct winlinks *, int);
1.1       nicm     2088: u_int           winlink_count(struct winlinks *);
1.268     nicm     2089: struct winlink *winlink_add(struct winlinks *, int);
                   2090: void            winlink_set_window(struct winlink *, struct window *);
1.1       nicm     2091: void            winlink_remove(struct winlinks *, struct winlink *);
1.186     nicm     2092: struct winlink *winlink_next(struct winlink *);
                   2093: struct winlink *winlink_previous(struct winlink *);
1.235     nicm     2094: struct winlink *winlink_next_by_number(struct winlink *, struct session *,
                   2095:                     int);
                   2096: struct winlink *winlink_previous_by_number(struct winlink *, struct session *,
                   2097:                     int);
1.1       nicm     2098: void            winlink_stack_push(struct winlink_stack *, struct winlink *);
                   2099: void            winlink_stack_remove(struct winlink_stack *, struct winlink *);
1.500     nicm     2100: struct window  *window_find_by_id_str(const char *);
1.309     nicm     2101: struct window  *window_find_by_id(u_int);
1.1       nicm     2102: struct window  *window_create1(u_int, u_int);
1.463     nicm     2103: struct window  *window_create(const char *, int, char **, const char *,
1.455     nicm     2104:                     const char *, int, struct environ *, struct termios *,
                   2105:                     u_int, u_int, u_int, char **);
1.1       nicm     2106: void            window_destroy(struct window *);
1.289     nicm     2107: struct window_pane *window_get_active_at(struct window *, u_int, u_int);
1.125     nicm     2108: void            window_set_active_at(struct window *, u_int, u_int);
1.289     nicm     2109: struct window_pane *window_find_string(struct window *, const char *);
1.492     nicm     2110: int             window_has_pane(struct window *, struct window_pane *);
1.477     nicm     2111: int             window_set_active_pane(struct window *, struct window_pane *);
1.51      nicm     2112: struct window_pane *window_add_pane(struct window *, u_int);
1.44      nicm     2113: void            window_resize(struct window *, u_int, u_int);
1.398     nicm     2114: int             window_zoom(struct window_pane *);
                   2115: int             window_unzoom(struct window *);
1.453     nicm     2116: void            window_lost_pane(struct window *, struct window_pane *);
1.1       nicm     2117: void            window_remove_pane(struct window *, struct window_pane *);
                   2118: struct window_pane *window_pane_at_index(struct window *, u_int);
1.235     nicm     2119: struct window_pane *window_pane_next_by_number(struct window *,
                   2120:                        struct window_pane *, u_int);
                   2121: struct window_pane *window_pane_previous_by_number(struct window *,
                   2122:                        struct window_pane *, u_int);
1.298     nicm     2123: int             window_pane_index(struct window_pane *, u_int *);
1.1       nicm     2124: u_int           window_count_panes(struct window *);
                   2125: void            window_destroy_panes(struct window *);
1.500     nicm     2126: struct window_pane *window_pane_find_by_id_str(const char *);
1.274     nicm     2127: struct window_pane *window_pane_find_by_id(u_int);
1.1       nicm     2128: struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int);
                   2129: void            window_pane_destroy(struct window_pane *);
1.325     nicm     2130: void            window_pane_timer_start(struct window_pane *);
1.463     nicm     2131: int             window_pane_spawn(struct window_pane *, int, char **,
1.455     nicm     2132:                     const char *, const char *, int, struct environ *,
                   2133:                     struct termios *, char **);
1.44      nicm     2134: void            window_pane_resize(struct window_pane *, u_int, u_int);
1.366     nicm     2135: void            window_pane_alternate_on(struct window_pane *,
                   2136:                     struct grid_cell *, int);
                   2137: void            window_pane_alternate_off(struct window_pane *,
                   2138:                     struct grid_cell *, int);
1.1       nicm     2139: int             window_pane_set_mode(
                   2140:                     struct window_pane *, const struct window_mode *);
                   2141: void            window_pane_reset_mode(struct window_pane *);
1.492     nicm     2142: void            window_pane_key(struct window_pane *, struct client *,
                   2143:                     struct session *, int, struct mouse_event *);
1.28      nicm     2144: int             window_pane_visible(struct window_pane *);
1.10      nicm     2145: char           *window_pane_search(
1.192     nicm     2146:                     struct window_pane *, const char *, u_int *);
1.256     nicm     2147: char           *window_printable_flags(struct session *, struct winlink *);
1.211     nicm     2148: struct window_pane *window_pane_find_up(struct window_pane *);
                   2149: struct window_pane *window_pane_find_down(struct window_pane *);
                   2150: struct window_pane *window_pane_find_left(struct window_pane *);
                   2151: struct window_pane *window_pane_find_right(struct window_pane *);
1.311     nicm     2152: void            window_set_name(struct window *, const char *);
1.352     nicm     2153: void            window_remove_ref(struct window *);
1.345     nicm     2154: void            winlink_clear_flags(struct winlink *);
1.1       nicm     2155:
                   2156: /* layout.c */
1.232     nicm     2157: u_int           layout_count_cells(struct layout_cell *);
1.39      nicm     2158: struct layout_cell *layout_create_cell(struct layout_cell *);
                   2159: void            layout_free_cell(struct layout_cell *);
                   2160: void            layout_print_cell(struct layout_cell *, const char *, u_int);
1.372     nicm     2161: void            layout_destroy_cell(struct layout_cell *, struct layout_cell **);
1.39      nicm     2162: void            layout_set_size(
                   2163:                     struct layout_cell *, u_int, u_int, u_int, u_int);
                   2164: void            layout_make_leaf(
                   2165:                     struct layout_cell *, struct window_pane *);
                   2166: void            layout_make_node(struct layout_cell *, enum layout_type);
                   2167: void            layout_fix_offsets(struct layout_cell *);
                   2168: void            layout_fix_panes(struct window *, u_int, u_int);
                   2169: u_int           layout_resize_check(struct layout_cell *, enum layout_type);
                   2170: void            layout_resize_adjust(
                   2171:                     struct layout_cell *, enum layout_type, int);
1.398     nicm     2172: void            layout_init(struct window *, struct window_pane *);
1.39      nicm     2173: void            layout_free(struct window *);
                   2174: void            layout_resize(struct window *, u_int, u_int);
1.385     nicm     2175: void            layout_resize_pane(struct window_pane *, enum layout_type,
                   2176:                     int);
                   2177: void            layout_resize_pane_to(struct window_pane *, enum layout_type,
                   2178:                     u_int);
1.198     nicm     2179: void            layout_assign_pane(struct layout_cell *, struct window_pane *);
                   2180: struct layout_cell *layout_split_pane(
1.315     nicm     2181:                     struct window_pane *, enum layout_type, int, int);
1.39      nicm     2182: void            layout_close_pane(struct window_pane *);
                   2183:
1.232     nicm     2184: /* layout-custom.c */
1.494     nicm     2185: char           *layout_dump(struct layout_cell *);
1.232     nicm     2186: int             layout_parse(struct window *, const char *);
                   2187:
1.39      nicm     2188: /* layout-set.c */
                   2189: const char     *layout_set_name(u_int);
                   2190: int             layout_set_lookup(const char *);
                   2191: u_int           layout_set_select(struct window *, u_int);
                   2192: u_int           layout_set_next(struct window *);
                   2193: u_int           layout_set_previous(struct window *);
                   2194: void            layout_set_active_changed(struct window *);
1.1       nicm     2195:
                   2196: /* window-clock.c */
                   2197: extern const struct window_mode window_clock_mode;
1.438     nicm     2198: extern const char window_clock_table[14][5][5];
1.1       nicm     2199:
                   2200: /* window-copy.c */
                   2201: extern const struct window_mode window_copy_mode;
1.216     nicm     2202: void            window_copy_init_from_pane(struct window_pane *);
                   2203: void            window_copy_init_for_output(struct window_pane *);
1.476     nicm     2204: void printflike(2, 3) window_copy_add(struct window_pane *, const char *, ...);
1.216     nicm     2205: void            window_copy_vadd(struct window_pane *, const char *, va_list);
1.192     nicm     2206: void            window_copy_pageup(struct window_pane *);
1.492     nicm     2207: void            window_copy_start_drag(struct client *, struct mouse_event *);
1.1       nicm     2208:
                   2209: /* window-choose.c */
                   2210: extern const struct window_mode window_choose_mode;
1.343     nicm     2211: void            window_choose_add(struct window_pane *,
                   2212:                         struct window_choose_data *);
1.1       nicm     2213: void            window_choose_ready(struct window_pane *,
1.376     nicm     2214:                     u_int, void (*)(struct window_choose_data *));
1.375     nicm     2215: struct window_choose_data      *window_choose_data_create (int,
                   2216:                     struct client *, struct session *);
                   2217: void   window_choose_data_free(struct window_choose_data *);
                   2218: void   window_choose_data_run(struct window_choose_data *);
1.344     nicm     2219: struct window_choose_data      *window_choose_add_window(struct window_pane *,
1.377     nicm     2220:                        struct client *, struct session *, struct winlink *,
1.380     nicm     2221:                        const char *, const char *, u_int);
1.344     nicm     2222: struct window_choose_data      *window_choose_add_session(struct window_pane *,
1.377     nicm     2223:                        struct client *, struct session *, const char *,
1.380     nicm     2224:                        const char *, u_int);
1.369     nicm     2225: void   window_choose_expand_all(struct window_pane *);
1.408     nicm     2226: void   window_choose_collapse_all(struct window_pane *);
                   2227: void   window_choose_set_current(struct window_pane *, u_int);
1.1       nicm     2228:
                   2229: /* names.c */
1.417     nicm     2230: void    queue_window_name(struct window *);
                   2231: char   *default_window_name(struct window *);
                   2232: char   *format_window_name(struct window *);
                   2233: char   *parse_window_name(const char *);
1.219     nicm     2234:
                   2235: /* signal.c */
1.349     nicm     2236: void   set_signals(void(*)(int, short, void *));
                   2237: void   clear_signals(int);
1.342     nicm     2238:
                   2239: /* control.c */
1.470     nicm     2240: void   control_callback(struct client *, int, void *);
1.476     nicm     2241: void printflike(2, 3) control_write(struct client *, const char *, ...);
1.357     nicm     2242: void   control_write_buffer(struct client *, struct evbuffer *);
1.353     nicm     2243:
                   2244: /* control-notify.c */
1.358     nicm     2245: void   control_notify_input(struct client *, struct window_pane *,
                   2246:            struct evbuffer *);
1.353     nicm     2247: void   control_notify_window_layout_changed(struct window *);
                   2248: void   control_notify_window_unlinked(struct session *, struct window *);
                   2249: void   control_notify_window_linked(struct session *, struct window *);
                   2250: void   control_notify_window_renamed(struct window *);
                   2251: void   control_notify_attached_session_changed(struct client *);
                   2252: void   control_notify_session_renamed(struct session *);
                   2253: void   control_notify_session_created(struct session *);
                   2254: void   control_notify_session_close(struct session *);
1.1       nicm     2255:
                   2256: /* session.c */
                   2257: extern struct sessions sessions;
1.101     nicm     2258: extern struct sessions dead_sessions;
1.124     nicm     2259: extern struct session_groups session_groups;
1.254     nicm     2260: int    session_cmp(struct session *, struct session *);
                   2261: RB_PROTOTYPE(sessions, session, entry, session_cmp);
1.251     nicm     2262: int             session_alive(struct session *);
1.1       nicm     2263: struct session *session_find(const char *);
1.500     nicm     2264: struct session *session_find_by_id_str(const char *);
1.402     nicm     2265: struct session *session_find_by_id(u_int);
1.463     nicm     2266: struct session *session_create(const char *, int, char **, const char *,
                   2267:                     int, struct environ *, struct termios *, int, u_int,
                   2268:                     u_int, char **);
1.192     nicm     2269: void            session_destroy(struct session *);
1.279     nicm     2270: int             session_check_name(const char *);
1.259     nicm     2271: void            session_update_activity(struct session *);
1.239     nicm     2272: struct session *session_next_session(struct session *);
                   2273: struct session *session_previous_session(struct session *);
1.463     nicm     2274: struct winlink *session_new(struct session *, const char *, int, char **,
1.455     nicm     2275:                     const char *, int, int, char **);
1.463     nicm     2276: struct winlink *session_attach(struct session *, struct window *, int,
                   2277:                     char **);
1.1       nicm     2278: int             session_detach(struct session *, struct winlink *);
1.497     nicm     2279: int             session_has(struct session *, struct window *);
1.504     nicm     2280: int             session_is_linked(struct session *, struct window *);
1.1       nicm     2281: int             session_next(struct session *, int);
                   2282: int             session_previous(struct session *, int);
                   2283: int             session_select(struct session *, int);
                   2284: int             session_last(struct session *);
1.392     nicm     2285: int             session_set_current(struct session *, struct winlink *);
1.124     nicm     2286: struct session_group *session_group_find(struct session *);
                   2287: u_int           session_group_index(struct session_group *);
                   2288: void            session_group_add(struct session *, struct session *);
                   2289: void            session_group_remove(struct session *);
1.478     nicm     2290: u_int           session_group_count(struct session_group *);
1.124     nicm     2291: void            session_group_synchronize_to(struct session *);
                   2292: void            session_group_synchronize_from(struct session *);
                   2293: void            session_group_synchronize1(struct session *, struct session *);
1.330     nicm     2294: void            session_renumber_windows(struct session *);
1.1       nicm     2295:
                   2296: /* utf8.c */
1.456     nicm     2297: void            utf8_build(void);
                   2298: void            utf8_set(struct utf8_data *, u_char);
                   2299: int             utf8_open(struct utf8_data *, u_char);
                   2300: int             utf8_append(struct utf8_data *, u_char);
                   2301: u_int           utf8_combine(const struct utf8_data *);
                   2302: u_int           utf8_split2(u_int, u_char *);
                   2303: int             utf8_strvis(char *, const char *, size_t, int);
                   2304: struct utf8_data *utf8_fromcstr(const char *);
                   2305: char           *utf8_tocstr(struct utf8_data *);
                   2306: u_int           utf8_cstrwidth(const char *);
                   2307: char           *utf8_trimcstr(const char *, u_int);
1.1       nicm     2308:
                   2309: /* procname.c */
                   2310: char   *get_proc_name(int, char *);
                   2311:
                   2312: /* log.c */
1.446     deraadt  2313: void            log_open(const char *);
1.1       nicm     2314: void            log_close(void);
1.476     nicm     2315: void printflike(1, 2) log_debug(const char *, ...);
                   2316: __dead void printflike(1, 2) log_fatal(const char *, ...);
                   2317: __dead void printflike(1, 2) log_fatalx(const char *, ...);
1.1       nicm     2318:
                   2319: /* xmalloc.c */
                   2320: char           *xstrdup(const char *);
                   2321: void           *xcalloc(size_t, size_t);
                   2322: void           *xmalloc(size_t);
1.472     nicm     2323: void           *xrealloc(void *, size_t);
                   2324: void           *xreallocarray(void *, size_t, size_t);
1.476     nicm     2325: int printflike(2, 3) xasprintf(char **, const char *, ...);
1.1       nicm     2326: int             xvasprintf(char **, const char *, va_list);
1.476     nicm     2327: int printflike(3, 4) xsnprintf(char *, size_t, const char *, ...);
1.1       nicm     2328: int             xvsnprintf(char *, size_t, const char *, va_list);
1.435     nicm     2329:
                   2330: /* style.c */
                   2331: int             style_parse(const struct grid_cell *,
                   2332:                     struct grid_cell *, const char *);
                   2333: const char     *style_tostring(struct grid_cell *);
                   2334: void            style_update_new(struct options *, const char *, const char *);
                   2335: void            style_update_old(struct options *, const char *,
                   2336:                     struct grid_cell *);
1.450     nicm     2337: void            style_apply(struct grid_cell *, struct options *,
                   2338:                     const char *);
                   2339: void            style_apply_update(struct grid_cell *, struct options *,
                   2340:                     const char *);
1.1       nicm     2341:
                   2342: #endif /* TMUX_H */