dev: allow mounting fonts after S position
[neatroff.git] / tr.c
blob34ac1d8c5fad644500d404c33e3be1d2049664c7
1 /* built-in troff requests */
2 #include <ctype.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include "roff.h"
8 static int tr_nl = 1; /* just read a newline */
9 static int c_pc = '%'; /* page number character */
10 int c_ec = '\\';
11 int c_cc = '.';
12 int c_c2 = '\'';
14 /* skip everything until the end of line */
15 static void jmp_eol(void)
17 int c;
18 do {
19 c = cp_next();
20 } while (c >= 0 && c != '\n');
23 static void tr_vs(char **args)
25 int vs = args[1] ? eval_re(args[1], n_v, 'p') : n_v0;
26 n_v0 = n_v;
27 n_v = MAX(0, vs);
30 static void tr_ls(char **args)
32 int ls = args[1] ? eval_re(args[1], n_L, 0) : n_L0;
33 n_L0 = n_L;
34 n_L = MAX(1, ls);
37 static void tr_pl(char **args)
39 int n = eval_re(args[1] ? args[1] : "11i", n_p, 'v');
40 n_p = MAX(0, n);
43 static void tr_nr(char **args)
45 int id;
46 if (!args[2])
47 return;
48 id = map(args[1]);
49 num_set(id, eval_re(args[2], num_get(id, 0), 'u'));
50 num_inc(id, args[3] ? eval(args[3], 'u') : 0);
53 static void tr_rr(char **args)
55 int i;
56 for (i = 1; i <= NARGS; i++)
57 if (args[i])
58 num_del(map(args[i]));
61 static void tr_af(char **args)
63 if (args[2])
64 num_setfmt(map(args[1]), args[2]);
67 static void tr_ds(char **args)
69 if (args[2])
70 str_set(map(args[1]), args[2]);
73 static void tr_as(char **args)
75 int reg;
76 char *s1, *s2, *s;
77 if (!args[2])
78 return;
79 reg = map(args[1]);
80 s1 = str_get(reg) ? str_get(reg) : "";
81 s2 = args[2];
82 s = malloc(strlen(s1) + strlen(s2) + 1);
83 strcpy(s, s1);
84 strcat(s, s2);
85 str_set(reg, s);
86 free(s);
89 static void tr_rm(char **args)
91 int i;
92 for (i = 1; i <= NARGS; i++)
93 if (args[i])
94 str_rm(map(args[i]));
97 static void tr_rn(char **args)
99 if (!args[2])
100 return;
101 str_rn(map(args[1]), map(args[2]));
104 static void tr_po(char **args)
106 int po = args[1] ? eval_re(args[1], n_o, 'm') : n_o0;
107 n_o0 = n_o;
108 n_o = MAX(0, po);
111 static char *arg_regname(char *s, int len);
113 static void macrobody(struct sbuf *sbuf, char *end)
115 char buf[NMLEN];
116 int i, c;
117 int first = 1;
118 cp_back('\n');
119 cp_wid(0); /* copy-mode; disable \w handling */
120 while ((c = cp_next()) >= 0) {
121 if (sbuf && !first)
122 sbuf_add(sbuf, c);
123 first = 0;
124 if (c == '\n') {
125 c = cp_next();
126 if (c == '.') {
127 arg_regname(buf, sizeof(buf));
128 if ((n_cp && end[0] == buf[0] && end[1] == buf[1]) ||
129 !strcmp(end, buf)) {
130 jmp_eol();
131 break;
133 if (!sbuf)
134 continue;
135 sbuf_add(sbuf, '.');
136 for (i = 0; buf[i]; i++)
137 sbuf_add(sbuf, (unsigned char) buf[i]);
138 continue;
140 if (sbuf && c >= 0)
141 sbuf_add(sbuf, c);
144 cp_wid(1);
147 static void tr_de(char **args)
149 struct sbuf sbuf;
150 int id;
151 if (!args[1])
152 return;
153 id = map(args[1]);
154 sbuf_init(&sbuf);
155 if (args[0][1] == 'a' && args[0][2] == 'm' && str_get(id))
156 sbuf_append(&sbuf, str_get(id));
157 macrobody(&sbuf, args[2] ? args[2] : ".");
158 str_set(id, sbuf_buf(&sbuf));
159 sbuf_done(&sbuf);
162 static void tr_ig(char **args)
164 macrobody(NULL, args[1] ? args[1] : ".");
167 /* read into sbuf until stop; if stop is NULL, stop at whitespace */
168 static int read_until(struct sbuf *sbuf, char *stop)
170 char cs[GNLEN], cs2[GNLEN];
171 int c;
172 while ((c = cp_next()) >= 0) {
173 cp_back(c);
174 if (c == '\n')
175 return 1;
176 if (!stop && (c == ' ' || c == '\t'))
177 return 0;
178 charnext(cs, cp_next, cp_back);
179 if (stop && !strcmp(stop, cs))
180 return 0;
181 charnext_str(cs2, cs);
182 sbuf_append(sbuf, cs2);
184 return 1;
187 /* evaluate .if strcmp (i.e. 'str'str') */
188 static int if_strcmp(void)
190 char delim[GNLEN];
191 struct sbuf s1, s2;
192 int ret;
193 charnext(delim, cp_next, cp_back);
194 sbuf_init(&s1);
195 sbuf_init(&s2);
196 read_until(&s1, delim);
197 read_until(&s2, delim);
198 ret = !strcmp(sbuf_buf(&s1), sbuf_buf(&s2));
199 sbuf_done(&s1);
200 sbuf_done(&s2);
201 return ret;
204 /* evaluate .if condition letters */
205 static int if_cond(void)
207 switch (cp_next()) {
208 case 'o':
209 return n_pg % 2;
210 case 'e':
211 return !(n_pg % 2);
212 case 't':
213 return 1;
214 case 'n':
215 return 0;
217 return 0;
220 /* evaluate .if condition */
221 static int if_eval(void)
223 struct sbuf sbuf;
224 int ret;
225 sbuf_init(&sbuf);
226 if (!read_until(&sbuf, NULL))
227 cp_back(' ');
228 ret = eval(sbuf_buf(&sbuf), '\0') > 0;
229 sbuf_done(&sbuf);
230 return ret;
233 static int ie_cond[NIES]; /* .ie condition stack */
234 static int ie_depth;
236 static void tr_if(char **args)
238 int neg = 0;
239 int ret;
240 int c;
241 do {
242 c = cp_next();
243 } while (c == ' ' || c == '\t');
244 if (c == '!') {
245 neg = 1;
246 c = cp_next();
248 cp_back(c);
249 if (strchr("oetn", c)) {
250 ret = if_cond();
251 } else if (!isdigit(c) && !strchr("-+*/%<=>&:.|()", c)) {
252 ret = if_strcmp();
253 } else {
254 ret = if_eval();
256 if (args[0][1] == 'i' && args[0][2] == 'e') /* .ie command */
257 if (ie_depth < NIES)
258 ie_cond[ie_depth++] = ret != neg;
259 cp_blk(ret == neg);
262 static void tr_el(char **args)
264 cp_blk(ie_depth > 0 ? ie_cond[--ie_depth] : 1);
267 static void tr_na(char **args)
269 n_na = 1;
272 static void tr_ad(char **args)
274 n_na = 0;
275 if (!args[1])
276 return;
277 switch (args[1][0]) {
278 case '0' + AD_L:
279 case 'l':
280 n_j = AD_L;
281 break;
282 case '0' + AD_R:
283 case 'r':
284 n_j = AD_R;
285 break;
286 case '0' + AD_C:
287 case 'c':
288 n_j = AD_C;
289 break;
290 case '0' + AD_B:
291 case 'b':
292 case 'n':
293 n_j = AD_B;
294 break;
298 static void tr_tm(char **args)
300 fprintf(stderr, "%s\n", args[1]);
303 static void tr_so(char **args)
305 if (args[1])
306 in_so(args[1]);
309 static void tr_nx(char **args)
311 in_nx(args[1]);
314 static void tr_ex(char **args)
316 in_ex();
319 static void tr_sy(char **args)
321 system(args[1]);
324 static void tr_lt(char **args)
326 int lt = args[1] ? eval_re(args[1], n_lt, 'm') : n_t0;
327 n_t0 = n_t0;
328 n_lt = MAX(0, lt);
331 static void tr_pc(char **args)
333 c_pc = args[1] ? args[1][0] : -1;
336 static int tl_next(void)
338 int c = cp_next();
339 if (c >= 0 && c == c_pc) {
340 in_push(num_str(map("%")), NULL);
341 c = cp_next();
343 return c;
346 static void tr_tl(char **args)
348 int c;
349 do {
350 c = cp_next();
351 } while (c >= 0 && (c == ' ' || c == '\t'));
352 cp_back(c);
353 ren_tl(tl_next, cp_back);
354 do {
355 c = cp_next();
356 } while (c >= 0 && c != '\n');
359 static void tr_ec(char **args)
361 c_ec = args[1] ? args[1][0] : '\\';
364 static void tr_cc(char **args)
366 c_ec = args[1] ? args[1][0] : '.';
369 static void tr_c2(char **args)
371 c_ec = args[1] ? args[1][0] : '\'';
374 static void tr_eo(char **args)
376 c_ec = -1;
379 static void tr_hc(char **args)
381 char *s = args[1];
382 if (!s || charread(&s, c_hc) < 0)
383 strcpy(c_hc, "\\%");
386 static void tr_nh(char **args)
388 n_hy = 0;
391 static void tr_hy(char **args)
393 n_hy = args[1] ? atoi(args[1]) : 1;
396 static void tr_lg(char **args)
398 if (args[1])
399 n_lg = atoi(args[1]);
402 static void tr_kn(char **args)
404 if (args[1])
405 n_kn = atoi(args[1]);
408 static void tr_cp(char **args)
410 if (args[1])
411 n_cp = atoi(args[1]);
414 static void tr_ss(char **args)
416 if (args[1])
417 n_ss = eval_re(args[1], n_ss, 0);
420 static void tr_cs(char **args)
422 if (!args[1])
423 return;
424 dev_setcs(dev_pos(args[1]), args[2] ? eval(args[2], 0) : 0);
427 static void tr_nm(char **args)
429 if (!args[1]) {
430 n_nm = 0;
431 return;
433 n_nm = 1;
434 n_ln = eval_re(args[1], n_ln, 0);
435 n_ln = MAX(0, n_ln);
436 if (args[2] && isdigit(args[2][0]))
437 n_nM = MAX(1, eval(args[2], 0));
438 if (args[3] && isdigit(args[3][0]))
439 n_nS = MAX(0, eval(args[3], 0));
440 if (args[4] && isdigit(args[4][0]))
441 n_nI = MAX(0, eval(args[4], 0));
444 static void tr_nn(char **args)
446 n_nn = args[1] ? eval(args[1], 0) : 1;
449 static void tr_bd(char **args)
451 if (!args[1] || !strcmp("S", args[1]))
452 return;
453 dev_setbd(dev_pos(args[1]), args[2] ? eval(args[2], 'u') : 0);
456 static void tr_it(char **args)
458 if (args[2]) {
459 n_it = map(args[2]);
460 n_itn = eval(args[1], 0);
461 } else {
462 n_it = 0;
466 static void tr_mc(char **args)
468 char *s = args[1];
469 if (s && charread(&s, c_mc) >= 0) {
470 n_mc = 1;
471 n_mcn = args[2] ? eval(args[2], 'm') : SC_EM;
472 } else {
473 n_mc = 0;
477 static void tr_tc(char **args)
479 char *s = args[1];
480 if (!s || charread(&s, c_tc) < 0)
481 strcpy(c_tc, "");
484 static void tr_lc(char **args)
486 char *s = args[1];
487 if (!s || charread(&s, c_lc) < 0)
488 strcpy(c_lc, "");
491 static void tr_lf(char **args)
493 if (args[1])
494 in_lf(args[2], eval(args[1], 0));
497 static void tr_chop(char **args)
499 struct sbuf sbuf;
500 int id;
501 if (args[1])
502 in_lf(args[2], eval(args[1], 0));
503 id = map(args[1]);
504 if (str_get(id)) {
505 sbuf_init(&sbuf);
506 sbuf_append(&sbuf, str_get(id));
507 if (!sbuf_empty(&sbuf)) {
508 sbuf_cut(&sbuf, sbuf_len(&sbuf) - 1);
509 str_set(id, sbuf_buf(&sbuf));
511 sbuf_done(&sbuf);
515 /* character translation (.tr) */
516 static char cmap_src[NCMAPS][GNLEN]; /* source character */
517 static char cmap_dst[NCMAPS][GNLEN]; /* character mapping */
518 static int cmap_n; /* number of translated character */
520 static int tr_find(char *c)
522 int i;
523 for (i = 0; i < cmap_n; i++)
524 if (!strcmp(c, cmap_src[i]))
525 return i;
526 return -1;
529 void cmap_add(char *c1, char *c2)
531 int i = tr_find(c1);
532 if (i < 0 && cmap_n < NCMAPS)
533 i = cmap_n++;
534 if (i >= 0) {
535 strcpy(cmap_src[i], c1);
536 strcpy(cmap_dst[i], c2);
540 char *cmap_map(char *c)
542 int i = tr_find(c);
543 return i >= 0 ? cmap_dst[i] : c;
546 static void tr_tr(char **args)
548 char *s = args[1];
549 char c1[GNLEN], c2[GNLEN];
550 while (s && charread(&s, c1) >= 0) {
551 if (charread(&s, c2) < 0)
552 strcpy(c2, " ");
553 cmap_add(c1, c2);
557 /* character definition (.char) */
558 static char cdef_src[NCDEFS][GNLEN]; /* source character */
559 static char *cdef_dst[NCDEFS]; /* character definition */
560 static int cdef_fn[NCDEFS]; /* owning font */
561 static int cdef_n; /* number of defined characters */
562 static int cdef_expanding; /* inside cdef_expand() call */
564 static int cdef_find(char *c, int fn)
566 int i;
567 for (i = 0; i < cdef_n; i++)
568 if (!strcmp(cdef_src[i], c) && (!cdef_fn[i] || cdef_fn[i] == fn))
569 return i;
570 return -1;
573 /* return the definition of the given character */
574 char *cdef_map(char *c, int fn)
576 int i = cdef_find(c, fn);
577 return !cdef_expanding && i >= 0 ? cdef_dst[i] : NULL;
580 int cdef_expand(struct wb *wb, char *s, int fn)
582 char *d = cdef_map(s, fn);
583 if (!d)
584 return 1;
585 cdef_expanding = 1;
586 ren_parse(wb, d);
587 cdef_expanding = 0;
588 return 0;
591 static void cdef_add(char *fn, char *cs, char *def)
593 char c[GNLEN];
594 int i;
595 if (!def || charread(&cs, c) < 0)
596 return;
597 i = cdef_find(c, -1);
598 if (i < 0 && cdef_n < NCDEFS)
599 i = cdef_n++;
600 if (i >= 0) {
601 strncpy(cdef_src[i], c, sizeof(cdef_src[i]) - 1);
602 cdef_dst[i] = malloc(strlen(def) + 1);
603 strcpy(cdef_dst[i], def);
604 cdef_fn[i] = fn ? dev_pos(fn) : 0;
608 static void cdef_remove(char *cs)
610 char c[GNLEN];
611 int i;
612 if (!cs || charread(&cs, c) < 0)
613 return;
614 for (i = 0; i < cdef_n; i++) {
615 if (!strcmp(cdef_src[i], c)) {
616 free(cdef_dst[i]);
617 cdef_dst[i] = NULL;
618 cdef_src[i][0] = '\0';
623 static void tr_char(char **args)
625 cdef_add(NULL, args[1], args[2]);
628 static void tr_rchar(char **args)
630 int i;
631 for (i = 1; i <= NARGS; i++)
632 if (args[i])
633 cdef_remove(args[i]);
636 static void tr_ochar(char **args)
638 cdef_add(args[1], args[2], args[3]);
641 static void tr_fmap(char **args)
643 struct font *fn;
644 if (!args[2])
645 return;
646 fn = dev_font(dev_pos(args[1]));
647 if (fn)
648 font_map(fn, args[2], args[3] ? font_glyph(fn, args[3]) : NULL);
651 static char *arg_regname(char *s, int len)
653 char *e = n_cp ? s + 2 : s + len;
654 int c = cp_next();
655 while (c == ' ' || c == '\t')
656 c = cp_next();
657 while (s < e && c >= 0 && c != ' ' && c != '\t' && c != '\n') {
658 *s++ = c;
659 c = cp_next();
661 if (c >= 0)
662 cp_back(c);
663 *s++ = '\0';
664 return s;
667 static char *arg_normal(char *s, int len)
669 char *e = s + len - 1;
670 int quoted = 0;
671 int c;
672 c = cp_next();
673 while (c == ' ')
674 c = cp_next();
675 if (c == '"') {
676 quoted = 1;
677 c = cp_next();
679 while (s < e && c > 0 && c != '\n') {
680 if (!quoted && c == ' ')
681 break;
682 if (quoted && c == '"') {
683 c = cp_next();
684 if (c != '"')
685 break;
687 *s++ = c;
688 c = cp_next();
690 if (c >= 0)
691 cp_back(c);
692 *s++ = '\0';
693 return s;
696 static char *arg_string(char *s, int len)
698 char *e = s + len - 1;
699 int c;
700 while ((c = cp_next()) == ' ')
702 if (c == '"')
703 c = cp_next();
704 while (s < e && c > 0 && c != '\n') {
705 *s++ = c;
706 c = cp_next();
708 *s++ = '\0';
709 if (c >= 0)
710 cp_back(c);
711 return s;
714 /* read macro arguments; trims tabs if rmtabs is nonzero */
715 static int mkargs(char **args, char *buf, int len)
717 char *s = buf;
718 char *e = buf + len - 1;
719 int c;
720 int n = 0;
721 while (n < NARGS) {
722 char *r = s;
723 c = cp_next();
724 if (c < 0 || c == '\n')
725 return n;
726 cp_back(c);
727 s = arg_normal(s, e - s);
728 if (*r != '\0')
729 args[n++] = r;
731 jmp_eol();
732 return n;
735 /* read request arguments; trims tabs too */
736 static int mkargs_req(char **args, char *buf, int len)
738 char *r, *s = buf;
739 char *e = buf + len - 1;
740 int c;
741 int n = 0;
742 c = cp_next();
743 while (n < NARGS && s < e) {
744 r = s;
745 while (c == ' ' || c == '\t')
746 c = cp_next();
747 while (c >= 0 && c != '\n' && c != ' ' && c != '\t' && s < e) {
748 *s++ = c;
749 c = cp_next();
751 *s++ = '\0';
752 if (*r != '\0')
753 args[n++] = r;
754 if (c < 0 || c == '\n')
755 return n;
757 jmp_eol();
758 return n;
761 /* read arguments for .ds */
762 static int mkargs_ds(char **args, char *buf, int len)
764 char *s = buf;
765 char *e = buf + len - 1;
766 int c;
767 args[0] = s;
768 s = arg_regname(s, e - s);
769 args[1] = s;
770 cp_wid(0);
771 s = arg_string(s, e - s);
772 cp_wid(1);
773 c = cp_next();
774 if (c >= 0 && c != '\n')
775 jmp_eol();
776 return 2;
779 /* read arguments for commands .nr that expect a register name */
780 static int mkargs_reg1(char **args, char *buf, int len)
782 char *s = buf;
783 char *e = buf + len - 1;
784 args[0] = s;
785 s = arg_regname(s, e - s);
786 return mkargs_req(args + 1, s, e - s) + 1;
789 /* do not read arguments; for .if, .ie and .el */
790 static int mkargs_null(char **args, char *buf, int len)
792 return 0;
795 /* read the whole line for .tm */
796 static int mkargs_eol(char **args, char *buf, int len)
798 char *s = buf;
799 char *e = buf + len - 1;
800 int c;
801 args[0] = s;
802 c = cp_next();
803 while (c == ' ')
804 c = cp_next();
805 while (s < e && c >= 0 && c != '\n') {
806 *s++ = c;
807 c = cp_next();
809 *s = '\0';
810 return 1;
813 static struct cmd {
814 char *id;
815 void (*f)(char **args);
816 int (*args)(char **args, char *buf, int len);
817 } cmds[] = {
818 {TR_DIVBEG, tr_divbeg},
819 {TR_DIVEND, tr_divend},
820 {TR_EJECT, tr_eject},
821 {"ab", tr_ab, mkargs_eol},
822 {"ad", tr_ad},
823 {"af", tr_af},
824 {"am", tr_de, mkargs_reg1},
825 {"as", tr_as, mkargs_ds},
826 {"bd", tr_bd},
827 {"bp", tr_bp},
828 {"br", tr_br},
829 {"c2", tr_c2},
830 {"cc", tr_cc},
831 {"ochar", tr_ochar},
832 {"ce", tr_ce},
833 {"ch", tr_ch},
834 {"char", tr_char, mkargs_ds},
835 {"chop", tr_chop, mkargs_reg1},
836 {"cl", tr_cl},
837 {"cp", tr_cp},
838 {"cs", tr_cs},
839 {"da", tr_di},
840 {"de", tr_de, mkargs_reg1},
841 {"di", tr_di},
842 {"ds", tr_ds, mkargs_ds},
843 {"dt", tr_dt},
844 {"ec", tr_ec},
845 {"el", tr_el, mkargs_null},
846 {"em", tr_em},
847 {"eo", tr_eo},
848 {"ev", tr_ev},
849 {"ex", tr_ex},
850 {"fc", tr_fc},
851 {"fi", tr_fi},
852 {"fmap", tr_fmap},
853 {"fp", tr_fp},
854 {"fspecial", tr_fspecial},
855 {"ft", tr_ft},
856 {"hc", tr_hc},
857 {"hy", tr_hy},
858 {"hw", tr_hw},
859 {"ie", tr_if, mkargs_null},
860 {"if", tr_if, mkargs_null},
861 {"ig", tr_ig},
862 {"in", tr_in},
863 {"it", tr_it},
864 {"kn", tr_kn},
865 {"lc", tr_lc},
866 {"lf", tr_lf},
867 {"lg", tr_lg},
868 {"ll", tr_ll},
869 {"ls", tr_ls},
870 {"lt", tr_lt},
871 {"mc", tr_mc},
872 {"mk", tr_mk},
873 {"na", tr_na},
874 {"ne", tr_ne},
875 {"nf", tr_nf},
876 {"nh", tr_nh},
877 {"nm", tr_nm},
878 {"nn", tr_nn},
879 {"nr", tr_nr, mkargs_reg1},
880 {"ns", tr_ns},
881 {"nx", tr_nx},
882 {"os", tr_os},
883 {"pc", tr_pc},
884 {"pl", tr_pl},
885 {"pn", tr_pn},
886 {"po", tr_po},
887 {"ps", tr_ps},
888 {"rchar", tr_rchar, mkargs_ds},
889 {"rm", tr_rm},
890 {"rn", tr_rn},
891 {"rr", tr_rr},
892 {"rs", tr_rs},
893 {"rt", tr_rt},
894 {"so", tr_so},
895 {"sp", tr_sp},
896 {"ss", tr_ss},
897 {"sv", tr_sv},
898 {"sy", tr_sy, mkargs_eol},
899 {"ta", tr_ta},
900 {"tc", tr_tc},
901 {"ti", tr_ti},
902 {"tl", tr_tl, mkargs_null},
903 {"tm", tr_tm, mkargs_eol},
904 {"tr", tr_tr, mkargs_eol},
905 {"vs", tr_vs},
906 {"wh", tr_wh},
909 int tr_next(void)
911 int c = cp_next();
912 int nl = c == '\n';
913 char *args[NARGS + 3] = {NULL};
914 char cmd[RNLEN];
915 char buf[LNLEN];
916 struct cmd *req;
917 while (tr_nl && c >= 0 && (c == c_cc || c == c_c2)) {
918 nl = 1;
919 memset(args, 0, sizeof(args));
920 args[0] = cmd;
921 cmd[0] = c;
922 req = NULL;
923 arg_regname(cmd + 1, sizeof(cmd) - 1);
924 req = str_dget(map(cmd + 1));
925 if (req) {
926 if (req->args)
927 req->args(args + 1, buf, sizeof(buf));
928 else
929 mkargs_req(args + 1, buf, sizeof(buf));
930 req->f(args);
931 } else {
932 cp_wid(0);
933 mkargs(args + 1, buf, sizeof(buf));
934 cp_wid(1);
935 if (str_get(map(cmd + 1)))
936 in_push(str_get(map(cmd + 1)), args + 1);
938 c = cp_next();
939 nl = c == '\n';
941 tr_nl = c < 0 || nl;
942 return c;
945 void tr_init(void)
947 int i;
948 for (i = 0; i < LEN(cmds); i++)
949 str_dset(map(cmds[i].id), &cmds[i]);
952 void tr_first(void)
954 cp_back(tr_next());
955 tr_nl = 1;