1 /* built-in troff requests */
8 static int tr_nl
= 1; /* just read a newline */
9 static int tr_bm
= -1; /* blank line macro */
10 static int tr_sm
= -1; /* leading space macro */
11 char c_pc
[GNLEN
] = "%"; /* page number character */
12 int c_ec
= '\\'; /* escape character */
13 int c_cc
= '.'; /* control character */
14 int c_c2
= '\''; /* no-break control character */
16 /* skip everything until the end of line */
17 static void jmp_eol(void)
22 } while (c
>= 0 && c
!= '\n');
25 static void tr_vs(char **args
)
27 int vs
= args
[1] ? eval_re(args
[1], n_v
, 'p') : n_v0
;
32 static void tr_ls(char **args
)
34 int ls
= args
[1] ? eval_re(args
[1], n_L
, 0) : n_L0
;
39 static void tr_pl(char **args
)
41 int n
= eval_re(args
[1] ? args
[1] : "11i", n_p
, 'v');
45 static void tr_nr(char **args
)
51 num_set(id
, eval_re(args
[2], num_get(id
), 'u'));
53 num_setinc(id
, eval(args
[3], 'u'));
56 static void tr_rr(char **args
)
59 for (i
= 1; i
< NARGS
; i
++)
61 num_del(map(args
[i
]));
64 static void tr_af(char **args
)
67 num_setfmt(map(args
[1]), args
[2]);
70 static void tr_ds(char **args
)
72 str_set(map(args
[1]), args
[2] ? args
[2] : "");
75 static void tr_as(char **args
)
80 s1
= str_get(reg
) ? str_get(reg
) : "";
81 s2
= args
[2] ? args
[2] : "";
82 s
= xmalloc(strlen(s1
) + strlen(s2
) + 1);
89 static void tr_rm(char **args
)
92 for (i
= 1; i
< NARGS
; i
++)
97 static void tr_rn(char **args
)
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
;
111 /* read a string argument of a macro */
112 static char *read_string(void)
119 while ((c
= cp_next()) == ' ')
121 empty
= c
<= 0 || c
== '\n';
124 while (c
> 0 && c
!= '\n') {
136 return sbuf_out(&sbuf
);
139 /* read a space separated macro argument; if two, read at most two characters */
140 static char *read_name(int two
)
146 while (c
== ' ' || c
== '\t' || c
== c_ni
)
148 while (c
> 0 && c
!= ' ' && c
!= '\t' && c
!= '\n' && (!two
|| i
< 2)) {
157 return sbuf_out(&sbuf
);
160 static void macrobody(struct sbuf
*sbuf
, char *end
)
167 while ((c
= cp_next()) >= 0) {
172 if ((c
= cp_next()) != c_cc
) {
176 req
= read_name(n_cp
);
177 if (!strcmp(end
, req
)) {
183 sbuf_add(sbuf
, c_cc
);
184 sbuf_append(sbuf
, req
);
194 static void tr_de(char **args
)
202 if (args
[0][1] == 'a' && args
[0][2] == 'm' && str_get(id
))
203 sbuf_append(&sbuf
, str_get(id
));
204 macrobody(&sbuf
, args
[2] ? args
[2] : ".");
205 str_set(id
, sbuf_buf(&sbuf
));
207 if (!n_cp
&& args
[3]) /* parse the arguments as request argv[3] */
208 str_dset(id
, str_dget(map(args
[3])));
211 static void tr_ig(char **args
)
213 macrobody(NULL
, args
[1] ? args
[1] : ".");
216 /* read into sbuf until stop; if stop is NULL, stop at whitespace */
217 static int read_until(struct sbuf
*sbuf
, char *stop
,
218 int (*next
)(void), void (*back
)(int))
220 char cs
[GNLEN
], cs2
[GNLEN
];
222 while ((c
= next()) >= 0) {
228 if (!stop
&& (c
== ' ' || c
== '\t'))
230 charnext(cs
, next
, back
);
231 if (stop
&& !strcmp(stop
, cs
))
233 charnext_str(cs2
, cs
);
234 sbuf_append(sbuf
, cs2
);
239 /* evaluate .if strcmp (i.e. 'str'str') */
240 static int if_strcmp(int (*next
)(void), void (*back
)(int))
245 charnext(delim
, next
, back
);
248 read_until(&s1
, delim
, next
, back
);
249 read_until(&s2
, delim
, next
, back
);
251 ret
= !strcmp(sbuf_buf(&s1
), sbuf_buf(&s2
));
257 /* evaluate .if condition letters */
258 static int if_cond(int (*next
)(void), void (*back
)(int))
273 /* evaluate .if condition */
274 static int if_eval(int (*next
)(void), void (*back
)(int))
279 read_until(&sbuf
, NULL
, next
, back
);
280 ret
= eval(sbuf_buf(&sbuf
), '\0') > 0;
285 static int eval_if(int (*next
)(void), void (*back
)(int))
292 } while (c
== ' ' || c
== '\t');
298 if (strchr("oetn", c
)) {
299 ret
= if_cond(next
, back
);
300 } else if (c
== ' ') {
302 } else if (!isdigit(c
) && !strchr("-+*/%<=>&:.|()", c
)) {
303 ret
= if_strcmp(next
, back
);
305 ret
= if_eval(next
, back
);
310 static int ie_cond
[NIES
]; /* .ie condition stack */
313 static void tr_if(char **args
)
315 int c
= eval_if(cp_next
, cp_back
);
316 if (args
[0][1] == 'i' && args
[0][2] == 'e') /* .ie command */
318 ie_cond
[ie_depth
++] = c
;
322 static void tr_el(char **args
)
324 cp_blk(ie_depth
> 0 ? ie_cond
[--ie_depth
] : 1);
327 static void tr_na(char **args
)
332 static int adjmode(int c
, int def
)
350 static void tr_ad(char **args
)
356 if (isdigit((unsigned char) s
[0]))
359 n_j
= s
[0] == 'p' ? AD_P
| adjmode(s
[1], AD_B
) : adjmode(s
[0], n_j
);
362 static void tr_tm(char **args
)
364 fprintf(stderr
, "%s\n", args
[1] ? args
[1] : "");
367 static void tr_so(char **args
)
373 static void tr_nx(char **args
)
378 static void tr_shift(char **args
)
380 int n
= args
[1] ? atoi(args
[1]) : 1;
385 static void tr_ex(char **args
)
390 static void tr_sy(char **args
)
395 static void tr_lt(char **args
)
397 int lt
= args
[1] ? eval_re(args
[1], n_lt
, 'm') : n_t0
;
402 static void tr_pc(char **args
)
405 if (!s
|| charread(&s
, c_pc
) < 0)
409 static void tr_tl(char **args
)
414 } while (c
>= 0 && (c
== ' ' || c
== '\t'));
416 ren_tl(cp_next
, cp_back
);
419 } while (c
>= 0 && c
!= '\n');
422 static void tr_ec(char **args
)
424 c_ec
= args
[1] ? args
[1][0] : '\\';
427 static void tr_cc(char **args
)
429 c_cc
= args
[1] ? args
[1][0] : '.';
432 static void tr_c2(char **args
)
434 c_c2
= args
[1] ? args
[1][0] : '\'';
437 static void tr_eo(char **args
)
442 static void tr_hc(char **args
)
445 if (!s
|| charread(&s
, c_hc
) < 0)
449 /* sentence ending and their transparent characters */
450 static char eos_sent
[NCHARS
][GNLEN
] = { ".", "?", "!", };
451 static int eos_sentcnt
= 3;
452 static char eos_tran
[NCHARS
][GNLEN
] = { "'", "\"", ")", "]", "*", };
453 static int eos_trancnt
= 5;
455 static void tr_eos(char **args
)
461 while (s
&& charread(&s
, eos_sent
[eos_sentcnt
]) >= 0)
462 if (eos_sentcnt
< NCHARS
- 1)
467 while (s
&& charread(&s
, eos_tran
[eos_trancnt
]) >= 0)
468 if (eos_trancnt
< NCHARS
- 1)
473 int c_eossent(char *s
)
476 for (i
= 0; i
< eos_sentcnt
; i
++)
477 if (!strcmp(eos_sent
[i
], s
))
482 int c_eostran(char *s
)
485 for (i
= 0; i
< eos_trancnt
; i
++)
486 if (!strcmp(eos_tran
[i
], s
))
491 /* hyphenation dashes and hyphenation inhibiting character */
492 static char hy_dash
[NCHARS
][GNLEN
] = { "\\:", "-", "em", "en", "\\-", "--", "hy", };
493 static int hy_dashcnt
= 7;
494 static char hy_stop
[NCHARS
][GNLEN
] = { "\\%", };
495 static int hy_stopcnt
= 1;
497 static void tr_nh(char **args
)
502 static void tr_hy(char **args
)
504 n_hy
= args
[1] ? eval_re(args
[1], n_hy
, '\0') : 1;
507 static void tr_hlm(char **args
)
509 n_hlm
= args
[1] ? eval_re(args
[1], n_hlm
, '\0') : 0;
512 static void tr_hycost(char **args
)
514 n_hycost
= args
[1] ? eval_re(args
[1], n_hycost
, '\0') : 0;
515 n_hycost2
= args
[2] ? eval_re(args
[2], n_hycost2
, '\0') : 0;
516 n_hycost3
= args
[3] ? eval_re(args
[3], n_hycost3
, '\0') : 0;
519 static void tr_hydash(char **args
)
524 while (s
&& charread(&s
, hy_dash
[hy_dashcnt
]) >= 0)
525 if (hy_dashcnt
< NCHARS
- 1)
530 static void tr_hystop(char **args
)
535 while (s
&& charread(&s
, hy_stop
[hy_stopcnt
]) >= 0)
536 if (hy_stopcnt
< NCHARS
- 1)
541 int c_hydash(char *s
)
544 for (i
= 0; i
< hy_dashcnt
; i
++)
545 if (!strcmp(hy_dash
[i
], s
))
550 int c_hystop(char *s
)
553 for (i
= 0; i
< hy_stopcnt
; i
++)
554 if (!strcmp(hy_stop
[i
], s
))
559 int c_hymark(char *s
)
561 return !strcmp(c_bp
, s
) || !strcmp(c_hc
, s
);
564 static void tr_pmll(char **args
)
566 n_pmll
= args
[1] ? eval_re(args
[1], n_pmll
, '\0') : 0;
567 n_pmllcost
= args
[2] ? eval_re(args
[2], n_pmllcost
, '\0') : 100;
570 static void tr_lg(char **args
)
573 n_lg
= eval(args
[1], '\0');
576 static void tr_kn(char **args
)
579 n_kn
= eval(args
[1], '\0');
582 static void tr_cp(char **args
)
585 n_cp
= atoi(args
[1]);
588 static void tr_ss(char **args
)
591 n_ss
= eval_re(args
[1], n_ss
, 0);
592 n_sss
= args
[2] ? eval_re(args
[2], n_sss
, 0) : n_ss
;
596 static void tr_ssh(char **args
)
598 n_ssh
= args
[1] ? eval_re(args
[1], n_ssh
, 0) : 0;
601 static void tr_cs(char **args
)
603 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
605 font_setcs(fn
, args
[2] ? eval(args
[2], 0) : 0,
606 args
[3] ? eval(args
[3], 0) : 0);
609 static void tr_fzoom(char **args
)
611 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
613 font_setzoom(fn
, args
[2] ? eval(args
[2], 0) : 0);
616 static void tr_tkf(char **args
)
618 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
620 font_track(fn
, eval(args
[2], 0), eval(args
[3], 0),
621 eval(args
[4], 0), eval(args
[5], 0));
624 static void tr_ff(char **args
)
626 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
628 for (i
= 2; i
< NARGS
; i
++)
629 if (fn
&& args
[i
] && args
[i
][0] && args
[i
][1])
630 font_feat(fn
, args
[i
] + 1, args
[i
][0] == '+');
633 static void tr_ffsc(char **args
)
635 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
637 font_scrp(fn
, args
[2]);
639 font_lang(fn
, args
[3]);
642 static void tr_nm(char **args
)
649 n_ln
= eval_re(args
[1], n_ln
, 0);
651 if (args
[2] && isdigit((unsigned char) args
[2][0]))
652 n_nM
= MAX(1, eval(args
[2], 0));
653 if (args
[3] && isdigit((unsigned char) args
[3][0]))
654 n_nS
= MAX(0, eval(args
[3], 0));
655 if (args
[4] && isdigit((unsigned char) args
[4][0]))
656 n_nI
= MAX(0, eval(args
[4], 0));
659 static void tr_nn(char **args
)
661 n_nn
= args
[1] ? eval(args
[1], 0) : 1;
664 static void tr_bd(char **args
)
666 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
667 if (!args
[1] || !strcmp("S", args
[1]))
670 font_setbd(fn
, args
[2] ? eval(args
[2], 'u') : 0);
673 static void tr_it(char **args
)
677 n_itn
= eval(args
[1], 0);
683 static void tr_mc(char **args
)
686 if (s
&& charread(&s
, c_mc
) >= 0) {
688 n_mcn
= args
[2] ? eval(args
[2], 'm') : SC_EM
;
694 static void tr_tc(char **args
)
697 if (!s
|| charread(&s
, c_tc
) < 0)
701 static void tr_lc(char **args
)
704 if (!s
|| charread(&s
, c_lc
) < 0)
708 static void tr_lf(char **args
)
711 in_lf(args
[2], eval(args
[1], 0));
714 static void tr_chop(char **args
)
721 sbuf_append(&sbuf
, str_get(id
));
722 if (!sbuf_empty(&sbuf
)) {
723 sbuf_cut(&sbuf
, sbuf_len(&sbuf
) - 1);
724 str_set(id
, sbuf_buf(&sbuf
));
730 /* character translation (.tr) */
731 static struct dict
*cmap
; /* character mapping */
732 static char cmap_src
[NCMAPS
][GNLEN
]; /* source character */
733 static char cmap_dst
[NCMAPS
][GNLEN
]; /* character mapping */
734 static int cmap_n
; /* number of translated character */
736 void cmap_add(char *c1
, char *c2
)
738 int i
= dict_get(cmap
, c1
);
740 strcpy(cmap_dst
[i
], c2
);
741 } else if (cmap_n
< NCMAPS
) {
742 strcpy(cmap_src
[cmap_n
], c1
);
743 strcpy(cmap_dst
[cmap_n
], c2
);
744 dict_put(cmap
, cmap_src
[cmap_n
], cmap_n
);
749 char *cmap_map(char *c
)
751 int i
= dict_get(cmap
, c
);
752 return i
>= 0 ? cmap_dst
[i
] : c
;
755 static void tr_tr(char **args
)
758 char c1
[GNLEN
], c2
[GNLEN
];
759 while (s
&& charread(&s
, c1
) >= 0) {
760 if (charread(&s
, c2
) < 0)
766 /* character definition (.char) */
767 static char cdef_src
[NCDEFS
][GNLEN
]; /* source character */
768 static char *cdef_dst
[NCDEFS
]; /* character definition */
769 static int cdef_fn
[NCDEFS
]; /* owning font */
770 static int cdef_n
; /* number of defined characters */
771 static int cdef_expanding
; /* inside cdef_expand() call */
773 static int cdef_find(char *c
, int fn
)
776 for (i
= 0; i
< cdef_n
; i
++)
777 if ((!cdef_fn
[i
] || cdef_fn
[i
] == fn
) && !strcmp(cdef_src
[i
], c
))
782 /* return the definition of the given character */
783 char *cdef_map(char *c
, int fn
)
785 int i
= cdef_find(c
, fn
);
786 return !cdef_expanding
&& i
>= 0 ? cdef_dst
[i
] : NULL
;
789 int cdef_expand(struct wb
*wb
, char *s
, int fn
)
791 char *d
= cdef_map(s
, fn
);
800 static void cdef_remove(char *fn
, char *cs
)
804 int fp
= fn
? dev_pos(fn
) : -1;
805 if (!cs
|| charread(&cs
, c
) < 0)
807 for (i
= 0; i
< cdef_n
; i
++) {
808 if (!strcmp(cdef_src
[i
], c
)) {
809 if (!fn
|| (fp
> 0 && cdef_fn
[i
] == fp
)) {
812 cdef_src
[i
][0] = '\0';
818 static void cdef_add(char *fn
, char *cs
, char *def
)
822 if (!def
|| charread(&cs
, c
) < 0)
824 i
= cdef_find(c
, fn
? dev_pos(fn
) : -1);
826 for (i
= 0; i
< cdef_n
; i
++)
829 if (i
== cdef_n
&& cdef_n
< NCDEFS
)
832 if (i
>= 0 && i
< cdef_n
) {
833 snprintf(cdef_src
[i
], sizeof(cdef_src
[i
]), "%s", c
);
834 cdef_dst
[i
] = xmalloc(strlen(def
) + 1);
835 strcpy(cdef_dst
[i
], def
);
836 cdef_fn
[i
] = fn
? dev_pos(fn
) : 0;
840 static void tr_rchar(char **args
)
843 for (i
= 1; i
< NARGS
; i
++)
845 cdef_remove(NULL
, args
[i
]);
848 static void tr_char(char **args
)
851 cdef_add(NULL
, args
[1], args
[2]);
853 cdef_remove(NULL
, args
[1]);
856 static void tr_ochar(char **args
)
859 cdef_add(args
[1], args
[2], args
[3]);
861 cdef_remove(args
[1], args
[2]);
864 static void tr_fmap(char **args
)
866 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
868 font_map(fn
, args
[2], args
[3]);
871 static void tr_blm(char **args
)
873 tr_bm
= args
[1] ? map(args
[1]) : -1;
876 static void tr_lsm(char **args
)
878 tr_sm
= args
[1] ? map(args
[1]) : -1;
881 static void tr_co(char **args
)
885 if (src
&& dst
&& str_get(map(src
)))
886 str_set(map(dst
), str_get(map(src
)));
889 static void tr_coa(char **args
)
893 if (src
&& dst
&& str_get(map(src
))) {
896 if (str_get(map(dst
)))
897 sbuf_append(&sb
, str_get(map(dst
)));
898 sbuf_append(&sb
, str_get(map(src
)));
899 str_set(map(dst
), sbuf_buf(&sb
));
904 static void tr_coo(char **args
)
907 char *path
= args
[2];
909 if (!reg
|| !reg
[0] || !path
|| !path
[0])
911 if ((fp
= fopen(path
, "w"))) {
912 if (str_get(map(reg
)))
913 fputs(str_get(map(reg
)), fp
);
918 static void tr_coi(char **args
)
921 char *path
= args
[2];
924 if (!reg
|| !reg
[0] || !path
|| !path
[0])
926 if ((fp
= fopen(path
, "r"))) {
929 while (fgets(buf
, sizeof(buf
), fp
))
930 sbuf_append(&sb
, buf
);
931 str_set(map(reg
), sbuf_buf(&sb
));
937 static void tr_dv(char **args
)
943 /* read a single macro argument */
944 static int macroarg(struct sbuf
*sbuf
, int brk
, int (*next
)(void), void (*back
)(int))
951 if (c
== '\n' || c
== brk
)
953 if (c
< 0 || c
== '\n' || c
== brk
)
959 while (c
>= 0 && c
!= '\n' && (quoted
|| c
!= brk
)) {
960 if (!quoted
&& c
== ' ')
962 if (quoted
&& c
== '"') {
980 /* split the arguments in sbuf, after calling one of mkargs_*() */
981 static void chopargs(struct sbuf
*sbuf
, char **args
)
983 char *s
= sbuf_buf(sbuf
);
984 char *e
= s
+ sbuf_len(sbuf
);
986 while (n
< NARGS
&& s
&& s
< e
) {
988 if ((s
= memchr(s
, '\0', e
- s
)))
993 /* read macro arguments; free the returned pointer when done */
994 char *tr_args(char **args
, int brk
, int (*next
)(void), void (*back
)(int))
998 while (!macroarg(&sbuf
, brk
, next
, back
))
1000 chopargs(&sbuf
, args
);
1001 return sbuf_out(&sbuf
);
1004 /* read regular macro arguments */
1005 static void mkargs_macro(struct sbuf
*sbuf
)
1008 while (!macroarg(sbuf
, -1, cp_next
, cp_back
))
1014 /* read request arguments; trims tabs too */
1015 static void mkargs_req(struct sbuf
*sbuf
)
1022 while (c
== ' ' || c
== '\t')
1024 while (c
>= 0 && c
!= '\n' && c
!= ' ' && c
!= '\t') {
1036 if (c
< 0 || c
== '\n')
1042 /* read arguments for .ds and .char */
1043 static void mkargs_ds(struct sbuf
*sbuf
)
1045 char *s
= read_name(n_cp
);
1046 sbuf_append(sbuf
, s
);
1051 sbuf_append(sbuf
, s
);
1058 /* read arguments for .ochar */
1059 static void mkargs_ochar(struct sbuf
*sbuf
)
1061 char *s
= read_name(0);
1062 sbuf_append(sbuf
, s
);
1068 /* read arguments for .nr */
1069 static void mkargs_reg1(struct sbuf
*sbuf
)
1071 char *s
= read_name(n_cp
);
1072 sbuf_append(sbuf
, s
);
1078 /* do not read any arguments; for .if, .ie and .el */
1079 static void mkargs_null(struct sbuf
*sbuf
)
1083 /* read the whole line for .tm */
1084 static void mkargs_eol(struct sbuf
*sbuf
)
1091 while (c
>= 0 && c
!= '\n') {
1101 void (*f
)(char **args
);
1102 void (*args
)(struct sbuf
*sbuf
);
1104 {TR_DIVBEG
, tr_divbeg
},
1105 {TR_DIVEND
, tr_divend
},
1106 {TR_DIVVS
, tr_divvs
},
1107 {TR_POPREN
, tr_popren
},
1110 {"ab", tr_ab
, mkargs_eol
},
1113 {"am", tr_de
, mkargs_reg1
},
1114 {"as", tr_as
, mkargs_ds
},
1123 {"char", tr_char
, mkargs_ds
},
1124 {"chop", tr_chop
, mkargs_reg1
},
1128 {"co<", tr_coi
, mkargs_ds
},
1129 {"co>", tr_coo
, mkargs_ds
},
1133 {"de", tr_de
, mkargs_reg1
},
1135 {"ds", tr_ds
, mkargs_ds
},
1137 {"dv", tr_dv
, mkargs_eol
},
1139 {"el", tr_el
, mkargs_null
},
1152 {"fspecial", tr_fspecial
},
1154 {"fzoom", tr_fzoom
},
1156 {"hcode", tr_hcode
},
1161 {"hycost", tr_hycost
},
1162 {"hydash", tr_hydash
},
1163 {"hystop", tr_hystop
},
1165 {"ie", tr_if
, mkargs_null
},
1166 {"if", tr_if
, mkargs_null
},
1187 {"nr", tr_nr
, mkargs_reg1
},
1190 {"ochar", tr_ochar
, mkargs_ochar
},
1198 {"rchar", tr_rchar
},
1204 {"shift", tr_shift
},
1210 {"sy", tr_sy
, mkargs_eol
},
1216 {"tl", tr_tl
, mkargs_null
},
1217 {"tm", tr_tm
, mkargs_eol
},
1218 {"tr", tr_tr
, mkargs_eol
},
1223 static char *dotted(char *name
, int dot
)
1225 char *out
= xmalloc(strlen(name
) + 2);
1227 strcpy(out
+ 1, name
);
1231 /* execute a built-in request */
1232 void tr_req(int reg
, char **args
)
1234 struct cmd
*req
= str_dget(reg
);
1239 /* interpolate a macro for tr_nextreq() */
1240 static void tr_nextreq_exec(char *mac
, char *arg0
, int readargs
)
1242 char *args
[NARGS
+ 3] = {arg0
};
1243 struct cmd
*req
= str_dget(map(mac
));
1244 char *str
= str_get(map(mac
));
1248 if (req
&& req
->args
)
1250 if (req
&& !req
->args
)
1253 mkargs_macro(&sbuf
);
1254 chopargs(&sbuf
, args
+ 1);
1263 /* read the next troff request; return zero if a request was executed. */
1264 int tr_nextreq(void)
1272 /* transparent line indicator */
1276 char *args
[NARGS
+ 3] = {"\\!"};
1282 chopargs(&sbuf
, args
+ 1);
1283 tr_transparent(args
);
1289 /* not a request, a blank line, or a line with leading spaces */
1290 if (c
< 0 || (c
!= c_cc
&& c
!= c_c2
&&
1291 (c
!= '\n' || tr_bm
< 0) &&
1292 (c
!= ' ' || tr_sm
< 0))) {
1297 if (c
== '\n') { /* blank line macro */
1298 mac
= malloc(strlen(map_name(tr_bm
)) + 1);
1299 strcpy(mac
, map_name(tr_bm
));
1300 arg0
= dotted(mac
, '.');
1301 tr_nextreq_exec(mac
, arg0
, 0);
1302 } else if (c
== ' ') { /* leading space macro */
1304 mac
= malloc(strlen(map_name(tr_sm
)) + 1);
1305 strcpy(mac
, map_name(tr_sm
));
1306 for (i
= 0; c
== ' '; i
++)
1310 arg0
= dotted(mac
, '.');
1311 tr_nextreq_exec(mac
, arg0
, 0);
1313 mac
= read_name(n_cp
);
1314 arg0
= dotted(mac
, c
);
1315 tr_nextreq_exec(mac
, arg0
, 1);
1325 while (!tr_nextreq())
1328 tr_nl
= c
== '\n' || c
< 0;
1335 for (i
= 0; i
< LEN(cmds
); i
++)
1336 str_dset(map(cmds
[i
].id
), &cmds
[i
]);
1337 cmap
= dict_make(-1, 0, 2);
1343 for (i
= 0; i
< cdef_n
; i
++)