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 */
40 } while (!(cur_cmd != spacer));
47 } while (!(cur_tok != 3115));
55 if (cur_cmd <= right_brace)
56 if (cur_cmd == right_brace)
61 /* else if cur_tok<cs_token_flag+single_base then ... */
62 else if (cur_tok < 4352) /* 4095 + 257 */
63 /* cur_val:=cur_tok-cs_token_flag-active_base */
64 cur_val = cur_tok - 4096; /* 4095 + 1 */
65 /* else cur_val:=cur_tok-cs_token_flag-single_base; */
66 else cur_val = cur_tok - 4352; /* 4095 + 257 */
69 print_err("Improper alphabetic constant");
70 help2("A one-character control sequence belongs after a ` mark.",
71 "So I'm essentially inserting \\0 here.");
78 if (cur_cmd != spacer)
81 } else if ((cur_cmd >= min_internal) && (cur_cmd <= max_internal))
83 scan_something_internal(0, false);
88 m = 214748364L; /* 7FFFFFFF hex */
92 m = 268435456L; /* 2^28 */
95 else if (cur_tok == 3106)
98 m = 134217728L; /* 2^27 8000000 hex */
105 if ((cur_tok < 3120 + radix) && (cur_tok >= 3120) && (cur_tok <= 3129))
107 else if (radix == 16)
108 if ((cur_tok <= 2886) && (cur_tok >= 2881))
110 else if ((cur_tok <= 3142) && (cur_tok >= 3137))
117 if ((cur_val >= m) && ((cur_val > m) || (d > 7) || (radix != 10)))
121 print_err("Number too big");
122 help2("I can only go up to 2147483647='17777777777=\"7FFFFFFF,",
123 "so I'm using that number instead of yours.");
125 cur_val = 2147483647L; /* 7FFFFFFF hex */
130 cur_val = cur_val * radix + d;
136 print_err("Missing number, treated as zero");
137 help3("A number should have been here; I inserted `0'.",
138 "(If you can't figure out why I needed to see a number,",
139 "look up `weird error' in the index to The TeXbook.)");
142 else if (cur_cmd != spacer)
146 cur_val = - (integer) cur_val;
149 void scan_dimen_(bool mu, bool inf, bool shortcut)
168 } while (!(cur_cmd != spacer));
172 negative = ! negative;
175 } while (!(cur_tok != 3115));
177 if ((cur_cmd >= min_internal) && (cur_cmd <= max_internal))
180 scan_something_internal(mu_val, false);
181 if (cur_val_level >= glue_val)
184 delete_glue_ref(cur_val);
187 if (cur_val_level == mu_val)
189 if (cur_val_level != int_val)
196 scan_something_internal(dimen_val, false);
197 if (cur_val_level == dimen_val)
216 if ((radix == 10) && (cur_tok == 3118))
219 p = 0; /* p:=null l.8883 */
224 if ((cur_tok > 3129) || (cur_tok < 3120))
229 info(q) = cur_tok - 3120;
235 for (kk = k; kk >= 1; kk--)
237 dig[kk - 1] = info(p);
242 f = round_decimals(k);
243 if (cur_cmd != spacer)
250 negative = !negative;
251 cur_val = - (integer) cur_val;
254 if (scan_keyword("fil")) {
256 while (scan_keyword("l")) {
257 if (cur_order == filll)
259 print_err("Illegal unit of measure(");
260 print_string("replaced by filll)");
261 help1("I dddon't go any higher than filll.");
269 savecurval = cur_val;
272 } while (!(cur_cmd != spacer));
274 if ((cur_cmd < min_internal) || (cur_cmd > max_internal))
280 scan_something_internal(mu_val, false);
281 if (cur_val_level >= glue_val)
284 delete_glue_ref(cur_val);
287 if (cur_val_level != mu_val)
294 scan_something_internal(dimen_val, false);
301 if (scan_keyword("em"))
302 v = (font_info[6 + param_base[eqtb[(hash_size + 1834)].hh.v.RH]].cint);
303 else if (scan_keyword("ex"))
304 v = (font_info[5 + param_base[eqtb[(hash_size + 1834)].hh.v.RH]].cint);
309 if (cur_cmd != spacer)
313 cur_val = mult_and_add(savecurval, v, xn_over_d(v, f, 65536L), 1073741823L); /* 2^30 - 1 */
318 if (scan_keyword("mu"))
322 print_err("Illegal unit of measure(");
323 print_string("mu inserted)");
324 help4("The unit of measurement in math glue must be mu.",
325 "To recover gracefully from this error, it's best to",
326 "delete the erroneous units; e.g., type `2' to delete",
327 "two letters. (See Chapter 27 of The TeXbook.)");
331 if (scan_keyword("true"))
336 cur_val = xn_over_d(cur_val, 1000, mag);
337 f = (1000 * f + 65536L * tex_remainder) / mag;
338 cur_val = cur_val + (f / 65536L);
342 if (scan_keyword("pt"))
344 if (scan_keyword("in"))
349 else if (scan_keyword("pc"))
354 else if (scan_keyword("cm"))
359 else if (scan_keyword("mm"))
364 else if (scan_keyword("bp"))
369 else if (scan_keyword("dd"))
374 else if (scan_keyword("cc"))
379 else if (scan_keyword("Q"))
384 else if (scan_keyword("H"))
389 else if (scan_keyword("sp"))
393 print_err("Illegal unit of measure(");
394 print_string("pt inserted)");
395 help6("Dimensions can be in units of em, ex, in, pt, pc,",
396 "cm, mm, dd, cc, bp, or sp; but yours is a new one!",
397 "I'll assume that you meant to say pt, for printer's points.",
398 "To recover gracefully from this error, it's best to",
399 "delete the erroneous units; e.g., type `2' to delete",
400 "two letters. (See Chapter 27 of The TeXbook.)");
404 cur_val = xn_over_d(cur_val, num, denom);
405 f = (num * f + 65536L * tex_remainder) / denom;
406 cur_val = cur_val +(f / 65536L);
410 if (cur_val >= 16384) /* 2^14 */
413 cur_val = cur_val * 65536L + f;
417 if (cur_cmd != spacer)
421 if (arith_error || (abs(cur_val)>= 1073741824L)) /* 2^30 */
423 print_err("Dimension too large");
424 help2("I can't work with sizes bigger than about 19 feet.",
425 "Continue and I'll use the largest value I can.");
427 cur_val = 1073741823L; /* 2^30 - 1 */
431 cur_val = - (integer) cur_val;
434 void scan_glue_(small_number level)
440 mu = (level == mu_val);
445 } while (!(cur_cmd != spacer));
449 negative = !negative;
452 } while (!(cur_tok != 3115));
454 if ((cur_cmd >= min_internal) && (cur_cmd <= max_internal))
456 scan_something_internal(level, negative);
457 if (cur_val_level >= glue_val)
459 if (cur_val_level != level)
465 if (cur_val_level == int_val)
467 scan_dimen(mu, false, true);
469 else if (level == mu_val)
477 scan_dimen(mu, false, false);
479 cur_val = - (integer) cur_val;
483 if (scan_keyword("plus"))
485 scan_dimen(mu, true, false);
486 stretch(q) = cur_val;
487 stretch_order(q) = cur_order;
489 if (scan_keyword("minus"))
491 scan_dimen(mu, true, false);
493 shrink_order(q) = cur_order;
498 halfword scan_rule_spec (void)
502 if (cur_cmd == vrule)
503 width(q) = default_rule;
506 height(q) = default_rule;
510 if (scan_keyword("width"))
512 scan_dimen(false, false, false);
516 if (scan_keyword("height"))
518 scan_dimen(false, false, false);
522 if (scan_keyword("depth"))
524 scan_dimen(false, false, false);
531 halfword str_toks_(pool_pointer b)
538 #ifdef ALLOCATESTRING
539 if (pool_ptr + 1 > current_pool_size)
540 str_pool = realloc_str_pool(increment_pool_size);
541 if (pool_ptr + 1 > current_pool_size)
542 { /* in case it failed 94/Jan/22 */
543 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
544 return 0; // abort_flag set
547 if (pool_ptr + 1 > pool_size)
549 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
550 return; // abort_flag set
557 while (k < pool_ptr) {
569 avail = mem[q].hh.v.RH;
586 halfword the_toks (void)
588 register halfword Result;
594 scan_something_internal(tok_val, false);
596 if (cur_val_level >= ident_val)
600 if (cur_val_level == ident_val)
604 mem[q].hh.v.LH = 4095 + cur_val;
607 else if (cur_val != 0)
610 while (r != 0) { /* while r<>null do l.9178 */
618 avail = mem[q].hh.v.RH;
626 mem[q].hh.v.LH = mem[r].hh.v.LH;
636 old_setting = selector;
637 selector = new_string;
639 switch (cur_val_level)
646 print_scaled(cur_val);
652 print_spec(cur_val, "pt");
653 delete_glue_ref(cur_val);
658 print_spec(cur_val, "mu");
659 delete_glue_ref(cur_val);
663 selector = old_setting;
664 Result = str_toks(b);
669 void ins_the_toks (void)
671 link(garbage) = the_toks();
672 begin_token_list(link(temp_head), 4);
675 void conv_toks (void)
679 small_number savescannerstatus;
686 case roman_numeral_code:
691 savescannerstatus = scanner_status;
694 scanner_status = savescannerstatus;
704 old_setting = selector;
705 selector = new_string;
712 case roman_numeral_code:
713 print_roman_int(cur_val);
725 print(font_name[cur_val]);
726 if (font_size[cur_val] != font_dsize[cur_val])
728 print_string(" at ");
729 print_scaled(font_size[cur_val]);
737 selector = old_setting;
738 link(garbage) = str_toks(b);
739 begin_token_list(link(temp_head), 4);
742 halfword scan_toks_(bool macrodef, bool xpand)
744 register halfword Result;
753 scanner_status = defining;
755 scanner_status = absorbing;
756 warning_index = cur_cs;
757 def_ref = get_avail();
758 token_ref_count(def_ref) = 0;
769 if (cur_cmd == mac_param)
773 if (cur_cmd == left_brace)
779 mem[q].hh.v.LH = cur_tok;
785 mem[q].hh.v.LH = 3584;
792 print_err("You already have nine parameters");
793 help1("I'm going to ignore the # sign you just used.");
801 print_err("Parameters must be numbered consecutively");
802 help2("I've inserted the digit you should have used after the #.",
803 "Type `1' to delete what you did use.");
812 mem[q].hh.v.LH = cur_tok;
820 mem[q].hh.v.LH = 3584;
824 if (cur_cmd == right_brace)
826 print_err("Missing { inserted");
828 help2("Where was the left brace? You said something like `\\def\\a}',",
829 "which I'm going to interpret as `\\def\\a{}'.");
845 if (cur_cmd <= max_command)
854 if (link(temp_head) != 0)
856 link(p) = link(temp_head);
868 if (cur_cmd < right_brace)
876 else if (cur_cmd == mac_param)
884 if (cur_cmd != mac_param)
885 if ((cur_tok <= 3120) || (cur_tok > t))
887 print_err("Illegal parameter number in definition of");
888 sprint_cs(warning_index);
889 help3("You meant to type ## instead of #, right?",
890 "Or maybe a } was forgotten somewhere earlier, and things",
891 "are all screwed up? I'm going to assume that you meant ##.");
896 cur_tok = 1232 + cur_chr;
901 mem[q].hh.v.LH = cur_tok;
911 mem[q].hh.v.LH = hashbrace;
917 /* used only in ITEX.C */
919 void read_toks_(integer n, halfword r)
924 /* small_number m; */
925 int m; /* 95/Jan/7 */
927 scanner_status = defining;
929 def_ref = get_avail();
930 token_ref_count(def_ref) = 0;
935 mem[q].hh.v.LH = 3584;
938 if ((n < 0) || (n > 15))
943 align_state = 1000000L;
945 begin_file_reading();
946 cur_input.name_field = m + 1;
947 if (read_open[m] == 2)
948 if (interaction > nonstop_mode)
966 fatal_error("*** (cannot \\read from terminal in nonstop modes)");
967 return; // abort_flag set
969 else if (read_open[m] == 1)
970 if (input_ln(read_file[m], false))
974 (void) a_close(read_file[m]);
979 if (!input_ln(read_file[m], true))
981 (void) a_close(read_file[m]);
983 if (align_state != 1000000L)
986 print_err("File ended within");
988 help1("This \\read has unbalanced braces.");
989 align_state = 1000000L;
994 cur_input.limit_field = last;
995 if ((end_line_char < 0) || (end_line_char > 255))
996 decr(cur_input.limit_field);
998 buffer[cur_input.limit_field] = end_line_char;
999 first = cur_input.limit_field + 1;
1000 cur_input.loc_field = cur_input.start_field;
1001 cur_input.state_field = new_line;
1006 if (align_state < 1000000L)
1010 } while(!(cur_tok == 0));
1011 align_state = 1000000L;
1017 mem[q].hh.v.LH = cur_tok;
1023 } while(!(align_state == 1000000L));
1025 scanner_status = normal;
1029 void pass_text (void)
1032 small_number savescannerstatus;
1034 savescannerstatus = scanner_status;
1035 scanner_status = skipping;
1040 if (cur_cmd == fi_or_else)
1047 else if (cur_cmd == if_test)
1051 scanner_status = savescannerstatus;
1054 void change_if_limit_(small_number l, halfword p)
1066 return; // abort_flag set
1077 /* called from tex2.c */
1079 void conditional (void)
1085 small_number savescannerstatus;
1086 halfword savecondptr;
1087 small_number thisif;
1089 p = get_node(if_node_size);
1092 subtype(p) = cur_if;
1093 if_line_field(p) = if_line;
1099 savecondptr = cond_ptr;
1108 if (cur_cmd == relax)
1109 if (cur_chr == 257) /* if cur_chr = no_expand_flag then ... p.506 */
1111 cur_cmd = active_char;
1112 cur_chr = cur_tok - 4096;
1115 if ((cur_cmd > active_char) || (cur_chr > 255))
1127 if (cur_cmd == relax)
1128 if (cur_chr == 257) /* if cur_chr = no_expand_flag then ... p.506 */
1130 cur_cmd = active_char;
1131 cur_chr = cur_tok - 4096;
1134 if ((cur_cmd > active_char) || (cur_chr > 255))
1139 if (thisif == if_char_code)
1148 if (thisif == if_int_code)
1151 scan_dimen(false, false, false);
1156 } while(!(cur_cmd != spacer));
1158 if ((cur_tok >= 3132) && (cur_tok <= 3134))
1162 print_err("Missing = inserted for ");
1163 print_cmd_chr(if_test, thisif);
1164 help1("I was expecting to see `<', `=', or `>'. Didn't.");
1168 if (thisif == if_int_code)
1171 scan_dimen(false, false, false);
1191 b = (abs(mode) == 1);
1194 b = (abs(mode) == 102);
1197 b = (abs(mode) == 203);
1206 scan_eight_bit_int();
1208 if (thisif == if_void_code)
1212 else if (thisif == if_hbox_code)
1213 b = (type(p) == hlist_node);
1215 b = (type(p) == vlist_node);
1220 savescannerstatus = scanner_status;
1229 else if (cur_cmd < call)
1239 while ((p != 0) && (q != 0))
1240 if (info(p) != info(q))
1247 b = ((p == 0) && (q == 0));
1250 scanner_status = savescannerstatus;
1255 scan_four_bit_int();
1256 b = (read_open[cur_val] == 2);
1269 if (tracing_commands > 1)
1272 print_string("{case ");
1275 end_diagnostic(false);
1279 if (cond_ptr == savecondptr)
1280 if (cur_chr == or_code)
1284 else if (cur_chr == fi_code)
1287 if_line = if_line_field(p);
1288 cur_if = subtype(p);
1291 free_node(p, if_node_size);
1294 change_if_limit(or_code, savecondptr);
1299 if (tracing_commands > 1)
1303 print_string("{true}");
1305 print_string("{false}");
1306 end_diagnostic(false);
1308 if (b) /* b may be used without ... */
1310 change_if_limit(else_code, savecondptr);
1315 if (cond_ptr == savecondptr)
1317 if (cur_chr != or_code)
1319 print_err("Extra ");
1321 help1("I'm ignoring this; it doesn't match any \\if.");
1324 else if (cur_chr == fi_code)
1327 if_line = if_line_field(p);
1328 cur_if = subtype(p);
1331 free_node(p, if_node_size);
1335 if (cur_chr == fi_code)
1338 if_line = if_line_field(p);
1339 cur_if = subtype(p);
1342 free_node(p, if_node_size);
1348 void begin_name (void)
1350 area_delimiter = 0; /* index between `file area' and `file name' */
1351 ext_delimiter = 0; /* index between `file name' and `file extension' */
1353 /* This gathers up a file name and makes a string of it */
1354 /* Also tries to break it into `file area' `file name' and `file extension' */
1355 /* Used by scan_file_name and prompt_file_name */
1356 /* We assume tilde has been converted to pseudo_tilde and space to pseudo_space */
1357 /* returns false if it is given a space character - end of file name */
1359 bool more_name_(ASCII_code c)
1361 register bool Result;
1363 /* if (c == 32)*/ /* white space delimits file name ... */
1364 if (quoted_file_name == 0 && c == 32)
1366 else if (quoted_file_name != 0 && c == '"')
1368 quoted_file_name = 0; /* catch next space character */
1369 Result = true; /* accept ending quote, but throw away */
1373 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1374 /* convert pseudo tilde back to '~' 95/Sep/26 */ /* moved here 97/June/5 */
1375 /* if (pseudo_tilde != 0 && c == pseudo_tilde) c = '~'; */
1376 /* convert pseudo space back to ' ' 97/June/5 */ /* moved here 97/June/5 */
1377 /* if (pseudo_space != 0 && c == pseudo_space) c = ' '; */
1378 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1380 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1381 #ifdef ALLOCATESTRING
1382 if (pool_ptr + 1 > current_pool_size)
1383 str_pool = realloc_str_pool(increment_pool_size);
1384 if (pool_ptr + 1 > current_pool_size)
1385 { /* in case it failed 94/Jan/24 */
1386 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
1387 return 0; // abort_flag set
1390 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1391 if (pool_ptr + 1 > pool_size)
1393 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
1394 return 0; // abort_flag set
1399 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1400 // if ((c == 47)) /* / */
1402 if ((c == '/' || c == '\\' || c == ':')) /* 94/Mar/1 */
1403 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1405 area_delimiter = cur_length;
1409 ext_delimiter = cur_length;
1414 /******************************** 2000 August 15th start ***********************/
1416 // The following code is to save string space used by TeX for filenames
1417 // Not really critical in a system that has dynamic memory allocation
1418 // And may slow it down slightly - although this linear search only
1419 // occurs when opening a file, which is somewhat slow inany case...
1421 // see if string from str_pool[start] to str_pool[end]
1422 // occurs elsewhere in string pool - returns string number
1423 // returns -1 if not found in string pool 2000 Aug 15
1425 int find_string (int start, int end)
1427 int k, nlen = end-start;
1430 // int trace_flag = 1; // debugging only
1434 sprintf(log_line, "\nLOOKING for string (str_ptr %d nlen %d) ", str_ptr, end-start);
1435 s = log_line + strlen(log_line);
1436 strncpy(s, str_pool + start, nlen);
1438 show_line(log_line, 0);
1441 // avoid problems with(cur_name == flushablestring)by going only up to str_ptr-1
1442 // code in new_font (tex8.c) will take care of reuse of font name already
1443 // for (k = 0; k < str_ptr; k++) {
1444 for (k = 0; k < str_ptr-1; k++)
1446 if (length(k) != nlen) continue;
1447 if (strncmp((const char *) str_pool + start, (const char *) str_pool + str_start[k], nlen) == 0) {
1449 sprintf(log_line, "\nFOUND the string %d (%d) ", k, str_start[k+1]-str_start[k]);
1450 s = log_line + strlen(log_line);
1451 strncpy(s, (const char *)str_pool + start, nlen);
1452 strcpy(s+nlen, "\n");
1453 show_line(log_line, 0);
1455 return k; // return number of matching string
1459 sprintf(log_line, "\nNOT FOUND string ");
1460 s = log_line + strlen(log_line);
1461 strncpy(s, (const char*)str_pool + start, nlen);
1462 strcpy(s+nlen, "\n");
1463 show_line(log_line, 0);
1465 return -1; // no match found
1468 // snip out the string from str_pool[start] to str_pool[end]
1469 // and move everything above it down 2000 Aug 15
1471 void remove_string (int start, int end)
1473 int nlen = pool_ptr - end; // how many bytes to move down
1476 // int trace_flag=1; // debugging only
1477 // if (end < start) show_line("\nEND < START", 1);
1478 // if (pool_ptr < end) show_line("\nPOOLPTR < END", 1);
1482 sprintf(log_line, "\nSTRIPPING OUT %d %d ", n, nlen);
1483 s = log_line + strlen(log_line);
1484 strncpy(s, (const char *)str_pool + start, n);
1486 show_line(log_line, 0);
1488 if (nlen > 0) memcpy(str_pool+start, str_pool+end, nlen);
1489 pool_ptr = start + nlen; // poolprt - (end-start);
1492 void show_string (int k)
1494 int nlen = length(k);
1497 sprintf(log_line, "\nSTRING %5d (%3d) %5d--%5d ",
1498 k, nlen, str_start[k], str_start[k+1]);
1499 s = log_line + strlen(log_line);
1500 strncpy(s, (const char *)str_pool + str_start[k], nlen);
1501 strcpy(s + nlen, "");
1502 show_line(log_line, 0);
1505 void show_all_strings (void)
1508 for (k = 0; k < str_ptr; k++) show_string(k);
1511 // int notfirst=0; // debugging only
1513 /********************************** 2000 August 15 end ****************************/
1515 void end_name (void)
1517 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1518 #ifdef ALLOCATESTRING
1519 if (str_ptr + 3 > current_max_strings)
1520 /* str_start = realloc_str_start(increment_max_strings); */
1521 str_start = realloc_str_start(increment_max_strings + 3);
1522 if (str_ptr + 3 > current_max_strings)
1523 { /* in case it failed 94/Jan/24 */
1524 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
1525 return; // abort_flag set
1528 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1529 if (str_ptr + 3 > max_strings)
1531 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
1532 return; // abort_flag set
1536 // if (notfirst++ == 0) show_all_strings(); // debugging only
1538 if (area_delimiter == 0) // no area delimiter ':' '/' or '\' found
1539 cur_area = 335; // "" default area
1541 if (save_strings_flag &&
1542 (cur_area = find_string(str_start[str_ptr], str_start[str_ptr]+area_delimiter)) > 0) {
1543 remove_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter);
1544 area_delimiter = 0; // area_delimiter - area_delimiter;
1545 if (ext_delimiter != 0) ext_delimiter = ext_delimiter - area_delimiter;
1546 // str_start[str_ptr + 1]= str_start[str_ptr]+ area_delimiter; // test only
1547 // incr(str_ptr); // test only
1549 else { // carve out string for "cur_area"
1551 str_start[str_ptr + 1]= str_start[str_ptr]+ area_delimiter;
1555 if (ext_delimiter == 0){ // no extension delimiter '.' found
1556 cur_ext = 335; // "" default extension
1557 if (save_strings_flag &&
1558 (cur_name = find_string(str_start[str_ptr], pool_ptr)) > 0) {
1559 remove_string(str_start[str_ptr], pool_ptr);
1560 // (void) make_string(); // test only
1562 else // Make string from str_start[str_ptr]to pool_ptr
1563 cur_name = make_string();
1565 else { // did find an extension
1566 if (save_strings_flag &&
1567 (cur_name = find_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter-1)) > 0) {
1568 remove_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter - 1);
1569 // str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1; // test only
1570 // incr(str_ptr); // test only
1572 else { // carve out string for "cur_name"
1574 str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1;
1577 if (save_strings_flag &&
1578 (cur_ext = find_string(str_start[str_ptr], pool_ptr)) > 0) {
1579 remove_string(str_start[str_ptr], pool_ptr);
1580 // (void) make_string(); // test only
1582 else // Make string from str_start[str_ptr]to pool_ptr
1583 cur_ext = make_string();
1587 /* n current name, a current area, e current extension */
1588 /* result in name_of_file[] */
1590 void pack_file_name_(str_number n, str_number a, str_number e)
1597 for (j = str_start[a]; j <= str_start[a + 1] - 1; j++)
1602 name_of_file[k] = xchr[c];
1604 for (j = str_start[n]; j <= str_start[n + 1] - 1; j++)
1609 name_of_file[k] = xchr[c];
1611 for (j = str_start[e]; j <= str_start[e + 1] - 1; j++)
1616 name_of_file[k] = xchr[c];
1622 name_length = PATHMAX - 1;
1623 /* pad it out with spaces ... what for ? in case we modify and forget ? */
1624 for (k = name_length + 1; k <= PATHMAX; k++) name_of_file[k]= ' ';
1625 name_of_file[PATHMAX]= '\0'; /* paranoia 94/Mar/24 */
1627 name_of_file [name_length+1] = '\0';
1630 sprintf(log_line, " pack_file_name `%s' (%d) ", name_of_file + 1, name_length); /* debugging */
1631 show_line(log_line, 0);
1633 name_of_file [name_length + 1] = ' ';
1636 /* Called only from two places tex9.c for format name - specified and default */
1637 /* for specified format name args are 0, a, b name in buffer[a] --- buffer[b] */
1638 /* for default args are format_default_length-4, 1, 0 */
1640 void pack_buffered_name_(small_number n, integer a, integer b)
1645 if (n + b - a + 5 > PATHMAX)
1646 b = a + PATHMAX - n - 5;
1648 /* This loop kicks in when we want the default format name */
1649 for (j = 1; j <= n; j++)
1651 c = xord[TEX_format_default[j]];
1654 name_of_file[k] = xchr[c];
1656 /* This loop kicks in when we want a specififed format name */
1657 for (j = a; j <= b; j++)
1662 name_of_file[k] = xchr[c];
1664 /* This adds the extension from the default format name */
1665 for (j = format_default_length - 3; j <= format_default_length; j++)
1667 c = xord[TEX_format_default[j]];
1670 name_of_file[k] = xchr[c];
1675 name_length = PATHMAX - 1;
1676 /* pad it out with spaces ... what for ? */
1677 for (k = name_length + 1; k <= PATHMAX; k++)
1678 name_of_file[k]= ' ';
1679 name_of_file[PATHMAX]= '\0'; /* paranoia 94/Mar/24 */
1682 str_number make_name_string (void)
1684 register str_number Result;
1687 #ifdef ALLOCATESTRING
1688 if (pool_ptr + name_length > current_pool_size)
1689 str_pool = realloc_str_pool(increment_pool_size + name_length);
1690 if (str_ptr == current_max_strings)
1691 str_start = realloc_str_start(increment_max_strings);
1692 if ((pool_ptr + name_length > current_pool_size) ||
1693 (str_ptr == current_max_strings) || (cur_length > 0))
1695 if ((pool_ptr + name_length > pool_size) || (str_ptr == max_strings) ||
1700 for (k = 1; k <= name_length; k++)
1702 str_pool[pool_ptr]= xord[name_of_file[k]];
1703 // sprintf(log_line, "%d => %d ", name_of_file[k], xord[name_of_file[k]]);
1704 // show_line(log_line, 0); // debugging only
1707 Result = make_string();
1712 str_number a_make_name_string_(alpha_file * f)
1714 register str_number Result;
1715 Result = make_name_string();
1717 } /* f unreferenced ? bkph */
1719 str_number b_make_name_string_(byte_file * f)
1721 register str_number Result;
1722 Result = make_name_string();
1724 } /* f unreferenced ? bkph */
1726 str_number w_make_name_string_(word_file * f)
1728 register str_number Result;
1729 Result = make_name_string();
1731 } /* f unreferenced ? bkph */
1733 /* Used by start_input to scan file name on command line */
1734 /* Also in tex8.c new_font_, open_or_close_in, and do_extension */
1736 void scan_file_name (void)
1738 name_in_progress = true;
1742 } while (!(cur_cmd != spacer));
1743 quoted_file_name = 0; /* 98/March/15 */
1744 if (allow_quoted_names)
1745 { /* check whether quoted name */
1748 quoted_file_name = 1;
1753 if ((cur_cmd > other_char)||(cur_chr > 255))
1755 back_input(); /* not a character put it back and leave */
1758 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1759 /* convert tilde '~' to pseudo tilde */
1760 /* if (pseudo_tilde != 0 && cur_chr == '~') cur_chr = pseudo_tilde; */
1761 /* convert space ' ' to pseudo space */
1762 /* if (pseudo_space != 0 && cur_chr == ' ') cur_chr = pseudo_space; */
1763 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1764 if (!more_name(cur_chr)) /* up to next white space */
1770 name_in_progress = false;
1772 /* argument is string .fmt, .log, or .dvi */
1774 void pack_job_name_(str_number s)
1776 cur_area = 335; /* "" */
1778 cur_name = job_name;
1779 pack_file_name(cur_name, cur_area, cur_ext);
1782 /**********************************************************************/
1783 /* show TEXINPUTS=... or format specific */
1784 /* only show this if name was not fully qualified ? */
1785 void show_tex_inputs (void)
1788 s = "TEXINPUTS"; /* default */
1789 if (format_specific) {
1790 s = format_name; /* try specific */
1791 if (grabenv(s) == NULL) s = "TEXINPUTS"; /* no format specific */
1794 if (grabenv(s) == NULL) s = "TEXINPUT"; /* 94/May/19 */
1798 print_char(40); /*(*/
1800 while (*t > '\0') print_char(*t++);
1805 while (*t > '\0') print_char(*t++);
1810 /**********************************************************************/
1812 void prompt_file_name_(str_number s, str_number e)/* s - what can't be found, e - default */
1815 if (interaction == scroll_mode);
1817 print_err("I can't find file `");
1819 print_err("I can't write on file `");
1820 print_file_name(cur_name, cur_area, cur_ext);
1823 { /* input file name */
1824 if (cur_area == 335)
1825 { /* "" only if path not specified */
1826 if (show_texinput_flag)
1830 if (e == 785) /* .tex */
1832 print_nl("Please type another ");
1834 if (interaction < 2)
1836 fatal_error("*** (job aborted, file error in nonstop mode)");
1837 return; // abort_flag set
1841 show_line(" (or ^z to exit)", 0);
1843 show_line(" (or Ctrl-Z to exit)", 0);
1847 term_input(": ", 0);
1849 /* should we deal with tilde and space in file name here ??? */
1853 /* step over leading spaces ... */
1854 while ((buffer[k]== 32) && (k < last))
1856 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1857 quoted_file_name = 0; /* 98/March/15 */
1858 if (allow_quoted_names && k < last)
1859 { /* check whether quoted name */
1860 if (buffer[k]== '"')
1862 quoted_file_name = 1;
1869 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1870 /* convert tilde '~' to pseudo tilde */
1871 if (pseudo_tilde != 0 && buffer[k]== '~')
1872 buffer[k]= pseudo_tilde;
1873 /* convert space ' ' to pseudo space */
1874 if (pseudo_space != 0 && buffer[k]== ' ')
1875 buffer[k]= pseudo_space;
1876 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1877 if (!more_name(buffer[k]))
1884 if (cur_ext == 335) /* "" */
1885 cur_ext = e; /* use default extension */
1886 pack_file_name(cur_name, cur_area, cur_ext);
1889 void open_log_file (void)
1894 ccharpointer months;
1896 old_setting = selector;
1899 job_name = 790; /* default: texput */
1900 pack_job_name(791); /* .log */
1901 while (!a_open_out(log_file)) {
1902 selector = term_only;
1903 prompt_file_name(793, 791); /* transcript file name texput */
1905 texmf_log_name = a_make_name_string(log_file);
1906 selector = log_only;
1909 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1910 // for our version DOS/Windows
1912 // showversion (log_file); /* in local.c - bkph */
1913 // showversion (stdout);
1914 stamp_it(log_line); // ??? use log_line ???
1915 strcat(log_line, "\n");
1916 (void) fputs(log_line, log_file);
1917 // show_line(buffer, 0); // ??? show on screen as well
1919 stampcopy(log_line);
1920 strcat(log_line, "\n");
1921 // show_line(buffer, 0); // ??? show on screen as well
1922 (void) fputs(log_line, log_file);
1925 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1926 /* also change following in itex.c - bkph */
1927 (void) fputs(tex_version, log_file);
1928 (void) fprintf(log_file, " (%s %s)", application, yandyversion);
1929 if (format_ident > 0)
1930 slow_print(format_ident); /* bkph */
1932 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1937 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1939 months = " JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
1940 for (k = 3 * month - 2; k <= 3 * month; k++)
1941 (void) putc(months[k], log_file);
1943 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1948 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1950 print_two(tex_time / 60); /* hour */
1952 print_two(tex_time % 60); /* minute */
1954 input_stack[input_ptr] = cur_input;
1956 l = input_stack[0].limit_field;
1957 if (buffer[l] == end_line_char)
1959 for (k = 1; k <= l; k++)
1962 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1963 /* a good place to show the fmt file name or pool file name ? 94/June/21 */
1966 if (string_file != NULL)
1968 fprintf(log_file, "(%s)\n", string_file);
1969 free(string_file); /* this was allocated by strdup in openinou */
1970 string_file = NULL; /* for safety */
1972 if (format_file != NULL)
1974 fprintf(log_file, "(%s)\n", format_file);
1975 free(format_file); /* this was allocated by strdup in openinou */
1976 format_file = NULL; /* for safety */
1979 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1980 selector = old_setting + 2;
1983 /**************************** start of insertion 98/Feb/7 **************/
1985 // Attempt to deal with foo.bar.tex given as foo.bar on command line
1986 // Makes copy of job_name with extension
1988 void morenamecopy(ASCII_code c)
1990 #ifdef ALLOCATESTRING
1991 if (pool_ptr + 1 > current_pool_size)
1992 str_pool = realloc_str_pool (increment_pool_size);
1993 if (pool_ptr + 1 > current_pool_size) { /* in case it failed 94/Jan/24 */
1994 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
1995 return; // abort_flag set
1998 if (pool_ptr + 1 > pool_size){
1999 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
2000 return; // abort_flag set
2003 str_pool[pool_ptr]= c;
2007 int endnamecopy(void)
2009 #ifdef ALLOCATESTRING
2010 if (str_ptr + 1 > current_max_strings)
2011 str_start = realloc_str_start(increment_max_strings + 1);
2012 if (str_ptr + 1 > current_max_strings) { /* in case it failed 94/Jan/24 */
2013 overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
2014 return 0; // abort_flag set
2017 if (str_ptr + 1 > max_strings){
2018 overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
2019 return 0; // abort_flag set
2022 return make_string();
2025 void jobnameappend (void)
2026 { /* add extension to job_name */
2029 k = str_start[job_name];
2030 n = str_start[job_name + 1];
2031 while (k < n) morenamecopy(str_pool[k++]);
2032 /* copy `extension' */
2033 k = str_start[cur_ext];
2034 n = str_start[cur_ext + 1];
2035 while (k < n) morenamecopy(str_pool[k++]);
2036 job_name = endnamecopy();
2039 /**************************** end of insertion 98/Feb/7 **************/
2041 void start_input (void)
2043 bool addedextension = false;
2045 pack_file_name(cur_name, cur_area, cur_ext);
2047 while (true) { /* loop until we get a valid file name */
2048 addedextension = false;
2049 begin_file_reading();
2050 /* *** *** *** *** *** following is new in 3.14159 *** *** *** *** *** *** */
2051 /* if current extension is *not* empty, try to open using name as is */
2052 /* string 335 is "" the empty string */
2053 if ((cur_ext != 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2055 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2056 /* we get here if extension is "", or file with extension failed to open */
2057 /* if current extension is not `tex,' and `tex' is not irrelevant, try it */
2058 /* string 785 is .tex */
2059 /* (! extensionirrelevantp(name_of_file, "tex"))){ */
2060 if ((cur_ext != 785) && (name_length + 5 < PATHMAX) &&
2061 (! extensionirrelevantp(name_of_file, name_length, "tex")))
2063 name_of_file[name_length + 1] = '.';
2064 name_of_file[name_length + 2] = 't';
2065 name_of_file[name_length + 3] = 'e';
2066 name_of_file[name_length + 4] = 'x';
2067 name_of_file[name_length + 5] = ' '; /* 96/Jan/20 ??? */
2068 name_length = name_length + 4;
2070 addedextension = true;
2071 /* *** *** *** *** following new in 3.14159 *** *** *** *** *** *** *** */
2072 if (a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2074 name_length = name_length - 4; /* strip extension again */
2075 name_of_file[name_length + 1] = ' '; /* ' ' */
2076 addedextension = false;
2077 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2079 /* *** *** *** *** major changes here in 3.14159 *** *** *** *** *** *** */
2080 /* string 335 is "" the empty string */
2081 if ((cur_ext == 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2083 if (maketextex() && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
2085 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2087 prompt_file_name(781, 785); /* input file name .tex */
2088 } /* end of while(true)trying to get valid file name */
2090 /* maybe set pseudo_tilde = 0 at this point ? 95/Sep/26 */
2092 cur_input.name_field = a_make_name_string(input_file[cur_input.index_field]);
2094 if (job_name == 0) /* only the first time */
2096 job_name = cur_name; /* here we set the job_name */
2097 /* did file name have an `extension' already and we added ".tex" ? */
2098 if (cur_ext != 335 && addedextension) /* 98/Feb/7 */
2099 jobnameappend(); /* append `extension' to job_name */
2102 if (term_offset + length(cur_input.name_field) > max_print_line - 2) /* was 3 ? */
2104 else if ((term_offset > 0) || (file_offset > 0))
2107 // print_char(64); // debugging only marker
2109 if (open_parens > max_open_parens)
2110 max_open_parens = open_parens; /* 1999/Jan/17 */
2111 slow_print(cur_input.name_field);
2112 // print_char(64); // debugging only marker
2116 cur_input.state_field = new_line;
2119 if (input_ln(input_file[cur_input.index_field], false));
2121 if ((end_line_char < 0) || (end_line_char > 255))
2122 decr(cur_input.limit_field);
2124 buffer[cur_input.limit_field] = end_line_char;
2125 first = cur_input.limit_field + 1;
2126 cur_input.loc_field = cur_input.start_field;
2130 /**********************************************************************/
2131 /* show TEXFONTS=... or format specific */
2132 /* only show this if name was not fully qualified ? */
2133 void show_tex_fonts (void)
2135 char *s, *t, *v, *u;
2138 if (encoding_specific) {
2139 u = encoding_name; /* try specific */
2140 if ((t = grabenv(u)) != NULL) {
2141 if (strchr(t, ':') != NULL &&
2142 sscanf(t, "%d", &n) == 0) {
2143 s = u; /* look here instead of TEXFONTS=... */
2151 while (*t > '\0') print_char(*t++);
2156 while (*t > '\0') print_char(*t++);
2161 /**********************************************************************/
2163 /* called only from tex8.c */
2165 internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
2167 register internal_font_number Result;
2170 /* halfword lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np; */
2171 halfword lf, lh, nw, nh, nd, ni, nl, nk, ne, np;
2172 /* halfword bc, ec; */
2173 int bc, ec; /* 95/Jan/7 */
2174 internal_font_number f;
2175 internal_font_number g;
2176 eight_bits a, b, c, d;
2187 pack_file_name(nom, aire, 805); /* .tfm */
2188 if (!b_open_in(tfm_file))
2189 { /* new in C version d */
2192 if (!b_open_in(tfm_file))
2197 /* was just: goto lab11; */
2200 /* tfm_temp = getc(tfm_file); */ /* done already in open_input, but why? */
2205 tfm_temp = getc(tfm_file);
2206 lf = lf * 256 + tfm_temp;
2208 tfm_temp = getc(tfm_file);
2213 tfm_temp = getc(tfm_file);
2214 lh = lh * 256 + tfm_temp;
2216 tfm_temp = getc(tfm_file);
2221 tfm_temp = getc(tfm_file);
2222 bc = bc * 256 + tfm_temp;
2224 tfm_temp = getc(tfm_file);
2229 tfm_temp = getc(tfm_file);
2230 ec = ec * 256 + tfm_temp;
2232 if ((bc > ec + 1)||(ec > 255))
2239 tfm_temp = getc(tfm_file);
2244 tfm_temp = getc(tfm_file);
2245 nw = nw * 256 + tfm_temp;
2247 tfm_temp = getc(tfm_file);
2252 tfm_temp = getc(tfm_file);
2253 nh = nh * 256 + tfm_temp;
2255 tfm_temp = getc(tfm_file);
2260 tfm_temp = getc(tfm_file);
2261 nd = nd * 256 + tfm_temp;
2263 tfm_temp = getc(tfm_file);
2268 tfm_temp = getc(tfm_file);
2269 ni = ni * 256 + tfm_temp;
2271 tfm_temp = getc(tfm_file);
2276 tfm_temp = getc(tfm_file);
2277 nl = nl * 256 + tfm_temp;
2279 tfm_temp = getc(tfm_file);
2284 tfm_temp = getc(tfm_file);
2285 nk = nk * 256 + tfm_temp;
2287 tfm_temp = getc(tfm_file);
2292 tfm_temp = getc(tfm_file);
2293 ne = ne * 256 + tfm_temp;
2295 tfm_temp = getc(tfm_file);
2300 tfm_temp = getc(tfm_file);
2301 np = np * 256 + tfm_temp;
2303 if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
2305 if ((nw == 0) || (nh == 0) || (nd == 0) || (ni == 0))
2311 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2313 if ((fmem_ptr + lf > current_font_mem_size)) /* 93/Nov/28 */
2314 font_info = realloc_font_info (increment_font_mem_size + lf);
2315 if ((font_ptr == font_max) || (fmem_ptr + lf > current_font_mem_size))
2317 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2318 if ((font_ptr == font_max) || (fmem_ptr + lf > font_mem_size))
2321 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2324 sprintf(log_line, "font_ptr %d font_max %d fmem_ptr %d lf %d font_mem_size %d\n",
2325 font_ptr, font_max, fmem_ptr, lf, font_mem_size); /* debugging */
2326 show_line(log_line, 0);
2328 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2332 print_file_name(nom, aire, 335); /* "" */
2335 print_string(" at ");
2339 else if (s != -1000)
2341 print_string(" scaled ");
2342 print_int(- (integer) s);
2344 print_string(" not loaded: Not enough room left");
2345 help4("I'm afraid I won't be able to make use of this font,",
2346 "because my memory for character-size data is too small.",
2347 "If you're really stuck, ask a wizard to enlarge me.",
2348 "Or maybe try `I\\font<same font id>=<name of loaded font>'.");
2353 char_base[f] = fmem_ptr - bc;
2354 width_base[f] = char_base[f] + ec + 1;
2355 height_base[f] = width_base[f] + nw;
2356 depth_base[f] = height_base[f] + nh;
2357 italic_base[f] = depth_base[f] + nd;
2358 lig_kern_base[f] = italic_base[f] + ni;
2359 kern_base[f] = lig_kern_base[f] + nl - 256 * (128);
2360 exten_base[f] = kern_base[f] + 256 *(128) + nk;
2361 param_base[f] = exten_base[f] + ne;
2365 /* build the font checksum now */
2367 tfm_temp = getc(tfm_file);
2370 tfm_temp = getc(tfm_file);
2373 tfm_temp = getc(tfm_file);
2376 tfm_temp = getc(tfm_file);
2381 tfm_temp = getc(tfm_file);
2386 tfm_temp = getc(tfm_file);
2387 z = z * 256 + tfm_temp;
2389 tfm_temp = getc(tfm_file);
2390 z = z * 256 + tfm_temp;
2391 tfm_temp = getc(tfm_file);
2392 z =(z * 16) + (tfm_temp / 16);
2396 tfm_temp = getc(tfm_file);
2397 tfm_temp = getc(tfm_file);
2398 tfm_temp = getc(tfm_file);
2399 tfm_temp = getc(tfm_file);
2407 z = xn_over_d(z, - (integer) s, 1000);
2411 for (k = fmem_ptr; k <= width_base[f] - 1; k++)
2414 tfm_temp = getc(tfm_file);
2417 tfm_temp = getc(tfm_file);
2420 tfm_temp = getc(tfm_file);
2423 tfm_temp = getc(tfm_file);
2426 font_info[k].qqqq = qw;
2428 if ((a >= nw) || (b / 16 >= nh) || (b % 16 >= nd) || (c / 4 >= ni))
2443 if ((d < bc)||(d > ec))
2446 while (d < k + bc - fmem_ptr) {
2447 qw = font_info[char_base[f]+ d].qqqq;
2448 if (((qw.b2)% 4)!= 2)
2452 if (d == k + bc - fmem_ptr)
2464 while (z >= 8388608L) { /* 2^23 */
2466 alpha = alpha + alpha;
2468 beta = (char) (256 / alpha);
2472 for (k = width_base[f]; k <= lig_kern_base[f] - 1; k++)
2474 tfm_temp = getc(tfm_file);
2476 tfm_temp = getc(tfm_file);
2478 tfm_temp = getc(tfm_file);
2480 tfm_temp = getc(tfm_file);
2482 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2484 font_info[k].cint = sw;
2486 font_info[k].cint = sw - alpha;
2490 if (font_info[width_base[f]].cint != 0)
2492 if (font_info[height_base[f]].cint != 0)
2494 if (font_info[depth_base[f]].cint != 0)
2496 if (font_info[italic_base[f]].cint != 0)
2499 /* read ligature/kern program */
2500 bchlabel = 32767; /* '77777 */
2504 for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128)- 1; k++)
2507 tfm_temp = getc(tfm_file);
2510 tfm_temp = getc(tfm_file);
2513 tfm_temp = getc(tfm_file);
2516 tfm_temp = getc(tfm_file);
2519 font_info[k].qqqq = qw; /* store_four_quarters(font_info[k].qqqq */
2523 if (256 * c + d >= nl)
2524 goto lab11; /* error in TFM, abort */
2526 if (k == lig_kern_base[f])
2534 if ((b < bc) || (b > ec)) /* check-existence(b) */
2535 goto lab11; /* error in TFM, abort */
2537 qw = font_info[char_base[f] + b].qqqq;
2539 goto lab11; /* error in TFM, abort */
2544 if ((d < bc) || (d > ec)) /* check-existence(d) */
2545 goto lab11; /* error in TFM, abort */
2547 qw = font_info[char_base[f] + d].qqqq;
2549 goto lab11; /* error in TFM, abort */
2551 else if (256 * (c - 128) + d >= nk)
2552 goto lab11; /* error in TFM, abort */
2554 if (k - lig_kern_base[f] + a + 1 >= nl)
2555 goto lab11; /* error in TFM, abort */
2559 bchlabel = 256 * c + d;
2562 for (k = kern_base[f] + 256 * (128); k <= exten_base[f] - 1; k++)
2564 tfm_temp = getc(tfm_file);
2566 tfm_temp = getc(tfm_file);
2568 tfm_temp = getc(tfm_file);
2570 tfm_temp = getc(tfm_file);
2572 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2574 font_info[k].cint = sw;
2576 font_info[k].cint = sw - alpha;
2579 /* read extensible character recipes */
2580 /* for k:=exten_base[f] to param_base[f]-1 do */
2581 for (k = exten_base[f]; k <= param_base[f] - 1; k++)
2584 tfm_temp = getc(tfm_file);
2587 tfm_temp = getc(tfm_file);
2590 tfm_temp = getc(tfm_file);
2593 tfm_temp = getc(tfm_file);
2596 /* store_four_quarters(font_info[k].qqqq); */
2597 font_info[k].qqqq = qw;
2602 if ((a < bc) || (a > ec))
2605 qw = font_info[char_base[f] + a].qqqq;
2612 if ((b < bc) || (b > ec))
2615 qw = font_info[char_base[f] + b].qqqq;
2622 if ((c < bc) || (c > ec))
2625 qw = font_info[char_base[f] + c].qqqq;
2631 if ((d < bc) || (d > ec))
2634 qw = font_info[char_base[f] + d].qqqq;
2640 for (k = 1; k <= np; k++)
2643 tfm_temp = getc(tfm_file);
2647 tfm_temp = getc(tfm_file);
2648 sw = sw * 256 + tfm_temp;
2649 tfm_temp = getc(tfm_file);
2650 sw = sw * 256 + tfm_temp;
2651 tfm_temp = getc(tfm_file);
2652 font_info[param_base[f]].cint = (sw * 16) + (tfm_temp / 16);
2656 tfm_temp = getc(tfm_file);
2658 tfm_temp = getc(tfm_file);
2660 tfm_temp = getc(tfm_file);
2662 tfm_temp = getc(tfm_file);
2664 sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
2666 font_info[param_base[f] + k - 1].cint = sw;
2668 font_info[param_base[f] + k - 1].cint = sw - alpha;
2671 /* use test_eof() here instead ? */
2674 for (k = np + 1; k <= 7; k++)
2675 font_info[param_base[f] + k - 1].cint = 0;
2677 /* @<Make final adjustments...@>= l.11174 */
2679 font_params[f] = np;
2682 hyphen_char[f] = default_hyphen_char;
2683 skew_char[f] = default_skew_char;
2685 bchar_label[f] = bchlabel + lig_kern_base[f];
2687 bchar_label[f]= non_address; /* i.e. 0 --- 96/Jan/15 */
2688 font_bchar[f] = bchar;
2689 font_false_bchar[f] = bchar;
2693 qw = font_info[char_base[f] + bchar].qqqq;
2695 font_false_bchar[f] = 256;
2698 font_area[f] = aire;
2701 font_glue[f] = 0; /* font_glue[f]:=null; l.11184 */
2702 char_base[f] = char_base[f];
2703 width_base[f] = width_base[f];
2704 lig_kern_base[f] = lig_kern_base[f];
2705 kern_base[f] = kern_base[f];
2706 exten_base[f] = exten_base[f];
2707 decr(param_base[f]);
2708 fmem_ptr = fmem_ptr + lf;
2716 print_file_name(nom, aire, 335); /* "" */
2719 print_string(" at ");
2723 else if (s != -1000)
2725 print_string("scaled");
2726 print_int(- (integer) s);
2729 print_string(" not loadable: Bad metric (TFM) file");
2731 print_string(" not loadable: Metric (TFM) file not found");
2733 { /* "" only if path not specified */
2734 if (show_texinput_flag) show_tex_fonts(); /* 98/Jan/31 */
2736 help5("I wasn't able to read the size data for this font,",
2737 "so I will ignore the font specification.",
2738 "[Wizards can fix TFM files using TFtoPL/PLtoTF.]",
2739 "You might try inserting a different font spec;",
2740 "e.g., type `I\\font<same font id>=<substitute font name>'.");