1 /* Copyright 2014 Clerk Ma
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
50 putc('\n', write_file[selector]);
55 void print_char_ (ASCII_code s)
57 if (s == new_line_char)
58 if (selector < pseudo)
69 putc(xchr[s], log_file);
72 if (term_offset == max_print_line)
78 if (file_offset == max_print_line)
80 putc ('\n', log_file);
87 putc(xchr[s], log_file);
90 if (file_offset == max_print_line)
99 if (term_offset == max_print_line)
109 if (tally < trick_count)
110 trick_buf[tally % error_line] = s;
115 #ifdef ALLOCATESTRING
116 if (pool_ptr + 1 > current_pool_size)
117 str_pool = realloc_str_pool (increment_pool_size);
119 if (pool_ptr < current_pool_size)
122 if (pool_ptr < pool_size)
128 putc(xchr[s], write_file[selector]);
135 void print_ (integer s)
150 if (selector > pseudo)
156 if (s == new_line_char)
157 if (selector < pseudo)
166 /* translate ansi to dos 850 */
167 if (!show_in_hex && s < 256 && s >= 32)
169 if (show_in_dos && s > 127)
171 if (wintodos[s - 128] > 0)
173 print_char(wintodos[s - 128]);
179 while (j < str_start[s + 1])
181 print_char(str_pool[j]);
188 print_char(s); /* don't translate to hex */
192 { /* not just a character */
195 while (j < str_start[s + 1])
197 print_char(str_pool[j]);
202 new_line_char = nl; /* restore eol */
207 /* we get here with s > 256 - i.e. not a single character */
210 while (j < str_start[s + 1])
212 print_char(str_pool[j]);
216 /* string version print. */
217 void prints_ (const char *s)
223 void slow_print_ (integer s)
227 if ((s >= str_ptr) || (s < 256))
233 while (j < str_start[s + 1])
241 void print_nl (const char * s)
243 if (((term_offset > 0) && (odd(selector))) ||
244 ((file_offset > 0) && (selector >= log_only)))
250 void print_esc (const char * s)
263 void print_the_digs_ (eight_bits k)
270 print_char('0' + dig[k]);
272 print_char('A' + dig[k]);
276 void print_int_ (integer n)
308 dig[k] = (char) (n % 10);
317 void print_cs_ (integer p)
320 if (p >= single_base)
324 print_esc("endcsname");
329 print_esc(""); print(p - single_base);
331 if (cat_code(p - single_base) == letter)
334 else if (p < active_base)
335 print_esc("IMPOSSIBLE.");
337 print(p - active_base);
338 else if (p >= undefined_control_sequence)
339 print_esc("IMPOSSIBLE.");
340 else if ((text(p) >= str_ptr))
341 print_esc("NONEXISTENT.");
350 void sprint_cs_(halfword p)
354 print(p - active_base);
355 else if (p < null_cs)
358 print(p - single_base);
363 print_esc("endcsname");
367 print_esc(""); print(text(p));
371 void print_file_name_(integer n, integer a, integer e)
378 void print_size_ (integer s)
381 print_esc("textfont");
383 print_esc("scriptfont");
385 print_esc("scriptscriptfont");
388 void print_write_whatsit_(const char * s, pointer p)
392 if (write_stream(p) < 16)
393 print_int(write_stream(p));
394 else if (write_stream(p) == 16)
396 else print_char('-');
401 close_files_and_terminate();
413 puts("EXITING at JUMPOUT");
415 if ((history != 0) && (history != 1))
424 // deal with error by asking for user response 0-9, D, E, H, I, X, Q, R, S
425 // NOTE: this may JUMPOUT either via X, or because of too many errors
429 integer s1, s2, s3, s4;
431 if (history < error_message_issued)
432 history = error_message_issued;
437 if (interaction == error_stop_mode)
441 clear_for_error_prompt();
464 if (deletions_allowed)
470 align_state = 1000000L;
471 OK_to_interrupt = false;
473 if ((last > first + 1) && (buffer[first + 1] >= '0') && (buffer[first + 1] <= '9'))
474 c = (c * 10 + buffer[first + 1] - '0' * 11);
488 OK_to_interrupt = true;
489 help2("I have just deleted some text, as you asked.",
490 "You can now delete more, or insert, or whatever.");
508 edit_name_start = str_start[input_stack[base_ptr].name_field];
509 edit_name_length = length(input_stack[base_ptr].name_field);
520 use_err_help = false;
525 help2("Sorry, I don't know how to help in this situation.",
526 "Maybe you should try asking a human?");
530 prints(help_line[help_ptr]);
533 while (!(help_ptr == 0));
536 help4("Sorry, I already gave what help I could...",
537 "Maybe you should try asking a human?",
538 "An error might have occurred before I noticed any problems.",
539 "``If all else fails, read the instructions.''");
546 begin_file_reading();
548 if (last > first + 1)
555 prompt_input("insert>");
571 interaction = 0 + c - 81; /* Q = 0, R = 1, S = 2, T = 3 */
572 prints("OK, entering ");
577 print_esc("batchmode");
582 print_esc("nonstopmode");
586 print_esc("scrollmode");
606 } /* end of switch analysing response character */
609 prints("Type <return> to proceed, S to scroll future error messages,");
610 print_nl("R to run without stopping, Q to run quietly,");
611 print_nl("I to insert something, ");
614 prints("E to edit your file,");
616 if (deletions_allowed)
617 print_nl("1 or ... or 9 to ignore the next 1 to 9 tokens of input,");
619 print_nl("H for help, X to quit.");
625 if (error_count == 100)
627 print_nl("(That makes 100 errors; please try again.)");
632 if (interaction > batch_mode)
640 else while (help_ptr > 0)
643 print_nl(help_line[help_ptr] == NULL ? "" : help_line[help_ptr]);
648 if (interaction > batch_mode)
654 void fatal_error(char * s)
656 normalize_selector();
657 print_err("Emergency stop");
662 void overflow_(char * s, integer n)
664 normalize_selector();
665 print_err("TeX capacity exceeded, sorry [");
670 help2("If you really absolutely need more capacity,",
671 "you can ask a wizard to enlarge me.");
675 if (!strcmp(s, "pattern memory") && (n == trie_size))
677 sprintf(log_line, "\n (Maybe use -h=... on command line in ini-TeX)\n");
678 show_line(log_line, 0);
680 else if (!strcmp(s, "exception dictionary") && (n == hyphen_prime))
682 sprintf(log_line, "\n (Maybe use -e=... on command line in ini-TeX)\n");
683 show_line(log_line, 0);
690 void confusion_(const char * s)
692 normalize_selector();
694 if (history < error_message_issued)
696 print_err("This can't happen (");
699 help1("I'm broken. Please show this to someone who can fix can fix");
703 print_err("I can't go on meeting you like this");
704 help2("One of your faux pas seems to have wounded me deeply...",
705 "in fact, I'm barely conscious. Please fix it and try again.");
711 boolean init_terminal (void)
721 while ((loc < last) && (buffer[loc]== ' '))
722 incr(loc); // step over initial white space
728 // failed to find input file name
733 flag = input_ln(stdin, true);
738 puts("! End of file on the terminal... why?\n");
744 while ((loc < last) && (buffer[loc]== ' '))
745 incr(loc); // step over intial white space
750 sprintf(log_line, "%s\n", "Please type the name of your input file.");
751 show_line(log_line, 1);
755 str_number make_string (void)
757 #ifdef ALLOCATESTRING
758 if (str_ptr == current_max_strings)
759 str_start = realloc_str_start(increment_max_strings);
761 if (str_ptr == current_max_strings)
763 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/9 */
767 if (str_ptr == max_strings)
769 overflow("number of strings", max_strings - init_str_ptr);
775 str_start[str_ptr] = pool_ptr;
777 return (str_ptr - 1);
780 boolean str_eq_buf_ (str_number s, integer k)
787 while (j < str_start[s + 1])
789 if (str_pool[j] != buffer[k])
805 boolean str_eq_str_ (str_number s, str_number t)
812 if (length(s) != length(t))
818 while (j < str_start[s + 1])
820 if (str_pool[j] != str_pool[k])
833 void print_two_(integer n)
836 print_char('0' + (n / 10));
837 print_char('0' + (n % 10));
840 void print_hex_(integer n)
849 dig[k] = (unsigned char) (n % 16);
858 void print_roman_int_(integer n)
861 nonnegative_integer u, v;
863 j = str_start[260]; /* m2d5c2l5x2v5i */
870 print_char(str_pool[j]);
878 u = v / (str_pool[k - 1] - '0');
880 if (str_pool[k - 1] == 50)
883 u = u / (str_pool[k - 1] - '0');
888 print_char(str_pool[k]);
894 v = v / (str_pool[j - 1] - '0');
899 void print_current_string (void)
903 j = str_start[str_ptr];
907 print_char(str_pool[j]);
913 void term_input(void)
922 flag = input_ln(stdin, true);
926 fatal_error("End of file on the terminal!");
931 decr(selector); // shut off echo
934 for (k = first; k <= last - 1; k++)
938 incr(selector); // reset selector again
941 void int_error_ (integer n)
949 void normalize_selector (void)
952 selector = term_and_log;
954 selector = term_only;
959 if (interaction == batch_mode)
963 void pause_for_instructions (void)
967 interaction = error_stop_mode;
969 if ((selector == log_only) || (selector == no_print))
972 print_err("Interruption");
974 "Try to insert some instructions for me (e.g.,`I\\showlists'),",
975 "unless you just want to quit by typing `X'.");
976 deletions_allowed = false;
978 deletions_allowed = true;
983 integer half_(integer x)
986 return ((x + 1) / 2);
991 scaled round_decimals_(small_number k)
1000 a = (a + dig[k] * 131072L) / 10; /* 2^17 */
1003 return ((a + 1) / 2);
1006 void print_scaled_(scaled s)
1016 print_int(s / 65536L);
1018 s = 10 * (s % 65536L) + 5;
1024 s = s - 17232; /* 2^15 - 50000 - rounding */
1026 print_char('0' + (s / 65536L));
1027 s = 10 * (s % 65536L);
1030 while (!(s <= delta));
1033 scaled mult_and_add_(integer n, scaled x, scaled y, scaled maxanswer)
1043 else if (((x <= (maxanswer - y) / n) && (- (integer) x <= (maxanswer + y) / n)))
1052 scaled x_over_n_(scaled x, integer n)
1054 register scaled Result;
1077 tex_remainder = x % n;
1081 Result = - (integer) ((- (integer) x)/ n);
1082 tex_remainder = - (integer) ((- (integer) x)% n);
1087 tex_remainder = - (integer) tex_remainder;
1092 scaled xn_over_d_(scaled x, integer n, integer d)
1094 register scaled Result;
1096 nonnegative_integer t, u, v;
1106 t = (x % 32767L) * n;
1107 u = (x / 32768L) * n + (t / 32768L);
1108 v = (u % d) * 32768L + (t % 32768L);
1110 if (u / d >= 32768L)
1113 u = 32768L * (u / d) + (v / d);
1118 tex_remainder = v % d;
1122 Result = - (integer) u;
1123 tex_remainder = - (integer)(v % d);
1129 halfword badness_(scaled t, scaled s)
1141 else if (s >= 1663497L)
1149 return (r * r * r + 131072L) / 262144L; /* 2^17 */
1154 void print_word_(memory_word w)
1158 print_scaled(w.cint);
1160 print_scaled(round(65536L * w.gr));
1170 print_int(w.qqqq.b0);
1172 print_int(w.qqqq.b1);
1174 print_int(w.qqqq.b2);
1176 print_int(w.qqqq.b3);
1178 /* need this version only if SHORTFONTINFO defined */
1179 void zprintfword(memory_word w)
1183 print_scaled(w.cint);
1185 print_scaled(round(65536L * w.gr));
1191 print_int(w .hh.b1);
1195 print_int(w.qqqq.b0);
1197 print_int(w.qqqq.b1);
1199 print_int(w.qqqq.b2);
1201 print_int(w.qqqq.b3);
1205 void show_token_list_(integer p, integer q, integer l)
1208 ASCII_code match_chr;
1215 while ((p != 0) && (tally < l))
1219 first_count = tally;
1220 trick_count = tally + 1 + error_line - half_error_line;
1222 if (trick_count < error_line)
1223 trick_count = error_line;
1226 if ((p < hi_mem_min) || (p > mem_end))
1228 print_esc("CLOBBERED.");
1232 if (info(p) >= cs_token_flag)
1233 print_cs(info(p) - cs_token_flag);
1264 print_char(c + '0');
1273 match_chr = (ASCII_code) c;
1302 if (scanner_status > 1)
1304 print_nl("Runaway ");
1306 switch (scanner_status)
1309 prints("definition");
1331 show_token_list(link(p), 0, error_line - 10);
1335 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1336 /* first try list of available nodes (avail != NULL) */
1337 /* then see if can go upwards (mem_end < mem_max) */
1338 /* then see if can go downwards (hi_mem_min > lo_mem_max) */
1339 /* if not, extend memory at the top and grab from there --- new */
1340 /* else fail ! paragraph 120 */
1341 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1342 halfword get_avail (void)
1349 avail = link(avail);
1350 else if (mem_end < mem_max)
1360 if (hi_mem_min <= lo_mem_max) /* have we run out in middle ? */
1363 mem = realloc_main (0, mem_top / 2); /* zzzaa = zmem = mem */
1368 if (mem_end >= mem_max)
1371 overflow("main memory size", mem_max + 1 - mem_min);
1375 incr(mem_end); /* then grab from new area */
1376 p = mem_end; /* 1993/Dec/14 */
1380 link(p) = 0; /* link(p) = null !!! */
1389 void flush_list_(pointer p)
1393 if (p != 0) /* null !!! */
1405 while (!(r == 0)); /* r != null */
1412 pointer get_node_(integer s)
1424 q = p + node_size(p);
1433 llink(t) = llink(q);
1434 rlink(llink(q)) = t;
1435 q = q + node_size(q);
1440 if (r > toint(p + 1))
1442 node_size(p) = r - p;
1457 node_size(p) = q - p;
1460 while (!(p == rover));
1462 if (s == 1073741824L) /* 2^30 - special case - merge adjacent */
1465 puts("Merged adjacent multi-word nodes\n");
1467 return max_halfword;
1470 /* maybe try downward epxansion first instead ? */
1471 if (lo_mem_max + 2 < hi_mem_min)
1472 if (lo_mem_max + 2 <= mem_bot + max_halfword) /* silly ? flush 93/Dec/16 */
1474 /* if (hi_mem_min - lo_mem_max >= 1998) */
1475 if (hi_mem_min - lo_mem_max >= (block_size + block_size - 2))
1476 /* t = lo_mem_max + 1000; */
1477 t = lo_mem_max + block_size;
1479 t = lo_mem_max + 1 + (hi_mem_min - lo_mem_max) / 2;
1486 if (t > mem_bot + max_halfword)
1487 t = mem_bot + max_halfword; /* silly ? flush 93/Dec/16 */
1491 link(q) = empty_flag;
1492 node_size(q) = t - lo_mem_max; /* block size */
1494 link(lo_mem_max) = 0;
1495 info(lo_mem_max) = 0;
1500 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1501 /* we've run out of space in the middle for variable length blocks */
1502 /* try and add new block from below mem_bot *//* first check if space ! */
1503 if (mem_min - (block_size + 1) <= mem_start) /* extend lower memory downwards */
1505 mem = realloc_main (mem_top/2 + block_size, 0); /* zzzaa = zmem = mem */
1513 if (mem_min - (block_size + 1) <= mem_start) /* check again */
1517 sprintf(log_line, "mem_min %lld, mem_start %ld, block_size %d\n", mem_min, mem_start, block_size);
1518 show_line(log_line, 0);
1521 overflow("main memory size", mem_max + 1 - mem_min); /* darn: allocation failed ! */
1525 add_variable_space (block_size);
1526 goto restart; /* go try get_node again */
1532 var_used = var_used + s;
1538 void free_node_(halfword p, halfword s)
1543 link(p) = empty_flag;
1551 var_used = var_used - s;
1555 pointer new_null_box (void)
1559 p = get_node(box_node_size);
1560 type(p) = hlist_node;
1561 subtype(p) = min_quarterword;
1565 shift_amount(p) = 0;
1567 glue_sign(p) = normal;
1568 glue_order(p) = normal;
1574 pointer new_rule (void)
1578 p = get_node(rule_node_size);
1579 type(p) = rule_node;
1581 width(p) = null_flag;
1582 depth(p) = null_flag;
1583 height(p) = null_flag;
1588 pointer new_ligature_(quarterword f, quarterword c, pointer q)
1592 p = get_node(small_node_size);
1593 type(p) = ligature_node;
1594 font(lig_char(p)) = f;
1595 character(lig_char(p)) = c;
1602 pointer new_lig_item_(quarterword c)
1606 p = get_node(small_node_size);
1613 pointer new_disc (void)
1617 p = get_node(small_node_size);
1618 type(p) = disc_node;
1619 replace_count(p) = 0;
1626 pointer new_math_(scaled w, small_number s)
1630 p = get_node(small_node_size);
1631 type(p) = math_node;
1638 pointer new_spec_(pointer p)
1642 q = get_node(glue_spec_size);
1644 glue_ref_count(q) = 0;
1645 width(q) = width(p);
1646 stretch(q) = stretch(p);
1647 shrink(q) = shrink(p);
1652 pointer new_param_glue_(small_number n)
1657 p = get_node(small_node_size);
1658 type(p) = glue_node;
1663 incr(glue_ref_count(q));
1668 pointer new_glue_(pointer q)
1672 p = get_node(small_node_size);
1673 type(p) = glue_node;
1674 subtype(p) = normal;
1677 incr(glue_ref_count(q));
1682 pointer new_skip_param_(small_number n)
1686 temp_ptr = new_spec(glue_par(n));
1687 p = new_glue(temp_ptr);
1688 glue_ref_count(temp_ptr) = 0;
1694 pointer new_kern(scaled w)
1698 p = get_node(small_node_size);
1699 type(p) = kern_node;
1700 subtype(p) = normal;
1706 pointer new_penalty(integer m)
1710 p = get_node(small_node_size);
1711 type(p) = penalty_node;
1720 void check_mem(boolean printlocs)
1725 for (p = mem_min; p <= lo_mem_max; p++) freearr[p] = false;
1726 for (p = hi_mem_min; p <= mem_end; p++) freearr[p] = false;
1731 if ((p > mem_end) || (p < hi_mem_min))
1733 else if (freearr[p])
1738 print_nl("AVAIL list clobbered at ");
1751 if ((p >= lo_mem_max) || (p < mem_min))
1753 else if ((rlink(p) >= lo_mem_max) || (rlink(p) < mem_min))
1755 else if (!(is_empty(p)) || (node_size(p) < 2) ||
1756 (p + node_size(p) > lo_mem_max) || (llink(rlink(p)) != p))
1761 print_nl("Double-AVAIL list clobbered at ");
1766 for (q = p; q <= p + node_size(p) - 1; q++)
1770 print_nl("Doubly free location at ");
1778 } while (!(p == rover));
1781 while (p <= lo_mem_max) {
1784 print_nl("Bad flag at ");
1787 while ((p <= lo_mem_max) && !freearr[p]) incr(p);
1788 while ((p <= lo_mem_max) && freearr[p]) incr(p);
1793 print_nl("New busy locs:");
1795 for (p = mem_min; p <= lo_mem_max; p++)
1796 if (!freearr[p] && ((p > was_lo_max) || wasfree[p]))
1802 for (p = hi_mem_min; p <= mem_end; p++)
1803 if (!freearr[p] && ((p < was_hi_min) || (p > was_mem_end) || wasfree[p]))
1810 for (p = mem_min; p <= lo_mem_max; p++) wasfree[p] = freearr[p];
1811 for (p = hi_mem_min; p <= mem_end; p++) wasfree[p] = freearr[p];
1813 was_mem_end = mem_end;
1814 was_lo_max = lo_mem_max;
1815 was_hi_min = hi_mem_min;
1821 void search_mem_(halfword p)
1825 for (q = mem_min; q <= lo_mem_max; q++)
1841 for (q = hi_mem_min; q <= mem_end; q++)
1857 for (q = active_base; q <= box_base + 255; q++)
1866 for (q = 0; q <= save_ptr - 1; q++)
1868 if (equiv_field(save_stack[q]) == p)
1876 for (q = 0; q <= hyphen_prime; q++)
1877 if (hyph_list[q] == p)
1886 void short_display_(integer p)
1890 while (p != 0) /* want p != null here ! */
1892 if (is_char_node(p))
1896 if (font(p) != font_in_short_display)
1898 if ((font(p) > font_max))
1903 print(font_id_text(font(p)));
1907 font_in_short_display = font(p);
1909 print(character(p));
1912 else switch (mem[p].hh.b0)
1927 if (glue_ptr(p) != 0)
1934 short_display(lig_ptr(p));
1937 short_display(pre_break(p));
1938 short_display(post_break(p));
1939 n = replace_count(p);
1956 void print_font_and_char (integer p)
1959 print_esc("CLOBBERED.");
1962 if ((font(p) > font_max))
1967 print(font_id_text(font(p)));
1971 print(character(p));
1975 void print_mark_ (integer p)
1979 if ((p < hi_mem_min) || (p > mem_end))
1980 print_esc("CLOBBERED.");
1982 show_token_list(link(p), 0, max_print_line - 10);
1987 void print_rule_dimen(scaled d)
1995 void print_glue_(scaled d, integer order, char * s)
1999 if ((order < normal) || (order > filll))
2011 else if (*s != '\0')
2015 void print_spec_(integer p, char * s)
2017 if ((p < mem_min) || (p >= lo_mem_max))
2021 print_scaled(width(p));
2026 if (stretch(p) != 0)
2029 print_glue(stretch(p), stretch_order(p), s);
2035 print_glue(shrink(p), shrink_order(p), s);
2040 void print_fam_and_char_(halfword p)
2045 print(character(p));
2048 void print_delimiter_(halfword p)
2052 a = small_fam(p) * 256 + small_char(p);
2053 a = a * 0x1000 + large_fam(p) * 256 + large_char(p);
2061 void print_subsidiary_data_(halfword p, ASCII_code c)
2063 if ((pool_ptr - str_start[str_ptr]) >= depth_threshold)
2065 if (math_type(p) != 0)
2073 switch (math_type(p))
2077 print_current_string();
2078 print_fam_and_char(p);
2089 print_current_string();
2104 void print_style_(integer c)
2109 print_esc("displaystyle");
2112 print_esc("textstyle");
2115 print_esc("scriptstyle");
2118 print_esc("scriptscriptstyle");
2121 prints("Unknown style!");
2126 void print_skip_param_(integer n)
2130 case line_skip_code:
2131 print_esc("lineskip");
2134 case baseline_skip_code:
2135 print_esc("baselineskip");
2139 print_esc("parskip");
2142 case above_display_skip_code:
2143 print_esc("abovedisplayskip");
2146 case below_display_skip_code:
2147 print_esc("belowdisplayskip");
2150 case above_display_short_skip_code:
2151 print_esc("abovedisplayshortskip");
2154 case below_display_short_skip_code:
2155 print_esc("belowdisplayshortskip");
2158 case left_skip_code:
2159 print_esc("leftskip");
2162 case right_skip_code:
2163 print_esc("rightskip");
2167 print_esc("topskip");
2170 case split_top_skip_code:
2171 print_esc("splittopskip");
2175 print_esc("tabskip");
2178 case space_skip_code:
2179 print_esc("spaceskip");
2182 case xspace_skip_code:
2183 print_esc("xspaceskip");
2186 case par_fill_skip_code:
2187 print_esc("parfillskip");
2190 case thin_mu_skip_code:
2191 print_esc("thinmuskip");
2194 case med_mu_skip_code:
2195 print_esc("medmuskip");
2198 case thick_mu_skip_code:
2199 print_esc("thickmuskip");
2203 prints("[unknown glue parameter!]");
2208 void show_node_list_(integer p)
2213 if (cur_length > depth_threshold)
2215 if (p != 0) /* fixed 94/Mar/23 BUG FIX NOTE: still not fixed in 3.14159 ! */
2223 while (p != 0) { /* want p != null - bkph 93/Dec/15 NOTE: still not fixed in 3.14159 ! */
2225 print_current_string();
2229 prints("Bad link, display aborted.");
2235 if (n > breadth_max)
2241 if (is_char_node(p))
2242 print_font_and_char(p);
2243 else switch (type(p))
2249 if (type(p) == hlist_node)
2251 else if (type(p) == vlist_node)
2253 else print_esc("unset");
2256 print_scaled(height(p));
2258 print_scaled(depth(p));
2260 print_scaled(width(p));
2262 if (type(p) == unset_node)
2264 if (span_count(p) != 0)
2267 print_int(span_count(p) + 1);
2268 prints(" columns)");
2271 if (glue_stretch(p) != 0)
2273 prints(", stretch ");
2274 print_glue(glue_stretch(p), glue_order(p), "");
2277 if (glue_shrink(p) != 0)
2279 prints(", shrink ");
2280 print_glue(glue_shrink(p), glue_sign(p), "");
2287 if ((g != 0.0) && (glue_sign(p) != 0))
2289 prints(", glue set ");
2291 if (glue_sign(p) == shrinking)
2294 if (fabs(g)> 20000.0)
2301 print_glue(20000 * unity, glue_order(p), "");
2304 print_glue(round(unity * g), glue_order(p), "");
2307 if (shift_amount(p) != 0)
2309 prints(", shifted ");
2310 print_scaled(shift_amount(p));
2314 node_list_display(list_ptr(p));
2321 print_rule_dimen(height(p));
2323 print_rule_dimen(depth(p));
2325 print_rule_dimen(width(p));
2331 print_esc("insert");
2332 print_int(subtype(p));
2333 prints(", natural size ");
2334 print_scaled(height(p));
2336 print_spec(split_top_ptr(p), "");
2338 print_scaled(depth(p));
2339 prints("); float cost ");
2340 print_int(float_cost(p));
2341 node_list_display(ins_ptr(p));
2350 print_write_whatsit("openout", p);
2352 print_file_name(open_name(p), open_area(p), open_ext(p));
2358 print_write_whatsit("write", p);
2359 print_mark(write_tokens(p));
2364 print_write_whatsit("closeout", p);
2369 print_esc("special");
2370 print_mark(write_tokens(p));
2376 print_esc("setlanguage");
2377 print_int(what_lang(p));
2378 prints(" (hyphenmin ");
2379 print_int(what_lhm(p));
2381 print_int(what_rhm(p));
2393 if (subtype(p) >= a_leaders)
2397 if (subtype(p) == c_leaders)
2399 else if (subtype(p) == x_leaders)
2403 print_spec(glue_ptr(p), "");
2404 node_list_display(leader_ptr(p));
2410 if (subtype(p) != normal)
2414 if (subtype(p) < cond_math_glue)
2415 print_skip_param(subtype(p) - 1);
2416 else if (subtype(p) == cond_math_glue)
2417 print_esc("nonscript");
2418 else print_esc("mskip");
2423 if (subtype(p) != cond_math_glue)
2427 if (subtype(p) < cond_math_glue)
2428 print_spec(glue_ptr(p), "");
2430 print_spec(glue_ptr(p), "mu");
2436 if (subtype(p) != mu_glue)
2440 if (subtype(p) != normal)
2443 print_scaled(width(p));
2445 if (subtype(p) == acc_kern)
2446 prints(" (for accent)");
2451 print_scaled(width(p));
2460 if (subtype(p) == before)
2467 prints(", surrounded ");
2468 print_scaled(width(p));
2475 print_font_and_char(lig_char(p));
2476 prints("(ligature ");
2481 font_in_short_display = font(lig_char(p));
2482 short_display(lig_ptr(p));
2484 if (odd(subtype(p)))
2493 print_esc("penalty ");
2494 print_int(penalty(p));
2500 print_esc("discretionary");
2502 if (replace_count(p) > 0)
2504 prints(" replacing ");
2505 print_int(replace_count(p));
2508 node_list_display(pre_break(p));
2510 show_node_list(post_break(p));
2518 print_mark(mark_ptr(p));
2524 print_esc("vadjust");
2525 node_list_display(adjust_ptr(p));
2530 print_style(subtype(p));
2535 print_esc("mathchoice");
2537 show_node_list(display_mlist(p));
2540 show_node_list(text_mlist(p));
2543 show_node_list(script_mlist(p));
2546 show_node_list(script_script_mlist(p));
2570 print_esc("mathord");
2574 print_esc("mathop");
2578 print_esc("mathbin");
2582 print_esc("mathrel");
2586 print_esc("mathopen");
2590 print_esc("mathclose");
2594 print_esc("mathpunct");
2598 print_esc("mathinner");
2602 print_esc("overline");
2606 print_esc("underline");
2610 print_esc("vcenter");
2615 print_esc("radical");
2616 print_delimiter(left_delimiter(p));
2622 print_esc("accent");
2623 print_fam_and_char(accent_chr(p));
2630 print_delimiter(delimiter(p));
2637 print_delimiter(delimiter(p));
2642 if (subtype(p) != normal)
2643 if (subtype(p) == limits)
2644 print_esc("limits");
2646 print_esc("nolimits");
2648 if (type(p) < left_noad)
2649 print_subsidiary_data(nucleus(p), '.');
2651 print_subsidiary_data(supscr(p), '^');
2652 print_subsidiary_data(subscr(p), '_');
2658 print_esc("fraction, thickness ");
2660 if (thickness(p) == 1073741824L) /* 2^30 */
2661 prints("= default");
2663 print_scaled(thickness(p));
2665 if ((small_fam(left_delimiter(p)) != 0) || (small_char(left_delimiter(p)) != 0) ||
2666 (large_fam(left_delimiter(p)) != 0) || (large_char(left_delimiter(p)) != 0))
2668 prints(", left-delimiter ");
2669 print_delimiter(left_delimiter(p));
2672 if ((small_fam(right_delimiter(p)) != 0) || (small_char(right_delimiter(p)) != 0) ||
2673 (large_fam(right_delimiter(p)) != 0) || (large_char(right_delimiter(p)) != 0))
2675 prints(", right-delimiter ");
2676 print_delimiter(right_delimiter(p));
2679 print_subsidiary_data(numerator(p), '\\');
2680 print_subsidiary_data(denominator(p), '/');
2685 prints("Unknown node type!");