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'));
52 num_setinc(id
, args
[3] ? eval(args
[3], 'u') : 0);
55 static void tr_rr(char **args
)
58 for (i
= 1; i
< NARGS
; i
++)
60 num_del(map(args
[i
]));
63 static void tr_af(char **args
)
66 num_setfmt(map(args
[1]), args
[2]);
69 static void tr_ds(char **args
)
71 str_set(map(args
[1]), args
[2] ? args
[2] : "");
74 static void tr_as(char **args
)
79 s1
= str_get(reg
) ? str_get(reg
) : "";
80 s2
= args
[2] ? args
[2] : "";
81 s
= xmalloc(strlen(s1
) + strlen(s2
) + 1);
88 static void tr_rm(char **args
)
91 for (i
= 1; i
< NARGS
; i
++)
96 static void tr_rn(char **args
)
100 str_rn(map(args
[1]), map(args
[2]));
103 static void tr_po(char **args
)
105 int po
= args
[1] ? eval_re(args
[1], n_o
, 'm') : n_o0
;
110 /* read a string argument of a macro */
111 static char *read_string(void)
118 while ((c
= cp_next()) == ' ')
120 empty
= c
<= 0 || c
== '\n';
123 while (c
> 0 && c
!= '\n') {
135 return sbuf_out(&sbuf
);
138 /* read a space separated macro argument; if two, read at most two characters */
139 static char *read_name(int two
)
145 while (c
== ' ' || c
== '\t' || c
== c_ni
)
147 while (c
> 0 && c
!= ' ' && c
!= '\t' && c
!= '\n' && (!two
|| i
< 2)) {
156 return sbuf_out(&sbuf
);
159 static void macrobody(struct sbuf
*sbuf
, char *end
)
166 while ((c
= cp_next()) >= 0) {
171 if ((c
= cp_next()) != c_cc
) {
175 req
= read_name(n_cp
);
176 if (!strcmp(end
, req
)) {
182 sbuf_add(sbuf
, c_cc
);
183 sbuf_append(sbuf
, req
);
193 static void tr_de(char **args
)
201 if (args
[0][1] == 'a' && args
[0][2] == 'm' && str_get(id
))
202 sbuf_append(&sbuf
, str_get(id
));
203 macrobody(&sbuf
, args
[2] ? args
[2] : ".");
204 str_set(id
, sbuf_buf(&sbuf
));
206 if (!n_cp
&& args
[3]) /* parse the arguments as request argv[3] */
207 str_dset(id
, str_dget(map(args
[3])));
210 static void tr_ig(char **args
)
212 macrobody(NULL
, args
[1] ? args
[1] : ".");
215 /* read into sbuf until stop; if stop is NULL, stop at whitespace */
216 static int read_until(struct sbuf
*sbuf
, char *stop
,
217 int (*next
)(void), void (*back
)(int))
219 char cs
[GNLEN
], cs2
[GNLEN
];
221 while ((c
= next()) >= 0) {
227 if (!stop
&& (c
== ' ' || c
== '\t'))
229 charnext(cs
, next
, back
);
230 if (stop
&& !strcmp(stop
, cs
))
232 charnext_str(cs2
, cs
);
233 sbuf_append(sbuf
, cs2
);
238 /* evaluate .if strcmp (i.e. 'str'str') */
239 static int if_strcmp(int (*next
)(void), void (*back
)(int))
244 charnext(delim
, next
, back
);
247 read_until(&s1
, delim
, next
, back
);
248 read_until(&s2
, delim
, next
, back
);
250 ret
= !strcmp(sbuf_buf(&s1
), sbuf_buf(&s2
));
256 /* evaluate .if condition letters */
257 static int if_cond(int (*next
)(void), void (*back
)(int))
272 /* evaluate .if condition */
273 static int if_eval(int (*next
)(void), void (*back
)(int))
278 read_until(&sbuf
, NULL
, next
, back
);
279 ret
= eval(sbuf_buf(&sbuf
), '\0') > 0;
284 static int eval_if(int (*next
)(void), void (*back
)(int))
291 } while (c
== ' ' || c
== '\t');
297 if (strchr("oetn", c
)) {
298 ret
= if_cond(next
, back
);
299 } else if (!isdigit(c
) && !strchr("-+*/%<=>&:.|()", c
)) {
300 ret
= if_strcmp(next
, back
);
302 ret
= if_eval(next
, back
);
307 static int ie_cond
[NIES
]; /* .ie condition stack */
310 static void tr_if(char **args
)
312 int c
= eval_if(cp_next
, cp_back
);
313 if (args
[0][1] == 'i' && args
[0][2] == 'e') /* .ie command */
315 ie_cond
[ie_depth
++] = c
;
319 static void tr_el(char **args
)
321 cp_blk(ie_depth
> 0 ? ie_cond
[--ie_depth
] : 1);
324 static void tr_na(char **args
)
329 static int adjmode(int c
, int def
)
347 static void tr_ad(char **args
)
353 if (isdigit((unsigned char) s
[0]))
356 n_j
= s
[0] == 'p' ? AD_P
| adjmode(s
[1], AD_B
) : adjmode(s
[0], n_j
);
359 static void tr_tm(char **args
)
361 fprintf(stderr
, "%s\n", args
[1] ? args
[1] : "");
364 static void tr_so(char **args
)
370 static void tr_nx(char **args
)
375 static void tr_shift(char **args
)
377 int n
= args
[1] ? atoi(args
[1]) : 1;
382 static void tr_ex(char **args
)
387 static void tr_sy(char **args
)
392 static void tr_lt(char **args
)
394 int lt
= args
[1] ? eval_re(args
[1], n_lt
, 'm') : n_t0
;
399 static void tr_pc(char **args
)
402 if (!s
|| charread(&s
, c_pc
) < 0)
406 static void tr_tl(char **args
)
411 } while (c
>= 0 && (c
== ' ' || c
== '\t'));
413 ren_tl(cp_next
, cp_back
);
416 } while (c
>= 0 && c
!= '\n');
419 static void tr_ec(char **args
)
421 c_ec
= args
[1] ? args
[1][0] : '\\';
424 static void tr_cc(char **args
)
426 c_cc
= args
[1] ? args
[1][0] : '.';
429 static void tr_c2(char **args
)
431 c_c2
= args
[1] ? args
[1][0] : '\'';
434 static void tr_eo(char **args
)
439 static void tr_hc(char **args
)
442 if (!s
|| charread(&s
, c_hc
) < 0)
446 /* sentence ending and their transparent characters */
447 static char eos_sent
[NCHARS
][GNLEN
] = { ".", "?", "!", };
448 static int eos_sentcnt
= 3;
449 static char eos_tran
[NCHARS
][GNLEN
] = { "'", "\"", ")", "]", "*", };
450 static int eos_trancnt
= 5;
452 static void tr_eos(char **args
)
458 while (s
&& charread(&s
, eos_sent
[eos_sentcnt
]) >= 0)
459 if (eos_sentcnt
< NCHARS
- 1)
464 while (s
&& charread(&s
, eos_tran
[eos_trancnt
]) >= 0)
465 if (eos_trancnt
< NCHARS
- 1)
470 int c_eossent(char *s
)
473 for (i
= 0; i
< eos_sentcnt
; i
++)
474 if (!strcmp(eos_sent
[i
], s
))
479 int c_eostran(char *s
)
482 for (i
= 0; i
< eos_trancnt
; i
++)
483 if (!strcmp(eos_tran
[i
], s
))
488 /* hyphenation dashes and hyphenation inhibiting character */
489 static char hy_dash
[NCHARS
][GNLEN
] = { "\\:", "-", "em", "en", "\\-", "--", "hy", };
490 static int hy_dashcnt
= 7;
491 static char hy_stop
[NCHARS
][GNLEN
] = { "\\%", };
492 static int hy_stopcnt
= 1;
494 static void tr_nh(char **args
)
499 static void tr_hy(char **args
)
501 n_hy
= args
[1] ? eval_re(args
[1], n_hy
, '\0') : 1;
504 static void tr_hlm(char **args
)
506 n_hlm
= args
[1] ? eval_re(args
[1], n_hlm
, '\0') : 0;
509 static void tr_hycost(char **args
)
511 n_hycost
= args
[1] ? eval_re(args
[1], n_hycost
, '\0') : 0;
512 n_hycost2
= args
[2] ? eval_re(args
[2], n_hycost2
, '\0') : 0;
513 n_hycost3
= args
[3] ? eval_re(args
[3], n_hycost3
, '\0') : 0;
516 static void tr_hydash(char **args
)
521 while (s
&& charread(&s
, hy_dash
[hy_dashcnt
]) >= 0)
522 if (hy_dashcnt
< NCHARS
- 1)
527 static void tr_hystop(char **args
)
532 while (s
&& charread(&s
, hy_stop
[hy_stopcnt
]) >= 0)
533 if (hy_stopcnt
< NCHARS
- 1)
538 int c_hydash(char *s
)
541 for (i
= 0; i
< hy_dashcnt
; i
++)
542 if (!strcmp(hy_dash
[i
], s
))
547 int c_hystop(char *s
)
550 for (i
= 0; i
< hy_stopcnt
; i
++)
551 if (!strcmp(hy_stop
[i
], s
))
556 int c_hymark(char *s
)
558 return !strcmp(c_bp
, s
) || !strcmp(c_hc
, s
);
561 static void tr_pmll(char **args
)
563 n_pmll
= args
[1] ? eval_re(args
[1], n_pmll
, '\0') : 0;
564 n_pmllcost
= args
[2] ? eval_re(args
[2], n_pmllcost
, '\0') : 100;
567 static void tr_lg(char **args
)
570 n_lg
= eval(args
[1], '\0');
573 static void tr_kn(char **args
)
576 n_kn
= eval(args
[1], '\0');
579 static void tr_cp(char **args
)
582 n_cp
= atoi(args
[1]);
585 static void tr_ss(char **args
)
588 n_ss
= eval_re(args
[1], n_ss
, 0);
589 n_sss
= args
[2] ? eval_re(args
[2], n_sss
, 0) : n_ss
;
593 static void tr_ssh(char **args
)
595 n_ssh
= args
[1] ? eval_re(args
[1], n_ssh
, 0) : 0;
598 static void tr_cs(char **args
)
600 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
602 font_setcs(fn
, args
[2] ? eval(args
[2], 0) : 0,
603 args
[3] ? eval(args
[3], 0) : 0);
606 static void tr_fzoom(char **args
)
608 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
610 font_setzoom(fn
, args
[2] ? eval(args
[2], 0) : 0);
613 static void tr_tkf(char **args
)
615 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
617 font_track(fn
, eval(args
[2], 0), eval(args
[3], 0),
618 eval(args
[4], 0), eval(args
[5], 0));
621 static void tr_ff(char **args
)
623 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
625 for (i
= 2; i
< NARGS
; i
++)
626 if (fn
&& args
[i
] && args
[i
][0] && args
[i
][1])
627 font_feat(fn
, args
[i
] + 1, args
[i
][0] == '+');
630 static void tr_ffsc(char **args
)
632 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
634 font_scrp(fn
, args
[2]);
636 font_lang(fn
, args
[3]);
639 static void tr_nm(char **args
)
646 n_ln
= eval_re(args
[1], n_ln
, 0);
648 if (args
[2] && isdigit((unsigned char) args
[2][0]))
649 n_nM
= MAX(1, eval(args
[2], 0));
650 if (args
[3] && isdigit((unsigned char) args
[3][0]))
651 n_nS
= MAX(0, eval(args
[3], 0));
652 if (args
[4] && isdigit((unsigned char) args
[4][0]))
653 n_nI
= MAX(0, eval(args
[4], 0));
656 static void tr_nn(char **args
)
658 n_nn
= args
[1] ? eval(args
[1], 0) : 1;
661 static void tr_bd(char **args
)
663 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
664 if (!args
[1] || !strcmp("S", args
[1]))
667 font_setbd(fn
, args
[2] ? eval(args
[2], 'u') : 0);
670 static void tr_it(char **args
)
674 n_itn
= eval(args
[1], 0);
680 static void tr_mc(char **args
)
683 if (s
&& charread(&s
, c_mc
) >= 0) {
685 n_mcn
= args
[2] ? eval(args
[2], 'm') : SC_EM
;
691 static void tr_tc(char **args
)
694 if (!s
|| charread(&s
, c_tc
) < 0)
698 static void tr_lc(char **args
)
701 if (!s
|| charread(&s
, c_lc
) < 0)
705 static void tr_lf(char **args
)
708 in_lf(args
[2], eval(args
[1], 0));
711 static void tr_chop(char **args
)
718 sbuf_append(&sbuf
, str_get(id
));
719 if (!sbuf_empty(&sbuf
)) {
720 sbuf_cut(&sbuf
, sbuf_len(&sbuf
) - 1);
721 str_set(id
, sbuf_buf(&sbuf
));
727 /* character translation (.tr) */
728 static struct dict
*cmap
; /* character mapping */
729 static char cmap_src
[NCMAPS
][GNLEN
]; /* source character */
730 static char cmap_dst
[NCMAPS
][GNLEN
]; /* character mapping */
731 static int cmap_n
; /* number of translated character */
733 void cmap_add(char *c1
, char *c2
)
735 int i
= dict_get(cmap
, c1
);
737 strcpy(cmap_dst
[i
], c2
);
738 } else if (cmap_n
< NCMAPS
) {
739 strcpy(cmap_src
[cmap_n
], c1
);
740 strcpy(cmap_dst
[cmap_n
], c2
);
741 dict_put(cmap
, cmap_src
[cmap_n
], cmap_n
);
746 char *cmap_map(char *c
)
748 int i
= dict_get(cmap
, c
);
749 return i
>= 0 ? cmap_dst
[i
] : c
;
752 static void tr_tr(char **args
)
755 char c1
[GNLEN
], c2
[GNLEN
];
756 while (s
&& charread(&s
, c1
) >= 0) {
757 if (charread(&s
, c2
) < 0)
763 /* character definition (.char) */
764 static char cdef_src
[NCDEFS
][GNLEN
]; /* source character */
765 static char *cdef_dst
[NCDEFS
]; /* character definition */
766 static int cdef_fn
[NCDEFS
]; /* owning font */
767 static int cdef_n
; /* number of defined characters */
768 static int cdef_expanding
; /* inside cdef_expand() call */
770 static int cdef_find(char *c
, int fn
)
773 for (i
= 0; i
< cdef_n
; i
++)
774 if ((!cdef_fn
[i
] || cdef_fn
[i
] == fn
) && !strcmp(cdef_src
[i
], c
))
779 /* return the definition of the given character */
780 char *cdef_map(char *c
, int fn
)
782 int i
= cdef_find(c
, fn
);
783 return !cdef_expanding
&& i
>= 0 ? cdef_dst
[i
] : NULL
;
786 int cdef_expand(struct wb
*wb
, char *s
, int fn
)
788 char *d
= cdef_map(s
, fn
);
797 static void cdef_remove(char *fn
, char *cs
)
801 int fp
= fn
? dev_pos(fn
) : -1;
802 if (!cs
|| charread(&cs
, c
) < 0)
804 for (i
= 0; i
< cdef_n
; i
++) {
805 if (!strcmp(cdef_src
[i
], c
)) {
806 if (!fn
|| (fp
> 0 && cdef_fn
[i
] == fp
)) {
809 cdef_src
[i
][0] = '\0';
815 static void cdef_add(char *fn
, char *cs
, char *def
)
819 if (!def
|| charread(&cs
, c
) < 0)
821 i
= cdef_find(c
, fn
? dev_pos(fn
) : -1);
823 for (i
= 0; i
< cdef_n
; i
++)
826 if (i
== cdef_n
&& cdef_n
< NCDEFS
)
829 if (i
>= 0 && i
< cdef_n
) {
830 snprintf(cdef_src
[i
], sizeof(cdef_src
[i
]), "%s", c
);
831 cdef_dst
[i
] = xmalloc(strlen(def
) + 1);
832 strcpy(cdef_dst
[i
], def
);
833 cdef_fn
[i
] = fn
? dev_pos(fn
) : 0;
837 static void tr_rchar(char **args
)
840 for (i
= 1; i
< NARGS
; i
++)
842 cdef_remove(NULL
, args
[i
]);
845 static void tr_char(char **args
)
848 cdef_add(NULL
, args
[1], args
[2]);
850 cdef_remove(NULL
, args
[1]);
853 static void tr_ochar(char **args
)
856 cdef_add(args
[1], args
[2], args
[3]);
858 cdef_remove(args
[1], args
[2]);
861 static void tr_fmap(char **args
)
863 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
865 font_map(fn
, args
[2], args
[3]);
868 static void tr_blm(char **args
)
870 tr_bm
= args
[1] ? map(args
[1]) : -1;
873 static void tr_lsm(char **args
)
875 tr_sm
= args
[1] ? map(args
[1]) : -1;
878 static void tr_co(char **args
)
882 if (src
&& dst
&& str_get(map(src
)))
883 str_set(map(dst
), str_get(map(src
)));
886 static void tr_coa(char **args
)
890 if (src
&& dst
&& str_get(map(src
))) {
893 if (str_get(map(dst
)))
894 sbuf_append(&sb
, str_get(map(dst
)));
895 sbuf_append(&sb
, str_get(map(src
)));
896 str_set(map(dst
), sbuf_buf(&sb
));
901 static void tr_coo(char **args
)
904 char *path
= args
[2];
906 if (!reg
|| !reg
[0] || !path
|| !path
[0])
908 if ((fp
= fopen(path
, "w"))) {
909 if (str_get(map(reg
)))
910 fputs(str_get(map(reg
)), fp
);
915 static void tr_coi(char **args
)
918 char *path
= args
[2];
921 if (!reg
|| !reg
[0] || !path
|| !path
[0])
923 if ((fp
= fopen(path
+ 1, "r"))) {
926 while (fgets(buf
, sizeof(buf
), fp
))
927 sbuf_append(&sb
, buf
);
928 str_set(map(reg
), sbuf_buf(&sb
));
934 static void tr_dv(char **args
)
940 /* read a single macro argument */
941 static int macroarg(struct sbuf
*sbuf
, int brk
, int (*next
)(void), void (*back
)(int))
948 if (c
== '\n' || c
== brk
)
950 if (c
< 0 || c
== '\n' || c
== brk
)
956 while (c
>= 0 && c
!= '\n' && (quoted
|| c
!= brk
)) {
957 if (!quoted
&& c
== ' ')
959 if (quoted
&& c
== '"') {
977 /* split the arguments in sbuf, after calling one of mkargs_*() */
978 static void chopargs(struct sbuf
*sbuf
, char **args
)
980 char *s
= sbuf_buf(sbuf
);
981 char *e
= s
+ sbuf_len(sbuf
);
983 while (n
< NARGS
&& s
&& s
< e
) {
985 if ((s
= memchr(s
, '\0', e
- s
)))
990 /* read macro arguments; free the returned pointer when done */
991 char *tr_args(char **args
, int brk
, int (*next
)(void), void (*back
)(int))
995 while (!macroarg(&sbuf
, brk
, next
, back
))
997 chopargs(&sbuf
, args
);
998 return sbuf_out(&sbuf
);
1001 /* read regular macro arguments */
1002 static void mkargs_macro(struct sbuf
*sbuf
)
1005 while (!macroarg(sbuf
, -1, cp_next
, cp_back
))
1011 /* read request arguments; trims tabs too */
1012 static void mkargs_req(struct sbuf
*sbuf
)
1019 while (c
== ' ' || c
== '\t')
1021 while (c
>= 0 && c
!= '\n' && c
!= ' ' && c
!= '\t') {
1033 if (c
< 0 || c
== '\n')
1039 /* read arguments for .ds and .char */
1040 static void mkargs_ds(struct sbuf
*sbuf
)
1042 char *s
= read_name(n_cp
);
1043 sbuf_append(sbuf
, s
);
1048 sbuf_append(sbuf
, s
);
1055 /* read arguments for .ochar */
1056 static void mkargs_ochar(struct sbuf
*sbuf
)
1058 char *s
= read_name(0);
1059 sbuf_append(sbuf
, s
);
1065 /* read arguments for .nr */
1066 static void mkargs_reg1(struct sbuf
*sbuf
)
1068 char *s
= read_name(n_cp
);
1069 sbuf_append(sbuf
, s
);
1075 /* do not read any arguments; for .if, .ie and .el */
1076 static void mkargs_null(struct sbuf
*sbuf
)
1080 /* read the whole line for .tm */
1081 static void mkargs_eol(struct sbuf
*sbuf
)
1088 while (c
>= 0 && c
!= '\n') {
1098 void (*f
)(char **args
);
1099 void (*args
)(struct sbuf
*sbuf
);
1101 {TR_DIVBEG
, tr_divbeg
},
1102 {TR_DIVEND
, tr_divend
},
1103 {TR_DIVVS
, tr_divvs
},
1104 {TR_POPREN
, tr_popren
},
1107 {"ab", tr_ab
, mkargs_eol
},
1110 {"am", tr_de
, mkargs_reg1
},
1111 {"as", tr_as
, mkargs_ds
},
1120 {"char", tr_char
, mkargs_ds
},
1121 {"chop", tr_chop
, mkargs_reg1
},
1125 {"co<", tr_coi
, mkargs_ds
},
1126 {"co>", tr_coo
, mkargs_ds
},
1130 {"de", tr_de
, mkargs_reg1
},
1132 {"ds", tr_ds
, mkargs_ds
},
1134 {"dv", tr_dv
, mkargs_eol
},
1136 {"el", tr_el
, mkargs_null
},
1149 {"fspecial", tr_fspecial
},
1151 {"fzoom", tr_fzoom
},
1153 {"hcode", tr_hcode
},
1158 {"hycost", tr_hycost
},
1159 {"hydash", tr_hydash
},
1160 {"hystop", tr_hystop
},
1162 {"ie", tr_if
, mkargs_null
},
1163 {"if", tr_if
, mkargs_null
},
1184 {"nr", tr_nr
, mkargs_reg1
},
1187 {"ochar", tr_ochar
, mkargs_ochar
},
1195 {"rchar", tr_rchar
},
1201 {"shift", tr_shift
},
1207 {"sy", tr_sy
, mkargs_eol
},
1213 {"tl", tr_tl
, mkargs_null
},
1214 {"tm", tr_tm
, mkargs_eol
},
1215 {"tr", tr_tr
, mkargs_eol
},
1220 static char *dotted(char *name
, int dot
)
1222 char *out
= xmalloc(strlen(name
) + 2);
1224 strcpy(out
+ 1, name
);
1228 /* execute a built-in request */
1229 void tr_req(int reg
, char **args
)
1231 struct cmd
*req
= str_dget(reg
);
1236 /* interpolate a macro for tr_nextreq() */
1237 static void tr_nextreq_exec(char *mac
, char *arg0
, int readargs
)
1239 char *args
[NARGS
+ 3] = {arg0
};
1240 struct cmd
*req
= str_dget(map(mac
));
1241 char *str
= str_get(map(mac
));
1245 if (req
&& req
->args
)
1247 if (req
&& !req
->args
)
1250 mkargs_macro(&sbuf
);
1251 chopargs(&sbuf
, args
+ 1);
1260 /* read the next troff request; return zero if a request was executed. */
1261 int tr_nextreq(void)
1269 /* transparent line indicator */
1273 char *args
[NARGS
+ 3] = {"\\!"};
1279 chopargs(&sbuf
, args
+ 1);
1280 tr_transparent(args
);
1286 /* not a request, a blank line, or a line with leading spaces */
1287 if (c
< 0 || (c
!= c_cc
&& c
!= c_c2
&&
1288 (c
!= '\n' || tr_bm
< 0) &&
1289 (c
!= ' ' || tr_sm
< 0))) {
1294 if (c
== '\n') { /* blank line macro */
1295 mac
= malloc(strlen(map_name(tr_bm
)) + 1);
1296 strcpy(mac
, map_name(tr_bm
));
1297 arg0
= dotted(mac
, '.');
1298 tr_nextreq_exec(mac
, arg0
, 0);
1299 } else if (c
== ' ') { /* leading space macro */
1301 mac
= malloc(strlen(map_name(tr_sm
)) + 1);
1302 strcpy(mac
, map_name(tr_sm
));
1303 for (i
= 0; c
== ' '; i
++)
1307 arg0
= dotted(mac
, '.');
1308 tr_nextreq_exec(mac
, arg0
, 0);
1310 mac
= read_name(n_cp
);
1311 arg0
= dotted(mac
, c
);
1312 tr_nextreq_exec(mac
, arg0
, 1);
1322 while (!tr_nextreq())
1325 tr_nl
= c
== '\n' || c
< 0;
1332 for (i
= 0; i
< LEN(cmds
); i
++)
1333 str_dset(map(cmds
[i
].id
), &cmds
[i
]);
1334 cmap
= dict_make(-1, 0, 2);
1340 for (i
= 0; i
< cdef_n
; i
++)