5 static int cp_nblk
; /* input block depth (text in \{ and \}) */
6 static int cp_sblk
[NIES
]; /* skip \} escape at this depth, if set */
7 static int cp_widreq
= 1; /* inline \w requests */
19 } else if (!n_cp
&& c1
== '[') {
21 while (i
< NMLEN
- 1 && c1
>= 0 && c1
!= ']') {
31 static void cp_num(void)
35 if (c
!= '-' && c
!= '+')
38 if (c
== '-' || c
== '+')
39 num_get(id
, c
== '+' ? 1 : -1);
41 in_push(num_str(id
), NULL
);
44 static void cp_str(void)
46 char *buf
= str_get(regid());
51 static void cp_numfmt(void)
53 in_push(num_getfmt(regid()), NULL
);
56 static void cp_arg(void)
61 if (c
>= '1' && c
<= '9')
62 arg
= in_arg(c
- '0');
67 static void cp_width(void)
70 sprintf(wid
, "%d", ren_wid(cp_next
, cp_back
));
74 static int cp_raw(void)
102 if (c
== '{' && cp_nblk
< LEN(cp_sblk
))
103 cp_sblk
[cp_nblk
++] = 0;
104 if (c
== '}' && cp_nblk
> 0)
105 if (cp_sblk
[--cp_nblk
])
122 while (c
>= 0 && c
!= '\n')
124 } else if (c
== 'w' && cp_widreq
) {
127 } else if (c
== 'n') {
130 } else if (c
== '*') {
133 } else if (c
== 'g') {
136 } else if (c
== '$') {
147 void cp_blk(int skip
)
152 c
= skip
? cp_raw() : cp_next();
153 } while (c
== ' ' || c
== '\t');
155 while (c
>= 0 && (c
!= '\n' || cp_nblk
> nblk
))
158 if (c
== c_ec
&& in_top() == '{') { /* a troff \{ \} block */
167 void cp_wid(int enable
)