Back to index

texmacs  1.0.7.15
Public Member Functions | Private Member Functions | Private Attributes | Friends
concater_rep Class Reference

#include <concater.hpp>

Collaboration diagram for concater_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 concater_rep (edit_env env, bool rigid=false)
void typeset (tree t, path ip)
void finish ()

Private Member Functions

void print (box b)
void print (int type, int op_type, box b)
void control (tree t, path ip)
void marker (path ip)
void ghost (string s, path ip)
void ghost (string s, path ip, color col)
void flag_ok (string s, path ip, color col)
void flag (string s, path ip, color col)
void print (space spc)
void penalty_min (int p)
void penalty_max (int p)
void with_limits (int status)
void typeset_substring (string s, path ip, int pos)
void typeset_math_substring (string s, path ip, int pos, int op_type)
void typeset_colored_substring (string s, path ip, int pos, string col)
void typeset_text_string (tree t, path ip, int start, int end)
void typeset_math_string (tree t, path ip, int start, int end)
void typeset_prog_string (tree t, path ip, int start, int end)
void typeset_document (tree t, path ip)
void typeset_paragraph (tree t, path ip)
void typeset_surround (tree t, path ip)
void typeset_concat (tree t, path ip)
void typeset_rigid (tree t, path ip)
void typeset_hspace (tree t, path ip)
void typeset_space (tree t, path ip)
void typeset_move (tree t, path ip)
void typeset_shift (tree t, path ip)
void typeset_resize (tree t, path ip)
void typeset_clipped (tree t, path ip)
void typeset_float (tree t, path ip)
void typeset_repeat (tree t, path ip)
void typeset_formatting (tree t, path ip, string var)
void typeset_decorated_box (tree t, path ip)
void typeset_around (tree t, path ip, bool colored)
void typeset_large (tree t, path ip, int type, int op_type, string prefix)
void typeset_bigop (tree t, path ip)
void typeset_long_arrow (tree t, path ip)
void typeset_lprime (tree t, path ip)
void typeset_rprime (tree t, path ip)
void typeset_below (tree t, path ip)
void typeset_above (tree t, path ip)
void typeset_script (tree t, path ip, bool right)
void typeset_frac (tree t, path ip)
void typeset_sqrt (tree t, path ip)
void typeset_wide (tree t, path ip, bool above)
void typeset_neg (tree t, path ip)
void typeset_tree (tree t, path ip)
void typeset_table (tree t, path ip)
void typeset_syntax (tree t, path ip)
void typeset_blue (tree t, path ip)
void typeset_src_open (tree t, path ip, string extra)
void typeset_src_middle (tree t, path ip, int i)
void typeset_src_close (tree t, path ip)
void typeset_src_args (tree t, path ip)
void typeset_src_tag (tree t, path ip)
void typeset_inactive (tree t, path ip)
void typeset_error (tree t, path ip)
void typeset_assign (tree t, path ip)
void typeset_with (tree t, path ip)
void typeset_compound (tree t, path ip)
void typeset_auto (tree t, path ip, tree macro)
void typeset_include (tree t, path ip)
void typeset_drd_props (tree t, path ip)
void typeset_eval (tree t, path ip)
void typeset_value (tree t, path ip)
void typeset_argument (tree t, path ip)
void typeset_eval_args (tree t, path ip)
void typeset_mark (tree t, path ip)
void typeset_expand_as (tree t, path ip)
void typeset_dynamic (tree t, path ip)
void typeset_executable (tree t, path ip)
void typeset_rewrite (tree t, path ip)
void typeset_if (tree t, path ip)
void typeset_var_if (tree t, path ip)
void typeset_case (tree t, path ip)
void typeset_range (tree t, path ip)
void typeset_locus (tree t, path ip)
void typeset_set_binding (tree t, path ip)
void typeset_write (tree t, path ip)
void typeset_specific (tree t, path ip)
void typeset_flag (tree t, path ip)
void typeset_anim_compose (tree t, path ip)
void typeset_anim_repeat (tree t, path ip)
void typeset_anim_constant (tree t, path ip)
void typeset_anim_translate (tree t, path ip)
void typeset_anim_progressive (tree t, path ip)
void typeset_video (tree t, path ip)
void typeset_sound (tree t, path ip)
void typeset_graphical (array< box > &bs, tree t, path ip)
void typeset_graphics (tree t, path ip)
void typeset_superpose (tree t, path ip)
void typeset_gr_group (tree t, path ip)
void typeset_gr_linear_transform (tree t, path ip)
void typeset_text_at (tree t, path ip)
void typeset_math_at (tree t, path ip)
void typeset_point (tree t, path ip)
array< boxtypeset_line_arrows (path ip)
void typeset_line (tree t, path ip, bool close)
void typeset_arc (tree t, path ip, bool close)
void typeset_spline (tree t, path ip, bool close)
void typeset_var_spline (tree t, path ip)
void typeset_cspline (tree t, path ip)
void typeset_fill (tree t, path ip)
void typeset_image (tree t, path ip)
void typeset_canvas (tree t, path ip)
void typeset_ornament (tree t, path ip)
int prec (int i)
int succ (int i)
void pre_glue ()
void glue (box b, int ref, int arg)
void glue (box b, int ref, int arg1, int arg2)
void clean_and_correct ()
void handle_scripts (int start, int end)
void handle_matching (int start, int end)
void handle_brackets ()
void kill_spaces ()

Private Attributes

edit_env env
array< line_itema
bool rigid

Friends

class liner_rep
class par_line_rep
class typesetter_rep
class document_rep
box typeset_as_concat (edit_env env, tree t, path ip)
box typeset_as_box (edit_env env, tree t, path ip)
box typeset_as_atomic (edit_env env, tree t, path ip)
array< line_itemtypeset_concat (edit_env env, tree t, path ip)
array< line_itemtypeset_concat_range (edit_env env, tree t, path ip, int i1, int i2)
array< line_itemtypeset_marker (edit_env env, path ip)

Detailed Description

Definition at line 25 of file concater.hpp.


Constructor & Destructor Documentation

concater_rep::concater_rep ( edit_env  env,
bool  rigid = false 
)

Definition at line 738 of file concater.cpp.

                                                     :
  env (env2), rigid (rigid2) {}

Member Function Documentation

void concater_rep::clean_and_correct ( ) [private]

