home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / v / vim_src.zip / VIM.H < prev    next >
C/C++ Source or Header  |  1993-01-12  |  5KB  |  236 lines

  1. /* vi:ts=4:sw=4
  2.  *
  3.  * VIM - Vi IMitation
  4.  *
  5.  * Code Contributions By:    Bram Moolenaar            mool@oce.nl
  6.  *                            Tim Thompson            twitch!tjt
  7.  *                            Tony Andrews            onecom!wldrdg!tony 
  8.  *                            G. R. (Fred) Walter        watmath!watcgl!grwalter 
  9.  */
  10.  
  11. #if defined(SYSV) || defined(BSD)
  12. # ifndef UNIX
  13. #  define UNIX
  14. # endif
  15. #endif
  16.  
  17. #include "debug.h"
  18.  
  19. #include <stdio.h>
  20.  
  21. #ifndef SYSV
  22. # include <stdlib.h>
  23. #endif
  24.  
  25. #include <ctype.h>
  26.  
  27. #include <string.h>
  28.  
  29. #include "ascii.h"
  30. #include "keymap.h"
  31. #include "term.h"
  32. #include "macros.h"
  33. #ifdef LATTICE
  34. # include <sys/types.h>
  35. # include <sys/stat.h>
  36. #else
  37. # ifdef _DCC
  38. #  include <sys/stat.h>
  39. # else
  40. #  ifdef MSDOS 
  41. #   include <sys\stat.h>
  42. #  else
  43. #   ifdef UNIX
  44. #      define volatile        /* needed for gcc */
  45. #      define signed            /* needed for gcc */
  46. #     include <sys/types.h>
  47. #     include <sys/stat.h>
  48. #   else
  49. #     include <stat.h>
  50. #   endif
  51. #  endif
  52. # endif
  53. #endif
  54.  
  55. #ifdef AMIGA
  56. /*
  57.  * arpbase.h must be included before functions.h
  58.  */
  59. # include <libraries/arpbase.h>
  60.  
  61. /*
  62.  * This won't be needed if you have a version of Lattice 4.01 without broken
  63.  * break signal handling.
  64.  */
  65. #include <signal.h>
  66. #endif
  67.  
  68. #ifdef AZTEC_C
  69. # include <functions.h>
  70. # define __ARGS(x)    x
  71. # define __PARMS(x)    x
  72. #endif
  73.  
  74. #ifdef SASC
  75. # include <clib/exec_protos.h>
  76. # define __ARGS(x)    x
  77. # define __PARMS(x)    x
  78. #endif
  79.  
  80. #ifdef _DCC
  81. # include <functions.h>
  82. # define __ARGS(x)    x
  83. # define __PARMS(x)    x
  84. #endif
  85.  
  86. #ifdef __TURBOC__
  87. # define __ARGS(x) x
  88. #endif
  89.  
  90. #ifdef MSDOS
  91. # include <dos.h>
  92. # include <dir.h>
  93. #endif
  94.  
  95. #if defined(__STDC__) || defined(__GNUC__)
  96. # ifndef __ARGS
  97. #  define __ARGS(x) x
  98. # endif /* __ARGS */
  99. # if defined(_SEQUENT_)
  100. #  include "ptx_stdlib.h"
  101. # endif
  102. # if defined(sun)
  103. #  include "sun_stdlib.h"
  104. # endif
  105. # if defined(linux)
  106. #  include <unistd.h>  /* may make sense for others too. jw. */
  107. # endif
  108. #else /*__STDC__*/
  109. # if defined(_SEQUENT_) && !defined(_STDLIB_H_)
  110.   extern char *getenv();
  111.   extern void *malloc();
  112. # endif
  113. #endif /* __STDC__ */
  114.  
  115. #ifndef __ARGS
  116. #define __ARGS(x)    ()
  117. #endif
  118. #ifndef __PARMS
  119. #define __PARMS(x)    ()
  120. #endif
  121.  
  122. /*
  123.  * for systems that do not allow free(NULL)
  124.  */
  125. #ifdef NO_FREE_NULL
  126. # define free(x)    {if ((x) != NULL) free(x);}
  127. #endif
  128.  
  129. /*
  130.  * fnamecmp() is used to compare filenames.
  131.  * On some systems case in a filename does not matter, on others it does.
  132.  */
  133. #if defined(AMIGA) || defined(MSDOS)
  134. # define fnamecmp(x, y) stricmp((x), (y))
  135. #else
  136. # define fnamecmp(x, y) strcmp((x), (y))
  137. #endif
  138.  
  139. /* flags for updateScreen() */
  140. #define VALID                    90    /* buffer not changed */
  141. #define NOT_VALID                91    /* buffer changed */
  142. #define VALID_TO_CURSCHAR        92    /* buffer before cursor not changed */
  143. #define INVERTED                93    /* redisplay inverted part */
  144. #define CLEAR                    94    /* first clear screen */
  145. #define CURSUPD                    95    /* update cursor first */
  146.  
  147. /* values for State */
  148. #define NORMAL                     0
  149. #define CMDLINE                  1
  150. #define INSERT                     2
  151. #define APPEND                     3
  152. #define REPLACE                  4    /* replace mode */
  153. #define HELP                     5
  154. #define NOMAPPING                  6    /* no :mapping mode for vgetc() */
  155. #define HITRETURN                 7
  156. #define SETWINSIZE                 8
  157. #define NORMAL_BUSY                 9    /* busy interpreting a command */
  158.  
  159. /* directions */
  160. #define FORWARD                  1
  161. #define BACKWARD                 -1
  162.  
  163. /* for GetChars */
  164. #define T_PEEK                    1    /* do not wait at all */
  165. #define T_WAIT                    2    /* wait for a short time */
  166. #define T_BLOCK                    3    /* wait forever */
  167.  
  168. #define QUOTELINE                29999    /* Quoting is linewise */
  169.  
  170. /*
  171.  * Names for the EXRC, HELP and temporary files.
  172.  * This may be redefined by machine dependent header files
  173.  * that are included below.
  174.  */
  175. #define SYSVIMRC_FILE    "s:.vimrc"
  176. #define SYSEXRC_FILE    "s:.exrc"
  177. #define VIMRC_FILE        ".vimrc"
  178. #define EXRC_FILE        ".exrc"
  179. #define VIM_HLP            "vim:vim.hlp"
  180. #define TMPNAME1        "t:viXXXXXX"
  181. #define TMPNAME2        "t:voXXXXXX"
  182. #define TMPNAMELEN        12
  183.  
  184. /*
  185.  * Boolean constants
  186.  */
  187. #ifndef TRUE
  188. #define FALSE    (0)            /* note: this is an int, not a long! */
  189. #define TRUE    (1)
  190. #endif
  191.  
  192. /*
  193.  * Maximum screen dimensions
  194.  */
  195. #define MAX_COLUMNS 140L
  196.  
  197. /*
  198.  * Buffer sizes
  199.  */
  200. #define CMDBUFFSIZE    256            /* size of the command processing buffer */
  201.  
  202. #define LSIZE        512            /* max. size of a line in the tags file */
  203.  
  204. #define IOSIZE       (1024+1)     /* file i/o and sprintf buffer size */
  205.  
  206. /*
  207.  * maximum length of a file name path
  208.  */
  209. #ifdef UNIX
  210. # define MAXPATHL    1024        /* Unix has long paths and plenty of memory */
  211. #else
  212. # define MAXPATHL    128            /* not too long to put name on stack */
  213. #endif
  214.  
  215. #define CHANGED   set_Changed()
  216. #define UNCHANGED Changed = 0
  217.  
  218. #if !defined(BSD) && !defined(linux) && !defined(SASC)
  219. typedef unsigned char    u_char;        /* shorthand */
  220. typedef unsigned short    u_short;    /* shorthand */
  221. typedef unsigned int    u_int;        /* shorthand */
  222. typedef unsigned long    u_long;        /* shorthand */
  223. #endif
  224.  
  225. typedef long            linenr_t;    /* line number type */
  226. typedef unsigned        colnr_t;    /* column number type */
  227. typedef struct fpos        FPOS;        /* file position type */
  228.  
  229. #define INVLNUM (0x7fffffff)        /* invalid line number */
  230.  
  231. struct fpos
  232. {
  233.         linenr_t        lnum;    /* line number */
  234.         colnr_t         col;    /* column number */
  235. };
  236.