vi.h

Go to the documentation of this file.
00001 /* vi.h */
00002 
00003 /* Author:
00004  *      Steve Kirkendall
00005  *      14407 SW Teal Blvd. #C
00006  *      Beaverton, OR 97005
00007  *      kirkenda@cs.pdx.edu
00008  */
00009 
00010 #define VERSION "ELVIS 1.5, by Steve Kirkendall (23 March 1992)"
00011 #define COPYING "This version of ELVIS is freely redistributable."
00012 
00013 #include <errno.h>
00014 extern int errno;
00015 #if TOS && !defined(__GNUC__)
00016 #define ENOENT (-AEFILNF)
00017 #endif
00018 
00019 #if TOS || VMS
00020 # include <types.h>
00021 # define O_RDONLY       0
00022 # define O_WRONLY       1
00023 # define O_RDWR         2
00024 # ifdef __GNUC__
00025 #  define S_IJDIR       S_IFDIR
00026 # endif
00027 #else
00028 # if OSK
00029 #  include <modes.h>
00030 #  define O_RDONLY      S_IREAD
00031 #  define O_WRONLY      S_IWRITE
00032 #  define O_RDWR        (S_IREAD | S_IWRITE)
00033 #  define ENOENT        E_PNNF
00034 #  define sprintf       Sprintf
00035 # else
00036 #  include <sys/types.h>
00037 #  if COHERENT
00038 #   include <sys/fcntl.h>
00039 #  else
00040 #   include <fcntl.h>
00041 #  endif
00042 # endif
00043 #endif
00044 
00045 #ifndef O_BINARY
00046 # define O_BINARY       0
00047 #endif
00048 
00049 #include "curses.h"
00050 
00051 #include <signal.h>
00052 
00053 /*------------------------------------------------------------------------*/
00054 /* Miscellaneous constants.                                               */
00055 
00056 #define INFINITY        2000000001L     /* a very large integer */
00057 #define LONGKEY         10              /* longest possible raw :map key */
00058 #ifndef MAXRCLEN
00059 # define MAXRCLEN       1000            /* longest possible :@ command */
00060 #endif
00061 
00062 /*------------------------------------------------------------------------*/
00063 /* These describe how temporary files are divided into blocks             */
00064 
00065 #define MAXBLKS (BLKSIZE / sizeof(unsigned short))
00066 typedef union
00067 {
00068         char            c[BLKSIZE];     /* for text blocks */
00069         unsigned short  n[MAXBLKS];     /* for the header block */
00070 }
00071         BLK;
00072 
00073 /*------------------------------------------------------------------------*/
00074 /* These are used manipulate BLK buffers.                                 */
00075 
00076 extern BLK      hdr;            /* buffer for the header block */
00077 extern BLK      *blkget();      /* given index into hdr.c[], reads block */
00078 extern BLK      *blkadd();      /* inserts a new block into hdr.c[] */
00079 
00080 /*------------------------------------------------------------------------*/
00081 /* These are used to keep track of various flags                          */
00082 extern struct _viflags
00083 {
00084         short   file;           /* file flags */
00085 }
00086         viflags;
00087 
00088 /* file flags */
00089 #define NEWFILE         0x0001  /* the file was just created */
00090 #define READONLY        0x0002  /* the file is read-only */
00091 #define HADNUL          0x0004  /* the file contained NUL characters */
00092 #define MODIFIED        0x0008  /* the file has been modified, but not saved */
00093 #define NOFILE          0x0010  /* no name is known for the current text */
00094 #define ADDEDNL         0x0020  /* newlines were added to the file */
00095 #define HADBS           0x0040  /* backspace chars were lost from the file */
00096 #define UNDOABLE        0x0080  /* file has been modified */
00097 #define NOTEDITED       0x0100  /* the :file command has been used */
00098 
00099 /* macros used to set/clear/test flags */
00100 #define setflag(x,y)    viflags.x |= y
00101 #define clrflag(x,y)    viflags.x &= ~y
00102 #define tstflag(x,y)    (viflags.x & y)
00103 #define initflags()     viflags.file = 0;
00104 
00105 /* The options */
00106 extern char     o_autoindent[1];
00107 extern char     o_autoprint[1];
00108 extern char     o_autotab[1];
00109 extern char     o_autowrite[1];
00110 extern char     o_columns[3];
00111 extern char     o_directory[30];
00112 extern char     o_edcompatible[1];
00113 extern char     o_equalprg[80];
00114 extern char     o_errorbells[1];
00115 extern char     o_exrefresh[1];
00116 extern char     o_ignorecase[1];
00117 extern char     o_keytime[3];
00118 extern char     o_keywordprg[80];
00119 extern char     o_lines[3];
00120 extern char     o_list[1];
00121 extern char     o_number[1];
00122 extern char     o_readonly[1];
00123 extern char     o_remap[1];
00124 extern char     o_report[3];
00125 extern char     o_scroll[3];
00126 extern char     o_shell[60];
00127 extern char     o_shiftwidth[3];
00128 extern char     o_sidescroll[3];
00129 extern char     o_sync[1];
00130 extern char     o_tabstop[3];
00131 extern char     o_term[30];
00132 extern char     o_flash[1];
00133 extern char     o_warn[1];
00134 extern char     o_wrapscan[1];
00135 
00136 #ifndef CRUNCH
00137 extern char     o_beautify[1];
00138 extern char     o_exrc[1];
00139 extern char     o_mesg[1];
00140 extern char     o_more[1];
00141 extern char     o_novice[1];
00142 extern char     o_prompt[1];
00143 extern char     o_taglength[3];
00144 extern char     o_terse[1];
00145 extern char     o_window[3];
00146 extern char     o_wrapmargin[3];
00147 extern char     o_writeany[1];
00148 #endif
00149 
00150 #ifndef NO_ERRLIST
00151 extern char     o_cc[30];
00152 extern char     o_make[30];
00153 #endif
00154 
00155 #ifndef NO_CHARATTR
00156 extern char     o_charattr[1];
00157 #endif
00158 
00159 #ifndef NO_DIGRAPH
00160 extern char     o_digraph[1];
00161 extern char     o_flipcase[80];
00162 #endif
00163 
00164 #ifndef NO_SENTENCE
00165 extern char     o_hideformat[1];
00166 #endif
00167 
00168 #ifndef NO_EXTENSIONS
00169 extern char     o_inputmode[1];
00170 extern char     o_ruler[1];
00171 #endif
00172 
00173 #ifndef NO_MAGIC
00174 extern char     o_magic[1];
00175 #endif
00176 
00177 #ifndef NO_MODELINES
00178 extern char     o_modelines[1];
00179 #endif
00180 
00181 #ifndef NO_SENTENCE
00182 extern char     o_paragraphs[30];
00183 extern char     o_sections[30];
00184 #endif
00185 
00186 #if MSDOS
00187 extern char     o_pcbios[1];
00188 #endif
00189 
00190 #ifndef NO_SHOWMATCH
00191 extern char     o_showmatch[1];
00192 #endif
00193 
00194 #ifndef NO_SHOWMODE
00195 extern char     o_smd[1];
00196 #endif
00197 
00198 /*------------------------------------------------------------------------*/
00199 /* These help support the single-line multi-change "undo" -- shift-U      */
00200 
00201 extern char     U_text[BLKSIZE];
00202 extern long     U_line;
00203 
00204 /*------------------------------------------------------------------------*/
00205 /* These are used to refer to places in the text                          */
00206 
00207 typedef long    MARK;
00208 #define markline(x)     (long)((x) / BLKSIZE)
00209 #define markidx(x)      (int)((x) & (BLKSIZE - 1))
00210 #define MARK_UNSET      ((MARK)0)
00211 #define MARK_FIRST      ((MARK)BLKSIZE)
00212 #define MARK_LAST       ((MARK)(nlines * BLKSIZE))
00213 #define MARK_AT_LINE(x) ((MARK)(x) * BLKSIZE)
00214 
00215 #define NMARKS  29
00216 extern MARK     mark[NMARKS];   /* marks a-z, plus mark ' and two temps */
00217 extern MARK     cursor;         /* mark where line is */
00218 
00219 /*------------------------------------------------------------------------*/
00220 /* These are used to keep track of the current & previous files.          */
00221 
00222 extern long     origtime;       /* modification date&time of the current file */
00223 extern char     origname[256];  /* name of the current file */
00224 extern char     prevorig[256];  /* name of the preceding file */
00225 extern long     prevline;       /* line number from preceding file */
00226 
00227 /*------------------------------------------------------------------------*/
00228 /* misc housekeeping variables & functions                                */
00229 
00230 extern int      tmpfd;          /* fd used to access the tmp file */
00231 extern int      tmpnum;         /* counter used to generate unique filenames */
00232 extern long     lnum[MAXBLKS];  /* last line# of each block */
00233 extern long     nlines;         /* number of lines in the file */
00234 extern char     args[BLKSIZE];  /* file names given on the command line */
00235 extern int      argno;          /* the current element of args[] */
00236 extern int      nargs;          /* number of filenames in args */
00237 extern long     changes;        /* counts changes, to prohibit short-cuts */
00238 extern int      significant;    /* boolean: was a *REAL* change made? */
00239 extern BLK      tmpblk;         /* a block used to accumulate changes */
00240 extern long     topline;        /* file line number of top line */
00241 extern int      leftcol;        /* column number of left col */
00242 #define         botline  (topline + LINES - 2)
00243 #define         rightcol (leftcol + COLS - (*o_number ? 9 : 1))
00244 extern int      physcol;        /* physical column number that cursor is on */
00245 extern int      physrow;        /* physical row number that cursor is on */
00246 extern int      exwrote;        /* used to detect verbose ex commands */
00247 extern int      doingdot;       /* boolean: are we doing the "." command? */
00248 extern int      doingglobal;    /* boolean: are doing a ":g" command? */
00249 extern long     rptlines;       /* number of lines affected by a command */
00250 extern char     *rptlabel;      /* description of how lines were affected */
00251 extern char     *fetchline();   /* read a given line from tmp file */
00252 extern char     *parseptrn();   /* isolate a regexp in a line */
00253 extern MARK     paste();        /* paste from cut buffer to a given point */
00254 extern char     *wildcard();    /* expand wildcards in filenames */
00255 extern MARK     input();        /* inserts characters from keyboard */
00256 extern char     *linespec();    /* finds the end of a /regexp/ string */
00257 #define         ctrl(ch) ((ch)&037)
00258 #ifndef NO_RECYCLE
00259 extern long     allocate();     /* allocate a free block of the tmp file */
00260 #endif
00261 extern int      trapint();      /* trap handler for SIGINT */
00262 extern int      deathtrap();    /* trap handler for deadly signals */
00263 extern void     blkdirty();     /* marks a block as being "dirty" */
00264 extern void     blkflush();     /* writes a single dirty block to the disk */
00265 extern void     blksync();      /* forces all "dirty" blocks to disk */
00266 extern void     blkinit();      /* resets the block cache to "empty" state */
00267 extern void     beep();         /* rings the terminal's bell */
00268 extern void     exrefresh();    /* writes text to the screen */
00269 extern void     msg();          /* writes a printf-style message to the screen */
00270 extern void     endmsgs();      /* if "manymsgs" is set, then scroll up 1 line */
00271 extern void     garbage();      /* reclaims any garbage blocks */
00272 extern void     redraw();       /* updates the screen after a change */
00273 extern void     resume_curses();/* puts the terminal in "cbreak" mode */
00274 extern void     beforedo();     /* saves current revision before a new change */
00275 extern void     afterdo();      /* marks end of a beforedo() change */
00276 extern void     abortdo();      /* like "afterdo()" followed by "undo()" */
00277 extern int      undo();         /* restores file to previous undo() */
00278 extern void     dumpkey();      /* lists key mappings to the screen */
00279 extern void     mapkey();       /* defines a new key mapping */
00280 extern void     savekeys();     /* lists key mappings to a file */
00281 extern void     redrawrange();  /* records clues from modify.c */
00282 extern void     cut();          /* saves text in a cut buffer */
00283 extern void     delete();       /* deletes text */
00284 extern void     add();          /* adds text */
00285 extern void     change();       /* deletes text, and then adds other text */
00286 extern void     cutswitch();    /* updates cut buffers when we switch files */
00287 extern void     do_abbr();      /* defines or lists abbreviations */
00288 extern void     do_digraph();   /* defines or lists digraphs */
00289 extern void     exstring();     /* execute a string as EX commands */
00290 extern void     dumpopts();
00291 extern void     setopts();
00292 extern void     saveopts();
00293 extern void     savedigs();
00294 extern void     saveabbr();
00295 extern void     savecolor();
00296 extern void     cutname();
00297 extern void     cutname();
00298 extern void     initopts();
00299 extern void     cutend();
00300 #ifndef CRUNCH
00301 extern int      wset;           /* boolean: has the "window" size been set? */
00302 #endif
00303 
00304 /*------------------------------------------------------------------------*/
00305 /* macros that are used as control structures                             */
00306 
00307 #define BeforeAfter(before, after) for((before),bavar=1;bavar;(after),bavar=0)
00308 #define ChangeText      BeforeAfter(beforedo(FALSE),afterdo())
00309 
00310 extern int      bavar;          /* used only in BeforeAfter macros */
00311 
00312 /*------------------------------------------------------------------------*/
00313 /* These are the movement commands.  Each accepts a mark for the starting */
00314 /* location & number and returns a mark for the destination.              */
00315 
00316 extern MARK     m_updnto();             /* k j G */
00317 extern MARK     m_right();              /* h */
00318 extern MARK     m_left();               /* l */
00319 extern MARK     m_tocol();              /* | */
00320 extern MARK     m_front();              /* ^ */
00321 extern MARK     m_rear();               /* $ */
00322 extern MARK     m_fword();              /* w */
00323 extern MARK     m_bword();              /* b */
00324 extern MARK     m_eword();              /* e */
00325 extern MARK     m_paragraph();          /* { } [[ ]] */
00326 extern MARK     m_match();              /* % */
00327 #ifndef NO_SENTENCE
00328  extern MARK    m_sentence();           /* ( ) */
00329 #endif
00330 extern MARK     m_tomark();             /* 'm */
00331 #ifndef NO_EXTENSIONS
00332 extern MARK     m_wsrch();              /* ^A */
00333 #endif
00334 extern MARK     m_nsrch();              /* n */
00335 extern MARK     m_Nsrch();              /* N */
00336 extern MARK     m_fsrch();              /* /regexp */
00337 extern MARK     m_bsrch();              /* ?regexp */
00338 #ifndef NO_CHARSEARCH
00339  extern MARK    m__ch();                /* ; , */
00340  extern MARK    m_fch();                /* f */
00341  extern MARK    m_tch();                /* t */
00342  extern MARK    m_Fch();                /* F */
00343  extern MARK    m_Tch();                /* T */
00344 #endif
00345 extern MARK     m_row();                /* H L M */
00346 extern MARK     m_z();                  /* z */
00347 extern MARK     m_scroll();             /* ^B ^F ^E ^Y ^U ^D */
00348 
00349 /* Some stuff that is used by movement functions... */
00350 
00351 extern MARK     adjmove();              /* a helper fn, used by move fns */
00352 
00353 /* This macro is used to set the default value of cnt */
00354 #define DEFAULT(val)    if (cnt < 1) cnt = (val)
00355 
00356 /* These are used to minimize calls to fetchline() */
00357 extern int      plen;   /* length of the line */
00358 extern long     pline;  /* line number that len refers to */
00359 extern long     pchgs;  /* "changes" level that len refers to */
00360 extern char     *ptext; /* text of previous line, if valid */
00361 extern void     pfetch();
00362 extern char     digraph();
00363 
00364 /* This is used to build a MARK that corresponds to a specific point in the
00365  * line that was most recently pfetch'ed.
00366  */
00367 #define buildmark(text) (MARK)(BLKSIZE * pline + (int)((text) - ptext))
00368 
00369 
00370 /*------------------------------------------------------------------------*/
00371 /* These are used to handle EX commands.                                  */
00372 
00373 #define  CMD_NULL       0       /* NOT A VALID COMMAND */
00374 #define  CMD_ABBR       1       /* "define an abbreviation" */
00375 #define  CMD_ARGS       2       /* "show me the args" */
00376 #define  CMD_APPEND     3       /* "insert lines after this line" */
00377 #define  CMD_AT         4       /* "execute a cut buffer's contents via EX" */
00378 #define  CMD_BANG       5       /* "run a single shell command" */
00379 #define  CMD_CC         6       /* "run `cc` and then do CMD_ERRLIST" */
00380 #define  CMD_CD         7       /* "change directories" */
00381 #define  CMD_CHANGE     8       /* "change some lines" */
00382 #define  CMD_COLOR      9       /* "change the default colors" */
00383 #define  CMD_COPY       10      /* "copy the selected text to a given place" */
00384 #define  CMD_DELETE     11      /* "delete the selected text" */
00385 #define  CMD_DIGRAPH    12      /* "add a digraph, or display them all" */
00386 #define  CMD_EDIT       13      /* "switch to a different file" */
00387 #define  CMD_EQUAL      14      /* "display a line number" */
00388 #define  CMD_ERRLIST    15      /* "locate the next error in a list" */
00389 #define  CMD_FILE       16      /* "show the file's status" */
00390 #define  CMD_GLOBAL     17      /* "globally search & do a command" */
00391 #define  CMD_INSERT     18      /* "insert lines before the current line" */
00392 #define  CMD_JOIN       19      /* "join the selected line & the one after" */
00393 #define  CMD_LIST       20      /* "print lines, making control chars visible" */
00394 #define  CMD_MAKE       21      /* "run `make` and then do CMD_ERRLIST" */
00395 #define  CMD_MAP        22      /* "adjust the keyboard map" */
00396 #define  CMD_MARK       23      /* "mark this line" */
00397 #define  CMD_MKEXRC     24      /* "make a .exrc file" */
00398 #define  CMD_MOVE       25      /* "move the selected text to a given place" */
00399 #define  CMD_NEXT       26      /* "switch to next file in args" */
00400 #define  CMD_NUMBER     27      /* "print lines from the file w/ line numbers" */
00401 #define  CMD_PRESERVE   28      /* "act as though vi crashed" */
00402 #define  CMD_PREVIOUS   29      /* "switch to the previous file in args" */
00403 #define  CMD_PRINT      30      /* "print the selected text" */
00404 #define  CMD_PUT        31      /* "insert any cut lines before this line" */
00405 #define  CMD_QUIT       32      /* "quit without writing the file" */
00406 #define  CMD_READ       33      /* "append the given file after this line */
00407 #define  CMD_RECOVER    34      /* "recover file after vi crashes" - USE -r FLAG */
00408 #define  CMD_REWIND     35      /* "rewind to first file" */
00409 #define  CMD_SET        36      /* "set a variable's value" */
00410 #define  CMD_SHELL      37      /* "run some lines through a command" */
00411 #define  CMD_SHIFTL     38      /* "shift lines left" */
00412 #define  CMD_SHIFTR     39      /* "shift lines right" */
00413 #define  CMD_SOURCE     40      /* "interpret a file's contents as ex commands" */
00414 #define  CMD_STOP       41      /* same as CMD_SUSPEND */
00415 #define  CMD_SUBAGAIN   42      /* "repeat the previous substitution" */
00416 #define  CMD_SUBSTITUTE 43      /* "substitute text in this line" */
00417 #define  CMD_SUSPEND    44      /* "suspend the vi session" */
00418 #define  CMD_TR         45      /* "transliterate chars in the selected lines" */
00419 #define  CMD_TAG        46      /* "go to a particular tag" */
00420 #define  CMD_UNABBR     47      /* "remove an abbreviation definition" */
00421 #define  CMD_UNDO       48      /* "undo the previous command" */
00422 #define  CMD_UNMAP      49      /* "remove a key sequence map */
00423 #define  CMD_VERSION    50      /* "describe which version this is" */
00424 #define  CMD_VGLOBAL    51      /* "apply a cmd to lines NOT containing an RE" */
00425 #define  CMD_VISUAL     52      /* "go into visual mode" */
00426 #define  CMD_WQUIT      53      /* "write this file out (any case) & quit" */
00427 #define  CMD_WRITE      54      /* "write the selected(?) text to a given file" */
00428 #define  CMD_XIT        55      /* "write this file out (if modified) & quit" */
00429 #define  CMD_YANK       56      /* "copy the selected text into the cut buffer" */
00430 #ifdef DEBUG
00431 # define CMD_DEBUG      57      /* access to internal data structures */
00432 # define CMD_VALIDATE   58      /* check for internal consistency */
00433 #endif
00434 typedef int CMD;
00435 
00436 extern void     ex();
00437 extern void     vi();
00438 extern void     doexcmd();
00439 
00440 extern void     cmd_append();
00441 extern void     cmd_args();
00442 #ifndef NO_AT
00443 extern void     cmd_at();
00444 #endif
00445 extern void     cmd_cd();
00446 #ifndef NO_COLOR
00447 extern void     cmd_color();
00448 #endif
00449 extern void     cmd_delete();
00450 #ifndef NO_DIGRAPH
00451 extern void     cmd_digraph();
00452 #endif
00453 extern void     cmd_edit();
00454 #ifndef NO_ERRLIST
00455 extern void     cmd_errlist();
00456 #endif
00457 extern void     cmd_file();
00458 extern void     cmd_global();
00459 extern void     cmd_join();
00460 extern void     cmd_mark();
00461 #ifndef NO_ERRLIST
00462 extern void     cmd_make();
00463 #endif
00464 extern void     cmd_map();
00465 #ifndef NO_MKEXRC
00466 extern void     cmd_mkexrc();
00467 #endif
00468 extern void     cmd_next();
00469 extern void     cmd_print();
00470 extern void     cmd_put();
00471 extern void     cmd_read();
00472 extern void     cmd_set();
00473 extern void     cmd_shell();
00474 extern void     cmd_shift();
00475 extern void     cmd_source();
00476 extern void     cmd_substitute();
00477 extern void     cmd_tag();
00478 extern void     cmd_undo();
00479 extern void     cmd_version();
00480 extern void     cmd_write();
00481 extern void     cmd_xit();
00482 extern void     cmd_move();
00483 #ifdef DEBUG
00484 extern void     cmd_debug();
00485 extern void     cmd_validate();
00486 #endif
00487 #ifdef SIGTSTP
00488 extern void     cmd_suspend();
00489 #endif
00490 
00491 /*----------------------------------------------------------------------*/
00492 /* These are used to handle VI commands                                 */
00493 
00494 extern MARK     v_1ex();        /* : */
00495 extern MARK     v_mark();       /* m */
00496 extern MARK     v_quit();       /* Q */
00497 extern MARK     v_redraw();     /* ^L ^R */
00498 extern MARK     v_ulcase();     /* ~ */
00499 extern MARK     v_undo();       /* u */
00500 extern MARK     v_xchar();      /* x X */
00501 extern MARK     v_replace();    /* r */
00502 extern MARK     v_overtype();   /* R */
00503 extern MARK     v_selcut();     /* " */
00504 extern MARK     v_paste();      /* p P */
00505 extern MARK     v_yank();       /* y Y */
00506 extern MARK     v_delete();     /* d D */
00507 extern MARK     v_join();       /* J */
00508 extern MARK     v_insert();     /* a A i I o O */
00509 extern MARK     v_change();     /* c C */
00510 extern MARK     v_subst();      /* s */
00511 extern MARK     v_lshift();     /* < */
00512 extern MARK     v_rshift();     /* > */
00513 extern MARK     v_reformat();   /* = */
00514 extern MARK     v_filter();     /* ! */
00515 extern MARK     v_status();     /* ^G */
00516 extern MARK     v_switch();     /* ^^ */
00517 extern MARK     v_tag();        /* ^] */
00518 extern MARK     v_xit();        /* ZZ */
00519 extern MARK     v_undoline();   /* U */
00520 extern MARK     v_again();      /* & */
00521 #ifndef NO_EXTENSIONS
00522  extern MARK    v_keyword();    /* K */
00523  extern MARK    v_increment();  /* * */
00524 #endif
00525 #ifndef NO_ERRLIST
00526  extern MARK    v_errlist();    /* * */
00527 #endif
00528 #ifndef NO_AT
00529  extern MARK    v_at();         /* @ */
00530 #endif
00531 #ifdef SIGTSTP
00532  extern MARK    v_suspend();    /* ^Z */
00533 #endif
00534 #ifndef NO_POPUP
00535  extern MARK    v_popup();      /* \ */
00536 #endif
00537 
00538 /*----------------------------------------------------------------------*/
00539 /* These flags describe the quirks of the individual visual commands */
00540 #define NO_FLAGS        0x00
00541 #define MVMT            0x01    /* this is a movement command */
00542 #define PTMV            0x02    /* this can be *part* of a movement command */
00543 #define FRNT            0x04    /* after move, go to front of line */
00544 #define INCL            0x08    /* include last char when used with c/d/y */
00545 #define LNMD            0x10    /* use line mode of c/d/y */
00546 #define NCOL            0x20    /* this command can't change the column# */
00547 #define NREL            0x40    /* this is "non-relative" -- set the '' mark */
00548 #define SDOT            0x80    /* set the "dot" variables, for the "." cmd */
00549 #ifndef NO_VISIBLE
00550 # define VIZ            0x100   /* commands which can be used with 'v' */
00551 #else
00552 # define VIZ            0
00553 #endif
00554 
00555 /* This variable is zeroed before a command executes, and later ORed with the
00556  * command's flags after the command has been executed.  It is used to force
00557  * certain flags to be TRUE for *some* invocations of a particular command.
00558  * For example, "/regexp/+offset" forces the LNMD flag, and sometimes a "p"
00559  * or "P" command will force FRNT.
00560  */
00561 extern int      force_flags;
00562 
00563 /*----------------------------------------------------------------------*/
00564 /* These describe what mode we're in */
00565 
00566 #define MODE_EX         1       /* executing ex commands */
00567 #define MODE_VI         2       /* executing vi commands */
00568 #define MODE_COLON      3       /* executing an ex command from vi mode */
00569 #define MODE_QUIT       4
00570 extern int      mode;
00571 
00572 #define WHEN_VICMD      1       /* getkey: we're reading a VI command */
00573 #define WHEN_VIINP      2       /* getkey: we're in VI's INPUT mode */
00574 #define WHEN_VIREP      4       /* getkey: we're in VI's REPLACE mode */
00575 #define WHEN_EX         8       /* getkey: we're in EX mode */
00576 #define WHEN_MSG        16      /* getkey: we're at a "more" prompt */
00577 #define WHEN_POPUP      32      /* getkey: we're in the pop-up menu */
00578 #define WHEN_REP1       64      /* getkey: we're getting a single char for 'r' */
00579 #define WHEN_CUT        128     /* getkey: we're getting a cut buffer name */
00580 #define WHEN_MARK       256     /* getkey: we're getting a mark name */
00581 #define WHEN_CHAR       512     /* getkey: we're getting a destination for f/F/t/T */
00582 #define WHEN_INMV       4096    /* in input mode, interpret the key in VICMD mode */
00583 #define WHEN_FREE       8192    /* free the keymap after doing it once */
00584 #define WHENMASK        (WHEN_VICMD|WHEN_VIINP|WHEN_VIREP|WHEN_REP1|WHEN_CUT|WHEN_MARK|WHEN_CHAR)
00585 
00586 #ifndef NO_VISIBLE
00587 extern MARK     V_from;
00588 extern int      V_linemd;
00589 extern MARK     v_start();
00590 #endif
00591 
00592 #ifdef DEBUG
00593 # define malloc(size)   dbmalloc(size, __FILE__, __LINE__)
00594 # define free(ptr)      dbfree(ptr, __FILE__, __LINE__)
00595 extern char *dbmalloc();
00596 #endif

Generated on Fri Apr 14 22:56:53 2006 for minix by  doxygen 1.4.6