1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
/* elvis.h */
/* Copyright 1995 by Steve Kirkendall */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include "version.h"
#include "osdef.h"
/* The FTP protocol requires HTTP */
#if defined(PROTOCOL_FTP) && !defined(PROTOCOL_HTTP)
# define PROTOCOL_HTTP
#endif
/* If any markup display mode is used, then define DISPLAY_ANYMARKUP */
#if defined(DISPLAY_HTML) || defined(DISPLAY_MAN) || defined(DISPLAY_TEX)
# define DISPLAY_ANYMARKUP
#endif
/* Some handy macros */
#define QTY(array) (sizeof(array) / sizeof((array)[0]))
#define ELVCTRL(ch) ((ch) ^ 0x40)
/* Names of some special buffers */
#define INIT_BUF "Elvis initialization"
#define CUSTOM_BUF "Elvis custom initialization"
#define BEFOREREAD_BUF "Elvis before reading"
#define AFTERREAD_BUF "Elvis after reading"
#define BEFOREWRITE_BUF "Elvis before writing"
#define AFTERWRITE_BUF "Elvis after writing"
#define MSG_BUF "Elvis messages"
#define MSGQUEUE_BUF "Elvis message queue"
#define UNTITLED_BUF "Elvis untitled #%d"
#define EX_BUF "Elvis ex history"
#define REGEXP_BUF "Elvis regexp history"
#define FILTER_BUF "Elvis filter history"
#define MORE_BUF "Elvis more"
#define CUTANON_BUF "Elvis cut buffer 1" /* anonymous cut buffer */
#define CUTNAMED_BUF "Elvis cut buffer %c" /* cut buffers a-z and 1-9 */
#define CUTEXTERN_BUF "Elvis clipboard" /* cut buffers < and > */
#define CUTINPUT_BUF "Elvis previous input" /* cut buffer . */
#define DEFAULT_BUF "Elvis default options"
#define HELP_BUF "Elvis documentation"
#define ERRLIST_BUF "Elvis error list"
#define TRACE_BUF "Elvis map log"
#define BBROWSE_BUF "Elvis buffer list"
/* Names of files that store default contents of buffers */
#define INIT_FILE "elvis.ini" /* executed before first file is loaded */
#if ANY_UNIX
# define CUSTOM_FILE ".exrc" /* custom file for each user */
#else
# define CUSTOM_FILE "elvis.rc" /* custom file for each user */
#endif
#define BEFOREREAD_FILE "elvis.brf" /* executed before each file is loaded */
#define AFTERREAD_FILE "elvis.arf" /* executed after each file is loaded */
#define BEFOREWRITE_FILE "elvis.bwf" /* executed before writing a file */
#define AFTERWRITE_FILE "elvis.awf" /* executed after writing a file */
#define MSG_FILE "elvis.msg" /* verbose message translations */
#define HELP_FILE "elvis.html" /* elvis online documentation */
#define SYNTAX_FILE "elvis.syn" /* descriptions of languages */
#define BROWSER_FILE "elvis.bro" /* prototype of browser document */
#define NET_FILE "elvis.net" /* network proxy list */
#define FTP_FILE "elvis.ftp" /* ftp account information */
/* a very large number */
#define INFINITY 2147483647L
/* default size of the tag stack (for each window) */
#ifndef TAGSTK
# define TAGSTK 10
#endif
/* Some useful data types */
typedef enum {False, True} BOOLEAN;
typedef enum { RESULT_COMPLETE, RESULT_MORE, RESULT_ERROR } RESULT;
typedef unsigned char CHAR;
typedef unsigned short COUNT;
typedef unsigned int _COUNT_;
typedef unsigned int _CHAR_;
typedef int _char_;
/* Include one version of the ctype macros. Elvis' versions have the advantage
* of automatically checking the digraph table.
*/
#ifdef NEED_CTYPE
# include "elvctype.h"
#else
# include <ctype.h>
#endif
/* Character conversions, and other operations */
#define toCHAR(s) ((CHAR *)(s))
#define tochar8(s) ((char *)(s))
#define CHARcpy(d,s) ((void)strcpy((char *)(d), (char *)(s)))
#define CHARcat(d,s) ((void)strcat((char *)(d), (char *)(s)))
#define CHARncpy(d,s,n) ((void)strncpy((char *)(d), (char *)(s), (n)))
#define CHARncat(d,s,n) ((void)strncat((char *)(d), (char *)(s), (n)))
#define CHARlen(s) strlen((char *)(s))
#define CHARchr(s,c) ((CHAR *)strchr((char *)(s), (char)(c)))
#define CHARrchr(s,c) ((CHAR *)strrchr((char *)(s), (char)(c)))
#define CHARcmp(s,t) (strcmp((char *)(s), (char *)(t)))
#define CHARncmp(s,t,n) (strncmp((char *)(s), (char *)(t), (n)))
#define CHARdup(s) ((CHAR *)safedup(tochar8(s)))
#define CHARkdup(s) ((CHAR *)safekdup(tochar8(s)))
#define long2CHAR(s,l) ((void)sprintf((char *)(s), "%ld", (l)))
#define CHAR2long(s) (atol(tochar8(s)))
#ifndef USE_PROTOTYPES
# if defined(__STDC__) || defined(__cplusplus)
# define USE_PROTOTYPES 1
# else
# define USE_PROTOTYPES 0
# endif
#endif
#if USE_PROTOTYPES
# define P_(args) args
#else
# define P_(args) ()
#endif
/* Some macros to handle C++ in a graceful way */
#if defined (__cplusplus)
#define BEGIN_EXTERNC extern "C" {
#define END_EXTERNC }
#else
#define BEGIN_EXTERNC
#define END_EXTERNC
#endif
/* Header files for the modules */
#include "safe.h"
#include "options.h"
#include "optglob.h"
#include "session.h"
#include "lowbuf.h"
#include "message.h"
#include "buffer.h"
#include "mark.h"
#include "buffer2.h"
#include "scan.h"
#include "opsys.h"
#include "map.h"
#include "gui.h"
#include "display.h"
#include "draw.h"
#include "state.h"
#include "window.h"
#include "options2.h"
#include "gui2.h"
#include "display2.h"
#include "draw2.h"
#include "state2.h"
#include "event.h"
#include "input.h"
#include "vi.h"
#include "regexp.h"
#include "ex.h"
#include "move.h"
#include "vicmd.h"
#include "operator.h"
#include "cut.h"
#include "elvisio.h"
#include "lp.h"
#include "calc.h"
#include "more.h"
#include "digraph.h"
#include "tag.h"
#include "tagsrch.h"
#include "tagelvis.h"
#include "need.h"
#include "misc.h"
#include "message2.h"
/* The following are defined in main.c */
extern GUI *chosengui;
BEGIN_EXTERNC
extern void mainfirstcmd P_((WINDOW win));
END_EXTERNC
|