2 Copyright 2014 Clerk Ma
\r
4 This program is free software; you can redistribute it and/or modify
\r
5 it under the terms of the GNU General Public License as published by
\r
6 the Free Software Foundation; either version 2 of the License, or
\r
7 (at your option) any later version.
\r
9 This program is distributed in the hope that it will be useful, but
\r
10 WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
12 General Public License for more details.
\r
14 You should have received a copy of the GNU General Public License
\r
15 along with this program; if not, write to the Free Software
\r
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
\r
20 #define EXTERN extern
\r
21 #include "yandytex.h"
\r
24 void do_nothing(void)
\r
28 void wake_up_terminal (void)
\r
33 void update_terminal(void)
\r
38 void append_char (ASCII_code c)
\r
40 str_pool[pool_ptr] = c;
\r
44 void str_room(int val)
\r
46 #ifdef ALLOCATESTRING
\r
47 if (pool_ptr + val > current_pool_size)
\r
48 str_pool = realloc_str_pool(increment_pool_size);
\r
50 if (pool_ptr + val > current_pool_size)
\r
51 overflow("pool size", current_pool_size - init_pool_ptr);
\r
53 if (pool_ptr + val > pool_size)
\r
54 overflow("pool size", pool_size - init_pool_ptr);
\r
58 void flush_string (void)
\r
61 pool_ptr = str_start[str_ptr];
\r
64 void append_lc_hex (ASCII_code c)
\r
67 append_char(c + '0');
\r
69 append_char(c - 10 + 'a');
\r
73 void print_err (const char * s)
\r
75 if (interaction == error_stop_mode)
\r
82 void prompt_input(const char * s)
\r
89 void tex_help (unsigned int n, ...)
\r
98 va_start(help_arg, n);
\r
100 for (i = n - 1; i > -1; --i)
\r
101 help_line[i] = va_arg(help_arg, char *);
\r
106 void succumb (void)
\r
108 if (interaction == error_stop_mode)
\r
109 interaction = scroll_mode;
\r
115 if (interaction > 0)
\r
119 history = error_stop_mode;
\r
123 void free_avail_(halfword p)
\r
132 void node_list_display (integer p)
\r
139 void tail_append_ (pointer val)
\r
145 void check_full_save_stack(void)
\r
147 if (save_ptr > max_save_stack)
\r
149 max_save_stack = save_ptr;
\r
151 #ifdef ALLOCATESAVESTACK
\r
152 if (max_save_stack > current_save_size - 6)
\r
153 save_stack = realloc_save_stack(increment_save_size);
\r
155 if (max_save_stack > current_save_size - 6)
\r
157 overflow("save size", current_save_size);
\r
161 if (max_save_stack > save_size - 6)
\r
163 overflow("save size", save_size);
\r
170 void push_input(void)
\r
172 if (input_ptr > max_in_stack)
\r
174 max_in_stack = input_ptr;
\r
176 #ifdef ALLOCATEINPUTSTACK
\r
177 if (input_ptr == current_stack_size)
\r
178 input_stack = realloc_input_stack(increment_stack_size);
\r
180 if (input_ptr == current_stack_size)
\r
182 overflow("input stack size", current_stack_size);
\r
186 if (input_ptr == stack_size)
\r
188 overflow("input stack size", stack_size);
\r
194 input_stack[input_ptr] = cur_input;
\r
198 void pop_input(void)
\r
201 cur_input = input_stack[input_ptr];
\r
204 void ensure_dvi_open (void)
\r
206 if (output_file_name == 0)
\r
211 pack_job_name(".dvi");
\r
213 while (!b_open_out(dvi_file))
\r
214 prompt_file_name("file name for output", ".dvi");
\r
216 output_file_name = b_make_name_string(dvi_file);
\r
222 fbyte = getc(tfm_file);
\r
225 void write_dvi(size_t a, size_t b)
\r
227 if (fwrite((char *)&dvi_buf[a], sizeof(dvi_buf[a]),
\r
228 (b - a + 1), dvi_file) != (b - a + 1))
\r
229 FATAL_PERROR("\n! dvi file");
\r
232 void dvi_out_(ASCII_code op)
\r
234 dvi_buf[dvi_ptr] = op;
\r
237 if (dvi_ptr == dvi_limit)
\r
241 void synch_h (void)
\r
243 if (cur_h != dvi_h)
\r
245 movement(cur_h - dvi_h, right1);
\r
250 void synch_v (void)
\r
252 if (cur_v != dvi_v)
\r
254 movement(cur_v - dvi_v, down1);
\r
259 void set_cur_lang (void)
\r
263 else if (language > 255)
\r
266 cur_lang = language;
\r
269 void print_plus (int i, const char * s)
\r
271 if (page_so_far[i] != 0)
\r
274 print_scaled(page_so_far[i]);
\r