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
24 #pragma warning(disable:4244) /* 96/Jan/10 */
44 while (!(cur_cmd != spacer));
46 if (cur_tok == other_token + '-')
49 cur_tok = other_token + '+';
51 } while (!(cur_tok != other_token + '+'));
53 if (cur_tok == alpha_token)
57 if (cur_tok < cs_token_flag)
61 if (cur_cmd <= right_brace)
62 if (cur_cmd == right_brace)
67 else if (cur_tok < cs_token_flag + single_base)
68 cur_val = cur_tok - cs_token_flag - active_base;
70 cur_val = cur_tok - cs_token_flag - single_base;
74 print_err("Improper alphabetic constant");
75 help2("A one-character control sequence belongs after a ` mark.",
76 "So I'm essentially inserting \\0 here.");
84 if (cur_cmd != spacer)
88 else if ((cur_cmd >= min_internal) && (cur_cmd <= max_internal))
90 scan_something_internal(int_val, false);
95 m = 214748364L; /* 7FFFFFFF hex */
97 if (cur_tok == octal_token)
100 m = 268435456L; /* 2^28 */
103 else if (cur_tok == hex_token)
106 m = 134217728L; /* 2^27 8000000 hex */
115 if ((cur_tok < zero_token + radix) && (cur_tok >= zero_token) && (cur_tok <= zero_token + 9))
116 d = cur_tok - zero_token;
117 else if (radix == 16)
118 if ((cur_tok <= A_token + 5) && (cur_tok >= A_token))
119 d = cur_tok - A_token + 10;
120 else if ((cur_tok <= other_A_token + 5) && (cur_tok >= other_A_token))
121 d = cur_tok - other_A_token;
129 if ((cur_val >= m) && ((cur_val > m) || (d > 7) || (radix != 10)))
133 print_err("Number too big");
134 help2("I can only go up to 2147483647='17777777777=\"7FFFFFFF,",
135 "so I'm using that number instead of yours.");
137 cur_val = 2147483647L; /* 7FFFFFFF hex */
142 cur_val = cur_val * radix + d;
149 print_err("Missing number, treated as zero");
150 help3("A number should have been here; I inserted `0'.",
151 "(If you can't figure out why I needed to see a number,",
152 "look up `weird error' in the index to The TeXbook.)");
155 else if (cur_cmd != spacer)
160 cur_val = - (integer) cur_val;
163 void scan_dimen_(bool mu, bool inf, bool shortcut)
186 while (!(cur_cmd != spacer));
188 if (cur_tok == other_token + '-')
190 negative = ! negative;
191 cur_tok = other_token + '+';
193 } while (!(cur_tok != other_token + '+'));
195 if ((cur_cmd >= min_internal) && (cur_cmd <= max_internal))
199 scan_something_internal(mu_val, false);
201 if (cur_val_level >= glue_val)
204 delete_glue_ref(cur_val);
208 if (cur_val_level == mu_val)
211 if (cur_val_level != int_val)
216 scan_something_internal(dimen_val, false);
218 if (cur_val_level == dimen_val)
226 if (cur_tok == continental_point_token)
227 cur_tok = point_token;
229 if (cur_tok != point_token)
239 if (cur_tok == continental_point_token)
240 cur_tok = point_token;
242 if ((radix == 10) && (cur_tok == point_token))
245 p = 0; /* p:=null l.8883 */
252 if ((cur_tok > zero_token + 9) || (cur_tok < zero_token))
259 info(q) = cur_tok - zero_token;
265 for (kk = k; kk >= 1; kk--)
267 dig[kk - 1] = info(p);
273 f = round_decimals(k);
275 if (cur_cmd != spacer)
283 negative = !negative;
284 cur_val = - (integer) cur_val;
289 if (scan_keyword("fil"))
293 while (scan_keyword("l"))
295 if (cur_order == filll)
297 print_err("Illegal unit of measure(");
298 print_string("replaced by filll)");
299 help1("I dddon't go any higher than filll.");
309 savecurval = cur_val;
315 while (!(cur_cmd != spacer));
317 if ((cur_cmd < min_internal) || (cur_cmd > max_internal))
323 scan_something_internal(mu_val, false);
325 if (cur_val_level >= glue_val)
328 delete_glue_ref(cur_val);
332 if (cur_val_level != mu_val)
339 scan_something_internal(dimen_val, false);
348 if (scan_keyword("em"))
350 else if (scan_keyword("ex"))
351 v = x_height(cur_font);
358 if (cur_cmd != spacer)
362 cur_val = mult_and_add(savecurval, v, xn_over_d(v, f, 65536L), 1073741823L); /* 2^30 - 1 */
367 if (scan_keyword("mu"))
371 print_err("Illegal unit of measure(");
372 print_string("mu inserted)");
373 help4("The unit of measurement in math glue must be mu.",
374 "To recover gracefully from this error, it's best to",
375 "delete the erroneous units; e.g., type `2' to delete",
376 "two letters. (See Chapter 27 of The TeXbook.)");
382 if (scan_keyword("true"))
388 cur_val = xn_over_d(cur_val, 1000, mag);
389 f = (1000 * f + 65536L * tex_remainder) / mag;
390 cur_val = cur_val + (f / 65536L);
395 if (scan_keyword("pt"))
398 if (scan_keyword("in"))
403 else if (scan_keyword("pc"))
408 else if (scan_keyword("cm"))
413 else if (scan_keyword("mm"))
418 else if (scan_keyword("bp"))
423 else if (scan_keyword("dd"))
428 else if (scan_keyword("cc"))
433 else if (scan_keyword("Q"))
438 else if (scan_keyword("H"))
443 else if (scan_keyword("sp"))
447 print_err("Illegal unit of measure(");
448 print_string("pt inserted)");
449 help6("Dimensions can be in units of em, ex, in, pt, pc,",
450 "cm, mm, dd, cc, bp, or sp; but yours is a new one!",
451 "I'll assume that you meant to say pt, for printer's points.",
452 "To recover gracefully from this error, it's best to",
453 "delete the erroneous units; e.g., type `2' to delete",
454 "two letters. (See Chapter 27 of The TeXbook.)");
459 cur_val = xn_over_d(cur_val, num, denom);
460 f = (num * f + 65536L * tex_remainder) / denom;
461 cur_val = cur_val +(f / 65536L);
465 if (cur_val >= 16384) /* 2^14 */
468 cur_val = cur_val * 65536L + f;
473 if (cur_cmd != spacer)
477 if (arith_error || (abs(cur_val) >= 1073741824L)) /* 2^30 */
479 print_err("Dimension too large");
480 help2("I can't work with sizes bigger than about 19 feet.",
481 "Continue and I'll use the largest value I can.");
483 cur_val = 1073741823L; /* 2^30 - 1 */
488 cur_val = - (integer) cur_val;
491 void scan_glue_(small_number level)
497 mu = (level == mu_val);
505 while (!(cur_cmd != spacer));
507 if (cur_tok == other_token + '-')
509 negative = !negative;
510 cur_tok = other_token + '+';
513 while (!(cur_tok != other_token + '+'));
515 if ((cur_cmd >= min_internal) && (cur_cmd <= max_internal))
517 scan_something_internal(level, negative);
519 if (cur_val_level >= glue_val)
521 if (cur_val_level != level)
528 if (cur_val_level == int_val)
530 scan_dimen(mu, false, true);
532 else if (level == mu_val)
540 scan_dimen(mu, false, false);
543 cur_val = - (integer) cur_val;
545 q = new_spec(zero_glue);
548 if (scan_keyword("plus"))
550 scan_dimen(mu, true, false);
551 stretch(q) = cur_val;
552 stretch_order(q) = cur_order;
555 if (scan_keyword("minus"))
557 scan_dimen(mu, true, false);
559 shrink_order(q) = cur_order;
565 halfword scan_rule_spec (void)
570 if (cur_cmd == vrule)
571 width(q) = default_rule;
574 height(q) = default_rule;
580 if (scan_keyword("width"))
582 scan_dimen(false, false, false);
587 if (scan_keyword("height"))
589 scan_dimen(false, false, false);
594 if (scan_keyword("depth"))
596 scan_dimen(false, false, false);
604 halfword str_toks_(pool_pointer b)
630 avail = mem[q].hh.v.RH;
648 halfword the_toks (void)
650 register halfword Result;
656 scan_something_internal(tok_val, false);
658 if (cur_val_level >= ident_val)
663 if (cur_val_level == ident_val)
667 mem[q].hh.v.LH = cs_token_flag + cur_val;
670 else if (cur_val != 0)
674 while (r != 0) { /* while r<>null do l.9178 */
682 avail = mem[q].hh.v.RH;
690 mem[q].hh.v.LH = mem[r].hh.v.LH;
700 old_setting = selector;
701 selector = new_string;
704 switch (cur_val_level)
711 print_scaled(cur_val);
717 print_spec(cur_val, "pt");
718 delete_glue_ref(cur_val);
723 print_spec(cur_val, "mu");
724 delete_glue_ref(cur_val);
728 selector = old_setting;
729 Result = str_toks(b);
735 void ins_the_toks (void)
737 link(garbage) = the_toks();
738 begin_token_list(link(temp_head), 4);
741 void conv_toks (void)
745 small_number savescannerstatus;
752 case roman_numeral_code:
757 savescannerstatus = scanner_status;
760 scanner_status = savescannerstatus;
770 old_setting = selector;
771 selector = new_string;
779 case roman_numeral_code:
780 print_roman_int(cur_val);
792 print(font_name[cur_val]);
794 if (font_size[cur_val] != font_dsize[cur_val])
796 print_string(" at ");
797 print_scaled(font_size[cur_val]);
805 selector = old_setting;
806 link(garbage) = str_toks(b);
807 begin_token_list(link(temp_head), 4);
810 halfword scan_toks_(bool macrodef, bool xpand)
812 register halfword Result;
821 scanner_status = defining;
823 scanner_status = absorbing;
825 warning_index = cur_cs;
826 def_ref = get_avail();
827 token_ref_count(def_ref) = 0;
838 if (cur_tok < right_brace_limit)
841 if (cur_cmd == mac_param)
843 s = match_token + cur_chr;
846 if (cur_cmd == left_brace)
852 mem[q].hh.v.LH = cur_tok;
858 mem[q].hh.v.LH = end_match_token;
864 if (t == zero_token + 9)
866 print_err("You already have nine parameters");
867 help1("I'm going to ignore the # sign you just used.");
876 print_err("Parameters must be numbered consecutively");
877 help2("I've inserted the digit you should have used after the #.",
878 "Type `1' to delete what you did use.");
887 mem[q].hh.v.LH = cur_tok;
895 mem[q].hh.v.LH = 3584;
899 if (cur_cmd == right_brace)
901 print_err("Missing { inserted");
903 help2("Where was the left brace? You said something like `\\def\\a}',",
904 "which I'm going to interpret as `\\def\\a{}'.");
925 if (cur_cmd <= max_command)
936 if (link(temp_head) != 0)
938 link(p) = link(temp_head);
949 if (cur_tok < right_brace_limit)
950 if (cur_cmd < right_brace)
959 else if (cur_cmd == mac_param)
969 if (cur_cmd != mac_param)
970 if ((cur_tok <= zero_token) || (cur_tok > t))
972 print_err("Illegal parameter number in definition of");
973 sprint_cs(warning_index);
974 help3("You meant to type ## instead of #, right?",
975 "Or maybe a } was forgotten somewhere earlier, and things",
976 "are all screwed up? I'm going to assume that you meant ##.");
981 cur_tok = out_param_token - '0' + cur_chr;
986 mem[q].hh.v.LH = cur_tok;
997 mem[q].hh.v.LH = hashbrace;
1003 /* used only in ITEX.C */
1005 void read_toks_(integer n, halfword r)
1010 /* small_number m; */
1011 int m; /* 95/Jan/7 */
1013 scanner_status = defining;
1015 def_ref = get_avail();
1016 token_ref_count(def_ref) = 0;
1021 mem[q].hh.v.LH = end_match_token;
1025 if ((n < 0) || (n > 15))
1031 align_state = 1000000L;
1034 begin_file_reading();
1035 cur_input.name_field = m + 1;
1037 if (read_open[m] == closed)
1038 if (interaction > nonstop_mode)
1056 fatal_error("*** (cannot \\read from terminal in nonstop modes)");
1057 return; // abort_flag set
1059 else if (read_open[m] == 1)
1060 if (input_ln(read_file[m], false))
1064 (void) a_close(read_file[m]);
1069 if (!input_ln(read_file[m], true))
1071 (void) a_close(read_file[m]);
1073 if (align_state != 1000000L)
1076 print_err("File ended within");
1078 help1("This \\read has unbalanced braces.");
1079 align_state = 1000000L;
1084 cur_input.limit_field = last;
1085 if ((end_line_char < 0) || (end_line_char > 255))
1086 decr(cur_input.limit_field);
1088 buffer[cur_input.limit_field] = end_line_char;
1089 first = cur_input.limit_field + 1;
1090 cur_input.loc_field = cur_input.start_field;
1091 cur_input.state_field = new_line;
1096 if (align_state < 1000000L)
1100 } while(!(cur_tok == 0));
1101 align_state = 1000000L;
1107 mem[q].hh.v.LH = cur_tok;
1113 } while(!(align_state == 1000000L));
1115 scanner_status = normal;
1119 void pass_text (void)
1122 small_number savescannerstatus;
1124 savescannerstatus = scanner_status;
1125 scanner_status = skipping;
1130 if (cur_cmd == fi_or_else)
1137 else if (cur_cmd == if_test)
1141 scanner_status = savescannerstatus;
1144 void change_if_limit_(small_number l, halfword p)
1156 return; // abort_flag set
1167 /* called from tex2.c */
1169 void conditional (void)
1175 small_number savescannerstatus;
1176 halfword savecondptr;
1177 small_number thisif;
1179 p = get_node(if_node_size);
1182 subtype(p) = cur_if;
1183 if_line_field(p) = if_line;
1189 savecondptr = cond_ptr;
1198 if (cur_cmd == relax)
1199 if (cur_chr == 257) /* if cur_chr = no_expand_flag then ... p.506 */
1201 cur_cmd = active_char;
1202 cur_chr = cur_tok - 4096;
1205 if ((cur_cmd > active_char) || (cur_chr > 255))
1217 if (cur_cmd == relax)
1218 if (cur_chr == 257) /* if cur_chr = no_expand_flag then ... p.506 */
1220 cur_cmd = active_char;
1221 cur_chr = cur_tok - 4096;
1224 if ((cur_cmd > active_char) || (cur_chr > 255))
1229 if (thisif == if_char_code)
1238 if (thisif == if_int_code)
1241 scan_dimen(false, false, false);
1246 } while(!(cur_cmd != spacer));
1248 if ((cur_tok >= 3132) && (cur_tok <= 3134))
1252 print_err("Missing = inserted for ");
1253 print_cmd_chr(if_test, thisif);
1254 help1("I was expecting to see `<', `=', or `>'. Didn't.");
1258 if (thisif == if_int_code)
1261 scan_dimen(false, false, false);
1281 b = (abs(mode) == 1);
1284 b = (abs(mode) == 102);
1287 b = (abs(mode) == 203);
1296 scan_eight_bit_int();
1298 if (thisif == if_void_code)
1302 else if (thisif == if_hbox_code)
1303 b = (type(p) == hlist_node);
1305 b = (type(p) == vlist_node);
1310 savescannerstatus = scanner_status;
1319 else if (cur_cmd < call)
1329 while ((p != 0) && (q != 0))
1330 if (info(p) != info(q))
1337 b = ((p == 0) && (q == 0));
1340 scanner_status = savescannerstatus;
1345 scan_four_bit_int();
1346 b = (read_open[cur_val] == 2);
1359 if (tracing_commands > 1)
1362 print_string("{case ");
1365 end_diagnostic(false);
1369 if (cond_ptr == savecondptr)
1370 if (cur_chr == or_code)
1374 else if (cur_chr == fi_code)
1377 if_line = if_line_field(p);
1378 cur_if = subtype(p);
1381 free_node(p, if_node_size);
1384 change_if_limit(or_code, savecondptr);
1389 if (tracing_commands > 1)
1393 print_string("{true}");
1395 print_string("{false}");
1396 end_diagnostic(false);
1398 if (b) /* b may be used without ... */
1400 change_if_limit(else_code, savecondptr);
1405 if (cond_ptr == savecondptr)
1407 if (cur_chr != or_code)
1409 print_err("Extra ");
1411 help1("I'm ignoring this; it doesn't match any \\if.");
1414 else if (cur_chr == fi_code)
1417 if_line = if_line_field(p);
1418 cur_if = subtype(p);
1421 free_node(p, if_node_size);
1425 if (cur_chr == fi_code)
1428 if_line = if_line_field(p);
1429 cur_if = subtype(p);
1432 free_node(p, if_node_size);
1438 void begin_name (void)
1440 area_delimiter = 0; /* index between `file area' and `file name' */
1441 ext_delimiter = 0; /* index between `file name' and `file extension' */
1443 /* This gathers up a file name and makes a string of it */
1444 /* Also tries to break it into `file area' `file name' and `file extension' */
1445 /* Used by scan_file_name and prompt_file_name */
1446 /* We assume tilde has been converted to pseudo_tilde and space to pseudo_space */
1447 /* returns false if it is given a space character - end of file name */
1449 bool more_name_(ASCII_code c)
1451 register bool Result;
1453 if (quoted_file_name == 0 && c == ' ')
1455 else if (quoted_file_name != 0 && c == '"')
1457 quoted_file_name = 0; /* catch next space character */
1458 Result = true; /* accept ending quote, but throw away */
1462 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1463 /* convert pseudo tilde back to '~' 95/Sep/26 */ /* moved here 97/June/5 */
1464 /* if (pseudo_tilde != 0 && c == pseudo_tilde) c = '~'; */
1465 /* convert pseudo space back to ' ' 97/June/5 */ /* moved here 97/June/5 */
1466 /* if (pseudo_space != 0 && c == pseudo_space) c = ' '; */
1467 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1470 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1471 // if ((c == 47)) /* / */
1473 if ((c == '/' || c == '\\' || c == ':')) /* 94/Mar/1 */
1474 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1476 area_delimiter = cur_length;
1480 ext_delimiter = cur_length;
1485 /******************************** 2000 August 15th start ***********************/
1487 // The following code is to save string space used by TeX for filenames
1488 // Not really critical in a system that has dynamic memory allocation
1489 // And may slow it down slightly - although this linear search only
1490 // occurs when opening a file, which is somewhat slow inany case...
1492 // see if string from str_pool[start] to str_pool[end]
1493 // occurs elsewhere in string pool - returns string number
1494 // returns -1 if not found in string pool 2000 Aug 15
1496 int find_string (int start, int end)
1498 int k, nlen = end - start;
1501 // int trace_flag = 1; // debugging only
1505 sprintf(log_line, "\nLOOKING for string (str_ptr %d nlen %d) ", str_ptr, end-start);
1506 s = log_line + strlen(log_line);
1507 strncpy(s, (const char *) str_pool + start, nlen);
1509 show_line(log_line, 0);
1512 // avoid problems with(cur_name == flushablestring)by going only up to str_ptr-1
1513 // code in new_font (tex8.c) will take care of reuse of font name already
1514 // for (k = 0; k < str_ptr; k++) {
1515 for (k = 0; k < str_ptr - 1; k++)
1517 if (length(k) != nlen) continue;
1518 if (strncmp((const char *) str_pool + start, (const char *) str_pool + str_start[k], nlen) == 0) {
1520 sprintf(log_line, "\nFOUND the string %d (%d) ", k, str_start[k+1]-str_start[k]);
1521 s = log_line + strlen(log_line);
1522 strncpy(s, (const char *)str_pool + start, nlen);
1523 strcpy(s+nlen, "\n");
1524 show_line(log_line, 0);
1526 return k; // return number of matching string
1530 sprintf(log_line, "\nNOT FOUND string ");
1531 s = log_line + strlen(log_line);
1532 strncpy(s, (const char*)str_pool + start, nlen);
1533 strcpy(s+nlen, "\n");
1534 show_line(log_line, 0);
1536 return -1; // no match found
1539 // snip out the string from str_pool[start] to str_pool[end]
1540 // and move everything above it down 2000 Aug 15
1542 void remove_string (int start, int end)
1544 int nlen = pool_ptr - end; // how many bytes to move down
1547 // int trace_flag=1; // debugging only
1548 // if (end < start) show_line("\nEND < START", 1);
1549 // if (pool_ptr < end) show_line("\nPOOLPTR < END", 1);
1553 sprintf(log_line, "\nSTRIPPING OUT %d %d ", n, nlen);
1554 s = log_line + strlen(log_line);
1555 strncpy(s, (const char *)str_pool + start, n);
1557 show_line(log_line, 0);
1559 if (nlen > 0) memcpy(str_pool+start, str_pool+end, nlen);
1560 pool_ptr = start + nlen; // poolprt - (end-start);
1563 void show_string (int k)
1565 int nlen = length(k);
1568 sprintf(log_line, "\nSTRING %5d (%3d) %5d--%5d ",
1569 k, nlen, str_start[k], str_start[k+1]);
1570 s = log_line + strlen(log_line);
1571 strncpy(s, (const char *)str_pool + str_start[k], nlen);
1572 strcpy(s + nlen, "");
1573 show_line(log_line, 0);
1576 void show_all_strings (void)
1579 for (k = 0; k < str_ptr; k++) show_string(k);
1582 // int notfirst=0; // debugging only
1584 /********************************** 2000 August 15 end ****************************/
1586 void end_name (void)
1588 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1589 #ifdef ALLOCATESTRING
1590 if (str_ptr + 3 > current_max_strings)
1591 /* str_start = realloc_str_start(increment_max_strings); */
1592 str_start = realloc_str_start(increment_max_strings + 3);
1593 if (str_ptr + 3 > current_max_strings)
1594 { /* in case it failed 94/Jan/24 */
1595 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
1596 return; // abort_flag set
1599 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1600 if (str_ptr + 3 > max_strings)
1602 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
1603 return; // abort_flag set
1607 // if (notfirst++ == 0) show_all_strings(); // debugging only
1609 if (area_delimiter == 0) // no area delimiter ':' '/' or '\' found
1610 cur_area = 335; // "" default area
1612 if (save_strings_flag &&
1613 (cur_area = find_string(str_start[str_ptr], str_start[str_ptr]+area_delimiter)) > 0) {
1614 remove_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter);
1615 area_delimiter = 0; // area_delimiter - area_delimiter;
1616 if (ext_delimiter != 0) ext_delimiter = ext_delimiter - area_delimiter;
1617 // str_start[str_ptr + 1]= str_start[str_ptr]+ area_delimiter; // test only
1618 // incr(str_ptr); // test only
1620 else { // carve out string for "cur_area"
1622 str_start[str_ptr + 1]= str_start[str_ptr]+ area_delimiter;
1626 if (ext_delimiter == 0){ // no extension delimiter '.' found
1627 cur_ext = 335; // "" default extension
1628 if (save_strings_flag &&
1629 (cur_name = find_string(str_start[str_ptr], pool_ptr)) > 0) {
1630 remove_string(str_start[str_ptr], pool_ptr);
1631 // (void) make_string(); // test only
1633 else // Make string from str_start[str_ptr]to pool_ptr
1634 cur_name = make_string();
1636 else { // did find an extension
1637 if (save_strings_flag &&
1638 (cur_name = find_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter-1)) > 0) {
1639 remove_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter - 1);
1640 // str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1; // test only
1641 // incr(str_ptr); // test only
1643 else { // carve out string for "cur_name"
1645 str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1;
1648 if (save_strings_flag &&
1649 (cur_ext = find_string(str_start[str_ptr], pool_ptr)) > 0) {
1650 remove_string(str_start[str_ptr], pool_ptr);
1651 // (void) make_string(); // test only
1653 else // Make string from str_start[str_ptr]to pool_ptr
1654 cur_ext = make_string();
1658 /* n current name, a current area, e current extension */
1659 /* result in name_of_file[] */
1661 void pack_file_name_(str_number n, str_number a, str_number e)
1668 for (j = str_start[a]; j <= str_start[a + 1] - 1; j++)
1673 name_of_file[k] = xchr[c];
1675 for (j = str_start[n]; j <= str_start[n + 1] - 1; j++)
1680 name_of_file[k] = xchr[c];
1682 for (j = str_start[e]; j <= str_start[e + 1] - 1; j++)
1687 name_of_file[k] = xchr[c];
1693 name_length = PATHMAX - 1;
1694 /* pad it out with spaces ... what for ? in case we modify and forget ? */
1695 for (k = name_length + 1; k <= PATHMAX; k++) name_of_file[k]= ' ';
1696 name_of_file[PATHMAX]= '\0'; /* paranoia 94/Mar/24 */
1698 name_of_file [name_length+1] = '\0';
1701 sprintf(log_line, " pack_file_name `%s' (%d) ", name_of_file + 1, name_length); /* debugging */
1702 show_line(log_line, 0);
1704 name_of_file [name_length + 1] = ' ';
1707 /* Called only from two places tex9.c for format name - specified and default */
1708 /* for specified format name args are 0, a, b name in buffer[a] --- buffer[b] */
1709 /* for default args are format_default_length-4, 1, 0 */
1711 void pack_buffered_name_(small_number n, integer a, integer b)
1716 if (n + b - a + 5 > PATHMAX)
1717 b = a + PATHMAX - n - 5;
1719 /* This loop kicks in when we want the default format name */
1720 for (j = 1; j <= n; j++)
1722 c = xord[TEX_format_default[j]];
1725 name_of_file[k] = xchr[c];
1727 /* This loop kicks in when we want a specififed format name */
1728 for (j = a; j <= b; j++)
1733 name_of_file[k] = xchr[c];
1735 /* This adds the extension from the default format name */
1736 for (j = format_default_length - 3; j <= format_default_length; j++)
1738 c = xord[TEX_format_default[j]];
1741 name_of_file[k] = xchr[c];
1746 name_length = PATHMAX - 1;
1747 /* pad it out with spaces ... what for ? */
1748 for (k = name_length + 1; k <= PATHMAX; k++)
1749 name_of_file[k]= ' ';
1750 name_of_file[PATHMAX]= '\0'; /* paranoia 94/Mar/24 */
1753 str_number make_name_string (void)
1755 register str_number Result;
1758 #ifdef ALLOCATESTRING
1759 if (pool_ptr + name_length > current_pool_size)
1760 str_pool = realloc_str_pool(increment_pool_size + name_length);
1762 if (str_ptr == current_max_strings)
1763 str_start = realloc_str_start(increment_max_strings);
1765 if ((pool_ptr + name_length > current_pool_size) ||
1766 (str_ptr == current_max_strings) || (cur_length > 0))
1768 if ((pool_ptr + name_length > pool_size) || (str_ptr == max_strings) ||
1773 for (k = 1; k <= name_length; k++)
1775 str_pool[pool_ptr]= xord[name_of_file[k]];
1776 // sprintf(log_line, "%d => %d ", name_of_file[k], xord[name_of_file[k]]);
1777 // show_line(log_line, 0); // debugging only
1780 Result = make_string();
1785 str_number a_make_name_string_(alpha_file * f)
1787 register str_number Result;
1788 Result = make_name_string();
1790 } /* f unreferenced ? bkph */
1792 str_number b_make_name_string_(byte_file * f)
1794 register str_number Result;
1795 Result = make_name_string();
1797 } /* f unreferenced ? bkph */
1799 str_number w_make_name_string_(word_file * f)
1801 register str_number Result;
1802 Result = make_name_string();
1804 } /* f unreferenced ? bkph */
1806 /* Used by start_input to scan file name on command line */
1807 /* Also in tex8.c new_font_, open_or_close_in, and do_extension */
1809 void scan_file_name (void)
1811 name_in_progress = true;
1818 while (!(cur_cmd != spacer));
1820 quoted_file_name = 0; /* 98/March/15 */
1822 if (allow_quoted_names) /* check whether quoted name */
1826 quoted_file_name = 1;
1833 if ((cur_cmd > other_char) || (cur_chr > 255))
1835 back_input(); /* not a character put it back and leave */
1838 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1839 /* convert tilde '~' to pseudo tilde */
1840 /* if (pseudo_tilde != 0 && cur_chr == '~') cur_chr = pseudo_tilde; */
1841 /* convert space ' ' to pseudo space */
1842 /* if (pseudo_space != 0 && cur_chr == ' ') cur_chr = pseudo_space; */
1843 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1844 if (!more_name(cur_chr)) /* up to next white space */
1851 name_in_progress = false;
1853 /* argument is string .fmt, .log, or .dvi */
1855 void pack_job_name_(str_number s)
1857 cur_area = 335; /* "" */
1859 cur_name = job_name;
1860 pack_file_name(cur_name, cur_area, cur_ext);
1863 /**********************************************************************/
1864 /* show TEXINPUTS=... or format specific */
1865 /* only show this if name was not fully qualified ? */
1866 void show_tex_inputs (void)
1870 s = "TEXINPUTS"; /* default */
1872 if (format_specific)
1874 s = format_name; /* try specific */
1875 if (grabenv(s) == NULL) s = "TEXINPUTS"; /* no format specific */
1878 if (grabenv(s) == NULL) s = "TEXINPUT"; /* 94/May/19 */
1900 /**********************************************************************/
1902 void prompt_file_name_(str_number s, str_number e)/* s - what can't be found, e - default */
1906 if (interaction == scroll_mode);
1909 print_err("I can't find file `");
1911 print_err("I can't write on file `");
1913 print_file_name(cur_name, cur_area, cur_ext);
1916 if (s == 781) /* input file name */
1918 if (cur_area == 335) /* "" only if path not specified */
1920 if (show_texinput_flag)
1925 if (e == 785) /* .tex */
1928 print_nl("Please type another ");
1931 if (interaction < 2)
1933 fatal_error("*** (job aborted, file error in nonstop mode)");
1934 return; // abort_flag set
1939 show_line(" (or ^z to exit)", 0);
1941 show_line(" (or Ctrl-Z to exit)", 0);
1945 term_input(": ", 0);
1947 /* should we deal with tilde and space in file name here ??? */
1951 /* step over leading spaces ... */
1952 while ((buffer[k]== 32) && (k < last))
1954 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1955 quoted_file_name = 0; /* 98/March/15 */
1957 if (allow_quoted_names && k < last) /* check whether quoted name */
1959 if (buffer[k]== '"')
1961 quoted_file_name = 1;
1969 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1970 /* convert tilde '~' to pseudo tilde */
1971 if (pseudo_tilde != 0 && buffer[k]== '~')
1972 buffer[k]= pseudo_tilde;
1973 /* convert space ' ' to pseudo space */
1974 if (pseudo_space != 0 && buffer[k]== ' ')
1975 buffer[k]= pseudo_space;
1976 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1977 if (!more_name(buffer[k]))
1984 if (cur_ext == 335) /* "" */
1985 cur_ext = e; /* use default extension */
1986 pack_file_name(cur_name, cur_area, cur_ext);
1989 void open_log_file (void)
1994 ccharpointer months;
1996 old_setting = selector;
1999 job_name = 790; /* default: texput */
2001 pack_job_name(791); /* .log */
2003 while (!a_open_out(log_file))
2005 selector = term_only;
2006 prompt_file_name(793, 791); /* transcript file name texput */
2008 texmf_log_name = a_make_name_string(log_file);
2009 selector = log_only;
2012 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2013 // for our version DOS/Windows
2015 // showversion (log_file); /* in local.c - bkph */
2016 // showversion (stdout);
2017 stamp_it(log_line); // ??? use log_line ???
2018 strcat(log_line, "\n");
2019 (void) fputs(log_line, log_file);
2020 // show_line(buffer, 0); // ??? show on screen as well
2022 stampcopy(log_line);
2023 strcat(log_line, "\n");
2024 // show_line(buffer, 0); // ??? show on screen as well
2025 (void) fputs(log_line, log_file);
2028 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2029 /* also change following in itex.c - bkph */
2030 (void) fputs(tex_version, log_file);
2031 (void) fprintf(log_file, " (%s %s)", application, yandyversion);
2032 if (format_ident > 0)
2033 slow_print(format_ident); /* bkph */
2035 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2040 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2042 months = " JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
2043 for (k = 3 * month - 2; k <= 3 * month; k++)
2044 (void) putc(months[k], log_file);
2046 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2051 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2053 print_two(tex_time / 60); /* hour */
2055 print_two(tex_time % 60); /* minute */
2057 input_stack[input_ptr] = cur_input;
2059 l = input_stack[0].limit_field;
2060 if (buffer[l] == end_line_char)
2062 for (k = 1; k <= l; k++)
2065 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2066 /* a good place to show the fmt file name or pool file name ? 94/June/21 */
2069 if (string_file != NULL)
2071 fprintf(log_file, "(%s)\n", string_file);
2072 free(string_file); /* this was allocated by strdup in openinou */
2073 string_file = NULL; /* for safety */
2075 if (format_file != NULL)
2077 fprintf(log_file, "(%s)\n", format_file);
2078 free(format_file); /* this was allocated by strdup in openinou */
2079 format_file = NULL; /* for safety */
2082 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2083 selector = old_setting + 2;
2086 /**************************** start of insertion 98/Feb/7 **************/
2088 // Attempt to deal with foo.bar.tex given as foo.bar on command line
2089 // Makes copy of job_name with extension
2091 void morenamecopy(ASCII_code c)
2093 #ifdef ALLOCATESTRING
2094 if (pool_ptr + 1 > current_pool_size)
2095 str_pool = realloc_str_pool (increment_pool_size);
2096 if (pool_ptr + 1 > current_pool_size) { /* in case it failed 94/Jan/24 */
2097 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
2098 return; // abort_flag set
2101 if (pool_ptr + 1 > pool_size){
2102 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
2103 return; // abort_flag set
2106 str_pool[pool_ptr]= c;
2110 int endnamecopy(void)
2112 #ifdef ALLOCATESTRING
2113 if (str_ptr + 1 > current_max_strings)
2114 str_start = realloc_str_start(increment_max_strings + 1);
2115 if (str_ptr + 1 > current_max_strings) { /* in case it failed 94/Jan/24 */
2116 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
2117 return 0; // abort_flag set
2120 if (str_ptr + 1 > max_strings){
2121 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
2122 return 0; // abort_flag set
2125 return make_string();
2128 void jobnameappend (void)
2129 { /* add extension to job_name */
2132 k = str_start[job_name];
2133 n = str_start[job_name + 1];
2134 while (k < n) morenamecopy(str_pool[k++]);
2135 /* copy `extension' */
2136 k = str_start[cur_ext];
2137 n = str_start[cur_ext + 1];
2138 while (k < n) morenamecopy(str_pool[k++]);
2139 job_name = endnamecopy();
2142 /**************************** end of insertion 98/Feb/7 **************/
2144 void start_input (void)
2146 bool addedextension = false;
2148 pack_file_name(cur_name, cur_area, cur_ext);
2150 while (true) { /* loop until we get a valid file name */
2151 addedextension = false;
2152 begin_file_reading();
2153 /* *** *** *** *** *** following is new in 3.14159 *** *** *** *** *** *** */
2154 /* if current extension is *not* empty, try to open using name as is */
2155 /* string 335 is "" the empty string */
2156 if ((cur_ext != 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2158 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2159 /* we get here if extension is "", or file with extension failed to open */
2160 /* if current extension is not `tex,' and `tex' is not irrelevant, try it */
2161 /* string 785 is .tex */
2162 /* (! extensionirrelevantp(name_of_file, "tex"))){ */
2163 if ((cur_ext != 785) && (name_length + 5 < PATHMAX) &&
2164 (! extensionirrelevantp(name_of_file, name_length, "tex")))
2166 name_of_file[name_length + 1] = '.';
2167 name_of_file[name_length + 2] = 't';
2168 name_of_file[name_length + 3] = 'e';
2169 name_of_file[name_length + 4] = 'x';
2170 name_of_file[name_length + 5] = ' '; /* 96/Jan/20 ??? */
2171 name_length = name_length + 4;
2173 addedextension = true;
2174 /* *** *** *** *** following new in 3.14159 *** *** *** *** *** *** *** */
2175 if (a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2177 name_length = name_length - 4; /* strip extension again */
2178 name_of_file[name_length + 1] = ' '; /* ' ' */
2179 addedextension = false;
2180 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2182 /* *** *** *** *** major changes here in 3.14159 *** *** *** *** *** *** */
2183 /* string 335 is "" the empty string */
2184 if ((cur_ext == 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2186 if (maketextex() && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2188 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2190 prompt_file_name(781, 785); /* input file name .tex */
2191 } /* end of while(true)trying to get valid file name */
2193 /* maybe set pseudo_tilde = 0 at this point ? 95/Sep/26 */
2195 cur_input.name_field = a_make_name_string(input_file[cur_input.index_field]);
2197 if (job_name == 0) /* only the first time */
2199 job_name = cur_name; /* here we set the job_name */
2200 /* did file name have an `extension' already and we added ".tex" ? */
2201 if (cur_ext != 335 && addedextension) /* 98/Feb/7 */
2202 jobnameappend(); /* append `extension' to job_name */
2205 if (term_offset + length(cur_input.name_field) > max_print_line - 2) /* was 3 ? */
2207 else if ((term_offset > 0) || (file_offset > 0))
2210 // print_char(64); // debugging only marker
2212 if (open_parens > max_open_parens)
2213 max_open_parens = open_parens; /* 1999/Jan/17 */
2214 slow_print(cur_input.name_field);
2215 // print_char(64); // debugging only marker
2219 cur_input.state_field = new_line;
2222 if (input_ln(input_file[cur_input.index_field], false));
2224 if ((end_line_char < 0) || (end_line_char > 255))
2225 decr(cur_input.limit_field);
2227 buffer[cur_input.limit_field] = end_line_char;
2228 first = cur_input.limit_field + 1;
2229 cur_input.loc_field = cur_input.start_field;
2233 /**********************************************************************/
2234 /* show TEXFONTS=... or format specific */
2235 /* only show this if name was not fully qualified ? */
2236 void show_tex_fonts (void)
2238 char *s, *t, *v, *u;
2241 if (encoding_specific) {
2242 u = encoding_name; /* try specific */
2243 if ((t = grabenv(u)) != NULL) {
2244 if (strchr(t, ':') != NULL &&
2245 sscanf(t, "%d", &n) == 0) {
2246 s = u; /* look here instead of TEXFONTS=... */
2254 while (*t > '\0') print_char(*t++);
2259 while (*t > '\0') print_char(*t++);
2264 /**********************************************************************/
2266 /* called only from tex8.c */
2268 internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
2270 register internal_font_number Result;
2273 /* halfword lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np; */
2274 halfword lf, lh, nw, nh, nd, ni, nl, nk, ne, np;
2275 /* halfword bc, ec; */
2276 int bc, ec; /* 95/Jan/7 */
2277 internal_font_number f;
2278 internal_font_number g;
2279 eight_bits a, b, c, d;
2290 pack_file_name(nom, aire, 805); /* .tfm */
2291 if (!b_open_in(tfm_file)) /* new in C version d */
2295 if (!b_open_in(tfm_file))
2300 /* was just: goto lab11; */
2303 /* tfm_temp = getc(tfm_file); */ /* done already in open_input, but why? */
2308 tfm_temp = getc(tfm_file);
2309 lf = lf * 256 + tfm_temp;
2311 tfm_temp = getc(tfm_file);
2316 tfm_temp = getc(tfm_file);
2317 lh = lh * 256 + tfm_temp;
2319 tfm_temp = getc(tfm_file);
2324 tfm_temp = getc(tfm_file);
2325 bc = bc * 256 + tfm_temp;
2327 tfm_temp = getc(tfm_file);
2332 tfm_temp = getc(tfm_file);
2333 ec = ec * 256 + tfm_temp;
2335 if ((bc > ec + 1)||(ec > 255))
2342 tfm_temp = getc(tfm_file);
2347 tfm_temp = getc(tfm_file);
2348 nw = nw * 256 + tfm_temp;
2350 tfm_temp = getc(tfm_file);
2355 tfm_temp = getc(tfm_file);
2356 nh = nh * 256 + tfm_temp;
2358 tfm_temp = getc(tfm_file);
2363 tfm_temp = getc(tfm_file);
2364 nd = nd * 256 + tfm_temp;
2366 tfm_temp = getc(tfm_file);
2371 tfm_temp = getc(tfm_file);
2372 ni = ni * 256 + tfm_temp;
2374 tfm_temp = getc(tfm_file);
2379 tfm_temp = getc(tfm_file);
2380 nl = nl * 256 + tfm_temp;
2382 tfm_temp = getc(tfm_file);
2387 tfm_temp = getc(tfm_file);
2388 nk = nk * 256 + tfm_temp;
2390 tfm_temp = getc(tfm_file);
2395 tfm_temp = getc(tfm_file);
2396 ne = ne * 256 + tfm_temp;
2398 tfm_temp = getc(tfm_file);
2403 tfm_temp = getc(tfm_file);
2404 np = np * 256 + tfm_temp;
2406 if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
2408 if ((nw == 0) || (nh == 0) || (nd == 0) || (ni == 0))
2414 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2416 if ((fmem_ptr + lf > current_font_mem_size)) /* 93/Nov/28 */
2417 font_info = realloc_font_info (increment_font_mem_size + lf);
2418 if ((font_ptr == font_max) || (fmem_ptr + lf > current_font_mem_size))
2420 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2421 if ((font_ptr == font_max) || (fmem_ptr + lf > font_mem_size))
2424 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2427 sprintf(log_line, "font_ptr %d font_max %d fmem_ptr %d lf %d font_mem_size %d\n",
2428 font_ptr, font_max, fmem_ptr, lf, font_mem_size); /* debugging */
2429 show_line(log_line, 0);
2431 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2435 print_file_name(nom, aire, 335); /* "" */
2438 print_string(" at ");
2442 else if (s != -1000)
2444 print_string(" scaled ");
2445 print_int(- (integer) s);
2447 print_string(" not loaded: Not enough room left");
2448 help4("I'm afraid I won't be able to make use of this font,",
2449 "because my memory for character-size data is too small.",
2450 "If you're really stuck, ask a wizard to enlarge me.",
2451 "Or maybe try `I\\font<same font id>=<name of loaded font>'.");
2456 char_base[f] = fmem_ptr - bc;
2457 width_base[f] = char_base[f] + ec + 1;
2458 height_base[f] = width_base[f] + nw;
2459 depth_base[f] = height_base[f] + nh;
2460 italic_base[f] = depth_base[f] + nd;
2461 lig_kern_base[f] = italic_base[f] + ni;
2462 kern_base[f] = lig_kern_base[f] + nl - 256 * (128);
2463 exten_base[f] = kern_base[f] + 256 *(128) + nk;
2464 param_base[f] = exten_base[f] + ne;
2468 /* build the font checksum now */
2470 tfm_temp = getc(tfm_file);
2473 tfm_temp = getc(tfm_file);
2476 tfm_temp = getc(tfm_file);
2479 tfm_temp = getc(tfm_file);
2484 tfm_temp = getc(tfm_file);
2489 tfm_temp = getc(tfm_file);
2490 z = z * 256 + tfm_temp;
2492 tfm_temp = getc(tfm_file);
2493 z = z * 256 + tfm_temp;
2494 tfm_temp = getc(tfm_file);
2495 z =(z * 16) + (tfm_temp / 16);
2499 tfm_temp = getc(tfm_file);
2500 tfm_temp = getc(tfm_file);
2501 tfm_temp = getc(tfm_file);
2502 tfm_temp = getc(tfm_file);
2510 z = xn_over_d(z, - (integer) s, 1000);
2514 for (k = fmem_ptr; k <= width_base[f] - 1; k++)
2517 tfm_temp = getc(tfm_file);
2520 tfm_temp = getc(tfm_file);
2523 tfm_temp = getc(tfm_file);
2526 tfm_temp = getc(tfm_file);
2529 font_info[k].qqqq = qw;
2531 if ((a >= nw) || (b / 16 >= nh) || (b % 16 >= nd) || (c / 4 >= ni))
2546 if ((d < bc)||(d > ec))
2549 while (d < k + bc - fmem_ptr) {
2550 qw = font_info[char_base[f]+ d].qqqq;
2551 if (((qw.b2)% 4)!= 2)
2555 if (d == k + bc - fmem_ptr)
2567 while (z >= 8388608L) { /* 2^23 */
2569 alpha = alpha + alpha;
2571 beta = (char) (256 / alpha);
2575 for (k = width_base[f]; k <= lig_kern_base[f] - 1; k++)
2577 tfm_temp = getc(tfm_file);
2579 tfm_temp = getc(tfm_file);
2581 tfm_temp = getc(tfm_file);
2583 tfm_temp = getc(tfm_file);
2585 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2587 font_info[k].cint = sw;
2589 font_info[k].cint = sw - alpha;
2593 if (font_info[width_base[f]].cint != 0)
2595 if (font_info[height_base[f]].cint != 0)
2597 if (font_info[depth_base[f]].cint != 0)
2599 if (font_info[italic_base[f]].cint != 0)
2602 /* read ligature/kern program */
2603 bchlabel = 32767; /* '77777 */
2607 for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128)- 1; k++)
2610 tfm_temp = getc(tfm_file);
2613 tfm_temp = getc(tfm_file);
2616 tfm_temp = getc(tfm_file);
2619 tfm_temp = getc(tfm_file);
2622 font_info[k].qqqq = qw; /* store_four_quarters(font_info[k].qqqq */
2626 if (256 * c + d >= nl)
2627 goto lab11; /* error in TFM, abort */
2629 if (k == lig_kern_base[f])
2637 if ((b < bc) || (b > ec)) /* check-existence(b) */
2638 goto lab11; /* error in TFM, abort */
2640 qw = font_info[char_base[f] + b].qqqq;
2642 goto lab11; /* error in TFM, abort */
2647 if ((d < bc) || (d > ec)) /* check-existence(d) */
2648 goto lab11; /* error in TFM, abort */
2650 qw = font_info[char_base[f] + d].qqqq;
2652 goto lab11; /* error in TFM, abort */
2654 else if (256 * (c - 128) + d >= nk)
2655 goto lab11; /* error in TFM, abort */
2657 if (k - lig_kern_base[f] + a + 1 >= nl)
2658 goto lab11; /* error in TFM, abort */
2662 bchlabel = 256 * c + d;
2665 for (k = kern_base[f] + 256 * (128); k <= exten_base[f] - 1; k++)
2667 tfm_temp = getc(tfm_file);
2669 tfm_temp = getc(tfm_file);
2671 tfm_temp = getc(tfm_file);
2673 tfm_temp = getc(tfm_file);
2675 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2677 font_info[k].cint = sw;
2679 font_info[k].cint = sw - alpha;
2682 /* read extensible character recipes */
2683 /* for k:=exten_base[f] to param_base[f]-1 do */
2684 for (k = exten_base[f]; k <= param_base[f] - 1; k++)
2687 tfm_temp = getc(tfm_file);
2690 tfm_temp = getc(tfm_file);
2693 tfm_temp = getc(tfm_file);
2696 tfm_temp = getc(tfm_file);
2699 /* store_four_quarters(font_info[k].qqqq); */
2700 font_info[k].qqqq = qw;
2705 if ((a < bc) || (a > ec))
2708 qw = font_info[char_base[f] + a].qqqq;
2715 if ((b < bc) || (b > ec))
2718 qw = font_info[char_base[f] + b].qqqq;
2725 if ((c < bc) || (c > ec))
2728 qw = font_info[char_base[f] + c].qqqq;
2734 if ((d < bc) || (d > ec))
2737 qw = font_info[char_base[f] + d].qqqq;
2743 for (k = 1; k <= np; k++)
2746 tfm_temp = getc(tfm_file);
2750 tfm_temp = getc(tfm_file);
2751 sw = sw * 256 + tfm_temp;
2752 tfm_temp = getc(tfm_file);
2753 sw = sw * 256 + tfm_temp;
2754 tfm_temp = getc(tfm_file);
2755 font_info[param_base[f]].cint = (sw * 16) + (tfm_temp / 16);
2759 tfm_temp = getc(tfm_file);
2761 tfm_temp = getc(tfm_file);
2763 tfm_temp = getc(tfm_file);
2765 tfm_temp = getc(tfm_file);
2767 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2769 font_info[param_base[f] + k - 1].cint = sw;
2771 font_info[param_base[f] + k - 1].cint = sw - alpha;
2774 /* use test_eof() here instead ? */
2777 for (k = np + 1; k <= 7; k++)
2778 font_info[param_base[f] + k - 1].cint = 0;
2780 /* @<Make final adjustments...@>= l.11174 */
2782 font_params[f] = np;
2785 hyphen_char[f] = default_hyphen_char;
2786 skew_char[f] = default_skew_char;
2788 bchar_label[f] = bchlabel + lig_kern_base[f];
2790 bchar_label[f]= non_address; /* i.e. 0 --- 96/Jan/15 */
2791 font_bchar[f] = bchar;
2792 font_false_bchar[f] = bchar;
2796 qw = font_info[char_base[f] + bchar].qqqq;
2798 font_false_bchar[f] = 256;
2801 font_area[f] = aire;
2804 font_glue[f] = 0; /* font_glue[f]:=null; l.11184 */
2805 char_base[f] = char_base[f];
2806 width_base[f] = width_base[f];
2807 lig_kern_base[f] = lig_kern_base[f];
2808 kern_base[f] = kern_base[f];
2809 exten_base[f] = exten_base[f];
2810 decr(param_base[f]);
2811 fmem_ptr = fmem_ptr + lf;
2819 print_file_name(nom, aire, 335); /* "" */
2822 print_string(" at ");
2826 else if (s != -1000)
2828 print_string("scaled");
2829 print_int(- (integer) s);
2832 print_string(" not loadable: Bad metric (TFM) file");
2834 print_string(" not loadable: Metric (TFM) file not found");
2836 { /* "" only if path not specified */
2837 if (show_texinput_flag) show_tex_fonts(); /* 98/Jan/31 */
2839 help5("I wasn't able to read the size data for this font,",
2840 "so I will ignore the font specification.",
2841 "[Wizards can fix TFM files using TFtoPL/PLtoTF.]",
2842 "You might try inserting a different font spec;",
2843 "e.g., type `I\\font<same font id>=<substitute font name>'.");