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 return make_name_string();
1788 } /* f unreferenced ? bkph */
1790 str_number b_make_name_string_(byte_file * f)
1792 return make_name_string();
1793 } /* f unreferenced ? bkph */
1795 str_number w_make_name_string_(word_file * f)
1797 return make_name_string();
1798 } /* f unreferenced ? bkph */
1800 /* Used by start_input to scan file name on command line */
1801 /* Also in tex8.c new_font_, open_or_close_in, and do_extension */
1803 void scan_file_name (void)
1805 name_in_progress = true;
1812 while (!(cur_cmd != spacer));
1814 quoted_file_name = 0; /* 98/March/15 */
1816 if (allow_quoted_names) /* check whether quoted name */
1820 quoted_file_name = 1;
1827 if ((cur_cmd > other_char) || (cur_chr > 255))
1829 back_input(); /* not a character put it back and leave */
1832 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1833 /* convert tilde '~' to pseudo tilde */
1834 /* if (pseudo_tilde != 0 && cur_chr == '~') cur_chr = pseudo_tilde; */
1835 /* convert space ' ' to pseudo space */
1836 /* if (pseudo_space != 0 && cur_chr == ' ') cur_chr = pseudo_space; */
1837 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1838 if (!more_name(cur_chr)) /* up to next white space */
1845 name_in_progress = false;
1847 /* argument is string .fmt, .log, or .dvi */
1849 void pack_job_name_(str_number s)
1851 cur_area = 335; /* "" */
1853 cur_name = job_name;
1854 pack_file_name(cur_name, cur_area, cur_ext);
1857 /**********************************************************************/
1858 /* show TEXINPUTS=... or format specific */
1859 /* only show this if name was not fully qualified ? */
1860 void show_tex_inputs (void)
1864 s = "TEXINPUTS"; /* default */
1866 if (format_specific)
1868 s = format_name; /* try specific */
1869 if (grabenv(s) == NULL)
1870 s = "TEXINPUTS"; /* no format specific */
1873 if (grabenv(s) == NULL)
1874 s = "TEXINPUT"; /* 94/May/19 */
1896 /**********************************************************************/
1898 /* s - what can't be found, e - default */
1899 void prompt_file_name_(str_number s, str_number e)
1903 if (interaction == scroll_mode);
1906 print_err("I can't find file `");
1908 print_err("I can't write on file `");
1910 print_file_name(cur_name, cur_area, cur_ext);
1913 if (s == 781) /* input file name */
1915 if (cur_area == 335) /* "" only if path not specified */
1917 if (show_texinput_flag)
1922 if (e == 785) /* .tex */
1925 print_nl("Please type another ");
1928 if (interaction < 2)
1930 fatal_error("*** (job aborted, file error in nonstop mode)");
1931 return; // abort_flag set
1936 show_line(" (or ^z to exit)", 0);
1938 show_line(" (or Ctrl-Z to exit)", 0);
1942 term_input(": ", 0);
1944 /* should we deal with tilde and space in file name here ??? */
1948 /* step over leading spaces ... */
1949 while ((buffer[k]== 32) && (k < last))
1951 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1952 quoted_file_name = 0; /* 98/March/15 */
1954 if (allow_quoted_names && k < last) /* check whether quoted name */
1956 if (buffer[k]== '"')
1958 quoted_file_name = 1;
1966 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1967 /* convert tilde '~' to pseudo tilde */
1968 if (pseudo_tilde != 0 && buffer[k]== '~')
1969 buffer[k]= pseudo_tilde;
1970 /* convert space ' ' to pseudo space */
1971 if (pseudo_space != 0 && buffer[k]== ' ')
1972 buffer[k]= pseudo_space;
1973 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1974 if (!more_name(buffer[k]))
1981 if (cur_ext == 335) /* "" */
1982 cur_ext = e; /* use default extension */
1983 pack_file_name(cur_name, cur_area, cur_ext);
1986 void open_log_file (void)
1991 ccharpointer months;
1993 old_setting = selector;
1996 job_name = 790; /* default: texput */
1998 pack_job_name(791); /* .log */
1999 //pack_job_name(make_string_pool(".log"));
2001 while (!a_open_out(log_file))
2003 selector = term_only;
2004 prompt_file_name(793, 791); /* transcript file name texput */
2006 texmf_log_name = a_make_name_string(log_file);
2007 selector = log_only;
2010 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2011 // for our version DOS/Windows
2014 // showversion (log_file); /* in local.c - bkph */
2015 // showversion (stdout);
2016 stamp_it(log_line); // ??? use log_line ???
2017 strcat(log_line, "\n");
2018 (void) fputs(log_line, log_file);
2019 // show_line(buffer, 0); // ??? show on screen as well
2021 stampcopy(log_line);
2022 strcat(log_line, "\n");
2023 // show_line(buffer, 0); // ??? show on screen as well
2024 (void) fputs(log_line, log_file);
2027 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2028 /* also change following in itex.c - bkph */
2029 (void) fputs(tex_version, log_file);
2030 (void) fprintf(log_file, " (%s %s)", application, yandyversion);
2032 if (format_ident > 0)
2033 slow_print(format_ident); /* bkph */
2036 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2041 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2043 months = " JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
2045 for (k = 3 * month - 2; k <= 3 * month; k++)
2046 (void) putc(months[k], log_file);
2049 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2054 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2056 print_two(tex_time / 60); /* hour */
2058 print_two(tex_time % 60); /* minute */
2061 input_stack[input_ptr] = cur_input;
2063 l = input_stack[0].limit_field;
2065 if (buffer[l] == end_line_char)
2068 for (k = 1; k <= l; k++)
2072 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2073 /* a good place to show the fmt file name or pool file name ? 94/June/21 */
2076 if (string_file != NULL)
2078 fprintf(log_file, "(%s)\n", string_file);
2079 free(string_file); /* this was allocated by strdup in openinou */
2080 string_file = NULL; /* for safety */
2082 if (format_file != NULL)
2084 fprintf(log_file, "(%s)\n", format_file);
2085 free(format_file); /* this was allocated by strdup in openinou */
2086 format_file = NULL; /* for safety */
2089 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2090 selector = old_setting + 2;
2093 /**************************** start of insertion 98/Feb/7 **************/
2095 // Attempt to deal with foo.bar.tex given as foo.bar on command line
2096 // Makes copy of job_name with extension
2098 void morenamecopy(ASCII_code c)
2100 #ifdef ALLOCATESTRING
2101 if (pool_ptr + 1 > current_pool_size)
2102 str_pool = realloc_str_pool (increment_pool_size);
2104 if (pool_ptr + 1 > current_pool_size) /* in case it failed 94/Jan/24 */
2106 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
2107 return; // abort_flag set
2110 if (pool_ptr + 1 > pool_size)
2112 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
2113 return; // abort_flag set
2116 str_pool[pool_ptr] = c;
2120 int endnamecopy(void)
2122 #ifdef ALLOCATESTRING
2123 if (str_ptr + 1 > current_max_strings)
2124 str_start = realloc_str_start(increment_max_strings + 1);
2126 if (str_ptr + 1 > current_max_strings) /* in case it failed 94/Jan/24 */
2128 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
2129 return 0; // abort_flag set
2132 if (str_ptr + 1 > max_strings)
2134 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
2135 return 0; // abort_flag set
2138 return make_string();
2141 /* add extension to job_name */
2142 void jobnameappend (void)
2146 k = str_start[job_name];
2147 n = str_start[job_name + 1];
2150 morenamecopy(str_pool[k++]);
2151 /* copy `extension' */
2152 k = str_start[cur_ext];
2153 n = str_start[cur_ext + 1];
2156 morenamecopy(str_pool[k++]);
2158 job_name = endnamecopy();
2161 /**************************** end of insertion 98/Feb/7 **************/
2163 void start_input (void)
2165 bool addedextension = false;
2167 pack_file_name(cur_name, cur_area, cur_ext);
2169 while (true) { /* loop until we get a valid file name */
2170 addedextension = false;
2171 begin_file_reading();
2172 /* *** *** *** *** *** following is new in 3.14159 *** *** *** *** *** *** */
2173 /* if current extension is *not* empty, try to open using name as is */
2174 /* string 335 is "" the empty string */
2175 if ((cur_ext != 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2177 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2178 /* we get here if extension is "", or file with extension failed to open */
2179 /* if current extension is not `tex,' and `tex' is not irrelevant, try it */
2180 /* string 785 is .tex */
2181 /* (! extensionirrelevantp(name_of_file, "tex"))){ */
2182 if ((cur_ext != 785) && (name_length + 5 < PATHMAX) &&
2183 (! extensionirrelevantp(name_of_file, name_length, "tex")))
2185 name_of_file[name_length + 1] = '.';
2186 name_of_file[name_length + 2] = 't';
2187 name_of_file[name_length + 3] = 'e';
2188 name_of_file[name_length + 4] = 'x';
2189 name_of_file[name_length + 5] = ' '; /* 96/Jan/20 ??? */
2190 name_length = name_length + 4;
2192 addedextension = true;
2193 /* *** *** *** *** following new in 3.14159 *** *** *** *** *** *** *** */
2194 if (a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2197 name_length = name_length - 4; /* strip extension again */
2198 name_of_file[name_length + 1] = ' '; /* ' ' */
2199 addedextension = false;
2200 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2202 /* *** *** *** *** major changes here in 3.14159 *** *** *** *** *** *** */
2203 /* string 335 is "" the empty string */
2204 if ((cur_ext == 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2207 if (maketextex() && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2209 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2211 prompt_file_name(781, 785); /* input file name .tex */
2212 } /* end of while(true)trying to get valid file name */
2214 /* maybe set pseudo_tilde = 0 at this point ? 95/Sep/26 */
2216 cur_input.name_field = a_make_name_string(input_file[cur_input.index_field]);
2218 if (job_name == 0) /* only the first time */
2220 job_name = cur_name; /* here we set the job_name */
2221 /* did file name have an `extension' already and we added ".tex" ? */
2222 if (cur_ext != 335 && addedextension) /* 98/Feb/7 */
2223 jobnameappend(); /* append `extension' to job_name */
2226 if (term_offset + length(cur_input.name_field) > max_print_line - 2) /* was 3 ? */
2228 else if ((term_offset > 0) || (file_offset > 0))
2231 // print_char(64); // debugging only marker
2233 if (open_parens > max_open_parens)
2234 max_open_parens = open_parens; /* 1999/Jan/17 */
2235 slow_print(cur_input.name_field);
2236 // print_char(64); // debugging only marker
2240 cur_input.state_field = new_line;
2243 if (input_ln(input_file[cur_input.index_field], false));
2245 if ((end_line_char < 0) || (end_line_char > 255))
2246 decr(cur_input.limit_field);
2248 buffer[cur_input.limit_field] = end_line_char;
2249 first = cur_input.limit_field + 1;
2250 cur_input.loc_field = cur_input.start_field;
2254 /**********************************************************************/
2255 /* show TEXFONTS=... or format specific */
2256 /* only show this if name was not fully qualified ? */
2257 void show_tex_fonts (void)
2259 char *s, *t, *v, *u;
2262 if (encoding_specific) {
2263 u = encoding_name; /* try specific */
2264 if ((t = grabenv(u)) != NULL) {
2265 if (strchr(t, ':') != NULL &&
2266 sscanf(t, "%d", &n) == 0) {
2267 s = u; /* look here instead of TEXFONTS=... */
2275 while (*t > '\0') print_char(*t++);
2280 while (*t > '\0') print_char(*t++);
2285 /**********************************************************************/
2287 /* called only from tex8.c */
2289 internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
2291 register internal_font_number Result;
2294 /* halfword lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np; */
2295 halfword lf, lh, nw, nh, nd, ni, nl, nk, ne, np;
2296 /* halfword bc, ec; */
2297 int bc, ec; /* 95/Jan/7 */
2298 internal_font_number f;
2299 internal_font_number g;
2300 eight_bits a, b, c, d;
2311 pack_file_name(nom, aire, 805); /* .tfm */
2312 if (!b_open_in(tfm_file)) /* new in C version d */
2316 if (!b_open_in(tfm_file))
2321 /* was just: goto lab11; */
2324 /* tfm_temp = getc(tfm_file); */ /* done already in open_input, but why? */
2329 tfm_temp = getc(tfm_file);
2330 lf = lf * 256 + tfm_temp;
2332 tfm_temp = getc(tfm_file);
2337 tfm_temp = getc(tfm_file);
2338 lh = lh * 256 + tfm_temp;
2340 tfm_temp = getc(tfm_file);
2345 tfm_temp = getc(tfm_file);
2346 bc = bc * 256 + tfm_temp;
2348 tfm_temp = getc(tfm_file);
2353 tfm_temp = getc(tfm_file);
2354 ec = ec * 256 + tfm_temp;
2356 if ((bc > ec + 1)||(ec > 255))
2363 tfm_temp = getc(tfm_file);
2368 tfm_temp = getc(tfm_file);
2369 nw = nw * 256 + tfm_temp;
2371 tfm_temp = getc(tfm_file);
2376 tfm_temp = getc(tfm_file);
2377 nh = nh * 256 + tfm_temp;
2379 tfm_temp = getc(tfm_file);
2384 tfm_temp = getc(tfm_file);
2385 nd = nd * 256 + tfm_temp;
2387 tfm_temp = getc(tfm_file);
2392 tfm_temp = getc(tfm_file);
2393 ni = ni * 256 + tfm_temp;
2395 tfm_temp = getc(tfm_file);
2400 tfm_temp = getc(tfm_file);
2401 nl = nl * 256 + tfm_temp;
2403 tfm_temp = getc(tfm_file);
2408 tfm_temp = getc(tfm_file);
2409 nk = nk * 256 + tfm_temp;
2411 tfm_temp = getc(tfm_file);
2416 tfm_temp = getc(tfm_file);
2417 ne = ne * 256 + tfm_temp;
2419 tfm_temp = getc(tfm_file);
2424 tfm_temp = getc(tfm_file);
2425 np = np * 256 + tfm_temp;
2427 if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
2429 if ((nw == 0) || (nh == 0) || (nd == 0) || (ni == 0))
2435 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2437 if ((fmem_ptr + lf > current_font_mem_size)) /* 93/Nov/28 */
2438 font_info = realloc_font_info (increment_font_mem_size + lf);
2439 if ((font_ptr == font_max) || (fmem_ptr + lf > current_font_mem_size))
2441 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2442 if ((font_ptr == font_max) || (fmem_ptr + lf > font_mem_size))
2445 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2448 sprintf(log_line, "font_ptr %d font_max %d fmem_ptr %d lf %d font_mem_size %d\n",
2449 font_ptr, font_max, fmem_ptr, lf, font_mem_size); /* debugging */
2450 show_line(log_line, 0);
2452 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2456 print_file_name(nom, aire, 335); /* "" */
2459 print_string(" at ");
2463 else if (s != -1000)
2465 print_string(" scaled ");
2466 print_int(- (integer) s);
2468 print_string(" not loaded: Not enough room left");
2469 help4("I'm afraid I won't be able to make use of this font,",
2470 "because my memory for character-size data is too small.",
2471 "If you're really stuck, ask a wizard to enlarge me.",
2472 "Or maybe try `I\\font<same font id>=<name of loaded font>'.");
2477 char_base[f] = fmem_ptr - bc;
2478 width_base[f] = char_base[f] + ec + 1;
2479 height_base[f] = width_base[f] + nw;
2480 depth_base[f] = height_base[f] + nh;
2481 italic_base[f] = depth_base[f] + nd;
2482 lig_kern_base[f] = italic_base[f] + ni;
2483 kern_base[f] = lig_kern_base[f] + nl - 256 * (128);
2484 exten_base[f] = kern_base[f] + 256 *(128) + nk;
2485 param_base[f] = exten_base[f] + ne;
2489 /* build the font checksum now */
2491 tfm_temp = getc(tfm_file);
2494 tfm_temp = getc(tfm_file);
2497 tfm_temp = getc(tfm_file);
2500 tfm_temp = getc(tfm_file);
2505 tfm_temp = getc(tfm_file);
2510 tfm_temp = getc(tfm_file);
2511 z = z * 256 + tfm_temp;
2513 tfm_temp = getc(tfm_file);
2514 z = z * 256 + tfm_temp;
2515 tfm_temp = getc(tfm_file);
2516 z =(z * 16) + (tfm_temp / 16);
2520 tfm_temp = getc(tfm_file);
2521 tfm_temp = getc(tfm_file);
2522 tfm_temp = getc(tfm_file);
2523 tfm_temp = getc(tfm_file);
2531 z = xn_over_d(z, - (integer) s, 1000);
2535 for (k = fmem_ptr; k <= width_base[f] - 1; k++)
2538 tfm_temp = getc(tfm_file);
2541 tfm_temp = getc(tfm_file);
2544 tfm_temp = getc(tfm_file);
2547 tfm_temp = getc(tfm_file);
2550 font_info[k].qqqq = qw;
2552 if ((a >= nw) || (b / 16 >= nh) || (b % 16 >= nd) || (c / 4 >= ni))
2567 if ((d < bc)||(d > ec))
2570 while (d < k + bc - fmem_ptr) {
2571 qw = font_info[char_base[f]+ d].qqqq;
2572 if (((qw.b2)% 4)!= 2)
2576 if (d == k + bc - fmem_ptr)
2588 while (z >= 8388608L) { /* 2^23 */
2590 alpha = alpha + alpha;
2592 beta = (char) (256 / alpha);
2596 for (k = width_base[f]; k <= lig_kern_base[f] - 1; k++)
2598 tfm_temp = getc(tfm_file);
2600 tfm_temp = getc(tfm_file);
2602 tfm_temp = getc(tfm_file);
2604 tfm_temp = getc(tfm_file);
2606 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2608 font_info[k].cint = sw;
2610 font_info[k].cint = sw - alpha;
2614 if (font_info[width_base[f]].cint != 0)
2616 if (font_info[height_base[f]].cint != 0)
2618 if (font_info[depth_base[f]].cint != 0)
2620 if (font_info[italic_base[f]].cint != 0)
2623 /* read ligature/kern program */
2624 bchlabel = 32767; /* '77777 */
2628 for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128)- 1; k++)
2631 tfm_temp = getc(tfm_file);
2634 tfm_temp = getc(tfm_file);
2637 tfm_temp = getc(tfm_file);
2640 tfm_temp = getc(tfm_file);
2643 font_info[k].qqqq = qw; /* store_four_quarters(font_info[k].qqqq */
2647 if (256 * c + d >= nl)
2648 goto lab11; /* error in TFM, abort */
2650 if (k == lig_kern_base[f])
2658 if ((b < bc) || (b > ec)) /* check-existence(b) */
2659 goto lab11; /* error in TFM, abort */
2661 qw = font_info[char_base[f] + b].qqqq;
2663 goto lab11; /* error in TFM, abort */
2668 if ((d < bc) || (d > ec)) /* check-existence(d) */
2669 goto lab11; /* error in TFM, abort */
2671 qw = font_info[char_base[f] + d].qqqq;
2673 goto lab11; /* error in TFM, abort */
2675 else if (256 * (c - 128) + d >= nk)
2676 goto lab11; /* error in TFM, abort */
2678 if (k - lig_kern_base[f] + a + 1 >= nl)
2679 goto lab11; /* error in TFM, abort */
2683 bchlabel = 256 * c + d;
2686 for (k = kern_base[f] + 256 * (128); k <= exten_base[f] - 1; k++)
2688 tfm_temp = getc(tfm_file);
2690 tfm_temp = getc(tfm_file);
2692 tfm_temp = getc(tfm_file);
2694 tfm_temp = getc(tfm_file);
2696 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2698 font_info[k].cint = sw;
2700 font_info[k].cint = sw - alpha;
2703 /* read extensible character recipes */
2704 /* for k:=exten_base[f] to param_base[f]-1 do */
2705 for (k = exten_base[f]; k <= param_base[f] - 1; k++)
2708 tfm_temp = getc(tfm_file);
2711 tfm_temp = getc(tfm_file);
2714 tfm_temp = getc(tfm_file);
2717 tfm_temp = getc(tfm_file);
2720 /* store_four_quarters(font_info[k].qqqq); */
2721 font_info[k].qqqq = qw;
2726 if ((a < bc) || (a > ec))
2729 qw = font_info[char_base[f] + a].qqqq;
2736 if ((b < bc) || (b > ec))
2739 qw = font_info[char_base[f] + b].qqqq;
2746 if ((c < bc) || (c > ec))
2749 qw = font_info[char_base[f] + c].qqqq;
2755 if ((d < bc) || (d > ec))
2758 qw = font_info[char_base[f] + d].qqqq;
2764 for (k = 1; k <= np; k++)
2767 tfm_temp = getc(tfm_file);
2771 tfm_temp = getc(tfm_file);
2772 sw = sw * 256 + tfm_temp;
2773 tfm_temp = getc(tfm_file);
2774 sw = sw * 256 + tfm_temp;
2775 tfm_temp = getc(tfm_file);
2776 font_info[param_base[f]].cint = (sw * 16) + (tfm_temp / 16);
2780 tfm_temp = getc(tfm_file);
2782 tfm_temp = getc(tfm_file);
2784 tfm_temp = getc(tfm_file);
2786 tfm_temp = getc(tfm_file);
2788 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2790 font_info[param_base[f] + k - 1].cint = sw;
2792 font_info[param_base[f] + k - 1].cint = sw - alpha;
2795 /* use test_eof() here instead ? */
2798 for (k = np + 1; k <= 7; k++)
2799 font_info[param_base[f] + k - 1].cint = 0;
2801 /* @<Make final adjustments...@>= l.11174 */
2803 font_params[f] = np;
2806 hyphen_char[f] = default_hyphen_char;
2807 skew_char[f] = default_skew_char;
2809 bchar_label[f] = bchlabel + lig_kern_base[f];
2811 bchar_label[f]= non_address; /* i.e. 0 --- 96/Jan/15 */
2812 font_bchar[f] = bchar;
2813 font_false_bchar[f] = bchar;
2817 qw = font_info[char_base[f] + bchar].qqqq;
2819 font_false_bchar[f] = 256;
2822 font_area[f] = aire;
2825 font_glue[f] = 0; /* font_glue[f]:=null; l.11184 */
2826 char_base[f] = char_base[f];
2827 width_base[f] = width_base[f];
2828 lig_kern_base[f] = lig_kern_base[f];
2829 kern_base[f] = kern_base[f];
2830 exten_base[f] = exten_base[f];
2831 decr(param_base[f]);
2832 fmem_ptr = fmem_ptr + lf;
2840 print_file_name(nom, aire, 335); /* "" */
2843 print_string(" at ");
2847 else if (s != -1000)
2849 print_string("scaled");
2850 print_int(- (integer) s);
2853 print_string(" not loadable: Bad metric (TFM) file");
2855 print_string(" not loadable: Metric (TFM) file not found");
2857 { /* "" only if path not specified */
2858 if (show_texinput_flag) show_tex_fonts(); /* 98/Jan/31 */
2860 help5("I wasn't able to read the size data for this font,",
2861 "so I will ignore the font specification.",
2862 "[Wizards can fix TFM files using TFtoPL/PLtoTF.]",
2863 "You might try inserting a different font spec;",
2864 "e.g., type `I\\font<same font id>=<substitute font name>'.");