home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / VILE327.ZIP / VILE327.TAR / vile3.27 / estruct.h < prev    next >
Text File  |  1992-12-14  |  51KB  |  1,627 lines

  1. /*    ESTRUCT:    Structure and preprocessor defines for
  2.             vile.  Reshaped from the original, which
  3.             was for MicroEMACS 3.9
  4.  
  5.             vile is by Paul Fox
  6.             MicroEmacs was written by Dave G. Conroy
  7.             modified by Steve Wilhite, George Jones
  8.             substantially modified by Daniel Lawrence
  9. */
  10.  
  11. /*
  12.  * $Log: estruct.h,v $
  13.  * Revision 1.90  1992/12/05  13:53:56  foxharp
  14.  * fix APOLLO signal types
  15.  *
  16.  * Revision 1.89  1992/12/04  09:28:35  foxharp
  17.  * added APOLLO
  18.  *
  19.  * Revision 1.88  1992/12/02  09:13:16  foxharp
  20.  * changes for "c-shiftwidth"
  21.  *
  22.  * Revision 1.87  1992/11/19  08:59:00  foxharp
  23.  * added "qident" bit definition, for "qualified" (a la c++) identifiers
  24.  *
  25.  * Revision 1.86  1992/08/19  22:55:55  foxharp
  26.  * made NFILEN bigger -- much safer
  27.  *
  28.  * Revision 1.85  1992/08/07  17:32:47  pgf
  29.  * don't use bcopy
  30.  *
  31.  * Revision 1.84  1992/08/06  23:51:47  foxharp
  32.  * nextsw() now finds next "shiftwidth stop", like nextab() finds next tabstop
  33.  *
  34.  * Revision 1.83  1992/08/04  20:09:59  foxharp
  35.  * bsd386 doesn't have bfill, but it does have mem{set,cpy}
  36.  *
  37.  * Revision 1.82  1992/07/24  18:22:51  foxharp
  38.  * deleted local atoi() routine -- now we use the system's copy
  39.  *
  40.  * Revision 1.81  1992/07/20  22:45:53  foxharp
  41.  * if using TERMCAP, define TTputc directly as putchar(),
  42.  * for some performance gain
  43.  *
  44.  * Revision 1.80  1992/07/17  19:16:45  foxharp
  45.  * change "sun" to "SUNOS" to make way for solaris
  46.  *
  47.  * Revision 1.79  1992/07/13  20:08:17  foxharp
  48.  * "terse" is now a boolean mode rather than a variable, and
  49.  * added "tagsrelative" mode
  50.  *
  51.  * Revision 1.78  1992/07/13  09:24:41  foxharp
  52.  * added b_dispfname, which will allow printing shorter paths
  53.  * for files by trimming leading 'pwd' matches
  54.  *
  55.  * Revision 1.77  1992/07/08  08:20:22  foxharp
  56.  * made the _rest_ of the command flags long.  sigh.
  57.  *
  58.  * Revision 1.76  1992/07/07  08:36:07  foxharp
  59.  * redefined the command flags as long constants, so the upper 16 bits don't
  60.  * get lost on 16 bit machines.  (DOS)
  61.  *
  62.  * Revision 1.75  1992/07/01  17:00:59  foxharp
  63.  * added ZIBMPC define, and comment re: COLOR support
  64.  *
  65.  * Revision 1.74  1992/06/25  23:00:50  foxharp
  66.  * changes for dos/ibmpc
  67.  *
  68.  * Revision 1.73  1992/06/22  08:33:28  foxharp
  69.  * another ifdef for UNIXPC
  70.  *
  71.  * Revision 1.72  1992/06/12  22:23:42  foxharp
  72.  * changes for separate 'comments' r.e. for formatregion
  73.  *
  74.  * Revision 1.71  1992/06/04  19:42:37  foxharp
  75.  * use #ifdef __STDC__ in favor of #if
  76.  *
  77.  * Revision 1.70  1992/06/01  20:35:59  foxharp
  78.  * added "tabinsert" support
  79.  *
  80.  * Revision 1.69  1992/05/25  21:27:14  foxharp
  81.  * some func declarations moved in here, from edef.h and other .c files
  82.  *
  83.  * Revision 1.68  1992/05/25  21:25:35  foxharp
  84.  * bad control char in log comment
  85.  *
  86.  * Revision 1.67  1992/05/20  18:57:16  foxharp
  87.  * added a/ux, fixed my stdarg ifdef
  88.  *
  89.  * Revision 1.66  1992/05/19  18:28:04  foxharp
  90.  * more proto-isms
  91.  *
  92.  * Revision 1.65  1992/05/19  09:15:45  foxharp
  93.  * more prototype fixups
  94.  *
  95.  * Revision 1.64  1992/05/16  12:00:31  pgf
  96.  * prototypes/ansi/void-int stuff/microsoftC
  97.  *
  98.  * Revision 1.63  1992/04/30  17:53:09  pgf
  99.  * fixed ifdef on HAVE_MKDIR
  100.  *
  101.  * Revision 1.62  1992/04/14  08:55:38  pgf
  102.  * added support for OSF1 (affects termio only)
  103.  *
  104.  * Revision 1.61  1992/04/10  19:52:40  pgf
  105.  * make sure svr3 implies usg
  106.  *
  107.  * Revision 1.60  1992/04/10  18:51:31  pgf
  108.  * rearrange some config ifdefs, so makefile can do config with targets
  109.  *
  110.  * Revision 1.59  1992/03/26  09:15:23  pgf
  111.  * system choice ifdef cleanup
  112.  *
  113.  * Revision 1.58  1992/03/25  19:13:17  pgf
  114.  * BSD portability changes
  115.  *
  116.  * Revision 1.57  1992/03/24  22:45:55  pgf
  117.  * corrected typos
  118.  *
  119.  * Revision 1.56  1992/03/19  23:33:35  pgf
  120.  * added b_linecount to BUFFER, so finderr can count from bottom of buffer
  121.  *
  122.  * Revision 1.55  1992/03/19  23:17:52  pgf
  123.  * SIGT for signals, and linux portability
  124.  *
  125.  * Revision 1.54  1992/03/07  10:21:29  pgf
  126.  * added AIX support (also need to link against -lcurses)
  127.  *
  128.  * Revision 1.53  1992/03/03  09:35:52  pgf
  129.  * added support for getting "words" out of the buffer via variables --
  130.  * needed _nonspace character type
  131.  *
  132.  * Revision 1.52  1992/03/01  18:38:40  pgf
  133.  * compilation error #if COLOR
  134.  *
  135.  * Revision 1.51  1992/02/17  09:18:55  pgf
  136.  * turn off DEBUG and DEBUGM for release
  137.  *
  138.  * Revision 1.50  1992/02/17  09:00:28  pgf
  139.  * added "showmode" support, and
  140.  * kill registers now hold unsigned chars
  141.  *
  142.  * Revision 1.49  1992/01/22  20:30:08  pgf
  143.  * added HPUX "support", and big warning for non-CRYPT support
  144.  *
  145.  * Revision 1.48  1992/01/10  07:10:46  pgf
  146.  * added VAL_SWIDTH
  147.  *
  148.  * Revision 1.47  1992/01/03  23:29:37  pgf
  149.  * added UNIXPC support (on hints from Eric Krohn), and
  150.  * changed the b_fname element of a BUFFER to a pointer
  151.  *
  152.  * Revision 1.46  1992/01/01  16:16:52  pgf
  153.  * fixed typo
  154.  *
  155.  * Revision 1.45  1991/11/18  08:35:32  pgf
  156.  * ifdef botch
  157.  *
  158.  * Revision 1.44  1991/11/16  18:29:15  pgf
  159.  * ifdef cleanup
  160.  *
  161.  * Revision 1.43  1991/11/13  20:09:27  pgf
  162.  * X11 changes, from dave lemke
  163.  *
  164.  * Revision 1.42  1991/11/08  13:18:23  pgf
  165.  * added FIOABRT error
  166.  *
  167.  * Revision 1.41  1991/11/06  23:28:08  pgf
  168.  * added fence character type macros
  169.  * getfence() will scan for a fence if not on one to begin with.  it'll
  170.  * scan in either direction, depending on arg to matchfence or matchfenceback
  171.  *
  172.  * Revision 1.40  1991/11/01  14:24:11  pgf
  173.  * added lsprintf decl
  174.  *
  175.  * Revision 1.39  1991/11/01  14:10:35  pgf
  176.  * make matchlen part of the regexp struct:  mlen, and
  177.  * changed regmust from pointer to offset into program, to make
  178.  * regexps relocatable
  179.  *
  180.  * Revision 1.38  1991/10/28  14:24:04  pgf
  181.  * eliminated some useless macros, made gacount part of the BUFFER struct
  182.  *
  183.  * Revision 1.37  1991/10/27  01:58:53  pgf
  184.  * added declarations/definitions for the regexp stuff (courtesy Henry Spencer),
  185.  * and added the new regex value definitions
  186.  *
  187.  * Revision 1.36  1991/10/24  13:05:52  pgf
  188.  * conversion to new regex package -- much faster
  189.  *
  190.  * Revision 1.35  1991/10/23  12:05:37  pgf
  191.  * support for the NeXT machine
  192.  *
  193.  * Revision 1.34  1991/10/18  10:56:54  pgf
  194.  * modified VALUE structures and lists to make them more easily settable
  195.  *
  196.  * Revision 1.33  1991/10/15  03:10:00  pgf
  197.  * added backspacelimit and taglength
  198.  *
  199.  * Revision 1.32  1991/10/10  12:33:33  pgf
  200.  * changes to support "block malloc" of line text -- now for most files
  201.  * there is are two mallocs and a single read, no copies.  previously there
  202.  * were two mallocs per line, and two copies (stdio's and ours).  This change
  203.  * implies that lines and line text should not move between buffers, without
  204.  * checking that the text and line struct do not "belong" to the buffer.
  205.  *
  206.  * Revision 1.31  1991/09/26  13:08:55  pgf
  207.  * created window values, moved list mode there
  208.  *
  209.  * Revision 1.30  1991/09/19  13:35:29  pgf
  210.  * MDEXACT is now MDIGNCASE, and names are now more vi-compliant
  211.  *
  212.  * Revision 1.29  1991/09/10  12:29:57  pgf
  213.  * added b_wline macro into b_wtraits
  214.  *
  215.  * Revision 1.28  1991/09/10  01:08:28  pgf
  216.  * added BEL define
  217.  *
  218.  * Revision 1.27  1991/09/10  00:44:29  pgf
  219.  * added ESC defines
  220.  *
  221.  * Revision 1.26  1991/08/16  10:58:54  pgf
  222.  * added the third flavor of insertmode
  223.  *
  224.  * Revision 1.25  1991/08/13  02:48:59  pgf
  225.  * added select and poll selectors, and alphabetized the VAL_XXX's
  226.  *
  227.  * Revision 1.24  1991/08/12  15:06:21  pgf
  228.  * added ANSI_SPEC capability -- can now use the arrow keys from
  229.  * command or insert mode
  230.  *
  231.  * Revision 1.23  1991/08/12  09:25:10  pgf
  232.  * now store w_line in w_traits while buffer is offscreen, so reframe
  233.  * isn't always necessary.  don't force reframe on redisplay.
  234.  *
  235.  * Revision 1.22  1991/08/07  11:51:32  pgf
  236.  * added RCS log entries
  237.  *
  238.  * revision 1.21
  239.  * date: 1991/08/06 15:07:43;
  240.  * global/local values
  241.  * ----------------------------
  242.  * revision 1.20
  243.  * date: 1991/06/28 10:52:53;
  244.  * added config for ISC, and changed some "#if" to "#ifdef"
  245.  * ----------------------------
  246.  * revision 1.19
  247.  * date: 1991/06/25 19:51:43;
  248.  * massive data structure restructure
  249.  * ----------------------------
  250.  * revision 1.18
  251.  * date: 1991/06/16 17:30:21;
  252.  * fixed tabs to be modulo intead of mask, added ctabstop capability, added
  253.  * LOCAL_VALUES #define to control local buffer values
  254.  * ----------------------------
  255.  * revision 1.17
  256.  * date: 1991/06/06 13:57:52;
  257.  * added auto-indent mode
  258.  * ----------------------------
  259.  * revision 1.16
  260.  * date: 1991/06/04 09:20:53;
  261.  * kcod2key is now a macro
  262.  * ----------------------------
  263.  * revision 1.15
  264.  * date: 1991/06/03 17:34:35;
  265.  * switch from "meta" etc. to "ctla" etc.
  266.  * ----------------------------
  267.  * revision 1.14
  268.  * date: 1991/06/03 13:58:40;
  269.  * made bind description list better
  270.  * ----------------------------
  271.  * revision 1.13
  272.  * date: 1991/06/03 10:16:34;
  273.  * cleanup, for release of 2.3
  274.  * ----------------------------
  275.  * revision 1.12
  276.  * date: 1991/05/31 10:46:27;
  277.  * added lspec character class for ex line specifiers
  278.  * added end pointer and offset to the region struct
  279.  * added #defines for the ex range allowances
  280.  * ----------------------------
  281.  * revision 1.11
  282.  * date: 1991/04/22 09:00:46;
  283.  * added ODT, POSIX defines.
  284.  * also added iswild() support
  285.  * ----------------------------
  286.  * revision 1.10
  287.  * date: 1991/04/05 13:04:55;
  288.  * fixed "shorten" directory name
  289.  * ----------------------------
  290.  * revision 1.9
  291.  * date: 1991/04/04 09:28:32;
  292.  * line text is now separate from LINE struct
  293.  * ----------------------------
  294.  * revision 1.8
  295.  * date: 1991/03/26 17:01:11;
  296.  * new undo dot offset field
  297.  * ----------------------------
  298.  * revision 1.7
  299.  * date: 1991/02/21 09:13:00;
  300.  * added sideways offsets for horiz scrolling
  301.  * ----------------------------
  302.  * revision 1.6
  303.  * date: 1990/12/16 22:23:19;
  304.  * changed the default configuration
  305.  * ----------------------------
  306.  * revision 1.5
  307.  * date: 1990/10/04 13:07:38;
  308.  * added #define for ODT
  309.  * ----------------------------
  310.  * revision 1.4
  311.  * date: 1990/10/03 16:00:49;
  312.  * make backspace work for everyone
  313.  * ----------------------------
  314.  * revision 1.3
  315.  * date: 1990/10/01 12:16:36;
  316.  * make provisions for shortnames, and added HAVE_MKDIR define
  317.  * ----------------------------
  318.  * revision 1.2
  319.  * date: 1990/09/28 14:36:22;
  320.  * cleanup of ifdefs, response to porting problems
  321.  * ----------------------------
  322.  * revision 1.1
  323.  * date: 1990/09/21 10:25:09;
  324.  * initial vile RCS revision
  325.  */
  326.  
  327. #define const
  328.  
  329. #ifndef os_chosen
  330.  
  331. /* Note that as of vile 3.15, most of these choices can be made
  332.     from the makefile, using separate make targets, so you may
  333.     not need to edit this... */
  334.  
  335. /*    Machine/OS definitions            */
  336. /* unix flavors */
  337. /* If you're UNIX, choose one of these... */
  338. #define BERK    0    /* Berkeley derived */
  339. #define USG    0    /* AT&T derived */
  340. #define SVR3    1    /* AT&T derived, more recently */
  341. #define V7    0    /* the good old days */
  342.  
  343. /* ...and turn this on if you can... */
  344. #define POSIX    0    /* the good new days */
  345.  
  346. /* unix sub-flavors */
  347. /* ...and turn on one of these if appropriate... */
  348. #define ODT    0            /* UNIX OPEN DESK TOP        */
  349. #define ULTRIX    0            /* UNIX ULTRIX            */
  350. #define ISC    0            /* Interactive Systems */
  351. #define SUNOS    0            /* SunOS 3 or 4 */
  352. #define NeXT    0
  353. #define UNIXPC    0
  354. #define HPUX    0
  355. #define AIX    0
  356. #define OSF1    0
  357. #define LINUX    0
  358. #define BSD386    0
  359. #define APOLLO    0
  360. #define AUX2    0            /* Apple A/UX 2.0 */
  361.  
  362. /* the following overrides are mostly for convenience only */
  363. #if ULTRIX || SUNOS
  364. # undef BERK
  365. # undef USG
  366. # undef POSIX
  367. # define BERK    1
  368. # define USG    0
  369. # define POSIX    1
  370. #endif
  371.  
  372. #if defined(mips)
  373. # undef BERK
  374. # undef USG
  375. # define BERK    0
  376. # define USG    1
  377. #endif
  378.  
  379. #if ODT || ISC 
  380. # undef BERK
  381. # undef USG
  382. # undef POSIX
  383. # define BERK    0
  384. # define USG    1
  385. # define POSIX    1
  386. # define SVR3_PTEM    1    /* for ptem.h in display.c */
  387. #endif
  388.  
  389. #if HPUX    /* reported to work with 7.05.  Could someone confirm these? */
  390. # define HAVE_SELECT
  391. # undef POSIX
  392. # undef BERK
  393. # undef USG
  394. # define POSIX    0
  395. # define BERK    0
  396. # define USG    1
  397. #endif
  398.  
  399. #if NeXT
  400. # define __STRICT_BSD__
  401. #endif
  402.  
  403. /* if anyone can verify that these are right, and work, let me know... -pgf */
  404. #if UNIXPC
  405. # undef BERK
  406. # undef USG
  407. # define BERK    0
  408. # define USG    1
  409. # define winit xxwinit
  410. # undef HAVE_MKDIR
  411. # undef HAVE_SELECT
  412. # define HAVE_MKDIR 0
  413. # define HAVE_SELECT 1
  414. #endif
  415.  
  416. #if AIX
  417. # undef POSIX
  418. # undef BERK
  419. # undef USG
  420. # define POSIX    1
  421. # define BERK    0
  422. # define USG    1
  423. # define HAVE_SELECT 1
  424. # undef __STR__
  425. #endif
  426.  
  427. #if LINUX
  428. # define HAVE_SELECT 1
  429. # define HAVE_POLL 0
  430. #endif
  431.  
  432. #if APOLLO
  433. # undef POSIX
  434. # undef BERK
  435. # undef USG
  436. # define POSIX 0
  437. # define BERK 1
  438. # define USG 0
  439. #endif
  440.  
  441.  
  442.  
  443. /* non-unix flavors */
  444. #undef    LATTICE        /* don't use their definitions...use ours    */
  445. #undef    MSDOS
  446. #undef    CPM
  447. #undef    AMIGA
  448. #undef    EGA
  449.  
  450. #define AMIGA    0            /* AmigaDOS            */
  451. #define ST520    0            /* ST520, TOS               */
  452. #define MSDOS    0            /* MS-DOS               */
  453. #define CPM    0            /* CP/M-86               */
  454. #define VMS    0            /* VAX/VMS               */
  455.  
  456. /*    Compiler definitions            */
  457. #define MWC86    0    /* marc williams compiler */
  458. #define    LATTICE    0    /* Lattice 2.14 through 3.0 compilers */
  459. #define    AZTEC    0    /* Aztec C 3.20e */
  460. #define    MSC    0    /* MicroSoft C compile version 3 & 4 & 5 & 6 */
  461. #define    ZTC    0    /* Zortech C compiler */
  462. #define    TURBO    0    /* Turbo C/MSDOS */
  463.  
  464. #endif /* os_chosen */
  465.  
  466. #if SVR3
  467. # undef BERK
  468. # undef USG
  469. # define BERK    0
  470. # define USG    1
  471. #endif
  472.  
  473. #define UNIX    (V7 | BERK | USG)    /* any unix        */
  474.  
  475. /* choose between void and int signal handler return type.
  476.   "typedefs?  we don't need no steenking typedefs..." */
  477. #if POSIX || (BERK && BSD386) || SVR3 || APOLLO
  478. # define SIGT void
  479. # define SIGRET
  480. #else
  481. # define SIGT int
  482. # define SIGRET return 0
  483. #endif
  484.  
  485.  
  486. /*    Porting constraints            */
  487. #ifndef HAVE_MKDIR
  488. # define HAVE_MKDIR    1    /* if your system has the mkdir() system call */
  489. #endif
  490.  
  491.  
  492. /* has the select() or poll() call, only used for short sleeps in fmatch() */
  493. #ifndef HAVE_SELECT
  494. # if BERK
  495. #  define HAVE_SELECT 1
  496. # else
  497. #  define HAVE_SELECT 0
  498. # endif
  499. #endif
  500.  
  501. #ifndef HAVE_POLL
  502. # if !HAVE_SELECT && (POSIX || SVR3 || ( USG && defined(pyr) ))
  503. #  define HAVE_POLL 1
  504. # else
  505. #  define HAVE_POLL 0
  506. # endif
  507. #endif
  508.  
  509.  
  510. #ifndef scrn_chosen
  511. /*    Terminal Output definitions        */
  512. /* choose ONLY one of the following */
  513. #define TERMCAP 1            /* Use TERMCAP            */
  514. #define ANSI    0            /* ANSI escape sequences    */
  515. #define AT386    0            /* AT style 386 unix console    */
  516. #define    HP150    0            /* HP150 screen driver        */
  517. #define    HP110    0            /* HP110 screen driver        */
  518. #define    VMSVT    0            /* various VMS terminal entries    */
  519. #define VT52    0            /* VT52 terminal (Zenith).    */
  520. #define RAINBOW 0            /* Use Rainbow fast video.    */
  521. #define    IBMPC    0            /* IBM-PC CGA/MONO/EGA driver    */
  522. #define    ZIBMPC    0            /* Zortech lib IBM-PC CGA/MONO/EGA driver    */
  523. #define    DG10    0            /* Data General system/10    */
  524. #define    TIPC    0            /* TI Professional PC driver    */
  525. #define    Z309    0            /* Zenith 100 PC family    driver    */
  526. #define    MAC    0            /* Macintosh            */
  527. #define    ATARI    0            /* Atari 520/1040ST screen    */
  528. #define NeWS    0            /* distributed */
  529. #define    X11    0            /* X Window System */
  530.  
  531. /*   Special keyboard definitions         */
  532. #define WANGPC    0        /* WangPC - mostly escape sequences    */
  533. /* the WANGPC stuff isn't in the cmdtbl keyboard definitions: sorry -- pgf */
  534. #endif
  535.  
  536. /*    Configuration options... pick and choose as you wish */
  537.  
  538. /* Appearance */
  539. #define    TYPEAH    1    /* type ahead causes screen refresh to be delayed */
  540. #define    REVSTA    1    /* Status line appears in reverse video        */
  541.  
  542. /* NOTE -- COLOR doesn't currently do anything if you're using X or TERMCAP */
  543. /* (But I think X11 may honor colors from the command line or .Xdefaults) */
  544. /* (and DOS definitely does do things with COLOR, but it may not work) */
  545. #define    COLOR    0    /* color commands and windows            */
  546. #define    CLRMSG    0    /* space clears the message line with no insert    */
  547.  
  548. /* Feature turnon/turnoff */
  549. #define ANSI_SPEC    1 /* ANSI function/arrow keys */
  550. #define    CTRLZ    0    /* add a ^Z at end of files under MSDOS only    */
  551. #define    DOSFILES 1    /* turn on code for DOS mode (lines that end in crlf) */
  552.             /* use DOSFILES, for instance, if you edit DOS- */
  553.             /*    created files under UNIX        */
  554. #define    CFENCE    1    /* do fence matching in CMODE            */
  555. #define    REBIND    1    /* permit rebinding of keys at run-time        */
  556. #define    APROP    1    /* Add code for Apropos command    (needs REBIND)    */
  557. #define    FILOCK    0    /* file locking under unix BSD 4.2 (uses scanf) */
  558. #define    ISRCH    1    /* Incremental searches like ITS EMACS        */
  559. #define    FLABEL    0    /* function key label code [HP150]        */
  560.  
  561. /* WARNING:  The code in crypt.c and the entry points marked
  562.     with #ifdef CRYPT are UNTESTED.  Several people turned the code
  563.     on and have reported bugs/coredumps/other problems.  If anyone
  564.     would like to take on the job of fixing this, be my guest!  If
  565.     you could, at the same time, make it compatible with UNIX crypt(1),
  566.     I'd be a happy man!  :-)
  567.     (I can forward details of at least one frustrated person's
  568.     experiences, in case someone wants to look at it.)
  569. */
  570. #define    CRYPT    0    /* file encryption? (not crypt(1) compatible!)    */
  571.  
  572. #define    TAGS    1    /* tags support                  */
  573. #define    WORDPRO    1    /* "Advanced" word processing features        */
  574. #define    AEDIT    1    /* advanced editing options: e.g. en/detabbing    */
  575. #define    PROC    1    /* named procedures                */
  576. #define    FINDERR    1    /* finderr support. uses scanf()        */
  577. #define    GLOBALS    1    /* "global" command support.            */
  578. #define    PATHLOOK 1    /* look along $PATH for startup and help files    */
  579. #define    SCROLLCODE 1    /* code in display.c for scrolling the screen.
  580.                Only useful if your display can scroll
  581.                regions, or at least insert/delete lines. 
  582.                ANSI, TERMCAP, and AT386 can do this         */
  583. #define CVMVAS    1    /* arguments to forward/back page and half page */
  584.             /* are in pages    instead of rows */
  585. #define PRETTIER_SCROLL 1 /* can improve the appearance of a scrolling screen */
  586. #define STUTTER_SEC_CMD 0 /* must the next/prev section commands (i.e.
  587.                 ']]' and '[[' be stuttered?  they must be
  588.                 stuttered in real vi, I prefer them not
  589.                 to be */
  590.  
  591. /*    Code size options    */
  592. #define    FEWNAMES 0    /* strip some names - will no longer be bindable */
  593. #define    SMALLER    0    /* strip out a bunch of uemacs fluff */
  594.             /*     (to each their own... :-)  pgf) */
  595.  
  596. /*    Debugging options    */
  597. #define    RAMSIZE    0    /* dynamic RAM memory usage tracking */
  598. #define    RAMSHOW    0    /* auto dynamic RAM reporting */
  599. #define    VMALLOC    0    /* verify malloc operation (slow!) */
  600. #define    DEBUG    0    /* allows core dump from keyboard under UNIX */
  601. #define    TIMING    0    /* shows user time spent on each user command */
  602.             /* TIMING doesn't work yet... sorry  -pgf */ 
  603. #define DEBUGM    0    /* $debug triggers macro debugging        */
  604. #define    VISMAC    0    /* update display during keyboard macros    */
  605.  
  606.  
  607. /* That's the end of the user selections -- the rest is static definition */
  608. /* (i.e. you shouldn't need to touch anything below here */
  609. /* ====================================================================== */
  610.  
  611. #if BERK && ! POSIX
  612. #define USE_INDEX 1
  613. #endif
  614. #if never && BERK && ! POSIX && ! BSD386
  615. #define USE_BCOPY 1
  616. #endif
  617.  
  618. #ifdef USE_INDEX
  619. #define strchr index
  620. #define strrchr rindex
  621. extern char *index();
  622. extern char *rindex();
  623. #endif
  624.  
  625. #ifdef USE_BCOPY
  626. #define memcmp        bcmp
  627. #define memcpy(a,b,c)    bcopy(b,a,c)
  628. #define memset(a,c,b)    bfill(a,b,c)
  629. #endif
  630.  
  631. /*    System dependent library redefinitions, structures and includes    */
  632.  
  633. #if    TURBO
  634. #include      <dos.h>
  635. #include      <mem.h>
  636. #undef peek
  637. #undef poke
  638. #define       peek(a,b,c,d)   movedata(a,b,FP_SEG(c),FP_OFF(c),d)
  639. #define       poke(a,b,c,d)   movedata(FP_SEG(c),FP_OFF(c),a,b,d)
  640. #endif
  641.  
  642. #if    VMS
  643. #define    getname    xgetname
  644. #endif
  645.  
  646. #if    LATTICE
  647. #define    unsigned
  648. #endif
  649.  
  650. #if    AZTEC
  651. #undef    fputc
  652. #undef    fgetc
  653. #if    MSDOS
  654. #define    fgetc    a1getc
  655. #else
  656. #define    fgetc    agetc
  657. #endif
  658. #define    fputc    aputc
  659. #define    int86    sysint
  660. #define    intdos(a, b)    sysint(33, a, b)
  661. #define    inp    inportb
  662. #define    outp    outportb
  663.  
  664. struct XREG {
  665.     int ax,bx,cx,dx,si,di;
  666. };
  667.  
  668. struct HREG {
  669.     char al,ah,bl,bh,cl,ch,dl,dh;
  670. };
  671.  
  672. union REGS {
  673.     struct XREG x;
  674.     struct HREG h;
  675. };
  676. #endif
  677.  
  678. #if    MSDOS && MWC86
  679. #include    <dos.h>
  680. #define    int86(a, b, c)    intcall(b, c, a)
  681. #define    inp    in
  682.  
  683. struct XREG {
  684.     int ax,bx,cx,dx,si,di,ds,es,flags;
  685. };
  686.  
  687. struct HREG {
  688.     char al,ah,bl,bh,cl,ch,dl,dh;
  689.     int ds,es,flags;
  690. };
  691.  
  692. union REGS {
  693.     struct XREG x;
  694.     struct HREG h;
  695. };
  696. #endif
  697.  
  698. #if    MSDOS && ( MSC || ZTC )
  699. #include    <dos.h>
  700. #include    <memory.h>
  701. #define    peek(a,b,c,d)    movedata(a,b,FP_SEG(c),FP_OFF(c),d)
  702. #define    poke(a,b,c,d)    movedata(FP_SEG(c),FP_OFF(c),a,b,d)
  703. #define    movmem(a, b, c)        memcpy(b, a, c)
  704. #endif
  705.  
  706. #if    MSDOS && LATTICE
  707. #undef    CPM
  708. #undef    LATTICE
  709. #include    <dos.h>
  710. #undef    CPM
  711. #endif
  712.  
  713. #if    VMS
  714. #define    unlink(a)    delete(a)
  715. #endif
  716.  
  717. /*    define some ability flags */
  718.  
  719. #if    IBMPC || Z309
  720. #define    MEMMAP    1
  721. #else
  722. #define    MEMMAP    0
  723. #endif
  724.  
  725. #if    ((MSDOS) && (LATTICE || AZTEC || MSC || TURBO || ZTC)) || UNIX
  726. #define    ENVFUNC    1
  727. #else
  728. #define    ENVFUNC    0
  729. #endif
  730.  
  731. /*    internal constants    */
  732.  
  733. #define    NBINDS    100            /* max # of bound prefixed keys    */
  734. #define NFILEN    256            /* # of bytes, file name    */
  735. #define NBUFN    20            /* # of bytes, buffer name    */
  736. #define NLINE    256            /* # of bytes, input line    */
  737. #define    NSTRING    128            /* # of bytes, string buffers    */
  738. #define NKBDM    256            /* # of strokes, keyboard macro */
  739. #define NPAT    128            /* # of bytes, pattern        */
  740. #define HUGE    60000            /* Huge number            */
  741. #define    NLOCKS    100            /* max # of file locks active    */
  742. #define    NCOLORS    8            /* number of supported colors    */
  743. #define    KBLOCK    256            /* sizeof kill buffer chunks    */
  744. #define    NKREGS    36            /* number of kill buffers    */
  745. #define    NBLOCK    16            /* line block chunk size    */
  746. #define    NVSIZE    10            /* max #chars in a var name    */
  747.  
  748. /* SPEC is just 8th bit set, for convenience in some systems (like NeWS?) */
  749. #define SPEC    0x0080            /* special key (function keys)    */
  750. #define CTLA    0x0100            /* ^A flag, or'ed in        */
  751. #define CTLX    0x0200            /* ^X flag, or'ed in        */
  752.  
  753. #define kcod2key(c) (c & 0x7f)        /* strip off the above prefixes */
  754.  
  755. #ifdef    FALSE
  756. #undef    FALSE
  757. #endif
  758. #ifdef    TRUE
  759. #undef    TRUE
  760. #endif
  761.  
  762. #define FALSE    0            /* False, no, bad, etc.     */
  763. #define TRUE    1            /* True, yes, good, etc.    */
  764. #define ABORT    2            /* Death, ESC, abort, etc.    */
  765. #define    FAILED    3            /* not-quite fatal false return    */
  766. #define    SORTOFTRUE    4        /* really!    */
  767.  
  768. #define    STOP    0            /* keyboard macro not in use    */
  769. #define    PLAY    1            /*    "     "      playing    */
  770. #define    RECORD    2            /*    "     "   recording    */
  771. #define    TMPSTOP    3            /* temporary stop, record can resume */
  772.  
  773. /* flook options */
  774. #define FL_HERE 1
  775. #define FL_HERE_HOME 2
  776. #define FL_ANYWHERE 3
  777.  
  778. /* bfind options */
  779. #define OK_CREAT TRUE
  780. #define NO_CREAT FALSE
  781.  
  782. /* kbd_string options */
  783. #define EXPAND TRUE
  784. #define NO_EXPAND FALSE
  785.  
  786. /*    Directive definitions    */
  787.  
  788. #if ! SMALLER
  789.  
  790. #define    DIF        0
  791. #define DELSE        1
  792. #define DENDIF        2
  793. #define DGOTO        3
  794. #define DRETURN        4
  795. #define DENDM        5
  796. #define DWHILE        6
  797. #define    DENDWHILE    7
  798. #define    DBREAK        8
  799. #define DFORCE        9
  800.  
  801. #define NUMDIRS        10
  802.  
  803. #else
  804.  
  805. #define DENDM        0
  806. #define NUMDIRS        1
  807.  
  808. #endif
  809.  
  810. /*
  811.  * PTBEG, PTEND, FORWARD, and REVERSE are all toggle-able values for
  812.  * the scan routines.
  813.  */
  814. #define    PTBEG    0    /* Leave the point at the beginning on search    */
  815. #define    PTEND    1    /* Leave the point at the end on search        */
  816. #define    FORWARD    0            /* forward direction        */
  817. #define REVERSE    1            /* backwards direction        */
  818.  
  819. #define FIOSUC    0            /* File I/O, success.        */
  820. #define FIOFNF    1            /* File I/O, file not found.    */
  821. #define FIOEOF    2            /* File I/O, end of file.    */
  822. #define FIOERR    3            /* File I/O, error.        */
  823. #define    FIOMEM    4            /* File I/O, out of memory    */
  824. #define    FIOFUN    5            /* File I/O, eod of file/bad line*/
  825. #define    FIOABRT    6            /* File I/O, aborted        */
  826.  
  827. /* three flavors of insert mode    */
  828. /* it's FALSE, or one of:    */
  829. #define INSERT 1
  830. #define OVERWRITE 2
  831. #define REPLACECHAR 3
  832.  
  833. /* kill register control */
  834. #define KNEEDCLEAN   0x01        /* Kill register needs cleaning */
  835. #define KYANK    0x02            /* Kill register resulted from yank */
  836. #define KLINES    0x04            /* Kill register contains full lines */
  837. #define KAPPEND  0x04            /* Kill register should be appended */
  838.  
  839. /* operator types.  Needed mainly because word movement changes depending on
  840.     whether operator is "delete" or not.  Aargh.  */
  841. #define OPDEL 1
  842. #define OPOTHER 2
  843.  
  844. /* define these so C-fence matching doesn't get confused when we're editing
  845.     the cfence code itself */
  846. #define LBRACE '{'
  847. #define RBRACE '}'
  848.  
  849.  
  850. #if UNIX
  851. #define    PATHCHR    ':'
  852. #else
  853. #define    PATHCHR    ';'
  854. #endif
  855.  
  856. /* how big is the ascii rep. of an int? */
  857. #define    INTWIDTH    sizeof(int) * 3
  858.  
  859. /*    Macro argument token types                    */
  860.  
  861. #define    TKNUL    0            /* end-of-string        */
  862. #define    TKARG    1            /* interactive argument        */
  863. #define    TKBUF    2            /* buffer argument        */
  864. #define    TKVAR    3            /* user variables        */
  865. #define    TKENV    4            /* environment variables    */
  866. #define    TKFUN    5            /* function....            */
  867. #define    TKDIR    6            /* directive            */
  868. #define    TKLBL    7            /* line label            */
  869. #define    TKLIT    8            /* numeric literal        */
  870. #define    TKSTR    9            /* quoted string literal    */
  871. #define    TKCMD    10            /* command name            */
  872.  
  873. /*    Internal defined functions                    */
  874.  
  875. #define    nextab(a)    (((a / curtabval) + 1) * curtabval)
  876. #define    nextsw(a)    (((a / curswval) + 1) * curswval)
  877.  
  878. /* these are the bits that go into the _chartypes_ array */
  879. /* the macros below test for them */
  880. #define N_chars 128
  881. #define _upper    0x1        /* upper case */
  882. #define _lower    0x2        /* lower case */
  883. #define _digit    0x4        /* digits */
  884. #define _space    0x8        /* whitespace */
  885. #define _bspace 0x10        /* backspace character (^H, DEL, and user's) */
  886. #define _cntrl    0x20        /* control characters, including DEL */
  887. #define _print    0x40        /* printable */
  888. #define _punct    0x80        /* punctuation */
  889. #define _ident    0x100        /* is typically legal in "normal" identifier */
  890. #define _pathn    0x200        /* is typically legal in a file's pathname */
  891. #define _wild    0x400        /* is typically a shell wildcard char */
  892. #define _linespec 0x800        /* ex-style line range: 1,$ or 13,15 or % etc.*/
  893. #define _fence    0x1000        /* a fence, i.e. (, ), [, ], {, } */
  894. #define _nonspace    0x2000    /* non-whitespace */
  895. #define _qident    0x4000        /* is typically legal in "qualified" identifier */
  896.  
  897. /* these intentionally match the ctypes.h definitions, except that
  898.     they force the char to 7-bit ascii first */
  899. #define istype(sometype,c)    (_chartypes_[(c)&(N_chars-1)] & (sometype))
  900. #define islower(c)    istype(_lower, c)
  901. #define isupper(c)    istype(_upper, c)
  902. #define isdigit(c)    istype(_digit, c)
  903. #define isspace(c)    istype(_space, c)
  904. #define iscntrl(c)    istype(_cntrl, c)
  905. #define isprint(c)    istype(_print, c)
  906. #define ispunct(c)    istype(_punct, c)
  907. #define iswild(c)    istype(_wild, c)
  908. #define isalpha(c)    istype(_lower|_upper, c)
  909. #define isalnum(c)    istype(_lower|_upper|_digit, c)
  910. #define isident(c)    istype(_ident, c)
  911. #define ispath(c)    istype(_pathn, c)
  912. #define isbackspace(c)    istype(_bspace, c)
  913. #define islinespecchar(c)    istype(_linespec, c)
  914. #define isfence(c)    istype(_fence, c)
  915.  
  916. /* DIFCASE represents the difference between upper
  917.    and lower case letters, DIFCNTRL the difference between upper case and
  918.    control characters.    They are xor-able values.  */
  919. #define    DIFCASE        0x20
  920. #define    DIFCNTRL    0x40
  921. #define toupper(c)    ((c)^DIFCASE)
  922. #define tolower(c)    ((c)^DIFCASE)
  923. #define tocntrl(c)    ((c)^DIFCNTRL)
  924. #define toalpha(c)    ((c)^DIFCNTRL)
  925.  
  926. #define nocase_eq(bc,pc)    ((bc) == (pc) || \
  927.             (isalpha(bc) && (((bc) ^ DIFCASE) == (pc))))
  928.  
  929. #define ESC    tocntrl('[')
  930. #define RECORDED_ESC    -2
  931.  
  932. #define BEL    tocntrl('G')    /* ascii bell character        */
  933.  
  934. /*    Dynamic RAM tracking and reporting redefinitions    */
  935.  
  936. #if    RAMSIZE
  937. #define    malloc    allocate
  938. #define    free    release
  939. #endif
  940.  
  941. #if VMALLOC
  942. char *vmalloc();
  943. void vfree();
  944. void rvverify();
  945. char *vrealloc();
  946. char *vcalloc();
  947. void vdump();
  948. # define malloc(x) vmalloc(x,__FILE__,__LINE__)
  949. # define free(x) vfree(x,__FILE__,__LINE__)
  950. # define realloc(x,y) vrealloc(x,y,__FILE__,__LINE__)
  951. # define calloc(x,y) vcalloc(x,y,__FILE__,__LINE__)
  952. # define vverify(s) rvverify(s,__FILE__,__LINE__)
  953. #else
  954. # define vverify(s) ;
  955. #endif
  956.  
  957. /*
  958.  * Definitions etc. for regexp(3) routines.
  959.  *
  960.  *    the regexp code is:
  961.  *    Copyright (c) 1986 by University of Toronto.
  962.  *    Written by Henry Spencer.  Not derived from licensed software.
  963.  *
  964.  */
  965. #define NSUBEXP  10
  966. typedef struct regexp {
  967.     char *startp[NSUBEXP];
  968.     char *endp[NSUBEXP];
  969.     short mlen;        /* convenience:  endp[0] - startp[0] */
  970.     char regstart;        /* Internal use only. */
  971.     char reganch;        /* Internal use only. */
  972.     int regmust;        /* Internal use only. */
  973.     int regmlen;        /* Internal use only. */
  974.     unsigned size;        /* vile addition -- how big is this */
  975.     char program[1];    /* Unwarranted chumminess with compiler. */
  976. } regexp;
  977.  
  978. extern regexp *regcomp();
  979. extern int regexec();
  980. extern void regsub();
  981. extern void regerror();
  982.  
  983. /*
  984.  * The first byte of the regexp internal "program" is actually this magic
  985.  * number; the start node begins in the second byte.
  986.  */
  987. #define    REGEXP_MAGIC    0234
  988.  
  989. #ifndef CHARBITS
  990. #define    UCHARAT(p)    ((int)*(unsigned char *)(p))
  991. #else
  992. #define    UCHARAT(p)    ((int)*(p)&CHARBITS)
  993. #endif
  994.  
  995. /* end of regexp stuff */
  996.  
  997. /*
  998.  * All text is kept in circularly linked lists of "LINE" structures. These
  999.  * begin at the header line. This line is pointed to by the "BUFFER".
  1000.  * Each line contains:
  1001.  *  number of bytes in the line (the "used" size), 
  1002.  *  the size of the text array,
  1003.  *  the text.
  1004.  * The end of line is not stored as a byte; it's implied. Future
  1005.  * additions may include update hints, and a list of marks into the line.
  1006.  *
  1007.  * Lines are additionally sometimes stacked in undo lists.
  1008.  */
  1009. typedef struct    LINE {
  1010.     struct    LINE *l_fp;        /* Link to the next line    */
  1011.     struct    LINE *l_bp;        /* Link to the previous line    */
  1012.     int   l_size;              /* Allocated size           */
  1013.     int   l_used;              /* Used size              */
  1014.     char *l_text;
  1015.     union {
  1016.         struct  LINE *l_stklnk;    /* Link for undo stack        */
  1017.         long    l_flag;        /* flags for undo ops        */
  1018.     } l;
  1019. }    LINE;
  1020.  
  1021. /* flag values */
  1022. #define LCOPIED 1    /* original line is already on an undo stack */
  1023. #define LGMARK 2    /* line matched a global scan */
  1024.  
  1025. /* macros to ease the use of lines */
  1026. #define lforw(lp)    ((lp)->l_fp)
  1027. #define lback(lp)    ((lp)->l_bp)
  1028. #define lgetc(lp, n)    ((lp)->l_text[(n)]&0xFF)
  1029. #define lputc(lp, n, c) ((lp)->l_text[(n)]=(c))
  1030. #define llength(lp)    ((lp)->l_used)
  1031. #define l_nxtundo    l.l_stklnk
  1032. #define liscopied(lp)    (lp->l.l_flag & LCOPIED)
  1033. #define lismarked(lp)    (lp->l.l_flag & LGMARK)
  1034. #define lsetcopied(lp)        (lp->l.l_flag |= LCOPIED)
  1035. #define lsetnotcopied(lp)    (lp->l.l_flag &= ~LCOPIED)
  1036. #define lsetmarked(lp)        (lp->l.l_flag |= LGMARK)
  1037. #define lsetnotmarked(lp)    (lp->l.l_flag &= ~LGMARK)
  1038. #define lsetclear(lp)    (lp->l.l_flag = 0)
  1039. #define LINENOTREAL    ((int)(-1))
  1040. #define LINEUNDOPATCH    ((int)(-2))
  1041. #define MARKPATCH    ((int)(-3))
  1042. #define lisreal(lp)    ((lp)->l_used >= 0)
  1043. #define lisnotreal(lp)       ((lp)->l_used == LINENOTREAL)
  1044. #define lislinepatch(lp)     ((lp)->l_used == LINEUNDOPATCH)
  1045. #define lismarkpatch(lp)     ((lp)->l_used == MARKPATCH)
  1046. #define lispatch(lp)     (lislinepatch(lp) || lismarkpatch(lp))
  1047. #define lneedscopying(lp)     ((lp)->l_copied != TRUE)
  1048.  
  1049. /* marks are a line and an offset into that line */
  1050. typedef struct MARK {
  1051.     LINE *l;
  1052.     int o;
  1053. } MARK;
  1054.  
  1055. /* some macros that take marks as arguments */
  1056. #define is_at_end_of_line(m)    (m.o == llength(m.l))
  1057. #define is_empty_line(m)    (llength(m.l) == 0)
  1058. #define sameline(m1,m2)        (m1.l == m2.l)
  1059. #define samepoint(m1,m2)    ((m1.l == m2.l) && (m1.o == m2.o))
  1060. #define char_at(m)        (lgetc(m.l,m.o))
  1061. #define put_char_at(m,c)    (lputc(m.l,m.o,c))
  1062. #define is_header_line(m,bp)    ( m.l == bp->b_line.l)
  1063. #define is_last_line(m,bp)    ( lforw(m.l) == bp->b_line.l)
  1064. #define is_first_line(m,bp)    ( lback(m.l) == bp->b_line.l)
  1065.  
  1066. /* settable values have their names stored here, along with a synonym, and
  1067.     what type they are */
  1068. struct VALNAMES {
  1069.         char *name;
  1070.         char *shortname;
  1071.         short type;
  1072. };
  1073. /* the values of VALNAMES->type */
  1074. #define VALTYPE_INT 0
  1075. #define VALTYPE_STRING 1
  1076. #define VALTYPE_BOOL 2
  1077. #define VALTYPE_REGEX 3
  1078.  
  1079. struct regexval {
  1080.     char *pat;
  1081.     regexp *reg;
  1082. };
  1083.  
  1084. /* this is to ensure values can be of any type we wish.
  1085.    more can be added if needed.  */
  1086. union V {
  1087.     int i;
  1088.     char *p;
  1089.     struct regexval *r;
  1090. };
  1091.  
  1092. struct VAL {
  1093.     union V v;
  1094.     union V *vp;
  1095. };
  1096.  
  1097. /* these are the boolean, integer, and pointer value'd settings that are
  1098.     associated with a window, and usually settable by a user.  There
  1099.     is a global set that is inherited into a buffer, and its windows
  1100.     in turn are inherit the buffer's set. */
  1101. #define    WMDLIST        0        /* "list" mode -- show tabs and EOL */
  1102. /* put more boolean-valued things here */
  1103. #define    MAX_BOOL_W_VALUE    0    /* max of boolean values    */
  1104.  
  1105. #define WVAL_SIDEWAYS    (MAX_BOOL_W_VALUE+1)
  1106. #define WVAL_FCOLOR    (MAX_BOOL_W_VALUE+2)
  1107. #define WVAL_BCOLOR    (MAX_BOOL_W_VALUE+3)
  1108. /* put more int-valued things here */
  1109. #define    MAX_INT_W_VALUE    (MAX_BOOL_W_VALUE+3) /* max of integer-valued modes */
  1110.  
  1111. /* put more string-valued things here */
  1112. #define    MAX_STRING_W_VALUE (MAX_INT_W_VALUE+0) /* max of string-valued modes */
  1113. #define    MAX_W_VALUES    (MAX_STRING_W_VALUE) /* max of buffer values */
  1114.  
  1115. typedef struct W_VALUES {
  1116.     /* each entry is a val, and a ptr to a val */
  1117.     struct VAL wv[MAX_W_VALUES+1];
  1118. } W_VALUES;
  1119.  
  1120.  
  1121. /* these are window properties affecting window appearance _only_ */
  1122. typedef struct    W_TRAITS {
  1123.     MARK     w_dt;            /* Line containing "."           */
  1124.         /* i don't think "mark" needs to be here -- I think it 
  1125.             could safely live only in the buffer -pgf */
  1126. #ifdef WINMARK
  1127.     MARK     w_mk;                /* Line containing "mark"      */
  1128. #endif
  1129.     MARK     w_ld;                /* Line containing "lastdotmark"*/
  1130.     MARK     w_ln;        /* Top line in the window (offset unused) */
  1131.     W_VALUES w_vals;
  1132. } W_TRAITS;
  1133.  
  1134. #define global_w_val(which) global_w_values.wv[which].v.i
  1135. #define set_global_w_val(which,val) global_w_val(which) = val
  1136. #define global_w_val_ptr(which) global_w_values.wv[which].v.p
  1137. #define set_global_w_val_ptr(which,val) global_w_val_ptr(which) = val
  1138.  
  1139. #define w_val(wp,val) (wp->w_traits.w_vals.wv[val].vp->i)
  1140. #define set_w_val(wp,which,val) w_val(wp,which) = val
  1141. #define w_val_ptr(wp,val) (wp->w_traits.w_vals.wv[val].vp->p)
  1142. #define set_w_val_ptr(wp,which,val) w_val_ptr(wp,which) = val
  1143.  
  1144. #define make_local_w_val(wp,which)  \
  1145.     wp->w_traits.w_vals.wv[which].vp = &(wp->w_traits.w_vals.wv[which].v)
  1146. #define make_global_w_val(wp,which)  \
  1147.     wp->w_traits.w_vals.wv[which].vp = &(global_wvalues.wv[which].v)
  1148.  
  1149. #define is_global_w_val(wp,which)  \
  1150.     (wp->w_traits.w_vals.wv[which].vp == &(global_w_values.wv[which].v))
  1151. #define is_local_w_val(wp,which)  \
  1152.     (wp->w_traits.w_vals.wv[which].vp == &(wp->w_traits.w_vals.wv[which].v))
  1153.  
  1154. #define gfcolor global_w_val(WVAL_FCOLOR)
  1155. #define gbcolor global_w_val(WVAL_BCOLOR)
  1156.  
  1157. /* buffer mode flags    */
  1158. /* the indices of B_VALUES.v[] */
  1159. /* the first set are boolean */
  1160. #define    MDAIND        0        /* auto-indent */
  1161. #define    MDASAVE        1        /* auto-save mode        */
  1162. #define    MDBACKLIMIT    2        /* backspace limited in insert mode */
  1163. #define    MDCMOD        3        /* C indentation and fence match*/
  1164. #define    MDCRYPT        4        /* encrytion mode active    */
  1165. #define    MDDOS        5        /* "dos" mode -- lines end in crlf */
  1166. #define    MDIGNCASE    6        /* Exact matching for searches    */
  1167. #define MDMAGIC        7        /* regular expressions in search */
  1168. #define    MDSHOWMAT    8        /* auto-indent */
  1169. #define    MDSHOWMODE    9        /* show insert/replace/command mode */
  1170. #define    MDTABINSERT    10        /* okay to insert tab chars     */
  1171. #define    MDTAGSRELTIV    11        /* tags are relative to tagsfile path */
  1172. #define    MDTERSE        12        /* be terse -- suppress messages */
  1173. #define    MDVIEW        13        /* read-only buffer        */
  1174. #define    MDSWRAP     14        /* wrap-around search mode    */
  1175. #define    MDWRAP        15        /* word wrap            */
  1176. #define    MAX_BOOL_B_VALUE    15    /* max of boolean values    */
  1177.  
  1178. #define VAL_ASAVECNT    (MAX_BOOL_B_VALUE+1)
  1179. #define VAL_C_SWIDTH    (MAX_BOOL_B_VALUE+2)
  1180. #define VAL_C_TAB    (MAX_BOOL_B_VALUE+3)
  1181. #define VAL_FILL    (MAX_BOOL_B_VALUE+4)
  1182. #define VAL_SWIDTH    (MAX_BOOL_B_VALUE+5)
  1183. #define VAL_TAB        (MAX_BOOL_B_VALUE+6)
  1184. #define VAL_TAGLEN    (MAX_BOOL_B_VALUE+7)
  1185. #define    MAX_INT_B_VALUE    (MAX_BOOL_B_VALUE+7) /* max of integer-valued modes */
  1186.  
  1187. #define VAL_CWD        (MAX_INT_B_VALUE+1)
  1188. #define VAL_TAGS    (MAX_INT_B_VALUE+2)
  1189. #define    MAX_STRING_B_VALUE (MAX_INT_B_VALUE+2) /* max of string-valued modes */
  1190.  
  1191. #define VAL_CSUFFIXES    (MAX_STRING_B_VALUE+1)
  1192. #define VAL_COMMENTS    (MAX_STRING_B_VALUE+2)
  1193. #define VAL_PARAGRAPHS    (MAX_STRING_B_VALUE+3)
  1194. #define VAL_SECTIONS    (MAX_STRING_B_VALUE+4)
  1195. #define VAL_SENTENCES    (MAX_STRING_B_VALUE+5)
  1196. #define    MAX_REGEX_B_VALUE (MAX_STRING_B_VALUE+5) /* max of string-valued modes */
  1197.  
  1198. #define    MAX_B_VALUES    (MAX_REGEX_B_VALUE) /* max of buffer values */
  1199.  
  1200. typedef struct B_VALUES {
  1201.     /* each entry is a val, and a ptr to a val */
  1202.     struct VAL bv[MAX_B_VALUES+1];
  1203. } B_VALUES;
  1204.  
  1205. /*
  1206.  * Text is kept in buffers. A buffer header, described below, exists for every
  1207.  * buffer in the system. The buffers are kept in a big list, so that commands
  1208.  * that search for a buffer by name can find the buffer header. There is a
  1209.  * safe store for the dot and mark in the header, but this is only valid if
  1210.  * the buffer is not being displayed (that is, if "b_nwnd" is 0). The text for
  1211.  * the buffer is kept in a circularly linked list of lines, with a pointer to
  1212.  * the header line in "b_line"    Buffers may be "Inactive" which means the files associated with them
  1213.  * have not been read in yet. These get read in at "use buffer" time.
  1214.  */
  1215.  
  1216. typedef struct    BUFFER {
  1217.     MARK     b_line;        /* Link to the header LINE (offset unused) */
  1218.     struct    BUFFER *b_bufp;     /* Link to next BUFFER        */
  1219.     MARK     *b_nmmarks;        /* named marks a-z        */
  1220.     B_VALUES b_values;        /* buffer traits we inherit from */
  1221.                     /*  global values        */
  1222.     struct    W_TRAITS b_wtraits;    /* saved window traits, while we're */
  1223.                     /*  not displayed        */
  1224.     long    b_linecount;        /* no. lines as of last read/write */
  1225.     LINE     *b_udstks[2];        /* undo stack pointers        */
  1226.     MARK     b_uddot[2];        /* Link to "." before undoable op*/
  1227.     short    b_udstkindx;        /* which of above to use    */
  1228.     LINE    *b_LINEs;        /* block-malloced LINE structs */
  1229.     LINE    *b_LINEs_end;        /* end of     "    "    " */
  1230.     LINE    *b_freeLINEs;        /* list of free "     "    " */
  1231.     unsigned char    *b_ltext;    /* block-malloced text */
  1232.     unsigned char    *b_ltext_end;    /* end of block-malloced text */
  1233.     LINE     *b_ulinep;        /* pointer at 'Undo' line    */
  1234.     int    b_active;        /* window activated flag    */
  1235.     int    b_nwnd;                /* Count of windows on buffer   */
  1236.     int    b_flag;                /* Flags                 */
  1237.     short    b_acount;        /* auto-save count            */
  1238.     char    *b_fname;        /* File name            */
  1239.     int    b_fnlen;        /* length of filename        */
  1240.     char    b_bname[NBUFN];     /* Buffer name            */
  1241. #if    CRYPT
  1242.     char    b_key[NPAT];        /* current encrypted key    */
  1243. #endif
  1244. }    BUFFER;
  1245.  
  1246. #define global_b_val(which) global_b_values.bv[which].v.i
  1247. #define set_global_b_val(which,val) global_b_val(which) = val
  1248. #define global_b_val_ptr(which) global_b_values.bv[which].v.p
  1249. #define set_global_b_val_ptr(which,val) global_b_val_ptr(which) = val
  1250. #define global_b_val_rexp(which) global_b_values.bv[which].v.r
  1251. #define set_global_b_val_rexp(which,val) global_b_val_rexp(which) = val
  1252.  
  1253. #define b_val(bp,val) (bp->b_values.bv[val].vp->i)
  1254. #define set_b_val(bp,which,val) b_val(bp,which) = val
  1255. #define b_val_ptr(bp,val) (bp->b_values.bv[val].vp->p)
  1256. #define set_b_val_ptr(bp,which,val) b_val_ptr(bp,which) = val
  1257. #define b_val_rexp(bp,val) (bp->b_values.bv[val].vp->r)
  1258. #define set_b_val_rexp(bp,which,val) b_val_rexp(bp,which) = val
  1259.  
  1260. #define make_local_b_val(bp,which)  \
  1261.         bp->b_values.bv[which].vp = &(bp->b_values.bv[which].v)
  1262. #define make_global_b_val(bp,which)  \
  1263.         bp->b_values.bv[which].vp = &(global_b_values.bv[which].v)
  1264.  
  1265. #define is_global_b_val(bp,which)  \
  1266.         (bp->b_values.bv[which].vp == &(global_b_values.bv[which].v))
  1267. #define is_local_b_val(bp,which)  \
  1268.         (bp->b_values.bv[which].vp == &(bp->b_values.bv[which].v))
  1269.  
  1270. #define is_empty_buf(bp) (lforw(bp->b_line.l) == bp->b_line.l)
  1271. #define b_dot b_wtraits.w_dt
  1272. #ifdef WINMARK
  1273. #define b_mark b_wtraits.w_mk
  1274. #endif
  1275. #define b_lastdot b_wtraits.w_ld
  1276. #define b_wline b_wtraits.w_ln
  1277.  
  1278. /* values for b_flag */
  1279. #define BFINVS    0x01            /* Internal invisible buffer    */
  1280. #define BFCHG    0x02            /* Changed since last write    */
  1281. #define BFSCRTCH   0x04         /* scratch -- gone on last close */
  1282.  
  1283. /*
  1284.  * There is a window structure allocated for every active display window. The
  1285.  * windows are kept in a big list, in top to bottom screen order, with the
  1286.  * listhead at "wheadp". Each window contains its own values of dot and mark.
  1287.  * The flag field contains some bits that are set by commands to guide
  1288.  * redisplay. Although this is a bit of a compromise in terms of decoupling,
  1289.  * the full blown redisplay is just too expensive to run for every input
  1290.  * character.
  1291.  */
  1292.  
  1293. typedef struct    WINDOW {
  1294.     W_TRAITS w_traits;        /* features of the window we should */
  1295.                     /*  remember between displays */
  1296.     struct    WINDOW *w_wndp;     /* Next window            */
  1297.     BUFFER  *w_bufp;         /* Buffer displayed in window    */
  1298.     int    w_toprow;            /* Origin 0 top row of window   */
  1299.     int    w_ntrows;            /* # of rows of text in window  */
  1300.     int    w_force;             /* If non-zero, forcing row.    */
  1301.     int    w_flag;                /* Flags.                */
  1302. }    WINDOW;
  1303.  
  1304. #define w_dot w_traits.w_dt
  1305. #ifdef WINMARK
  1306. #define w_mark w_traits.w_mk
  1307. #endif
  1308. #define w_lastdot w_traits.w_ld
  1309. #define w_line w_traits.w_ln
  1310. #define w_values w_traits.w_vals
  1311. #define w_mode w_traits.w_vals.w_mod
  1312.  
  1313. #define DOT curwp->w_traits.w_dt
  1314. #ifdef WINMARK
  1315. #define MK curwp->w_traits.w_mk
  1316. #else
  1317. #define MK Mark
  1318. #endif
  1319.  
  1320. #define WFFORCE 0x01            /* Window needs forced reframe    */
  1321. #define WFMOVE    0x02            /* Movement from line to line    */
  1322. #define WFEDIT    0x04            /* Editing within a line    */
  1323. #define WFHARD    0x08            /* Better do a full display    */
  1324. #define WFMODE    0x10            /* Update mode line.        */
  1325. #define    WFCOLR    0x20            /* Needs a color change        */
  1326. #define    WFKILLS    0x40            /* something was deleted    */
  1327. #define    WFINS    0x80            /* something was inserted    */
  1328.  
  1329.  
  1330. /* the next set are global, bit-mapped, but are meaningless per-buffer */
  1331. #define    NUMOTHERMODES    2 /* # of defined modes        */
  1332. #define OTH_LAZY 0x01
  1333. #define OTH_VERS 0x02
  1334.  
  1335.  
  1336. /*
  1337.  * The starting position of a region, and the size of the region in
  1338.  * characters, is kept in a region structure.  Used by the region commands.
  1339.  */
  1340. typedef struct    {
  1341.     MARK     r_orig;            /* Origin LINE address.     */
  1342.     MARK    r_end;            /* Ending LINE address.     */
  1343.     long    r_size;         /* Length in characters.    */
  1344. }    REGION;
  1345.  
  1346. /*
  1347.  * The editor communicates with the display using a high level interface. A
  1348.  * "TERM" structure holds useful variables, and indirect pointers to routines
  1349.  * that do useful operations. The low level get and put routines are here too.
  1350.  * This lets a terminal, in addition to having non standard commands, have
  1351.  * funny get and put character code too. The calls might get changed to
  1352.  * "termp->t_field" style in the future, to make it possible to run more than
  1353.  * one terminal type.
  1354.  */
  1355. typedef struct    {
  1356.     int    t_mrow;            /* max number of rows allowable */
  1357.     int    t_nrow;         /* current number of rows used    */
  1358.     int    t_mcol;         /* max Number of columns.    */
  1359.     int    t_ncol;         /* current Number of columns.    */
  1360.     int    t_margin;        /* min margin for extended lines*/
  1361.     int    t_scrsiz;        /* size of scroll region "    */
  1362.     int    t_pause;        /* # times thru update to pause */
  1363.     void    (*t_open)();        /* Open terminal at the start.    */
  1364.     void    (*t_close)();        /* Close terminal at end.    */
  1365.     void    (*t_kopen)();        /* Open keyboard        */
  1366.     void    (*t_kclose)();        /* close keyboard        */
  1367.     int    (*t_getchar)();     /* Get character from keyboard. */
  1368.     void    (*t_putchar)();     /* Put character to display.    */
  1369.     void    (*t_flush)();        /* Flush output buffers.    */
  1370.     void    (*t_move)();        /* Move the cursor, origin 0.    */
  1371.     void    (*t_eeol)();        /* Erase to end of line.    */
  1372.     void    (*t_eeop)();        /* Erase to end of page.    */
  1373.     void    (*t_beep)();        /* Beep.            */
  1374.     void    (*t_rev)();        /* set reverse video state    */
  1375.     int    (*t_rez)();        /* change screen resolution    */
  1376. #if    COLOR
  1377.     void    (*t_setfor)();        /* set foreground color        */
  1378.     void    (*t_setback)();        /* set background color        */
  1379. #endif
  1380. #if    SCROLLCODE
  1381.     void    (*t_scroll)();        /* scroll a region of the screen */
  1382. #endif
  1383. }    TERM;
  1384.  
  1385. /*    TEMPORARY macros for terminal I/O  (to be placed in a machine
  1386.                         dependent place later)    */
  1387.  
  1388. #define    TTopen        (*term.t_open)
  1389. #define    TTclose        (*term.t_close)
  1390. #define    TTkopen        (*term.t_kopen)
  1391. #define    TTkclose    (*term.t_kclose)
  1392. #define    TTgetc        (*term.t_getchar)
  1393. #if ! TERMCAP
  1394. #define    TTputc        (*term.t_putchar)
  1395. #else
  1396. #define    TTputc        putchar
  1397. #endif
  1398. #define    TTflush        (*term.t_flush)
  1399. #define    TTmove        (*term.t_move)
  1400. #define    TTeeol        (*term.t_eeol)
  1401. #define    TTeeop        (*term.t_eeop)
  1402. #define    TTbeep        (*term.t_beep)
  1403. #define    TTrev        (*term.t_rev)
  1404. #define    TTrez        (*term.t_rez)
  1405. #if    COLOR
  1406. #define    TTforg        (*term.t_setfor)
  1407. #define    TTbacg        (*term.t_setback)
  1408. #endif
  1409.  
  1410. typedef struct  VIDEO {
  1411.         int    v_flag;                 /* Flags */
  1412. #if    COLOR
  1413.     int    v_fcolor;        /* current forground color */
  1414.     int    v_bcolor;        /* current background color */
  1415.     int    v_rfcolor;        /* requested forground color */
  1416.     int    v_rbcolor;        /* requested background color */
  1417. #endif
  1418.     /* allocate 4 bytes here, and malloc 4 bytes less than we need,
  1419.         to keep malloc from rounding up. */
  1420.         char    v_text[4];              /* Screen data. */
  1421. }       VIDEO;
  1422.  
  1423. #define VFCHG   0x0001                  /* Changed flag            */
  1424. #define    VFEXT    0x0002            /* extended (beyond column 80)    */
  1425. #define    VFREV    0x0004            /* reverse video status        */
  1426. #define    VFREQ    0x0008            /* reverse video request    */
  1427. #define    VFCOL    0x0010            /* color change requested    */
  1428.  
  1429. #if IBMPC
  1430. /*
  1431.  * these need to go into edef.h eventually!
  1432.  */
  1433. #define    CDCGA    0            /* color graphics card        */
  1434. #define    CDMONO    1            /* monochrome text card        */
  1435. #define    CDEGA    2            /* EGA color adapter        */
  1436. #define    CDVGA    3            /* VGA color adapter        */
  1437. #define    CDSENSE    9            /* detect the card type        */
  1438.  
  1439. #endif
  1440.  
  1441.  
  1442. /* Commands are represented as CMDFUNC structures, which contain a
  1443.  *    pointer to the actual function, and flags which help to classify it.
  1444.  *    (things like is it a MOTION, can it be UNDOne)
  1445.  *
  1446.  *    These structures are generated automatically from the cmdtbl file,
  1447.  *    and can be found in the file nefunc.h
  1448. */
  1449. typedef  struct {
  1450.     int (*c_func)();    /* function name is bound to */
  1451.     unsigned long c_flags;        /* what sort of command is it? */
  1452. }    CMDFUNC;
  1453.  
  1454. /* when referencing a command by name (e.g ":e file") it is looked up in
  1455.  *    the nametbl, which is an array of NTAB structures, containing the
  1456.  *    name, and a pointer to the CMDFUNC structure.  There can be several
  1457.  *    entries pointing at a single CMDFUNC, since a command might have
  1458.  *    several synonymous names.
  1459.  *
  1460.  *    The nametbl array is generated automatically from the cmdtbl file,
  1461.  *    and can be found in the file nename.h
  1462.  */
  1463. typedef struct {
  1464.     char *n_name;
  1465.     CMDFUNC    *n_cmd;
  1466. }    NTAB;
  1467.  
  1468. /* when a command is referenced by bound key (like h,j,k,l, or "dd"), it
  1469.  *    is looked up one of two ways:  single character 7-bit ascii commands
  1470.  *    (by far the majority) are simply indexed into a 128 element array of
  1471.  *    CMDFUNC pointers.  Other commands (those with ^A, ^X, or SPEC
  1472.  *    prefixes) are searched for in a binding table, made up of KBIND
  1473.  *    structures.  This structure contains the command code, and again, a
  1474.  *    pointer to the CMDFUNC structure for the command 
  1475.  *
  1476.  *    The asciitbl array, and the kbindtbl array are generated automatically
  1477.  *    from the cmdtbl file, and can be found in the file nebind.h
  1478.  */
  1479. typedef struct {
  1480.     short    k_code;         /* Key code            */
  1481.     CMDFUNC    *k_cmd;
  1482. }    KBIND;
  1483.  
  1484.  
  1485. /* these are the flags which can appear in the CMDFUNC structure, describing
  1486.     a command */
  1487. #define NONE    0L
  1488. #define UNDO    1L    /* command is undo-able, so clean up undo lists */
  1489. #define REDO    2L    /* command is redo-able, record it for dotcmd */
  1490. #define MOTION    4L    /* command causes motion, okay after operator cmds */
  1491. #define FL    8L    /* if command causes motion, opers act on full lines */
  1492. #define ABS    16L    /* command causes absolute (i.e. non-relative) motion */
  1493. #define GOAL    32L    /* column goal should be retained */
  1494. #define GLOBOK    64L    /* permitted after global command */
  1495. #define OPER    128L    /* function is an operator, affects a region */
  1496. #define LISTED    256L    /* internal use only -- used in describing bindings
  1497.                 to only describe each once */
  1498.  
  1499. /* these flags are ex argument descriptors. I simply moved them over 
  1500.     from elvis.  Not all are used or honored or implemented */
  1501. #define FROM    (1L<<16)    /* allow a linespec */
  1502. #define    TO    (2L<<16)    /* allow a second linespec */
  1503. #define BANG    (4L<<16)    /* allow a ! after the command name */
  1504. #define EXTRA    (8L<<16)    /* allow extra args after command name */
  1505. #define XFILE    (16L<<16)    /* expand wildcards in extra part */
  1506. #define NOSPC    (32L<<16)    /* no spaces allowed in the extra part */
  1507. #define    DFLALL    (64L<<16)    /* default file range is 1,$ */
  1508. #define DFLNONE    (128L<<16)    /* no default file range */
  1509. #define NODFL    (256L<<16)    /* do not default to the current file name */
  1510. #define EXRCOK    (512L<<16)    /* can be in a .exrc file */
  1511. #define NL    (1024L<<16)    /* if !exmode, then write a newline first */
  1512. #define PLUS    (2048L<<16)    /* allow a line number, as in ":e +32 foo" */
  1513. #define ZERO    (4096L<<16)    /* allow 0 to be given as a line number */
  1514. #define FILES    (XFILE + EXTRA)    /* multiple extra files allowed */
  1515. #define WORD1    (EXTRA + NOSPC)    /* one extra word allowed */
  1516. #define FILE1    (FILES + NOSPC)    /* 1 file allowed, defaults to current file */
  1517. #define NAMEDF    (FILE1 + NODFL)    /* 1 file allowed, defaults to "" */
  1518. #define NAMEDFS    (FILES + NODFL)    /* multiple files allowed, default is "" */
  1519. #define RANGE    (FROM + TO)    /* range of linespecs allowed */
  1520.  
  1521. /*    The editor holds deleted text chunks in the KILL registers. The
  1522.     kill registers are logically a stream of ascii characters, however
  1523.     due to unpredicatable size, get implemented as a linked
  1524.     list of chunks. (The d_ prefix is for "deleted" text, as k_
  1525.     was taken up by the keycode structure)
  1526. */
  1527.  
  1528. typedef    struct KILL {
  1529.     struct KILL *d_next;    /* link to next chunk, NULL if last */
  1530.     unsigned char d_chunk[KBLOCK];    /* deleted text */
  1531. } KILL;
  1532.  
  1533. typedef struct KILLREG {
  1534.     struct KILL *kbufp;    /* current kill register chunk pointer */
  1535.     struct KILL *kbufh;    /* kill register header pointer    */
  1536.     int   kused;        /* # of bytes used in kill last chunk    */
  1537.     short kbflag;        /* flags describing kill register    */
  1538. } KILLREG;
  1539.  
  1540. /*    When the command interpretor needs to get a variable's name,
  1541.     rather than its value, it is passed back as a VDESC variable
  1542.     description structure. The v_num field is an index into the
  1543.     appropriate variable table.
  1544. */
  1545.  
  1546. typedef struct VDESC {
  1547.     int v_type;    /* type of variable */
  1548.     int v_num;    /* ordinal pointer to variable in list */
  1549. } VDESC;
  1550.  
  1551. /*    The !WHILE directive in the execution language needs to
  1552.     stack references to pending whiles. These are stored linked
  1553.     to each currently open procedure via a linked list of
  1554.     the following structure
  1555. */
  1556.  
  1557. typedef struct WHBLOCK {
  1558.     LINE *w_begin;        /* ptr to !while statement */
  1559.     LINE *w_end;        /* ptr to the !endwhile statement*/
  1560.     int w_type;        /* block type */
  1561.     struct WHBLOCK *w_next;    /* next while */
  1562. } WHBLOCK;
  1563.  
  1564. #define    BTWHILE        1
  1565. #define    BTBREAK        2
  1566.  
  1567. /*
  1568.  * Incremental search defines.
  1569.  */
  1570. #if    ISRCH
  1571.  
  1572. #define    CMDBUFLEN    256    /* Length of our command buffer */
  1573.  
  1574. #define IS_REVERSE    tocntrl('R')    /* Search backward */
  1575. #define    IS_FORWARD    tocntrl('F')    /* Search forward */
  1576.  
  1577. #endif
  1578.  
  1579. #ifndef NULL
  1580. # define NULL 0
  1581. #endif
  1582.  
  1583. /*
  1584.  * General purpose includes
  1585.  */
  1586.  
  1587. #ifdef __STDC__
  1588. #include <stdarg.h>
  1589. #else
  1590. #include <varargs.h>
  1591. #endif
  1592.  
  1593. #include <sys/types.h>
  1594. #include <stdio.h>
  1595. #include <string.h>
  1596.  
  1597. #if POSIX
  1598. #include "unistd.h"
  1599. #include "stdlib.h"
  1600. #else
  1601. # if ! VMALLOC
  1602.  extern char *malloc();
  1603.  extern char *realloc();
  1604. # endif
  1605. extern char *getenv();
  1606. #endif
  1607. #if ! USG
  1608. extern char *getwd();
  1609. extern char *getcwd();
  1610. #endif
  1611.  
  1612. #if HAVE_SELECT
  1613. #if UNIXPC
  1614. #include <select.h>
  1615. #else
  1616. #include <sys/time.h>
  1617. #endif
  1618. #endif
  1619.  
  1620.  
  1621. /*
  1622.  * Local prototypes
  1623.  */
  1624.  
  1625. #include "proto.h"
  1626.  
  1627.