Definition at line 165 of file concat_post.cpp.

                                 {
  array<line_item> new_a;
  int i, prev=-1;
  for (i=0; i<N(a); i++)
    if (a[i]->type!=OBSOLETE_ITEM) {
      if (a[i]->b->w () != 0) {
       if (prev != -1)
         a[prev]->spc += space (::italic_correction (a[prev]->b, a[i]->b));
       prev= i;
      }
      new_a << a[i];
    }
  a= new_a;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::control ( tree  t,
path  ip 
) [private]

Definition at line 34 of file concater.cpp.

                                      {
  box b= empty_box (ip, 0, 0, 0, env->fn->yx);
  a << line_item (CONTROL_ITEM, OP_SKIP, b, HYPH_INVALID, t);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 323 of file concat_post.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::flag ( string  s,
path  ip,
color  col 
) [private]

Definition at line 114 of file concater.cpp.

                                                {
  if (is_accessible (ip) && (!env->read_only))
    flag_ok (s, ip, col);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::flag_ok ( string  s,
path  ip,
color  col 
) [private]

Definition at line 82 of file concater.cpp.

                                                   {
  path dip = decorate_right (ip);
  SI h= 4*env->fn->wfn/5;
  int r, g, b, a;
  get_rgb_color (col, r, g, b, a);
  r= 255- (255 - r)/6;
  g= 255- (255 - g)/6;
  b= 255- (255 - b)/6;
  color light= rgb_color (r, g, b, a);
  int info= env->info_level;
  if (info == INFO_MINIMAL || info == INFO_SHORT) {
    box infob= info_box (dip, h, env->fn->wline, col, light);
    box specb= specific_box (ip, infob, false, env->fn);
    print (specb);
  }
  else if (info == INFO_DETAILED || info == INFO_PAPER) {
    int sz= script (env->fn_size, env->index_level+2);
    font gfn (tex_font ("ecrm", sz, (int) (env->magn*env->dpi)));
    box textb= text_box (decorate (ip), 0, s, gfn, col);
    box flagb= flag_box (dip, textb, h, env->fn->wline, col, light);
    if (info == INFO_DETAILED) {
      box specb= specific_box (ip, flagb, false, env->fn);
      print (specb);
    }
    else {
      box b= resize_box (ip, flagb, 0, 0, 0, env->fn->yx);
      print (b);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::ghost ( string  s,
path  ip 
) [private]

Definition at line 50 of file concater.cpp.

                                      {
  ghost (s, ip, blue);
}

Here is the caller graph for this function:

void concater_rep::ghost ( string  s,
path  ip,
color  col 
) [private]

Definition at line 55 of file concater.cpp.

                                                 {
  if ((N(s)>2) && (s[0]=='<') && (s[N(s)-1]=='>')) {
    ghost ("<", ip, col);
    ghost (s (1,N(s)-1), ip, col);
    ghost (">", ip, col);
    return;
  }
  
  string fn_name= "cmr";
  if (N(s)==1) {
    if (s[0] == '<') { fn_name= "cmsy"; s= "h"; }
    else if (s[0] == '>') { fn_name= "cmsy"; s= "i"; }
    else if (s[0] == '|') { fn_name= "cmsy"; s= "j"; }
    else if (s[0] == '\\') { fn_name= "cmsy"; s= "n"; }
    else if (s[0] == '{') { fn_name= "cmsy"; s= "f"; }
    else if (s[0] == '}') { fn_name= "cmsy"; s= "g"; }
  }
  int sz= script (env->fn_size, env->index_level);
  font gfn (tex_font (fn_name, sz, (int) (env->magn*env->dpi)));
  box b= text_box (decorate (ip), 0, s, gfn, col);
  array<box> bs (1);
  bs[0]= b;
  a << line_item (STD_ITEM, OP_SKIP,
                  composite_box (decorate (ip), bs), HYPH_INVALID);
}

Here is the call graph for this function:

void concater_rep::glue ( box  b,
int  ref,
int  arg 
) [private]

Definition at line 67 of file concat_post.cpp.

                                           {
  space spc = max (a[ref]->spc, a[arg]->spc);

  a[arg]  = line_item (OBSOLETE_ITEM, OP_SKIP, a[arg]->b, a[arg]->penalty);
  a[ref]  = line_item (arg<ref? GLUE_LEFT_ITEM: GLUE_RIGHT_ITEM,
                       a[ref]->op_type, b,
                     min (a[ref]->penalty, a[arg]->penalty));
  a[ref]->spc = spc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::glue ( box  b,
int  ref,
int  arg1,
int  arg2 
) [private]

Definition at line 78 of file concat_post.cpp.

                                                      {
  space spc = max (a[ref]->spc, max (a[arg1]->spc, a[arg2]->spc));
  int   pen = min (a[ref]->penalty, min (a[arg1]->penalty, a[arg2]->penalty));

  space ref_spc= a[ref]->spc;
  a[arg1]= line_item (OBSOLETE_ITEM, OP_SKIP, a[arg1]->b, a[arg1]->penalty);
  a[arg2]= line_item (OBSOLETE_ITEM, OP_SKIP, a[arg2]->b, a[arg2]->penalty);
  a[ref]= line_item (GLUE_BOTH_ITEM, a[ref]->op_type, b, pen);
  a[ref]->spc = spc;
}
void concater_rep::handle_brackets ( ) [private]

Definition at line 267 of file concat_post.cpp.

                               {
  int first=-1, start=0, i=0;
  while (i<N(a)) {
    if (a[i]->type==LEFT_BRACKET_ITEM) {
      if (first==-1) first= i;
      start= i;
    }
    if (a[i]->type==RIGHT_BRACKET_ITEM) {
      handle_scripts  (succ (start), prec (i));
      handle_matching (start, i);
      if (first!=-1) i=first-1;
      start= 0;
      first= -1;
    }
    i++;
  }
  if (N(a)>0) {
    handle_scripts  (0, N(a)-1);
    handle_matching (0, N(a)-1);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::handle_matching ( int  start,
int  end 
) [private]

Definition at line 185 of file concat_post.cpp.

                                                 {
  //cout << "matching " << start << " -- " << end << "\n";
  //cout << a << "\n\n";
  int i;
  SI y1= min (a[start]->b->y1, a[end]->b->y2);
  SI y2= max (a[start]->b->y1, a[end]->b->y2);
  a[start]->penalty++;
  a[end]->penalty++;
  // cout << "Start: " << (y2-y1) << "\n";
  for (i=start+1; i<end; i++) {
    if (a[i]->type == OBSOLETE_ITEM) continue;
    // cout << "  " << a[i] << ": " << (a[i]->b->y2- a[i]->b->y1) << "\n";
    // y1= min (y1, a[i]->b->sub_base());
    // y2= max (y2, a[i]->b->sup_base());
    y1= min (y1, a[i]->b->y1);
    y2= max (y2, a[i]->b->y2);
    a[i]->penalty++;
  }
  for (i=start; i<=end; i++) {
    int tp= a[i]->type;
    if (tp == LEFT_BRACKET_ITEM ||
       tp == MIDDLE_BRACKET_ITEM ||
       tp == RIGHT_BRACKET_ITEM)
      {
       // make symmetric and prevent from too large delimiters if possible
       font fn = a[i]->b->get_leaf_font ();
       SI Y1   = y1 + (fn->sep >> 1);
       SI Y2   = y2 - (fn->sep >> 1);
       SI tol  = fn->sep << 1;
       SI mid  = (a[i]->b->y1 + a[i]->b->y2) >> 1;
       SI drift= ((Y1 + Y2) >> 1) - mid; // fn->yfrac;
       if (drift < 0) Y2 += min (-drift, tol) << 1;
       else Y1 -= min (drift, tol) << 1;

        // further adjustments when the enclosed expression is not very heigh
        SI h= y2 - y1 - fn->sep;
        SI d= 5 * fn->yx - h;
        if (d > 0) { Y1 += d/12; Y2 -= d/12; }

        // replace item by large or small delimiter
        string ls= a[i]->b->get_leaf_string ();
        color lc= a[i]->b->get_leaf_color ();
        font lf= a[i]->b->get_leaf_font ();
        if (Y1 < fn->y1 || Y2 > fn->y2)
          a[i]->b= delimiter_box (a[i]->b->ip, ls, fn, lc, Y1, Y2);
        else {
          string s= "<nobracket>";
          int j;
          for (j=0; j<N(ls); j++)
            if (ls[j] == '-') break;
          if (j<N(ls) && ls[N(ls)-1] == '>') s= ls (j+1, N(ls)-1);
          if (N(s) > 1 && s[0] != '<') s= "<" * s * ">";
          else if (N(s) == 0 || s == ".") s= "<nobracket>";
          a[i]->b= text_box (a[i]->b->ip, 0, s, lf, lc);
          tp= STD_ITEM;
        }
        a[i]->type= STD_ITEM;
      }
    if (tp == LEFT_BRACKET_ITEM)
      for (int j= i-1; j>=0; j--) {
       if (a[j]->type == MARKER_ITEM) {
         SI Y1= a[i]->b->y1;
         SI Y2= a[i]->b->y2;
         a[j]->b   = marker_box (a[j]->b->find_lip (), 0, Y1, 0, Y2, a[j]->b);
         a[j]->type= STD_ITEM;
       }
       else if (a[j]->type != CONTROL_ITEM) break;
      }
    if (tp == RIGHT_BRACKET_ITEM)
      for (int j= i+1; j<N(a); j++) {
       if (a[j]->type == MARKER_ITEM) {
         SI Y1= a[i]->b->y1;
         SI Y2= a[i]->b->y2;
         a[j]->b   = marker_box (a[j]->b->find_lip (), 0, Y1, 0, Y2, a[j]->b);
         a[j]->type= STD_ITEM;
       }
       else if (a[j]->type != CONTROL_ITEM) break;
      }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::handle_scripts ( int  start,
int  end 
) [private]

Definition at line 90 of file concat_post.cpp.

                                                {
  int i;
  for (i=start; i<=end; ) {
    if ((a[i]->type == OBSOLETE_ITEM) ||
       (a[i]->type == LSUB_ITEM) ||
       (a[i]->type == LSUP_ITEM) ||
       (a[i]->type == GLUE_LSUBS_ITEM) ||
       (a[i]->type == RSUB_ITEM) ||
       (a[i]->type == RSUP_ITEM) ||
       (a[i]->type == GLUE_RSUBS_ITEM)) { i++; continue; }

    path sip;
    int l= prec (i);
    box lb1, lb2;
    if (l < start) l= -1;
    else switch (a[l]->type) {
    case LSUB_ITEM:
      lb1= a[l]->b[0];
      sip= lb1->ip;
      break;
    case LSUP_ITEM:
      lb2= a[l]->b[0];
      sip= lb2->ip;
      break;
    case GLUE_LSUBS_ITEM:
      lb1= a[l]->b[0];
      lb2= a[l]->b[1];
      sip= lb2->ip;
      break;
    default:
      l = -1;
    }

    int r= succ (i);
    box rb1, rb2;
    if (r > end) r= N(a);
    else switch (a[r]->type) {
    case RSUB_ITEM:
      rb1= a[r]->b[0];
      sip= rb1->ip;
      break;
    case RSUP_ITEM:
      rb2= a[r]->b[0];
      sip= rb2->ip;
      break;
    case GLUE_RSUBS_ITEM:
      rb1= a[r]->b[0];
      rb2= a[r]->b[1];
      sip= rb2->ip;
      break;
    default:
      r = N(a);
    }

    box b;
    if ((l==-1) && (r==N(a))) { i++; continue; }
    if ((l!=-1) && (r==N(a))) {
      b= left_script_box (sip, a[i]->b, lb1, lb2, env->fn, env->vert_pos);
      glue (b, i, l);
    }
    if ((l==-1) && (r!=N(a))) {
      if (a[i]->limits)
       b= limit_box (sip, a[i]->b, rb1, rb2, env->fn, true);
      else
       b= right_script_box (sip, a[i]->b, rb1, rb2, env->fn, env->vert_pos);
      glue (b, i, r);
    }
    if ((l!=-1) && (r!=N(a))) {
      b= side_box (sip, a[i]->b, lb1, lb2, rb1, rb2, env->fn, env->vert_pos);
      glue (b, i, l, r);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::kill_spaces ( ) [private]

Definition at line 294 of file concat_post.cpp.

                           {
  int i;
  for (i=N(a)-1; (i>0) && (a[i]->type == CONTROL_ITEM); i--)
    a[i-1]->spc= space (0);
  for (i=0; (i<N(a)) && (a[i]->type == CONTROL_ITEM); i++)
    a[i]->spc= space (0);

  for (i=0; i<N(a); i++)
    if (a[i]->type==CONTROL_ITEM) {
      if (is_formatting (a[i]->t)) {
       tree_label lab= L(a[i]->t);
       if ((lab==NEXT_LINE) || (lab==LINE_BREAK) || (lab==NEW_LINE))
         {
           if (i>0) a[i-1]->spc= space (0);
           a[i]->spc= space (0);
         }
      }

      if (is_tuple (a[i]->t, "env_par") ||
         is_tuple (a[i]->t, "env_page"))
       a[i]->spc= space (0);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::marker ( path  ip) [private]

Definition at line 40 of file concater.cpp.

                             {
  if (is_decoration (ip)) ip= path (0, ip);
  string fn_name= "cmr";
  int sz= script (env->fn_size, env->index_level);
  font gfn (tex_font (fn_name, sz, (int) (env->magn*env->dpi)));
  box b= text_box (ip->next, ip->item, "", gfn, blue);
  a << line_item (MARKER_ITEM, OP_SKIP, b, HYPH_INVALID);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::penalty_max ( int  p) [private]

Definition at line 136 of file concater.cpp.

                                {
  if (N(a)>0) a[N(a)-1]->penalty = max (a[N(a)-1]->penalty, p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::penalty_min ( int  p) [private]

Definition at line 131 of file concater.cpp.

                                {
  if (N(a)>0) a[N(a)-1]->penalty = min (a[N(a)-1]->penalty, p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::pre_glue ( ) [private]

Definition at line 38 of file concat_post.cpp.

                        {
  int i;
  for (i=0; i<N(a)-1; i++) {
    line_item item1= a[i];
    line_item item2= a[i+1];
    int t1= item1->type;
    int t2= item2->type;
    if (((t1 == RSUB_ITEM) && (t2 == RSUP_ITEM)) ||
       ((t1 == RSUP_ITEM) && (t2 == RSUB_ITEM)) ||
       ((t1 == LSUB_ITEM) && (t2 == LSUP_ITEM)) ||
       ((t1 == LSUP_ITEM) && (t2 == LSUB_ITEM)))
      {
       bool  flag1 = (t1 == LSUB_ITEM) || (t1 == RSUB_ITEM);
       bool  flag2 = (t1 == LSUB_ITEM) || (t1 == LSUP_ITEM);
       int   type  = flag2? GLUE_LSUBS_ITEM: GLUE_RSUBS_ITEM;
       box   b1    = flag1? item1->b[0]: item2->b[0];
       box   b2    = flag1? item2->b[0]: item1->b[0];
       box   b     = script_box (b1->ip, b1, b2, env->fn);
       int   pen   = item2->penalty;
       space spc   = max (item1->spc, item2->spc);

       a[i]= line_item (type, OP_SKIP, b, pen);
       a[i]->spc = spc;
       a[i+1]= line_item (OBSOLETE_ITEM, OP_SKIP, item2->b, pen);
      }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int concater_rep::prec ( int  i) [private]

Definition at line 22 of file concat_post.cpp.

                         {
  do i--; while ((i>=0) && (a[i]->type==OBSOLETE_ITEM));
  return i;
}

Here is the caller graph for this function:

void concater_rep::print ( box  b) [private]

Definition at line 24 of file concater.cpp.

                          {
  a << line_item (STD_ITEM, env->mode_op, b, HYPH_INVALID);
}
void concater_rep::print ( int  type,
int  op_type,
box  b 
) [private]

Definition at line 29 of file concater.cpp.

                                                 {
  a << line_item (type, op_type, b, HYPH_INVALID);
}
void concater_rep::print ( space  spc) [private]

Definition at line 124 of file concater.cpp.

                              {
  int n= N(a);
  if (n==0) return;
  a[n-1]->spc= max (spc, a[n-1]->spc);
}

Here is the call graph for this function:

int concater_rep::succ ( int  i) [private]

Definition at line 28 of file concat_post.cpp.

                         {
  do i++; while ((i<N(a)) && (a[i]->type==OBSOLETE_ITEM));
  return i;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset ( tree  t,
path  ip 
)

Definition at line 152 of file concater.cpp.

                                      {
  // cout << "Typeset " << t << "\n";
  // cout << "Typeset " << t << ", " << ip << ", " << obtain_ip (t) << "\n";

  /*
  if (obtain_ip (t) != ip)
    cout << "TeXmacs] Wrong ip: " << t << "\n"
        << "       ] " << obtain_ip (t) << " -> " << ip << "\n";
  */

  if (!is_accessible (ip)) {
    path ip2= obtain_ip (t);
    if (ip2 != path (DETACHED))
      ip= ip2;
  }

  if (env->hl_lan != 0)
    env->lan->highlight (t);

  if (is_atomic (t)) {
    if      (env->mode == 1) typeset_text_string (t, ip, 0, N(t->label));
    else if (env->mode == 2) typeset_math_string (t, ip, 0, N(t->label));
    else if (env->mode == 3) typeset_prog_string (t, ip, 0, N(t->label));
    else                     typeset_text_string (t, ip, 0, N(t->label));
    return;
  }

  switch (L (t)) {
  case UNINIT:
  case ERROR:
    typeset_error (t, ip);
    break;
  case RAW_DATA:
    typeset_inactive (t, ip);
    break;
  case DOCUMENT:
    typeset_document (t, ip);
    break;
  case PARA:
    typeset_paragraph (t, ip);
    break;
  case SURROUND:
    typeset_surround (t, ip);
    break;
  case CONCAT:
    typeset_concat (t, ip);
    break;
  case RIGID:
    typeset_rigid (t, ip);
    break;
  case HIDDEN:
    //(void) env->exec (t);
    if (N(t) != 1) typeset_error (t, ip);
    else (void) typeset_as_concat (env, t[0], descend (ip, 0));
    break;
  case FREEZE:
    if (N(t) != 1) typeset_error (t, ip);
    else typeset (attach_middle (t[0], ip));
    //typeset (freeze (t[0]), decorate_middle (ip));
    break;
  case UNFREEZE:
    if (N(t) != 1) typeset_error (t, ip);
    else typeset (t[0], descend (ip, 0));
    break;
  case HSPACE:
    t= env->exec (t);
    typeset_hspace (t, ip);
    break;
  case VAR_VSPACE:
    flag (env->drd->get_name (L(t)), ip, brown);
    t= tree (VAR_VSPACE, env->exec (tree (TMLEN, A(t))));
    control (t, ip);
    break;
  case VSPACE:
    flag (env->drd->get_name (L(t)), ip, brown);
    t= tree (VSPACE, env->exec (tree (TMLEN, A(t))));
    control (t, ip);
    break;
  case SPACE:
    t= env->exec (t);
    typeset_space (attach_here (t, ip));
    break;
  case HTAB:
    if (N(t) != 1 && N(t) != 2) { typeset_error (t, ip); break; }
    if (N(a)==0) print (empty_box (ip, 0, 0, 0, env->fn->yx));
    print (space (env->as_length (t[0])));
    control (t, ip);
    break;
  case MOVE:
    typeset_move (t, ip);
    break;
  case SHIFT:
    typeset_shift (t, ip);
    break;
  case RESIZE:
    typeset_resize (t, ip);
    break;
  case CLIPPED:
    typeset_clipped (t, ip);
    break;
  case REPEAT:
    typeset_repeat (t, ip);
    break;
  case _FLOAT:
    typeset_float (t, ip);
    break;
  case DATOMS:
    typeset_formatting (t, ip, ATOM_DECORATIONS);
    break;
  case DLINES:
    typeset_formatting (t, ip, LINE_DECORATIONS);
    break;
  case DPAGES:
    typeset_formatting (t, ip, PAGE_DECORATIONS);
    break;
  case DBOX:
    typeset_decorated_box (t, ip);
    break;

  case WITH_LIMITS:
    with_limits (LIMITS_DISPLAY);
    flag ("with-limits", ip, brown);
    control (t, ip);
    break;
  case LINE_BREAK:
    if (N(a)>0) a[N(a)-1]->penalty = 0;   
    flag ("line-break", ip, brown);
    control (t, ip);
    break;
  case NEW_LINE:
  case NEXT_LINE:
    {
      string name= env->drd->get_name (L(t));
      flag (name, ip, brown);
      control (t, ip);
      break;
    }
  case NO_BREAK:
    if (N(a)>0) a[N(a)-1]->penalty = HYPH_INVALID;
    if ((N(a)>1) &&
       (a[N(a)-1]->type == STRING_ITEM) &&
       (a[N(a)-1]->b->get_leaf_string () == ""))
      a[N(a)-2]->penalty = HYPH_INVALID;  
    flag ("no line break", ip, brown);
    control (t, ip);
    break;
  case YES_INDENT:
    flag ("yes-first-indent", ip, brown);
    control (tuple ("env_par", PAR_FIRST, env->read (PAR_FIRST)), ip);
    break;
  case NO_INDENT:
    flag ("no-first-indent", ip, brown);
    control (tuple ("env_par", PAR_FIRST, "0cm"), ip);
    break;
  case VAR_YES_INDENT:
    flag ("yes-first-indent-after", ip, brown);
    control (tuple ("env_par", PAR_NO_FIRST, "false"), ip);
    break;
  case VAR_NO_INDENT:
    flag ("no-first-indent-after", ip, brown);
    control (tuple ("env_par", PAR_NO_FIRST, "true"), ip);
    break;
  case VAR_PAGE_BREAK:
  case PAGE_BREAK:
  case VAR_NO_PAGE_BREAK:
  case NO_PAGE_BREAK:
  case VAR_NEW_PAGE:
  case NEW_PAGE:
  case VAR_NEW_DPAGE:
  case NEW_DPAGE:
    {
      string name= env->drd->get_name (L(t));
      flag (name, ip, brown);
      control (t, ip);
      break;
    }

  case AROUND:
  case VAR_AROUND:
  case BIG_AROUND:
    typeset_around (t, ip, env->get_string (MATH_NESTING_MODE) != "off");
    break;
  case LEFT:
    typeset_large (t, ip, LEFT_BRACKET_ITEM, OP_OPENING_BRACKET, "<left-");
    break;
  case MID:
    typeset_large (t, ip, MIDDLE_BRACKET_ITEM, OP_MIDDLE_BRACKET, "<mid-");
    break;
  case RIGHT:
    typeset_large (t, ip, RIGHT_BRACKET_ITEM, OP_CLOSING_BRACKET, "<right-");
    break;
  case BIG:
    typeset_bigop (t, ip);
    break;
  case LONG_ARROW:
    typeset_long_arrow (t, ip);
    break;
  case LPRIME:
    typeset_lprime (t, ip);
    break;
  case RPRIME:
    typeset_rprime (t, ip);
    break;
  case BELOW:
    typeset_below (t, ip);
    break;
  case ABOVE:
    typeset_above (t, ip);
    break;
  case LSUB:
  case LSUP:
    typeset_script (t, ip, false);
    break;
  case RSUB:
  case RSUP:
    typeset_script (t, ip, true);
    break;
  case FRAC:
    typeset_frac (t, ip);
    break;
  case SQRT:
    typeset_sqrt (t, ip);
    break;
  case WIDE:
    typeset_wide (t, ip, true);
    break;
  case VAR_WIDE:
    typeset_wide (t, ip, false);
    break;
  case NEG:
    typeset_neg (t, ip);
    break;
  case TREE:
    typeset_tree (t, ip);
    break;
  case SYNTAX:
    typeset_syntax (t, ip);
    break;

  case TFORMAT:
    if ((N(t)>0) && is_table (t[N(t)-1])) typeset_table (t, ip);
    else typeset_formatting (t, ip, CELL_FORMAT);
    break;
  case TWITH:
  case CWITH:
  case TMARKER:
    typeset_inactive (t, ip);
    break;
  case TABLE:
    typeset_table (t, ip);
    break;
  case ROW:
  case CELL:
  case SUBTABLE:
    break;

  case ASSIGN:
    typeset_assign (t, ip);
    break;
  case WITH:
    typeset_with (t, ip);
    break;
  case PROVIDES:
    typeset_executable (t, ip);
    break;
  case QUOTE_VALUE:
    typeset_inactive (t, ip);
    break;
  case VALUE:
    typeset_value (t, ip);
    break;
  case MACRO:
    typeset_inactive (t, ip);
    break;
  case DRD_PROPS:
    typeset_drd_props (t, ip);
    break;
  case ARG:
    typeset_argument (t, ip);
    break;
  case QUOTE_ARG:
    typeset_inactive (t, ip);
    break;
  case COMPOUND:
    typeset_compound (t, ip);
    break;
  case XMACRO:
    typeset_inactive (t, ip);
    break;
  case GET_LABEL:
    typeset_executable (t, ip);
    break;
  case GET_ARITY:
    typeset_executable (t, ip);
    break;
  case MAP_ARGS:
    typeset_rewrite (t, ip);
    break;
  case EVAL_ARGS:
    typeset_eval_args (t, ip);
    break;
  case MARK:
    typeset_mark (t, ip);
    break;
  case EXPAND_AS:
    typeset_expand_as (t, ip);
    break;
  case EVAL:
    typeset_eval (t, ip);
    break;
  case QUOTE:
    typeset_inactive (t, ip);
    break;
  case QUASI:
    typeset_eval (tree (EVAL, tree (QUASIQUOTE, t[0])), ip);
    break;
  case QUASIQUOTE:
  case UNQUOTE:
  case VAR_UNQUOTE:
  case COPY:
    typeset_executable (t, ip);
    break;
  case IF:
    typeset_if (t, ip);
    break;
  case VAR_IF:
    typeset_var_if (t, ip);
    break;
  case CASE:
    typeset_case (t, ip);
    break;
  case WHILE:
  case FOR_EACH:
    typeset_executable (t, ip);
    break;
  case EXTERN:
    typeset_rewrite (t, ip);
    break;
  case INCLUDE:
    typeset_include (t, ip);
    break;
  case USE_PACKAGE:
  case USE_MODULE:
    typeset_executable (t, ip);
    break;

  case OR:
  case XOR:
  case AND:
  case NOT:
  case PLUS:
  case MINUS:
  case TIMES:
  case OVER:
  case DIV:
  case MOD:
  case MINIMUM:
  case MAXIMUM:
  case MATH_SQRT:
  case EXP:
  case LOG:
  case POW:
  case COS:
  case SIN:
  case TAN:
  case MERGE:
  case LENGTH:
    typeset_executable (t, ip);
    break;
  case RANGE:
    typeset_range (t, ip);
    break;
  case NUMBER:
  case _DATE:
  case TRANSLATE:
  case CHANGE_CASE:
  case FIND_FILE:
  case IS_TUPLE:
  case LOOK_UP:
  case EQUAL:
  case UNEQUAL:
  case LESS:
  case LESSEQ:
  case GREATER:
  case GREATEREQ:
  case BOX_INFO:
  case FRAME_DIRECT:
  case FRAME_INVERSE:
    typeset_executable (t, ip);
    break;

  case CM_LENGTH:
  case MM_LENGTH:
  case IN_LENGTH:
  case PT_LENGTH:
  case BP_LENGTH:
  case DD_LENGTH:
  case PC_LENGTH:
  case CC_LENGTH:
  case FS_LENGTH:
  case FBS_LENGTH:
  case EM_LENGTH:
  case LN_LENGTH:
  case SEP_LENGTH:
  case YFRAC_LENGTH:
  case EX_LENGTH:
  case FN_LENGTH:
  case FNS_LENGTH:
  case BLS_LENGTH:
  case SPC_LENGTH:
  case XSPC_LENGTH:
  case PAR_LENGTH:
  case PAG_LENGTH:
  case GW_LENGTH:
  case GH_LENGTH:
  case TMPT_LENGTH:
  case PX_LENGTH:
    typeset_executable (t, ip);
    break;

  case STYLE_ONLY:
  case VAR_STYLE_ONLY:
  case ACTIVE:
  case VAR_ACTIVE:
  case INACTIVE:
  case VAR_INACTIVE:
    typeset_compound (t, ip);
    break;
  case REWRITE_INACTIVE:
    typeset_rewrite (t, ip);
    break;
  case INLINE_TAG:
  case OPEN_TAG:
  case MIDDLE_TAG:
  case CLOSE_TAG:
    typeset_src_tag (t, ip);
    break;
  case SYMBOL:
  case LATEX:
  case HYBRID:
    typeset_inactive (t, ip);
    break;

  case LOCUS:
    typeset_locus (t, ip);
    break;
  case ID:
    typeset_inactive (t, ip);
    break;
  case HARD_ID:
    typeset_executable (t, ip);
    break;
  case LINK:
  case URL:
  case SCRIPT:
    typeset_inactive (t, ip);
    break;
  case HLINK:
  case ACTION:
    typeset_compound (t, ip);
    break;
  case SET_BINDING:
    typeset_set_binding (t, ip);
    break;
  case GET_BINDING:
    typeset_executable (t, ip);
    break;
  case LABEL:
  case REFERENCE:
  case PAGEREF:
    typeset_compound (t, ip);
    break;
  case WRITE:
    typeset_write (t, ip);
    break;

  case TUPLE:
  case ATTR:
  case TMLEN:
  case COLLECTION:
  case ASSOCIATE:
  case BACKUP:
    typeset_inactive (t, ip);
    break;
  case PATTERN:
  case GRADIENT:
    marker (descend (ip, 0));
    typeset_inactive (env->exec (t), decorate (ip));
    marker (descend (ip, 1));
    break;
  case SPECIFIC:
    typeset_specific (t, ip);
    break;
  case FLAG:
    typeset_flag (t, ip);
    break;

  case ANIM_COMPOSE:
    typeset_anim_compose (t, ip);
    break;
  case ANIM_REPEAT:
    typeset_anim_repeat (t, ip);
    break;
  case ANIM_CONSTANT:
    typeset_anim_constant (t, ip);
    break;
  case ANIM_TRANSLATE:
    typeset_anim_translate (t, ip);
    break;
  case ANIM_PROGRESSIVE:
    typeset_anim_progressive (t, ip);
    break;
  case VIDEO:
    typeset_video (t, ip);
    break;
  case SOUND:
    typeset_sound (t, ip);
    break;

  case GRAPHICS:
    typeset_graphics (t, ip);
    break;
  case SUPERPOSE:
    typeset_superpose (t, ip);
    break;
  case GR_GROUP:
    typeset_gr_group (t, ip);
    break;
  case GR_LINEAR_TRANSFORM:
    typeset_gr_linear_transform (t, ip);
    break;
  case TEXT_AT:
    typeset_text_at (t, ip);
    break;
  case MATH_AT:
    typeset_math_at (t, ip);
    break;
  case _POINT:
    typeset_point (t, ip);
    break;
  case LINE:
    typeset_line (t, ip, false);
    break;
  case CLINE:
    typeset_line (t, ip, true);
    break;
  case ARC:
    typeset_arc (t, ip, false);
    break;
  case CARC:
    typeset_arc (t, ip, true);
    break;
  case SPLINE:
    typeset_spline (t, ip, false);
    break;
  case VAR_SPLINE:
    typeset_var_spline (t, ip);
    break;
  case CSPLINE:
    typeset_cspline (t, ip);
    break;
  case FILL:
    typeset_fill (t, ip);
    break;
  case IMAGE:
    typeset_image (t, ip);
    break;

  case CANVAS:
    typeset_canvas (t, ip);
    break;
  case ORNAMENT:
    typeset_ornament (t, ip);
    break;

  default:
    if (L(t) < START_EXTENSIONS) print (test_box (ip));
    else typeset_compound (t, ip);
    break;
  }
}

Here is the caller graph for this function:

void concater_rep::typeset_above ( tree  t,
path  ip 
) [private]

Definition at line 174 of file concat_math.cpp.

                                            {
  if (N(t) != 2) { typeset_error (t, ip); return; }
  box b1= typeset_as_concat (env, t[0], descend (ip, 0));
  tree old_ds= env->local_begin (MATH_DISPLAY, "false");
  tree old_mc= env->local_begin (MATH_CONDENSED, "true");
  tree old_il= env->local_begin_script ();
  box b2= typeset_as_concat (env, t[1], descend (ip, 1));
  env->local_end_script (old_il);
  env->local_end (MATH_CONDENSED, old_mc);
  env->local_end (MATH_DISPLAY, old_ds);
  print (limit_box (ip, b1, box (), b2, env->fn, false));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_anim_compose ( tree  t,
path  ip 
) [private]

Definition at line 19 of file concat_animate.cpp.

                                                   {
  int i, n= N(t);
  array<box> bs(n);
  for (i=0; i<n; i++) bs[i]= typeset_as_concat (env, t[i], descend (ip, i));
  print (anim_compose_box (ip, bs));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_anim_constant ( tree  t,
path  ip 
) [private]

Definition at line 34 of file concat_animate.cpp.

                                                    {
  if (N(t) != 2) { typeset_error (t, ip); return; }
  box b= typeset_as_concat (env, t[0], descend (ip, 0));
  int l= env->as_length (env->exec (t[1]));
  print (anim_constant_box (ip, b, l));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_anim_progressive ( tree  t,
path  ip 
) [private]

Definition at line 63 of file concat_animate.cpp.

                                                       {
  if (N(t) != 4) { typeset_error (t, ip); return; }
  box b  = typeset_as_concat (env, t[0], descend (ip, 0));
  int  len= env->as_length (t[1]);
  tree t1 = env->exec (t[2]);
  tree t2 = env->exec (t[3]);
  rectangle r1 (b->x1, b->y1, b->x2, b->y2);
  rectangle r2 (b->x1, b->y1, b->x2, b->y2);
  if (is_tuple (t1) && N(t1)==4) {
    effect_point (env, b, t1[0], t1[1], r1->x1, r1->y1);
    effect_point (env, b, t1[2], t1[3], r1->x2, r1->y2);
  }
  if (is_tuple (t2) && N(t2)==4) {
    effect_point (env, b, t2[0], t2[1], r2->x1, r2->y1);
    effect_point (env, b, t2[2], t2[3], r2->x2, r2->y2);
  }
  print (anim_progressive_box (ip, b, len, r1, r2));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_anim_repeat ( tree  t,
path  ip 
) [private]

Definition at line 27 of file concat_animate.cpp.

                                                  {
  if (N(t) != 1) { typeset_error (t, ip); return; }
  box b= typeset_as_concat (env, t[0], descend (ip, 0));
  print (anim_repeat_box (ip, b));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_anim_translate ( tree  t,
path  ip 
) [private]

Definition at line 50 of file concat_animate.cpp.

                                                     {
  if (N(t) != 4) { typeset_error (t, ip); return; }
  box b  = typeset_as_concat (env, t[0], descend (ip, 0));
  int  len= env->as_length (t[1]);
  tree t1 = env->exec (t[2]);
  tree t2 = env->exec (t[3]);
  SI x1= b->x1, y1= b->y1, x2= b->x1, y2= b->y1;
  if (is_tuple (t1) && N(t1)==2) effect_point (env, b, t1[0], t1[1], x1, y1);
  if (is_tuple (t2) && N(t2)==2) effect_point (env, b, t2[0], t2[1], x2, y2);
  print (anim_translate_box (ip, b, len, x1, y1, x2, y2));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_arc ( tree  t,
path  ip,
bool  close 
) [private]

Definition at line 270 of file concat_graphics.cpp.

                                                      {
BEGIN_MAGNIFY
  int i, n= N(t);
  array<point> a(n);
  for (i=0; i<n; i++)
    a[i]= env->as_point (env->exec (t[i]));
  array<path> cip(n);
  for (i=0; i<n; i++)
    cip[i]= descend (ip, i);
  if (N(a) == 0 || N(a[0]) == 0) typeset_error (t, ip);
  else {
    if (n != 3 || linearly_dependent (a[0], a[1], a[2]) ||
        (N (intersection (midperp (a[0], a[1], a[2]),
                          midperp (a[1], a[2], a[0]))) == 0))
      typeset_line (t, ip, close);
    else {
      curve c= env->fr (arc (a, cip, close));
      print (curve_box (ip, c, env->lw, env->col,
                        env->dash_style, env->dash_style_unit,
                        env->fill_mode, env->fill_color,
                        typeset_line_arrows (ip)));
    }
  }
END_MAGNIFY
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_argument ( tree  t,
path  ip 
) [private]

Definition at line 194 of file concat_macro.cpp.

                                               {
  // cout << "Argument " << t << ", " << ip << "\n";
  if (N(t) == 0) { typeset_error (t, ip); return; }
  tree r= t[0];
  if (is_compound (r) ||
      is_nil (env->macro_arg) ||
      (!env->macro_arg->item->contains (r->label)))
    {
      typeset_error (t, ip);
      return;
    }

  string name = r->label;
  tree   value= env->macro_arg->item [name];
  path   valip= decorate_right (ip);
  if (!is_func (value, BACKUP)) {
    path new_valip= env->macro_src->item [name];
    if (is_accessible (new_valip)) valip= new_valip;
  }
  // cout << "Src   " << name << "=\t " << valip << "\n";

  marker (descend (ip, 0));
  list<hashmap<string,tree> > old_var= env->macro_arg;
  list<hashmap<string,path> > old_src= env->macro_src;
  if (!is_nil (env->macro_arg)) env->macro_arg= env->macro_arg->next;
  if (!is_nil (env->macro_src)) env->macro_src= env->macro_src->next;

  if (N(t) > 1) {
    int i, n= N(t);
    for (i=1; i<n; i++) {
      tree r= env->exec (t[i]);
      if (!is_int (r)) {
        value= tree (ERROR, "arg " * name);
        valip= decorate_right (ip);
        break;
      }
      int nr= as_int (r);
      if ((!is_compound (value)) || (nr<0) || (nr>=N(value))) {
        value= tree (ERROR, "arg " * name);
        valip= decorate_right (ip);
        break;
      }
      value= value[nr];
      valip= descend (valip, nr);
    }
  }
  typeset (attach_here (value, valip));

  env->macro_arg= old_var;
  env->macro_src= old_src;
  marker (descend (ip, 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_around ( tree  t,
path  ip,
bool  colored 
) [private]

Definition at line 348 of file concat_math.cpp.

                                                           {
  if (colored) {
    int nl= env->get_int (MATH_NESTING_LEVEL);
    tree old_col= env->local_begin (COLOR, bracket_color (nl));
    tree old_nl = env->local_begin (MATH_NESTING_LEVEL, as_string (nl+1));
    typeset_around (t, ip, false);
    env->local_end (MATH_NESTING_LEVEL, old_nl);
    env->local_end (COLOR, old_col);
  }
  else {
    marker (descend (ip, 0));
    switch (L(t)) {
    case AROUND:
      if (N(t) == 3) {
        box br1= typeset_as_concat (env, t[0], descend (ip, 0));
        print (STD_ITEM, OP_OPENING_BRACKET, br1);
        typeset (t[1], descend (ip, 1));
        box br2= typeset_as_concat (env, t[2], descend (ip, 2));
        print (STD_ITEM, OP_CLOSING_BRACKET, br2);
      }
      else typeset_error (t, ip);
      break;
    case VAR_AROUND:
      if (N(t) == 3) {
        typeset (make_large (LEFT, t[0]),
                 decorate_middle (descend (ip, 0)));
        typeset (t[1], descend (ip, 1));
        typeset (make_large (RIGHT, t[2]),
                 decorate_middle (descend (ip, 2)));
      }
      else typeset_error (t, ip);
      break;
    case BIG_AROUND:
      if (N(t) == 2) {
        typeset (make_large (BIG, t[0]),
                 decorate_middle (descend (ip, 0)));
        typeset (t[1], descend (ip, 1));
      }
      else typeset_error (t, ip);
      break;
    default:
      break;
    }
    marker (descend (ip, 1));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_assign ( tree  t,
path  ip 
) [private]

Definition at line 19 of file concat_macro.cpp.

                                             {
  if (N(t) != 2) { typeset_error (t, ip); return; }
  tree r= env->exec (t[0]);
  if (!is_atomic (r)) return;
  string var= r->label;
  env->assign (var, copy (t[1]));
  if (env->var_type [var] == Env_Paragraph)
    control (tuple ("env_par", var, env->read (var)), ip);
  else if (env->var_type [var] == Env_Page)
    control (tuple ("env_page", var, env->read (var)), ip);
  else control (t, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_auto ( tree  t,
path  ip,
tree  macro 
) [private]

Definition at line 135 of file concat_macro.cpp.

                                                   {
  env->macro_arg= list<hashmap<string,tree> > (
    hashmap<string,tree> (UNINIT), env->macro_arg);
  env->macro_src= list<hashmap<string,path> > (
    hashmap<string,path> (path (DECORATION)), env->macro_src);
  string var= f[0]->label;
  env->macro_arg->item (var)= t;
  env->macro_src->item (var)= ip;
  typeset (attach_right (f[1], ip));
  env->macro_arg= env->macro_arg->next;
  env->macro_src= env->macro_src->next;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_below ( tree  t,
path  ip 
) [private]

Definition at line 160 of file concat_math.cpp.

                                            {
  if (N(t) != 2) { typeset_error (t, ip); return; }
  box b1= typeset_as_concat (env, t[0], descend (ip, 0));
  tree old_ds= env->local_begin (MATH_DISPLAY, "false");
  tree old_mc= env->local_begin (MATH_CONDENSED, "true");
  tree old_il= env->local_begin_script ();
  box b2= typeset_as_concat (env, t[1], descend (ip, 1));
  env->local_end_script (old_il);
  env->local_end (MATH_CONDENSED, old_mc);
  env->local_end (MATH_DISPLAY, old_ds);
  print (limit_box (ip, b1, b2, box (), env->fn, false));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_bigop ( tree  t,
path  ip 
) [private]

Definition at line 54 of file concat_math.cpp.

                                            {
  if ((N(t) == 1) && is_atomic (t[0])) {
    space spc= env->fn->spc;
    string l= t[0]->label;
    string s= "<big-" * l * ">";
    bool flag= (!env->math_condensed) && (l != ".");
    box b= big_operator_box (ip, s, env->fn, env->col,
                          env->display_style? 2: 1);
    print (STD_ITEM, OP_BIG, b);
    penalty_min (HYPH_PANIC);
    if ((l != "int") && (l != "oint")) with_limits (LIMITS_DISPLAY);
    if (flag) print (spc);
    // temporarary: use parameters from operator-big class in std-math.syx
  }
  else typeset_error (t, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_blue ( tree  t,
path  ip 
) [private]

Definition at line 20 of file concat_inactive.cpp.

                                           {
  tree old_mode= env->local_begin (MODE, "src");
  tree old_col = env->local_begin (COLOR, "blue");
  tree old_fam = env->local_begin (FONT_FAMILY, "ss");
  typeset (t, ip);
  env->local_end (FONT_FAMILY, old_fam);
  env->local_end (COLOR, old_col);
  env->local_end (MODE, old_mode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_canvas ( tree  t,
path  ip 
) [private]

Definition at line 256 of file concat_gui.cpp.

                                             {
  // IDEA: set left, right, bottom, top environment variables
  //       and allow doing computations with them
  if (N(t) != 7) { typeset_error (t, ip); return; }
  canvas_properties props= get_canvas_properties (env, t);
  box b= typeset_as_concat (env, t[6], descend (ip, 6));
  SI x1, y1, x2, y2, scx, scy;
  get_canvas_horizontal (props, b->x1, b->x2, x1, x2, scx);
  get_canvas_vertical (props, b->y1, b->y2, y1, y2, scy);
  string type= env->get_string (CANVAS_TYPE);
  path dip= (type == "plain"? ip: decorate (ip));
  box cb= clip_box (dip, b, x1, y1, x2, y2, props->xt, props->yt, scx, scy);
  if (type != "plain") cb= put_scroll_bars (props, cb, ip, b, scx, scy);
  print (cb);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_case ( tree  t,
path  ip 
) [private]

Definition at line 55 of file concat_active.cpp.

                                           {
  // This method must be kept consistent with edit_env_rep::exec(tree)
  // in ../Env/env_exec.cpp
  if (N(t)<2) {
    typeset_executable (t, ip);
    return;
  }
  marker (descend (ip, 0));
  int i, n= N(t);
  for (i=0; i<(n-1); i+=2) {
    tree tt= env->exec (t[i]);
    if (is_compound (tt) || !is_bool (tt->label)) {
      typeset_executable (t, ip);
      i=n;
    }
    else if (as_bool (tt->label)) {
      typeset (t[i+1], descend (ip, i+1));
      i=n;
    }
  }
  if (i<n) typeset (t[i], descend (ip, i));
  marker (descend (ip, 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_clipped ( tree  t,
path  ip 
) [private]

Definition at line 355 of file concat_text.cpp.

                                              {
  if (N(t) != 5) { typeset_error (t, ip); return; }
  box  b = typeset_as_concat (env, t[0], descend (ip, 0));
  tree old= env->local_begin_extents (b);
  SI   x1 = (t[1] == ""? b->x1: env->as_length (env->exec (t[1]), "w"));
  SI   y1 = (t[2] == ""? b->y1: env->as_length (env->exec (t[2]), "h"));
  SI   x2 = (t[3] == ""? b->x2: env->as_length (env->exec (t[3]), "w"));
  SI   y2 = (t[4] == ""? b->y2: env->as_length (env->exec (t[4]), "h"));
  env->local_end_extents (old);
  print (clip_box (ip, b, x1, y1, x2, y2));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_colored_substring ( string  s,
path  ip,
int  pos,
string  col 
) [private]

Definition at line 36 of file concat_text.cpp.

{
  color c= (col == ""? env->col: named_color (col));
  if (env->alpha != 255) {
    int r, g, b, a;
    get_rgb_color (c, r, g, b, a);
    c= rgb_color (r, g, b, env->alpha);
  }
  box b= text_box (ip, pos, s, env->fn, c);
  a << line_item (STRING_ITEM, OP_TEXT, b, HYPH_INVALID, env->lan);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_compound ( tree  t,
path  ip 
) [private]

Definition at line 68 of file concat_macro.cpp.

                                               {
  int d; tree f;
  if (L(t) == COMPOUND) {
    if (N(t) == 0) { typeset_error (t, ip); return; }
    d= 1;
    f= t[0];
    if (is_compound (f)) f= env->exec (f);
    if (is_atomic (f)) {
      string var= f->label;
      if (!env->provides (var)) {
       typeset_error (t, ip);
       return;
      }
      f= env->read (var);
    }
  }
  else {
    string var= as_string (L(t));
    if (!env->provides (var)) {
      typeset_error (t, ip);
      return;
    }
    d= 0;
    f= env->read (var);
  }

  if (is_applicable (f)) {
    int i, n=N(f)-1, m=N(t)-d;
    env->macro_arg= list<hashmap<string,tree> > (
      hashmap<string,tree> (UNINIT), env->macro_arg);
    env->macro_src= list<hashmap<string,path> > (
      hashmap<string,path> (path (DECORATION)), env->macro_src);
    if (L(f) == XMACRO) {
      if (is_atomic (f[0])) {
       string var= f[0]->label;
       env->macro_arg->item (var)= t;
       env->macro_src->item (var)= ip;
      }
    }
    else for (i=0; i<n; i++)
      if (is_atomic (f[i])) {
       string var= f[i]->label;
       env->macro_arg->item (var)=
         i<m? t[i+d]: attach_dip (tree (UNINIT), decorate_right(ip));
       env->macro_src->item (var)= i<m? descend (ip,i+d): decorate_right(ip);
      }
    if (is_decoration (ip))
      typeset (attach_here (f[n], ip));
    else {
      /*IF_NON_CHILD_ENFORCING(t)*/ marker (descend (ip, 0));
      typeset (attach_right (f[n], ip));
      /*IF_NON_CHILD_ENFORCING(t)*/ marker (descend (ip, 1));
    }
    env->macro_arg= env->macro_arg->next;
    env->macro_src= env->macro_src->next;
  }
  else {
    if (is_decoration (ip)) typeset (attach_here (f, ip));
    else {
      /*IF_NON_CHILD_ENFORCING(t)*/ marker (descend (ip, 0));
      typeset (attach_right (f, ip));
      /*IF_NON_CHILD_ENFORCING(t)*/ marker (descend (ip, 1));
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_concat ( tree  t,
path  ip 
) [private]

Definition at line 240 of file concat_text.cpp.

                                             {
  int i, n= N(t);
  for (i=0; i<n; i++)
    typeset (t[i], descend (ip, i));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_cspline ( tree  t,
path  ip 
) [private]

Definition at line 328 of file concat_graphics.cpp.

                                              {
  typeset_spline (t, ip, true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_decorated_box ( tree  t,
path  ip 
) [private]

Definition at line 440 of file concat_text.cpp.

                                                    {
  (void) t; (void) ip;
  int n= N (env->decorated_boxes);
  if ((n > 0) && (!is_nil (env->decorated_boxes [n-1]))) {
    print (env->decorated_boxes [n-1]);
    env->decorated_boxes [n-1]= box ();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_document ( tree  t,
path  ip 
) [private]

Definition at line 224 of file concat_text.cpp.

                                               {
  print (::typeset_as_stack (env, t, ip));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_drd_props ( tree  t,
path  ip 
) [private]

Definition at line 163 of file concat_macro.cpp.

                                                {
  (void) env->exec (t);
  flag ("drd-properties", ip, brown);
  control (t, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_dynamic ( tree  t,
path  ip 
) [private]

Definition at line 314 of file concat_macro.cpp.

                                              {
  // ATTENTION: in the future, the ip should still be passed to
  // this routine, since the typesetting depends on whether ip
  // is a decoration or not

  // cout << "Dynamic " << t << ", " << ip << "\n";
  if (is_decoration (ip)) {
    typeset (attach_here (t, ip));
    return;
  }

  marker (descend (ip, 0));
  // int start= N(a);
  typeset (attach_right (t, ip));
  // int end= N(a), i;

  /* Old style unaccessible text, using left and middle decorations
  SI total= 0, half= 0, mid;
  for (i=start; i<end; i++)
    total += a[i]->b->w();
  for (mid=start; mid<end; mid++) {
    half += a[mid]->b->w();
    if (half >= (total>>1)) break;
  }
  for (i=start; i<mid; i++)
    a[i]->b->relocate (decorate_left (ip));
  if (i<end) {
    if (a[i]->b->decoration ())
      if ((a[i]->type==STD_ITEM) ||
          (a[i]->type == MARKER_ITEM) ||
         (a[i]->type==STRING_ITEM))
       a[i]->b= macro_box (decorate_right (ip), a[i]->b);
    a[i]->b->relocate (decorate_middle (ip));
    i++;
  }
  */

  marker (descend (ip, 1));

  /*
  for (i=start-1; i<end+1; i++)
    cout << i << ": " << a[i]->b
        << ", " << a[i]->b->find_lip ()
        << ", " << a[i]->b->find_rip () << "\n";
  */

  /*
  for (i=start; i<end; i++)
    cout << i << ": " << a[i]->b << ", " << a[i]->b->ip << "\n";
  */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_error ( tree  t,
path  ip 
) [private]

Definition at line 206 of file concat_inactive.cpp.

                                            {
  tree m (MACRO, "x", tree (REWRITE_INACTIVE, tree (ARG, "x"), "error"));
  marker (descend (ip, 0));
  typeset_auto (attach_right (t, ip), m);
  marker (descend (ip, 1));
}

Here is the call graph for this function:

void concater_rep::typeset_eval ( tree  t,
path  ip 
) [private]

Definition at line 170 of file concat_macro.cpp.

                                           {
  if (N(t) != 1) { typeset_error (t, ip); return; }
  tree r= env->exec (t[0]);
  typeset_dynamic (r, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_eval_args ( tree  t,
path  ip 
) [private]

Definition at line 248 of file concat_macro.cpp.

                                                { 
  if (N(t) != 1) { typeset_error (t, ip); return; }
  marker (descend (ip, 0));
  typeset_inactive (attach_right (env->exec (t), ip));
  marker (descend (ip, 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_executable ( tree  t,
path  ip 
) [private]

Definition at line 302 of file concat_macro.cpp.

                                                 {
  tree r= env->exec (t);
  typeset_dynamic (r, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_expand_as ( tree  t,
path  ip 
) [private]

Definition at line 293 of file concat_macro.cpp.

                                                {
  // cout << "Mark: " << t << ", " << ip << "\n\n";
  if (N(t) != 2) { typeset_error (t, ip); return; }
  marker (descend (ip, 0));
  typeset (t[1], descend (ip, 1));
  marker (descend (ip, 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_fill ( tree  t,
path  ip 
) [private]

Definition at line 333 of file concat_graphics.cpp.

                                           {
  (void) t; (void) ip;
  print (test_box (ip));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_flag ( tree  t,
path  ip 
) [private]

Definition at line 231 of file concat_active.cpp.

                                           {
  if (N(t) != 2 && N(t) != 3) { typeset_error (t, ip); return; }
  string name= env->exec_string (t[0]);
  string col = env->exec_string (t[1]);
  path sip= ip;
  if ((N(t) >= 3) && (!is_nil (env->macro_src))) {
    string var= env->exec_string (t[2]);
    sip= env->macro_src->item [var];
  }
  if (((N(t) == 2) || is_accessible (sip)) && (!env->read_only)) {
    marker (descend (ip, 0));
    flag_ok (name, ip, named_color (col));
    marker (descend (ip, 1));  
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_float ( tree  t,
path  ip 
) [private]

Definition at line 372 of file concat_text.cpp.

                                            {
  if (N(t) != 3) { typeset_error (t, ip); return; }
  tree t1= env->exec (t[0]);
  tree t2= env->exec (t[1]);
  tree ch= tuple (t1, t2);
  lazy lz= make_lazy_vstream (env, t[2], descend (ip, 2), ch);
  marker (descend (ip, 0));
  if (is_accessible (ip) && !env->read_only)
    flag_ok (as_string (t1), decorate_middle (ip), brown);
  print (FLOAT_ITEM, OP_SKIP, control_box (decorate_middle (ip), lz, env->fn));
  marker (descend (ip, 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_formatting ( tree  t,
path  ip,
string  var 
) [private]

Definition at line 403 of file concat_text.cpp.

                                                           {
  if (N(t) == 0) { typeset_error (t, ip); return; }
  if (rigid && v == ATOM_DECORATIONS) {
    int k, n=N(t);
    box b= typeset_as_concat (env, t[n-1], descend (ip, n-1));
    tree e (DBOX);
    for (k=n-2; k>=0; k--)
      if (is_func (t[k], MACRO, 2))
        e= tree (COMPOUND, t[k], e);
    if (e != tree (DBOX)) {
      env->decorated_boxes << b;
      box bb= typeset_as_concat (env, attach_middle (e, ip));
      env->decorated_boxes->resize (N (env->decorated_boxes) - 1);
      b= bb;
    }
    marker (descend (ip, 0));
    print (b);
    marker (descend (ip, 1));
  }
  else {
    int n= N(t);
    tree new_format= env->read (v) * t (0, n-1);
    tree old_format= env->local_begin (v, new_format);
    if (v != CELL_FORMAT) {
      marker (descend (ip, 0));
      control (t (0, N(t)-1), decorate (ip));
    }
    typeset (t[n-1], descend (ip, n-1));
    if (v != CELL_FORMAT) {
      control (tree (L(t)), decorate (ip));
      marker (descend (ip, 1));
    }
    env->local_end (v, old_format);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_frac ( tree  t,
path  ip 
) [private]

Definition at line 222 of file concat_math.cpp.

                                           {
  if (N(t) != 2) { typeset_error (t, ip); return; }
  bool disp= env->display_style;
  tree old;
  if (disp) old= env->local_begin (MATH_DISPLAY, "false");
  else old= env->local_begin_script ();
  tree old_vp= env->local_begin (MATH_VPOS, "1");
  box nom= typeset_as_concat (env, t[0], descend (ip, 0));
  env->local_end (MATH_VPOS, "-1");
  box den= typeset_as_concat (env, t[1], descend (ip, 1));
  env->local_end (MATH_VPOS, old_vp);
  font sfn= env->fn;
  if (disp) env->local_end (MATH_DISPLAY, old);
  else env->local_end_script (old);
  print (frac_box (ip, nom, den, env->fn, sfn, env->col));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_gr_group ( tree  t,
path  ip 
) [private]

Definition at line 108 of file concat_graphics.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_gr_linear_transform ( tree  t,
path  ip 
) [private]

Definition at line 131 of file concat_graphics.cpp.

                                                          {
  if (N(t) != 2 || !is_tuple (t[1])) { typeset_error (t, ip); }
  frame f= affine_2D (as_matrix<double> (t[1]));
  box   b= typeset_as_concat (env, t[0], descend (ip, 0));
        /* The call should be performed with 'typeset_as_atomic()',
          but we should re-test transform() under these circumstances.
         */
  print (b->transform (env->fr * (f * invert (env->fr))));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_graphical ( array< box > &  bs,
tree  t,
path  ip 
) [private]

Definition at line 400 of file concat_graphics.cpp.

                                                                {
  int i, n= N(t);
  set_graphical_values (t);

  for (i=0; i<n; i++)
    if (the_drd->get_type (t[i]) == TYPE_CONSTRAINT) {
      tree u= t[i];
      switch (L(u)) {
      case IS_EQUAL:
        if (has_graphical_value (u[1]))
          set_graphical_value (u[0], get_graphical_value (u[1]));
        break;
      case IS_INTERSECTION:
       cout << "Not yet implemented 'is-intersection'\n";
        break;
      case ON_CURVE:
       cout << "Not yet implemented 'on-curve'\n";
        break;
      case ON_TEXT_BORDER:
       cout << "Not yet implemented 'on-text-border'\n";
        break;
      case ON_GRID:
       cout << "Not yet implemented 'on-grid'\n";
        break;
      default:
        break;
      }
    }

  for (i=0; i<n; i++)
    if (the_drd->get_type (t[i]) != TYPE_CONSTRAINT && !is_atomic (t[i]))
      bs << typeset_as_atomic (env, t[i], descend (ip, i));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_graphics ( tree  t,
path  ip 
) [private]

Definition at line 71 of file concat_graphics.cpp.

                                               {
BEGIN_MAGNIFY
  grid gr= as_grid (env->read (GR_GRID));
  array<box> bs;
  gr->set_aspect (env->read (GR_GRID_ASPECT));
  bs << grid_box (ip, gr, env->fr, env->as_length ("2ln"),
                  env->clip_lim1, env->clip_lim2);
  typeset_graphical (bs, t, ip);

  point lim1= env->clip_lim1;
  point lim2= env->clip_lim2;
  if (env->get_bool (GR_AUTO_CROP)) {
    SI x1= MAX_SI, y1= MAX_SI, x2= -MAX_SI, y2= -MAX_SI;
    for (int i=1; i<N(bs); i++) {
      box b= bs[i];
      //cout << i << ", " << b << ", " << b->get_type () << "\n";
      x1= min (x1, b->x1); y1= min (y1, b->y1);
      x2= max (x2, b->x2); y2= max (y2, b->y2);
      x1= min (x1, b->x3); y1= min (y1, b->y3);
      x2= max (x2, b->x4); y2= max (y2, b->y4);
    }
    SI pad= env->get_length (GR_CROP_PADDING);
    lim1= env->fr [point (x1 - pad, y1 - pad)];
    lim2= env->fr [point (x2 + pad, y2 + pad)];
    //cout << lim1 << " -- " << lim2 << "\n";
  }

  gr= as_grid (env->read (GR_EDIT_GRID));
  gr->set_aspect (env->read (GR_EDIT_GRID_ASPECT));
  box b= graphics_box (ip, bs, env->fr, gr, lim1, lim2);
  print (b);

  notify_graphics_extents (t, lim1, lim2);
END_MAGNIFY
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_hspace ( tree  t,
path  ip 
) [private]

Definition at line 292 of file concat_text.cpp.

                                             {
  if (N(t) != 1 && N(t) != 3) { typeset_error (t, ip); return; }
  if (N(a)==0) print (empty_box (ip, 0, 0, 0, env->fn->yx));
  if (N(t)==1) print (env->as_hspace (t[0]));
  else print (space (env->as_length (t[0]),
                     env->as_length (t[1]),
                     env->as_length (t[2])));
  control (t, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_if ( tree  t,
path  ip 
) [private]

Definition at line 25 of file concat_active.cpp.

                                         {
  // This method must be kept consistent with edit_env_rep::exec(tree)
  // in ../Env/env_exec.cpp
  if ((N(t)!=2) && (N(t)!=3)) {
    typeset_executable (t, ip);
    return;
  }
  tree tt= env->exec (t[0]);
  if (is_compound (tt) || ! is_bool (tt->label)) {
    typeset_executable (t, ip);
    return;
  }
  marker (descend (ip, 0));
  if (as_bool (tt->label)) typeset (t[1], descend (ip, 1));
  else if (N(t) == 3) typeset (t[2], descend (ip, 2));
  marker (descend (ip, 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_image ( tree  t,
path  ip 
) [private]

Definition at line 257 of file concat_active.cpp.

                                            {
  // determine the image url
  if (N(t) != 5) error_image ("parameters");
  tree image_tree= env->exec (t[0]);
  url image= url_none ();
  if (is_atomic (image_tree)) {
    if (N (image_tree->label) == 0)
      error_image (tree (WITH, "color", "red", "no image"));
    url im= image_tree->label;
    image= resolve (relative (env->base_file_name, im));
    if (is_none (image)) image= "$TEXMACS_PATH/misc/pixmaps/unknown.ps";
  }
  else if (is_func (image_tree, TUPLE, 2) &&
            is_func (image_tree[0], RAW_DATA, 1) &&
            is_atomic (image_tree[0][0]) && is_atomic (image_tree[1])) {
    image= url_ramdisc (image_tree[0][0]->label) *
           url ("image." * image_tree[1]->label);
  }
  else error_image (image_tree);

  // determine the original size of the image
  int iw, ih;
  image_size (image, iw, ih);
  double pt= ((double) env->dpi*PIXEL) / 72.0;
  SI w= (SI) (((double) iw) * pt);
  SI h= (SI) (((double) ih) * pt);

  // determine the width and the height
  tree old_w= env->local_begin ("w-length", as_string (w) * "tmpt");
  tree old_h= env->local_begin ("h-length", as_string (h) * "tmpt");
  SI imw= (t[1] == ""? w: env->as_length (env->exec (t[1]), "w"));
  SI imh= (t[2] == ""? h: env->as_length (env->exec (t[2]), "h"));
  if (t[1] == "" && t[2] != "" && ih != 0)
    imw= (SI) ((iw * ((double) imh)) / ih);
  if (t[1] != "" && t[2] == "" && iw != 0)
    imh= (SI) ((ih * ((double) imw)) / iw);
  if (imw <= 0 || imh <= 0)
    error_image (tree (WITH, "color", "red", "null box"));
  env->local_end ("w-length", old_w);
  env->local_end ("h-length", old_h);
  
  // determine the offset
  old_w= env->local_begin ("w-length", as_string (imw) * "tmpt");
  old_h= env->local_begin ("h-length", as_string (imh) * "tmpt");
  SI imx= (t[3] == ""? 0: env->as_length (env->exec (t[3]), "w"));
  SI imy= (t[4] == ""? 0: env->as_length (env->exec (t[4]), "h"));
  env->local_end ("w-length", old_w);
  env->local_end ("h-length", old_h);
  
  // print the box
  box imb= image_box (ip, image, imw, imh, env->alpha);
  print (move_box (ip, imb, imx, imy, true));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_inactive ( tree  t,
path  ip 
) [private]

Definition at line 200 of file concat_inactive.cpp.

                                               {
  tree m (MACRO, "x", tree (REWRITE_INACTIVE, tree (ARG, "x"), "once"));
  typeset_auto (t, ip, m);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_include ( tree  t,
path  ip 
) [private]

Definition at line 149 of file concat_macro.cpp.

                                              {
  if (N(t) != 1) { typeset_error (t, ip); return; }
  url file_name= as_string (t[0]);
  url incl_file= relative (env->base_file_name, file_name);
  tree incl= load_inclusion (incl_file);
  url save_name= env->cur_file_name;
  env->cur_file_name= incl_file;
  env->secure= is_secure (env->cur_file_name);
  typeset_dynamic (incl, ip);
  env->cur_file_name= save_name;
  env->secure= is_secure (env->cur_file_name);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_large ( tree  t,
path  ip,
int  type,
int  op_type,
string  prefix 
) [private]

Definition at line 20 of file concat_math.cpp.

                                                                            {
  if ((N(t) == 1) && is_atomic (t[0])) {
    string s= prefix * t[0]->label * ">";
    box b= text_box (ip, 0, s, env->fn, env->col);
    print (tp, otp, b);
    // temporarary: use parameters from group-open class in std-math.syx
    // bug: allow hyphenation after ) and before *
  }
  else if ((N(t) == 2) && is_atomic (t[0]) && is_int (t[1])) {
    string s= prefix * t[0]->label * "-" * t[1]->label * ">";
    box b= text_box (ip, 0, s, env->fn, env->col);
    SI dy= env->fn->yfrac - ((b->y1 + b->y2) >> 1);
    box mvb= move_box (ip, b, 0, dy, false, true);
    print (STD_ITEM, otp, macro_box (ip, mvb, env->fn));
  }
  else if ((N(t) >= 2) && is_atomic (t[0])) {
    SI y1, y2;
    if (N(t) == 2) {
      SI l= env->as_length (t[1]) >> 1;
      y1= env->fn->yfrac - l;
      y2= env->fn->yfrac + l;
    }
    else {
      y1= env->as_length (t[1]);
      y2= env->as_length (t[2]);
    }
    string s= prefix * t[0]->label * ">";
    box b= delimiter_box (ip, s, env->fn, env->col, y1, y2);
    print (STD_ITEM, otp, b);
  }
  else typeset_error (t, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_line ( tree  t,
path  ip,
bool  close 
) [private]

Definition at line 241 of file concat_graphics.cpp.

                                                       {
BEGIN_MAGNIFY
  int i, n= N(t);
  array<point> a(n);
  for (i=0; i<n; i++)
    a[i]= env->as_point (env->exec (t[i]));
  array<path> cip(n);
  for (i=0; i<n; i++)
    cip[i]= descend (ip, i);
  if (close) {
    a << copy (a[0]);
    cip << cip[0];
  }
  if (N(a) == 0 || N(a[0]) == 0) typeset_error (t, ip);
  else {
    if (N(a) == 1) {
      a << copy (a[0]);
      cip << cip[0];
    }
    curve c= env->fr (poly_segment (a, cip));
    print (curve_box (ip, c, env->lw, env->col,
                      env->dash_style, env->dash_style_unit,
                      env->fill_mode, env->fill_color,
                      typeset_line_arrows (ip)));
  }
END_MAGNIFY
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 227 of file concat_graphics.cpp.

                                          {
  array<box> bs (2);
  if (env->line_arrows[0] != "") {
    tree a= protect_arrow (env, env->line_arrows[0]);
    bs[0]= typeset_as_concat (env, a, decorate (ip));
  }
  if (env->line_arrows[1] != "") {
    tree a= protect_arrow (env, env->line_arrows[1]);
    bs[1]= typeset_as_concat (env, a, decorate (ip));
  }
  return bs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_locus ( tree  t,
path  ip 
) [private]

Definition at line 150 of file concat_active.cpp.

                                            {
  string ref;
  string anchor;

  if (N(t) == 0) { typeset_error (t, ip); return; }
  int last= N(t)-1;
  list<string> ids;
  string col;
  if (build_locus (env, t, ids, col, ref, anchor)) {
    marker (descend (ip, 0));
    tree old= env->local_begin (COLOR, col);
    typeset (t[last], descend (ip, last));
    env->local_end (COLOR, old);
    marker (descend (ip, 1));
  }
  else {
    tree old= env->local_begin (COLOR, col);
    box b= typeset_as_concat (env, t[last], descend (ip, last));
    env->local_end (COLOR, old);
    print (locus_box (ip, b, ids, env->get_int (SFACTOR) * PIXEL, ref, anchor));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_long_arrow ( tree  t,
path  ip 
) [private]

Definition at line 125 of file concat_math.cpp.

                                                 {
  if (N(t) != 2 && N(t) != 3) { typeset_error (t, ip); return; }
  tree old_ds= env->local_begin (MATH_DISPLAY, "false");
  tree old_mc= env->local_begin (MATH_CONDENSED, "true");
  tree old_il= env->local_begin_script ();
  box sup_b, sub_b;
  if (N(t) >= 2) {
    tree old_vp= env->local_begin (MATH_VPOS, "-1");
    sup_b= typeset_as_concat (env, t[1], descend (ip, 1));
    env->local_end (MATH_VPOS, old_vp);
  }
  if (N(t) >= 3) {
    tree old_vp= env->local_begin (MATH_VPOS, "1");
    sub_b= typeset_as_concat (env, t[2], descend (ip, 2));
    env->local_end (MATH_VPOS, old_vp);
  }
  env->local_end_script (old_il);
  env->local_end (MATH_CONDENSED, old_mc);
  env->local_end (MATH_DISPLAY, old_ds);

  string s= as_string (t[0]);
  SI w= sup_b->w();
  if (N(t) == 3) w= max (w, sub_b->w());
  w += env->fn->wquad;
  box arrow= wide_box (decorate (descend (ip, 0)), s, env->fn, env->col, w);

  space spc= env->fn->spc;
  if (env->math_condensed) spc= space (spc->min>>3, spc->def>>3, spc->max>>2);
  else spc= space (spc->min>>1, spc->def>>1, spc->max);
  print (spc);
  print (limit_box (ip, arrow, sub_b, sup_b, env->fn, false));
  print (spc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_lprime ( tree  t,
path  ip 
) [private]

Definition at line 72 of file concat_math.cpp.

                                             {
  if ((N(t) == 1) && is_atomic (t[0])) {
    string s= t[0]->label;
    bool flag= (env->fn->type == FONT_TYPE_UNICODE);
    if (flag)
      for (int i=0; i<N(s); i++)
       flag= flag && (s[i] == '\'' || s[i] == '`');
    tree old_il;
    if (!flag) old_il= env->local_begin_script ();
    path sip= descend (ip, 0);
    box b1, b2;
    b2= typeset_as_concat (env, t[0], sip);
    b2= symbol_box (sip, b2, N(t[0]->label));
    b2= move_box (sip, b2,
                flag? 0: env->as_length (string ("-0.05fn")),
                flag? env->as_length ("-0.75ex"): 0);
    if (!flag) env->local_end_script (old_il);
    print (LSUP_ITEM, OP_SKIP, script_box (ip, b1, b2, env->fn));
    penalty_max (HYPH_INVALID);
  }
  else typeset_error (t, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_mark ( tree  t,
path  ip 
) [private]

Definition at line 256 of file concat_macro.cpp.

                                           {
  // cout << "Mark: " << t << ", " << ip << "\n\n";
  if (N(t) != 2) { typeset_error (t, ip); return; }
  if (is_func (t[0], ARG) &&
      is_atomic (t[0][0]) &&
      (!is_nil (env->macro_arg)) &&
      env->macro_arg->item->contains (t[0][0]->label))
    {
      string name = t[0][0]->label;
      tree   value= env->macro_arg->item [name];
      path   valip= decorate_right (ip);
      if (!is_func (value, BACKUP)) {
       path new_valip= env->macro_src->item [name];
       if (is_accessible (new_valip)) valip= new_valip;
      }
      // cout << "Src   " << name << "=\t " << valip << "\n";

      if (N(t[0]) > 1) {
       int i, n= N(t[0]);
       for (i=1; i<n; i++) {
         tree r= env->exec (t[0][i]);
         if (!is_int (r)) break;
         int nr= as_int (r);
         if ((!is_compound (value)) || (nr<0) || (nr>=N(value))) break;
         value= value[nr];
         valip= descend (valip, nr);
       }
      }

      marker (descend (valip, 0));
      typeset (t[1], descend (ip, 1));
      marker (descend (valip, right_index (value)));
    }
  else typeset (t[1], descend (ip, 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_math_at ( tree  t,
path  ip 
) [private]

Definition at line 172 of file concat_graphics.cpp.

                                              {
BEGIN_MAGNIFY
  if (N(t) != 2) typeset_error (t, ip);
  else {
    // FIXME: attaching ip to compound ("math", t[0]) is a bit hacky,
    // but it seems to work fine for the time being
    box    b     = typeset_as_concat (env, compound ("math", t[0]), ip);
    point  p     = env->fr (env->as_point (env->exec (t[1])));
    string halign= env->text_at_halign;
    string valign= env->text_at_valign;

    if (N(p) == 0)
      typeset_dynamic (tree (ERROR, "bad text-at"), ip);
    else {
      SI x= (SI) p[0], y= (SI) p[1], axis= (b->h() >> 1);
      if (halign == "left") x -= b->x1;
      else if (halign == "center") x -= ((b->x1 + b->x2) >> 1);
      else if (halign == "right") x -= b->x2;
      if (valign == "bottom") y -= b->y1;
      else if (valign == "axis") {
       axis= (env->fn->yx >> 1) - b->y1;
       y -= (env->fn->yx >> 1);
      }
      else if (valign == "center") y -= ((b->y1 + b->y2) >> 1);
      else if (valign == "top") y -= b->y2;
      print (text_at_box (ip, b, x, y, axis, env->fn->spc->def));
    }
  }
END_MAGNIFY
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_math_string ( tree  t,
path  ip,
int  start,
int  end 
) [private]

Definition at line 128 of file concat_text.cpp.

                                                                    {
  string s= t->label;
  int    start;
  space  spc= env->fn->spc;
  space  extra= env->fn->extra;
  bool   condensed= env->math_condensed;

  do {
    start= pos;
    text_property tp= env->lan->advance (t, pos);
    int k= N(a);
    while (k > 0 && a[k-1]->op_type == OP_SKIP) k--;
    int prev_op_type= (k == 0? OP_TEXT: a[k-1]->op_type);
    int succ_status= succession_status (prev_op_type, tp->op_type);
    //cout << "Succession [" << s (start, pos) << "] "
    //     << "(" << prev_op_type << ", " << tp->op_type << ")"
    //     << " -> " << succ_status << "\n";
    if ((succ_status & 1) != 0 && k > 0) a[k-1]->spc= space (0);
    bool spc_ok= (succ_status <= 1);
    if (pos > end) pos= end;
    if ((pos > start) && (s[start]==' ')) { // spaces
      if (start == 0) typeset_substring ("", ip, 0);
      penalty_max (HYPH_INVALID);
      //penalty_min (tp->pen_after);
      if (spc_ok) {
        PRINT_SPACE (tp->spc_before);
        PRINT_SPACE (tp->spc_after);
      }
      //if ((pos==end) || (s[pos]==' '))
      typeset_math_substring ("", ip, pos, OP_APPLY);
    }
    else { // strings
      penalty_max (tp->pen_before);
      if (spc_ok) {
        if (condensed) PRINT_CONDENSED_SPACE (tp->spc_before)
        else PRINT_SPACE (tp->spc_before)
      }
      if (pos > start && s[start] == '*' && env->info_level >= INFO_SHORT) {
        color c = rgb_color (160, 160, 255);
        box   tb= text_box (decorate (ip), 0, "<cdot>", env->fn, c);
        box   sb= specific_box (decorate (ip), tb, false, env->fn);
        box   mb= move_box (decorate (ip), sb, -tb->w()>>1, 0);
        box   rb= resize_box (decorate (ip), mb, 0, tb->y1, 0, tb->y2);
        a << line_item (STD_ITEM, OP_SKIP, rb, HYPH_INVALID);
      }
      typeset_math_substring (s (start, pos), ip, start, tp->op_type);
      penalty_min (tp->pen_after);
      if (tp->limits != LIMITS_NONE) with_limits (tp->limits);
      if (spc_ok) {
        if (condensed) PRINT_CONDENSED_SPACE (tp->spc_after)
        else PRINT_SPACE (tp->spc_after)
      }
    }
  } while (pos<end);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_math_substring ( string  s,
path  ip,
int  pos,
int  op_type 
) [private]

Definition at line 29 of file concat_text.cpp.

                                                                           {
  box b= text_box (ip, pos, s, env->fn, env->col);
  a << line_item (STRING_ITEM, otype, b, HYPH_INVALID, env->lan);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void concater_rep::typeset_move ( tree  t,
path  ip 
) [private]

Definition at line 320 of file concat_text.cpp.

                                           {
  if (N(t) != 3) { typeset_error (t, ip); return; }
  box  b  = typeset_as_concat (env, t[0], descend (ip, 0));
  tree old= env->local_begin_extents (b);
  SI   x  = (t[1] == ""? 0: env->as_length (env->exec (t[1]), "w"));
  SI   y  = (t[2] == ""? 0: env->as_length (env->exec (t[2]), "h"));
  env->local_end_extents (old);
  print (move_box (ip, b, x, y, true));
}

Here is the call graph for this function:

Here is the caller graph for this function: