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 if (quoted_file_name == 0 && c == ' ')
1453 else if (quoted_file_name != 0 && c == '"')
1455 quoted_file_name = 0; /* catch next space character */
1456 return true; /* accept ending quote, but throw away */
1460 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1461 /* convert pseudo tilde back to '~' 95/Sep/26 */ /* moved here 97/June/5 */
1462 /* if (pseudo_tilde != 0 && c == pseudo_tilde) c = '~'; */
1463 /* convert pseudo space back to ' ' 97/June/5 */ /* moved here 97/June/5 */
1464 /* if (pseudo_space != 0 && c == pseudo_space) c = ' '; */
1465 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1468 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1469 // if ((c == 47)) /* / */
1471 if ((c == '/' || c == '\\' || c == ':')) /* 94/Mar/1 */
1472 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1474 area_delimiter = cur_length;
1478 ext_delimiter = cur_length;
1482 /******************************** 2000 August 15th start ***********************/
1484 // The following code is to save string space used by TeX for filenames
1485 // Not really critical in a system that has dynamic memory allocation
1486 // And may slow it down slightly - although this linear search only
1487 // occurs when opening a file, which is somewhat slow inany case...
1489 // see if string from str_pool[start] to str_pool[end]
1490 // occurs elsewhere in string pool - returns string number
1491 // returns -1 if not found in string pool 2000 Aug 15
1493 int find_string (int start, int end)
1495 int k, nlen = end - start;
1498 // int trace_flag = 1; // debugging only
1502 sprintf(log_line, "\nLOOKING for string (str_ptr %d nlen %d) ", str_ptr, end-start);
1503 s = log_line + strlen(log_line);
1504 strncpy(s, (const char *) str_pool + start, nlen);
1506 show_line(log_line, 0);
1509 // avoid problems with(cur_name == flushablestring)by going only up to str_ptr-1
1510 // code in new_font (tex8.c) will take care of reuse of font name already
1511 for (k = 0; k < str_ptr - 1; k++)
1513 if (length(k) != nlen) continue;
1514 if (strncmp((const char *) str_pool + start, (const char *) str_pool + str_start[k], nlen) == 0)
1518 sprintf(log_line, "\nFOUND the string %d (%d) ", k, str_start[k+1]-str_start[k]);
1519 s = log_line + strlen(log_line);
1520 strncpy(s, (const char *)str_pool + start, nlen);
1521 strcpy(s+nlen, "\n");
1522 show_line(log_line, 0);
1524 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);
1537 return -1; // no match found
1540 // snip out the string from str_pool[start] to str_pool[end]
1541 // and move everything above it down 2000 Aug 15
1543 void remove_string (int start, int end)
1545 int nlen = pool_ptr - end; // how many bytes to move down
1548 // int trace_flag=1; // debugging only
1549 // if (end < start) show_line("\nEND < START", 1);
1550 // if (pool_ptr < end) show_line("\nPOOLPTR < END", 1);
1555 sprintf(log_line, "\nSTRIPPING OUT %d %d ", n, nlen);
1556 s = log_line + strlen(log_line);
1557 strncpy(s, (const char *)str_pool + start, n);
1559 show_line(log_line, 0);
1563 memcpy(str_pool+start, str_pool+end, nlen);
1565 pool_ptr = start + nlen; // poolprt - (end-start);
1568 void show_string (int k)
1570 int nlen = length(k);
1573 sprintf(log_line, "\nSTRING %5d (%3d) %5d--%5d ",
1574 k, nlen, str_start[k], str_start[k+1]);
1575 s = log_line + strlen(log_line);
1576 strncpy(s, (const char *)str_pool + str_start[k], nlen);
1577 strcpy(s + nlen, "");
1578 show_line(log_line, 0);
1582 void show_all_strings (void)
1586 for (k = 0; k < str_ptr; k++)
1590 // int notfirst=0; // debugging only
1592 /********************************** 2000 August 15 end ****************************/
1594 void end_name (void)
1596 #ifdef ALLOCATESTRING
1597 if (str_ptr + 3 > current_max_strings)
1598 str_start = realloc_str_start(increment_max_strings + 3);
1600 if (str_ptr + 3 > current_max_strings)
1602 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
1603 return; // abort_flag set
1606 if (str_ptr + 3 > max_strings)
1608 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
1609 return; // abort_flag set
1613 // if (notfirst++ == 0) show_all_strings(); // debugging only
1615 if (area_delimiter == 0) // no area delimiter ':' '/' or '\' found
1616 cur_area = 335; // "" default area
1619 if (save_strings_flag && (cur_area = find_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter)) > 0)
1621 remove_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter);
1622 area_delimiter = 0; // area_delimiter - area_delimiter;
1624 if (ext_delimiter != 0)
1625 ext_delimiter = ext_delimiter - area_delimiter;
1627 // str_start[str_ptr + 1]= str_start[str_ptr]+ area_delimiter; // test only
1628 // incr(str_ptr); // test only
1630 else // carve out string for "cur_area"
1633 str_start[str_ptr + 1] = str_start[str_ptr] + area_delimiter;
1638 if (ext_delimiter == 0) // no extension delimiter '.' found
1640 cur_ext = 335; // "" default extension
1642 if (save_strings_flag && (cur_name = find_string(str_start[str_ptr], pool_ptr)) > 0)
1644 remove_string(str_start[str_ptr], pool_ptr);
1645 // (void) make_string(); // test only
1647 else // Make string from str_start[str_ptr]to pool_ptr
1648 cur_name = make_string();
1650 else // did find an extension
1652 if (save_strings_flag &&
1653 (cur_name = find_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter-1)) > 0)
1655 remove_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter - 1);
1656 // str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1; // test only
1657 // incr(str_ptr); // test only
1659 else // carve out string for "cur_name"
1662 str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1;
1666 if (save_strings_flag && (cur_ext = find_string(str_start[str_ptr], pool_ptr)) > 0)
1668 remove_string(str_start[str_ptr], pool_ptr);
1669 // (void) make_string(); // test only
1671 else // Make string from str_start[str_ptr]to pool_ptr
1672 cur_ext = make_string();
1676 /* n current name, a current area, e current extension */
1677 /* result in name_of_file[] */
1679 void pack_file_name_(str_number n, str_number a, str_number e)
1686 for (j = str_start[a]; j <= str_start[a + 1] - 1; j++)
1691 name_of_file[k] = xchr[c];
1693 for (j = str_start[n]; j <= str_start[n + 1] - 1; j++)
1698 name_of_file[k] = xchr[c];
1700 for (j = str_start[e]; j <= str_start[e + 1] - 1; j++)
1705 name_of_file[k] = xchr[c];
1711 name_length = PATHMAX - 1;
1712 /* pad it out with spaces ... what for ? in case we modify and forget ? */
1713 for (k = name_length + 1; k <= PATHMAX; k++) name_of_file[k]= ' ';
1714 name_of_file[PATHMAX]= '\0'; /* paranoia 94/Mar/24 */
1716 name_of_file [name_length+1] = '\0';
1719 sprintf(log_line, " pack_file_name `%s' (%d) ", name_of_file + 1, name_length); /* debugging */
1720 show_line(log_line, 0);
1722 name_of_file [name_length + 1] = ' ';
1725 /* Called only from two places tex9.c for format name - specified and default */
1726 /* for specified format name args are 0, a, b name in buffer[a] --- buffer[b] */
1727 /* for default args are format_default_length-4, 1, 0 */
1729 void pack_buffered_name_(small_number n, integer a, integer b)
1734 if (n + b - a + 5 > PATHMAX)
1735 b = a + PATHMAX - n - 5;
1737 /* This loop kicks in when we want the default format name */
1738 for (j = 1; j <= n; j++)
1740 c = xord[TEX_format_default[j]];
1743 name_of_file[k] = xchr[c];
1745 /* This loop kicks in when we want a specififed format name */
1746 for (j = a; j <= b; j++)
1751 name_of_file[k] = xchr[c];
1753 /* This adds the extension from the default format name */
1754 for (j = format_default_length - 3; j <= format_default_length; j++)
1756 c = xord[TEX_format_default[j]];
1759 name_of_file[k] = xchr[c];
1764 name_length = PATHMAX - 1;
1765 /* pad it out with spaces ... what for ? */
1766 for (k = name_length + 1; k <= PATHMAX; k++)
1767 name_of_file[k]= ' ';
1768 name_of_file[PATHMAX]= '\0'; /* paranoia 94/Mar/24 */
1771 str_number make_name_string (void)
1775 #ifdef ALLOCATESTRING
1776 if (pool_ptr + name_length > current_pool_size)
1777 str_pool = realloc_str_pool(increment_pool_size + name_length);
1779 if (str_ptr == current_max_strings)
1780 str_start = realloc_str_start(increment_max_strings);
1782 if ((pool_ptr + name_length > current_pool_size) || (str_ptr == current_max_strings) || (cur_length > 0))
1784 if ((pool_ptr + name_length > pool_size) || (str_ptr == max_strings) || (cur_length > 0))
1791 for (k = 1; k <= name_length; k++)
1792 append_char(xord[name_of_file[k]]);
1794 return make_string();
1798 str_number a_make_name_string_(alpha_file * f)
1800 return make_name_string();
1803 str_number b_make_name_string_(byte_file * f)
1805 return make_name_string();
1808 str_number w_make_name_string_(word_file * f)
1810 return make_name_string();
1813 /* Used by start_input to scan file name on command line */
1814 /* Also in tex8.c new_font_, open_or_close_in, and do_extension */
1816 void scan_file_name (void)
1818 name_in_progress = true;
1825 while (!(cur_cmd != spacer));
1827 quoted_file_name = 0; /* 98/March/15 */
1829 if (allow_quoted_names) /* check whether quoted name */
1833 quoted_file_name = 1;
1840 if ((cur_cmd > other_char) || (cur_chr > 255))
1842 back_input(); /* not a character put it back and leave */
1845 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1846 /* convert tilde '~' to pseudo tilde */
1847 /* if (pseudo_tilde != 0 && cur_chr == '~') cur_chr = pseudo_tilde; */
1848 /* convert space ' ' to pseudo space */
1849 /* if (pseudo_space != 0 && cur_chr == ' ') cur_chr = pseudo_space; */
1850 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1851 if (!more_name(cur_chr)) /* up to next white space */
1858 name_in_progress = false;
1860 /* argument is string .fmt, .log, or .dvi */
1862 void pack_job_name_(str_number s)
1864 cur_area = 335; /* "" */
1866 cur_name = job_name;
1867 pack_file_name(cur_name, cur_area, cur_ext);
1870 /**********************************************************************/
1871 /* show TEXINPUTS=... or format specific */
1872 /* only show this if name was not fully qualified ? */
1873 void show_tex_inputs (void)
1877 s = "TEXINPUTS"; /* default */
1879 if (format_specific)
1881 s = format_name; /* try specific */
1883 if (grabenv(s) == NULL)
1884 s = "TEXINPUTS"; /* no format specific */
1887 if (grabenv(s) == NULL)
1888 s = "TEXINPUT"; /* 94/May/19 */
1910 /**********************************************************************/
1912 /* s - what can't be found, e - default */
1913 void prompt_file_name_(char * s, str_number e)
1917 if (interaction == scroll_mode);
1919 if (!strcmp("input file name", s))
1920 print_err("I can't find file `");
1922 print_err("I can't write on file `");
1924 print_file_name(cur_name, cur_area, cur_ext);
1927 if (!strcmp("input file name", s))
1929 if (cur_area == 335) /* "" only if path not specified */
1931 if (show_texinput_flag)
1936 if (e == 785) /* .tex */
1939 print_nl("Please type another ");
1942 if (interaction < 2)
1944 fatal_error("*** (job aborted, file error in nonstop mode)");
1945 return; // abort_flag set
1950 show_line(" (or ^z to exit)", 0);
1952 show_line(" (or Ctrl-Z to exit)", 0);
1956 term_input(": ", 0);
1958 /* should we deal with tilde and space in file name here ??? */
1963 while ((buffer[k] == ' ') && (k < last))
1965 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1966 quoted_file_name = 0; /* 98/March/15 */
1968 if (allow_quoted_names && k < last) /* check whether quoted name */
1970 if (buffer[k]== '"')
1972 quoted_file_name = 1;
1980 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1981 /* convert tilde '~' to pseudo tilde */
1982 if (pseudo_tilde != 0 && buffer[k]== '~')
1983 buffer[k] = pseudo_tilde;
1984 /* convert space ' ' to pseudo space */
1985 if (pseudo_space != 0 && buffer[k]== ' ')
1986 buffer[k] = pseudo_space;
1987 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1988 if (!more_name(buffer[k]))
1996 if (cur_ext == 335) /* "" */
1997 cur_ext = e; /* use default extension */
1999 pack_file_name(cur_name, cur_area, cur_ext);
2002 void open_log_file (void)
2007 ccharpointer months;
2009 old_setting = selector;
2012 job_name = 790; /* default: texput */
2014 pack_job_name(".log");
2016 while (!a_open_out(log_file))
2018 selector = term_only;
2019 prompt_file_name("transcript file name", ".log");
2022 texmf_log_name = a_make_name_string(log_file);
2023 selector = log_only;
2026 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2027 // for our version DOS/Windows
2030 stamp_it(log_line); // ??? use log_line ???
2031 strcat(log_line, "\n");
2032 (void) fputs(log_line, log_file);
2033 stampcopy(log_line);
2034 strcat(log_line, "\n");
2035 (void) fputs(log_line, log_file);
2037 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2038 /* also change following in itex.c - bkph */
2039 (void) fputs(tex_version, log_file);
2040 (void) fprintf(log_file, " (%s %s)", application, yandyversion);
2042 if (format_ident > 0)
2043 slow_print(format_ident); /* bkph */
2046 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2051 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2053 months = " JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
2055 for (k = 3 * month - 2; k <= 3 * month; k++)
2056 (void) putc(months[k], log_file);
2059 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2064 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2066 print_two(tex_time / 60); /* hour */
2068 print_two(tex_time % 60); /* minute */
2071 input_stack[input_ptr] = cur_input;
2073 l = input_stack[0].limit_field;
2075 if (buffer[l] == end_line_char)
2078 for (k = 1; k <= l; k++)
2082 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2083 /* a good place to show the fmt file name or pool file name ? 94/June/21 */
2086 if (string_file != NULL)
2088 fprintf(log_file, "(%s)\n", string_file);
2089 free(string_file); /* this was allocated by strdup in openinou */
2090 string_file = NULL; /* for safety */
2093 if (format_file != NULL)
2095 fprintf(log_file, "(%s)\n", format_file);
2096 free(format_file); /* this was allocated by strdup in openinou */
2097 format_file = NULL; /* for safety */
2100 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2101 selector = old_setting + 2;
2104 /**************************** start of insertion 98/Feb/7 **************/
2106 // Attempt to deal with foo.bar.tex given as foo.bar on command line
2107 // Makes copy of job_name with extension
2109 void morenamecopy(ASCII_code c)
2111 #ifdef ALLOCATESTRING
2112 if (pool_ptr + 1 > current_pool_size)
2113 str_pool = realloc_str_pool (increment_pool_size);
2115 if (pool_ptr + 1 > current_pool_size) /* in case it failed 94/Jan/24 */
2117 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
2118 return; // abort_flag set
2121 if (pool_ptr + 1 > pool_size)
2123 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
2124 return; // abort_flag set
2127 str_pool[pool_ptr] = c;
2131 int endnamecopy(void)
2133 #ifdef ALLOCATESTRING
2134 if (str_ptr + 1 > current_max_strings)
2135 str_start = realloc_str_start(increment_max_strings + 1);
2137 if (str_ptr + 1 > current_max_strings) /* in case it failed 94/Jan/24 */
2139 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
2140 return 0; // abort_flag set
2143 if (str_ptr + 1 > max_strings)
2145 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
2146 return 0; // abort_flag set
2149 return make_string();
2152 /* add extension to job_name */
2153 void jobnameappend (void)
2157 k = str_start[job_name];
2158 n = str_start[job_name + 1];
2161 morenamecopy(str_pool[k++]);
2162 /* copy `extension' */
2163 k = str_start[cur_ext];
2164 n = str_start[cur_ext + 1];
2167 morenamecopy(str_pool[k++]);
2169 job_name = endnamecopy();
2172 /**************************** end of insertion 98/Feb/7 **************/
2174 void start_input (void)
2176 bool addedextension = false;
2178 pack_file_name(cur_name, cur_area, cur_ext);
2180 while (true) { /* loop until we get a valid file name */
2181 addedextension = false;
2182 begin_file_reading();
2183 /* *** *** *** *** *** following is new in 3.14159 *** *** *** *** *** *** */
2184 /* if current extension is *not* empty, try to open using name as is */
2185 /* string 335 is "" the empty string */
2186 if ((cur_ext != 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2188 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2189 /* we get here if extension is "", or file with extension failed to open */
2190 /* if current extension is not `tex,' and `tex' is not irrelevant, try it */
2191 /* string 785 is .tex */
2192 /* (! extensionirrelevantp(name_of_file, "tex"))){ */
2193 if ((cur_ext != 785) && (name_length + 5 < PATHMAX) &&
2194 (! extensionirrelevantp(name_of_file, name_length, "tex")))
2196 name_of_file[name_length + 1] = '.';
2197 name_of_file[name_length + 2] = 't';
2198 name_of_file[name_length + 3] = 'e';
2199 name_of_file[name_length + 4] = 'x';
2200 name_of_file[name_length + 5] = ' '; /* 96/Jan/20 ??? */
2201 name_length = name_length + 4;
2203 addedextension = true;
2204 /* *** *** *** *** following new in 3.14159 *** *** *** *** *** *** *** */
2205 if (a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2208 name_length = name_length - 4; /* strip extension again */
2209 name_of_file[name_length + 1] = ' '; /* ' ' */
2210 addedextension = false;
2211 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2213 /* *** *** *** *** major changes here in 3.14159 *** *** *** *** *** *** */
2214 /* string 335 is "" the empty string */
2215 if ((cur_ext == 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2218 if (maketextex() && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2220 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2222 prompt_file_name("input file name", ".tex");
2223 } /* end of while(true)trying to get valid file name */
2225 /* maybe set pseudo_tilde = 0 at this point ? 95/Sep/26 */
2227 cur_input.name_field = a_make_name_string(input_file[cur_input.index_field]);
2229 if (job_name == 0) /* only the first time */
2231 job_name = cur_name; /* here we set the job_name */
2232 /* did file name have an `extension' already and we added ".tex" ? */
2233 if (cur_ext != 335 && addedextension) /* 98/Feb/7 */
2234 jobnameappend(); /* append `extension' to job_name */
2237 if (term_offset + length(cur_input.name_field) > max_print_line - 2) /* was 3 ? */
2239 else if ((term_offset > 0) || (file_offset > 0))
2242 // print_char(64); // debugging only marker
2244 if (open_parens > max_open_parens)
2245 max_open_parens = open_parens; /* 1999/Jan/17 */
2246 slow_print(cur_input.name_field);
2247 // print_char(64); // debugging only marker
2251 cur_input.state_field = new_line;
2254 if (input_ln(input_file[cur_input.index_field], false));
2256 if ((end_line_char < 0) || (end_line_char > 255))
2257 decr(cur_input.limit_field);
2259 buffer[cur_input.limit_field] = end_line_char;
2260 first = cur_input.limit_field + 1;
2261 cur_input.loc_field = cur_input.start_field;
2265 /**********************************************************************/
2266 /* show TEXFONTS=... or format specific */
2267 /* only show this if name was not fully qualified ? */
2268 void show_tex_fonts (void)
2270 char *s, *t, *v, *u;
2273 if (encoding_specific) {
2274 u = encoding_name; /* try specific */
2275 if ((t = grabenv(u)) != NULL) {
2276 if (strchr(t, ':') != NULL &&
2277 sscanf(t, "%d", &n) == 0) {
2278 s = u; /* look here instead of TEXFONTS=... */
2286 while (*t > '\0') print_char(*t++);
2291 while (*t > '\0') print_char(*t++);
2296 /**********************************************************************/
2298 /* called only from tex8.c */
2300 internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
2302 register internal_font_number Result;
2305 /* halfword lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np; */
2306 halfword lf, lh, nw, nh, nd, ni, nl, nk, ne, np;
2307 /* halfword bc, ec; */
2308 int bc, ec; /* 95/Jan/7 */
2309 internal_font_number f;
2310 internal_font_number g;
2311 eight_bits a, b, c, d;
2322 pack_file_name(nom, aire, 805); /* .tfm */
2324 if (!b_open_in(tfm_file)) /* new in C version d */
2328 if (!b_open_in(tfm_file))
2333 /* was just: goto lab11; */
2336 /* tfm_temp = getc(tfm_file); */ /* done already in open_input, but why? */
2341 tfm_temp = getc(tfm_file);
2342 lf = lf * 256 + tfm_temp;
2344 tfm_temp = getc(tfm_file);
2349 tfm_temp = getc(tfm_file);
2350 lh = lh * 256 + tfm_temp;
2352 tfm_temp = getc(tfm_file);
2357 tfm_temp = getc(tfm_file);
2358 bc = bc * 256 + tfm_temp;
2360 tfm_temp = getc(tfm_file);
2365 tfm_temp = getc(tfm_file);
2366 ec = ec * 256 + tfm_temp;
2368 if ((bc > ec + 1)||(ec > 255))
2375 tfm_temp = getc(tfm_file);
2380 tfm_temp = getc(tfm_file);
2381 nw = nw * 256 + tfm_temp;
2383 tfm_temp = getc(tfm_file);
2388 tfm_temp = getc(tfm_file);
2389 nh = nh * 256 + tfm_temp;
2391 tfm_temp = getc(tfm_file);
2396 tfm_temp = getc(tfm_file);
2397 nd = nd * 256 + tfm_temp;
2399 tfm_temp = getc(tfm_file);
2404 tfm_temp = getc(tfm_file);
2405 ni = ni * 256 + tfm_temp;
2407 tfm_temp = getc(tfm_file);
2412 tfm_temp = getc(tfm_file);
2413 nl = nl * 256 + tfm_temp;
2415 tfm_temp = getc(tfm_file);
2420 tfm_temp = getc(tfm_file);
2421 nk = nk * 256 + tfm_temp;
2423 tfm_temp = getc(tfm_file);
2428 tfm_temp = getc(tfm_file);
2429 ne = ne * 256 + tfm_temp;
2431 tfm_temp = getc(tfm_file);
2436 tfm_temp = getc(tfm_file);
2437 np = np * 256 + tfm_temp;
2439 if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
2442 if ((nw == 0) || (nh == 0) || (nd == 0) || (ni == 0))
2450 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2452 if ((fmem_ptr + lf > current_font_mem_size)) /* 93/Nov/28 */
2453 font_info = realloc_font_info (increment_font_mem_size + lf);
2455 if ((font_ptr == font_max) || (fmem_ptr + lf > current_font_mem_size))
2457 if ((font_ptr == font_max) || (fmem_ptr + lf > font_mem_size))
2462 sprintf(log_line, "font_ptr %d font_max %d fmem_ptr %d lf %d font_mem_size %d\n",
2463 font_ptr, font_max, fmem_ptr, lf, font_mem_size); /* debugging */
2464 show_line(log_line, 0);
2470 print_file_name(nom, aire, 335); /* "" */
2474 print_string(" at ");
2478 else if (s != -1000)
2480 print_string(" scaled ");
2481 print_int(- (integer) s);
2484 print_string(" not loaded: Not enough room left");
2485 help4("I'm afraid I won't be able to make use of this font,",
2486 "because my memory for character-size data is too small.",
2487 "If you're really stuck, ask a wizard to enlarge me.",
2488 "Or maybe try `I\\font<same font id>=<name of loaded font>'.");
2494 char_base[f] = fmem_ptr - bc;
2495 width_base[f] = char_base[f] + ec + 1;
2496 height_base[f] = width_base[f] + nw;
2497 depth_base[f] = height_base[f] + nh;
2498 italic_base[f] = depth_base[f] + nd;
2499 lig_kern_base[f] = italic_base[f] + ni;
2500 kern_base[f] = lig_kern_base[f] + nl - 256 * (128);
2501 exten_base[f] = kern_base[f] + 256 *(128) + nk;
2502 param_base[f] = exten_base[f] + ne;
2507 /* build the font checksum now */
2509 tfm_temp = getc(tfm_file);
2512 tfm_temp = getc(tfm_file);
2515 tfm_temp = getc(tfm_file);
2518 tfm_temp = getc(tfm_file);
2524 tfm_temp = getc(tfm_file);
2529 tfm_temp = getc(tfm_file);
2530 z = z * 256 + tfm_temp;
2533 tfm_temp = getc(tfm_file);
2534 z = z * 256 + tfm_temp;
2535 tfm_temp = getc(tfm_file);
2536 z =(z * 16) + (tfm_temp / 16);
2543 tfm_temp = getc(tfm_file);
2544 tfm_temp = getc(tfm_file);
2545 tfm_temp = getc(tfm_file);
2546 tfm_temp = getc(tfm_file);
2556 z = xn_over_d(z, - (integer) s, 1000);
2560 for (k = fmem_ptr; k <= width_base[f] - 1; k++)
2563 tfm_temp = getc(tfm_file);
2566 tfm_temp = getc(tfm_file);
2569 tfm_temp = getc(tfm_file);
2572 tfm_temp = getc(tfm_file);
2575 font_info[k].qqqq = qw;
2578 if ((a >= nw) || (b / 16 >= nh) || (b % 16 >= nd) || (c / 4 >= ni))
2594 if ((d < bc)||(d > ec))
2597 while (d < k + bc - fmem_ptr) {
2598 qw = font_info[char_base[f]+ d].qqqq;
2599 if (((qw.b2)% 4)!= 2)
2603 if (d == k + bc - fmem_ptr)
2615 while (z >= 8388608L) { /* 2^23 */
2617 alpha = alpha + alpha;
2619 beta = (char) (256 / alpha);
2623 for (k = width_base[f]; k <= lig_kern_base[f] - 1; k++)
2625 tfm_temp = getc(tfm_file);
2627 tfm_temp = getc(tfm_file);
2629 tfm_temp = getc(tfm_file);
2631 tfm_temp = getc(tfm_file);
2633 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2635 font_info[k].cint = sw;
2637 font_info[k].cint = sw - alpha;
2641 if (font_info[width_base[f]].cint != 0)
2643 if (font_info[height_base[f]].cint != 0)
2645 if (font_info[depth_base[f]].cint != 0)
2647 if (font_info[italic_base[f]].cint != 0)
2650 /* read ligature/kern program */
2651 bchlabel = 32767; /* '77777 */
2656 for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128)- 1; k++)
2659 tfm_temp = getc(tfm_file);
2662 tfm_temp = getc(tfm_file);
2665 tfm_temp = getc(tfm_file);
2668 tfm_temp = getc(tfm_file);
2671 font_info[k].qqqq = qw; /* store_four_quarters(font_info[k].qqqq */
2675 if (256 * c + d >= nl)
2676 goto lab11; /* error in TFM, abort */
2678 if (k == lig_kern_base[f])
2686 if ((b < bc) || (b > ec)) /* check-existence(b) */
2687 goto lab11; /* error in TFM, abort */
2689 qw = font_info[char_base[f] + b].qqqq;
2691 goto lab11; /* error in TFM, abort */
2696 if ((d < bc) || (d > ec)) /* check-existence(d) */
2697 goto lab11; /* error in TFM, abort */
2699 qw = font_info[char_base[f] + d].qqqq;
2701 goto lab11; /* error in TFM, abort */
2703 else if (256 * (c - 128) + d >= nk)
2704 goto lab11; /* error in TFM, abort */
2706 if (k - lig_kern_base[f] + a + 1 >= nl)
2707 goto lab11; /* error in TFM, abort */
2711 bchlabel = 256 * c + d;
2714 for (k = kern_base[f] + 256 * (128); k <= exten_base[f] - 1; k++)
2716 tfm_temp = getc(tfm_file);
2718 tfm_temp = getc(tfm_file);
2720 tfm_temp = getc(tfm_file);
2722 tfm_temp = getc(tfm_file);
2724 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2726 font_info[k].cint = sw;
2728 font_info[k].cint = sw - alpha;
2731 /* read extensible character recipes */
2732 /* for k:=exten_base[f] to param_base[f]-1 do */
2733 for (k = exten_base[f]; k <= param_base[f] - 1; k++)
2736 tfm_temp = getc(tfm_file);
2739 tfm_temp = getc(tfm_file);
2742 tfm_temp = getc(tfm_file);
2745 tfm_temp = getc(tfm_file);
2748 /* store_four_quarters(font_info[k].qqqq); */
2749 font_info[k].qqqq = qw;
2754 if ((a < bc) || (a > ec))
2757 qw = font_info[char_base[f] + a].qqqq;
2764 if ((b < bc) || (b > ec))
2767 qw = font_info[char_base[f] + b].qqqq;
2774 if ((c < bc) || (c > ec))
2777 qw = font_info[char_base[f] + c].qqqq;
2783 if ((d < bc) || (d > ec))
2786 qw = font_info[char_base[f] + d].qqqq;
2792 for (k = 1; k <= np; k++)
2795 tfm_temp = getc(tfm_file);
2799 tfm_temp = getc(tfm_file);
2800 sw = sw * 256 + tfm_temp;
2801 tfm_temp = getc(tfm_file);
2802 sw = sw * 256 + tfm_temp;
2803 tfm_temp = getc(tfm_file);
2804 font_info[param_base[f]].cint = (sw * 16) + (tfm_temp / 16);
2808 tfm_temp = getc(tfm_file);
2810 tfm_temp = getc(tfm_file);
2812 tfm_temp = getc(tfm_file);
2814 tfm_temp = getc(tfm_file);
2816 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2818 font_info[param_base[f] + k - 1].cint = sw;
2820 font_info[param_base[f] + k - 1].cint = sw - alpha;
2823 /* use test_eof() here instead ? */
2826 for (k = np + 1; k <= 7; k++)
2827 font_info[param_base[f] + k - 1].cint = 0;
2829 /* @<Make final adjustments...@>= l.11174 */
2831 font_params[f] = np;
2834 hyphen_char[f] = default_hyphen_char;
2835 skew_char[f] = default_skew_char;
2837 bchar_label[f] = bchlabel + lig_kern_base[f];
2839 bchar_label[f]= non_address; /* i.e. 0 --- 96/Jan/15 */
2840 font_bchar[f] = bchar;
2841 font_false_bchar[f] = bchar;
2845 qw = font_info[char_base[f] + bchar].qqqq;
2847 font_false_bchar[f] = 256;
2850 font_area[f] = aire;
2853 font_glue[f] = 0; /* font_glue[f]:=null; l.11184 */
2854 char_base[f] = char_base[f];
2855 width_base[f] = width_base[f];
2856 lig_kern_base[f] = lig_kern_base[f];
2857 kern_base[f] = kern_base[f];
2858 exten_base[f] = exten_base[f];
2859 decr(param_base[f]);
2860 fmem_ptr = fmem_ptr + lf;
2868 print_file_name(nom, aire, 335); /* "" */
2871 print_string(" at ");
2875 else if (s != -1000)
2877 print_string("scaled");
2878 print_int(- (integer) s);
2882 print_string(" not loadable: Bad metric (TFM) file");
2884 print_string(" not loadable: Metric (TFM) file not found");
2886 if (aire == 335) /* "" only if path not specified */
2888 if (show_texinput_flag) show_tex_fonts(); /* 98/Jan/31 */
2891 help5("I wasn't able to read the size data for this font,",
2892 "so I will ignore the font specification.",
2893 "[Wizards can fix TFM files using TFtoPL/PLtoTF.]",
2894 "You might try inserting a different font spec;",
2895 "e.g., type `I\\font<same font id>=<substitute font name>'.");