@@ -24,7 +24,6 @@ static jmp_buf error_jmpbuf, recover_jmpbuf;
2424
2525/*22: */
2626
27- typedef size_t pool_pointer ;
2827typedef size_t hash_loc ;
2928typedef size_t cite_number ;
3029typedef size_t wiz_fn_loc ;
@@ -102,108 +101,6 @@ printf_log(const char *fmt, ...)
102101
103102/*:159*/ /*160: */
104103
105- static void x_width (ExecCtx * ctx )
106- {
107- unwrap (pop_lit_stk (ctx , & ctx -> pop1 ));
108- if (ctx -> pop1 .tag != ExecVal_String ) {
109- unwrap (print_wrong_stk_lit (ctx , ctx -> pop1 , STK_TYPE_STRING ));
110- push_lit_stk (ctx , int_val (0 ));
111- } else {
112-
113- bib_set_buf_len (BUF_TY_EX , 0 );
114- add_buf_pool (ctx -> pop1 .string );
115- int32_t string_width = 0 ;
116- {
117- int32_t brace_level = 0 ;
118- bib_set_buf_offset (BUF_TY_EX , 1 , 0 );
119- while (bib_buf_offset (BUF_TY_EX , 1 ) < bib_buf_len (BUF_TY_EX )) {
120-
121- if (bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 )) == 123 /*left_brace */ ) {
122- brace_level = brace_level + 1 ;
123- if ((brace_level == 1 ) && (bib_buf_offset (BUF_TY_EX , 1 ) + 1 < bib_buf_len (BUF_TY_EX ))) {
124-
125- if (bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 ) + 1 ) == 92 /*backslash */ ) { /*453: */
126- bib_set_buf_offset (BUF_TY_EX , 1 , bib_buf_offset (BUF_TY_EX , 1 ) + 1 );
127- while ((bib_buf_offset (BUF_TY_EX , 1 ) < bib_buf_len (BUF_TY_EX )) && (brace_level > 0 )) {
128-
129- bib_set_buf_offset (BUF_TY_EX , 1 , bib_buf_offset (BUF_TY_EX , 1 ) + 1 );
130- BufPointer ex_buf_xptr = bib_buf_offset (BUF_TY_EX , 1 );
131- while (((bib_buf_offset (BUF_TY_EX , 1 ) < bib_buf_len (BUF_TY_EX ))
132- && (LEX_CLASS [bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 ))] == LEX_CLASS_ALPHA )))
133- bib_set_buf_offset (BUF_TY_EX , 1 , bib_buf_offset (BUF_TY_EX , 1 ) + 1 );
134- if ((bib_buf_offset (BUF_TY_EX , 1 ) < bib_buf_len (BUF_TY_EX )) && (bib_buf_offset (BUF_TY_EX , 1 ) == ex_buf_xptr ))
135- bib_set_buf_offset (BUF_TY_EX , 1 , bib_buf_offset (BUF_TY_EX , 1 ) + 1 );
136- else {
137- LookupRes hash = unwrap_lookup (str_lookup (BUF_TY_EX , ex_buf_xptr ,
138- bib_buf_offset (BUF_TY_EX , 1 ) -
139- ex_buf_xptr , STR_ILK_CONTROL_SEQ ,
140- false));
141- hash_loc control_seq_loc = hash .loc ;
142- if (hash .exists ) { /*454: */
143- switch ((ilk_info (control_seq_loc ))) {
144- case 12 :
145- string_width = string_width + 500 ;
146- break ;
147- case 4 :
148- string_width = string_width + 722 ;
149- break ;
150- case 2 :
151- string_width = string_width + 778 ;
152- break ;
153- case 5 :
154- string_width = string_width + 903 ;
155- break ;
156- case 3 :
157- string_width = string_width + 1014 ;
158- break ;
159- default :
160- string_width = string_width + CHAR_WIDTH [bib_buf (BUF_TY_EX , ex_buf_xptr )];
161- break ;
162- }
163- }
164- }
165- while (((bib_buf_offset (BUF_TY_EX , 1 ) < bib_buf_len (BUF_TY_EX ))
166- && (LEX_CLASS [bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 ))] == LEX_CLASS_WHITESPACE )))
167- bib_set_buf_offset (BUF_TY_EX , 1 , bib_buf_offset (BUF_TY_EX , 1 ) + 1 );
168- while (((bib_buf_offset (BUF_TY_EX , 1 ) < bib_buf_len (BUF_TY_EX )) && (brace_level > 0 )
169- && (bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 )) != 92 /*backslash */ ))) {
170-
171- if (bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 )) == 125 /*right_brace */ )
172- brace_level = brace_level - 1 ;
173- else if (bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 )) == 123 /*left_brace */ )
174- brace_level = brace_level + 1 ;
175- else
176- string_width = string_width + CHAR_WIDTH [bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 ))];
177- bib_set_buf_offset (BUF_TY_EX , 1 , bib_buf_offset (BUF_TY_EX , 1 ) + 1 );
178- }
179- }
180- bib_set_buf_offset (BUF_TY_EX , 1 , bib_buf_offset (BUF_TY_EX , 1 ) - 1 );
181- } else
182- string_width = string_width + CHAR_WIDTH [123 /*left_brace */ ];
183- } else
184- string_width = string_width + CHAR_WIDTH [123 /*left_brace */ ];
185- } else if (bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 )) == 125 /*right_brace */ ) {
186- unwrap (decr_brace_level (ctx , ctx -> pop1 .string , & brace_level ));
187- string_width = string_width + CHAR_WIDTH [125 /*right_brace */ ];
188- } else
189- string_width = string_width + CHAR_WIDTH [bib_buf (BUF_TY_EX , bib_buf_offset (BUF_TY_EX , 1 ))];
190- bib_set_buf_offset (BUF_TY_EX , 1 , bib_buf_offset (BUF_TY_EX , 1 ) + 1 );
191- }
192- unwrap (check_brace_level (ctx , ctx -> pop1 .string , brace_level ));
193- }
194- push_lit_stk (ctx , int_val (string_width ));
195- }
196- }
197-
198- static void x_write (ExecCtx * ctx )
199- {
200- unwrap (pop_lit_stk (ctx , & ctx -> pop1 ));
201- if (ctx -> pop1 .tag != ExecVal_String )
202- unwrap (print_wrong_stk_lit (ctx , ctx -> pop1 , STK_TYPE_STRING ));
203- else
204- add_out_pool (ctx -> glbl_ctx , ctx -> pop1 .string );
205- }
206-
207104static void execute_fn (ExecCtx * ctx , hash_loc ex_fn_loc )
208105{
209106 wiz_fn_loc wiz_ptr ;
@@ -329,7 +226,7 @@ static void execute_fn(ExecCtx* ctx, hash_loc ex_fn_loc)
329226 unwrap (x_type (ctx ));
330227 break ;
331228 case 33 :
332- x_warning (ctx );
229+ unwrap ( x_warning (ctx ) );
333230 break ;
334231 case 34 :
335232 {
@@ -357,10 +254,10 @@ static void execute_fn(ExecCtx* ctx, hash_loc ex_fn_loc)
357254 }
358255 break ;
359256 case 35 :
360- x_width (ctx );
257+ unwrap ( x_width (ctx ) );
361258 break ;
362259 case 36 :
363- x_write (ctx );
260+ unwrap ( x_write (ctx ) );
364261 break ;
365262 default :
366263 puts_log ("Unknown built-in function" );
0 commit comments