home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / jove414s.zip / jove.h < prev    next >
C/C++ Source or Header  |  1991-06-28  |  5KB  |  194 lines

  1. /***************************************************************************
  2.  * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  3.  * is provided to you without charge, and with no warranty.  You may give  *
  4.  * away copies of JOVE, including sources, provided that this notice is    *
  5.  * included in all the files.                                              *
  6.  ***************************************************************************/
  7.  
  8. /* jove.h header file to be included by EVERYONE */
  9.  
  10. #include <setjmp.h>
  11. #ifndef TUNED
  12. # include "tune.h"
  13. #endif
  14.  
  15. #if !defined(MAC)
  16. # include <sys/types.h>
  17. # include <string.h>
  18. #else
  19. # include <types.h>
  20. #endif
  21.  
  22. /* proto: macro to allow us to prototype any function declaration
  23.  * without upsetting old compilers.
  24.  */
  25.  
  26. #if defined(__STDC__) || defined(USE_PROTOTYPES)
  27. # define proto(x)        x
  28. #else
  29. # define proto(x)        ()
  30. #endif
  31.  
  32. /* There are two ways to handle functions with a variable number of args.
  33.  * The old portable way uses varargs.h.  The way sanctioned by ANSI X3J11
  34.  * uses stdarg.h.
  35.  */
  36. #if defined(__STDC__)
  37. #define    STDARGS    1
  38. # define    va_init(ap, parmN)    { va_start((ap), (parmN)); }
  39. #else
  40. # define    va_init(ap, parmN)    { va_start((ap)); }
  41. #endif
  42.  
  43. /* const: readonly type qualifier */
  44. #ifndef    __STDC__
  45. #define    const    /* Only in ANSI C.  Pity */
  46. #endif    /* !__STDC__ */
  47.  
  48. /* UnivPtr: universal pointer type */
  49. #ifdef    __STDC__
  50. typedef void    *UnivPtr;
  51. typedef const void    *UnivConstPtr;
  52. #else    /* !__STDC__ */
  53. typedef char    *UnivPtr;
  54. typedef const char    *UnivConstPtr;
  55. #endif    /* !__STDC__ */
  56.  
  57. /* According to the ANSI standard for C, any library routine may
  58.  * be defined as a macro with parameters.  In order to prevent
  59.  * the expansion of this macro in a declaration of the routine,
  60.  * ANSI suggests parenthesizing the identifier.  This is a reasonable
  61.  * and legal approach, even for K&R C.
  62.  *
  63.  * A bug in the MIPS compiler used on MIPS, IRIS, and probably other
  64.  * MIPS R[23]000 based systems, causes the compiler to reject
  65.  * these declarations (at least at the current time, 1989 August).
  66.  * To avoid this bug, we conditionally define and use UNMACRO.
  67.  */
  68. #if defined(mips)
  69. # define UNMACRO(proc)    proc
  70. #else
  71. # define UNMACRO(proc)    (proc)
  72. #endif
  73.  
  74. #ifndef    EOF
  75. #define EOF    (-1)
  76. #endif
  77.  
  78. /* typedef structure definitions */
  79. #if defined (IPROCS) || defined (OS2IPROCS)
  80. typedef struct process    Process;
  81. #endif
  82. typedef struct window    Window;
  83. typedef struct position    Bufpos;
  84. typedef struct mark    Mark;
  85. typedef struct buffer    Buffer;
  86. typedef struct line    Line;
  87. typedef struct iobuf    IOBUF;
  88.  
  89. #include "buf.h"
  90. #include "wind.h"
  91. #include "io.h"
  92. #include "dataobj.h"
  93. #include "keymaps.h"
  94. #include "argcount.h"
  95. #include "util.h"
  96. #include "vars.h"
  97. #include "screen.h"
  98. #include "style.h"
  99.  
  100. /* return codes for command completion (all < 0 because >= 0 are
  101.    legitimate offsets into array of strings */
  102.  
  103. #define AMBIGUOUS    (-2)    /* matches more than one at this point */
  104. #define UNIQUE        (-3)    /* matches only one string */
  105. #define ORIGINAL    (-4)    /* matches no strings at all! */
  106. #define NULLSTRING    (-5)    /* just hit return without typing anything */
  107.  
  108. /* values for the `flags' argument to complete */
  109. #define NOTHING        0    /* opposite of RET_STATE */
  110. #define RET_STATE    1    /* return state when we hit return */
  111. #define RCOMMAND    2    /* we are reading a joverc file */
  112. #define CASEIND        4    /* map all to lower case */
  113.  
  114. #define FORWARD        1
  115. #define BACKWARD    (-1)
  116.  
  117. #define ARG_CMD        1
  118. #define LINECMD        2
  119. #define KILLCMD        3    /* so we can merge kills */
  120. #define YANKCMD        4    /* so we can do ESC Y (yank-pop) */
  121.  
  122. extern jmp_buf    mainjmp;
  123.  
  124. /* setjmp/longjmp args for DoKeys() mainjmp */
  125. #define FIRSTCALL    0
  126. #define ERROR        1
  127. #define COMPLAIN    2    /* do the error without a getDOT */
  128. #define QUIT        3    /* leave this level of recursion */
  129.  
  130. #define YES_NODIGIT    2
  131.  
  132. #define INT_OKAY    0
  133. #define INT_BAD        (-1)
  134.  
  135. extern char    NullStr[];
  136. extern char    *ProcFmt;
  137.  
  138. extern int
  139.     InMacDefine,    /* are we defining a macro right now? */
  140.  
  141.     LastKeyStruck,
  142.  
  143.     TOabort,    /* flag set by Typeout() */
  144.     errormsg,    /* last message was an error message
  145.                so don't erase the error before it
  146.                has been read */
  147.     RecDepth,    /* recursion depth */
  148.     InputPending,    /* nonzero if there is input waiting to
  149.                be processed */
  150.  
  151.     InJoverc,
  152.     Interactive,
  153.  
  154.     Crashing,    /* we are in the middle of crashing */
  155.     Asking,        /* are we on read a string from the terminal? */
  156.     InRealAsk,    /* are we currently executing real_ask()? */
  157.     inIOread;    /* so we know whether we can do a redisplay. */
  158.  
  159. extern char
  160.     *Inputp,
  161.     Minibuf[LBSIZE],
  162.     ShcomBuf[LBSIZE],
  163.     *version;
  164.  
  165. #define MESG_SIZE 128
  166. extern char    mesgbuf[MESG_SIZE];
  167.  
  168. #define CATCH \
  169. {\
  170.     jmp_buf    sav_jmp; \
  171. \
  172.     push_env(sav_jmp); \
  173.     if (setjmp(mainjmp) == 0) {
  174.  
  175. #define ONERROR \
  176.     } else { \
  177.  
  178. #define ENDCATCH \
  179.     } \
  180.     pop_env(sav_jmp); \
  181. }
  182.  
  183. #ifdef OS2
  184. # define SIGQUIT SIGUSR1
  185. # define SIGKILL -1
  186. #endif
  187.  
  188. typedef enum {
  189.     if_pressed_key,
  190.     get_character
  191. } KBD_REQUEST;
  192.  
  193. #include "externs.h"
  194.