home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume23 / abc / part06 < prev    next >
Text File  |  1991-01-08  |  56KB  |  1,900 lines

  1. Subject:  v23i085:  ABC interactive programming environment, Part06/25
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: b7706352 a11485aa 68c9e722 ad6bf350
  5.  
  6. Submitted-by: Steven Pemberton <steven@cwi.nl>
  7. Posting-number: Volume 23, Issue 85
  8. Archive-name: abc/part06
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # Contents:  abc/bed/e1que2.c abc/boot/dump.c abc/tc/termcap
  17. # Wrapped by rsalz@litchi.bbn.com on Mon Dec 17 13:27:55 1990
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. echo If this archive is complete, you will see the following message:
  20. echo '          "shar: End of archive 6 (of 25)."'
  21. if test -f 'abc/bed/e1que2.c' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'abc/bed/e1que2.c'\"
  23. else
  24.   echo shar: Extracting \"'abc/bed/e1que2.c'\" \(23165 characters\)
  25.   sed "s/^X//" >'abc/bed/e1que2.c' <<'END_OF_FILE'
  26. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */
  27. X
  28. X/*
  29. X * B editor -- Manipulate queues of nodes, higher levels.
  30. X */
  31. X
  32. X#include "b.h"
  33. X#include "bedi.h"
  34. X#include "etex.h"
  35. X#include "feat.h"
  36. X#include "bobj.h"
  37. X#include "node.h"
  38. X#include "supr.h"
  39. X#include "queu.h"
  40. X#include "gram.h"
  41. X#include "tabl.h"
  42. X#include "code.h"
  43. X
  44. Xextern bool lefttorite;
  45. X    /* Set by edit() to signal we parse purely left-to-right */
  46. X
  47. X/*
  48. X * Insert a queue of nodes at the focus
  49. X * (which had better be some kind of a hole).
  50. X * The nodes may also be a text, in which case the individual characters
  51. X * are inserted.
  52. X * Extensive changes to the parse tree may occur, and the node may be
  53. X * broken up in its constituent parts (texts and other nodes) which
  54. X * are then inserted individually.
  55. X */
  56. X
  57. XVisible bool
  58. Xins_queue(ep, pq, pq2)
  59. X    register environ *ep;
  60. X    register queue *pq;
  61. X    register queue *pq2;
  62. X{
  63. X    register bool ok = Yes;
  64. X    register node n;
  65. X    register queue oldq2;
  66. X    environ saveenv;
  67. X    int oldindentation = focindent(ep);
  68. X    int indentation = oldindentation;
  69. X    string str;
  70. X
  71. X    leftvhole(ep);
  72. X    while (ok && !emptyqueue(*pq)) {
  73. X        n = queuebehead(pq);
  74. X        if (Is_etext(n)) {
  75. X            str= e_sstrval((value) n);
  76. X            ok = ins_string(ep, str, pq2, 0);
  77. X            e_fstrval(str);
  78. X            
  79. X            switch (e_ncharval(e_length((value) n), (value) n)) {
  80. X                /* Last char */
  81. X            case '\t':
  82. X                ++indentation;
  83. X                break;
  84. X            case '\b':
  85. X                --indentation;
  86. X                break;
  87. X            case '\n':
  88. X                while (focindent(ep) > indentation) {
  89. X                    if (!ins_newline(ep))
  90. X                        break;
  91. X                }
  92. X                break;
  93. X            }
  94. X        }
  95. X        else {
  96. X            Ecopy(*ep, saveenv);
  97. X            oldq2 = qcopy(*pq2);
  98. X            if (!ins_node(&saveenv, n, pq2)) {
  99. X                Erelease(saveenv);
  100. X                qrelease(*pq2);
  101. X                *pq2 = oldq2;
  102. X                if (symbol(n) == Hole)
  103. X                    ok = ins_string(ep, "?", pq2, 0);
  104. X                else
  105. X                    splitnode(n, pq);
  106. X            }
  107. X            else {
  108. X                Erelease(*ep);
  109. X                Emove(saveenv, *ep);
  110. X                qrelease(oldq2);
  111. X            }
  112. X        }
  113. X        noderelease(n);
  114. X    }
  115. X#ifndef NDEBUG
  116. X    if (!ok)
  117. X        qshow(*pq, "ins_queue");
  118. X#endif
  119. X    qrelease(*pq);
  120. X    for (indentation = focindent(ep);
  121. X        indentation > oldindentation; --indentation)
  122. X        stringtoqueue("\b", pq2); /* Pass on indentation to outer level */
  123. X    return ok;
  124. X}
  125. X
  126. X
  127. X/*
  128. X * Subroutine to insert a queue to the right of the focus
  129. X * without affecting the focus position.
  130. X */
  131. X
  132. XVisible bool
  133. Xapp_queue(ep, pq)
  134. X    environ *ep;
  135. X    queue *pq;
  136. X{
  137. X    int where;
  138. X    static int markbit = 1; /* To properly handle recursive calls */
  139. X
  140. X    if (emptyqueue(*pq))
  141. X        return Yes;
  142. X    where = focoffset(ep);
  143. X    markbit <<= 1;
  144. X    markpath(&ep->focus, markbit);
  145. X    if (!ins_queue(ep, pq, pq)) {
  146. X        markbit >>= 1;
  147. X        return No;
  148. X    }
  149. X    if (!firstmarked(&ep->focus, markbit)) Abort();
  150. X    unmkpath(&ep->focus, markbit);
  151. X    markbit >>= 1;
  152. X    ep->spflag = No;
  153. X    fixfocus(ep, where);
  154. X    return Yes;
  155. X}
  156. X
  157. X
  158. X/*
  159. X * Advance to next thing after current position.
  160. X */
  161. X
  162. XVisible bool
  163. Xmove_on(ep)
  164. X    register environ *ep;
  165. X{
  166. X    register node n;
  167. X    register string *rp;
  168. X    register int sym;
  169. X    register int ich = ichild(ep->focus);
  170. X
  171. X    if (!up(&ep->focus))
  172. X        return No;
  173. X    higher(ep);
  174. X    n = tree(ep->focus);
  175. X    rp = noderepr(n);
  176. X    if (Fw_positive(rp[ich])) {
  177. X        ep->mode = FHOLE;
  178. X        ep->s1 = 2*ich + 1;
  179. X        ep->s2 = 0;
  180. X        if (ep->spflag) {
  181. X            ep->spflag = No;
  182. X            if (rp[ich][0] == ' ') {
  183. X                ++ep->s2;
  184. X                if (fwidth(rp[ich]) > 1)
  185. X                    return Yes;
  186. X            }
  187. X            else
  188. X                return Yes;
  189. X        }
  190. X        else
  191. X            return Yes;
  192. X    }
  193. X    if (ich < nchildren(n)) {
  194. X        s_downi(ep, ich+1);
  195. X        sym = symbol(tree(ep->focus));
  196. X        if (sym == Hole || sym == Optional)
  197. X            ep->mode = WHOLE;
  198. X        else
  199. X            ep->mode = ATBEGIN;
  200. X        return Yes;
  201. X    }
  202. X    ep->mode = ATEND;
  203. X    return Yes;
  204. X}
  205. X
  206. X
  207. X/*
  208. X * Like move_on but moves through fixed texts, skipping only spaces
  209. X * and empty strings.
  210. X * <<<<< This code is a dinosaur and should be revised. >>>>>
  211. X */
  212. X
  213. XVisible bool
  214. Xfix_move(ep)
  215. X    register environ *ep;
  216. X{
  217. X    register int ich;
  218. X    register int i;
  219. X    register string *rp;
  220. X    register string cp;
  221. X
  222. X    Assert(ep->mode == FHOLE);
  223. X
  224. X    ich = ep->s1/2;
  225. X    rp = noderepr(tree(ep->focus));
  226. X    cp = rp[ich];
  227. X    if (cp) {
  228. X        i = ep->s2;
  229. X        Assert(i <= Fwidth(cp));
  230. X        if (cp[i] == ' ') {
  231. X            do {
  232. X                ++i;
  233. X            } while (cp[i] == ' ');
  234. X        }
  235. X        if (cp[i] == '\b' || cp[i] == '\t') {
  236. X            ++i;
  237. X            Assert(!cp[i]);
  238. X        }
  239. X        else if (cp[i]) {
  240. X            if (i == ep->s2)
  241. X                return No;
  242. X            ep->s2 = i;
  243. X            return Yes;
  244. X        }
  245. X    }
  246. X
  247. X    if (ich >= nchildren(tree(ep->focus)))
  248. X        ep->mode = ATEND;
  249. X    else {
  250. X        s_downi(ep, ich+1);
  251. X        if (symbol(tree(ep->focus)) == Hole
  252. X            || symbol(tree(ep->focus)) == Optional)
  253. X            ep->mode = WHOLE;
  254. X        else
  255. X            ep->mode = ATBEGIN;
  256. X    }
  257. X    return Yes;
  258. X}
  259. X
  260. X
  261. X/*
  262. X * Insert a node in the parse tree.
  263. X */
  264. X
  265. XHidden bool
  266. Xins_node(ep, n, pq)
  267. X    register environ *ep;
  268. X    register node n;
  269. X    register queue *pq;
  270. X{
  271. X    register int sym;
  272. X    register node nn;
  273. X    register markbits x;
  274. X    string *rp;
  275. X    node fc;
  276. X
  277. X    if (symbol(n) == Optional)
  278. X        return Yes;
  279. X
  280. X    for (;;) {
  281. X        switch (ep->mode) {
  282. X
  283. X        case FHOLE:
  284. X            if (ep->s2 < lenitem(ep) || !fix_move(ep))
  285. X                return No;
  286. X            continue;
  287. X
  288. X        case VHOLE:
  289. X            if (ep->s2 == lenitem(ep)
  290. X                && symbol(tree(ep->focus)) == Name
  291. X                && (symbol(n) == Text1_display
  292. X                    || symbol(n) == Text2_display))
  293. X            {
  294. X                /* enable insertion of name before */
  295. X                /* text display with conversion */
  296. X                ep->mode= ATEND;
  297. X                continue;
  298. X            }
  299. X            if (ep->s2 < lenitem(ep) || !move_on(ep))
  300. X                return No;
  301. X            continue;
  302. X
  303. X        case ATBEGIN:
  304. X            sym = symbol(tree(ep->focus));
  305. X            if (sym == Optional || sym == Hole) {
  306. X                ep->mode = WHOLE;
  307. X                continue;
  308. X            }
  309. X            x = marks(tree(ep->focus));
  310. X            if (joinnodes(&ep->focus, n, tree(ep->focus), No)) {
  311. X                if (x) {
  312. X                    s_downi(ep, 2);
  313. X                    markpath(&ep->focus, x);
  314. X                    s_up(ep);
  315. X                }
  316. X                s_down(ep);
  317. X                ep->mode = ATEND;
  318. X                leftvhole(ep);
  319. X                return Yes;
  320. X            }
  321. X            nn = tree(ep->focus);
  322. X            rp = noderepr(nn);
  323. X            if (nchildren(nn) >= 1 && Fw_zero(rp[0])) {
  324. X                fc= firstchild(nn);
  325. X                sym = (Is_etext(fc) ? (-1) : symbol(fc));
  326. X                if (sym == Hole || sym == Optional) {
  327. X                    s_down(ep);
  328. X                    if (fitnode(&ep->focus, n)) {
  329. X                        ep->mode = ATEND;
  330. X                        leftvhole(ep);
  331. X                        return Yes;
  332. X                    }
  333. X                    s_up(ep);
  334. X                }
  335. X            }
  336. X            nn = nodecopy(nn);
  337. X            if (!fitnode(&ep->focus, n)) {
  338. X                addtoqueue(pq, nn);
  339. X                noderelease(nn);
  340. X                delfocus(&ep->focus);
  341. X                ep->mode = WHOLE;
  342. X                continue;
  343. X            }
  344. X            if (downrite(&ep->focus)) {
  345. X                if (!Is_etext(tree(ep->focus))) {
  346. X                    sym = symbol(tree(ep->focus));
  347. X                    if (sym == Hole || sym == Optional) {
  348. X                        if (fitnode(&ep->focus, nn)) {
  349. X                            noderelease(nn);
  350. X                            nn = Nnil;
  351. X                        }
  352. X                    }
  353. X                }
  354. X                else
  355. X                    VOID up(&ep->focus);
  356. X            }
  357. X            if (nn) {
  358. X                addtoqueue(pq, nn);
  359. X                noderelease(nn);
  360. X            }
  361. X            ep->mode = ATEND;
  362. X            leftvhole(ep);
  363. X            return Yes;
  364. X
  365. X        case WHOLE:
  366. X            sym = symbol(tree(ep->focus));
  367. X            Assert(sym == Optional || sym == Hole);
  368. X            do {
  369. X                higher(ep); /* Only for second time around */
  370. X                if (fitnode(&ep->focus, n)) {
  371. X                    ep->mode = ATEND;
  372. X                    leftvhole(ep);
  373. X                    return Yes;
  374. X                }
  375. X            } while (resttoqueue(&ep->focus, pq));
  376. X            ep->mode = ATEND;
  377. X            /* Fall through */
  378. X        case ATEND:
  379. X            do {
  380. X                higher(ep); /* Only for second time around */
  381. X                if (joinnodes(&ep->focus, tree(ep->focus), n, ep->spflag)) {
  382. X                    ep->spflag = No;
  383. X                    leftvhole(ep);
  384. X                    return Yes;
  385. X                }
  386. X            } while (resttoqueue(&ep->focus, pq)
  387. X                || move_on(ep) && ep->mode == ATEND);
  388. X            return No;
  389. X
  390. X        default:
  391. X            return No;
  392. X
  393. X        }
  394. X    }
  395. X}
  396. X
  397. X/* Hacked refinements for ins_string below, mainly to fix problems
  398. X * with suggestions and suggestion-rests for commands; timo
  399. X */
  400. X
  401. XHidden bool softening_builtin(inch, sym) char inch; int sym; {
  402. X    /* refinement for ins_string to enable softening of
  403. X     * builtin commands, e.g REMOVE ? FROM ? -> REMOVE M?
  404. X     */
  405. X    return (bool) (isupper(inch) && Put <= sym && sym < Check);
  406. X}
  407. X
  408. XHidden bool fits_kwchar(n, i, ch) node n; int i; int ch; {
  409. X    /* REPORT i'th char of Keyword(n) == ch */
  410. X    string s;
  411. X    int si;
  412. X    
  413. X    Assert(symbol(n) == Keyword && i >= 0);
  414. X    s= e_strval((value) firstchild(n));
  415. X    if (strlen(s) < i)
  416. X        return No;
  417. X    /* else: */
  418. X    si= s[i];
  419. X    return (bool) si == ch;
  420. X}
  421. X
  422. XHidden bool fits_nextkwstart(n, ch) node n; int ch; {
  423. X    register int sym= symbol(n);
  424. X    
  425. X    if (sym == Keyword)
  426. X        return fits_kwchar(n, 0, ch);
  427. X    else if (sym == Kw_plus)
  428. X        return fits_nextkwstart(child(n, 1), ch);
  429. X    /* else: */
  430. X    return No; /* can't accept Hole '?' as fit of Capital ch */
  431. X}
  432. X
  433. X/* Return whether rest of user-defined-command stems from suggestion.
  434. X * There is a problem with tailing Keywords, since we don't know whether
  435. X * they stem from suggestion;
  436. X * if they do, the user can accept them explicitly,
  437. X * or by blind-typing, which has been handled by now;
  438. X * if they don't, we should not kill them now!
  439. X */
  440. X
  441. XHidden bool is_varsuggrest(n, exphole_seen) node n; bool exphole_seen; {
  442. X    register int sym= symbol(n);
  443. X    register node n2;
  444. X    register int sym2;
  445. X    
  446. X    if (sym == Kw_plus) {
  447. X        n2= child(n, 2);
  448. X        sym2= symbol(n2);
  449. X        if (sym2 == Hole)
  450. X            return Yes;
  451. X        else if (sym2 == Kw_plus || sym2 == Exp_plus || sym2 == Keyword)
  452. X            return (is_varsuggrest(n2, exphole_seen));
  453. X        /* else: FAIL */
  454. X    }
  455. X    else if (sym == Exp_plus) {
  456. X        if (symbol(child(n, 1)) != Hole)
  457. X            return No;
  458. X        /* else: */
  459. X        n2= child(n, 2);
  460. X        sym2= symbol(n2);
  461. X        if (sym2 == Hole)
  462. X            /* Hole is safety-net; cannot happen? */
  463. X            return Yes;
  464. X        else if (sym2 == Kw_plus || sym2 == Exp_plus || sym2 == Keyword)
  465. X            return is_varsuggrest(n2, Yes);
  466. X    }
  467. X    else if (sym == Keyword && exphole_seen)
  468. X        return Yes;
  469. X    /* else: */
  470. X    return No;
  471. X}
  472. X
  473. X/* Focus at end of expr in Exp_plus, or after space in Kw_plus;
  474. X * acknowledge **pstr (== Capital) iff it fits start of Keyword
  475. X * following focus;
  476. X * else, if rest resembles suggestion-rest, kill that.
  477. X */
  478. XHidden bool ack_or_kill_varsuggrest(ep, pstr) environ *ep; string *pstr; {
  479. X    node nn= tree(ep->focus);
  480. X    
  481. X    if (fits_nextkwstart(child(nn, 2), (int)**pstr)) {
  482. X        /* accept start_char in Keyword */
  483. X        s_downi(ep, 2);
  484. X        Assert(symbol(tree(ep->focus)) != Exp_plus);
  485. X        if (symbol(tree(ep->focus)) == Kw_plus)
  486. X            s_downi(ep, 1);
  487. X        Assert(symbol(tree(ep->focus)) == Keyword);
  488. X        ep->s1= 2;
  489. X        ep->s2= 1;
  490. X        ep->mode= VHOLE;
  491. X        ep->spflag= No;
  492. X        ++*pstr;
  493. X        return Yes;
  494. X    }
  495. X    else if (is_varsuggrest(child(nn, 2), No)) {
  496. X        /* kill non-matching suggestion-rest */
  497. X        s_downi(ep, 2);
  498. X        treereplace(&ep->focus, gram(Hole));
  499. X        ep->mode= WHOLE;
  500. X        ep->spflag= No;
  501. X        return Yes;
  502. X    }
  503. X    return No;
  504. X}
  505. X
  506. X/*
  507. X * Another hack to turn {a.?} (where a. is seen as a name)
  508. X * upon receit of a second "." into {a.?}, where a is the name
  509. X * and . is seen as an operator (to enable '?' after ')
  510. X */
  511. X
  512. XHidden bool range_hack(ep) register environ *ep; {
  513. X    path pa;
  514. X    int sympa;
  515. X    string str;
  516. X    node n1;
  517. X    node n2;
  518. X    node nn;
  519. X    int s2= ep->s2;
  520. X    bool r= No;
  521. X    
  522. X    if (s2 <= 1) return No;
  523. X    
  524. X    pa= parent(ep->focus);
  525. X    sympa= pa ? symbol(tree(pa)) : Rootsymbol;
  526. X
  527. X    if (sympa == List_or_table_display || sympa == List_filler_series) {
  528. X        str= e_sstrval((value) firstchild(tree(ep->focus)));
  529. X        if (s2 == strlen(str) && str[s2-1] == '.') {
  530. X            str[s2-1]= '\0';
  531. X            n1= gram(Name);
  532. X            setchild(&n1, 1, (node) mk_etext(str));
  533. X            n2= gram(Operator);
  534. X            setchild(&n2, 1, (node) mk_etext("."));
  535. X            nn= gram(Blocked);
  536. X            setchild(&nn, 1, n1);
  537. X            setchild(&nn, 2, n2);
  538. X            treereplace(&ep->focus, nn);
  539. X            s_downi(ep, 2);
  540. X            ep->mode= ATEND;
  541. X            r= Yes;
  542. X        }
  543. X        e_fstrval(str);
  544. X    }
  545. X    return r;
  546. X}
  547. X
  548. X/*
  549. X * Insert a string in the parse tree.
  550. X *
  551. X * justgoon is Yes if the last key seen was a lower case
  552. X * letter that was inserted as such.  In this case, some
  553. X * code can be skipped, in particular in ins2.c (which
  554. X * amounts to a so called horrible hack).
  555. X */
  556. X
  557. XVisible bool justgoon = No;
  558. X
  559. X#define NEXT_CH (++str, alt_c = 0)
  560. X
  561. XVisible bool
  562. Xins_string(ep, str, pq, alt_c)
  563. X    register environ *ep;
  564. X    /*auto*/ string str;
  565. X    register queue *pq;
  566. X    int alt_c;
  567. X{
  568. X    register node nn;
  569. X    auto value v;
  570. X    char buf[1024];
  571. X    register string repr;
  572. X    string oldstr;
  573. X    register int sym;
  574. X    register int len;
  575. X    bool inter_active = alt_c != 0;
  576. X    path pa;
  577. X
  578. X    if (alt_c < 0)
  579. X        alt_c = 0;
  580. X    while (*str) {
  581. X        switch (*str) {
  582. X
  583. X        case '\n':
  584. X            if (!ins_newline(ep))
  585. X                return No;
  586. X            /* Fall through */
  587. X        case '\t':
  588. X        case '\b':
  589. X            NEXT_CH;
  590. X            continue;
  591. X
  592. X        }
  593. X        switch (ep->mode) {
  594. X
  595. X        case ATBEGIN:
  596. X            nn = tree(ep->focus);
  597. X            if (Is_etext(nn)) {
  598. X                ep->s1 = 2*ichild(ep->focus);
  599. X                ep->s2 = 0;
  600. X                ep->mode = VHOLE;
  601. X                s_up(ep);
  602. X                continue;
  603. X            }
  604. X            sym = symbol(nn);
  605. X            if (sym != Optional && sym != Hole) {
  606. X                if (fwidth(noderepr(nn)[0]) == 0) {
  607. X                    if (down(&ep->focus))
  608. X                        break;
  609. X                }
  610. X                addtoqueue(pq, nn);
  611. X                delfocus(&ep->focus);
  612. X            }
  613. X            ep->mode = WHOLE;
  614. X            /* Fall through */
  615. X        case WHOLE:
  616. X            nn = tree(ep->focus);
  617. X            sym = symbol(nn);
  618. X            Assert(sym == Hole || sym == Optional);
  619. X            while ((len = fitstring(&ep->focus, str, alt_c)) == 0) {
  620. X                if (sym == Optional) {
  621. X                    if (!move_on(ep)) {
  622. X                        if (*str == ' ')
  623. X                            NEXT_CH;
  624. X                        else
  625. X                            return No;
  626. X                    }
  627. X                    break;
  628. X                }
  629. X                if (!inter_active && *str == '?') {
  630. X                    NEXT_CH;
  631. X                    ep->mode = ATEND;
  632. X                    break;
  633. X                }
  634. X                if (resttoqueue(&ep->focus, pq))
  635. X                    higher(ep);
  636. X                else if (spacefix(ep))
  637. X                    break;
  638. X                else if (*str == ' ') {
  639. X                    NEXT_CH;
  640. X                    break;
  641. X                }
  642. X                else if (inter_active)
  643. X                    return No;
  644. X                else {
  645. X                    ep->mode = ATEND;
  646. X                    break;
  647. X                }
  648. X            }
  649. X            if (len > 0) {
  650. X                str += len;
  651. X                alt_c = 0;
  652. X                fixfocus(ep, len);
  653. X            }
  654. X            break;
  655. X
  656. X        case ATEND:
  657. X            if ((pa=parent(ep->focus)) &&
  658. X                symbol(tree(pa)) == Exp_plus &&
  659. X                ichild(ep->focus) == 1 &&
  660. X                isupper(*str))
  661. X            {    /* at end of expr in Exp_plus */
  662. X                s_up(ep);
  663. X                if (ack_or_kill_varsuggrest(ep, &str))
  664. X                    break;
  665. X                /* else: undo up */
  666. X                s_downi(ep, 1);
  667. X            }
  668. X            if (add_string(ep, &str)) {
  669. X                alt_c = 0;
  670. X                break;
  671. X            }
  672. X            
  673. X            len = joinstring(&ep->focus, str, ep->spflag,
  674. X                alt_c ? alt_c : inter_active ? -1 : 0, Yes);
  675. X            if (len > 0) {
  676. X                s_downi(ep, 2);
  677. X                ep->spflag = No;
  678. X                fixfocus(ep, len);
  679. X            }
  680. X            else {
  681. X                if (resttoqueue(&ep->focus, pq)) {
  682. X                    higher(ep);
  683. X                    break;
  684. X                }
  685. X                if (move_on(ep))
  686. X                    break;
  687. X                if (*str == ' ') {
  688. X                    NEXT_CH;
  689. X                    break;
  690. X                }
  691. X                return No;
  692. X            }
  693. X            str += len;
  694. X            alt_c = 0;
  695. X            break;
  696. X
  697. X        case FHOLE:
  698. X            nn = tree(ep->focus);
  699. X            sym = symbol(nn);
  700. X            if (sym == Edit_unit && ep->s1 == 1 && ep->s2 == 1
  701. X                && symbol(child(nn, 1)) == Sugghowname)
  702. X            {
  703. X                s_downi(ep, 1);
  704. X                ep->mode= VHOLE;
  705. X                ep->s1= 2; ep->s2= 0;
  706. X                break;
  707. X            }
  708. X            if (sym == Formal_kw_plus 
  709. X                && ep->s1 == 3 && ep->s2 == 1 && alt_c)
  710. X            {
  711. X                /* force Formal_naming_plus */
  712. X                alt_c= 0;
  713. X                /* and go_on */
  714. X            }
  715. X            if ((sym == Kw_plus || sym == Exp_plus)
  716. X                && ep->s1 == 3 && ep->s2 == 1) {
  717. X                /* after space before Keyword */
  718. X                if (isupper(*str)) {
  719. X                    if (ack_or_kill_varsuggrest(ep, &str))
  720. X                        break;
  721. X                }
  722. X                else if (sym == Exp_plus) {
  723. X                    /* this wasn't handled properly */
  724. X                    /* e.g. ADD a >?<TO ?, 
  725. X                     *    insert +,
  726. X                     *    ADD a>?< + TO ? */
  727. X                    s_downi(ep, 1);
  728. X                    ep->mode= ATEND;
  729. X                    ep->spflag= Yes;
  730. X                    break;
  731. X                }
  732. X                else if (sym == Kw_plus && alt_c)
  733. X                            /* force Exp_plus */
  734. X                            alt_c = 0;
  735. X                            /* and go on: */
  736. X            }
  737. X            repr = noderepr(nn)[ep->s1/2];
  738. X            if (ep->s2 >= fwidth(repr)
  739. X                &&
  740. X                (ep->s2 <= 0 || !isalpha(repr[0]) ||
  741. X                 ((ep->spflag || repr[ep->s2-1] == ' ')
  742. X                  && !softening_builtin(*str, symbol(nn))
  743. X               )))
  744. X            {    /* At end */
  745. X                if (ep->s1/2 < nchildren(nn)) {
  746. X                    s_downi(ep, ep->s1/2 + 1);
  747. X                    ep->mode = ATBEGIN; /* Of next child */
  748. X                }
  749. X                else
  750. X                    ep->mode = ATEND;
  751. X                break;
  752. X            }
  753. X            if ((*str == ':' || *str == ' ') && *str == repr[ep->s2]) {
  754. X                /*****
  755. X                 * Quick hack for insertion of test-suites and refinements:
  756. X                 *****/
  757. X                ++ep->s2;
  758. X                NEXT_CH;
  759. X                continue;
  760. X            }
  761. X            if (!lefttorite)
  762. X                nosuggtoqueue(ep, pq);
  763. X            oldstr = str;
  764. X            if (resuggest(ep, &str, alt_c) || soften(ep, &str, alt_c)) {
  765. X                if (str > oldstr)
  766. X                    alt_c = 0;
  767. X                continue;
  768. X            }
  769. X            if (fix_move(ep))
  770. X                continue;
  771. X            return No;
  772. X
  773. X        case VHOLE:
  774. X            Assert(!(ep->s1&1));
  775. X            nn = tree(ep->focus);
  776. X            sym = symbol(nn);
  777. X#ifdef USERSUGG
  778. X            if (sym == Suggestion) {
  779. X                if (*str == '?')
  780. X                    return No;
  781. X                if (newsugg(ep, &str, alt_c))
  782. X                    alt_c = 0;
  783. X                else {
  784. X                    killsugg(ep, &str);
  785. X                }
  786. X                continue;
  787. X            }
  788. X            else if (sym == Sugghowname) {
  789. X                if (*str == '?')
  790. X                    return No;
  791. X                if (!newhowsugg(ep, &str, alt_c))
  792. X                    return No;
  793. X                /* else */
  794. X                continue;
  795. X            }
  796. X#endif /* USERSUGG */
  797. X            if (sym == Keyword && 
  798. X                (fits_kwchar(nn, ep->s2, (int)*str)
  799. X                 ||
  800. X                 (ep->s2 > 0 && alt_c > 0 &&
  801. X                  fits_kwchar(nn, ep->s2, alt_c)
  802. X               )))
  803. X            {
  804. X                /* accept next char in Keyword */
  805. X                /* required for blind typist rule; timo */
  806. X                /* also enables lowercase within KW */
  807. X                ep->s2++;
  808. X                NEXT_CH;
  809. X                break;
  810. X            }
  811. X            if (sym == Name && *str == '.' && range_hack(ep)) {
  812. X                break;
  813. X            }
  814. X            s_downi(ep, ep->s1/2);
  815. X            v = copy((value) tree(ep->focus));
  816. X            len = 0;
  817. X            if (!ep->spflag) {
  818. X                for (; len < sizeof buf - 1 && str[len]
  819. X                        && mayinsert(nn, ep->s1/2, !!(ep->s2 + len),
  820. X                            str[len]);
  821. X                    ++len) {
  822. X                    buf[len] = str[len];
  823. X                }
  824. X                justgoon = len > 0 && islower(str[len-1]);
  825. X                if (len <= 0 && alt_c
  826. X                    && mayinsert(nn, ep->s1/2, !!(ep->s2 + len), alt_c)) {
  827. X                    buf[0] = alt_c;
  828. X                    len = 1;
  829. X                }
  830. X            }
  831. X            if (len > 0) { /* Effectuate change */
  832. X                str += len;
  833. X                alt_c = 0;
  834. X                Assert(Is_etext(v));
  835. X                buf[len] = 0;
  836. X                putintrim(&v, ep->s2, e_length(v) - ep->s2, buf);
  837. X                treereplace(&ep->focus, (node) v);
  838. X                s_up(ep);
  839. X                ep->spflag = No;
  840. X                ep->s2 += len;
  841. X            }
  842. X            else { /* Nothing inserted */
  843. X                if (ep->s2 == 0) { /* Whole string rejected */
  844. X                    addtoqueue(pq, (node)v);
  845. X                    release(v);
  846. X                    s_up(ep);
  847. X                    delfocus(&ep->focus);
  848. X                    ep->mode = WHOLE;
  849. X                    break;
  850. X                }
  851. X                if (ep->s2 < e_length(v)) {
  852. X                    value w;
  853. X/*                    addstringtoqueue(pq, e_strval(v) + ep->s2); */
  854. X                    w= e_ibehead(v, ep->s2 + 1);
  855. X                    addtoqueue(pq, (node) w);
  856. X                    release(w);
  857. X                    /* putintrim(&v, ep->s2, 0, ""); */
  858. X                    v= e_icurtail(w= v, ep->s2);
  859. X                    release(w);
  860. X                    treereplace(&ep->focus, (node) v);
  861. X                }
  862. X                else
  863. X                    release(v);
  864. X                if (!move_on(ep)) Abort(); /* ==> up, cancelling s_downi! */
  865. X            }
  866. X            break;
  867. X
  868. X        default:
  869. X            Abort();
  870. X
  871. X        } /* end switch (ep->mode) */
  872. X    } /* end while (*str) */
  873. X
  874. X    return Yes;
  875. X}
  876. X
  877. X
  878. X/*
  879. X * See if two nodes can be joined in a hole.
  880. X * 'Spflag' indicates whether a space must be present between the nodes
  881. X * (required or forbidden).
  882. X * Either of n1, n2 may actually be the current contents of the hole.
  883. X */
  884. X
  885. XHidden bool
  886. Xjoinnodes(pp, n1, n2, spflag)
  887. X    path *pp;
  888. X    node n1;
  889. X    node n2;
  890. X    bool spflag;
  891. X{
  892. X    path pa = parent(*pp);
  893. X    int sympa = pa ? symbol(tree(pa)) : Rootsymbol;
  894. X    struct table *tp = &table[sympa];
  895. X    struct classinfo *ci = tp->r_class[ichild(*pp) - 1];
  896. X    classptr cp = ci->c_join;
  897. X    int sym1 = symbol(n1);
  898. X    int sym2 = symbol(n2);
  899. X    int symcp;
  900. X    int symfound = -1;
  901. X
  902. X    if (!cp)
  903. X        return No;
  904. X    for (; *cp; cp += 2) {
  905. X        if (cp[0] != spflag + 1)
  906. X            continue;
  907. X        symcp = cp[1];
  908. X        tp = &table[symcp];
  909. X        if (isinclass(sym1, tp->r_class[0])
  910. X            && isinclass(sym2, tp->r_class[1])) {
  911. X            symfound = symcp;
  912. X            break;
  913. X        }
  914. X    }
  915. X
  916. X    if (symfound < 0)
  917. X        return No;
  918. X    n1 = nodecopy(n1);
  919. X    n2 = nodecopy(n2); /* 'Cause one of them may overlap tree(*pp) */
  920. X    treereplace(pp, table[symfound].r_node);
  921. X    if (!down(pp)) Abort();
  922. X    treereplace(pp, n1);
  923. X    if (!rite(pp)) Abort();
  924. X    treereplace(pp, n2);
  925. X    if (!up(pp)) Abort();
  926. X    return Yes;
  927. X}
  928. X
  929. X
  930. X/*
  931. X * Try to join a node (implicit as tree(*pp)) with some text.
  932. X * That is, try to replace the node by one with it as first child,
  933. X * (some of) the text as second child, and nothing or a space in between.
  934. X *
  935. X * 'Spflag' indicates whether a space is desirable between the nodes
  936. X * (but if No it is only used as advice).
  937. X *
  938. X * Returns the number of characters consumed from str.
  939. X */
  940. X
  941. XVisible int
  942. Xjoinstring(pp, str, spflag, alt_c, mayindent)
  943. X    path *pp;
  944. X    register string str;
  945. X    register bool spflag;
  946. X    int alt_c;
  947. X    bool mayindent;
  948. X{
  949. X    register struct table *tp;
  950. X    path pa = parent(*pp);
  951. X    node n1;
  952. X    struct classinfo *ci;
  953. X    register classptr cp;
  954. X    int sympa = pa ? symbol(tree(pa)) : Rootsymbol;
  955. X    register int sym1;
  956. X    register int symcp;
  957. X    int symfound;
  958. X    int len;
  959. X    char buf[2];
  960. X    bool inter_active = alt_c != 0;
  961. X
  962. X    if (alt_c < 0)
  963. X        alt_c = 0;
  964. X    ci = table[sympa].r_class[ichild(*pp) - 1];
  965. X    Assert(ci);
  966. X    cp = ci->c_join;
  967. X    if (!cp)
  968. X        return 0;
  969. X
  970. X    n1 = tree(*pp);
  971. X    sym1 = symbol(n1);
  972. X    symfound = -1;
  973. X    for (; *cp; cp += 2) {
  974. X        if (cp[0] < spflag + 1)
  975. X            continue;
  976. X        symcp = cp[1];
  977. X        tp = &table[symcp];
  978. X        if (!mayindent && tp->r_repr[1] && strchr(tp->r_repr[1], '\t'))
  979. X            continue;
  980. X        if (isinclass(sym1, tp->r_class[0])
  981. X            && ((canfitchar(str[0], tp->r_class[1]))
  982. X                || str[0] == '?' && !inter_active)) {
  983. X            if (cp[0] == spflag + 1) {
  984. X                symfound = symcp;
  985. X                break;
  986. X            }
  987. X            if (symfound < 0)
  988. X                symfound = symcp;
  989. X        }
  990. X    }
  991. X
  992. X    if (symfound < 0) { /* 1-level recursion */
  993. X        if (!alt_c)
  994. X            return 0;
  995. X        buf[0] = alt_c;
  996. X        buf[1] = 0;
  997. X        return joinstring(pp, buf, spflag, 0, mayindent);
  998. X    }
  999. X    n1 = nodecopy(n1); /* 'Cause it overlaps tree(*pp) */
  1000. X    treereplace(pp, table[symfound].r_node);
  1001. X    if (!down(pp)) Abort();
  1002. X    treereplace(pp, n1);
  1003. X    if (!rite(pp)) Abort();
  1004. X    len = fitstring(pp, str, 0);
  1005. X    if (len == 0 && str[0] == '?')
  1006. X        len = 1;
  1007. X    Assert(len > 0); /* Disagreement between canfitchar and fitstring */
  1008. X    if (!up(pp)) Abort();
  1009. X    return len;
  1010. X}
  1011. X
  1012. X
  1013. X/*
  1014. X * Similar to joinstring, but now the string must match the delimiter
  1015. X * rather than being acceptable as second child.
  1016. X * (Interface has changed to resemble resuggest/soften.)
  1017. X */
  1018. X
  1019. XHidden bool
  1020. Xadd_string(ep, pstr, alt_c)
  1021. X    environ *ep;
  1022. X    string *pstr;
  1023. X{
  1024. X    register struct table *tp;
  1025. X    path pa = parent(ep->focus);
  1026. X    node n1;
  1027. X    struct classinfo *ci;
  1028. X    register classptr cp;
  1029. X    int sympa = pa ? symbol(tree(pa)) : Rootsymbol;
  1030. X    register int sym1;
  1031. X    register int symcp;
  1032. X    register int c;
  1033. X
  1034. X    ci = table[sympa].r_class[ichild(ep->focus) - 1];
  1035. X    Assert(ci);
  1036. X    cp = ci->c_append;
  1037. X    if (!cp)
  1038. X        return No;
  1039. X    n1 = tree(ep->focus);
  1040. X    sym1 = symbol(n1);
  1041. X    c = **pstr;
  1042. X    for (; *cp; cp += 2) {
  1043. X        if ((*cp&0177) != c)
  1044. X            continue;
  1045. X        symcp = cp[1];
  1046. X        tp = &table[symcp];
  1047. X        if (isinclass(sym1, tp->r_class[0]))
  1048. X            break;
  1049. X    }
  1050. X    if (!*cp)
  1051. X        return No;
  1052. X    ++*pstr;
  1053. X    if (c == ' ') {
  1054. X        ep->spflag = Yes;
  1055. X        return Yes;
  1056. X    }
  1057. X    n1 = nodecopy(n1); /* 'Cause it overlaps tree(ep->focus) */
  1058. X    treereplace(&ep->focus, table[symcp].r_node);
  1059. X    s_down(ep);
  1060. X    treereplace(&ep->focus, n1);
  1061. X    s_up(ep);
  1062. X    ep->mode = FHOLE;
  1063. X    ep->s1 = 3;
  1064. X    ep->s2 = (*cp&0200) ? 2 : 1;
  1065. X    ep->spflag = No;
  1066. X    return Yes;
  1067. X}
  1068. X
  1069. X
  1070. X/*
  1071. X * See whether a character may start a new node in a hole with given class.
  1072. X */
  1073. X
  1074. XHidden bool
  1075. Xcanfitchar(c, ci)
  1076. X    int c;
  1077. X    struct classinfo *ci;
  1078. X{
  1079. X    register classptr cp;
  1080. X    register int code = Code(c);
  1081. X
  1082. X    Assert(ci);
  1083. X    cp = ci->c_insert;
  1084. X    Assert(cp);
  1085. X    for (; *cp; cp += 2) {
  1086. X        if (cp[0] == code)
  1087. X            return Yes;
  1088. X    }
  1089. X    return No;
  1090. X}
  1091. X
  1092. X
  1093. X#ifndef NDEBUG
  1094. X/*
  1095. X * Debug routine to print a queue.
  1096. X */
  1097. X
  1098. XVisible Procedure
  1099. Xqshow(q, where)
  1100. X    queue q;
  1101. X    string where;
  1102. X{
  1103. X    node n;
  1104. X    char buf[256];
  1105. X    string cp;
  1106. X    string sp;
  1107. X
  1108. X    sprintf(buf, "%s:", where);
  1109. X    cp = buf + strlen(buf);
  1110. X    for (;q; q = q->q_link) {
  1111. X        n = q->q_data;
  1112. X        *cp++ = ' ';
  1113. X        if (Is_etext(n)) {
  1114. X            *cp++ = '"';
  1115. X            for (sp = e_strval((value) n); *sp; ++sp) {
  1116. X                if (isprint(*sp) || *sp == ' ') {
  1117. X                    *cp++ = *sp;
  1118. X                    if (*sp == '"')
  1119. X                        *cp++ = *sp;
  1120. X                }
  1121. X                else {
  1122. X                    sprintf(cp, "\\%03o", *sp&0377);
  1123. X                    cp += 4;
  1124. X                }
  1125. X            }
  1126. X            *cp++ = '"';
  1127. X        }
  1128. X        else {
  1129. X            strncpy(cp, table[symbol(n)].r_name, 80);
  1130. X            cp += strlen(cp);
  1131. X        }
  1132. X        if (cp >= buf+80) {
  1133. X            strcpy(buf+76, "...");
  1134. X            break;
  1135. X        }
  1136. X    }
  1137. X    *cp = 0;
  1138. X    debug(buf);
  1139. X}
  1140. X#endif /* NDEBUG */
  1141. END_OF_FILE
  1142.   if test 23165 -ne `wc -c <'abc/bed/e1que2.c'`; then
  1143.     echo shar: \"'abc/bed/e1que2.c'\" unpacked with wrong size!
  1144.   fi
  1145.   # end of 'abc/bed/e1que2.c'
  1146. fi
  1147. if test -f 'abc/boot/dump.c' -a "${1}" != "-c" ; then 
  1148.   echo shar: Will not clobber existing file \"'abc/boot/dump.c'\"
  1149. else
  1150.   echo shar: Extracting \"'abc/boot/dump.c'\" \(5863 characters\)
  1151.   sed "s/^X//" >'abc/boot/dump.c' <<'END_OF_FILE'
  1152. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */
  1153. X
  1154. X/*
  1155. X * Dump info in files for ABC editor.
  1156. X */
  1157. X
  1158. X#include "b.h"
  1159. X#include "main.h"
  1160. X
  1161. X#define Copyright \
  1162. X "/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */\n\n"
  1163. X#define Warning \
  1164. X "/* WARNING: this file is constructed by 'mktable'. */\n"
  1165. X#define Change \
  1166. X "/* If you want to change the grammar, see ../boot/README. */\n\n"
  1167. X
  1168. XVisible Procedure dump_files() {
  1169. X    
  1170. X    dump_tables();
  1171. X    
  1172. X    dump_include();
  1173. X}
  1174. X    
  1175. XHidden Procedure dump_tables() {
  1176. X    
  1177. X    dump_title(tfp, "Data file with grammar tables");
  1178. X    fprintf(tfp, "#include \"b.h\"\n");
  1179. X    fprintf(tfp, "#include \"bedi.h\"\n");
  1180. X    fprintf(tfp, "#include \"%s\"\n\n", hfile);
  1181. X    dump_classdef();
  1182. X    dump_symdef();
  1183. X    dump_lexdef();
  1184. X}
  1185. X
  1186. XHidden Procedure dump_title(xfp, title) FILE *xfp; string title; {
  1187. X    fprintf(xfp, Copyright);
  1188. X    fprintf(xfp, "/* %s. */\n\n", title);
  1189. X    fprintf(xfp, Warning);
  1190. X    fprintf(xfp, Change);
  1191. X}
  1192. X
  1193. XHidden Procedure dump_classdef() {
  1194. X    struct classinfo *pclass;
  1195. X    int iclass;
  1196. X    
  1197. X    for (iclass= 0; iclass < nclass; iclass++) {
  1198. X        pclass= &classdef[iclass];
  1199. X        dump_array(pclass->c_syms, 's', iclass);
  1200. X        dump_array(pclass->c_insert, 'i', iclass);
  1201. X        dump_array(pclass->c_append, 'a', iclass);
  1202. X        dump_array(pclass->c_join, 'j', iclass);
  1203. X    }
  1204. X    fprintf(tfp, "\nstruct classinfo cl[%d] = {\n", nclass);
  1205. X    for (iclass= 0; iclass < nclass; iclass++) {
  1206. X        pclass= &classdef[iclass];
  1207. X        fprintf(tfp, "   {");
  1208. X        dump_adr(pclass->c_syms, 's', iclass);
  1209. X        fprintf(tfp, ", ");
  1210. X        dump_adr(pclass->c_insert, 'i', iclass);
  1211. X        fprintf(tfp, ", ");
  1212. X        dump_adr(pclass->c_append, 'a', iclass);
  1213. X        fprintf(tfp, ", ");
  1214. X        dump_adr(pclass->c_join, 'j', iclass);
  1215. X        if (iclass < nclass-1)
  1216. X            fprintf(tfp, "},");
  1217. X        else
  1218. X            fprintf(tfp, "}");
  1219. X        fprintf(tfp, "    /* %s */\n", pclass->c_name);
  1220. X    }
  1221. X    fprintf(tfp, "};\n\n");
  1222. X}    
  1223. X
  1224. XHidden Procedure dump_array(parray, ch, icl) itemptr parray; char ch; int icl; {
  1225. X    int w;    /* guess line width */
  1226. X    int a;
  1227. X    
  1228. X    if (parray == NULL)
  1229. X        return;
  1230. X    fprintf(tfp, "classelem %c%d[]= {", ch, icl);
  1231. X    w= 18;
  1232. X    while (!Isnilitem(*parray)) {
  1233. X        if (w >= 70) {
  1234. X            fprintf(tfp, "\n\t");
  1235. X            w= 8;
  1236. X        }
  1237. X        a= (int)*parray;
  1238. X        fprintf(tfp, "%d,", a);
  1239. X        w+= (a>99 ? 4: a>9 ? 3: 2);
  1240. X        parray++;
  1241. X    }
  1242. X    fprintf(tfp, "0};\n");
  1243. X}
  1244. X
  1245. XHidden Procedure dump_adr(parray, ch, icl) itemptr parray; char ch; int icl; {
  1246. X    
  1247. X    if (parray == NULL)
  1248. X        fprintf(tfp, "0");
  1249. X    else
  1250. X        fprintf(tfp, "%c%d", ch, icl);
  1251. X}
  1252. X
  1253. XHidden Procedure dump_symdef() {
  1254. X    int isym;
  1255. X
  1256. X    fprintf(tfp, "static struct table abc_grammar[%d] = {\n", nsym);
  1257. X    for (isym= 0; isym < nsym; ++isym)
  1258. X        dumpsymbol(isym);
  1259. X    fprintf(tfp, "};\n\n");
  1260. X    
  1261. X    fprintf(tfp, "struct table *table= abc_grammar;\n");
  1262. X}
  1263. X    
  1264. XHidden Procedure dumpsymbol(isym) int isym; {
  1265. X    struct syminfo *psym;
  1266. X    int ich;
  1267. X    
  1268. X    fprintf(tfp, "   /* %-3d */ {", isym);
  1269. X    psym= &symdef[isym];
  1270. X    dumpstring(psym->s_name);
  1271. X    fprintf(tfp, ", {");
  1272. X    for (ich= 0; ich <= MAXCHILD; ++ich) {
  1273. X        dumpstring(psym->s_repr[ich]);
  1274. X        if (ich == MAXCHILD)
  1275. X            break;
  1276. X        fprintf(tfp, ",");
  1277. X    }
  1278. X    fprintf(tfp, "}, {");
  1279. X    for (ich= 0; ich < MAXCHILD; ++ich) {
  1280. X        dump_cl(psym->s_class[ich]);
  1281. X        if (ich == MAXCHILD-1)
  1282. X            break;
  1283. X        fprintf(tfp, ",");
  1284. X    }
  1285. X    fprintf(tfp, "}, 0}%s\n",  (isym==nsym-1 ? "" : ","));
  1286. X}
  1287. X
  1288. XHidden Procedure dumpstring(s) string s; {
  1289. X    char c;
  1290. X    
  1291. X    if (s == NULL) {
  1292. X        fprintf(tfp, "0");
  1293. X        return;
  1294. X    }
  1295. X    fputc('"', tfp);
  1296. X    for (; (c= *s) != '\0'; ++s) {
  1297. X        if (c == '\b')
  1298. X            fprintf(tfp, "\\b");
  1299. X        else if (c == '\t')
  1300. X            fprintf(tfp, "\\t");
  1301. X        else if (c == '\n')
  1302. X            fprintf(tfp, "\\n");
  1303. X        else if (c == '\\' || c == '"')
  1304. X            fprintf(tfp, "\\%c", c);
  1305. X        else
  1306. X            fputc(c, tfp);
  1307. X    }
  1308. X    fprintf(tfp, "\"");
  1309. X}
  1310. X
  1311. XHidden Procedure dump_cl(ind) item ind; {
  1312. X    if (ind >= 0)
  1313. X        fprintf(tfp, "&cl[%d]", ind);
  1314. X    else
  1315. X        fprintf(tfp, "0");
  1316. X}
  1317. X
  1318. XHidden Procedure dump_lexdef() {
  1319. X    int ilex;
  1320. X
  1321. X    fprintf(tfp, "\nstatic struct lexinfo abc_lexicals[%d] = {\n", nlex);
  1322. X    for (ilex= 0; ilex < nlex; ++ilex)
  1323. X        dumplex(&lexdef[ilex], (ilex==nlex-1 ? "" : ","));
  1324. X    fprintf(tfp, "};\n\n");
  1325. X    
  1326. X    fprintf(tfp, "struct lexinfo *lextab= abc_lexicals;\n");
  1327. X}
  1328. X
  1329. XHidden Procedure dumplex(plex, sep) struct lexinfo *plex; string sep; {
  1330. X    
  1331. X    fprintf(tfp, "   {");
  1332. X    dumpstring(plex->l_start);
  1333. X    fprintf(tfp, ", ");
  1334. X    dumpstring(plex->l_cont);
  1335. X    fprintf(tfp, "}%s    /* %s */\n", sep, plex->l_name);
  1336. X}
  1337. X    
  1338. XHidden Procedure dump_include() {
  1339. X    
  1340. X    dump_title(ifp, "Header file with grammar table structure");
  1341. X    if (nsym+nlex < 128)
  1342. X        fprintf(ifp, "typedef char classelem;\n");
  1343. X    else
  1344. X        fprintf(ifp, "typedef short classelem;\n");
  1345. X    
  1346. X    fprintf(ifp, "typedef classelem *classptr;\n\n");
  1347. X    
  1348. X    fprintf(ifp, "struct classinfo {\n");
  1349. X    fprintf(ifp, "   classptr c_class;\n");
  1350. X    fprintf(ifp, "   classptr c_insert;\n");
  1351. X    fprintf(ifp, "   classptr c_append;\n");
  1352. X    fprintf(ifp, "   classptr c_join;\n");
  1353. X    fprintf(ifp, "};\n\n");
  1354. X    
  1355. X    fprintf(ifp, "#define MAXCHILD %d\n\n", MAXCHILD);
  1356. X    
  1357. X    fprintf(ifp, "struct table {\n");
  1358. X    fprintf(ifp, "   string r_name;\n");
  1359. X    fprintf(ifp, "   string r_repr[MAXCHILD+1];\n");
  1360. X    fprintf(ifp, "   struct classinfo *r_class[MAXCHILD];\n");
  1361. X    fprintf(ifp, "   node r_node;\n");
  1362. X    fprintf(ifp, "};\n\n");
  1363. X    
  1364. X    fprintf(ifp, "extern struct table *table;\n");
  1365. X    fprintf(ifp, "#define TABLEN %d\n", nsym);
  1366. X    
  1367. X    fprintf(ifp, "struct lexinfo {\n");
  1368. X    fprintf(ifp, "   string l_start;\n");
  1369. X    fprintf(ifp, "   string l_continue;\n");
  1370. X    fprintf(ifp, "};\n\n");
  1371. X    
  1372. X    fprintf(ifp, "extern struct lexinfo *lextab;\n");
  1373. X    
  1374. X    dump_isymdef();
  1375. X    
  1376. X    dump_ilexdef();
  1377. X}
  1378. X
  1379. XHidden Procedure dump_isymdef() {
  1380. X    int isym;
  1381. X    
  1382. X    fprintf(ifp, "\n/* Symbols indexing grammar table */\n\n");
  1383. X    for (isym= 0; isym < nsym; isym++) {
  1384. X        fprintf(ifp, "#define %s %d\n", symdef[isym].s_name, isym);
  1385. X    }
  1386. X}
  1387. X
  1388. XHidden Procedure dump_ilexdef() {
  1389. X    int ilex;
  1390. X    
  1391. X    fprintf(ifp, "\n/* LEXICAL symbols */\n");
  1392. X    fprintf(ifp, "\n#define LEXICAL %d\n\n", nlexical);
  1393. X    for (ilex= 0; ilex < nlex; ilex++) {
  1394. X        fprintf(ifp, "#define %s %d\n", 
  1395. X            lexdef[ilex].l_name, nlexical+ilex);
  1396. X    }
  1397. X    fprintf(ifp, "\n#define NLEX %d\n", nlex);
  1398. X}
  1399. END_OF_FILE
  1400.   if test 5863 -ne `wc -c <'abc/boot/dump.c'`; then
  1401.     echo shar: \"'abc/boot/dump.c'\" unpacked with wrong size!
  1402.   fi
  1403.   # end of 'abc/boot/dump.c'
  1404. fi
  1405. if test -f 'abc/tc/termcap' -a "${1}" != "-c" ; then 
  1406.   echo shar: Will not clobber existing file \"'abc/tc/termcap'\"
  1407. else
  1408.   echo shar: Extracting \"'abc/tc/termcap'\" \(22050 characters\)
  1409.   sed "s/^X//" >'abc/tc/termcap' <<'END_OF_FILE'
  1410. X# This file has been shortened considerably for the ABC distribution
  1411. X# and derives from a very old public-domain version. It should only be seen
  1412. X# as an example.
  1413. X# Ask yous boss to pay for a decent unix:-).
  1414. X#
  1415. X# This file describes capabilities of various terminals, as needed by
  1416. X# software such as screen editors.  It does not attempt to describe
  1417. X# printing terminals very well, nor graphics terminals.  Someday.
  1418. X# See termcap(5) in the Unix Programmers Manual for documentation.
  1419. X#
  1420. X# Conventions: First entry is two chars, first char is manufacturer,
  1421. X# second char is canonical name for model or mode.
  1422. X# Third entry is the one the editor will print with "set" command.
  1423. X# Last entry is verbose description.
  1424. X# Others are mnemonic synonyms for the terminal.
  1425. X#
  1426. X# Terminal naming conventions:
  1427. X# Terminal names look like <manufacturer> <model> - <modes/options>
  1428. X# Certain abbreviations (e.g. c100 for concept100) are also allowed
  1429. X# for upward compatibility.  The part to the left of the dash, if a
  1430. X# dash is present, describes the particular hardware of the terminal.
  1431. X# The part to the right can be used for flags indicating special ROM's,
  1432. X# extra memory, particular terminal modes, or user preferences.
  1433. X# All names are always in lower case, for consistency in typing.
  1434. X#
  1435. X# The following are conventionally used flags:
  1436. X#    rv    Terminal in reverse video mode (black on white)
  1437. X#    2p    Has two pages of memory.  Likewise 4p, 8p, etc.
  1438. X#    w    Wide - in 132 column mode.
  1439. X#    pp    Has a printer port which is used.
  1440. X#    na    No arrow keys - termcap ignores arrow keys which are
  1441. X#        actually there on the terminal, so the user can use
  1442. X#        the arrow keys locally.
  1443. X#  
  1444. X# There are some cases where the same name is used for two different
  1445. X# terminals, e.g. "teleray" or "2621" or "vt100".  In these cases,
  1446. X# if a site has one of these, they should choose a local default and
  1447. X# bring that terminal to the front in the reorder script.  This works
  1448. X# because tgetent picks the first match in /etc/termcap.
  1449. X# The list of names intentionally duplicated is:
  1450. X# 2621, c108, dtc, hp2621, teleray, tvi, vt100.
  1451. X#
  1452. X# If you absolutely MUST check for a specific terminal (this is discouraged)
  1453. X# check for the 2nd entry (the canonical form) since all other codes are
  1454. X# subject to change.  The two letter codes are there for version 6 and are
  1455. X# EXTREMELY subject to change, or even to go away if version 6 becomes for
  1456. X# all practical purposes obsolete.  We would much rather put in special
  1457. X# capabilities to describe your terminal rather than having you key on the
  1458. X# name.
  1459. X#
  1460. X#  Special manufacturer codes:
  1461. X#    A: hardcopy daisy wheel terminals
  1462. X#    M: Misc. (with only a few terminals)
  1463. X#      q: Homemade
  1464. X#      s: special (dialup, etc.)
  1465. X#  
  1466. X# Comments in this file begin with # - they cannot appear in the middle
  1467. X# of a termcap entry.  Individual entries are commented out by
  1468. X# placing a period between the colon and the capability name.
  1469. X#
  1470. X#  This file is to be installed with an editor script (reorder)
  1471. X#  that moves the most common terminals to the front of the file.
  1472. X#  If the source is not available, it can be constructed by sorting
  1473. X#  the above entries by the 2 char initial code.
  1474. X#
  1475. X# ...
  1476. X#
  1477. X# CIT 80  - vt 100 emulator, the termcap has been modified to remove
  1478. X#           the delay times and do an auto tab set rather than the indirect 
  1479. X#           file used in vt100.
  1480. XMT|cit80|cit 80|Citoh 80:\
  1481. X    :co#80:li#24:am:cl=\E[;H\EJ:bs:cm=\E[%i%2;%2H:nd=\E[C:up=\E[A:\
  1482. X    :ce=\EK:cd=\EJ:is=\E>:ks=\E[?1h\E=:ke=\E[?1l\E>:\
  1483. X    :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:
  1484. X# AlternateCIT 101 - vt 100 emulator, the termcap has been modified to remove
  1485. X#           the delay times and do an auto tab set rather than the indirect 
  1486. X#           file used in vt100.
  1487. X#        Uses 23 lines so can run citsys (like h19sys).
  1488. XMU|citc|Citoh fast vt100:\
  1489. X    :co#80:li#23:am:cl=\E[;H\E[2J:bs:cm=\E[%i%2;%2H:nd=\E[C:up=\E[A:\
  1490. X    :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\
  1491. X    :is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[3g\E[>5g:\
  1492. X    :ks=\E[?1h\E=:ke=\E[?1l\E>:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:\
  1493. X        :vb=\E[?5h\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\E[?5l:\
  1494. X    :dc=\E[P:al=\E[L:im=:ei=:dl=\E[M:ic=\E[@:
  1495. X# Note several versions of blit.  I don't know exactly what is what
  1496. X# so please send me any corrections to this -- mrh
  1497. X# From research!ikeya!rob Tue Aug 31 23:41 EDT 1982
  1498. XMY|blit|jerq|blit-pb|blit running teletype rom:\
  1499. X    :cr=^M:do=^J:nl=^J:bl=^G:ta=^I:\
  1500. X    :IC=\Ef%+ :DC=\Ee%+ :AL=\EF%+ :DL=\EE%+ :\
  1501. X    :mi:dl=\EE!:ic=\Ef!:dc=\Ee!:al=\EF!:\
  1502. X    :ce=\EK:cl=^L:cm=\EY%r%+ %+ :co#87:li#72:nd=\EC:\
  1503. X    :up=\EA:ku=\EA:kd=\EB:kr=\EC:kl=\ED:kb=^H:am:ul:pt:eo:
  1504. XMZ|cbblit|columbus enhanced tty blit:\
  1505. X    :vb=\E^G:so=\EU!:se=\EV!:us=\EU":ue=\EV":cd=\EJ:\
  1506. X    :im=\EQ:ei=\ER:ic@:co#88:sf=\EG:tc=blit:
  1507. XMa|oblit|ojerq|first version of blit rom:\
  1508. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1509. X    :AL=\Ef%+ :DL=\Ee%+ :mi:dl=\EE:ei=\ER:im=\EQ:dc=\EO:da:db:\
  1510. X    :al=\EF:cd=\EJ:ce=\EK:cl=^L:cm=\EY%r%+ %+ :co#88:li#72:nd=\EC:\
  1511. X    :up=\EA:vb=\E^G:am:ul:pt:eo:
  1512. XMb|daleblit|daleterm|blit running Dale DeJager's ROM:\
  1513. X    :ku=\EA:kd=\EB:kr=\EC:kl=\ED:so=\EU!:se=\EV!:us=\EU":ue=\EV":\
  1514. X    :da@:db@:tc=oblit:
  1515. XMc|datapoint|dp3|dp3360|datapoint 3360:\
  1516. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1517. X    :am:le=^H:bs:cd=^_:ce=^^:cl=^]^_:co#82:ho=^]:li#25:nd=^x:up=^z:
  1518. X#
  1519. X# d: DEC (DIGITAL EQUIPMENT CORPORATION)
  1520. X#
  1521. X# Note that xn glitch in vt100 is not quite the same as concept, since
  1522. X# the cursor is left in a different position while in the weird state
  1523. X# (concept at beginning of next line, vt100 at end of this line) so
  1524. X# all versions of vi before 3.7 don't handle xn right on vt100.
  1525. X# I assume you have smooth scroll off or are at a slow enough baud
  1526. X# rate that it doesn't matter (1200? or less).  Also this assumes
  1527. X# that you set auto-nl to "on", if you set it off use vt100-nam below.
  1528. X#
  1529. X# Since there are two things here called vt100, the installer can make
  1530. X# a local decision to make either one standard "vt100" by including
  1531. X# it in the list of terminals in reorder, since the first vt100 in
  1532. X# /etc/termcap is the one that it will find.  The choice is between
  1533. X# nam (no automatic margins) and am (automatic margins), as determined
  1534. X# by the wrapline switch (group 3 #2).  I presonally recommend turning
  1535. X# on the bit and using vt100-am, since having stuff hammer on the right
  1536. X# margin is sort of hard to read.  However, the xn glitch does not occur
  1537. X# if you turn the bit off.
  1538. X#
  1539. X# I am unsure about the padding requirements listed here.  I have heard
  1540. X# a claim that the vt100 needs no padding.  It's possible that it needs
  1541. X# padding only if the xon/xoff switch is off.  For UNIX, this switch
  1542. X# should probably be on.
  1543. X#
  1544. X# The vt100 uses rs and rf rather than is/ct/st because the tab settings
  1545. X# are in non-volatile memory and don't need to be reset upon login.
  1546. X# You can type "reset" to get them set.
  1547. Xdp|vt100-np|vt100 with no padding (for psl games):\
  1548. X    :cl=\E[H\E[2J:sr=\EM:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\
  1549. X    :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\
  1550. X    :md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:tc=vt100:
  1551. Xd0|vt100|vt100-am|dec vt100:\
  1552. X    :cr=^M:do=^J:nl=^J:bl=^G:co#80:li#24:cl=50\E[;H\E[2J:\
  1553. X    :le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
  1554. X    :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
  1555. X    :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\
  1556. X    :rf=/usr/lib/tabset/vt100:\
  1557. X    :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
  1558. X    :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
  1559. X    :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:ta=^I:pt:sr=5\EM:vt#3:xn:\
  1560. X    :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:
  1561. Xd1|vt100-nam|vt100 w/no am:\
  1562. X    :am@:xn@:tc=vt100-am:
  1563. Xd2|gt42|dec gt42:\
  1564. X    :cr=^M:do=^J:bl=^G:\
  1565. X    :le=^H:bs:co#72:ns:li#40:os:
  1566. Xd3|vt132|vt132:\
  1567. X    :al=99\E[L:dl=99\E[M:ip=7:dc=7\E[P:ei=\E[4l:im=\E[4h:xn:dN#30:tc=vt100:
  1568. Xd4|gt40|dec gt40:\
  1569. X    :cr=^M:do=^J:bl=^G:\
  1570. X    :le=^H:bs:co#72:ns:li#30:os:
  1571. Xd5|vt50|dec vt50:\
  1572. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1573. X    :le=^H:bs:cd=\EJ:ce=\EK:cl=\EH\EJ:co#80:li#12:nd=\EC:ta=^I:pt:up=\EA:
  1574. Xd6|vt125|vt125-am|DEC vt125:\
  1575. X    :xn:cr=^M:do=^J:nl=^J:bl=^G:co#80:li#24:cl=50\E[H\E[2J:\
  1576. X    :le=^H:am:bs:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:ce=3\E[K:cd=50\E[J:\
  1577. X    :so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:md=2\E[1m:mr=2\E[7m:mb=2\E[5m:\
  1578. X    :me=2\E[m:is=\E[1;24r\E[24;1H\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\
  1579. X    :ks=\E[?1h\E=:ke=\E[?1l\E>:if=/usr/lib/tabset/vt100:ku=\EOA:kd=\EOB:\
  1580. X    :kr=\EOC:kl=\EOD:kb=^H:ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:ta=^I:\
  1581. X    :pt:sr=5\EM:vt#3:sc=\E7:rc=\E8:cs=\E[%i%d;%dr:
  1582. X# DEC gigi color graphic terminal , same as vt52
  1583. Xd7|gigi|dec gigi terminal:\
  1584. X    :co#80:is=200\E>\E[?4l\E[?5l\E[?7h\E[?8h:\
  1585. X    :li#24:cl=100\E[;H\E[2J:bs:cm=50\E[%i%2;%2H:nd=200\E[C:up=100\E[A:\
  1586. X    :ce=120\E[K:cd=100\E[J:so=20\E[7m:se=20\E[m:us=20\E[4m:ue=20\E[m:\
  1587. X    :ks=200\E[?1h\E=:ke=200\E[?1l\E>:\
  1588. X    :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:\
  1589. X    :kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=200\EM:\
  1590. X    :dC=50:dF=200:dN=50:dT=50:
  1591. XdI|dw1|decwriter I:\
  1592. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1593. X    :le=^H:bs:co#72:hc:os:
  1594. X# From tut@Topaz.CC Thu May 12 14:49:02 1983
  1595. X# From tut@topaz.CC Thu Sep 24 22:10:46 1981
  1596. Xdf|dw4|decwriter IV:\
  1597. X    :cr=^M:do=^J:nl=^J:bl=^G:le=^H:bs:co#132:hc:os:am:\
  1598. X    :ta=^I:pt:is=\Ec:k0=\EOP:k1=\EOQ:k2=\EOR:k3=\EOS:kb=^H:
  1599. Xdh|vt50h|dec vt50h:\
  1600. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1601. X    :le=^H:bs:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :co#80:li#12:nd=\EC:\
  1602. X    :ta=^I:pt:sr=\EI:up=\EA:
  1603. Xdi|vt100-s|vt100 with status line at top:\
  1604. X    :li#23:i2=\E[2;24r\E[24;1H:\
  1605. X    :cm@:ho=\E[H^J:cl=50\E[;H^J\E[2J:\
  1606. X    :hs:es:ts=\E7\E[1;%dH\E[1K:fs=\E8:tc=vt100-am:
  1607. Xdj|vt100-s-bot|vt100 with status line at bottom:\
  1608. X    :li#23:i2=\E[1;23r\E[23;1H:\
  1609. X    :hs:es:ts=\E7\E[24;%dH\E[1K:fs=\E8:tc=vt100-am:
  1610. Xds|vt100-nav|dec vt100 132 cols 14 lines (w/o advanced video option):\
  1611. X    :li#14:tc=vt100-w:
  1612. Xdt|vt100-w|dec vt100 132 cols (w/advanced video):\
  1613. X    :co#132:li#24:rs=\E>\E[?3h\E[?4l\E[?5l\E[?8h:tc=vt100-am:
  1614. Xdv|vt100-w-nam|dec vt100 132 cols (w/advanced video), no am:\
  1615. X    :co#132:li#24:rs=\E>\E[?3h\E[?4l\E[?5l\E[?8h:vt@:tc=vt100-nam:
  1616. Xdw|vt52|dec vt52:\
  1617. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1618. X    :le=^H:bs:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :co#80:li#24:nd=\EC:\
  1619. X    :ta=^I:pt:sr=\EI:up=\EA:ku=\EA:kd=\EB:kr=\EC:kl=\ED:kb=^H:
  1620. Xdx|dw2|decwriter II:\
  1621. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1622. X    :kb=^h:le=^H:bs:co#132:hc:os:
  1623. X#  # --------------------------------
  1624. X#
  1625. X# h: HEWLETT PACKARD
  1626. X#
  1627. X# Note: no "ho" on HP's since that homes to top of memory, not screen.
  1628. X# Due to severe 2621 braindamage, the only way to get the arrow keys to
  1629. X# transmit anything at all is to turn on the function key labels
  1630. X# (f1-f8) with ks, and even then the poor user has to hold down shift!
  1631. X# The default 2621 turns off the labels except when it has to to enable
  1632. X# the function keys.  If your installation prefers labels on all the time,
  1633. X# or off all the time (at the "expense" of the function keys) move the
  1634. X# 2621-nl or 2621-wl labels to the front using reorder.
  1635. X# Note: there are newer ROM's for 2621's that allow you to set strap A
  1636. X# so the regular arrow keys xmit \EA, etc, as with the 2645.  However,
  1637. X# even with this strap set, the terminal stops xmitting if you reset it,
  1638. X# until you unset and reset the strap!  Since there is no way to set/unset
  1639. X# the strap with an escape sequence, we don't use it in the default.
  1640. X# If you like, you can use 2621-ba (braindamaged arrow keys).
  1641. Xh1|2621-ba|2621 w/new rom, strap A set:\
  1642. X    :ks@:ke@:ku=\EA:kd=\EB:kl=\ED:kr=\EC:kh=\Eh:tc=hp2621:
  1643. X# 2621 with function labels.  Most of the time they are off,
  1644. X# but inside vi, the function key labels appear.  You have to
  1645. X# hold down shift to get them to xmit.
  1646. X# 2621k45: untested
  1647. X# 2622: unsure if this is quite it, have only heard about the terminal.
  1648. Xh3|2621k45|hp2621k45|k45|2622|hp2622|hp 2621 with 45 keyboard:\
  1649. X    :kb=^H:ku=\EA:kd=\EB:kl=\ED:kr=\EC:kh=\Eh:ks=\E&s1A:ke=\E&s0A:tc=2621:
  1650. X# This entry does not use any of the fancy windowing stuff of the 2621.
  1651. X# Indeed, termcap does not yet handle such stuff.  We are looking at it.
  1652. Xh6|hp2626|hp2626a|hp2626p|2626|2626a|2626p|hp 2626:\
  1653. X    :dc=2\EP:ip=2:se=\E&d@:so=\E&dB:cd=500\EJ:\
  1654. X    :mr=\E&dB:us=\E&dD:mb=\E&dA:mk=\E&dS:me=\E&d@:ue=\E&d@:\
  1655. X    :kh=\Eh:ku=\EA:kl=\ED:kr=\EC:kd=\EB:ks=\E&s1A:ke=\E&s0A:\
  1656. X    :sf=\ES:ta=2^I:xs:tc=2621:
  1657. X# cD is a pain - but it only screws up at 9600 baud.
  1658. X# You should use this terminal at 4800 baud or less.
  1659. Xh8|hp2648|hp2648a|2648a|2648|HP 2648a graphics terminal:\
  1660. X    :cl=50\EH\EJ:cm=20\E&a%r%dc%dY:dc=7\EP:ip=5:tc=2645:
  1661. X# This terminal should be used at 4800 baud or less.
  1662. Xh9|hp2645-np|2645 w/no padding:cm=\E&a%r%dc%dY:tc=hp2645:
  1663. X# 2640a doesn't have the Y cursor addressing feature, and C is memory relative
  1664. X# instead of screen relative, as we need.
  1665. X# 2621 using all 48 lines of memory, only 24 visible at any time.  Untested.
  1666. Xhl|2621-48|48 line 2621:\
  1667. X    :li#48:ho=\EH:cm=\E&a%r%dc%dR:tc=2621:
  1668. X# 2621 with no labels ever.  Also prevents vi delays on escape.
  1669. X# Needed for UCB ARPAVAX console, since lsi-11 expands tabs (wrong).
  1670. Xht|hp2621-nt|2621nt|2621-nt|hp2621nt|hp 2621 w/no tabs:\
  1671. X    :pt@:tc=hp2621:
  1672. X# 2621 with labels on all the time - normal outside vi, function inside vi.
  1673. X#  # --------------------------------
  1674. X#
  1675. X# l: LEAR SIEGLER (ADM)
  1676. X#
  1677. X# If the adm31 gives you trouble with standout mode, check the DIP switch
  1678. X# in position 6, bank @c11, 25% from back end of pc.  Should be OFF.
  1679. X# If there is no such switch, you have an old adm31 and must use oadm31
  1680. Xl1|adm31|31|lsi adm31:\
  1681. X    :is=\Eu\E0:cr=^M:do=^J:nl=^J:bl=^G:\
  1682. X    :al=\EE:am:le=^H:bs:ce=\ET:cm=\E=%+ %+ :cl=\E*:cd=\EY:\
  1683. X    :co#80:dc=\EW:dl=\ER:ei=\Er:ho=^^:im=\Eq:\
  1684. X    :k0=^A0\r:k1=^A1\r:k2=^A2\r:k3=^A3\r:k4=^A4\r:\
  1685. X    :k5=^A5\r:k6=^A6\r:k7=^A7\r:k8=^A8\r:k9=^A9\r:kd=^J:kl=^H:kr=^L:ku=^K:\
  1686. X    :li#24:ma=j^Jk^P^K^Pl ^R^L^L :mi:nd=^L:\
  1687. X    :se=\EG0:so=\EG1:up=^K:us=\EG1:ue=\EG0:
  1688. Xl2|adm2|lsi adm2:\
  1689. X    :cr=^M:do=^J:nl=^J:bl=^G:al=\EE:am:le=^H:bs:cd=\EY:ce=\ET:cl=\E;:\
  1690. X    :cm=\E=%+ %+ :co#80:dc=\EW:dl=\ER:\
  1691. X    :ei=:ho=^^:ic=\EQ:im=:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:li#24:nd=^L:up=^K:
  1692. Xl3|adm3|3|lsi adm3:\
  1693. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1694. X    :am:le=^H:bs:cl=^Z:li#24:ma=^K^P:co#80:
  1695. Xl4|adm42|42|lsi adm42:\
  1696. X    :vs=\EC\E3 \E3(:\
  1697. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1698. X    :al=270\EE:am:le=^H:bs:cd=\EY:ce=\ET:cl=\E;:cm=\E=%+ %+ :co#80:\
  1699. X    :dc=\EW:dl=\ER:ei=\Er:im=\Eq:ip=6*:li#24:\
  1700. X    :bt=\EI:nd=^L:se=\EG0:so=\EG4:ta=\t:up=^k:\
  1701. X    :ma=^K^P:pc=\177:
  1702. Xl5|adm5|5|lsi adm5:\
  1703. X    :cr=^M:do=^J:nl=^J:bl=^G:\
  1704. X    :cd=\EY:ce=\ET:do=^J:kb=^H:kh=^^:\
  1705. X    :ma=^Hh^Jj^Kk^Ll^^H:se=\EG:sg#1:so=\EG:tc=adm3aplus:
  1706. Xl7|adm20|lear siegler adm20:\
  1707. X    :am:li#24:co#80:bs:cl=^Z:cm=\E=%i%r%+^_%+^_:nd=^L:up=^K:ho=^^:ce=\ET:\
  1708. X    :cd=\EY:al=\EE:dl=\ER:im=:ei=:ic=\EQ:dm=:ed=:dc=\EW:so=\E):se=\E(:\
  1709. X    :bt=\EI:pt:kn#7:k1=^A:k2=^B:k3=^W:k4=^D:k5=^E:k6:^X:k7=^Z:
  1710. Xla|adm3a|3a|lsi adm3a:\
  1711. X    :am:cr=^M:do=^J:nl=^J:bl=^G:\
  1712. X    :le=^H:bs:cm=\E=%+ %+ :cl=1^Z:co#80:ho=^^:li#24:ma=^K^P:nd=^L:up=^K:
  1713. Xlb|adm3a+|3a+|adm3aplus:\
  1714. X    :kl=^H:kd=^J:ku=^K:kr=^L:tc=adm3a:
  1715. Xlc|adm22|22|lsi adm22:\
  1716. X    :is=\E%\014\014\014\016\003\000\003\002\003\002\000\000\000\000\000\000\000\000\000\000\000:\
  1717. X    :al=\EE:am:bs:bt=\EI:cd=\Ey:ce=\Et:cl=\E+:cm=\000\E=%+ %+ :co#80:\
  1718. X    :cr=^M:dc=\EW:dl=\ER:do=^J:em=:ho=^^:ic=\EQ:im=:\
  1719. X    :k1=\001@\015:k2=\001A\015:k3=\001B\015:k4=\001C\015:\
  1720. X    :k5=\001D\015:k6=\001E\015:k7=\001F\015:kn#7:\
  1721. X    :ko=ho:\
  1722. X    :l1=F1:l2=F2:l3=F3:l4=F4:l5=F5:l6=F6:l7=F7:\
  1723. X    :kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:li#24:\
  1724. X    :ma=j^Jk^P^K^Pl ^R^L^L :nd=^L:nl=^J:\
  1725. X    :se=\E(:so=\E):ta=\Ei:up=^K:
  1726. X#  # --------------------------------
  1727. X#
  1728. X# v: TELEVIDEO
  1729. X#
  1730. X# There are some tvi's that require incredible amounts of padding and
  1731. X# some that don't.  I'm assuming 912 and 920 are the old slow ones,
  1732. X# and 912b, 912c, 920b, 920c are the new ones that don't need padding.
  1733. Xv1|tvi912|912|920|tvi920|old televideo:\
  1734. X    :ct=\E3:st=\E1:cr=^M:do=^J:nl=^J:bl=^G:\
  1735. X    :al=33*\EE:le=^H:ce=\ET:cm=\E=%+ %+ :cl=^Z:co#80:dc=\EW:dl=33*\ER:ei=:\
  1736. X    :kb=^h:ku=^K:kd=^J:kl=^H:kr=^L:k0=^A@\r:k1=^AA\r:k2=^AB\r:k3=^AC\r:\
  1737. X    :bs:am:k4=^AD\r:k5=^AE\r:k6=^AF\r:k7=^AG\r:k8=^AH\r:k9=^AI\r:\
  1738. X    :ho=^^:im=:ic=\EQ:li#24:nd=^L:ta=^I:pt:se=\Ek:so=\Ej:up=^K:us=\El:ue=\Em:\
  1739. X    :ma=^K^P^L :sg#1:ug#1:
  1740. X# the 912 has a <funct> key that's like shift: <funct>8 xmits "^A8\r".
  1741. X# The 920 has this plus real function keys that xmit different things.
  1742. X# Termcap makes you use the funct key on the 912 but the real keys on the 920.
  1743. Xv2|912b|912c|tvi912b|tvi912c|tvi|new televideo 912:\
  1744. X    :al=5*\EE:dl=5*\ER:tc=tvi912:
  1745. Xv3|920b|920c|tvi920b|tvi920c|new televideo 920:\
  1746. X    :k0=^A@\r:k1=^AA\r:k2=^AB\r:k3=^AC\r:k4=^AD\r:k5=^AE\r:\
  1747. X    :k6=^AF\r:k7=^AG\r:k8=^AH\r:k9=^AI\r:tc=tvi912b:
  1748. X# set to page 1 when entering ex (\E-17 )
  1749. X# reset to page 0 when exiting ex (\E-07 )
  1750. Xv4|tvi912-2p|tvi920-2p|912-2p|920-2p|tvi-2p|televideo w/2 pages:\
  1751. X    :ti=\E-17 :te=\E-07 :tc=tvi912:\
  1752. Xv5|tvi950-ap|tvi 950 w/alt pages:\
  1753. X    :is=\E\\1:ti=\E-06 :te=\E-16 :tc=tvi950:
  1754. Xv6|tvi950-b|bare tvi950 no is:\
  1755. X    :is@:tc=tvi950:
  1756. Xv7|tvi950-ns|tvi950 w/no standout:\
  1757. X    :so@:se@:us@:ue@:tc=tvi950:
  1758. Xv8|tvi925|925|televideo model 925:\
  1759. X    :hs:xn:am:bs:co#80:li#24:cm=\E=%+ %+ :cl=^Z:cd=\EY:ce=\ET:is=\El\E":\
  1760. X    :al=\EE:dl=\ER:im=:ei=:ic=\EQ:dc=\EW:if=/usr/lib/tabset/stdcrt:\
  1761. X    :ho=^^:nd=^L:bt=\EI:pt:so=\EG4:se=\EG0:sg#1:us=\EG8:ue=\EG0:ug#1:\
  1762. X    :up=^K:do=^V:kb=^H:ku=^K:kd=^V:kl=^H:kr=^L:kh=^^:ma=^V^J^L :\
  1763. X    :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\
  1764. X    :k8=^AG\r:k9=^AH\r:k0=^AI\r:ko=ic,dc,al,dl,cl,ce,cd,bt:\
  1765. X    :ts=\Ef:fs=\Eg:
  1766. X# entry by Tim Curry 5/21/82 Univ. of Central Fla. duke!ucf-cs!tim
  1767. Xv9|925a|tvi925a|TeleVideo Model 925:\
  1768. X        :al=\EE:am:bs:bt=\EI:bw:cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :co#80:dc=\EW:\
  1769. X        :dl=\ER:do=^V:ei=:ic=\EQ:if=/usr/lib/tabset/std:im=:kb=^H:kd=^V:\
  1770. X        :kh=^^:kl=^H:kn#12:kr=^L:ku=^K:li#24:nd=^L:pt:se=\EG0:sg=#1:so=\EG4:\
  1771. X        :ue=\EG0:ug#1:ul:up=^K:us=\EG8:is=\El\
  1772. X        :vb=\Eb\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Ed:\
  1773. X        :ve=\E.4:vs=\E.2:
  1774. X# The following tvi descriptions from B:pjphar and virus!mike
  1775. X# is for all 950's.  It sets the following attributes:
  1776. X# full duplex (\EDF)        write protect off (\E()
  1777. X# conversation mode (\EC)    graphics mode off (\E%)
  1778. X# white on black (\Ed)        auto page flip off (\Ew)
  1779. X# turn off status line (\Eg)    clear status line (\Ef\r)
  1780. X# normal video (\E0)        monitor mode off (\EX or \Eu)
  1781. X# edit mode (\Er)        load blank char to space (\Ee\040)
  1782. X# line edit mode (\EO)        enable buffer control (^O)
  1783. X# protect mode off (\E\047)    duplex edit keys (\El)
  1784. X# program unshifted send key to send line all (\E016)
  1785. X# program shifted send key to send line unprotected (\E004)
  1786. X# set the following to nulls:
  1787. X#    field delimiter (\Ex0\200\200)
  1788. X#    line delimiter (\Ex1\200\200)
  1789. X#    start-protected field delimiter (\Ex2\200\200)
  1790. X#    end-protected field delimiter (\Ex3\200\200)
  1791. X# set end of text delimiter to carriage return/null (\Ex4\r\200)
  1792. X#
  1793. Xva|tvi950|950|televideo950:\
  1794. X    :ct=\E3:st=\E1:cr=^M:do=^J:nl=^J:bl=^G:\
  1795. X    :is=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O\
  1796. X    \El\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\
  1797. X    \Ex3\200\200\Ex4\r\200\Ef\r:\
  1798. X    :al=\EE:am:le=^H:bs:bt=\EI:cd=\Ey:ce=\Et:cl=\E*:cm=\E=%+ %+ :\
  1799. X    :co#80:dc=\EW:dl=\ER:do=^V:ei=\Er:ho=^^:im=\Eq:k0=^A0\r:\
  1800. X    :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\
  1801. X    :k7=^AF\r:k8=^AG\r:k9=^AH\r:kb=^H:kd=^V:kh=^^:kl=^H:\
  1802. X    :ko=ic\054dc\054al\054dl\054cl\054bt\054ce\054cd:kr=^L:\
  1803. X    :ku=^K:li#24:ma=^Vj^Kk^Hh^Ll^^H:mi:ms:nd=^L:ta=^I:pt:se=\EG0:\
  1804. X    :sg#1:so=\EG4:sr=\Ej:ue=\EG0:ug#1:up=^K:us=\EG8:\
  1805. X    :vb=\Eb\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Ed:\
  1806. X    :xn:hs:ts=\Eg\Ef:fs=\r:ds=\Eg\Ef\r:
  1807. X#
  1808. X# is for 950 with two pages adds the following:
  1809. X#    set 48 line page (\E\\2)
  1810. X#    place cursor at page 0, line 24, column 1 (\E-07 )
  1811. X#    set local (no send) edit keys (\Ek)
  1812. X#
  1813. X# two page 950 adds the following:
  1814. X#    when entering ex, set 24 line page (\E\\1)
  1815. X#    when exiting ex, reset 48 line page (\E\\2)
  1816. X#             place cursor at 0,24,1 (\E-07 )
  1817. X#    set duplex (send) edit keys (\El) when entering vi
  1818. X#    set local (no send) edit keys (\Ek) when exiting vi
  1819. X#
  1820. Xvb|tvi950-2p|950-2p|televideo950 w/2 pages:\
  1821. X    :is=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O\
  1822. X    \Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\
  1823. X    \Ex3\200\200\Ex4\r\200\E\\2\E-07 \
  1824. X    :te=\E\\2\E-07 :ti=\E\\1\E-07 :ks=\El:ke=\Ek:tc=tvi950:
  1825. X#
  1826. X# is for 950 with four pages adds the following:
  1827. X#    set 96 line page (\E\\3)
  1828. X#    place cursor at page 0, line 24, column 1 (\E-07 )
  1829. X#
  1830. X# four page 950 adds the following:
  1831. X#    when entering ex, set 24 line page (\E\\1)
  1832. X#    when exiting ex, reset 96 line page (\E\\3)
  1833. X#             place cursor at 0,24,1 (\E-07 )
  1834. X#
  1835. Xvc|tvi950-4p|950-4p|televideo950 w/4 pages:\
  1836. X    :is=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O\
  1837. X    \Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\
  1838. X    \Ex3\200\200\Ex4\r\200\E\\3\E-07 \
  1839. X    :te=\E\\3\E-07 :ti=\E\\1\E-07 :ks=\El:ke=\Ek:tc=tvi950:
  1840. X#
  1841. X# is for reverse video 950 changes the following:
  1842. X#    set reverse video (\Ed)
  1843. X#
  1844. X# set vb accordingly (\Ed ...nulls... \Eb)
  1845. X#
  1846. Xvd|tvi950-rv|950-rv|televideo950 rev video:\
  1847. X    :is=\EDF\EC\Eb\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O\
  1848. X    \El\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\
  1849. X    \Ex3\200\200\Ex4\r\200:\
  1850. X    :vb=\Ed\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Eb:\
  1851. X    :tc=tvi950:
  1852. X#
  1853. X# uses the appropriate entries from 950-2p and 950-rv
  1854. X#
  1855. Xve|tvi950-rv-2p|950-rv-2p|televideo950 rev video w/2 pages:\
  1856. X    :is=\EDF\EC\Eb\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O\
  1857. X    \Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\
  1858. X    \Ex3\200\200\Ex4\r\200\E\\2\E-07 :\
  1859. X    :vb=\Ed\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Eb:\
  1860. X    :te=\E\\2\E-07 :ti=\E\\1\E-07 :ks=\El:ke=\Ek:tc=tvi950:
  1861. X#
  1862. X# uses the appropriate entries from 950-4p and 950-rv
  1863. X#
  1864. Xvf|tvi950-rv-4p|950-rv-4p|televideo950 rev video w/4 pages:\
  1865. X    :is=\EDF\EC\Eb\EG0\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O\
  1866. X    \Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\
  1867. X    \Ex3\200\200\Ex4\r\200\E\\3\E-07 :\
  1868. X    :vb=\Ed\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Eb:\
  1869. X    :te=\E\\3\E-07 :ti=\E\\1\E-07 :ks=\El:ke=\Ek:tc=tvi950:
  1870. Xve|tvi924|924|televideo model 924:\
  1871. X    :am:bs:xn:co#80:li#24:cm=\E=%+ %+ :cl=\E*0:cd=\Ey:ce=\Et:is=\Ek0\E"^O:\
  1872. X    :al=\EE:dl=\ER:im=:ei=:ic=\EQ:dc=\EW:if=/usr/lib/tabset/stdcrt:ho=^^:\
  1873. X    :nd=^L:bt=\EI:pt:so=\EG4:se=\EG0:us=\EG8:ue=\EG0:up=^K:do=^V:kb=^H:\
  1874. X    :ku=^K:kd=^V:kl=^H:kr=^L:kh=^^:ma=^Vj^Kk^Ll^^H^R^L:k1=^A@\r:k2=^AA\r:\
  1875. X    :k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:\
  1876. X    :k0=^AI\r:ko=ic,dc,al,dl,cl,ce,cd,bt:sr=\Ej:\
  1877. X    :hs:fs=^Y\Es1:ts=\Ef:ds=\Es0\Ef^Y:
  1878. END_OF_FILE
  1879.   if test 22050 -ne `wc -c <'abc/tc/termcap'`; then
  1880.     echo shar: \"'abc/tc/termcap'\" unpacked with wrong size!
  1881.   fi
  1882.   # end of 'abc/tc/termcap'
  1883. fi
  1884. echo shar: End of archive 6 \(of 25\).
  1885. cp /dev/null ark6isdone
  1886. MISSING=""
  1887. 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 24 25 ; do
  1888.     if test ! -f ark${I}isdone ; then
  1889.     MISSING="${MISSING} ${I}"
  1890.     fi
  1891. done
  1892. if test "${MISSING}" = "" ; then
  1893.     echo You have unpacked all 25 archives.
  1894.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1895. else
  1896.     echo You still must unpack the following archives:
  1897.     echo "        " ${MISSING}
  1898. fi
  1899. exit 0 # Just in case...
  1900.