예제 #1
0
void err_print (char *s) /* prints `\..' and location of error message */
{ print(*s=='!' ? "\n%s." : "%s.",s);
  if (web_file_open) 
                     { char *k, *l=(loc<limit) ? loc : limit; /* pointers into |buffer| */
                       if (changing) printf(" (l. %d of change file)\n", change_line);
                       else if (include_depth==0) printf(" (l. %d)\n", cur_line);
                       else printf(" (l. %d of include file %s)\n", cur_line, cur_file_name);
                       if (l>buffer)
                       { for (k=buffer; k<l; k++) putchar(*k=='\t' ? ' ': *k);
                         new_line();
                         for (k=buffer; k<l; k++) putchar(' '); /* space out the next line */
                       }
                       for (k=l; k<limit; k++) putchar(*k); /* print the part not yet read */
                     }
  update_terminal(); mark_error();
}
예제 #2
0
void short_display_n(int p,int m)
{
int i= 0;
font_in_short_display= null_font;
if(p==null)
return;
while(p!=null){
if(is_char_node(p)){
if(p<=max_halfword){
if(font(p)!=font_in_short_display){
if(!is_valid_font(font(p)))
print_char('*');
else
print_font_identifier(font(p));
print_char(' ');
font_in_short_display= font(p);
}
print(character(p));
}
}else{
if((type(p)==glue_node)||
(type(p)==disc_node)||
(type(p)==penalty_node)||
((type(p)==kern_node)&&(subtype(p)==explicit_kern||
subtype(p)==italic_kern))){
incr(i);
}
if(i>=m)
return;
if(type(p)==disc_node){
print_char('|');
short_display(vlink(pre_break(p)));
print_char('|');
short_display(vlink(post_break(p)));
print_char('|');
}else{

print_short_node_contents(p);
}
}
p= vlink(p);
if(p==null)
return;
}
update_terminal();
}
예제 #3
0
// texk/web2c/lib/uexit.c
void uexit (int unix_code)
{
  int final_code;

  update_terminal();

  if (unix_code == 0)
    final_code = EXIT_SUCCESS;
  else if (unix_code == 1)
    final_code = EXIT_FAILURE;
  else
    final_code = unix_code;

  if (jump_used)
  {
    printf("Jump Buffer already used.\n");
    exit(1);
  }

  jump_used++;
  exit(final_code);
}
예제 #4
0
void pdf_ship_out (pointer p)
{
  integer page_loc;
  char j, k;

  if (tracing_output > 0)
  {
    print_nl("");
    print_ln();
    prints("Completed box being shipped out");
  }

  if (term_offset > max_print_line - 9)
    print_ln();
  else if ((term_offset > 0) || (file_offset > 0))
    print_char(' ');

  print_char('[');
  j = 9;

  while ((count(j) == 0) && (j > 0))
    decr(j);

  for (k = 0; k <= j; k++)
  {
    print_int(count(k));

    if (k < j)
      print_char('.');
  }

  update_terminal();

  if (tracing_output > 0)
  {
    print_char(']');
    begin_diagnostic();
    show_box(p);
    end_diagnostic(true);
  }

  if ((height(p) > max_dimen) || (depth(p) > max_dimen) ||
      (height(p) + depth(p) + v_offset > max_dimen) ||
      (width(p) + h_offset > max_dimen))
  {
    print_err("Huge page cannot be shipped out");
    help2("The page just created is more than 18 feet tall or",
      "more than 18 feet wide, so I suspect something went wrong.");
    error();

    if (tracing_output <= 0)
    {
      begin_diagnostic();
      print_nl("The following box has been deleted:");
      show_box(p);
      end_diagnostic(true);
    }

    goto done;
  }

  if (height(p) + depth(p) + v_offset > max_v)
    max_v = height(p) + depth(p) + v_offset;

  if (width(p) + h_offset > max_h)
    max_h = width(p) + h_offset;

  dvi_h = 0;
  dvi_v = 0;
  cur_h = h_offset;
  dvi_f = null_font;
  ensure_pdf_open();

  if (total_pages == 0)
  {
    pdf_set_version(5);
    pdf_set_compression(9);
    pdf_init_fontmaps();
    read_config_file("dvipdfmx.cfg");
    pdf_doc_set_producer("Y&YTeX 2.3.0");
    pdf_doc_set_creator("TeX");
    pdf_files_init();
    pdf_init_device(0.000015202, 2, 0);
    // TODO: pdfTeX's page width and height.
    // page_width  = pdf_page_width  != 0 ? <- : width(p)             + 2 * (pdf_h_origin + h_offset);
    // page_height = pdf_page_height != 0 ? <- : height(p) + depth(p) + 2 * (pdf_v_origin + v_offset);
    pdf_open_document(pdf_file_name, 0, 595.0, 842.0, 0, 0, (1 << 4));
    spc_exec_at_begin_document();
  }

  page_loc = dvi_offset + dvi_ptr;
  pdf_doc_begin_page(1.0, 72.0, 770.0);
  spc_exec_at_begin_page();

  last_bop = page_loc;
  cur_v = height(p) + v_offset;
  temp_ptr = p;

  if (type(p) == vlist_node)
    pdf_vlist_out();
  else
    pdf_hlist_out();

  spc_exec_at_end_page();
  pdf_doc_end_page();
  incr(total_pages);
  cur_s = -1;

done:
  if (tracing_output <= 0)
    print_char(']');

  dead_cycles = 0;
  update_terminal();

#ifdef STAT
  if (tracing_stats > 1)
  {
    print_nl("Memory usage before: ");
    print_int(var_used);
    print_char('&');
    print_int(dyn_used);
    print_char(';');
  }
#endif

  flush_node_list(p);

#ifdef STAT
  if (tracing_stats > 1)
  {
    prints(" after: ");
    print_int(var_used);
    print_char('&');
    print_int(dyn_used);
    prints("; still utouched: ");
    print_int(hi_mem_min - lo_mem_max - 1);
    print_ln();
  }
#endif
}
예제 #5
0
void print(char* s,...)
{ va_list p; va_start(p,s);
  if (term_line_empty && *s=='\n') ++s; /* avoid printing empty line */
  vprintf(s,p); va_end(p); /* print formatted value */
  term_line_empty= s[strlen(s)-1]=='\n'; update_terminal();
}