home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / STEVIE3.ZIP / STEVIE.H < prev   
Text File  |  1991-03-27  |  5KB  |  232 lines

  1. /*
  2.  * STevie - ST editor for VI enthusiasts.    ...Tim Thompson...twitch!tjt...
  3.  *
  4.  * Extensive modifications by:  Tony Andrews       onecom!wldrdg!tony
  5.  *
  6.  */
  7.  
  8. /*
  9.  * One (and only 1) of the following defines should be uncommented.
  10.  * Most of the code is pretty machine-independent. Machine dependent
  11.  * code goes in a file like tos.c or unix.c. The only other place
  12.  * where machine dependent code goes is term.h for escape sequences.
  13.  */
  14.  
  15. /* #define    ATARI            /* For the Atari ST */
  16. /* #define    UNIX            /* System V */
  17. #define    OS2            /* Microsoft OS/2 */
  18.  
  19. /*
  20.  * If ATARI is defined, one of the following compilers must be selected.
  21.  */
  22. #ifdef    ATARI
  23. #define    MEGAMAX            /* Megamax Compiler */
  24. /* #define    ALCYON        /* Alcyon C compiler */
  25. #endif
  26.  
  27. /*
  28.  * If HELP is defined, the :help command shows a vi command summary.
  29.  */
  30. #define    HELP            /* enable help command */
  31.  
  32. #include <stdio.h>
  33. #include <ctype.h>
  34. #include <string.h>
  35. #include "ascii.h"
  36. #include "keymap.h"
  37. #include "param.h"
  38. #include "term.h"
  39.  
  40. extern    char    *strchr();
  41.  
  42. #define NORMAL 0
  43. #define CMDLINE 1
  44. #define INSERT 2
  45. #define APPEND 3
  46. #define FORWARD 4
  47. #define BACKWARD 5
  48.  
  49. /*
  50.  * Boolean type definition and constants
  51.  */
  52. typedef    short    bool_t;
  53.  
  54. #ifndef    TRUE
  55. #define    FALSE    (0)
  56. #define    TRUE    (1)
  57. #endif
  58.  
  59. /*
  60.  * SLOP is the amount of extra space we get for text on a line during
  61.  * editing operations that need more space. This keeps us from calling
  62.  * malloc every time we get a character during insert mode. No extra
  63.  * space is allocated when the file is initially read.
  64.  */
  65. #define    SLOP    10
  66.  
  67. /*
  68.  * LINEINC is the gap we leave between the artificial line numbers. This
  69.  * helps to avoid renumbering all the lines every time a new line is
  70.  * inserted.
  71.  */
  72. #define    LINEINC    10
  73.  
  74. /*
  75.  * See 'normal.c' for a description of can_undo.
  76.  */
  77. extern    bool_t    can_undo;
  78.  
  79. #define CHANGED Changed = !(can_undo = FALSE)
  80. #define UNCHANGED Changed=0
  81.  
  82. struct    line {
  83.     struct    line    *prev, *next;    /* previous and next lines */
  84.     char    *s;            /* text for this line */
  85.     int    size;            /* actual size of space at 's' */
  86.     unsigned int    num;        /* line "number" */
  87. };
  88.  
  89. #define    LINEOF(x)    (x->linep->num)
  90.  
  91. struct    lptr {
  92.     struct    line    *linep;        /* line we're referencing */
  93.     int    index;            /* position within that line */
  94. };
  95.  
  96. typedef    struct line    LINE;
  97. typedef    struct lptr    LPTR;
  98.  
  99. struct charinfo {
  100.     char ch_size;
  101.     char *ch_str;
  102. };
  103.  
  104. extern struct charinfo chars[];
  105.  
  106. extern int State;
  107. extern int Rows;
  108. extern int Columns;
  109. extern char *Realscreen;
  110. extern char *Nextscreen;
  111. extern char *Filename;
  112. extern LPTR *Filemem;
  113. extern LPTR *Fileend;
  114. extern LPTR *Topchar;
  115. extern LPTR *Botchar;
  116. extern LPTR *Curschar;
  117. extern LPTR *Insstart;
  118. extern int Cursrow, Curscol, Cursvcol, Curswant;
  119. extern bool_t set_want_col;
  120. extern int Prenum;
  121. extern bool_t Debug;
  122. extern bool_t Changed;
  123. extern bool_t Binary;
  124. extern char Redobuff[], Undobuff[], Insbuff[];
  125. extern LPTR *Uncurschar;
  126. extern char *Insptr;
  127. extern int Ninsert, Undelchars;
  128.  
  129. extern char *malloc(), *strcpy();
  130.  
  131. /*
  132.  * alloc.c
  133.  */
  134. char    *alloc(), *strsave();
  135. void    screenalloc(), filealloc(), freeall();
  136. LINE    *newline();
  137. bool_t    bufempty(), buf1line(), lineempty(), endofline(), canincrease();
  138.  
  139. /*
  140.  * cmdline.c
  141.  */
  142. void    readcmdline(), dotag(), msg(), emsg(), smsg(), gotocmd(), wait_return();
  143.  
  144. /*
  145.  * edit.c
  146.  */
  147. void    edit(), insertchar(), getout(), scrollup(), scrolldown(), beginline();
  148. bool_t    oneright(), oneleft(), oneup(), onedown();
  149.  
  150. /*
  151.  * fileio.c
  152.  */
  153. void    filemess(), renum();
  154. bool_t    readfile(), writeit();
  155.  
  156. /*
  157.  * help.c
  158.  */
  159. bool_t    help();
  160.  
  161. /*
  162.  * linefunc.c
  163.  */
  164. LPTR    *nextline(), *prevline(), *coladvance();
  165.  
  166. /*
  167.  * main.c
  168.  */
  169. void    stuffin(), stuffnum(), addtobuff();
  170. int    vgetc(), vpeekc();
  171. bool_t    anyinput();
  172.  
  173. /*
  174.  * mark.c
  175.  */
  176. void    setpcmark(), clrall(), clrmark();
  177. bool_t    setmark();
  178. LPTR    *getmark();
  179.  
  180. /*
  181.  * misccmds.c
  182.  */
  183. void    opencmd(), fileinfo(), inschar(), insstr(), delline();
  184. bool_t    delchar();
  185. int    cntllines(), plines();
  186. LPTR    *gotoline();
  187.  
  188. /*
  189.  * normal.c
  190.  */
  191. void    normal(), resetundo();
  192. char    *mkstr();
  193.  
  194. /*
  195.  * param.c
  196.  */
  197. void    doset();
  198.  
  199. /*
  200.  * ptrfunc.c
  201.  */
  202. int    inc(), dec();
  203. int    gchar();
  204. void    pchar(), pswap();
  205. bool_t    lt(), gt(), equal(), ltoreq(), gtoreq();
  206.  
  207. /*
  208.  * screen.c
  209.  */
  210. void    updatescreen(), updateline();
  211. void    screenclear(), cursupdate();
  212. void    s_ins(), s_del();
  213.  
  214. /*
  215.  * search.c
  216.  */
  217. void    dosearch(), repsearch();
  218. bool_t    searchc(), crepsearch(), findfunc();
  219. LPTR    *showmatch();
  220. LPTR    *fwd_word(), *bck_word(), *end_word();
  221.  
  222. /*
  223.  * Machine-dependent routines.
  224.  */
  225. int    inchar();
  226. void    outchar(), outstr(), beep();
  227. #ifndef    OS2
  228. void    remove(), rename();
  229. #endif
  230. void    windinit(), windexit(), windgoto();
  231. void    delay();
  232.