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 */
27 void char_warning_(internal_font_number f, eight_bits c)
29 if (tracing_lost_chars > 0)
31 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
32 if (show_missing == 0) /* show on screen 94/June/10 */
33 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
35 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
37 { /* add ! before 94/June/10 */
39 print_string("Missing character: there is no ");
42 print_nl("Missing character: there is no ");
44 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
46 { /* bkph 93/Dec/21 */
51 print_char(48 + c / 100);
53 c = c - (c / 100) * 100; /* ? */
54 print_char(48 + c / 10);
59 c = c - (c / 100) * 100; /* ? */
60 if (c / 10 > 0) print_char(48 + c / 10);
62 print_char(48 + c % 10);
66 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
67 print_string(" in font ");
68 slow_print(font_name[f]);
70 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
71 /* if (show_missing) show_context(); */ /* in tex2.c 94/June/10 */
74 if (f != 0) show_context(); /* not if its the nullfont */
76 if (show_missing == 0) /* show on screen 94/June/10 */
77 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
78 end_diagnostic(false);
79 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
80 missing_characters++; /* bkph 93/Dec/16 */
81 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
85 halfword new_character_(internal_font_number f, eight_bits c)
87 register halfword Result;
91 if ((font_info[char_base[f] + c].qqqq.b0 > 0))
99 char_warning(f, c); /* char_warning(f,c); l.11283 */
100 Result = 0; /* new_character:=null */
103 /* following needs access to dvi_buf=zdvibuf see coerce.h */
110 sprintf(log_line, "dvi_swap %d", dvi_gone);
111 show_line(log_line, 0);
114 if (dvi_limit == dvi_buf_size)
116 writedvi(0, half_buf - 1);
117 dvi_limit = half_buf;
118 dvi_offset = dvi_offset + dvi_buf_size;
123 writedvi(half_buf, dvi_buf_size - 1);
124 dvi_limit = dvi_buf_size;
126 dvi_gone = dvi_gone + half_buf;
128 /* following needs access to dvi_buf=zdvibuf see coerce.h */
129 /* attempt at speeding up bkph - is compiler smart ? */
131 void dvi_four_(integer x)
134 // dvi_out(x % 16777216L);
138 x = x + 1073741824L; /* 2^30 40000000 hex */
140 //dvi_out((x / 16777216L) + 128);
141 dvi_out((x >> 24) + 128);
143 /* x = x % 16777216L; */ /* % 2^24 */
145 //dvi_out(x / 65536L);
147 /* x = x % 65536L; */ /* % 2^16 */
154 /* following needs access to dvi_buf=zdvibuf see coerce.h */
156 void zdvipop(integer l)
158 if ((l == dvi_offset + dvi_ptr) && (dvi_ptr > 0))
163 /* following needs access to dvi_buf=zdvibuf see coerce.h */
165 void dvi_font_def_(internal_font_number f)
168 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
178 dvi_out(((f - 1) >> 8));
179 dvi_out(((f - 1) & 255));
185 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
186 /* spit out the font checksum now */
187 dvi_out(font_check[f].b0);
188 dvi_out(font_check[f].b1);
189 dvi_out(font_check[f].b2);
190 dvi_out(font_check[f].b3);
191 dvi_four(font_size[f]);
192 dvi_four(font_dsize[f]);
193 dvi_out(length(font_area[f]));
194 dvi_out(length(font_name[f]));
196 for (k = str_start[font_area[f]]; k <= str_start[font_area[f]+ 1] - 1; k++)
197 dvi_out(str_pool[k]);
198 for (k = str_start[font_name[f]]; k <= str_start[font_name[f]+ 1] - 1; k++)
199 dvi_out(str_pool[k]);
201 /* following needs access to dvi_buf=zdvibuf see coerce.h */
203 void zmovement(scaled w, eight_bits o)
210 mem[q + 2].cint = dvi_offset + dvi_ptr;
211 if (o == 157) /* 157 == down1 */
213 mem[q].hh.v.RH = down_ptr;
217 { /* 143 == right1 */
218 mem[q].hh.v.RH = right_ptr;
223 while (p != 0) { /* while p<>null do l.12153 */
224 if (mem[p + 1].cint == w)
225 switch(mstate + mem[p].hh.v.LH)
231 if (mem[p + 2].cint < dvi_gone)
235 k = mem[p + 2].cint - dvi_offset;
237 k = k + dvi_buf_size;
238 dvi_buf[k]= dvi_buf[k] + 5;
246 if (mem[p + 2].cint < dvi_gone)
250 k = mem[p + 2].cint - dvi_offset;
252 k = k + dvi_buf_size;
253 dvi_buf[k]= dvi_buf[k] + 10;
267 else switch (mstate + mem[p].hh.v.LH)
287 if (abs(w) >= 8388608L) /* 2^23 */
293 if (abs(w) >= 32768L)
297 w = w + 16777216L; /* 2^24 */
298 //dvi_out(w / 65536L);
300 /* w = w % 65536L; */
323 mem[q].hh.v.LH = mem[p].hh.v.LH;
324 if (mem[q].hh.v.LH == 1)
327 while (mem[q].hh.v.RH != p) {
329 switch (mem[q].hh.v.LH)
345 while (mem[q].hh.v.RH != p) {
347 switch (mem[q].hh.v.LH)
362 void prune_movements_(integer l)
365 while (down_ptr != 0)
367 if (mem[down_ptr + 2].cint < l)
370 down_ptr = mem[p].hh.v.RH;
374 while (right_ptr != 0)
376 if (mem[right_ptr + 2].cint < l)
379 right_ptr = mem[p].hh.v.RH;
383 /* following needs access to dvi_buf=zdvibuf see coerce.h */
385 void special_out_(halfword p)
392 movement(cur_h - dvi_h, 143); /* 143 == right1 */
398 movement(cur_v - dvi_v, 157); /* 157 == down1 */
401 old_setting = selector;
402 selector = new_string;
403 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
404 /* About output \special{...} make some space in string pool 97/Mar/9 */
405 #ifdef ALLOCATESTRING
406 if (pool_ptr + 32000 > current_pool_size)
407 str_pool = realloc_str_pool (increment_pool_size);
408 /* We don't bother to check whether this worked - will catch later */
410 /* Potential problem here if current_pool_size is not much more than pool_ptr! */
411 /* Fixed 97/Mar/9 in version 2.0.3 */
412 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
413 #ifdef ALLOCATESTRING
414 /* show_token_list(mem[mem[p + 1].hh.v.RH].hh.v.RH, 0,
415 current_pool_size - pool_ptr); */
416 show_token_list(mem[mem[p + 1].hh.v.RH].hh.v.RH, 0, 10000000L);
417 /* Above is safe, since print/print_char/print_esc will extend string space */
419 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
420 show_token_list(mem[mem[p + 1].hh.v.RH].hh.v.RH, 0, pool_size - pool_ptr);
422 selector = old_setting;
424 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
425 /* str_room(1) - is there space for one more character in string pool ? */
426 #ifdef ALLOCATESTRING
427 if (pool_ptr + 1 > current_pool_size)
428 str_pool = realloc_str_pool (increment_pool_size);
429 if (pool_ptr + 1 > current_pool_size)
430 { /* in case it failed 94/Jan/24 */
431 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
432 return; // abort_flag set
435 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
436 if (pool_ptr + 1 > pool_size)
438 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
439 return; // abort_flag set
443 if (cur_length < 256) /* can use xxx1 ? */
446 /* long to unsigned char ... */
448 } else { /* use xxx4 instead */
450 dvi_four(cur_length);
454 /* debugging code for \special{src: ... } 98/Nov/11 */
456 int k = str_start[str_ptr];
459 if (str_pool [k] == 's' &&
460 str_pool [k+1] == 'r' &&
461 str_pool [k+2] == 'c' &&
462 str_pool [k+3] == ':') { /* \special{src: ... } */
466 *s++ = str_pool[k++];
470 show_line(log_line, 0)
474 if (cur_input.name_field > 17) { /* redundant ? */
475 print(cur_input.name_field);
477 print_int(line); /* line number */
489 for (k = str_start[str_ptr]; k <= pool_ptr - 1; k++)
490 dvi_out(str_pool[k]);
491 pool_ptr = str_start[str_ptr];
493 /* noew returns -1 if it fails */
495 void write_out_(halfword p)
498 /* integer oldmode; */
499 int oldmode; /* 1995/Jan/7 */
500 /* small_number j; */
501 int j; /* 1995/Jan/7 */
503 /* q:=get_avail; info(q):=right_brace_token+"}";@/ */
506 /* r:=get_avail; link(q):=r; info(r):=end_write_token; ins_list(q);@/ */
507 /* @d end_write_token==cs_token_flag+end_write */
510 /* mem[r].hh.v.LH = (hash_size + 4617); */
511 /* mem[r].hh.v.LH = (hash_size + 4095 + 522); */
512 info(r) = (hash_size + hash_extra + 4095 + 522);
513 begin_token_list(q, 4);
514 begin_token_list(mem[p + 1].hh.v.RH, 15);
516 mem[q].hh.v.LH = 379;
517 begin_token_list(q, 4);
521 q = scan_toks(false, true);
523 /* if (cur_tok != (hash_size + 4617)) */
524 /* if (cur_tok != (hash_size + 4095 + 522)) */
525 if (cur_tok != (hash_size + hash_extra + 4095 + 522))
527 print_err("Unbalanced write command");
528 help2("On this page there's a \\write with fewer real {'s than }'s.",
529 "I can't handle that very well; good luck.");
535 while(!(cur_tok == (hash_size + hash_extra + 4095 + 522))); /*1996/Jan/10*/
539 old_setting = selector;
540 j = mem[p + 1].hh.v.LH;
545 if ((j == 17) && (selector == 19))
552 selector = old_setting;
555 void out_what_(halfword p)
557 /* small_number j; */
558 int j; /* 1995/Jan/7 */
563 if (!doing_leaders) {
564 j = mem[p + 1].hh.v.LH;
565 if (mem[p].hh.b1 == 1){
569 (void) a_close(write_file[j]);
570 if (mem[p].hh.b1 == 2)
571 write_open[j]= false;
573 cur_name = mem[p + 1].hh.v.RH;
574 cur_area = mem[p + 2].hh.v.LH;
575 cur_ext = mem[p + 2].hh.v.RH;
576 if (cur_ext == 335) /* "" */
577 cur_ext = 785; /* => ".tex" */
578 pack_file_name(cur_name, cur_area, cur_ext);
579 while(! a_open_out(write_file[j])) {
580 prompt_file_name(1294, 785); /* output file name .tex */
596 return; // abort_flag set
601 /* following needs access to dvi_buf=zdvibuf see coerce.h */
603 void hlist_out (void)
609 /* glue_ord gorder; */
610 int gorder; /* 95/Jan/7 */
612 int gsign; /* 95/Jan/7 */
618 bool outerdoingleaders;
627 gorder = glue_order(thisbox);
628 gsign = glue_sign(thisbox);
629 p = list_ptr(thisbox);
633 if (cur_s > max_push)
635 saveloc = dvi_offset + dvi_ptr;
638 /* while p<>null do l.12314 */
645 movement(cur_h - dvi_h, 143); /* 143 == right1 */
650 movement(cur_v - dvi_v, 157); /* 157 == down1 */
665 dvi_out(f + 170); /* fnt_num_0 --- fnt_num_63 */
666 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
668 /* if we allow greater than 256 fonts */
671 dvi_out(235); /* fnt1 followed by f */
675 /* normal TeX 82 case */
678 dvi_out(235); /* fnt1 followed by f */
683 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
685 /* fnt2 followed by f / 256, f % 256 */
689 dvi_out(((f - 1) >> 8)); /* top byte */
690 dvi_out(((f - 1) & 255)); /* bottom byte */
693 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
699 cur_h = cur_h + font_info[width_base[f] + font_info[char_base[f] + c].qqqq.b0].cint;
701 } while(!(!(p >= hi_mem_min)));
710 if (list_ptr(p) == 0)
711 cur_h = cur_h + width(p);
716 cur_v = baseline + shift_amount(p);
719 if (type(p) == vlist_node)
725 cur_h = edge + width(p);
743 rule_wd = width(g) - cur_g;
746 if (gsign == stretching)
748 if (stretch_order(g) == gorder)
750 //gluetemp = glue_set(thisbox) * stretch(g);
751 cur_glue = cur_glue + stretch(g);
752 gluetemp = glue_set(thisbox) * cur_glue;
753 if (gluetemp > 1000000000.0)
754 gluetemp = 1000000000.0;
755 else if (gluetemp < -1000000000.0)
756 gluetemp = -1000000000.0;
757 cur_g = round(gluetemp);
758 //rule_wd = rule_wd + round(gluetemp);
761 else if (shrink_order(g) == gorder)
763 //gluetemp = glue_set(thisbox) * shrink(g);
764 cur_glue = cur_glue - shrink(g);
765 gluetemp = glue_set(thisbox) * cur_glue;
766 if (gluetemp > 1000000000.0)
767 gluetemp = 1000000000.0;
768 else if (gluetemp < -1000000000.0)
769 gluetemp = -1000000000.0;
770 cur_g = round(gluetemp);
771 //rule_wd = rule_wd - round(gluetemp);
774 rule_wd = rule_wd + cur_g;
775 if (subtype(p) >= a_leaders)
777 leaderbox = leader_ptr(p);
778 if (type(leaderbox) == rule_node)
780 rule_ht = height(leaderbox);
781 rule_dp = depth(leaderbox);
784 leaderwd = width(leaderbox);
785 if ((leaderwd > 0) && (rule_wd > 0))
787 rule_wd = rule_wd + 10;
788 edge = cur_h + rule_wd;
790 if (subtype(p) == a_leaders)
793 cur_h = leftedge + leaderwd * ((cur_h - leftedge) / leaderwd);
795 cur_h = cur_h + leaderwd;
799 lq = rule_wd / leaderwd;
800 lr = rule_wd % leaderwd;
801 if (subtype(p) == c_leaders)
802 cur_h = cur_h + (lr / 2);
805 lx =(2 * lr + lq + 1) / (2 * lq + 2);
806 cur_h = cur_h + ((lr - (lq - 1)* lx) / 2);
809 while (cur_h + leaderwd <= edge)
811 cur_v = baseline + shift_amount(leaderbox);
814 movement(cur_v - dvi_v, 157); /* 157 == down1 */
820 movement(cur_h - dvi_h, 143); /* 143 == right1 */
824 temp_ptr = leaderbox;
825 outerdoingleaders = doing_leaders;
826 doing_leaders = true;
827 if (type(leaderbox) == vlist_node)
831 doing_leaders = outerdoingleaders;
835 cur_h = saveh + leaderwd + lx;
846 cur_h = cur_h + width(p);
850 mem[lig_trick]= mem[p + 1];
851 mem[lig_trick].hh.v.RH = mem[p].hh.v.RH;
861 if ((rule_ht == -1073741824L)) /* - 2^30 */
862 rule_ht = height(thisbox);
863 if ((rule_dp == -1073741824L)) /* - 2^30 */
864 rule_dp = depth(thisbox);
865 rule_ht = rule_ht + rule_dp;
866 if ((rule_ht > 0)&&(rule_wd > 0))
870 movement(cur_h - dvi_h, 143); /* 143 == right1 */
873 cur_v = baseline + rule_dp;
876 movement(cur_v - dvi_v, 157); /* 157 == down1 */
883 dvi_h = dvi_h + rule_wd;
886 cur_h = cur_h + rule_wd;
890 prune_movements(saveloc);
895 /* following needs access to dvi_buf=zdvibuf see coerce.h */
897 void vlist_out (void)
903 /* glue_ord gorder; */
904 int gorder; /* 95/Jan/7 */
906 int gsign; /* 95/Jan/7 */
912 bool outerdoingleaders;
921 gorder = glue_order(thisbox);
922 gsign = glue_sign(thisbox);
923 p = list_ptr(thisbox);
927 if (cur_s > max_push)
929 saveloc = dvi_offset + dvi_ptr;
931 cur_v = cur_v - height(thisbox);
935 { /* while p<>null do l.12494 OK */
936 if ((p >= hi_mem_min))
938 confusion("vlistout");
939 return; // abort_flag set
943 switch (mem[p].hh.b0)
947 if (mem[p + 5].hh.v.RH == 0)
948 cur_v = cur_v + height(p) + depth(p);
951 cur_v = cur_v + height(p);
954 movement(cur_v - dvi_v, 157); /* 157 == down1 */
959 cur_h = leftedge + shift_amount(p);
961 if (type(p) == vlist_node)
967 cur_v = savev + depth(p);
985 rule_ht = width(g) - cur_g;
988 if (gsign == stretching)
990 if (stretch_order(g) == gorder)
992 //gluetemp = glue_set(thisbox) * mem[g + 2].cint;
993 cur_glue = cur_glue + stretch(g);
994 gluetemp = glue_set(thisbox) * cur_glue;
995 if (gluetemp > 1000000000.0)
996 gluetemp = 1000000000.0;
997 else if (gluetemp < -1000000000.0)
998 gluetemp = -1000000000.0;
999 //rule_ht = rule_ht + round(gluetemp);
1000 cur_g = round(gluetemp);
1003 else if (mem[g].hh.b1 == gorder) /* BUG FIX !!! */
1005 //gluetemp = glue_set(thisbox) * mem[g + 3].cint;
1006 cur_glue = cur_glue - shrink(g);
1007 gluetemp = glue_set(thisbox) * cur_glue;
1008 if (gluetemp > 1000000000.0)
1009 gluetemp = 1000000000.0;
1010 else if (gluetemp < -1000000000.0)
1011 gluetemp = -1000000000.0;
1012 //rule_ht = rule_ht - round(gluetemp);
1013 cur_g = round(gluetemp);
1016 rule_ht = rule_ht + cur_g;
1017 if (subtype(p) >= a_leaders)
1019 leaderbox = leader_ptr(p);
1020 if (type(leaderbox) == rule_node)
1022 rule_wd = width(leaderbox);
1026 leaderht = height(leaderbox) + depth(leaderbox);
1027 if ((leaderht > 0) && (rule_ht > 0))
1029 rule_ht = rule_ht + 10;
1030 edge = cur_v + rule_ht;
1032 if (subtype(p) == a_leaders)
1035 cur_v = topedge + leaderht * ((cur_v - topedge) / leaderht);
1037 cur_v = cur_v + leaderht;
1041 lq = rule_ht / leaderht;
1042 lr = rule_ht % leaderht;
1043 if (subtype(p) == c_leaders)
1044 cur_v = cur_v + (lr / 2);
1047 lx =(2 * lr + lq + 1) / (2 * lq + 2);
1048 cur_v = cur_v + ((lr - (lq - 1) * lx) / 2);
1051 while (cur_v + leaderht <= edge)
1053 cur_h = leftedge + shift_amount(leaderbox);
1056 movement(cur_h - dvi_h, 143); /* 143 == right1 */
1060 cur_v = cur_v + height(leaderbox);
1063 movement(cur_v - dvi_v, 157); /* 157 == down1 */
1067 temp_ptr = leaderbox;
1068 outerdoingleaders = doing_leaders;
1069 doing_leaders = true;
1070 if (type(leaderbox) == vlist_node)
1074 doing_leaders = outerdoingleaders;
1078 cur_v = savev - height(leaderbox) + leaderht + lx;
1088 cur_v = cur_v + width(p);
1095 if ((rule_wd == -1073741824L)) /* -2^30 */
1096 rule_wd = width(thisbox);
1097 rule_ht = rule_ht + rule_dp;
1098 cur_v = cur_v + rule_ht;
1099 if ((rule_ht > 0) && (rule_wd > 0))
1103 movement(cur_h - dvi_h, 143); /* 143 == right1 */
1108 movement(cur_v - dvi_v, 157); /* 157 == down1 */
1117 cur_v = cur_v + rule_ht;
1122 prune_movements(saveloc);
1127 /****************HPDF******************/
1129 void error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void * user_data)
1131 printf ("ERROR: error_no=%04X, detail_no=%u\n", (HPDF_UINT)error_no, (HPDF_UINT)detail_no);
1134 /****************HPDF******************/
1136 /* following needs access to dvi_buf=zdvibuf see coerce.h */
1138 void ship_out_(halfword p)
1145 if (tracing_output > 0)
1149 print_string("Completed box being shipped out");
1152 if (term_offset > max_print_line - 9)
1154 else if ((term_offset > 0) || (file_offset > 0))
1158 while((count(j) == 0) && (j > 0))
1160 for (k = 0; k <= j; k++)
1162 print_int(count(k));
1169 if (tracing_output > 0)
1174 end_diagnostic(true);
1176 if ((height(p) > 1073741823L) || /* 2^30 - 1 */
1177 (depth(p) > 1073741823L) ||
1178 (height(p) + depth(p) + v_offset > 1073741823L) ||
1179 (width(p) + h_offset > 1073741823L))
1181 print_err("Huge page cannot be shipped out");
1182 help2("The page just created is more than 18 feet tall or",
1183 "more than 18 feet wide, so I suspect something went wrong.");
1185 if (tracing_output <= 0)
1188 print_nl("The following box has been deleted:");
1190 end_diagnostic(true);
1194 if (height(p) + depth(p) + v_offset > max_v)
1195 max_v = height(p) + depth(p) + v_offset;
1196 if (width(p) + h_offset > max_h)
1197 max_h = height(p) + h_offset;
1202 if (output_file_name == 0)
1206 pack_job_name(788); /* .dvi */
1207 while(!b_open_out(dvi_file))
1209 prompt_file_name(789, 788); /* file name for output .dvi */
1211 output_file_name = b_make_name_string(dvi_file);
1214 if (total_pages == 0)
1218 /********BINDING WITH LIBHARU*********/
1220 yandy_pdf = HPDF_New(error_handler, NULL);
1221 yandy_page = HPDF_AddPage(yandy_pdf);
1222 HPDF_SetInfoAttr(yandy_pdf, HPDF_INFO_PRODUCER, "Y&Y TeX with ApTeX");
1223 HPDF_SetCompressionMode (yandy_pdf, HPDF_COMP_ALL);
1224 HPDF_Page_SetSize (yandy_page, HPDF_PAGE_SIZE_A5, HPDF_PAGE_PORTRAIT);
1225 yandy_font = HPDF_GetFont (yandy_pdf, "Times-Roman", NULL);
1226 HPDF_Page_BeginText (yandy_page);
1227 HPDF_Page_SetFontAndSize (yandy_page, yandy_font, 16);
1228 HPDF_Page_TextOut (yandy_page, 60, HPDF_Page_GetHeight (yandy_page)-90, "This is the \xAErst page.");
1229 HPDF_Page_TextOut (yandy_page, 60, HPDF_Page_GetHeight (yandy_page)-180, "Wait for ...");
1230 HPDF_Page_EndText (yandy_page);
1231 HPDF_SaveToFile (yandy_pdf, "NOTICE.pdf");
1232 HPDF_Free(yandy_pdf);
1234 /********BINDING WITH LIBHARU*********/
1235 dvi_four(25400000L); /* magic DVI scale factor */
1236 dvi_four(473628672L); /* 7227 * 65536 */
1239 old_setting = selector;
1240 selector = new_string;
1241 print_string(" TeX output ");
1248 print_two(tex_time / 60);
1249 print_two(tex_time % 60);
1250 selector = old_setting;
1251 /* long to unsigned char ... */
1252 dvi_out(cur_length);
1253 for (s = str_start[str_ptr]; s <= pool_ptr - 1; s++)
1254 dvi_out(str_pool[s]);
1255 pool_ptr = str_start[str_ptr];
1256 } // end of if total_pages == 0
1258 pageloc = dvi_offset + dvi_ptr;
1260 for (k = 0; k <= 9; k++)
1264 cur_v = height(p) + v_offset;
1266 if (type(p) == vlist_node)
1274 if (tracing_output <= 0)
1282 if (tracing_stats > 1)
1284 print_nl("Memory usage before: ");
1285 print_int(var_used);
1287 print_int(dyn_used);
1293 if (tracing_stats > 1)
1295 print_string(" after: ");
1296 print_int(var_used);
1298 print_int(dyn_used);
1299 print_string("; still utouched: ");
1300 print_int(hi_mem_min - lo_mem_max - 1); /* somewhat inaccurate free mem */
1306 void scan_spec_(group_code c, bool threecodes)
1312 s = save_stack[save_ptr + 0].cint;
1313 if (scan_keyword("to"))
1315 else if (scan_keyword("spread"))
1323 scan_dimen(false, false, false);
1327 save_stack[save_ptr + 0].cint = s; /* s may be used without ... */
1330 save_stack[save_ptr + 0].cint = speccode;
1331 save_stack[save_ptr + 1].cint = cur_val;
1332 save_ptr = save_ptr + 2;
1337 halfword hpack_(halfword p, scaled w, small_number m)
1339 register halfword Result;
1346 int o; /* 95/Jan/7 */
1347 internal_font_number f;
1352 r = get_node(box_node_size);
1353 type(r) = hlist_node;
1355 shift_amount(r) = 0;
1356 q = r + list_offset;
1361 total_stretch[normal] = 0;
1362 total_shrink[normal] = 0;
1363 total_stretch[fil] = 0;
1364 total_shrink[fil] = 0;
1365 total_stretch[fill] = 0;
1366 total_shrink[fill] = 0;
1367 total_stretch[filll] = 0;
1368 total_shrink[filll] = 0;
1370 { /* while p<>null do l.12862 */
1372 while ((p >= hi_mem_min))
1375 i = font_info[char_base[f] + mem[p].hh.b1].qqqq;
1377 x = x + font_info[width_base[f] + i.b0].cint;
1378 s = font_info[height_base[f] + (hd) / 16].cint;
1381 s = font_info[depth_base[f] + (hd) % 16].cint;
1386 if (p != 0) /* if p<>null then l.12886 */
1388 switch (mem[p].hh.b0)
1396 if (type(p) >= rule_node)
1399 s = shift_amount(p);
1400 if (height(p) - s > h)
1402 if (depth(p) + s > d)
1409 if (adjust_tail != 0)
1411 while (link(q) != p)
1413 if (type(p) == adjust_node)
1415 link(adjust_tail) = adjust_ptr(p);
1416 while (link(adjust_tail)!= 0)
1417 adjust_tail = link(adjust_tail);
1419 free_node(link(q), small_node_size);
1423 link(adjust_tail) = p;
1437 o = stretch_order(g);
1438 total_stretch[o]= total_stretch[o] + stretch(g);
1439 o = shrink_order(g);
1440 total_shrink[o]= total_shrink[o] + shrink(g);
1441 if (subtype(p) >= a_leaders)
1457 mem[lig_trick] = mem[lig_char(p)];
1458 link(lig_trick) = link(p);
1469 if (adjust_tail != 0)
1470 link(adjust_tail) = 0;
1479 glue_sign(r) = normal;
1480 glue_order(r) = normal;
1486 if (total_stretch[filll] != 0)
1488 else if (total_stretch[fill] != 0)
1490 else if (total_stretch[fil] != 0)
1495 glue_sign(r) = stretching;
1496 if (total_stretch[o]!= 0)
1497 glue_set(r) = x / ((double) total_stretch[o]);
1500 glue_sign(r) = normal;
1504 if (list_ptr(r) != 0)
1506 last_badness = badness(x, total_stretch[0]);
1507 if (last_badness > hbadness)
1510 if (last_badness > 100)
1511 print_nl("Underfull");
1514 print_string(" \\hbox (badness ");
1515 print_int(last_badness);
1516 if (last_badness > 100) /* Y&Y TeX */
1517 underfull_hbox++; /* 1996/Feb/9 */
1525 if (total_shrink[filll] != 0)
1527 else if (total_shrink[fill] != 0)
1529 else if (total_shrink[fil] != 0)
1534 glue_sign(r) = shrinking;
1535 if (total_shrink[o] != 0)
1536 glue_set(r) =(- (integer) x) / ((double) total_shrink[o]);
1539 glue_sign(r) = normal;
1542 if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
1544 last_badness = 1000000L;
1546 if ((- (integer) x - total_shrink[0] > hfuzz) || (hbadness < 100))
1548 if ((overfull_rule > 0) && (- (integer) x - total_shrink[0] > hfuzz))
1552 link(q) = new_rule();
1553 width(link(q)) = overfull_rule;
1556 print_nl("Overfull \\hbox(");
1557 print_scaled(- (integer) x - total_shrink[0]);
1558 print_string("pt too wide");
1559 overfull_hbox++; /* 1996/Feb/9 */
1563 else if (o == normal)
1564 if (list_ptr(r) != 0)
1566 last_badness = badness(- (integer) x, total_shrink[normal]);
1567 if (last_badness > hbadness)
1570 print_nl("Tight \\hbox (badness ");
1571 print_int(last_badness);
1579 print_string(") has occurred while \\output is active");
1582 if (pack_begin_line != 0)
1584 if (pack_begin_line > 0)
1585 print_string(") in paragraph at lines ");
1587 print_string(") in alignment at lines ");
1588 print_int(abs(pack_begin_line));
1592 print_string(") detected at line ");
1596 font_in_short_display = 0;
1597 short_display(list_ptr(r));
1601 end_diagnostic(true);
1607 halfword vpackage_(halfword p, scaled h, small_number m, scaled l)
1609 register halfword Result;
1615 int o; /* 95/Jan/7 */
1618 r = get_node(box_node_size);
1619 type(r) = vlist_node;
1621 shift_amount(r) = 0;
1626 total_stretch[normal] = 0;
1627 total_shrink[normal] = 0;
1628 total_stretch[fil] = 0;
1629 total_shrink[fil] = 0;
1630 total_stretch[fill] = 0;
1631 total_shrink[fill] = 0;
1632 total_stretch[filll] = 0;
1633 total_shrink[filll] = 0;
1637 if ((p >= hi_mem_min))
1640 return 0; // abort_flag set
1642 else switch (mem[p].hh.b0)
1649 x = x + d + height(p);
1651 if (type(p) >= rule_node)
1654 s = shift_amount(p);
1655 if (width(p) + s > w)
1667 o = stretch_order(g);
1668 total_stretch[o] = total_stretch[o] + stretch(g);
1669 o = shrink_order(g);
1670 total_shrink[o] = total_shrink[o] + shrink(g);
1672 if (subtype(p) >= a_leaders)
1682 x = x + d + width(p);
1707 glue_sign(r) = normal;
1708 glue_order(r) = normal;
1714 if (total_stretch[filll] != 0)
1716 else if (total_stretch[fill] != 0)
1718 else if (total_stretch[fil] != 0)
1723 glue_sign(r) = stretching;
1725 if (total_stretch[o] != 0)
1726 glue_set(r) = x / ((double) total_stretch[o]);
1729 glue_sign(r) = normal;
1734 if (list_ptr(r) != 0)
1736 last_badness = badness(x, total_stretch[normal]);
1737 if (last_badness > vbadness)
1740 if (last_badness > 100)
1741 print_nl("Underfull");
1744 print_string(" \\vbox (badness ");
1745 print_int(last_badness);
1746 if (last_badness > 100)
1747 underfull_vbox++; /* 1996/Feb/9 */
1755 if (total_shrink[filll] != 0)
1757 else if (total_shrink[fill] != 0)
1759 else if (total_shrink[fil] != 0)
1764 glue_sign(r) = shrinking;
1765 if (total_shrink[o]!= 0)
1766 glue_set(r) =(- (integer) x)/ ((double) total_shrink[o]);
1769 glue_sign(r) = normal;
1773 if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
1775 last_badness = 1000000L;
1777 if ((- (integer) x - total_shrink[0] > vfuzz) || (vbadness < 100))
1780 print_nl("Overfull \\vbox(");
1781 print_scaled(- (integer) x - total_shrink[0]);
1782 print_string("pt too high");
1783 overfull_vbox++; /* 1996/Feb/9 */
1788 if (list_ptr(r) != 0)
1790 last_badness = badness(- (integer) x, total_shrink[normal]);
1791 if (last_badness > vbadness)
1794 print_nl("Tight \\vbox (badness ");
1795 print_int(last_badness);
1803 print_string(") has occurred while \\output is active");
1805 if (pack_begin_line != 0)
1807 print_string(") in alignment at lines ");
1808 print_int(abs(pack_begin_line));
1812 print_string(") detected at line ");
1818 end_diagnostic(true);
1824 void append_to_vlist_(halfword b)
1829 if (cur_list.aux_field.cint > ignore_depth)
1831 d = width(baseline_skip) - cur_list.aux_field.cint - height(b);
1833 if (d < line_skip_limit)
1834 p = new_param_glue(line_skip_code);
1837 p = new_skip_param(baseline_skip_code);
1838 width(temp_ptr) = d;
1845 cur_list.aux_field.cint = depth(b);
1848 halfword new_noad (void)
1851 p = get_node(noad_size);
1853 subtype(p) = normal;
1854 mem[nucleus(p)].hh = empty_field;
1855 mem[subscr(p)].hh = empty_field;
1856 mem[supscr(p)].hh = empty_field;
1860 halfword new_style_(small_number s)
1863 p = get_node(style_node_size);
1864 type(p) = style_node;
1871 halfword new_choice (void)
1874 p = get_node(style_node_size);
1875 type(p) = choice_node;
1877 display_mlist(p) = 0;
1879 script_mlist(p) = 0;
1880 script_script_mlist(p) = 0;
1884 void show_info (void)
1886 show_node_list(info(temp_ptr));
1889 halfword fraction_rule_(scaled t)
1897 halfword overbar_(halfword b, scaled k, scaled t)
1899 register halfword Result;
1903 q = fraction_rule(t);
1907 Result = vpackage(p, 0, 1, 1073741823L); /* 2^30 - 1 */
1910 halfword char_box_(internal_font_number f, quarterword c)
1912 register halfword Result;
1916 q = font_info[char_base[f]+ c].qqqq;
1919 mem[b + 1].cint = font_info[width_base[f]+ q.b0].cint + font_info[italic_base[f]+(q.b2) / 4].cint;
1920 mem[b + 3].cint = font_info[height_base[f]+(hd) / 16].cint;
1921 mem[b + 2].cint = font_info[depth_base[f]+(hd) % 16].cint;
1922 /* long to unsigned short ... */
1926 mem[b + 5].hh.v.RH = p;
1930 void stack_into_box_(halfword b, internal_font_number f, quarterword c)
1934 mem[p].hh.v.RH = mem[b + 5].hh.v.RH;
1935 mem[b + 5].hh.v.RH = p;
1936 mem[b + 3].cint = mem[p + 3].cint;
1938 scaled height_plus_depth_(internal_font_number f, fquarterword c)
1940 register scaled Result;
1943 q = font_info[char_base[f]+ c].qqqq;
1945 Result = font_info[height_base[f]+(hd)/ 16].cint + font_info[depth_base[f]+(hd) % 16].cint;
1948 halfword var_delimiter_(halfword d, small_number s, scaled v)
1950 register halfword Result;
1952 internal_font_number f, g;
1953 quarterword c, x, y;
1960 /* small_number z; */
1961 int z; /* 95/Jan/7 */
1962 /* bool largeattempt; */
1963 int largeattempt; /* 95/Jan/7 */
1966 largeattempt = false;
1970 if ((z != 0) || (x != 0)) {
1974 g = eqtb[(hash_size + 1835) + z].hh.v.RH;
1977 if ((y >= font_bc[g]) && (y <= font_ec[g])) {
1979 q = font_info[char_base[g]+ y].qqqq;
1981 if (((q.b2) % 4) == 3) {
1987 u = font_info[height_base[g]+(hd)/ 16].cint + font_info[depth_base[g]+(hd)% 16].cint;
1995 if (((q.b2)% 4)== 2) {
2002 } while (!(z < 16));
2006 largeattempt = true;
2012 if (((q.b2) % 4)== 3) /* q may be used without ... */
2016 r = font_info[exten_base[f]+ q.b3].qqqq;
2018 u = height_plus_depth(f, c);
2020 q = font_info[char_base[f]+ c].qqqq;
2021 mem[b + 1].cint = font_info[width_base[f]+ q.b0].cint + font_info[italic_base[f]+(q.b2) / 4].cint;
2024 w = w + height_plus_depth(f, c);
2027 w = w + height_plus_depth(f, c);
2030 w = w + height_plus_depth(f, c);
2041 stack_into_box(b, f, c);
2044 register integer for_end;
2047 if (m <= for_end) do
2048 stack_into_box(b, f, c);
2049 while (m++ < for_end);
2053 stack_into_box(b, f, c);
2056 register integer for_end;
2059 if (m <= for_end) do
2060 stack_into_box(b, f, c);
2061 while(m++ < for_end);
2066 stack_into_box(b, f, c);
2067 mem[b + 2].cint = w - mem[b + 3].cint;
2068 } else b = char_box(f, c);
2069 else { /* c may be used without ... */
2071 mem[b + 1].cint = null_delimiter_space;
2073 mem[b + 4].cint = half(mem[b + 3].cint - mem[b + 2].cint) - font_info[22 + param_base[eqtb[(hash_size + 1837) + s].hh.v.RH]].cint;
2077 /* rebox_ etc used to follow here in tex4.c */