6 #pragma warning(disable:4115) // kill rpcasync.h complaint
8 #define MYLIBAPI __declspec(dllexport)
11 #pragma warning(disable:4996)
12 #pragma warning(disable:4131) // old style declarator
13 #pragma warning(disable:4135) // conversion between different integral types
14 #pragma warning(disable:4127) // conditional expression is constant
22 #pragma warning(disable:4244) /* 96/Jan/10 */
43 while (!(cur_cmd != spacer));
45 if (cur_tok == other_token + '-')
48 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)
188 while (!(cur_cmd != spacer));
190 if (cur_tok == other_token + '-')
192 negative = ! negative;
193 cur_tok = other_token + '+';
196 while (!(cur_tok != other_token + '+'));
198 if ((cur_cmd >= min_internal) && (cur_cmd <= max_internal))
202 scan_something_internal(mu_val, false);
204 if (cur_val_level >= glue_val)
207 delete_glue_ref(cur_val);
211 if (cur_val_level == mu_val)
214 if (cur_val_level != int_val)
219 scan_something_internal(dimen_val, false);
221 if (cur_val_level == dimen_val)
229 if (cur_tok == continental_point_token)
230 cur_tok = point_token;
232 if (cur_tok != point_token)
242 if (cur_tok == continental_point_token)
243 cur_tok = point_token;
245 if ((radix == 10) && (cur_tok == point_token))
248 p = 0; /* p:=null l.8883 */
255 if ((cur_tok > zero_token + 9) || (cur_tok < zero_token))
262 info(q) = cur_tok - zero_token;
268 for (kk = k; kk >= 1; kk--)
270 dig[kk - 1] = info(p);
276 f = round_decimals(k);
278 if (cur_cmd != spacer)
286 negative = !negative;
287 cur_val = - (integer) cur_val;
292 if (scan_keyword("fil"))
296 while (scan_keyword("l"))
298 if (cur_order == filll)
300 print_err("Illegal unit of measure (");
301 print_string("replaced by filll)");
302 help1("I dddon't go any higher than filll.");
312 savecurval = cur_val;
318 while (!(cur_cmd != spacer));
320 if ((cur_cmd < min_internal) || (cur_cmd > max_internal))
326 scan_something_internal(mu_val, false);
328 if (cur_val_level >= glue_val)
331 delete_glue_ref(cur_val);
335 if (cur_val_level != mu_val)
342 scan_something_internal(dimen_val, false);
352 if (scan_keyword("em"))
354 else if (scan_keyword("ex"))
355 v = x_height(cur_font);
362 if (cur_cmd != spacer)
366 cur_val = mult_and_add(savecurval, v, xn_over_d(v, f, 65536L), 1073741823L); /* 2^30 - 1 */
371 if (scan_keyword("mu"))
375 print_err("Illegal unit of measure (");
376 print_string("mu inserted)");
377 help4("The unit of measurement in math glue must be mu.",
378 "To recover gracefully from this error, it's best to",
379 "delete the erroneous units; e.g., type `2' to delete",
380 "two letters. (See Chapter 27 of The TeXbook.)");
386 if (scan_keyword("true"))
392 cur_val = xn_over_d(cur_val, 1000, mag);
393 f = (1000 * f + 65536L * tex_remainder) / mag;
394 cur_val = cur_val + (f / 65536L);
399 if (scan_keyword("pt"))
402 if (scan_keyword("in"))
407 else if (scan_keyword("pc"))
412 else if (scan_keyword("cm"))
417 else if (scan_keyword("mm"))
422 else if (scan_keyword("bp"))
427 else if (scan_keyword("dd"))
432 else if (scan_keyword("cc"))
437 else if (scan_keyword("Q"))
442 else if (scan_keyword("H"))
447 else if (scan_keyword("sp"))
451 print_err("Illegal unit of measure (");
452 print_string("pt inserted)");
453 help6("Dimensions can be in units of em, ex, in, pt, pc,",
454 "cm, mm, dd, cc, bp, or sp; but yours is a new one!",
455 "I'll assume that you meant to say pt, for printer's points.",
456 "To recover gracefully from this error, it's best to",
457 "delete the erroneous units; e.g., type `2' to delete",
458 "two letters. (See Chapter 27 of The TeXbook.)");
463 cur_val = xn_over_d(cur_val, num, denom);
464 f = (num * f + 65536L * tex_remainder) / denom;
465 cur_val = cur_val +(f / 65536L);
469 if (cur_val >= 16384) /* 2^14 */
472 cur_val = cur_val * 65536L + f;
477 if (cur_cmd != spacer)
481 if (arith_error || (abs(cur_val) >= 1073741824L)) /* 2^30 */
483 print_err("Dimension too large");
484 help2("I can't work with sizes bigger than about 19 feet.",
485 "Continue and I'll use the largest value I can.");
487 cur_val = 1073741823L; /* 2^30 - 1 */
492 cur_val = - (integer) cur_val;
495 void scan_glue_(small_number level)
501 mu = (level == mu_val);
510 while (!(cur_cmd != spacer));
512 if (cur_tok == other_token + '-')
514 negative = !negative;
515 cur_tok = other_token + '+';
518 while (!(cur_tok != other_token + '+'));
520 if ((cur_cmd >= min_internal) && (cur_cmd <= max_internal))
522 scan_something_internal(level, negative);
524 if (cur_val_level >= glue_val)
526 if (cur_val_level != level)
533 if (cur_val_level == int_val)
535 scan_dimen(mu, false, true);
537 else if (level == mu_val)
545 scan_dimen(mu, false, false);
548 cur_val = - (integer) cur_val;
550 q = new_spec(zero_glue);
553 if (scan_keyword("plus"))
555 scan_dimen(mu, true, false);
556 stretch(q) = cur_val;
557 stretch_order(q) = cur_order;
560 if (scan_keyword("minus"))
562 scan_dimen(mu, true, false);
564 shrink_order(q) = cur_order;
570 halfword scan_rule_spec (void)
576 if (cur_cmd == vrule)
577 width(q) = default_rule;
580 height(q) = default_rule;
586 if (scan_keyword("width"))
588 scan_dimen(false, false, false);
593 if (scan_keyword("height"))
595 scan_dimen(false, false, false);
600 if (scan_keyword("depth"))
602 scan_dimen(false, false, false);
610 halfword str_toks_(pool_pointer b)
638 avail = mem[q].hh.v.RH;
656 halfword the_toks (void)
658 register halfword Result;
664 scan_something_internal(tok_val, false);
666 if (cur_val_level >= ident_val)
671 if (cur_val_level == ident_val)
675 mem[q].hh.v.LH = cs_token_flag + cur_val;
678 else if (cur_val != 0)
682 while (r != 0) { /* while r<>null do l.9178 */
690 avail = mem[q].hh.v.RH;
698 mem[q].hh.v.LH = mem[r].hh.v.LH;
708 old_setting = selector;
709 selector = new_string;
712 switch (cur_val_level)
719 print_scaled(cur_val);
725 print_spec(cur_val, "pt");
726 delete_glue_ref(cur_val);
731 print_spec(cur_val, "mu");
732 delete_glue_ref(cur_val);
736 selector = old_setting;
737 Result = str_toks(b);
743 void ins_the_toks (void)
745 link(garbage) = the_toks();
746 begin_token_list(link(temp_head), 4);
749 void conv_toks (void)
753 small_number savescannerstatus;
761 case roman_numeral_code:
767 savescannerstatus = scanner_status;
770 scanner_status = savescannerstatus;
783 old_setting = selector;
784 selector = new_string;
793 case roman_numeral_code:
794 print_roman_int(cur_val);
809 print(font_name[cur_val]);
811 if (font_size[cur_val] != font_dsize[cur_val])
813 print_string(" at ");
814 print_scaled(font_size[cur_val]);
824 selector = old_setting;
825 link(garbage) = str_toks(b);
826 begin_token_list(link(temp_head), 4);
829 halfword scan_toks_(bool macrodef, bool xpand)
831 register halfword Result;
840 scanner_status = defining;
842 scanner_status = absorbing;
844 warning_index = cur_cs;
845 def_ref = get_avail();
846 token_ref_count(def_ref) = 0;
857 if (cur_tok < right_brace_limit)
860 if (cur_cmd == mac_param)
862 s = match_token + cur_chr;
865 if (cur_cmd == left_brace)
871 mem[q].hh.v.LH = cur_tok;
877 mem[q].hh.v.LH = end_match_token;
883 if (t == zero_token + 9)
885 print_err("You already have nine parameters");
886 help1("I'm going to ignore the # sign you just used.");
895 print_err("Parameters must be numbered consecutively");
896 help2("I've inserted the digit you should have used after the #.",
897 "Type `1' to delete what you did use.");
906 mem[q].hh.v.LH = cur_tok;
914 mem[q].hh.v.LH = end_match_token;
918 if (cur_cmd == right_brace)
920 print_err("Missing { inserted");
922 help2("Where was the left brace? You said something like `\\def\\a}',",
923 "which I'm going to interpret as `\\def\\a{}'.");
944 if (cur_cmd <= max_command)
955 if (link(temp_head) != 0)
957 link(p) = link(temp_head);
968 if (cur_tok < right_brace_limit)
969 if (cur_cmd < right_brace)
978 else if (cur_cmd == mac_param)
988 if (cur_cmd != mac_param)
989 if ((cur_tok <= zero_token) || (cur_tok > t))
991 print_err("Illegal parameter number in definition of ");
992 sprint_cs(warning_index);
993 help3("You meant to type ## instead of #, right?",
994 "Or maybe a } was forgotten somewhere earlier, and things",
995 "are all screwed up? I'm going to assume that you meant ##.");
1000 cur_tok = out_param_token - '0' + cur_chr;
1005 mem[q].hh.v.LH = cur_tok;
1016 mem[q].hh.v.LH = hashbrace;
1022 /* used only in ITEX.C */
1024 void read_toks_(integer n, halfword r)
1029 /* small_number m; */
1030 int m; /* 95/Jan/7 */
1032 scanner_status = defining;
1034 def_ref = get_avail();
1035 token_ref_count(def_ref) = 0;
1041 mem[q].hh.v.LH = end_match_token;
1045 if ((n < 0) || (n > 15))
1051 align_state = 1000000L;
1055 begin_file_reading();
1056 cur_input.name_field = m + 1;
1058 if (read_open[m] == closed)
1059 if (interaction > nonstop_mode)
1077 fatal_error("*** (cannot \\read from terminal in nonstop modes)");
1078 return; // abort_flag set
1080 else if (read_open[m] == 1)
1081 if (input_ln(read_file[m], false))
1085 (void) a_close(read_file[m]);
1090 if (!input_ln(read_file[m], true))
1092 (void) a_close(read_file[m]);
1095 if (align_state != 1000000L)
1098 print_err("File ended within ");
1100 help1("This \\read has unbalanced braces.");
1101 align_state = 1000000L;
1107 cur_input.limit_field = last;
1109 if ((end_line_char < 0) || (end_line_char > 255))
1110 decr(cur_input.limit_field);
1112 buffer[cur_input.limit_field] = end_line_char;
1114 first = cur_input.limit_field + 1;
1115 cur_input.loc_field = cur_input.start_field;
1116 cur_input.state_field = new_line;
1125 if (align_state < 1000000L)
1131 while(!(cur_tok == 0));
1133 align_state = 1000000L;
1140 mem[q].hh.v.LH = cur_tok;
1147 while(!(align_state == 1000000L));
1150 scanner_status = normal;
1154 void pass_text (void)
1157 small_number savescannerstatus;
1159 savescannerstatus = scanner_status;
1160 scanner_status = skipping;
1168 if (cur_cmd == fi_or_else)
1176 else if (cur_cmd == if_test)
1180 scanner_status = savescannerstatus;
1183 void change_if_limit_(small_number l, halfword p)
1198 return; // abort_flag set
1211 /* called from tex2.c */
1213 void conditional (void)
1219 small_number savescannerstatus;
1220 halfword savecondptr;
1221 small_number thisif;
1224 p = get_node(if_node_size);
1227 subtype(p) = cur_if;
1228 if_line_field(p) = if_line;
1235 savecondptr = cond_ptr;
1246 if (cur_cmd == relax)
1247 if (cur_chr == no_expand_flag)
1249 cur_cmd = active_char;
1250 cur_chr = cur_tok - cs_token_flag - active_base;
1254 if ((cur_cmd > active_char) || (cur_chr > 255))
1267 if (cur_cmd == relax)
1268 if (cur_chr == no_expand_flag)
1270 cur_cmd = active_char;
1271 cur_chr = cur_tok - cs_token_flag - active_base;
1275 if ((cur_cmd > active_char) || (cur_chr > 255))
1281 if (thisif == if_char_code)
1291 if (thisif == if_int_code)
1294 scan_dimen(false, false, false);
1302 while(!(cur_cmd != spacer));
1304 if ((cur_tok >= other_token + '<') && (cur_tok <= other_token + '>'))
1305 r = cur_tok - other_token;
1308 print_err("Missing = inserted for ");
1309 print_cmd_chr(if_test, thisif);
1310 help1("I was expecting to see `<', `=', or `>'. Didn't.");
1315 if (thisif == if_int_code)
1318 scan_dimen(false, false, false);
1343 b = (abs(mode) == 1);
1347 b = (abs(mode) == 102);
1351 b = (abs(mode) == 203);
1362 scan_eight_bit_int();
1365 if (thisif == if_void_code)
1369 else if (thisif == if_hbox_code)
1370 b = (type(p) == hlist_node);
1372 b = (type(p) == vlist_node);
1378 savescannerstatus = scanner_status;
1388 else if (cur_cmd < call)
1399 while ((p != 0) && (q != 0))
1400 if (info(p) != info(q))
1408 b = ((p == 0) && (q == 0));
1412 scanner_status = savescannerstatus;
1418 scan_four_bit_int();
1419 b = (read_open[cur_val] == closed);
1436 if (tracing_commands > 1)
1439 print_string("{case ");
1442 end_diagnostic(false);
1449 if (cond_ptr == savecondptr)
1450 if (cur_chr == or_code)
1454 else if (cur_chr == fi_code)
1457 if_line = if_line_field(p);
1458 cur_if = subtype(p);
1461 free_node(p, if_node_size);
1465 change_if_limit(or_code, savecondptr);
1471 if (tracing_commands > 1)
1476 print_string("{true}");
1478 print_string("{false}");
1480 end_diagnostic(false);
1483 if (b) /* b may be used without ... */
1485 change_if_limit(else_code, savecondptr);
1493 if (cond_ptr == savecondptr)
1495 if (cur_chr != or_code)
1498 print_err("Extra ");
1500 help1("I'm ignoring this; it doesn't match any \\if.");
1503 else if (cur_chr == fi_code)
1506 if_line = if_line_field(p);
1507 cur_if = subtype(p);
1510 free_node(p, if_node_size);
1515 if (cur_chr == fi_code)
1518 if_line = if_line_field(p);
1519 cur_if = subtype(p);
1522 free_node(p, if_node_size);
1528 void begin_name (void)
1530 area_delimiter = 0; /* index between `file area' and `file name' */
1531 ext_delimiter = 0; /* index between `file name' and `file extension' */
1533 /* This gathers up a file name and makes a string of it */
1534 /* Also tries to break it into `file area' `file name' and `file extension' */
1535 /* Used by scan_file_name and prompt_file_name */
1536 /* We assume tilde has been converted to pseudo_tilde and space to pseudo_space */
1537 /* returns false if it is given a space character - end of file name */
1539 bool more_name_(ASCII_code c)
1541 if (quoted_file_name == 0 && c == ' ')
1543 else if (quoted_file_name != 0 && c == '"')
1545 quoted_file_name = 0; /* catch next space character */
1546 return true; /* accept ending quote, but throw away */
1550 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1551 /* convert pseudo tilde back to '~' 95/Sep/26 */ /* moved here 97/June/5 */
1552 /* if (pseudo_tilde != 0 && c == pseudo_tilde) c = '~'; */
1553 /* convert pseudo space back to ' ' 97/June/5 */ /* moved here 97/June/5 */
1554 /* if (pseudo_space != 0 && c == pseudo_space) c = ' '; */
1555 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1558 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1559 // if ((c == 47)) /* / */
1561 if ((c == '/' || c == '\\' || c == ':')) /* 94/Mar/1 */
1562 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1564 area_delimiter = cur_length;
1568 ext_delimiter = cur_length;
1572 /******************************** 2000 August 15th start ***********************/
1574 // The following code is to save string space used by TeX for filenames
1575 // Not really critical in a system that has dynamic memory allocation
1576 // And may slow it down slightly - although this linear search only
1577 // occurs when opening a file, which is somewhat slow inany case...
1579 // see if string from str_pool[start] to str_pool[end]
1580 // occurs elsewhere in string pool - returns string number
1581 // returns -1 if not found in string pool 2000 Aug 15
1583 int find_string (int start, int end)
1585 int k, nlen = end - start;
1588 // int trace_flag = 1; // debugging only
1592 sprintf(log_line, "\nLOOKING for string (str_ptr %d nlen %d) ", str_ptr, end - start);
1593 s = log_line + strlen(log_line);
1594 strncpy(s, (const char *) str_pool + start, nlen);
1595 strcpy(s + nlen, "");
1596 show_line(log_line, 0);
1599 // avoid problems with(cur_name == flushablestring)by going only up to str_ptr-1
1600 // code in new_font (tex8.c) will take care of reuse of font name already
1601 for (k = 0; k < str_ptr - 1; k++)
1603 if (length(k) != nlen)
1606 if (strncmp((const char *) str_pool + start, (const char *) str_pool + str_start[k], nlen) == 0)
1610 sprintf(log_line, "\nFOUND the string %d (%d) ", k, str_start[k+1]-str_start[k]);
1611 s = log_line + strlen(log_line);
1612 strncpy(s, (const char *)str_pool + start, nlen);
1613 strcpy(s+nlen, "\n");
1614 show_line(log_line, 0);
1616 return k; // return number of matching string
1622 sprintf(log_line, "\nNOT FOUND string ");
1623 s = log_line + strlen(log_line);
1624 strncpy(s, (const char*)str_pool + start, nlen);
1625 strcpy(s + nlen, "\n");
1626 show_line(log_line, 0);
1629 return -1; // no match found
1632 // snip out the string from str_pool[start] to str_pool[end]
1633 // and move everything above it down 2000 Aug 15
1635 void remove_string (int start, int end)
1637 int nlen = pool_ptr - end; // how many bytes to move down
1640 // int trace_flag=1; // debugging only
1641 // if (end < start) show_line("\nEND < START", 1);
1642 // if (pool_ptr < end) show_line("\nPOOLPTR < END", 1);
1646 int n = end - start;
1647 sprintf(log_line, "\nSTRIPPING OUT %d %d ", n, nlen);
1648 s = log_line + strlen(log_line);
1649 strncpy(s, (const char *)str_pool + start, n);
1650 strcpy(s + n, "\n");
1651 show_line(log_line, 0);
1655 memcpy(str_pool + start, str_pool + end, nlen);
1657 pool_ptr = start + nlen; // poolprt - (end-start);
1660 void show_string (int k)
1662 int nlen = length(k);
1665 sprintf(log_line, "\nSTRING %5d (%3d) %5d--%5d ",
1666 k, nlen, str_start[k], str_start[k+1]);
1667 s = log_line + strlen(log_line);
1668 strncpy(s, (const char *)str_pool + str_start[k], nlen);
1669 strcpy(s + nlen, "");
1670 show_line(log_line, 0);
1673 void show_all_strings (void)
1677 for (k = 0; k < str_ptr; k++)
1681 // int notfirst=0; // debugging only
1683 /********************************** 2000 August 15 end ****************************/
1685 void end_name (void)
1687 #ifdef ALLOCATESTRING
1688 if (str_ptr + 3 > current_max_strings)
1689 str_start = realloc_str_start(increment_max_strings + 3);
1691 if (str_ptr + 3 > current_max_strings)
1693 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
1694 return; // abort_flag set
1697 if (str_ptr + 3 > max_strings)
1699 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
1700 return; // abort_flag set
1704 // if (notfirst++ == 0) show_all_strings(); // debugging only
1706 if (area_delimiter == 0) // no area delimiter ':' '/' or '\' found
1707 cur_area = 335; // "" default area
1710 if (save_strings_flag && (cur_area = find_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter)) > 0)
1712 remove_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter);
1713 area_delimiter = 0; // area_delimiter - area_delimiter;
1715 if (ext_delimiter != 0)
1716 ext_delimiter = ext_delimiter - area_delimiter;
1718 // str_start[str_ptr + 1]= str_start[str_ptr]+ area_delimiter; // test only
1719 // incr(str_ptr); // test only
1721 else // carve out string for "cur_area"
1724 str_start[str_ptr + 1] = str_start[str_ptr] + area_delimiter;
1729 if (ext_delimiter == 0) // no extension delimiter '.' found
1731 cur_ext = 335; // "" default extension
1733 if (save_strings_flag && (cur_name = find_string(str_start[str_ptr], pool_ptr)) > 0)
1735 remove_string(str_start[str_ptr], pool_ptr);
1736 // (void) make_string(); // test only
1738 else // Make string from str_start[str_ptr]to pool_ptr
1739 cur_name = make_string();
1741 else // did find an extension
1743 if (save_strings_flag &&
1744 (cur_name = find_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter-1)) > 0)
1746 remove_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter - 1);
1747 // str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1; // test only
1748 // incr(str_ptr); // test only
1750 else // carve out string for "cur_name"
1753 str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1;
1757 if (save_strings_flag && (cur_ext = find_string(str_start[str_ptr], pool_ptr)) > 0)
1759 remove_string(str_start[str_ptr], pool_ptr);
1760 // (void) make_string(); // test only
1762 else // Make string from str_start[str_ptr]to pool_ptr
1763 cur_ext = make_string();
1767 /* n current name, a current area, e current extension */
1768 /* result in name_of_file[] */
1770 void pack_file_name_(str_number n, str_number a, str_number e)
1778 for (j = str_start[a]; j <= str_start[a + 1] - 1; j++)
1784 name_of_file[k] = xchr[c];
1787 for (j = str_start[n]; j <= str_start[n + 1] - 1; j++)
1793 name_of_file[k] = xchr[c];
1796 for (j = str_start[e]; j <= str_start[e + 1] - 1; j++)
1802 name_of_file[k] = xchr[c];
1808 name_length = PATHMAX - 1;
1810 /* pad it out with spaces ... what for ? in case we modify and forget ? */
1811 for (k = name_length + 1; k <= PATHMAX; k++)
1812 name_of_file[k] = ' ';
1814 name_of_file[PATHMAX] = '\0'; /* paranoia 94/Mar/24 */
1817 name_of_file [name_length+1] = '\0';
1821 sprintf(log_line, " pack_file_name `%s' (%d) ", name_of_file + 1, name_length); /* debugging */
1822 show_line(log_line, 0);
1825 name_of_file [name_length + 1] = ' ';
1828 /* Called only from two places tex9.c for format name - specified and default */
1829 /* for specified format name args are 0, a, b name in buffer[a] --- buffer[b] */
1830 /* for default args are format_default_length-4, 1, 0 */
1832 void pack_buffered_name_(small_number n, integer a, integer b)
1838 if (n + b - a + 5 > PATHMAX)
1839 b = a + PATHMAX - n - 5;
1843 /* This loop kicks in when we want the default format name */
1844 for (j = 1; j <= n; j++)
1846 c = xord[TEX_format_default[j]];
1850 name_of_file[k] = xchr[c];
1852 /* This loop kicks in when we want a specififed format name */
1853 for (j = a; j <= b; j++)
1859 name_of_file[k] = xchr[c];
1862 /* This adds the extension from the default format name */
1863 for (j = format_default_length - 3; j <= format_default_length; j++)
1865 c = xord[TEX_format_default[j]];
1869 name_of_file[k] = xchr[c];
1875 name_length = PATHMAX - 1;
1877 /* pad it out with spaces ... what for ? */
1878 for (k = name_length + 1; k <= PATHMAX; k++)
1879 name_of_file[k]= ' ';
1881 name_of_file[PATHMAX] = '\0'; /* paranoia 94/Mar/24 */
1884 str_number make_name_string (void)
1888 #ifdef ALLOCATESTRING
1889 if (pool_ptr + name_length > current_pool_size)
1890 str_pool = realloc_str_pool(increment_pool_size + name_length);
1892 if (str_ptr == current_max_strings)
1893 str_start = realloc_str_start(increment_max_strings);
1895 if ((pool_ptr + name_length > current_pool_size) || (str_ptr == current_max_strings) || (cur_length > 0))
1897 if ((pool_ptr + name_length > pool_size) || (str_ptr == max_strings) || (cur_length > 0))
1904 for (k = 1; k <= name_length; k++)
1905 append_char(xord[name_of_file[k]]);
1907 return make_string();
1911 str_number a_make_name_string_(alpha_file * f)
1913 return make_name_string();
1916 str_number b_make_name_string_(byte_file * f)
1918 return make_name_string();
1921 str_number w_make_name_string_(word_file * f)
1923 return make_name_string();
1926 /* Used by start_input to scan file name on command line */
1927 /* Also in tex8.c new_font_, open_or_close_in, and do_extension */
1929 void scan_file_name (void)
1931 name_in_progress = true;
1938 while (!(cur_cmd != spacer));
1940 quoted_file_name = 0; /* 98/March/15 */
1942 if (allow_quoted_names) /* check whether quoted name */
1946 quoted_file_name = 1;
1953 if ((cur_cmd > other_char) || (cur_chr > 255))
1955 back_input(); /* not a character put it back and leave */
1958 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1959 /* convert tilde '~' to pseudo tilde */
1960 /* if (pseudo_tilde != 0 && cur_chr == '~') cur_chr = pseudo_tilde; */
1961 /* convert space ' ' to pseudo space */
1962 /* if (pseudo_space != 0 && cur_chr == ' ') cur_chr = pseudo_space; */
1963 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1964 if (!more_name(cur_chr)) /* up to next white space */
1971 name_in_progress = false;
1973 /* argument is string .fmt, .log, or .dvi */
1975 void pack_job_name_(str_number s)
1977 cur_area = 335; /* "" */
1979 cur_name = job_name;
1980 pack_file_name(cur_name, cur_area, cur_ext);
1983 /**********************************************************************/
1984 /* show TEXINPUTS=... or format specific */
1985 /* only show this if name was not fully qualified ? */
1986 void show_tex_inputs (void)
1990 s = "TEXINPUTS"; /* default */
1992 if (format_specific)
1994 s = format_name; /* try specific */
1996 if (grabenv(s) == NULL)
1997 s = "TEXINPUTS"; /* no format specific */
2000 if (grabenv(s) == NULL)
2001 s = "TEXINPUT"; /* 94/May/19 */
2025 /**********************************************************************/
2027 /* s - what can't be found, e - default */
2028 void prompt_file_name_(char * s, str_number e)
2032 if (interaction == scroll_mode);
2034 if (!strcmp("input file name", s))
2035 print_err("I can't find file `");
2037 print_err("I can't write on file `");
2039 print_file_name(cur_name, cur_area, cur_ext);
2042 if (!strcmp("input file name", s))
2044 if (cur_area == 335) /* "" only if path not specified */
2046 if (show_texinput_flag)
2051 if (e == 785) /* .tex */
2054 print_nl("Please type another ");
2057 if (interaction < 2)
2059 fatal_error("*** (job aborted, file error in nonstop mode)");
2060 return; // abort_flag set
2065 show_line(" (or ^z to exit)", 0);
2067 show_line(" (or Ctrl-Z to exit)", 0);
2071 term_input(": ", 0);
2073 /* should we deal with tilde and space in file name here ??? */
2078 while ((buffer[k] == ' ') && (k < last))
2080 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2081 quoted_file_name = 0; /* 98/March/15 */
2083 if (allow_quoted_names && k < last) /* check whether quoted name */
2085 if (buffer[k]== '"')
2087 quoted_file_name = 1;
2096 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2097 /* convert tilde '~' to pseudo tilde */
2098 if (pseudo_tilde != 0 && buffer[k]== '~')
2099 buffer[k] = pseudo_tilde;
2100 /* convert space ' ' to pseudo space */
2101 if (pseudo_space != 0 && buffer[k]== ' ')
2102 buffer[k] = pseudo_space;
2103 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2104 if (!more_name(buffer[k]))
2113 if (cur_ext == 335) /* "" */
2114 cur_ext = e; /* use default extension */
2116 pack_file_name(cur_name, cur_area, cur_ext);
2119 void open_log_file (void)
2126 old_setting = selector;
2129 job_name = 790; /* default: texput */
2131 pack_job_name(".log");
2133 while (!a_open_out(log_file))
2135 selector = term_only;
2136 prompt_file_name("transcript file name", ".log");
2139 texmf_log_name = a_make_name_string(log_file);
2140 selector = log_only;
2144 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2147 stamp_it(log_line); // ??? use log_line ???
2148 strcat(log_line, "\n");
2149 (void) fputs(log_line, log_file);
2150 stampcopy(log_line);
2151 strcat(log_line, "\n");
2152 (void) fputs(log_line, log_file);
2154 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2155 /* also change following in itex.c - bkph */
2156 (void) fputs(tex_version, log_file);
2157 (void) fprintf(log_file, " (%s %s)", application, yandyversion);
2159 if (format_ident > 0)
2160 slow_print(format_ident); /* bkph */
2163 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2168 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2170 months = " JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
2172 for (k = 3 * month - 2; k <= 3 * month; k++)
2173 (void) putc(months[k], log_file);
2176 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2181 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2183 print_two(tex_time / 60); /* hour */
2185 print_two(tex_time % 60); /* minute */
2188 input_stack[input_ptr] = cur_input;
2190 l = input_stack[0].limit_field;
2192 if (buffer[l] == end_line_char)
2195 for (k = 1; k <= l; k++)
2199 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2200 /* a good place to show the fmt file name or pool file name ? 94/June/21 */
2203 if (string_file != NULL)
2205 fprintf(log_file, "(%s)\n", string_file);
2206 free(string_file); /* this was allocated by strdup in openinou */
2207 string_file = NULL; /* for safety */
2210 if (format_file != NULL)
2212 fprintf(log_file, "(%s)\n", format_file);
2213 free(format_file); /* this was allocated by strdup in openinou */
2214 format_file = NULL; /* for safety */
2217 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2218 selector = old_setting + 2;
2221 /**************************** start of insertion 98/Feb/7 **************/
2223 // Attempt to deal with foo.bar.tex given as foo.bar on command line
2224 // Makes copy of job_name with extension
2226 void morenamecopy(ASCII_code c)
2228 #ifdef ALLOCATESTRING
2229 if (pool_ptr + 1 > current_pool_size)
2230 str_pool = realloc_str_pool (increment_pool_size);
2232 if (pool_ptr + 1 > current_pool_size) /* in case it failed 94/Jan/24 */
2234 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
2235 return; // abort_flag set
2238 if (pool_ptr + 1 > pool_size)
2240 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
2241 return; // abort_flag set
2244 str_pool[pool_ptr] = c;
2248 int endnamecopy(void)
2250 #ifdef ALLOCATESTRING
2251 if (str_ptr + 1 > current_max_strings)
2252 str_start = realloc_str_start(increment_max_strings + 1);
2254 if (str_ptr + 1 > current_max_strings) /* in case it failed 94/Jan/24 */
2256 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
2257 return 0; // abort_flag set
2260 if (str_ptr + 1 > max_strings)
2262 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
2263 return 0; // abort_flag set
2266 return make_string();
2269 /* add extension to job_name */
2270 void jobnameappend (void)
2274 k = str_start[job_name];
2275 n = str_start[job_name + 1];
2278 morenamecopy(str_pool[k++]);
2279 /* copy `extension' */
2280 k = str_start[cur_ext];
2281 n = str_start[cur_ext + 1];
2284 morenamecopy(str_pool[k++]);
2286 job_name = endnamecopy();
2289 /**************************** end of insertion 98/Feb/7 **************/
2291 void start_input (void)
2293 bool addedextension = false;
2296 pack_file_name(cur_name, cur_area, cur_ext);
2298 while (true) /* loop until we get a valid file name */
2300 addedextension = false;
2301 begin_file_reading();
2302 /* *** *** *** *** *** following is new in 3.14159 *** *** *** *** *** *** */
2303 /* if current extension is *not* empty, try to open using name as is */
2304 /* string 335 is "" the empty string */
2305 /* should be updated to current Kpathsea. */
2306 if ((cur_ext != 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2308 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2309 /* we get here if extension is "", or file with extension failed to open */
2310 /* if current extension is not `tex,' and `tex' is not irrelevant, try it */
2311 /* string 785 is .tex */
2312 if ((cur_ext != 785) && (name_length + 5 < PATHMAX))
2314 //strcpy(name_of_file + name_length + 1, ".tex ");
2315 name_of_file[name_length + 1] = '.';
2316 name_of_file[name_length + 2] = 't';
2317 name_of_file[name_length + 3] = 'e';
2318 name_of_file[name_length + 4] = 'x';
2319 name_of_file[name_length + 5] = ' ';
2320 name_length = name_length + 4;
2322 addedextension = true;
2324 if (a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2327 name_length = name_length - 4; /* strip extension again */
2328 name_of_file[name_length + 1] = ' '; /* ' ' */
2329 addedextension = false;
2330 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2332 /* *** *** *** *** major changes here in 3.14159 *** *** *** *** *** *** */
2333 /* string 335 is "" the empty string */
2334 if ((cur_ext == 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2337 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2339 prompt_file_name("input file name", ".tex");
2340 } /* end of while(true)trying to get valid file name */
2342 /* maybe set pseudo_tilde = 0 at this point ? 95/Sep/26 */
2344 cur_input.name_field = a_make_name_string(input_file[cur_input.index_field]);
2346 if (job_name == 0) /* only the first time */
2348 job_name = cur_name; /* here we set the job_name */
2349 /* did file name have an `extension' already and we added ".tex" ? */
2350 if (cur_ext != 335 && addedextension) /* 98/Feb/7 */
2351 jobnameappend(); /* append `extension' to job_name */
2356 if (term_offset + length(cur_input.name_field) > max_print_line - 2) /* was 3 ? */
2358 else if ((term_offset > 0) || (file_offset > 0))
2362 // print_char('@'); // debugging only marker
2365 if (open_parens > max_open_parens)
2366 max_open_parens = open_parens; /* 1999/Jan/17 */
2368 slow_print(cur_input.name_field);
2369 // print_char('@'); // debugging only marker
2373 cur_input.state_field = new_line;
2378 if (input_ln(input_file[cur_input.index_field], false));
2382 if ((end_line_char < 0) || (end_line_char > 255))
2383 decr(cur_input.limit_field);
2385 buffer[cur_input.limit_field] = end_line_char;
2387 first = cur_input.limit_field + 1;
2388 cur_input.loc_field = cur_input.start_field;
2392 /**********************************************************************/
2393 /* show TEXFONTS=... or format specific */
2394 /* only show this if name was not fully qualified ? */
2395 void show_tex_fonts (void)
2397 char *s, *t, *v, *u;
2402 if (encoding_specific)
2404 u = encoding_name; /* try specific */
2406 if ((t = grabenv(u)) != NULL)
2408 if (strchr(t, ':') != NULL && sscanf(t, "%d", &n) == 0)
2410 s = u; /* look here instead of TEXFONTS=... */
2437 /**********************************************************************/
2439 /* called only from tex8.c */
2441 internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
2445 /* halfword lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np; */
2446 halfword lf, lh, nw, nh, nd, ni, nl, nk, ne, np;
2447 /* halfword bc, ec; */
2448 int bc, ec; /* 95/Jan/7 */
2449 internal_font_number f;
2450 internal_font_number g;
2451 eight_bits a, b, c, d;
2462 pack_file_name(nom, aire, 805); /* .tfm */
2464 if (!b_open_in(tfm_file)) /* new in C version d */
2468 /* was just: goto lab11; */
2471 /* tfm_temp = getc(tfm_file); */ /* done already in open_input, but why? */
2472 //tfm_temp = getc(tfm_file);
2477 tfm_temp = getc(tfm_file);
2478 lf = lf * 256 + tfm_temp;
2480 tfm_temp = getc(tfm_file);
2485 tfm_temp = getc(tfm_file);
2486 lh = lh * 256 + tfm_temp;
2488 tfm_temp = getc(tfm_file);
2493 tfm_temp = getc(tfm_file);
2494 bc = bc * 256 + tfm_temp;
2496 tfm_temp = getc(tfm_file);
2501 tfm_temp = getc(tfm_file);
2502 ec = ec * 256 + tfm_temp;
2504 if ((bc > ec + 1)||(ec > 255))
2511 tfm_temp = getc(tfm_file);
2516 tfm_temp = getc(tfm_file);
2517 nw = nw * 256 + tfm_temp;
2519 tfm_temp = getc(tfm_file);
2524 tfm_temp = getc(tfm_file);
2525 nh = nh * 256 + tfm_temp;
2527 tfm_temp = getc(tfm_file);
2532 tfm_temp = getc(tfm_file);
2533 nd = nd * 256 + tfm_temp;
2535 tfm_temp = getc(tfm_file);
2540 tfm_temp = getc(tfm_file);
2541 ni = ni * 256 + tfm_temp;
2543 tfm_temp = getc(tfm_file);
2548 tfm_temp = getc(tfm_file);
2549 nl = nl * 256 + tfm_temp;
2551 tfm_temp = getc(tfm_file);
2556 tfm_temp = getc(tfm_file);
2557 nk = nk * 256 + tfm_temp;
2559 tfm_temp = getc(tfm_file);
2564 tfm_temp = getc(tfm_file);
2565 ne = ne * 256 + tfm_temp;
2567 tfm_temp = getc(tfm_file);
2572 tfm_temp = getc(tfm_file);
2573 np = np * 256 + tfm_temp;
2575 if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
2578 if ((nw == 0) || (nh == 0) || (nd == 0) || (ni == 0))
2586 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2588 if ((fmem_ptr + lf > current_font_mem_size)) /* 93/Nov/28 */
2589 font_info = realloc_font_info (increment_font_mem_size + lf);
2591 if ((font_ptr == font_max) || (fmem_ptr + lf > current_font_mem_size))
2593 if ((font_ptr == font_max) || (fmem_ptr + lf > font_mem_size))
2598 sprintf(log_line, "font_ptr %d font_max %d fmem_ptr %d lf %d font_mem_size %d\n",
2599 font_ptr, font_max, fmem_ptr, lf, font_mem_size); /* debugging */
2600 show_line(log_line, 0);
2606 print_file_name(nom, aire, 335); /* "" */
2610 print_string(" at ");
2614 else if (s != -1000)
2616 print_string(" scaled ");
2617 print_int(- (integer) s);
2620 print_string(" not loaded: Not enough room left");
2621 help4("I'm afraid I won't be able to make use of this font,",
2622 "because my memory for character-size data is too small.",
2623 "If you're really stuck, ask a wizard to enlarge me.",
2624 "Or maybe try `I\\font<same font id>=<name of loaded font>'.");
2630 char_base[f] = fmem_ptr - bc;
2631 width_base[f] = char_base[f] + ec + 1;
2632 height_base[f] = width_base[f] + nw;
2633 depth_base[f] = height_base[f] + nh;
2634 italic_base[f] = depth_base[f] + nd;
2635 lig_kern_base[f] = italic_base[f] + ni;
2636 kern_base[f] = lig_kern_base[f] + nl - 256 * (128);
2637 exten_base[f] = kern_base[f] + 256 * (128) + nk;
2638 param_base[f] = exten_base[f] + ne;
2643 /* build the font checksum now */
2645 tfm_temp = getc(tfm_file);
2648 tfm_temp = getc(tfm_file);
2651 tfm_temp = getc(tfm_file);
2654 tfm_temp = getc(tfm_file);
2660 tfm_temp = getc(tfm_file);
2665 tfm_temp = getc(tfm_file);
2666 z = z * 256 + tfm_temp;
2669 tfm_temp = getc(tfm_file);
2670 z = z * 256 + tfm_temp;
2671 tfm_temp = getc(tfm_file);
2672 z =(z * 16) + (tfm_temp / 16);
2679 tfm_temp = getc(tfm_file);
2680 tfm_temp = getc(tfm_file);
2681 tfm_temp = getc(tfm_file);
2682 tfm_temp = getc(tfm_file);
2692 z = xn_over_d(z, - (integer) s, 1000);
2697 for (k = fmem_ptr; k <= width_base[f] - 1; k++)
2700 tfm_temp = getc(tfm_file);
2703 tfm_temp = getc(tfm_file);
2706 tfm_temp = getc(tfm_file);
2709 tfm_temp = getc(tfm_file);
2712 font_info[k].qqqq = qw;
2715 if ((a >= nw) || (b / 16 >= nh) || (b % 16 >= nd) || (c / 4 >= ni))
2733 if ((d < bc)||(d > ec))
2737 while (d < k + bc - fmem_ptr)
2739 qw = font_info[char_base[f]+ d].qqqq;
2741 if (((qw.b2)% 4)!= 2)
2747 if (d == k + bc - fmem_ptr)
2761 while (z >= 8388608L) /* 2^23 */
2764 alpha = alpha + alpha;
2767 beta = (char) (256 / alpha);
2771 for (k = width_base[f]; k <= lig_kern_base[f] - 1; k++)
2773 tfm_temp = getc(tfm_file);
2775 tfm_temp = getc(tfm_file);
2777 tfm_temp = getc(tfm_file);
2779 tfm_temp = getc(tfm_file);
2781 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2784 font_info[k].cint = sw;
2786 font_info[k].cint = sw - alpha;
2791 if (font_info[width_base[f]].cint != 0)
2794 if (font_info[height_base[f]].cint != 0)
2797 if (font_info[depth_base[f]].cint != 0)
2800 if (font_info[italic_base[f]].cint != 0)
2803 /* read ligature/kern program */
2804 bchlabel = 32767; /* '77777 */
2809 for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128) - 1; k++)
2812 tfm_temp = getc(tfm_file);
2815 tfm_temp = getc(tfm_file);
2818 tfm_temp = getc(tfm_file);
2821 tfm_temp = getc(tfm_file);
2824 font_info[k].qqqq = qw; /* store_four_quarters(font_info[k].qqqq */
2829 if (256 * c + d >= nl)
2830 goto lab11; /* error in TFM, abort */
2833 if (k == lig_kern_base[f])
2841 if ((b < bc) || (b > ec)) /* check-existence(b) */
2842 goto lab11; /* error in TFM, abort */
2845 qw = font_info[char_base[f] + b].qqqq;
2848 goto lab11; /* error in TFM, abort */
2854 if ((d < bc) || (d > ec)) /* check-existence(d) */
2855 goto lab11; /* error in TFM, abort */
2858 qw = font_info[char_base[f] + d].qqqq;
2861 goto lab11; /* error in TFM, abort */
2863 else if (256 * (c - 128) + d >= nk)
2864 goto lab11; /* error in TFM, abort */
2866 if (k - lig_kern_base[f] + a + 1 >= nl)
2867 goto lab11; /* error in TFM, abort */
2872 bchlabel = 256 * c + d;
2875 for (k = kern_base[f] + 256 * (128); k <= exten_base[f] - 1; k++)
2877 tfm_temp = getc(tfm_file);
2879 tfm_temp = getc(tfm_file);
2881 tfm_temp = getc(tfm_file);
2883 tfm_temp = getc(tfm_file);
2885 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2888 font_info[k].cint = sw;
2890 font_info[k].cint = sw - alpha;
2893 /* read extensible character recipes */
2894 /* for k:=exten_base[f] to param_base[f]-1 do */
2895 for (k = exten_base[f]; k <= param_base[f] - 1; k++)
2898 tfm_temp = getc(tfm_file);
2901 tfm_temp = getc(tfm_file);
2904 tfm_temp = getc(tfm_file);
2907 tfm_temp = getc(tfm_file);
2910 /* store_four_quarters(font_info[k].qqqq); */
2911 font_info[k].qqqq = qw;
2917 if ((a < bc) || (a > ec))
2921 qw = font_info[char_base[f] + a].qqqq;
2930 if ((b < bc) || (b > ec))
2934 qw = font_info[char_base[f] + b].qqqq;
2943 if ((c < bc) || (c > ec))
2947 qw = font_info[char_base[f] + c].qqqq;
2954 if ((d < bc) || (d > ec))
2958 qw = font_info[char_base[f] + d].qqqq;
2965 for (k = 1; k <= np; k++)
2968 tfm_temp = getc(tfm_file);
2974 tfm_temp = getc(tfm_file);
2975 sw = sw * 256 + tfm_temp;
2976 tfm_temp = getc(tfm_file);
2977 sw = sw * 256 + tfm_temp;
2978 tfm_temp = getc(tfm_file);
2979 font_info[param_base[f]].cint = (sw * 16) + (tfm_temp / 16);
2983 tfm_temp = getc(tfm_file);
2985 tfm_temp = getc(tfm_file);
2987 tfm_temp = getc(tfm_file);
2989 tfm_temp = getc(tfm_file);
2991 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2994 font_info[param_base[f] + k - 1].cint = sw;
2996 font_info[param_base[f] + k - 1].cint = sw - alpha;
2999 /* use test_eof() here instead ? */
3003 for (k = np + 1; k <= 7; k++)
3004 font_info[param_base[f] + k - 1].cint = 0;
3006 /* @<Make final adjustments...@>= l.11174 */
3008 font_params[f] = np;
3012 hyphen_char[f] = default_hyphen_char;
3013 skew_char[f] = default_skew_char;
3016 bchar_label[f] = bchlabel + lig_kern_base[f];
3018 bchar_label[f]= non_address; /* i.e. 0 --- 96/Jan/15 */
3020 font_bchar[f] = bchar;
3021 font_false_bchar[f] = bchar;
3026 qw = font_info[char_base[f] + bchar].qqqq;
3029 font_false_bchar[f] = 256;
3033 font_area[f] = aire;
3036 font_glue[f] = 0; /* font_glue[f]:=null; l.11184 */
3037 char_base[f] = char_base[f];
3038 width_base[f] = width_base[f];
3039 lig_kern_base[f] = lig_kern_base[f];
3040 kern_base[f] = kern_base[f];
3041 exten_base[f] = exten_base[f];
3042 decr(param_base[f]);
3043 fmem_ptr = fmem_ptr + lf;
3051 print_file_name(nom, aire, 335); /* "" */
3055 print_string(" at ");
3059 else if (s != -1000)
3061 print_string("scaled");
3062 print_int(- (integer) s);
3066 print_string(" not loadable: Bad metric (TFM) file");
3068 print_string(" not loadable: Metric (TFM) file not found");
3070 if (aire == 335) /* "" only if path not specified */
3072 if (show_texinput_flag)
3073 show_tex_fonts(); /* 98/Jan/31 */
3076 help5("I wasn't able to read the size data for this font,",
3077 "so I will ignore the font specification.",
3078 "[Wizards can fix TFM files using TFtoPL/PLtoTF.]",
3079 "You might try inserting a different font spec;",
3080 "e.g., type `I\\font<same font id>=<substitute font name>'.");