home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume37 / vim / part10 < prev    next >
Text File  |  1993-04-24  |  40KB  |  1,311 lines

  1. Newsgroups: comp.sources.misc
  2. From: mool@oce.nl (Bram Moolenaar)
  3. Subject: v37i010:  vim - Vi IMitation editor v1.27, Part10/24
  4. Message-ID: <1993Apr25.013249.22121@sparky.imd.sterling.com>
  5. X-Md4-Signature: 9deda35be89b3c582eb5d52aada5fe78
  6. Date: Sun, 25 Apr 1993 01:32:49 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: mool@oce.nl (Bram Moolenaar)
  10. Posting-number: Volume 37, Issue 10
  11. Archive-name: vim/part10
  12. Environment: UNIX, AMIGA, MS-DOS
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then unpack
  16. # it by saving it into a file and typing "sh file".  To overwrite existing
  17. # files, type "sh file -c".  You can also feed this as standard input via
  18. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  19. # will see the following message at the end:
  20. #        "End of archive 10 (of 23)."
  21. # Contents:  vim/src/tags vim/src/term.c
  22. # Wrapped by mool@oce-rd2 on Mon Apr 19 15:50:10 1993
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. if test -f 'vim/src/tags' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'vim/src/tags'\"
  26. else
  27. echo shar: Extracting \"'vim/src/tags'\" \(17914 characters\)
  28. sed "s/^X//" >'vim/src/tags' <<'END_OF_FILE'
  29. XAppendNumberToRedobuff    buffers.c    /^AppendNumberToRedobuff(n)$/
  30. XAppendToRedobuff    buffers.c    /^AppendToRedobuff(s)$/
  31. XChk_Abort    amiga.c    /^Chk_Abort()$/
  32. XCtrl    ascii.h    /^#define Ctrl(x) ((x) & 0x1f)$/
  33. XDoOneCmd    cmdline.c    /^DoOneCmd(buff)$/
  34. XExpandOne    cmdline.c    /^ExpandOne(str, list_notfound, mode)$/
  35. XExpandWildCards    amiga.c    /^ExpandWildCards(num_pat, pat, num_file, file, file/
  36. XFAIL    regexp.c    /^#define FAIL(m) { emsg(m); return NULL; }$/
  37. XFreeWild    amiga.c    /^FreeWild(num, file)$/
  38. XFullName    amiga.c    /^FullName(fname, buf, len)$/
  39. XGetChars    amiga.c    /^GetChars(buf, maxlen, type)$/
  40. XINIT    normal.c    /^#define INIT(x) x$/
  41. XISSPECIAL    edit.c    /^#define ISSPECIAL(c)    ((c) < ' ' || (c) >= DEL)$/
  42. XMP    amiga.c    /^#define MP(xx)    ((struct MsgPort *)((struct FileHan/
  43. XMaddcr    addcr.c    /^main(argc, argv)$/
  44. XMagic    regexp.c    /^#define Magic(x)    ((x)|('\\\\'<<8))$/
  45. XMmain    main.c    /^main(argc, argv)$/
  46. XMmkcmdtab    mkcmdtab.c    /^main(argc, argv)$/
  47. XNEXT    regexp.c    /^#define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&/
  48. XOP    regexp.c    /^#define OP(p)    (*(p))$/
  49. XOPENDEBUG    debug.h    /^#    define OPENDEBUG(file)\\$/
  50. XOPERAND    regexp.c    /^#define OPERAND(p)        ((p) + 3)$/
  51. XOpencmd    misccmds.c    /^Opencmd(dir, redraw)$/
  52. XPeekChr    regexp.c    /^#define PeekChr() curchr    \/* shortcut only when las/
  53. XRead    unix.c    /^Read(buf, maxlen)$/
  54. XRealWaitForChar    unix.c    /^RealWaitForChar(ticks)$/
  55. XResetBuffers    buffers.c    /^ResetBuffers()$/
  56. XSupdatescript    script.c    /^Supdatescript(str)$/
  57. XTTEST    term.c    /^# define TTEST(a) debug1("%s: ", "a"); if (a) {deb/
  58. XUCHARAT    regexp.c    /^#define UCHARAT(p)        ((int)*(unsigned char *)(p))$/
  59. XWaitForChar    msdos.c    /^WaitForChar(msec)$/
  60. X__ARGS    regsub.c    /^# define __ARGS(a)    a$/
  61. X__PARMS    vim.h    /^# define __PARMS(x)    x$/
  62. X_addfmt    termlib.c    /^_addfmt(buf, fmt, val)             \/* add val to b/
  63. X_find    termlib.c    /^_find(s, set)   \/* finds next c in s that's a memb/
  64. X_match    termlib.c    /^_match(s1, s2)                 \/* returns length o/
  65. Xadd_buff    buffers.c    /^add_buff(buf, s)$/
  66. Xadd_num_buff    buffers.c    /^add_num_buff(buf, n)$/
  67. Xaddfile    msdos.c    /^addfile(fl, f)$/
  68. Xaddstar    cmdline.c    /^addstar(fname, len)$/
  69. XadjustCurpos    linefunc.c    /^adjustCurpos()$/
  70. Xadjust_lnum    normal.c    /^adjust_lnum()$/
  71. Xadjustmark    mark.c    /^adjustmark(old, new)$/
  72. Xalloc    alloc.c    /^alloc(size)$/
  73. Xalloc_block    storage.c    /^alloc_block()$/
  74. Xalloc_line    storage.c    /^alloc_line(size)$/
  75. Xappendline    storage.c    /^appendline(after, s)$/
  76. Xask_yesno    misccmds.c    /^ask_yesno(str)$/
  77. Xautowrite    cmdline.c    /^autowrite()$/
  78. Xbck_word    search.c    /^bck_word(count, type)$/
  79. Xbeep    misccmds.c    /^beep()$/
  80. Xbeginline    edit.c    /^beginline(flag)$/
  81. Xblink    msdos.c    /^blink(n)$/
  82. Xblock_prep    ops.c    /^block_prep(lnum, delete)$/
  83. Xbreakcheck    amiga.c    /^breakcheck()$/
  84. Xbsdmemset    alloc.c    /^bsdmemset(ptr, c, size)$/
  85. Xbuf1line    macros.h    /^#define buf1line() (line_count == 1)$/
  86. Xbufempty    macros.h    /^#define bufempty() (buf1line() && lineempty((linen/
  87. Xbzero    unix.c    /^#  define bzero(a, b)    memset((a), 0, (b))$/
  88. Xcall_shell    amiga.c    /^call_shell(cmd, filter)$/
  89. Xcanincrease    storage.c    /^canincrease(n)$/
  90. Xcatch_cbrk    msdos.c    /^catch_cbrk()$/
  91. Xcatch_cint    msdos.c    /^catch_cint(bp, di, si, ds, es, dx, cx, bx, ax)$/
  92. Xcbrk_handler    msdos.c    /^cbrk_handler()$/
  93. Xcharsize    charset.c    /^charsize(c)$/
  94. Xchartabsize    charset.c    /^chartabsize(c, col)$/
  95. Xcheck_changed    cmdline.c    /^check_changed(checkaw)$/
  96. Xcheck_fname    cmdline.c    /^check_fname()$/
  97. Xcheck_list    storage.c    /^check_list()$/
  98. Xcheck_more    cmdline.c    /^check_more()$/
  99. Xcheck_readonly    cmdline.c    /^check_readonly()$/
  100. Xcheck_win    amiga.c    /^check_win(argc, argv)$/
  101. Xcheck_winsize    term.c    /^check_winsize()$/
  102. Xcheckclearop    normal.c    /^checkclearop()$/
  103. Xcheckclearopq    normal.c    /^checkclearopq()$/
  104. Xchk_mline    fileio.c    /^chk_mline(lnum)$/
  105. Xclear_line    screen.c    /^clear_line()$/
  106. Xclear_termparam    param.c    /^clear_termparam()$/
  107. Xclearmarked    storage.c    /^clearmarked()$/
  108. Xclearopbeep    normal.c    /^clearopbeep()$/
  109. Xclrallmarks    mark.c    /^clrallmarks()$/
  110. Xclrtags    tag.c    /^clrtags()$/
  111. Xcls    search.c    /^cls()$/
  112. Xcmdchecklen    cmdline.c    /^cmdchecklen()$/
  113. Xcoladvance    linefunc.c    /^coladvance(wcol)$/
  114. Xcomp_Botline    screen.c    /^comp_Botline()$/
  115. Xcopy_redo    buffers.c    /^copy_redo()$/
  116. Xcopy_spaces    alloc.c    /^copy_spaces(ptr, count)$/
  117. Xcstrchr    regexp.c    /^cstrchr(s, c)$/
  118. Xcstrncmp    regexp.c    /^cstrncmp(s1, s2, n)$/
  119. Xcurs_columns    screen.c    /^curs_columns()$/
  120. Xcursorcmd    cmdline.c    /^cursorcmd()$/
  121. Xcursupdate    screen.c    /^cursupdate()$/
  122. Xdebug    debug.h    /^#    define debug(x) {fprintf(debugfp,x);fflush(debug/
  123. Xdebug1    debug.h    /^#    define debug1(x,a) {fprintf(debugfp,x,a);fflush(/
  124. Xdebug2    debug.h    /^#    define debug2(x,a,b) {fprintf(debugfp,x,a,b);ffl/
  125. Xdebug3    debug.h    /^#    define debug3(x,a,b,c) {fprintf(debugfp,x,a,b,c)/
  126. Xdec    linefunc.c    /^dec(lp)$/
  127. XdecCurpos    linefunc.c    /^decCurpos()$/
  128. Xdecl    linefunc.c    /^decl(lp)$/
  129. Xdecrmarks    mark.c    /^decrmarks()$/
  130. Xdecrtags    tag.c    /^decrtags()$/
  131. Xdelchar    misccmds.c    /^delchar(fixpos)$/
  132. Xdellines    misccmds.c    /^dellines(nlines, can_update)$/
  133. Xdelmode    screen.c    /^delmode()$/
  134. Xdelsline    storage.c    /^delsline(nr, delmarks)$/
  135. Xdirname    amiga.c    /^dirname(buf, len)$/
  136. Xdo_Lower    regsub.c    /^do_Lower(d, c)$/
  137. Xdo_Upper    regsub.c    /^do_Upper(d, c)$/
  138. Xdo_copy    regsub.c    /^do_copy(d, c)$/
  139. Xdo_lower    regsub.c    /^do_lower(d, c)$/
  140. Xdo_mlines    fileio.c    /^do_mlines()$/
  141. Xdo_upper    regsub.c    /^do_upper(d, c)$/
  142. Xdoaddsub    ops.c    /^doaddsub(c, Prenum1)$/
  143. Xdoarglist    cmdline.c    /^doarglist(str)$/
  144. Xdobang    cmdline.c    /^dobang(addr_count, arg)$/
  145. Xdochange    ops.c    /^dochange()$/
  146. Xdocmdline    cmdline.c    /^docmdline(cmdline)$/
  147. Xdodelete    ops.c    /^dodelete()$/
  148. Xdodis    ops.c    /^dodis()$/
  149. Xdodojoin    ops.c    /^dodojoin(count, flag, redraw)$/
  150. Xdoecmd    cmdline.c    /^doecmd(arg)$/
  151. Xdoexecbuf    ops.c    /^doexecbuf(c)$/
  152. Xdofilter    cmdline.c    /^dofilter(buff, do_in, do_out)$/
  153. Xdoformat    ops.c    /^doformat()$/
  154. Xdoglob    csearch.c    /^doglob(type, lp, up, cmd)$/
  155. Xdojoin    ops.c    /^dojoin(insert_space)$/
  156. Xdojumps    mark.c    /^dojumps()$/
  157. Xdomap    buffers.c    /^domap(maptype, keys, mode)$/
  158. Xdomarks    mark.c    /^domarks()$/
  159. Xdoput    ops.c    /^doput(dir, count)$/
  160. Xdorecord    ops.c    /^dorecord(c)$/
  161. Xdos_packet    amiga.c    /^dos_packet(pid, action, arg)$/
  162. Xdosearch    search.c    /^dosearch(dir, str, reverse, count, echo)$/
  163. Xdoset    param.c    /^doset(arg)$/
  164. Xdoshell    cmdline.c    /^doshell(cmd)$/
  165. Xdoshift    ops.c    /^doshift(op)$/
  166. Xdosource    cmdline.c    /^dosource(fname)$/
  167. Xdosub    csearch.c    /^dosub(lp, up, cmd, nextcommand)$/
  168. Xdotag    tag.c    /^dotag(tag, type, count)$/
  169. Xdotags    tag.c    /^dotags()$/
  170. Xdotilde    ops.c    /^dotilde()$/
  171. Xdowrite    cmdline.c    /^dowrite(arg, append)$/
  172. Xdoyank    ops.c    /^doyank(deleting)$/
  173. Xedit    edit.c    /^edit(count)$/
  174. Xemsg    message.c    /^emsg(s)$/
  175. Xend_word    search.c    /^end_word(count, type, stop)$/
  176. Xequal    macros.h    /^#define equal(a, b) (((a).lnum == (b).lnum) && ((a/
  177. Xexpand_env    misccmds.c    /^expand_env(src, dst, dstlen)$/
  178. Xexpandpath    msdos.c    /^expandpath(fl, path, fonly, donly, notf)$/
  179. Xfilealloc    storage.c    /^filealloc()$/
  180. Xfileinfo    misccmds.c    /^fileinfo()$/
  181. Xfilemess    fileio.c    /^filemess(name, s)$/
  182. Xfill_inbuf    unix.c    /^fill_inbuf()$/
  183. Xfindfunc    search.c    /^findfunc(dir, what, count)$/
  184. Xfindpar    search.c    /^findpar(dir, count, what)$/
  185. Xfindsent    search.c    /^findsent(dir, count)$/
  186. Xfindtag    tag.c    /^findtag(tag)$/
  187. Xfirstmarked    storage.c    /^firstmarked()$/
  188. Xfirsttaborspace    tag.c    /^firsttaborspace(str)$/
  189. Xflush_buffers    buffers.c    /^flush_buffers()$/
  190. Xflushbuf    amiga.c    /^flushbuf()$/
  191. Xfm_getname    mark.c    /^fm_getname(fmark)$/
  192. Xfname_case    amiga.c    /^fname_case(name)$/
  193. Xfnamecmp    vim.h    /^# define fnamecmp(x, y) stricmp((x), (y))$/
  194. Xfree    vim.h    /^# define free(x)    nofreeNULL(x)$/
  195. Xfree_buff    buffers.c    /^free_buff(buf)$/
  196. Xfree_line    storage.c    /^free_line(ptr)$/
  197. Xfree_yank    ops.c    /^free_yank(n)$/
  198. Xfree_yank_all    ops.c    /^free_yank_all()$/
  199. Xfreeall    storage.c    /^freeall()$/
  200. Xfreefiles    amiga.c    /^freefiles()$/
  201. Xfullpathcmp    misccmds.c    /^fullpathcmp(s1, s2)$/
  202. Xfwd_word    search.c    /^fwd_word(count, type)$/
  203. Xgchar    misccmds.c    /^gchar(pos)$/
  204. XgcharCurpos    misccmds.c    /^gcharCurpos()$/
  205. Xget_address    cmdline.c    /^get_address(ptr)$/
  206. Xget_bufcont    buffers.c    /^get_bufcont(buffer)$/
  207. Xget_fib    amiga.c    /^get_fib(fname)$/
  208. Xget_indent    misccmds.c    /^get_indent()$/
  209. Xget_inserted    buffers.c    /^get_inserted()$/
  210. Xget_literal    edit.c    /^get_literal(nextc)$/
  211. Xget_recorded    buffers.c    /^get_recorded()$/
  212. Xget_yank_buffer    ops.c    /^get_yank_buffer(writing)$/
  213. Xgetaltfile    cmdline.c    /^getaltfile(n, lnum, setpm)$/
  214. Xgetaltfname    cmdline.c    /^getaltfname(n)$/
  215. Xgetchr    regexp.c    /^getchr()$/
  216. Xgetcmdline    cmdline.c    /^getcmdline(firstc, buff)$/
  217. Xgetdigits    misccmds.c    /^getdigits(pp)$/
  218. Xgetdigraph    digraph.c    /^getdigraph(char1, char2)$/
  219. Xgetent    termlib.c    /^getent(tbuf, term, termcap, buflen)$/
  220. Xgetfile    cmdline.c    /^getfile(fname, setpm)$/
  221. Xgetlinecol    term.c    /^getlinecol()$/
  222. Xgetmark    mark.c    /^getmark(c, changefile)$/
  223. Xgetout    main.c    /^getout(r)$/
  224. Xgetperm    amiga.c    /^getperm(name)$/
  225. Xgetvcol    screen.c    /^getvcol(pos, type)$/
  226. Xgotocmdline    cmdline.c    /^gotocmdline(clr, firstc)$/
  227. Xhas_wildcard    amiga.c    /^has_wildcard(p)$/
  228. Xhelp    help.c    /^help()$/
  229. Xinc    linefunc.c    /^inc(lp)$/
  230. XincCurpos    linefunc.c    /^incCurpos()$/
  231. Xinchar    term.c    /^inchar(async, waitforever)$/
  232. Xincl    linefunc.c    /^incl(lp)$/
  233. Xincrmarks    mark.c    /^incrmarks()$/
  234. Xincrtags    tag.c    /^incrtags()$/
  235. Xinindent    misccmds.c    /^inindent()$/
  236. Xinit_yank    ops.c    /^init_yank()$/
  237. Xinitchr    regexp.c    /^initchr(str)$/
  238. Xinmacro    search.c    /^inmacro(opt, s)$/
  239. Xins_mapbuf    buffers.c    /^ins_mapbuf(str)$/
  240. Xinschar    misccmds.c    /^inschar(c)$/
  241. Xinsertbuf    ops.c    /^insertbuf(c)$/
  242. Xinsertchar    edit.c    /^insertchar(c)$/
  243. Xinsfile    amiga.c    /^insfile(name)$/
  244. Xinsstr    misccmds.c    /^insstr(s)$/
  245. Xisdir    amiga.c    /^isdir(name)$/
  246. Xisidchar    charset.c    /^isidchar(c)$/
  247. Xismult    regexp.c    /^ismult(c)$/
  248. Xistermparam    param.c    /^istermparam(p)$/
  249. Xlalloc    alloc.c    /^lalloc(size, message)$/
  250. Xlineempty    macros.h    /^#define lineempty(p) (*nr2ptr(p) == NUL)$/
  251. Xlistdigraphs    digraph.c    /^listdigraphs()$/
  252. Xlock2name    amiga.c    /^lock2name(lock, buf, len)$/
  253. Xlt    macros.h    /^#define lt(a, b) (((a).lnum != (b).lnum) \\$/
  254. Xltoreq    macros.h    /^#define ltoreq(a, b) (((a).lnum != (b).lnum) \\$/
  255. Xm_blockalloc    storage.c    /^m_blockalloc(size, message)$/
  256. Xm_blockfree    storage.c    /^m_blockfree()$/
  257. Xm_error    storage.c    /^m_error()$/
  258. Xmakemap    buffers.c    /^makemap(fd)$/
  259. Xmakescriptname    script.c    /^makescriptname()$/
  260. Xmakeset    param.c    /^makeset(fd)$/
  261. Xmaketitle    misccmds.c    /^maketitle()$/
  262. Xmark2pos    mark.c    /^mark2pos(markp)$/
  263. Xmch_get_winsize    amiga.c    /^mch_get_winsize()$/
  264. Xmch_set_winsize    amiga.c    /^mch_set_winsize()$/
  265. Xmch_settmode    amiga.c    /^mch_settmode(raw)$/
  266. Xmch_suspend    amiga.c    /^mch_suspend()$/
  267. Xmch_windexit    amiga.c    /^mch_windexit(r)$/
  268. Xmch_windinit    amiga.c    /^mch_windinit()$/
  269. Xmemmove    unix.h    /^#define memmove(to, from, len) memcpy(to, from, le/
  270. Xmemset    vim.h    /^#define memset(ptr, c, size)    bsdmemset(ptr, c, siz/
  271. Xmkstr    alloc.c    /^mkstr(c)$/
  272. Xmktemp    cmdline.c    /^# define mktemp(a)    tmpnam(a)$/
  273. Xmkup    regexp.c    /^#define mkup(c)         (reg_ic ? toupper(c) : (c))$/
  274. Xmodname    script.c    /^modname(fname, ext)$/
  275. Xmovemark    mark.c    /^movemark(count)$/
  276. Xmsg    message.c    /^msg(s)$/
  277. Xmsgmore    misccmds.c    /^msgmore(n)$/
  278. Xmyregcomp    search.c    /^myregcomp(pat)$/
  279. Xnextent    termlib.c    /^nextent(tbuf, termcap, buflen)         \/* Read 1 e/
  280. XnofreeNULL    alloc.c    /^nofreeNULL(x)$/
  281. Xnormal    normal.c    /^normal()$/
  282. Xnr2ptr    storage.c    /^nr2ptr(nr)$/
  283. Xonedown    edit.c    /^onedown(n)$/
  284. Xoneleft    edit.c    /^oneleft()$/
  285. Xonepage    edit.c    /^onepage(dir, count)$/
  286. Xoneright    edit.c    /^oneright()$/
  287. Xoneup    edit.c    /^oneup(n)$/
  288. Xopenrecover    script.c    /^openrecover()$/
  289. Xopenscript    script.c    /^openscript(name)$/
  290. Xotherfile    misccmds.c    /^otherfile(s)$/
  291. Xoutchar    amiga.c    /^outchar(c)$/
  292. Xoutnum    term.c    /^outnum(n)$/
  293. Xoutstr    msdos.c    /^outstr(s)$/
  294. Xoutstrn    term.c    /^outstrn(s)$/
  295. Xouttrans    charset.c    /^outtrans(str, len)$/
  296. Xparse_builtin_tcap    term.c    /^parse_builtin_tcap(tc, s)$/
  297. Xpchar    macros.h    /^#define pchar(lp, c) (*(nr2ptr((lp).lnum) + (lp).c/
  298. Xpeekchr    regexp.c    /^peekchr()$/
  299. Xpeekpeekchr    regexp.c    /^peekpeekchr()$/
  300. Xplines    misccmds.c    /^plines(p)$/
  301. Xplines_m    misccmds.c    /^plines_m(first, last)$/
  302. Xplural    misccmds.c    /^plural(n)$/
  303. Xpos2ptr    storage.c    /^pos2ptr(pos)$/
  304. Xpremsg    normal.c    /^premsg(c1, c2)$/
  305. Xprep_redo    normal.c    /^prep_redo(num, cmd, c, nchar)$/
  306. Xprintdigraph    digraph.c    /^printdigraph(p)$/
  307. Xprt_line    screen.c    /^prt_line(s)$/
  308. Xpstrcmp    msdos.c    /^pstrcmp(a, b)$/
  309. Xptr2nr    storage.c    /^ptr2nr(ptr, start)$/
  310. Xputdigraph    digraph.c    /^putdigraph(str)$/
  311. Xqf_adjustmark    quickfix.c    /^qf_adjustmark(old, new)$/
  312. Xqf_clrallmarks    quickfix.c    /^qf_clrallmarks()$/
  313. Xqf_free    quickfix.c    /^qf_free()$/
  314. Xqf_init    quickfix.c    /^qf_init(fname)$/
  315. Xqf_jump    quickfix.c    /^qf_jump(errornr)$/
  316. Xqf_list    quickfix.c    /^qf_list()$/
  317. Xread_redo    buffers.c    /^read_redo(init)$/
  318. Xread_stuff    buffers.c    /^read_stuff(advance)$/
  319. Xreadfile    fileio.c    /^readfile(fname, from, newfile)$/
  320. Xredrawcmd    cmdline.c    /^redrawcmd()$/
  321. Xredrawcmdline    cmdline.c    /^redrawcmdline()$/
  322. Xredrawhelp    help.c    /^redrawhelp()$/
  323. Xreg    regexp.c    /^reg(paren, flagp)$/
  324. Xregatom    regexp.c    /^regatom(flagp)$/
  325. Xregbranch    regexp.c    /^regbranch(flagp)$/
  326. Xregc    regexp.c    /^regc(b)$/
  327. Xregcomp    regexp.c    /^regcomp(exp)$/
  328. Xregdump    regexp.c    /^regdump(r)$/
  329. Xregexec    regexp.c    /^regexec(prog, string, at_bol)$/
  330. Xreginsert    regexp.c    /^reginsert(op, opnd)$/
  331. Xregmatch    regexp.c    /^regmatch(prog)$/
  332. Xregnext    regexp.c    /^regnext(p)$/
  333. Xregnode    regexp.c    /^regnode(op)$/
  334. Xregoptail    regexp.c    /^regoptail(p, val)$/
  335. Xregpiece    regexp.c    /^regpiece(flagp)$/
  336. Xregprop    regexp.c    /^regprop(op)$/
  337. Xregrepeat    regexp.c    /^regrepeat(p)$/
  338. Xregsub    regsub.c    /^regsub(prog, source, dest, copy, magic)$/
  339. Xregtail    regexp.c    /^regtail(p, val)$/
  340. Xregtry    regexp.c    /^regtry(prog, string)$/
  341. Xremove    msdos.c    /^remove(name)$/
  342. Xrename    unix.c    /^rename(src, dst)$/
  343. Xreplaceline    storage.c    /^replaceline(lnum, new)$/
  344. Xresettitle    amiga.c    /^resettitle()$/
  345. Xs_del    screen.c    /^s_del(row, nlines, invalid)$/
  346. Xs_ins    screen.c    /^s_ins(row, nlines, invalid)$/
  347. Xsamealtfile    cmdline.c    /^samealtfile(n)$/
  348. Xsave_line    storage.c    /^save_line(src)$/
  349. Xscreenalloc    screen.c    /^screenalloc()$/
  350. Xscreenchar    screen.c    /^screenchar(p, row, col)$/
  351. Xscreenclear    screen.c    /^screenclear()$/
  352. Xscreenfill    screen.c    /^screenfill(srow, c)$/
  353. Xscreenline    screen.c    /^screenline(lnum, startrow, endrow)$/
  354. Xscript_winsize    script.c    /^script_winsize()$/
  355. Xscript_winsize_pp    script.c    /^script_winsize_pp()$/
  356. Xscrolldown    screen.c    /^scrolldown(nlines)$/
  357. Xscrollup    screen.c    /^scrollup(nlines)$/
  358. Xsearchc    search.c    /^searchc(c, dir, type, count)$/
  359. Xsearchit    search.c    /^searchit(pos, dir, str, count, end)$/
  360. Xset_Changed    misccmds.c    /^set_Changed()$/
  361. Xset_indent    misccmds.c    /^set_indent(size, delete)$/
  362. Xset_init    param.c    /^set_init()$/
  363. Xset_keymap    amiga.c    /^set_keymap(name)$/
  364. Xset_redo_ins    buffers.c    /^set_redo_ins()$/
  365. Xset_term    term.c    /^set_term(term)$/
  366. Xset_winsize    term.c    /^set_winsize(width, height, mustset)$/
  367. Xsetaltfname    cmdline.c    /^setaltfname(arg, lnum, newfile)$/
  368. Xsetcursor    term.c    /^setcursor()$/
  369. Xsetfname    misccmds.c    /^setfname(s)$/
  370. Xsetmark    mark.c    /^setmark(c)$/
  371. Xsetmarked    storage.c    /^setmarked(lnum)$/
  372. Xsetpcmark    mark.c    /^setpcmark()$/
  373. Xsetperm    amiga.c    /^setperm(name, perm)$/
  374. Xsettitle    amiga.c    /^settitle(str)$/
  375. Xsettmode    term.c    /^settmode(raw)$/
  376. Xshift_line    ops.c    /^shift_line(left)$/
  377. Xshowmap    buffers.c    /^showmap(mp)$/
  378. Xshowmatch    search.c    /^showmatch()$/
  379. Xshowmatches    cmdline.c    /^showmatches(file, len)$/
  380. Xshowmode    screen.c    /^showmode()$/
  381. Xshowonep    param.c    /^showonep(p)$/
  382. Xshowparams    param.c    /^showparams(all)$/
  383. Xshowruler    screen.c    /^showruler(always)$/
  384. Xsig_winch    unix.c    /^sig_winch(sig, code, scp)$/
  385. Xskip_chars    search.c    /^skip_chars(class, dir)$/
  386. Xskipchr    regexp.c    /^skipchr()$/
  387. Xskipspace    misccmds.c    /^skipspace(pp)$/
  388. Xskiptospace    misccmds.c    /^skiptospace(pp)$/
  389. Xsleep    amiga.c    /^sleep(n)$/
  390. Xsmsg    message.c    /^smsg(s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)$/
  391. XstartPS    search.c    /^startPS(lnum, para)$/
  392. Xstart_arrow    edit.c    /^start_arrow()$/
  393. Xstart_redo    buffers.c    /^start_redo(count)$/
  394. Xstart_redo_ins    buffers.c    /^start_redo_ins()$/
  395. Xstart_stuff    buffers.c    /^start_stuff()$/
  396. Xstartinsert    ops.c    /^startinsert(initstr, startln, count)$/
  397. Xstartscript    script.c    /^startscript()$/
  398. Xstarttermcap    term.c    /^starttermcap()$/
  399. Xstop_arrow    edit.c    /^stop_arrow()$/
  400. Xstop_insert    edit.c    /^stop_insert()$/
  401. Xstop_redo_ins    buffers.c    /^stop_redo_ins()$/
  402. Xstopscript    script.c    /^stopscript()$/
  403. Xstoptermcap    term.c    /^stoptermcap()$/
  404. Xstrchr    vim.h    /^#define strchr(ptr, c)            index(ptr, c)$/
  405. Xstrcspn    regexp.c    /^strcspn(s1, s2)$/
  406. Xstrlowcpy    msdos.c    /^strlowcpy(d, s)$/
  407. Xstrnfcpy    regsub.c    /^strnfcpy(f, d, s, n)$/
  408. Xstrnsave    alloc.c    /^strnsave(string, len)$/
  409. Xstrrchr    vim.h    /^#define strrchr(ptr, c)            rindex(ptr, c)$/
  410. Xstrsave    alloc.c    /^strsave(string)$/
  411. Xstrsize    charset.c    /^strsize(s)$/
  412. XstuffReadbuff    buffers.c    /^stuffReadbuff(s)$/
  413. Xstuff_empty    buffers.c    /^stuff_empty()$/
  414. Xstuff_inserted    edit.c    /^stuff_inserted(c, count, no_esc)$/
  415. Xstuff_yank    ops.c    /^stuff_yank(bufname, p)$/
  416. XstuffnumReadbuff    buffers.c    /^stuffnumReadbuff(n)$/
  417. Xswapchar    ops.c    /^swapchar(pos)$/
  418. Xtermcapinit    term.c    /^termcapinit(term)$/
  419. Xtextfile    msdos.c    /^textfile(on)$/
  420. Xtgetent    termlib.c    /^tgetent(tbuf, term)$/
  421. Xtgetflag    termlib.c    /^tgetflag(id)$/
  422. Xtgetnum    termlib.c    /^tgetnum(id)$/
  423. Xtgetstr    termlib.c    /^tgetstr(id, buf)$/
  424. Xtgoto    term.c    /^tgoto(cm, x, y)$/
  425. Xtinit    termlib.c    /^tinit(name)$/
  426. Xtltoa    term.c    /^tltoa(i)$/
  427. Xtputs    termlib.c    /^tputs(cp, affcnt, outc)$/
  428. Xtranschar    charset.c    /^transchar(c)$/
  429. Xttest    term.c    /^ttest(pairs)$/
  430. Xu_clearall    undo.c    /^u_clearall()$/
  431. Xu_clearline    undo.c    /^u_clearline()$/
  432. Xu_freeentry    undo.c    /^u_freeentry(uep, n)$/
  433. Xu_freelist    undo.c    /^u_freelist(uhp)$/
  434. Xu_getbot    undo.c    /^u_getbot()$/
  435. Xu_redo    undo.c    /^u_redo(count)$/
  436. Xu_save    undo.c    /^u_save(top, bot)$/
  437. Xu_saveCurpos    undo.c    /^u_saveCurpos()$/
  438. Xu_savecommon    undo.c    /^u_savecommon(top, bot, flag, ptr)$/
  439. Xu_savedel    undo.c    /^u_savedel(lnum, ptr)$/
  440. Xu_saveline    undo.c    /^u_saveline(lnum)$/
  441. Xu_savesub    undo.c    /^u_savesub(lnum, ptr)$/
  442. Xu_sync    undo.c    /^u_sync()$/
  443. Xu_undo    undo.c    /^u_undo(count)$/
  444. Xu_undoline    undo.c    /^u_undoline()$/
  445. Xu_undoredo    undo.c    /^u_undoredo()$/
  446. Xungetchr    regexp.c    /^ungetchr()$/
  447. Xunregc    regexp.c    /^unregc()$/
  448. XupdateScreen    screen.c    /^updateScreen(type)$/
  449. Xupdateline    screen.c    /^updateline()$/
  450. Xupdatescript    script.c    /^updatescript(c)$/
  451. Xusage    main.c    /^usage(n)$/
  452. Xvgetc    buffers.c    /^vgetc()$/
  453. Xvgetorpeek    buffers.c    /^vgetorpeek(advance)$/
  454. Xvim_delay    amiga.c    /^vim_delay()$/
  455. Xvimgetenv    amiga.c    /^vimgetenv(var)$/
  456. Xvpeekc    buffers.c    /^vpeekc()$/
  457. Xwait_return    message.c    /^wait_return(redraw)$/
  458. Xwin_resize_off    amiga.c    /^win_resize_off()$/
  459. Xwin_resize_on    amiga.c    /^win_resize_on()$/
  460. Xwindgoto    term.c    /^windgoto(row, col)$/
  461. Xwriteit    fileio.c    /^writeit(fname, start, end, append, forceit)$/
  462. END_OF_FILE
  463. if test 17914 -ne `wc -c <'vim/src/tags'`; then
  464.     echo shar: \"'vim/src/tags'\" unpacked with wrong size!
  465. fi
  466. # end of 'vim/src/tags'
  467. fi
  468. if test -f 'vim/src/term.c' -a "${1}" != "-c" ; then 
  469.   echo shar: Will not clobber existing file \"'vim/src/term.c'\"
  470. else
  471. echo shar: Extracting \"'vim/src/term.c'\" \(18112 characters\)
  472. sed "s/^X//" >'vim/src/term.c' <<'END_OF_FILE'
  473. X/* vi:sw=4:ts=4:
  474. X *
  475. X * term.c -- VIM - Vi IMitation
  476. X *
  477. X * primitive termcap support added
  478. X *
  479. X * NOTE: padding and variable substitution is not performed,
  480. X * when compiling without TERMCAP, we use tputs() and tgoto() dummies.
  481. X *
  482. X * 14.6.92
  483. X */
  484. X
  485. X#include "vim.h"
  486. X#include "globals.h"
  487. X#include "param.h"
  488. X#include "proto.h"
  489. X#ifdef TERMCAP
  490. X# ifdef linux
  491. X#  include <termcap.h>
  492. X#  define TPUTSFUNCAST (outfuntype)
  493. X# else
  494. X#  define TPUTSFUNCAST
  495. X#  ifdef AMIGA
  496. X#   include "proto/termlib.pro"
  497. X#  endif
  498. X# endif
  499. X#endif
  500. X
  501. X#ifdef DEBUG
  502. X# define TTEST(a) debug1("%s: ", "a"); if (a) {debug2("%02x %s\n", *a, a + 1);} else debug("NULL\n");
  503. X#endif
  504. X
  505. Xstatic void parse_builtin_tcap __ARGS((Tcarr *tc, char *s));
  506. X
  507. X/*
  508. X * Builtin_tcaps must always contain DFLT_TCAP as the first entry!
  509. X * DFLT_TCAP is used, when no terminal is specified with -T option or $TERM.
  510. X * The entries are compact, therefore they normally are included even when
  511. X * TERMCAP is defined.
  512. X * When TERMCAP is defined, the builtin entries can be accessed with
  513. X * "builtin_amiga", "builtin_ansi", "builtin_debug", etc.
  514. X */
  515. Xstatic char *builtin_tcaps[] =
  516. X{
  517. X#ifndef NO_BUILTIN_TCAPS
  518. X  DFLT_TCAP,        /* almost allways included */
  519. X# if !defined(UNIX) && (defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS))
  520. X  ANSI_TCAP,        /* default for unix */
  521. X# endif
  522. X# if !defined(AMIGA) && (defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS))
  523. X  AMIGA_TCAP,        /* default for amiga */
  524. X# endif
  525. X# if !defined(MSDOS) && (defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS))
  526. X  PCTERM_TCAP,        /* default for MSdos */
  527. X# endif
  528. X# if !defined(ATARI) && defined(ALL_BUILTIN_TCAPS)
  529. X  ATARI_TCAP,        /* default for Atari */
  530. X# endif
  531. X# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS)
  532. X  XTERM_TCAP,        /* always included on unix */
  533. X# endif
  534. X# ifdef ALL_BUILTIN_TCAPS
  535. X  VT52_TCAP,
  536. X# endif
  537. X# if defined(DEBUG) || defined(ALL_BUILTIN_TCAPS)
  538. X  DEBUG_TCAP,        /* always included when debugging */
  539. X# endif
  540. X#else /* NO_BUILTIN_TCAPS */
  541. X  "dump\0\0\0",
  542. X#endif /* NO_BUILTIN_TCAPS */
  543. X  NULL,
  544. X};
  545. X
  546. X/*
  547. X * Term_strings contains currently used terminal strings.
  548. X * It is initialized with the default values by parse_builtin_tcap().
  549. X * The values can be changed by setting the parameter with the same name.
  550. X */
  551. XTcarr term_strings;
  552. X
  553. X/*
  554. X * Parsing of the builtin termcap entries.
  555. X * The terminal's name is not set, as this is already done in termcapinit().
  556. X * Chop builtin termcaps, string entries are already '\0' terminated.
  557. X * not yet implemented:
  558. X *   boolean entries could be empty strings;
  559. X *   numeric entries would need a flag (e.g. high bit of the skip byte),
  560. X *   so that parse_builtin_tcap can handle them.
  561. X */
  562. X    static void
  563. Xparse_builtin_tcap(tc, s)
  564. X    Tcarr *tc;
  565. X    char *s;
  566. X{
  567. X    char **p = &tc->t_name;
  568. X
  569. X    p++;
  570. X    for (;;)
  571. X    {
  572. X        while (*s++)
  573. X            ;
  574. X        p += *s++;
  575. X        if (!*s)
  576. X            return;
  577. X        *p++ = s;
  578. X    }
  579. X}
  580. X
  581. X#ifdef TERMCAP
  582. X# ifndef linux        /* included in <termlib.h> */
  583. X#  ifndef AMIGA        /* included in proto/termlib.pro */
  584. Xint                tgetent();
  585. Xint                tgetnum();
  586. Xchar            *tgetstr();
  587. Xint                tputs();
  588. X#  endif /* AMIGA */
  589. X#  ifndef hpux
  590. Xextern short    ospeed;
  591. X#  endif
  592. X# endif /* linux */
  593. X# ifndef hpux
  594. Xextern char        *UP, *BC, PC;
  595. X# endif
  596. X#endif /* TERMCAP */
  597. X
  598. X    void
  599. Xset_term(term)
  600. X    char *term;
  601. X{
  602. X    char **p = builtin_tcaps;
  603. X#ifdef TERMCAP
  604. X    int builtin = 0;
  605. X#endif
  606. X    int width = 0, height = 0;
  607. X
  608. X    clear_termparam();        /* clear old parameters */
  609. X    if (!strncmp(term, "builtin_", (size_t)8))
  610. X    {
  611. X        term += 8;
  612. X#ifdef TERMCAP
  613. X        builtin = 1;
  614. X#endif
  615. X    }
  616. X#ifdef TERMCAP
  617. X    else
  618. X    {
  619. X        for (;;)
  620. X        {
  621. X            char            *p;
  622. X            static char    tstrbuf[TBUFSZ];
  623. X            char            tbuf[TBUFSZ];
  624. X            char            *tp = tstrbuf;
  625. X            int            i;
  626. X
  627. X            i = tgetent(tbuf, term);
  628. X            if (i == -1)
  629. X            {
  630. X                emsg("Cannot open termcap file");
  631. X                builtin = 1;
  632. X                break;
  633. X            }
  634. X            if (i == 0)
  635. X            {
  636. X                emsg("terminal entry not found");
  637. X                builtin = 1;
  638. X                break;
  639. X            }
  640. X
  641. X        /* output strings */
  642. X            T_EL = tgetstr("ce", &tp);
  643. X            T_IL = tgetstr("al", &tp);
  644. X            T_CIL = tgetstr("AL", &tp);
  645. X            T_DL = tgetstr("dl", &tp);
  646. X            T_CDL = tgetstr("DL", &tp);
  647. X            T_ED = tgetstr("cl", &tp);
  648. X            T_CI = tgetstr("vi", &tp);
  649. X            T_CV = tgetstr("ve", &tp);
  650. X            T_TP = tgetstr("me", &tp);
  651. X            T_TI = tgetstr("mr", &tp);
  652. X            T_CM = tgetstr("cm", &tp);
  653. X            T_SR = tgetstr("sr", &tp);
  654. X            T_CRI = tgetstr("RI", &tp);
  655. X            T_VB = tgetstr("vb", &tp);
  656. X            T_KS = tgetstr("ks", &tp);
  657. X            T_KE = tgetstr("ke", &tp);
  658. X            T_TS = tgetstr("ti", &tp);
  659. X            T_TE = tgetstr("te", &tp);
  660. X
  661. X        /* key codes */
  662. X            term_strings.t_ku = tgetstr("ku", &tp);
  663. X            term_strings.t_kd = tgetstr("kd", &tp);
  664. X            term_strings.t_kl = tgetstr("kl", &tp);
  665. X            term_strings.t_kr = tgetstr("kr", &tp);
  666. X            /* term_strings.t_sku = tgetstr("", &tp); termcap code unknown */
  667. X            /* term_strings.t_skd = tgetstr("", &tp); termcap code unknown */
  668. X            term_strings.t_sku = NULL;
  669. X            term_strings.t_skd = NULL;
  670. X            term_strings.t_skl = tgetstr("#4", &tp);
  671. X            term_strings.t_skr = tgetstr("%i", &tp);
  672. X            term_strings.t_f1 = tgetstr("k1", &tp);
  673. X            term_strings.t_f2 = tgetstr("k2", &tp);
  674. X            term_strings.t_f3 = tgetstr("k3", &tp);
  675. X            term_strings.t_f4 = tgetstr("k4", &tp);
  676. X            term_strings.t_f5 = tgetstr("k5", &tp);
  677. X            term_strings.t_f6 = tgetstr("k6", &tp);
  678. X            term_strings.t_f7 = tgetstr("k7", &tp);
  679. X            term_strings.t_f8 = tgetstr("k8", &tp);
  680. X            term_strings.t_f9 = tgetstr("k9", &tp);
  681. X            term_strings.t_f10 = tgetstr("k;", &tp);
  682. X            term_strings.t_sf1 = tgetstr("F1", &tp);    /* really function keys 11-20 */
  683. X            term_strings.t_sf2 = tgetstr("F2", &tp);
  684. X            term_strings.t_sf3 = tgetstr("F3", &tp);
  685. X            term_strings.t_sf4 = tgetstr("F4", &tp);
  686. X            term_strings.t_sf5 = tgetstr("F5", &tp);
  687. X            term_strings.t_sf6 = tgetstr("F6", &tp);
  688. X            term_strings.t_sf7 = tgetstr("F7", &tp);
  689. X            term_strings.t_sf8 = tgetstr("F8", &tp);
  690. X            term_strings.t_sf9 = tgetstr("F9", &tp);
  691. X            term_strings.t_sf10 = tgetstr("FA", &tp);
  692. X            term_strings.t_help = tgetstr("%1", &tp);
  693. X            term_strings.t_undo = tgetstr("&8", &tp);
  694. X
  695. X            height = tgetnum("li");
  696. X            width = tgetnum("co");
  697. X
  698. X# ifndef hpux
  699. X            BC = tgetstr("bc", &tp);
  700. X            UP = tgetstr("up", &tp);
  701. X            p = tgetstr("pc", &tp);
  702. X            if (p)
  703. X                PC = *p;
  704. X            ospeed = 0;
  705. X# endif
  706. X            break;
  707. X        }
  708. X    }
  709. X    if (builtin)
  710. X#endif
  711. X    {
  712. X        while (*p && strcmp(term, *p))
  713. X            p++;
  714. X        if (!*p)
  715. X        {
  716. X            fprintf(stderr, "'%s' not builtin. Available terminals are:\n", term);
  717. X            for (p = builtin_tcaps; *p; p++)
  718. X                fprintf(stderr, "\t%s\n", *p);
  719. X            sleep(2);
  720. X            fprintf(stderr, "defaulting to '%s'\n", *builtin_tcaps);
  721. X            sleep(2);
  722. X            p = builtin_tcaps;
  723. X            free(term_strings.t_name);
  724. X            term_strings.t_name = strsave(term = *p);
  725. X        }
  726. X        parse_builtin_tcap(&term_strings, *p);
  727. X    }
  728. X#if defined(AMIGA) || defined(MSDOS)
  729. X        /* DFLT_TCAP indicates that it is the machine console. */
  730. X    if (strcmp(term, *builtin_tcaps))
  731. X        term_console = FALSE;
  732. X    else
  733. X    {
  734. X        term_console = TRUE;
  735. X# ifdef AMIGA
  736. X        win_resize_on();        /* enable window resizing reports */
  737. X# endif
  738. X    }
  739. X#endif
  740. X    ttest(TRUE);
  741. X        /* display initial screen after ttest() checking. jw. */
  742. X    if (width <= 0 || height <= 0)
  743. X    {
  744. X        /* termcap failed to report size */
  745. X        /* set defaults, in case mch_get_winsize also fails */
  746. X        width = 80;
  747. X        height = 24;
  748. X    }
  749. X    set_winsize(width, height, FALSE);  
  750. X}
  751. X
  752. X#if defined(TERMCAP) && defined(UNIX)
  753. X/*
  754. X * Get Columns and Rows from the termcap. Used after a window signal if the
  755. X * ioctl() fails. It doesn't make sense to call tgetent each time if the "co"
  756. X * and "li" entries never change. But this may happen on some systems.
  757. X */
  758. X    void
  759. Xgetlinecol()
  760. X{
  761. X    char            tbuf[TBUFSZ];
  762. X
  763. X    if (term_strings.t_name && tgetent(tbuf, term_strings.t_name) > 0)
  764. X    {
  765. X        if (Columns == 0)
  766. X            Columns = tgetnum("co");
  767. X        if (Rows == 0)
  768. X            Rows = tgetnum("li");
  769. X    }
  770. X}
  771. X#endif
  772. X
  773. Xstatic char *tltoa __PARMS((unsigned long));
  774. X
  775. X    static char *
  776. Xtltoa(i)
  777. X    unsigned long i;
  778. X{
  779. X    static char buf[16];
  780. X    char        *p;
  781. X
  782. X    p = buf + 15;
  783. X    *p = '\0';
  784. X    do
  785. X    {
  786. X        --p;
  787. X        *p = i % 10 + '0';
  788. X        i /= 10;
  789. X    }
  790. X    while (i > 0 && p > buf);
  791. X    return p;
  792. X}
  793. X
  794. X#ifndef TERMCAP
  795. X
  796. X/*
  797. X * minimal tgoto() implementation.
  798. X * no padding and we only parse for %i %d and %+char
  799. X */
  800. X
  801. X    char *
  802. Xtgoto(cm, x, y)
  803. X    char *cm;
  804. X    int x, y;
  805. X{
  806. X    static char buf[30];
  807. X    char *p, *s, *e;
  808. X
  809. X    if (!cm)
  810. X        return "OOPS";
  811. X    e = buf + 29;
  812. X    for (s = buf; s < e && *cm; cm++)
  813. X    {
  814. X        if (*cm != '%')
  815. X        {
  816. X            *s++ = *cm;
  817. X            continue;
  818. X        }
  819. X        switch (*++cm)
  820. X        {
  821. X        case 'd':
  822. X            p = tltoa((unsigned long)y);
  823. X            y = x;
  824. X            while (*p)
  825. X                *s++ = *p++;
  826. X            break;
  827. X        case 'i':
  828. X            x++;
  829. X            y++;
  830. X            break;
  831. X        case '+':
  832. X            *s++ = (char)(*++cm + y);
  833. X            y = x;
  834. X            break;
  835. X        case '%':
  836. X            *s++ = *cm;
  837. X            break;
  838. X        default:
  839. X            return "OOPS";
  840. X        }
  841. X    }
  842. X    *s = '\0';
  843. X    return buf;
  844. X}
  845. X
  846. X#endif /* TERMCAP */
  847. X
  848. X/*
  849. X * Termcapinit is called from main() to initialize the terminal.
  850. X * The optional argument is given with the -T command line option.
  851. X */
  852. X    void
  853. Xtermcapinit(term)
  854. X    char *term;
  855. X{
  856. X    if (!term)
  857. X        term = (char *)vimgetenv("TERM");
  858. X    if (!term || !*term)
  859. X        term = *builtin_tcaps;
  860. X    term_strings.t_name = strsave(term);
  861. X    set_term(term);
  862. X}
  863. X
  864. X/*
  865. X * a never-padding outstr.
  866. X * use this whenever you don't want to run the string through tputs.
  867. X * tputs above is harmless, but tputs from the termcap library 
  868. X * is likely to strip off leading digits, that it mistakes for padding
  869. X * information. (jw)
  870. X */
  871. X    void
  872. Xoutstrn(s)
  873. X    char *s;
  874. X{
  875. X    while (*s)
  876. X        outchar(*s++);
  877. X}
  878. X
  879. X#ifndef MSDOS        /* there is a special version of outstr() in msdos.c */
  880. X/*
  881. X * outstr(s): put a string character at a time into the output buffer.
  882. X * If TERMCAP is defined use the termcap parser. (jw)
  883. X */
  884. X    void
  885. Xoutstr(s)
  886. X    register char             *s;
  887. X{
  888. X    if (s)
  889. X#ifdef TERMCAP
  890. X        tputs(s, 1, TPUTSFUNCAST outchar);
  891. X#else
  892. X        while (*s)
  893. X            outchar(*s++);
  894. X#endif
  895. X}
  896. X#endif /* MSDOS */
  897. X
  898. X/* 
  899. X * cursor positioning using termcap parser. (jw)
  900. X */
  901. X    void
  902. Xwindgoto(row, col)
  903. X    int        row;
  904. X    int        col;
  905. X{
  906. X#ifdef TERMCAP
  907. X    tputs(tgoto(T_CM, col, row), 1, TPUTSFUNCAST outchar);
  908. X#else
  909. X    outstr(tgoto(T_CM, col, row));
  910. X#endif
  911. X}
  912. X
  913. X/*
  914. X * Set cursor to current position.
  915. X * Should be optimized for minimal terminal output.
  916. X */
  917. X
  918. X    void
  919. Xsetcursor()
  920. X{
  921. X    if (!RedrawingDisabled)
  922. X        windgoto(Cursrow, Curscol);
  923. X}
  924. X
  925. X    void
  926. Xttest(pairs)
  927. X    int    pairs;
  928. X{
  929. X    char buf[70];
  930. X    char *s = "terminal capability %s required.\n";
  931. X    char *t = NULL;
  932. X
  933. X#ifdef TTEST
  934. X  TTEST(T_EL);
  935. X  TTEST(T_IL);
  936. X  TTEST(T_CIL);
  937. X  TTEST(T_DL);
  938. X  TTEST(T_CDL);
  939. X  TTEST(T_ED);
  940. X  TTEST(T_CI);
  941. X  TTEST(T_CV);
  942. X  TTEST(T_TP);
  943. X  TTEST(T_TI);
  944. X  TTEST(T_CM);
  945. X  TTEST(T_SR);
  946. X  TTEST(T_CRI);
  947. X#endif /* TTEST */
  948. X
  949. X  /* hard requirements */
  950. X    if (!T_ED || !*T_ED)    /* erase display */
  951. X        t = "cl";
  952. X    if (!T_CM || !*T_CM)    /* cursor motion */
  953. X        t = "cm";
  954. X
  955. X    if (t)
  956. X    {
  957. X        sprintf(buf, s, t);
  958. X        emsg(buf);
  959. X    }
  960. X
  961. X    if (pairs)
  962. X    {
  963. X      /* optional pairs */
  964. X        if ((!T_TP || !*T_TP) ^ (!T_TI || !*T_TI))
  965. X        {
  966. X            debug2("cap :me=%s:mr=%s: ignored\n", T_TP, T_TI);
  967. X            T_TP = T_TI = NULL;
  968. X        }
  969. X        if ((!T_CI || !*T_CI) ^ (!T_CV || !*T_CV))
  970. X        {
  971. X            debug2("cap :vi=%s:ve=%s: ignored\n", T_CI, T_CV);
  972. X            T_CI = T_CV = NULL;
  973. X        }
  974. X    }
  975. X}
  976. X
  977. X/*
  978. X * inchar() - get a character from
  979. X *        1. a scriptfile
  980. X *        2. the keyboard - take care of interpreting escape sequences
  981. X *
  982. X *    If we got an interrupt all input is read until none is available.
  983. X *  If async is TRUE there is no waiting for the char and we keep the
  984. X *   character.
  985. X *  If waitforever is FALSE we wait for 1 second for a character to arrive.
  986. X */
  987. X
  988. X#define INBUFLEN 50        /* buffer lengt, must be enough to contain an
  989. X                            Amiga raw keycode report */
  990. X
  991. X    int
  992. Xinchar(async, waitforever)
  993. X    int async;
  994. X    int waitforever;
  995. X{
  996. X    static u_char    buf[INBUFLEN+1];    /* already entered characters */
  997. X    static int        len = 0;            /* number of valid chars in buf */
  998. X    static int        lastc = -1;            /* last character from script file */
  999. X    register int     c;
  1000. X    register int     slen = 0;
  1001. X    register char     **p;
  1002. X#ifdef AMIGA
  1003. X             char    *s;
  1004. X#endif /* AMIGA */
  1005. X             int    first;
  1006. X             int    mode_deleted = FALSE;
  1007. X
  1008. X    if (!async)
  1009. X        flushbuf();
  1010. X
  1011. X/*
  1012. X * Check for interrupt.
  1013. X */
  1014. X    breakcheck();
  1015. X
  1016. X/*
  1017. X * first try script file
  1018. X *    If interrupted: Stop reading script files.
  1019. X */
  1020. Xretry:
  1021. X    if (scriptin[curscript] != NULL)
  1022. X    {
  1023. X        if (!got_int && lastc >= 0)
  1024. X            c = lastc;
  1025. X        else if (got_int || (c = getc(scriptin[curscript])) < 0)    /* reached EOF */
  1026. X        {
  1027. X            lastc = -1;
  1028. X            fclose(scriptin[curscript]);
  1029. X            scriptin[curscript] = NULL;
  1030. X            if (curscript > 0)
  1031. X                --curscript;
  1032. X                /* recovery may be delayed till after reading a script file */
  1033. X            if (recoverymode)
  1034. X                openrecover();
  1035. X            goto retry;        /* may read other script if this one was nested */
  1036. X        }
  1037. X        if (c == 0)
  1038. X            c = K_ZERO;        /* replace ^@ with special code */
  1039. X        if (async)
  1040. X            lastc = c;
  1041. X        else
  1042. X            lastc = -1;
  1043. X        return c;
  1044. X    }
  1045. X
  1046. X/*
  1047. X * If we got an interrupt, skip all previously typed characters and
  1048. X * reset interrupt flag.
  1049. X */
  1050. X    if (got_int)        /* skip typed characters */
  1051. X    {
  1052. X        while (GetChars((char *)buf, INBUFLEN, T_PEEK))
  1053. X            ;
  1054. X        got_int = FALSE;
  1055. X        len = 0;
  1056. X    }
  1057. X/*
  1058. X * get character(s) from the keyboard
  1059. X * this is repeated until we have found that
  1060. X * - it is not an escape sequence, return the first char
  1061. X * - it is the start of an escape sequence, but it is not completed within
  1062. X *   a short time, return the first char
  1063. X * - it is an escape seqence, translate it into a single byte code
  1064. X */
  1065. X    first = TRUE;
  1066. X    for (;;)
  1067. X    {
  1068. X        if (!first || len == 0)
  1069. X        {
  1070. X            /*
  1071. X             * special case: if we get an <ESC> in insert mode and there are
  1072. X             * no more characters at once, we pretend to go out of insert mode.
  1073. X             * This prevents the one second delay after typing an <ESC>.
  1074. X             * If we get something after all, we may have to redisplay the
  1075. X             * mode. That the cursor is in the wrong place does not matter.
  1076. X             */
  1077. X            if (!async && len == 1 && buf[0] == ESC && (State == INSERT || State == REPLACE) && (p_timeout || p_ttimeout))
  1078. X            {
  1079. X                slen = GetChars((char *)buf + len, INBUFLEN - len, T_PEEK);
  1080. X                if (slen != 0)
  1081. X                {
  1082. X                    len += slen;
  1083. X                    goto gotchar;
  1084. X                }
  1085. X                if (p_mo)
  1086. X                {
  1087. X                    delmode();
  1088. X                    mode_deleted = TRUE;
  1089. X                }
  1090. X                if (Curscol)        /* move cursor one left if possible */
  1091. X                    --Curscol;
  1092. X                else if (Curpos.col != 0 && Cursrow)
  1093. X                {
  1094. X                        --Cursrow;
  1095. X                        Curscol = Columns - 1;
  1096. X                }
  1097. X                setcursor();
  1098. X                flushbuf();
  1099. X            }
  1100. X            /*
  1101. X             * When async == TRUE do not wait for characters to arrive: T_PEEK
  1102. X             * When getting the first character wait until one arrives: T_BLOCK
  1103. X             * When waiting for a key sequence to complete
  1104. X             *        and 'timeout' or !waitforever set wait a short time: T_WAIT
  1105. X             *        and 'timeout' not set wait until one arrives: T_BLOCK
  1106. X             */
  1107. X            slen = GetChars((char *)buf + len, INBUFLEN - len,
  1108. X                        async ? T_PEEK : ((len == 0 || !(p_timeout || p_ttimeout))
  1109. X                                    && waitforever) ? T_BLOCK : T_WAIT);
  1110. X            if (got_int)
  1111. X                goto retry;        /* CTRL-C typed, flush input buffer */
  1112. X            len += slen;
  1113. X            if ((async || !waitforever) && len == 0)    /* nothing typed */
  1114. X                return NUL;
  1115. X            if (slen == 0)            /* escape sequence not completed in time */
  1116. X                break;
  1117. X        }
  1118. X        first = FALSE;
  1119. X
  1120. X        if (async)        /* when we get here: len != 0 */
  1121. X            return (int)buf[0];
  1122. X
  1123. Xgotchar:
  1124. X        if (State != NOMAPPING)
  1125. X        {
  1126. X            /* search in the escape sequences for the characters we have */
  1127. X            for (p = (char **)&term_strings.t_ku; p != (char **)&term_strings.t_undo + 1; ++p)
  1128. X            {
  1129. X                if (*p == NULL)
  1130. X                    continue;
  1131. X                slen = strlen(*p);
  1132. X                if (strncmp(*p, (char *)buf, (size_t)(slen > len ? len : slen)) == 0)
  1133. X                    break;
  1134. X            }
  1135. X        }
  1136. X        if (State == NOMAPPING || p == (char **)&term_strings.t_undo + 1)    /* no match */
  1137. X        {
  1138. X#ifdef AMIGA        /* check for window bounds report */
  1139. X            buf[len] = 0;
  1140. X            if ((buf[0] & 0xff) == CSI && ((s = strchr((char *)buf, 'r')) || (s = strchr((char *)buf, '|'))))
  1141. X            {
  1142. X                slen = s - buf + 1;
  1143. X                p = NULL;
  1144. X            }
  1145. X            else
  1146. X#endif
  1147. X                break;
  1148. X        }
  1149. X        if (slen <= len)        /* got the complete sequence */
  1150. X        {
  1151. X            if (mode_deleted)
  1152. X                showmode();
  1153. X            len -= slen;
  1154. X            memmove((char *)buf, (char *)buf + slen, (size_t)len);
  1155. X#ifdef AMIGA
  1156. X            if (p == NULL)        /* got window bounds report */
  1157. X            {
  1158. X                set_winsize(0, 0, FALSE);      /* get size and redraw screen */
  1159. X                continue;
  1160. X            }
  1161. X#endif
  1162. X
  1163. X                /* this relies on the Key numbers to be consecutive! */
  1164. X            return (int)(K_UARROW + (p - (char **)&term_strings.t_ku));
  1165. X        }
  1166. X        /*
  1167. X         * get here when we got an incomplete sequence,
  1168. X         * we need some more characters
  1169. X         */
  1170. X    }
  1171. X    c = buf[0];
  1172. X    memmove((char *)buf, (char *)buf+1, (size_t)--len);
  1173. X    if (c == 0)
  1174. X        c = K_ZERO;        /* replace ^@ with special code */
  1175. X        /* delete "INSERT" message if we return an ESC */
  1176. X    if (c == ESC && p_mo && !mode_deleted && (State == INSERT || State == REPLACE))
  1177. X        delmode();
  1178. X    return c;
  1179. X}
  1180. X
  1181. X/*
  1182. X * outnum - output a (big) number fast
  1183. X */
  1184. X    void
  1185. Xoutnum(n)
  1186. X    register long n;
  1187. X{
  1188. X    outstrn(tltoa((unsigned long)n));
  1189. X}
  1190. X    void
  1191. Xcheck_winsize()
  1192. X{
  1193. X    if (Columns < 5)
  1194. X        Columns = 5;
  1195. X    else if (Columns > MAX_COLUMNS)
  1196. X        Columns = MAX_COLUMNS;
  1197. X    if (Rows < 2)
  1198. X        Rows = 2;
  1199. X    p_scroll = Rows >> 1;
  1200. X}
  1201. X
  1202. X/*
  1203. X * set window size
  1204. X * If 'mustset' is TRUE, we must set Rows and Columns, do not get real
  1205. X * window size (this is used for the :win command during recovery).
  1206. X * If 'mustset' is FALSE, we may try to get the real window size and if
  1207. X * it fails use 'width' and 'height'.
  1208. X */
  1209. X    void
  1210. Xset_winsize(width, height, mustset)
  1211. X    int        width, height;
  1212. X    int        mustset;
  1213. X{
  1214. X    register int         tmp;
  1215. X
  1216. X    if (width < 0 || height < 0)    /* just checking... */
  1217. X        return;
  1218. X
  1219. X    if (State == HITRETURN)    /* postpone the resizing */
  1220. X    {
  1221. X        State = SETWINSIZE;
  1222. X        return;
  1223. X    }
  1224. X    screenclear();
  1225. X#ifdef AMIGA
  1226. X    flushbuf();         /* must do this before mch_get_winsize for some obscure reason */
  1227. X#endif /* AMIGA */
  1228. X    if (mustset || mch_get_winsize())
  1229. X    {
  1230. X        debug("mch_get_win failed\n");
  1231. X        Rows = height;
  1232. X        Columns = width;
  1233. X        mch_set_winsize();
  1234. X    }
  1235. X    check_winsize();        /* always check, to get p_scroll right */
  1236. X    if (State == HELP)
  1237. X        redrawhelp();
  1238. X    else if (!starting)
  1239. X    {
  1240. X        tmp = RedrawingDisabled;
  1241. X        RedrawingDisabled = FALSE;
  1242. X        comp_Botline();
  1243. X        updateScreen(CURSUPD);
  1244. X        RedrawingDisabled = tmp;
  1245. X        if (State == CMDLINE)
  1246. X            redrawcmdline();
  1247. X        else
  1248. X            setcursor();
  1249. X    }
  1250. X    flushbuf();
  1251. X}
  1252. X
  1253. X    void
  1254. Xsettmode(raw)
  1255. X    int     raw;
  1256. X{
  1257. X    static int        oldraw = FALSE;
  1258. X
  1259. X    if (oldraw == raw)        /* skip if already in desired mode */
  1260. X        return;
  1261. X    oldraw = raw;
  1262. X
  1263. X    mch_settmode(raw);    /* machine specific function */
  1264. X}
  1265. X
  1266. X    void
  1267. Xstarttermcap()
  1268. X{
  1269. X    outstr(T_KS);    /* start "keypad transmit" mode */
  1270. X    outstr(T_TS);    /* start termcap mode */
  1271. X}
  1272. X
  1273. X    void
  1274. Xstoptermcap()
  1275. X{
  1276. X    outstr(T_KE);    /* stop "keypad transmit" mode */
  1277. X    outstr(T_TE);    /* stop termcap mode */
  1278. X}
  1279. END_OF_FILE
  1280. if test 18112 -ne `wc -c <'vim/src/term.c'`; then
  1281.     echo shar: \"'vim/src/term.c'\" unpacked with wrong size!
  1282. fi
  1283. # end of 'vim/src/term.c'
  1284. fi
  1285. echo shar: End of archive 10 \(of 23\).
  1286. cp /dev/null ark10isdone
  1287. MISSING=""
  1288. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ; do
  1289.     if test ! -f ark${I}isdone ; then
  1290.     MISSING="${MISSING} ${I}"
  1291.     fi
  1292. done
  1293. if test "${MISSING}" = "" ; then
  1294.     echo You have unpacked all 23 archives.
  1295.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1296. else
  1297.     echo You still need to unpack the following archives:
  1298.     echo "        " ${MISSING}
  1299. fi
  1300. ##  End of shell archive.
  1301. exit 0
  1302. -------------8<----------------8<----------------8<---------------8<--------
  1303. Bram Moolenaar                             | DISCLAIMER:  This  note  does  not
  1304. Oce Nederland B.V., Research & Development | necessarily represent the position
  1305. p.o. box 101, 5900 MA  Venlo               | of  Oce-Nederland  B.V.  Therefore
  1306. The Netherlands        phone +31 77 594077 | no liability or responsibility for
  1307. UUCP: mool@oce.nl        fax +31 77 595450 | whatever will be accepted.
  1308.  
  1309. exit 0 # Just in case...
  1310.