7 static int cp_nblk
; /* input block depth (text in \{ and \}) */
8 static int cp_sblk
[NIES
]; /* skip \} escape at this depth, if set */
9 static int cp_widreq
= 1; /* inline \w requests */
11 static int regid(void)
23 static void cp_num(void)
27 if (c
!= '-' && c
!= '+')
30 if (c
== '-' || c
== '+')
31 num_get(id
, c
== '+' ? 1 : -1);
33 in_push(num_str(id
), NULL
);
36 static void cp_str(void)
38 char *buf
= str_get(regid());
43 static void cp_arg(void)
48 if (c
>= '1' && c
<= '9')
49 arg
= in_arg(c
- '0');
54 static void cp_width(void)
57 sprintf(wid
, "%d", ren_wid(cp_next
, cp_back
));
61 static int cp_raw(void)
73 if (c
== '{' && cp_nblk
< LEN(cp_sblk
))
74 cp_sblk
[cp_nblk
++] = 0;
75 if (c
== '}' && cp_nblk
> 0)
76 if (cp_sblk
[--cp_nblk
])
93 while (c
>= 0 && c
!= '\n')
95 } else if (c
== 'w' && cp_widreq
) {
98 } else if (c
== 'n') {
101 } else if (c
== '*') {
104 } else if (c
== '$') {
115 void cp_blk(int skip
)
120 c
= skip
? cp_raw() : cp_next();
121 } while (c
== ' ' || c
== '\t');
122 if (c
== '\\' && in_top() == '{') { /* a troff \{ \} block */
124 while (skip
&& cp_nblk
> nblk
&& c
>= 0)
134 while (skip
&& c
!= '\n') /* skip until the end of the line */
138 void cp_wid(int enable
)