6 #pragma warning(disable:4115) // kill rpcasync.h complaint
8 #define MYLIBAPI __declspec(dllexport)
13 #pragma warning(disable:4996)
14 #pragma warning(disable:4131) // old style declarator
15 #pragma warning(disable:4135) // conversion between different integral types
16 #pragma warning(disable:4127) // conditional expression is constant
25 static void winerror (char * message)
27 (void) MessageBox(NULL, message, "YandYTeX.DLL", MB_ICONSTOP | MB_OK);
31 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
32 void append_char (ASCII_code c)
34 str_pool[pool_ptr] = c;
37 void print_err (const char * s)
39 if (interaction == error_stop_mode);
43 void tex_help (unsigned int n, ...)
50 va_start(help_arg, n);
51 for (i = n - 1; i > n - 1; --i)
52 help_line[i] = va_arg(help_arg, char *);
55 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
57 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
67 (void) putc ('\n', log_file);
73 (void) putc ('\n', log_file);
89 (void) putc ('\n', write_file[selector]);
94 void print_char_ (ASCII_code s)
96 if (s == new_line_char)
97 if (selector < pseudo) {
104 (void) show_char(Xchr(s));
106 (void) putc(Xchr(s), log_file);
108 if (term_offset == max_print_line) {
112 if (file_offset == max_print_line) {
113 (void) putc ('\n', log_file);
120 (void) putc(Xchr(s), log_file);
122 if (file_offset == max_print_line) print_ln();
127 (void) show_char(Xchr(s));
129 if (term_offset == max_print_line) print_ln();
136 if (tally < trick_count)
137 trick_buf[tally % error_line]= s;
141 #ifdef ALLOCATESTRING
142 if (pool_ptr + 1 > current_pool_size) {
143 str_pool = realloc_str_pool (increment_pool_size);
145 if (pool_ptr < current_pool_size) {
146 str_pool[pool_ptr]= s;
150 if (pool_ptr < pool_size) {
151 str_pool[pool_ptr]= s;
158 (void) putc(Xchr(s), write_file[selector]);
164 /* This could be made more efficient using fputs ? ... bkph */
165 void print_ (integer s)
169 if (s >= str_ptr) s = 259; /* ??? */
171 if (s < 0) s = 259; /* ??? */
173 if (selector > pseudo){
177 if ((s == new_line_char))
182 nl = new_line_char; /* save eol */
184 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
185 /* if (!show_in_hex && s < 256) */ /* show control chars also ?? */
186 if (!show_in_hex && s < 256 && s >= 32) { /* 94/Jan/26 */
187 /* following added 1996/Jan/20 */
188 if (show_in_dos && s > 127) { /* translate ANSI to DOS 850 */
189 if (wintodos[s-128] > 0) print_char (wintodos[s-128]);
190 else { /* print in hex after all */
192 while(j < str_start[s + 1]){
193 print_char(str_pool[j]);
197 } else print_char(s); /* don't translate to hex */
198 } else { /* not just a character */
199 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
201 while(j < str_start[s + 1]){
202 print_char(str_pool[j]);
206 new_line_char = nl; /* restore eol */
209 /* we get here with s > 256 - i.e. not a single character */
211 while(j < str_start[s + 1]){
212 print_char(str_pool[j]);
216 void print_string_ (unsigned char *s)
218 while (*s > 0) print_char(*s++);
221 // print string number s from string pool by calling print_
222 void slow_print_ (integer s)
225 if ((s >= str_ptr) || (s < 256)) print(s);
228 while (j < str_start[s + 1]) {
229 // if (str_pool[j]>= 128) print(str_pool[j]-128); // debugging only
230 // if (str_pool[j]== 0) print(36); // debugging only
237 // print newline followed by string number s (unless at start of line)
238 void print_nl_ (char * s)
240 if (((term_offset > 0) && (odd(selector))) ||
241 ((file_offset > 0) && (selector >= log_only)))
246 // print string number s preceded by escape character
247 void print_esc_ (char * s)
252 if (c < 256) print(c);
257 void print_the_digs_ (eight_bits k)
262 print_char('0' + dig[k]);
264 print_char('A' + dig[k]);
268 void print_int_ (integer n)
291 dig[k]= (char) (n % 10);
298 void print_cs_ (integer p)
300 if (p < 514) /* if p < hash_base then ... p.262 */
301 if (p >= 257) /* if p > single_base then ... p.262 */
302 if (p == 513) /* if p = null_cs then ... p.262 */
305 print_esc("endcsname");
308 //print_esc(p - 257); /* p - single_base */
309 print_esc("");print(p - 257);
310 /* if cat_code(p - single_base) = letter then ... p.262 */
311 if (eqtb[(hash_size + 1883) + p - 257].hh.v.RH == 11)
315 print_esc("IMPOSSIBLE.");
317 else if (p >= (hash_size + 781)) /* undefined_control_sequence */
318 print_esc("IMPOSSIBLE.");
319 else if ((hash[p].v.RH >= str_ptr))
320 print_esc("NONEXISTENT.");
322 //print_esc(hash[p].v.RH);
323 print_esc(""); print(hash[p].v.RH);
324 print_char(32); /* */
328 void sprint_cs_(halfword p)
330 if (p < 514) /* if p < hash_base then ... p.263 */
331 if (p < 257) /* if p < single_base then ... p.263 */
332 print(p - 1); /* print (p - active_base); */
333 else if (p < 513) /* else if p < null_cs then ... */
334 //print_esc(p - 257); /* print (p - single_base); */
335 {print_esc(""); print(p-257);}
338 print_esc("endcsname");
340 else //print_esc(hash[p].v.RH);
342 print_esc(""); print(hash[p].v.RH);
346 /* ! I can't find file ` c:/foo/ accents .tex '. */
347 void print_file_name_(integer n, integer a, integer e)
349 /* sprintf(log_line, "\na %d n %d e %d\n", a, n, e); */
350 /* show_line(log_line, 0); */
351 // print_char(33); // debugging only
353 // print_char(33); // debugging only
355 // print_char(33); // debugging only
357 // print_char(33); // debugging only
360 void print_size_(integer s)
363 print_esc("textfont");
365 print_esc("scriptfont");
367 print_esc("scriptscriptfont");
370 void print_write_whatsit_(str_number s, halfword p)
373 print_esc(""); print(s);
374 if (mem[p + 1].hh.v.LH < 16)
375 print_int(mem[p + 1].hh.v.LH);
376 else if (mem[p + 1].hh.v.LH == 16)
378 else print_char('-');
383 // called from itex.c and tex0.c only NASTY NASTY!
384 // now uses uses non-local goto (longjmp) 1999/Nov/7
387 close_files_and_terminate();
395 if (trace_flag) show_line("EXITING at JUMPOUT\n", 0);
397 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
398 // if (endit(history) != 0) history = 2; /* 93/Dec/26 in local.c */
399 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
401 // abort_flag++; // TURN OFF THE POWER ???
403 if ((history != 0) && (history != 1))
408 // longjmp(jumpbuffer, code+1);
412 // deal with error by asking for user response 0-9, D, E, H, I, X, Q, R, S
413 // NOTE: this may JUMPOUT either via X, or because of too many errors
417 integer s1, s2, s3, s4;
418 if (history < 2) history = 2;
423 if (interaction == 3)
426 clear_for_error_prompt();
430 term_input(264, help_ptr);
432 if (last == first) return; // no input
433 c = buffer[first]; // analyze first letter typed
434 if (c >= 97) // uppercase letter first
435 c = (unsigned char) (c - 32);
447 if (deletions_allowed) {
452 align_state = 1000000L;
453 OK_to_interrupt = false;
454 if ((last > first + 1) && (buffer[first + 1]>= 48) && (buffer[first + 1]<= 57))
455 c = (unsigned char) (c * 10 + buffer[first + 1]- 48 * 11);
457 c = (unsigned char) (c - 48);
466 OK_to_interrupt = true;
467 help2("I have just deleted some text, as you asked.",
468 "You can now delete more, or insert, or whatever.");
470 goto lab22; /* loop again */
478 goto lab22; /* loop again */
484 edit_name_start = str_start[input_stack[base_ptr].name_field];
485 edit_name_length = str_start[input_stack[base_ptr].name_field + 1] -
486 str_start[input_stack[base_ptr].name_field];
489 // return; // can drop through now 99/Oct/20
497 use_err_help = false;
500 help2("Sorry, I don't know how to help in this situation.",
501 "Maybe you should try asking a human?");
504 print_string(help_line[help_ptr]);
506 } while (!(help_ptr == 0));
508 help4("Sorry, I already gave what help I could...",
509 "Maybe you should try asking a human?",
510 "An error might have occurred before I noticed any problems.",
511 "``If all else fails, read the instructions.''");
512 goto lab22; /* loop again */
517 begin_file_reading();
518 if (last > first + 1)
520 cur_input.loc_field = first + 1;
525 print_string("insert>");
528 cur_input.loc_field = first;
531 cur_input.limit_field = last - 1;
540 interaction = 0 + c - 81; /* Q = 0, R = 1, S = 2, T = 3 */
541 print_string("OK, entering ");
545 print_esc("batchmode"); /* */
550 print_esc("nonstopmode"); /* */
553 print_esc("scrollmode"); /* */
568 // return; // can drop through now 99/Oct/20
574 } /* end of switch analysing response character */
576 print_string("Type <return> to proceed, S to scroll future error messages,");
577 print_nl("R to run without stopping, Q to run quietly,"); /* */
578 print_nl("I to insert something, "); /* */
579 if (base_ptr > 0) print_string("E to edit your file,");
580 if (deletions_allowed) print_nl("1 or ... or 9 to ignore the next 1 to 9 tokens of input,"); /* */
581 print_nl("H for help, X to quit."); /* */
583 } /* end of while(true) loop */
586 if (error_count == 100) {
587 print_nl("(That makes 100 errors; please try again.)");
590 // return; // can drop through now 99/Oct/20
592 if (interaction > 0) decr(selector);
597 else while(help_ptr > 0){
599 print_nl(help_line[help_ptr]);
602 if (interaction > 0)incr(selector);
606 void fatal_error_(char * s)
608 normalize_selector();
609 print_err("Emergency stop");
612 if (interaction == 3)interaction = 2;
618 if (interaction > 0)debug_help();
622 // return; // can drop through now 99/Oct/20
626 void overflow_(char * s, integer n)
628 normalize_selector();
629 print_err("TeX capacity exceeded, sorry[");
634 help2("If you really absolutely need more capacity,",
635 "you can ask a wizard to enlarge me.");
636 if (! knuth_flag) { /* Additional comments 98/Jan/5 */
637 if (!strcmp(s, "pattern memory") && n == trie_size) {
638 sprintf(log_line, "\n (Maybe use -h=... on command line in ini-TeX)\n");
639 show_line(log_line, 0);
640 } else if (!strcmp(s, "exception dictionary") && n == hyphen_prime) {
641 sprintf(log_line, "\n (Maybe use -e=... on command line in ini-TeX)\n");
642 show_line(log_line, 0);
645 if (interaction == 3)
659 void confusion_(char * s)
661 normalize_selector();
663 print_err("This can't happen(");
666 help1("I'm broken. Please show this to someone who can fix can fix");
668 print_err("I can't go on meeting you like this");
669 help2("One of your faux pas seems to have wounded me deeply...",
670 "in fact, I'm barely conscious. Please fix it and try again.");
673 if (interaction == 3)
688 bool init_terminal (void)
690 register bool Result;
695 cur_input.loc_field = first;
696 while((cur_input.loc_field < last) && (buffer[cur_input.loc_field]== ' '))
697 incr(cur_input.loc_field); // step over initial white space
698 if (cur_input.loc_field < last){
700 return Result; // there is an input file name
704 // failed to find input file name
708 flag = ConsoleInput("**", "Please type a file name or a control sequence\r\n(or ^z to exit)", (char *) &buffer[first]);
709 last = first + strlen((char *) &buffer[first]); /* -1 ? */
710 // may need to be more elaborate see input_line in texmf.c
712 (void) fputs("**", stdout);
714 flag = input_ln(stdin, true);
718 show_line("! End of file on the terminal... why?\n", 1);
723 cur_input.loc_field = first;
724 while ((cur_input.loc_field < last) && (buffer[cur_input.loc_field]== ' '))
725 incr(cur_input.loc_field); // step over intial white space
726 if (cur_input.loc_field < last) {
728 return Result; // there is an input file name
730 sprintf(log_line, "%s\n", "Please type the name of your input file.");
731 show_line(log_line, 1);
735 // Make string from str_start[str_ptr]to pool_ptr
736 str_number make_string (void)
738 register str_number Result;
739 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
740 #ifdef ALLOCATESTRING
741 if (str_ptr == current_max_strings)
742 str_start = realloc_str_start(increment_max_strings);
743 if (str_ptr == current_max_strings) {
744 // printf("**********MAKESTRING**********"); // debugging only
745 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/9 */
746 return 0; // abort_flag set
749 if (str_ptr == max_strings) {
750 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
751 return 0; // abort_flag set
755 str_start[str_ptr] = pool_ptr;
756 Result = str_ptr - 1;
760 bool str_eq_buf_ (str_number s, integer k)
762 register bool Result;
766 while (j < str_start[s + 1]) {
767 if (str_pool[j]!= buffer[k])
776 lab45: Result = result;
780 bool str_eq_str_ (str_number s, str_number t)
782 register bool Result;
786 if ((str_start[s + 1] - str_start[s]) != (str_start[t + 1] - str_start[t]))
790 while (j < str_start[s + 1]) {
791 if (str_pool[j] != str_pool[k])
797 lab45: Result = result;
801 void print_two_(integer n)
804 print_char('0' + (n / 10));
805 print_char('0' + (n % 10));
808 void print_hex_(integer n)
814 dig[k] = (unsigned char) (n % 16);
821 void print_roman_int_(integer n)
824 nonnegative_integer u, v;
825 j = str_start[260]; /* m2d5c2l5x2v5i */
829 print_char(str_pool[j]);
835 u = v / (str_pool[k - 1]- 48);
836 if (str_pool[k - 1]== 50)
839 u = u / (str_pool[k - 1]- 48);
843 print_char(str_pool[k]);
847 v = v / (str_pool[j - 1]- 48);
852 void print_current_string (void)
855 j = str_start[str_ptr];
856 while (j < pool_ptr) {
857 print_char(str_pool[j]);
862 int stringlength (int str_ptr)
865 nstart = str_start[str_ptr];
866 nnext = str_start[str_ptr + 1];
867 return (nnext - nstart) + 2;
870 char * add_string (char *s, int str_ptr)
872 int nstart, nnext, n;
873 nstart = str_start[str_ptr];
874 nnext = str_start[str_ptr + 1];
876 memcpy(s, &str_pool[nstart], n);
885 // make one long \r\n separated string out of help lines
886 // str_pool is packed_ASCII_code *
888 char * make_up_help_string (int nhelplines)
890 char * helpstring, *s;
893 // get length of help for this specific message
894 for (k = nhelplines-1; k >= 0; k--) {
895 //nlen += stringlength(help_line[k]);
896 nlen += strlen(help_line[k]);
898 nlen += 2; // for blank line separator
900 nlen += stringlength(265);
901 nlen += stringlength(266);
902 nlen += stringlength(267);
903 if (base_ptr > 0)nlen += stringlength(268);
904 if (deletions_allowed)nlen += stringlength(269);
905 nlen += stringlength(270);
907 helpstring = (char *) malloc(nlen+1);
909 for (k = nhelplines-1; k >= 0; k--) {
910 s = add_string(s, help_line[k]);
915 s = add_string(s, 265); /* Type <return> to proceed, S to scroll future error messages, */
916 s = add_string(s, 266); /* R to run without stopping, Q to run quietly, */
917 s = add_string(s, 267); /* I to insert something, */
918 if (base_ptr > 0)s = add_string(s, 268); /* E to edit your file, */
919 if (deletions_allowed)s = add_string(s, 269); /* 1 or ... or 9 to ignore the next 1 to 9 tokens of input, */
920 s = add_string(s, 270); /* H for help, X to quit. */
925 char * make_up_query_string (int promptstr)
928 int nstart, nnext, n;
930 nstart = str_start[ promptstr];
931 nnext = str_start[ promptstr + 1];
933 querystr = (char *) malloc(n + 1);
935 memcpy(s, &str_pool[nstart], n);
941 // abort_flag set if input_line / ConsoleInput returns non-zero
942 // should set interrupt instead ???
943 // called from tex0.c, tex2.c, tex3.c
945 // void term_input(void)
946 void term_input (int promptstr, int nhelplines)
950 char * helpstring = NULL;
951 char * querystring = NULL;
952 // if (nhelplines != 0) {
953 // helpstring = make_up_help_string (nhelplines);
954 // printf(helpstring);
957 show_line("\n", 0); // force it to show what may be buffered up ???
960 if (promptstr != 0) querystring = make_up_query_string (promptstr);
961 if (nhelplines != 0) helpstring = make_up_help_string (nhelplines);
962 if (helpstring == NULL && querystring != NULL) {
963 if (strcmp(querystring, ": ") == 0)
964 helpstring = xstrdup("Please type another file name (or ^z to exit):");
965 else if (strcmp(querystring, "=>") == 0) // from firm_up_the_line
966 helpstring = xstrdup("Please type <enter> to accept this line\r\nor type a replacement line");
967 else if (strcmp(querystring, "insert>") == 0) // from error() after "I"
968 helpstring = xstrdup("Please type something to insert here");
969 else if (strcmp(querystring, "") == 0) // from read_toks
970 helpstring = xstrdup("Please type a control sequence");
971 else if (strcmp(querystring, "= ") == 0) // from read_toks
972 helpstring = xstrdup("Please type a token");
973 else if (strcmp(querystring, "*") == 0) // get_next
974 helpstring = xstrdup("Please type a control sequence\r\n(or ^z to exit)");
975 // else if (strcmp(querystring, "**") == 0) // init_terminal
976 // helpstring = xstrdup("Please type a control sequence or a file name\r\n(or ^z to exit)");
977 // else if (strcmp(querystring, "? ") == 0) // from error()
978 // helpstring = xstrdup("Please type a character to select an action");
980 flag = ConsoleInput(querystring, helpstring, (char *) &buffer[first]); // ???
981 // flag == 0 means trouble --- EOF on terminal
982 if (querystring != NULL) free(querystring);
983 if (helpstring != NULL) free(helpstring);
984 helpstring = querystring = NULL;
986 last = first + strlen((char *) &buffer[first]); /* -1 ? */
987 // flag = (last > first);
988 // may need to be more elaborate see input_line in texmf.c ???
989 // sprintf(log_line, "first %d last %d flag %d - %s",
990 // first, last, flag, (char *) &buffer[first]);
991 // winerror(log_line);
994 flag = input_ln(stdin, true);
997 fatal_error("End of file on the terminal!"); /* */
998 return; // abort_flag set
1002 // echo what was typed into Console buffer also
1004 {register integer for_end; k = first; for_end = last - 1;
1005 if (k <= for_end) do
1007 while(k++ < for_end);
1011 decr(selector); // shut off echo
1013 {register integer for_end; k = first; for_end = last - 1;
1014 if (k <= for_end) do
1016 while(k++ < for_end);
1019 incr(selector); // reset selector again
1023 void int_error_ (integer n)
1031 void normalize_selector (void)
1039 if (interaction == 0)
1043 void pause_for_instructions (void)
1045 if (OK_to_interrupt) {
1047 if ((selector == 18)||(selector == 16))
1049 print_err("Interruption");
1051 "Try to insert some instructions for me (e.g.,`I\\showlists'),",
1052 "unless you just want to quit by typing `X'.");
1053 deletions_allowed = false;
1055 deletions_allowed = true;
1060 integer half_(integer x)
1062 register integer Result;
1065 else Result = x / 2;
1069 scaled round_decimals_(small_number k)
1071 register scaled Result;
1076 a = (a + dig[k]* 131072L) / 10; /* 2^17 */
1082 /* This has some minor speedup changes - no real advantage probably ... */
1083 void print_scaled_(scaled s)
1091 print_int(s / 65536L);
1093 s = 10 * (s % 65536L) + 5;
1097 s = s - 17232; /* 2^15 - 50000 - rounding */
1098 print_char('0' + (s / 65536L));
1099 s = 10 * (s % 65536L);
1101 } while (!(s <= delta));
1104 scaled mult_and_add_(integer n, scaled x, scaled y, scaled maxanswer)
1106 register scaled Result;
1114 else if (((x <= (maxanswer - y) / n) && (- (integer) x <= (maxanswer + y) / n)))
1123 scaled x_over_n_(scaled x, integer n)
1125 register scaled Result;
1143 tex_remainder = x % n;
1145 Result = - (integer) ((- (integer) x)/ n);
1146 tex_remainder = - (integer) ((- (integer) x)% n);
1150 tex_remainder = - (integer) tex_remainder;
1154 scaled xn_over_d_(scaled x, integer n, integer d)
1156 register scaled Result;
1158 nonnegative_integer t, u, v;
1165 /* t =(x % 32768L)* n; */
1166 t =(x & 32767L) * n;
1167 /* u =(x / 32768L)* n +(t / 32768L); */
1168 u =(x >> 15) * n + (t >> 15);
1169 /* v =(u % d)* 32768L +(t % 32768L); */
1170 v =((u % d) << 15) + (t & 32767L);
1171 if (u / d >= 32768L)
1173 /* else u = 32768L *(u / d)+(v / d); */
1174 else u =((u / d) << 15) + (v / d);
1178 tex_remainder = v % d;
1180 Result = - (integer) u;
1181 tex_remainder = - (integer)(v % d);
1186 halfword badness_(scaled t, scaled s)
1188 register halfword Result;
1197 else if (s >= 1663497L)
1203 /* safe to assume that r is positive ? */
1204 /* else Result =(r * r * r + 131072L)/ 262144L; */
1205 else Result = (r * r * r + 131072L) >> 18; /* 2^17 */
1211 void print_word_(memory_word w)
1215 print_scaled(w.cint);
1217 print_scaled(round(65536L * w.gr));
1219 print_int(w.hh.v.LH);
1225 print_int(w.hh.v.RH);
1227 print_int(w.qqqq.b0);
1229 print_int(w.qqqq.b1);
1231 print_int(w.qqqq.b2);
1233 print_int(w.qqqq.b3);
1235 /* need this version only if SHORTFONTINFO defined */
1236 void zprintfword(fmemoryword w)
1240 print_scaled(w.cint);
1242 print_scaled(round(65536L * w.gr));
1244 print_int(w.hh.v.LH);
1248 print_int(w .hh.b1);
1250 print_int(w.hh.v.RH);
1252 print_int(w.qqqq.b0);
1254 print_int(w.qqqq.b1);
1256 print_int(w.qqqq.b2);
1258 print_int(w.qqqq.b3);
1262 void show_token_list_(integer p, integer q, integer l)
1265 ASCII_code matchchr;
1270 /* while (p<>null) and (tally<l) do l.6239 */
1271 while ((p != 0) && (tally < l)) {
1274 first_count = tally;
1275 trick_count = tally + 1 + error_line - half_error_line;
1276 if (trick_count < error_line)
1277 trick_count = error_line;
1279 if ((p < hi_mem_min) || (p > mem_end))
1281 print_esc("CLOBBERED.");
1284 if (mem[p].hh.v.LH >= 4095)
1285 print_cs(mem[p].hh.v.LH - 4095);
1287 m = mem[p].hh.v.LH / 256;
1288 c = mem[p].hh.v.LH % 256;
1289 if (mem[p].hh.v.LH < 0)
1315 print_char(c + '0');
1324 matchchr = (ASCII_code) c;
1342 /* if p<>null then print_esc("ETC."); l.6244 */
1350 if (scanner_status > 1)
1352 print_nl("Runaway ");
1353 switch (scanner_status)
1357 print_string("definition");
1363 print_string("argument");
1369 print_string("preamble");
1375 print_string("text");
1382 /* p may be used without being initialized -- OK */
1383 show_token_list(mem[p].hh.v.RH, 0, error_line - 10);
1387 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1388 /* first try list of available nodes (avail != NULL) */
1389 /* then see if can go upwards (mem_end < mem_max) */
1390 /* then see if can go downwards (hi_mem_min > lo_mem_max) */
1391 /* if not, extend memory at the top and grab from there --- new */
1392 /* else fail ! paragraph 120 */
1393 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1394 halfword get_avail (void)
1396 register halfword Result;
1399 if (p != 0) /* while p<>null do */
1400 avail = link(avail);
1401 else if (mem_end < mem_max) /* mem_end + 1 < mem_max ? NO */
1408 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1409 if (hi_mem_min <= lo_mem_max) { /* have we run out in middle ? */
1410 incr(hi_mem_min); /* undo the change */
1411 /* realloc_main (0, mem_top/2); */ /* extend main memory at hi end */
1412 mem = realloc_main (0, mem_top / 2); /* zzzaa = zmem = mem */
1416 /* presumably now mem_end < mem_max - but need test in case allocation fails */
1417 if (mem_end >= mem_max) {
1419 overflow("main memory size", mem_max + 1 - mem_min); /* main memory size */
1420 return 0; // abort_flag set
1422 incr(mem_end); /* then grab from new area */
1423 p = mem_end; /* 1993/Dec/14 */
1425 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1427 mem[p].hh.v.RH = 0; /* link(p) = null !!! */
1436 void flush_list_(halfword p) /* paragraph 123 */
1439 if (p != 0) /* null !!! */
1449 } while (!(r == 0)); /* r != null */
1455 halfword get_node_(integer s)
1457 register halfword Result;
1464 q = p + mem[p].hh.v.LH;
1465 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1466 /* while((mem[q].hh.v.RH == 262143L)) { */ /* NO! */
1467 while ((mem[q].hh.v.RH == empty_flag)) {
1468 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1470 /* should never happen, since this field is reference count for zeroglue */
1471 } /* debugging code 93/DEC/15 */ /* eventually remove */
1472 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1473 t = mem[q + 1].hh.v.RH;
1476 mem[t + 1].hh.v.LH = mem[q + 1].hh.v.LH;
1477 mem[mem[q + 1].hh.v.LH + 1].hh.v.RH = t;
1478 q = q + mem[q].hh.v.LH;
1481 if (r > toint(p + 1))
1483 mem[p].hh.v.LH = r - p;
1488 if (mem[p + 1].hh.v.RH != p)
1490 rover = mem[p + 1].hh.v.RH;
1491 t = mem[p + 1].hh.v.LH;
1492 mem[rover + 1].hh.v.LH = t;
1493 mem[t + 1].hh.v.RH = rover;
1496 mem[p].hh.v.LH = q - p;
1497 p = mem[p + 1].hh.v.RH;
1498 } while (!(p == rover));
1499 if (s == 1073741824L) /* 2^30 - special case - merge adjacent */
1501 Result = empty_flag;
1502 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1504 show_line("Merged adjacent multi-word nodes\n", 0);
1505 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1508 /* maybe try downward epxansion first instead ? */
1509 if (lo_mem_max + 2 < hi_mem_min)
1510 /* if (lo_mem_max + 2 <= 262143L) */ /* NO! */
1511 if (lo_mem_max + 2 <= mem_bot + max_halfword) /* silly ? flush 93/Dec/16 */
1513 /* if (hi_mem_min - lo_mem_max >= 1998) */
1514 if (hi_mem_min - lo_mem_max >= (block_size + block_size - 2))
1515 /* t = lo_mem_max + 1000; */
1516 t = lo_mem_max + block_size;
1518 t = lo_mem_max + 1 +(hi_mem_min - lo_mem_max) / 2;
1519 p = mem[rover + 1].hh.v.LH;
1521 mem[p + 1].hh.v.RH = q;
1522 mem[rover + 1].hh.v.LH = q;
1523 /* if (t > 262143L) t = 262143L; */ /* NO! */
1524 if (t > mem_bot + max_halfword)
1525 t = mem_bot + max_halfword; /* silly ? flush 93/Dec/16 */
1526 mem[q + 1].hh.v.RH = rover;
1527 mem[q + 1].hh.v.LH = p;
1528 mem[q].hh.v.RH = empty_flag;
1529 mem[q].hh.v.LH = t - lo_mem_max; /* block size */
1531 mem[lo_mem_max].hh.v.RH = 0;
1532 mem[lo_mem_max].hh.v.LH = 0;
1536 /* overflow("main memory size", mem_max + 1 - mem_min); */ /* what used to happen! */
1537 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1538 /* we've run out of space in the middle for variable length blocks */
1539 /* try and add new block from below mem_bot *//* first check if space ! */
1540 if (mem_min - (block_size + 1) <= mem_start) {/* extend lower memory downwards */
1541 /* realloc_main (mem_top/2, 0); */
1542 mem = realloc_main (mem_top/2 + block_size, 0); /* zzzaa = zmem = mem */
1547 /* if (trace_flag) show_line("Extending downwards by %d\n", block_size, 0); */
1548 if (mem_min - (block_size + 1) <= mem_start) { /* check again */
1550 sprintf(log_line, "mem_min %d, mem_start %d, block_size %d\n", mem_min, mem_start, block_size);
1551 show_line(log_line, 0);
1553 overflow("main memory size", mem_max + 1 - mem_min); /* darn: allocation failed ! */
1554 return 0; // abort_flag set
1556 /* avoid function call in following ? */
1557 add_variable_space (block_size); /* now to be found in itex.c */
1558 goto lab20; /* go try get_node again */
1559 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1561 lab40: mem[r].hh.v.RH = 0;
1564 var_used = var_used + s;
1567 /* if (trace_flag) {
1568 if (r == 0) show_line("r IS ZERO in ZGETNODE!\n", 0);
1569 } */ /* debugging code 93/dec/15 */
1575 void free_node_(halfword p, halfword s)
1579 mem[p].hh.v.RH = empty_flag;
1580 q = mem[rover + 1].hh.v.LH;
1581 mem[p + 1].hh.v.LH = q;
1582 mem[p + 1].hh.v.RH = rover;
1583 mem[rover + 1].hh.v.LH = p;
1584 mem[q + 1].hh.v.RH = p;
1587 var_used = var_used - s;
1591 halfword new_null_box (void)
1593 register halfword Result;
1598 mem[p + 1].cint = 0;
1599 mem[p + 2].cint = 0;
1600 mem[p + 3].cint = 0;
1601 mem[p + 4].cint = 0;
1602 mem[p + 5].hh.v.RH = 0;
1603 mem[p + 5].hh.b0 = 0;
1604 mem[p + 5].hh.b1 = 0;
1605 mem[p + 6].gr = 0.0;
1610 // @ A new rule node is delivered by the |new_rule| function. It
1611 // makes all the dimensions ``running,'' so you have to change the
1612 // ones that are not allowed to run.
1614 halfword new_rule (void)
1616 register halfword Result;
1618 p = get_node(4); /* rule_node_size */
1619 mem[p].hh.b0 = 2; /* rule_node type */
1620 mem[p].hh.b1 = 0; /* sub_type zero */
1621 mem[p + 1].cint = -1073741824L; /* -2^30 null_flag width */
1622 mem[p + 2].cint = -1073741824L; /* -2^30 null_flag depth */
1623 mem[p + 3].cint = -1073741824L; /* -2^30 null_flag height */
1628 // @ The |new_ligature| function creates a ligature node having given
1629 // contents of the |font|, |character|, and |lig_ptr| fields.
1631 halfword new_ligature_(quarterword f, quarterword c, halfword q)
1633 register halfword Result;
1635 p = get_node(2); /* small_node_size */
1636 mem[p].hh.b0 = 6; /* ligature_node type */
1637 mem[p + 1].hh.b0 = f; /* font */
1638 mem[p + 1].hh.b1 = c; /* character */
1639 mem[p + 1].hh.v.RH = q; /* pointer */
1640 mem[p].hh.b1 = 0; /* subtype zero */
1645 // We also have a |new_lig_item| function, which returns a two-word
1646 // node having a given |character| field. Such nodes are used for
1647 // temporary processing as ligatures are being created.
1649 halfword new_lig_item_(quarterword c)
1651 register halfword Result;
1653 p = get_node(2); /* small_node_size */
1654 mem[p].hh.b1 = c; /* character */
1655 mem[p + 1].hh.v.RH = 0; /* lig_ptr(p):=null; */
1660 halfword new_disc (void)
1662 register halfword Result;
1667 mem[p + 1].hh.v.LH = 0; /* pre_break(p):=null; */
1668 mem[p + 1].hh.v.RH = 0; /* post_break(p):=null; */
1673 halfword new_math_(scaled w, small_number s)
1675 register halfword Result;
1680 mem[p + 1].cint = w;
1685 halfword new_spec_(halfword p)
1687 register halfword Result;
1692 mem[q + 1].cint = mem[p + 1].cint;
1693 mem[q + 2].cint = mem[p + 2].cint;
1694 mem[q + 3].cint = mem[p + 3].cint;
1699 halfword new_param_glue_(small_number n)
1701 register halfword Result;
1706 mem[p].hh.b1 = n + 1; /* conversion int to unsigned short */
1707 mem[p + 1].hh.v.RH = 0;
1708 q = eqtb[(hash_size + 782) + n].hh.v.RH; /* gluebase + n */
1709 mem[p + 1].hh.v.LH = q;
1710 incr(mem[q].hh.v.RH);
1715 halfword new_glue_(halfword q)
1717 register halfword Result;
1722 mem[p + 1].hh.v.RH = 0;
1723 mem[p + 1].hh.v.LH = q;
1724 incr(mem[q].hh.v.RH);
1729 halfword new_skip_param_(small_number n)
1731 register halfword Result;
1733 temp_ptr = new_spec(eqtb[(hash_size + 782) + n].hh.v.RH); /* gluebase + n */
1734 p = new_glue(temp_ptr);
1735 mem[temp_ptr].hh.v.RH = 0;
1736 mem[p].hh.b1 = n + 1; /* conversion int to unsigned short */
1741 halfword new_kern_(scaled w)
1743 register halfword Result;
1748 mem[p + 1].cint = w;
1753 halfword new_penalty_(integer m)
1755 register halfword Result;
1760 mem[p + 1].cint = m;
1766 void check_mem_(bool printlocs)
1771 register integer for_end;
1773 for_end = lo_mem_max;
1774 if (p <= for_end) do
1776 while (p++ < for_end);
1779 register integer for_end;
1782 if (p <= for_end) do
1784 while (p++ < for_end);
1789 while (p != 0) { /* while p<>null do */
1790 if ((p > mem_end) || (p < hi_mem_min))
1792 else if (freearr[p])
1796 print_nl("AVAIL list clobbered at ");
1806 q = 0; /* q:=null */
1809 if ((p >= lo_mem_max) || (p < mem_min))
1811 else if ((mem[p + 1].hh.v.RH >= lo_mem_max) || (mem[p + 1].hh.v.RH < mem_min))
1813 /* else if (!((mem[p].hh.v.RH == 262143L)) ||(mem[p].hh *//*NO!*/
1814 else if (!((mem[p].hh.v.RH == empty_flag)) ||
1815 (mem[p].hh .v.LH < 2) ||
1816 (p + mem[p].hh.v.LH > lo_mem_max) ||
1817 (mem[mem[p + 1].hh.v.RH + 1].hh.v.LH != p))
1821 print_nl("Double-AVAIL list clobbered at ");
1826 register integer for_end;
1828 for_end = p + mem[p].hh.v.LH - 1;
1829 if (q <= for_end) do
1833 print_nl("Doubly free location at ");
1838 } while (q++ < for_end);
1841 p = mem[p + 1].hh.v.RH;
1842 } while (!(p == rover));
1845 while (p <= lo_mem_max) {
1846 if ((mem[p].hh.v.RH == empty_flag))
1848 print_nl("Bad flag at ");
1851 while ((p <= lo_mem_max) && !freearr[p]) incr(p);
1852 while ((p <= lo_mem_max) && freearr[p]) incr(p);
1856 print_nl("New busy locs:");
1858 register integer for_end;
1860 for_end = lo_mem_max;
1861 if (p <= for_end) do
1862 if (!freearr[p] && ((p > was_lo_max) || wasfree[p]))
1866 } while (p++ < for_end);
1869 register integer for_end;
1872 if (p <= for_end) do
1873 if (!freearr[p] && ((p < was_hi_min) || (p > was_mem_end) || wasfree[p]))
1877 } while (p++ < for_end);
1881 register integer for_end;
1883 for_end = lo_mem_max;
1884 if (p <= for_end) do
1885 wasfree[p]= freearr[p];
1886 while (p++ < for_end);
1889 register integer for_end;
1892 if (p <= for_end) do
1893 wasfree[p] = freearr[p];
1894 while (p++ < for_end);
1896 was_mem_end = mem_end;
1897 was_lo_max = lo_mem_max;
1898 was_hi_min = hi_mem_min;
1903 void search_mem_(halfword p)
1907 register integer for_end;
1909 for_end = lo_mem_max;
1910 if (q <= for_end) do
1924 } while (q++ < for_end);
1927 register integer for_end;
1930 if (q <= for_end) do
1944 } while (q++ < for_end);
1947 register integer for_end;
1949 for_end = (hash_size + 1833);
1950 if (q <= for_end) do
1952 if (eqtb[q].hh.v.RH == p)
1958 } while(q++ < for_end);
1962 register integer for_end;
1964 for_end = save_ptr - 1;
1965 if (q <= for_end) do
1967 if (save_stack[q].hh.v.RH == p)
1973 } while (q++ < for_end);
1975 /* {register integer for_end; q = 0; for_end = 607; if (q <= for_end) do */
1977 register integer for_end;
1979 for_end = hyphen_prime;
1980 if (q <= for_end) do
1982 if (hyph_list[q]== p)
1988 } while(q++ < for_end);
1993 void short_display_(integer p)
1996 /* while(p > mem_min){ */
1997 while (p != 0) { /* want p != null here bkph 93/Dec/15 !!! */
1998 /* NOTE: still not fixed in 3.14159 ! */
1999 if ((p >= hi_mem_min)) /* is_char_node(p) */
2003 if (mem[p].hh.b0 != font_in_short_display) /* font(p) */
2005 if ((mem[p].hh.b0 > font_max))
2007 /* else print_esc(hash[(hash_size + 524) + mem[p].hh.b0].v.RH); */
2008 else //print_esc(hash[(hash_size + hash_extra + 524) + mem[p].hh.b0].v.RH);
2009 {print_esc("");print(hash[(hash_size + hash_extra + 524) + mem[p].hh.b0].v.RH);}
2012 font_in_short_display = mem[p].hh.b0;
2014 print(mem[p].hh.b1); /* character(p) */
2016 } else switch (mem[p].hh.b0)
2031 if (mem[p + 1].hh.v.LH != 0)
2038 short_display(mem[p + 1].hh.v.RH);
2042 short_display(mem[p + 1].hh.v.LH);
2043 short_display(mem[p + 1].hh.v.RH);
2046 if (link(p) != 0) /* if link(p)<>null then */
2060 void print_font_and_char_ (integer p)
2063 print_esc("CLOBBERED.");
2065 if ((mem[p].hh.b0 > font_max)) /* font(p) */
2066 print_char(42); /* * */
2067 /* else print_esc(hash[(hash_size + 524) + mem[p].hh.b0].v.RH); */
2069 //print_esc(hash[(hash_size + hash_extra + 524) + mem[p].hh.b0].v.RH); /* 96/Jan/10 */
2070 {print_esc("");print(hash[(hash_size + hash_extra + 524) + mem[p].hh.b0].v.RH);}
2072 print(mem[p].hh.b1); /* character(p) */
2076 void print_mark_ (integer p)
2079 if ((p < hi_mem_min)||(p > mem_end))
2080 print_esc("CLOBBERED.");
2082 show_token_list(mem[p].hh.v.RH, 0, max_print_line - 10);
2086 void print_rule_dimen_ (scaled d)
2088 if ((d == -1073741824L)) /* - 2^30 */
2094 void print_glue_(scaled d, integer order, str_number s)
2097 if ((order < 0)||(order > 3))
2098 print_string("foul");
2101 print_string("fil");
2110 void print_spec_(integer p, str_number s)
2112 if ((p < mem_min)||(p >= lo_mem_max))
2115 print_scaled(mem[p + 1].cint);
2118 if (mem[p + 2].cint != 0)
2120 print_string("plus");
2121 print_glue(mem[p + 2].cint, mem[p].hh.b0, s);
2123 if (mem[p + 3].cint != 0)
2125 print_string("minus");
2126 print_glue(mem[p + 3].cint, mem[p].hh.b1, s);
2131 void print_fam_and_char_(halfword p)
2134 print_int(mem[p].hh.b0);
2136 print(mem[p].hh.b1);
2139 void print_delimiter_(halfword p)
2142 a = mem[p].qqqq.b0 * 256 + mem[p].qqqq.b1;
2143 a = a * 4096 + mem[p].qqqq.b2 * 256 + mem[p].qqqq.b3;
2150 void print_subsidiary_data_(halfword p, ASCII_code c)
2152 if ((pool_ptr - str_start[str_ptr]) >= depth_threshold)
2154 if (mem[p].hh.v.RH != 0)
2158 str_pool[pool_ptr]= c;
2162 switch (mem[p].hh.v.RH)
2167 print_current_string();
2168 print_fam_and_char(p);
2175 if (mem[p].hh.v.LH == 0)
2178 print_current_string();
2190 void print_style_(integer c)
2195 print_esc("displaystyle");
2198 print_esc("textstyle");
2201 print_esc("scriptstyle");
2204 print_esc("scriptscriptstyle");
2207 print_string("Unknown style!");
2212 void print_skip_param_(integer n)
2216 case line_skip_code:
2217 print_esc("lineskip");
2219 case baseline_skip_code:
2220 print_esc("baselineskip");
2223 print_esc("parskip");
2225 case above_display_skip_code:
2226 print_esc("abovedisplayskip");
2228 case below_display_skip_code:
2229 print_esc("belowdisplayskip");
2231 case above_display_short_skip_code:
2232 print_esc("abovedisplayshortskip");
2234 case below_display_short_skip_code:
2235 print_esc("belowdisplayshortskip");
2237 case left_skip_code:
2238 print_esc("leftskip");
2240 case right_skip_code:
2241 print_esc("rightskip");
2244 print_esc("topskip");
2246 case split_top_skip_code:
2247 print_esc("splittopskip");
2250 print_esc("tabskip");
2252 case space_skip_code:
2253 print_esc("spaceskip");
2255 case xspace_skip_code:
2256 print_esc("xspaceskip");
2258 case par_fill_skip_code:
2259 print_esc("parfillskip");
2261 case thin_mu_skip_code:
2262 print_esc("thinmuskip");
2264 case med_mu_skip_code:
2265 print_esc("medmuskip");
2267 case thick_mu_skip_code:
2268 print_esc("thickmuskip");
2271 print_string("[unknown glue parameter!]");
2276 void show_node_list_(integer p)
2280 /* begin if cur_length>depth_threshold then */
2281 if ((pool_ptr - str_start[str_ptr]) > depth_threshold)
2283 /* if (p > 0) */ /* was p>null !!! line 3662 in tex.web */
2284 if (p != 0) /* fixed 94/Mar/23 BUG FIX */
2285 /* NOTE: still not fixed in 3.14159 ! */
2290 /* while(p > mem_min){ */ /* was p>mem_min !!! line 3667 in tex.web */
2291 while(p != 0){ /* want p != null - bkph 93/Dec/15 */
2292 /* NOTE: still not fixed in 3.14159 ! */
2294 print_current_string();
2297 print_string("Bad link, display aborted.");
2301 if (n > breadth_max)
2303 print_string("etc.");
2306 if ((p >= hi_mem_min))
2307 print_font_and_char(p);
2308 else switch (mem[p].hh.b0)
2314 if (mem[p].hh.b0 == 0)
2316 else if (mem[p].hh.b0 == 1)
2318 else print_esc("unset");
2319 print_string("box(");
2320 print_scaled(mem[p + 3].cint);
2322 print_scaled(mem[p + 2].cint);
2323 print_string(", shifted ");
2324 print_scaled(mem[p + 1].cint);
2325 if (mem[p].hh.b0 == 13)
2327 if (mem[p].hh.b1 != 0)
2330 print_int(mem[p].hh.b1 + 1);
2331 print_string(" columns)");
2333 if (mem[p + 6].cint != 0)
2335 print_string(", stretch");
2336 print_glue(mem[p + 6].cint, mem[p + 5].hh.b1, 0);
2338 if (mem[p + 4].cint != 0)
2340 print_string(", shrink");
2341 print_glue(mem[p + 4].cint, mem[p + 5].hh.b0, 0);
2345 if ((g != 0.0)&&(mem[p + 5].hh.b0 != 0))
2347 print_string(", glue set");
2348 if (mem[p + 5].hh.b0 == 2)
2350 if (fabs(g)> 20000.0)
2355 print_string("< -");
2356 print_glue(20000 * 65536L, mem[p + 5].hh.b1, 0);
2357 } else print_glue(round(65536L * g), mem[p + 5].hh.b1, 0);
2359 if (mem[p + 4].cint != 0)
2361 print_string("shifted");
2362 print_scaled(mem[p + 4].cint);
2367 str_pool[pool_ptr]= 46;
2370 show_node_list(mem[p + 5].hh.v.RH);
2378 print_rule_dimen(mem[p + 3].cint);
2380 print_rule_dimen(mem[p + 2].cint);
2382 print_rule_dimen(mem[p + 1].cint);
2387 print_esc("insert");
2388 print_int(mem[p].hh.b1);
2389 print_string(",natural size ");
2390 print_scaled(mem[p + 3].cint);
2391 print_string("; split(");
2392 print_spec(mem[p + 4].hh.v.RH, 0);
2394 print_scaled(mem[p + 2].cint);
2395 print_string("(; float cost");
2396 print_int(mem[p + 1].cint);
2399 str_pool[pool_ptr]= 46;
2402 show_node_list(mem[p + 4].hh.v.LH);
2408 switch (mem[p].hh.b1)
2412 print_write_whatsit(1279, p); /* debug # (-1 to exit): */
2414 print_file_name(mem[p + 1].hh.v.RH, mem[p + 2].hh.v.LH, mem[p + 2].hh.v.RH);
2419 print_write_whatsit(591, p); /* write */
2420 print_mark(mem[p + 1].hh.v.RH);
2424 print_write_whatsit(1280, p); /* closeout */
2428 print_esc("special");
2429 print_mark(mem[p + 1].hh.v.RH);
2434 print_esc("setlanguage");
2435 print_int(mem[p + 1].hh.v.RH);
2436 print_string(" (hyphenmin");
2437 print_int(mem[p + 1].hh.b0);
2439 print_int(mem[p + 1].hh.b1);
2444 print_string("whatsit");
2449 if (mem[p].hh.b1 >= 100)
2452 if (mem[p].hh.b1 == 101)
2454 else if (mem[p].hh.b1 == 102)
2456 print_string("leaders ");
2457 print_spec(mem[p + 1].hh.v.LH, 0);
2460 str_pool[pool_ptr]= 46;
2463 show_node_list(mem[p + 1].hh.v.RH);
2468 if (mem[p].hh.b1 != 0)
2471 if (mem[p].hh.b1 < 98)
2472 print_skip_param(mem[p].hh.b1 - 1);
2473 else if (mem[p].hh.b1 == 98)
2474 print_esc("nonscript");
2475 else print_esc("mskip");
2478 if (mem[p].hh.b1 != 98)
2481 if (mem[p].hh.b1 < 98)
2482 print_spec(mem[p + 1].hh.v.LH, 0);
2484 print_spec(mem[p + 1].hh.v.LH, 334); /* mu */
2489 if (mem[p].hh.b1 != 99)
2492 if (mem[p].hh.b1 != 0)
2494 print_scaled(mem[p + 1].cint);
2495 if (mem[p].hh.b1 == 2)
2496 print_string(" (for accent)");
2499 print_scaled(mem[p + 1].cint);
2506 if (mem[p].hh.b1 == 0)
2508 else print_string("off");
2509 if (mem[p + 1].cint != 0)
2511 print_string(", surrounded");
2512 print_scaled(mem[p + 1].cint);
2518 print_font_and_char(p + 1);
2519 print_string("(ligature");
2520 if (mem[p].hh.b1 > 1)
2522 font_in_short_display = mem[p + 1].hh.b0;
2523 short_display(mem[p + 1].hh.v.RH);
2524 if (odd(mem[p].hh.b1))
2531 print_esc("penalty ");
2532 print_int(mem[p + 1].cint);
2537 print_esc("discretionary");
2538 if (mem[p].hh.b1 > 0)
2540 print_string(" replacing ");
2541 print_int(mem[p].hh.b1);
2545 str_pool[pool_ptr]= 46;
2548 show_node_list(mem[p + 1].hh.v.LH);
2552 str_pool[pool_ptr]= 124;
2555 show_node_list(mem[p + 1].hh.v.RH);
2562 print_mark(mem[p + 1].cint);
2567 print_esc("vadjust");
2570 str_pool[pool_ptr]= 46;
2573 show_node_list(mem[p + 1].cint);
2579 print_style(mem[p].hh.b1);
2583 print_esc("mathchoice");
2585 str_pool[pool_ptr]= 68;
2588 show_node_list(mem[p + 1].hh.v.LH);
2591 str_pool[pool_ptr]= 84;
2594 show_node_list(mem[p + 1].hh.v.RH);
2597 str_pool[pool_ptr]= 83;
2600 show_node_list(mem[p + 2].hh.v.LH);
2603 str_pool[pool_ptr]= 115;
2606 show_node_list(mem[p + 2].hh.v.RH);
2626 switch (mem[p].hh.b0)
2629 print_esc("mathord");
2632 print_esc("mathop");
2635 print_esc("mathbin");
2638 print_esc("mathrel");
2641 print_esc("mathopen");
2644 print_esc("mathclose");
2647 print_esc("mathpunct");
2650 print_esc("mathinner");
2653 print_esc("overline");
2656 print_esc("underline");
2659 print_esc("vcenter");
2663 print_esc("radical");
2664 print_delimiter(p + 4);
2669 print_esc("accent");
2670 print_fam_and_char(p + 4);
2676 print_delimiter(p + 1);
2682 print_delimiter(p + 1);
2686 if (mem[p].hh.b1 != 0)
2687 if (mem[p].hh.b1 == 1)
2688 print_esc("limits");
2689 else print_esc("nolimits");
2690 if (mem[p].hh.b0 < 30)
2691 print_subsidiary_data(p + 1, 46);
2692 print_subsidiary_data(p + 2, 94);
2693 print_subsidiary_data(p + 3, 95);
2698 print_esc("fraction");
2699 if (mem[p + 1].cint == 1073741824L) /* 2^30 */
2700 print_string("= default");
2701 else print_scaled(mem[p + 1].cint);
2702 if ((mem[p + 4].qqqq.b0 != 0) || (mem[p + 4].qqqq.b1 != 0) ||
2703 (mem[p + 4].qqqq.b2 != 0) || (mem[p + 4].qqqq.b3 != 0))
2705 print_string(", left");
2706 print_delimiter(p + 4);
2708 if ((mem[p + 5].qqqq.b0 != 0) || (mem[p + 5].qqqq.b1 != 0) ||
2709 (mem[p + 5].qqqq.b2 != 0)||(mem[p + 5].qqqq.b3 != 0))
2711 print_string(", right");
2712 print_delimiter(p + 5);
2714 print_subsidiary_data(p + 2, 92);
2715 print_subsidiary_data(p + 3, 47);
2719 print_string("Unknown node type!");
2725 /* NOTE: 262143L should be empty_flag */