home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / Editors / mjovesrc.zoo / jove.h < prev    next >
C/C++ Source or Header  |  1991-10-02  |  6KB  |  224 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. #ifndef    MAC
  16. # include <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. #ifdef    REALSTDC
  27. # define    USE_PROTOTYPES  1
  28. #endif
  29.  
  30. #ifdef    USE_PROTOTYPES
  31. # define proto(x)        x
  32. # ifdef    NO_PTRPROTO
  33.    /* on these systems, a prototype cannot be used for a pointer to function */
  34. #  define ptrproto(x)        ()
  35. # else
  36. #  define ptrproto(x)        x
  37. # endif
  38. #else
  39. # define proto(x)        ()
  40. # define ptrproto(x)        ()
  41. #endif
  42.  
  43. /* There are two ways to handle functions with a variable number of args.
  44.  * The old portable way uses varargs.h.  The way sanctioned by ANSI X3J11
  45.  * uses stdarg.h.
  46.  */
  47. #ifdef    REALSTDC
  48. #define    STDARGS    1
  49. # define    va_init(ap, parmN)    { va_start((ap), (parmN)); }
  50. #else
  51. # define    va_init(ap, parmN)    { va_start((ap)); }
  52. #endif
  53.  
  54. /* ANSI Goodies and their substitutes
  55.  *
  56.  * const: readonly type qualifier
  57.  *
  58.  * volatile: type qualifier indicating one of two kinds of magic.
  59.  * 1. This object may be modified by an event unknown to the implementation
  60.  *    (eg. asynchronous signal or memory-mapped I/O device).
  61.  * 2. This automatic variable might be modified between a setjmp()
  62.  *    and a longjmp(), and we wish it to have the correct value after
  63.  *    the longjmp().  This second meaning is an X3J11 abomination.
  64.  * So far, only the second meaning is used.
  65.  *
  66.  * UnivPtr: universal pointer type
  67.  *
  68.  * UnivConstPtr: universal pointer to const
  69.  */
  70.  
  71. #ifdef    REALSTDC
  72.  
  73.   typedef void    *UnivPtr;
  74.   typedef const void    *UnivConstPtr;
  75.  
  76. #else    /* !REALSTDC */
  77.  
  78. # ifndef const
  79. #  define    const    /* Only in ANSI C.  Pity */
  80. # endif
  81. # ifndef volatile
  82. #  define    volatile
  83. # endif
  84.   typedef char    *UnivPtr;
  85.   typedef const char    *UnivConstPtr;
  86.  
  87. #endif    /* !REALSTDC */
  88.  
  89. /* According to the ANSI standard for C, any library routine may
  90.  * be defined as a macro with parameters.  In order to prevent
  91.  * the expansion of this macro in a declaration of the routine,
  92.  * ANSI suggests parenthesizing the identifier.  This is a reasonable
  93.  * and legal approach, even for K&R C.
  94.  *
  95.  * A bug in the MIPS compiler used on MIPS, IRIS, and probably other
  96.  * MIPS R[23]000 based systems, causes the compiler to reject
  97.  * these declarations (at least at the current time, 1989 August).
  98.  * To avoid this bug, we conditionally define and use UNMACRO.
  99.  */
  100. #ifdef    mips
  101. # define UNMACRO(proc)    proc
  102. #else
  103. # define UNMACRO(proc)    (proc)
  104. #endif
  105.  
  106. /* Since we don't use stdio.h, we may have to define NULL and EOF */
  107.  
  108. #ifndef    NULL
  109. # define NULL    0
  110. #endif
  111.  
  112. #ifndef    EOF
  113. #define EOF    (-1)
  114. #endif
  115.  
  116. #define private        static
  117.  
  118. typedef int    bool;
  119. #define NO        0
  120. #define YES        1
  121. #define FALSE        0
  122. #define TRUE        1
  123. #define OFF        0
  124. #define ON        1
  125.  
  126. /* typedef structure definitions */
  127. #ifdef    IPROCS
  128. typedef struct process    Process;
  129. #endif
  130. typedef struct window    Window;
  131. typedef struct position    Bufpos;
  132. typedef struct mark    Mark;
  133. typedef struct buffer    Buffer;
  134. typedef struct line    Line;
  135. typedef struct iobuf    IOBUF;
  136.  
  137. #include "buf.h"
  138. #include "wind.h"
  139. #include "io.h"
  140. #include "dataobj.h"
  141. #include "keymaps.h"
  142. #include "argcount.h"
  143. #include "util.h"
  144. #include "vars.h"
  145. #include "screen.h"
  146.  
  147. /* return codes for command completion (all < 0 because >= 0 are
  148.    legitimate offsets into array of strings */
  149.  
  150. #define AMBIGUOUS    (-2)    /* matches more than one at this point */
  151. #define UNIQUE        (-3)    /* matches only one string */
  152. #define ORIGINAL    (-4)    /* matches no strings at all! */
  153. #define NULLSTRING    (-5)    /* just hit return without typing anything */
  154.  
  155. /* values for the `flags' argument to complete */
  156. #define NOTHING        0    /* opposite of RET_STATE */
  157. #define RET_STATE    1    /* return state when we hit return */
  158. #define RCOMMAND    2    /* we are reading a joverc file */
  159. #define CASEIND        4    /* map all to lower case */
  160.  
  161. #define FORWARD        1
  162. #define BACKWARD    (-1)
  163.  
  164. #define ARG_CMD        1
  165. #define LINECMD        2
  166. #define KILLCMD        3    /* so we can merge kills */
  167. #define YANKCMD        4    /* so we can do ESC Y (yank-pop) */
  168.  
  169. extern jmp_buf    mainjmp;
  170.  
  171. /* setjmp/longjmp args for DoKeys() mainjmp */
  172. #define FIRSTCALL    0
  173. #define ERROR        1
  174. #define COMPLAIN    2    /* do the error without a getDOT */
  175. #define QUIT        3    /* leave this level of recursion */
  176.  
  177. #define INT_OKAY    0
  178. #define INT_BAD        (-1)
  179.  
  180. extern char    NullStr[];
  181. extern char    *ProcFmt;
  182.  
  183. extern int
  184.     LastKeyStruck,
  185.  
  186.     RecDepth,    /* recursion depth */
  187.     InJoverc;    /* depth in sourcing */
  188.  
  189. extern bool
  190.     InMacDefine,    /* are we defining a macro right now? */
  191.  
  192.     TOabort,    /* flag set by Typeout() */
  193.  
  194.     errormsg,    /* last message was an error message
  195.                so don't erase the error before it
  196.                has been read */
  197.     InputPending,    /* nonzero if there is input waiting to
  198.                be processed */
  199.     Interactive,
  200.     inIOread,    /* so we know whether we can do a redisplay. */
  201.  
  202.     Asking,        /* are we on read a string from the terminal? */
  203.     InRealAsk;    /* are we currently executing real_ask()? */
  204.  
  205. extern int
  206.     AskingWidth;    /* width of question being asked */
  207.  
  208. extern char
  209.     *Inputp,
  210.     Minibuf[LBSIZE],
  211.     ShcomBuf[LBSIZE],
  212.     *version;
  213.  
  214. #define MESG_SIZE 128
  215. extern char    mesgbuf[MESG_SIZE];
  216.  
  217. #include "externs.h"
  218.  
  219. #ifndef    W_OK
  220. # define W_OK    2
  221. # define X_OK    1
  222. # define F_OK    0
  223. #endif
  224.