Back to index

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

#include <env.hpp>

Inheritance diagram for edit_env_rep:
Inheritance graph
[legend]
Collaboration diagram for edit_env_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 edit_env_rep (drd_info &drd, url base_file_name, hashmap< string, tree > &local_ref, hashmap< string, tree > &global_ref, hashmap< string, tree > &local_aux, hashmap< string, tree > &global_aux)
void style_init_env ()
tree exec (tree t)
void exec_until (tree t, path p)
bool exec_until (tree t, path p, string var, int level)
string exec_string (tree t)
tree expand (tree t, bool search_accessible=false)
bool depends (tree t, string s, int level)
tree rewrite (tree t)
void monitored_write (string s, tree t)
void monitored_write_update (string s, tree t)
void write (string s, tree t)
void write_update (string s, tree t)
tree local_begin (string s, tree t)
void local_end (string s, tree t)
tree local_begin_script ()
void local_end_script (tree t)
void assign (string s, tree t)
bool provides (string s)
tree read (string s)
tree local_begin_extents (box b)
void local_end_extents (tree t)
void write_default_env ()
void write_env (hashmap< string, tree > user_env)
void monitored_patch_env (hashmap< string, tree > patch)
void patch_env (hashmap< string, tree > patch)
void read_env (hashmap< string, tree > &ret)
void local_start (hashmap< string, tree > &prev_back)
void local_update (hashmap< string, tree > &oldpat, hashmap< string, tree > &chg)
void local_end (hashmap< string, tree > &prev_back)
void update_page_pars ()
void get_page_pars (SI &w, SI &h, SI &ww, SI &hh, SI &odd, SI &even, SI &top, SI &bottom)
tree decode_arrow (tree t, string l, string h)
void update_font ()
void update_color ()
void update_mode ()
void update_info_level ()
void update_language ()
void update_geometry ()
void update_frame ()
void update_src_style ()
void update_src_special ()
void update_src_compact ()
void update_src_close ()
void update_dash_style ()
void update_line_arrows ()
void update ()
void update (string env_var)
bool is_length (string s)
bool is_anylen (tree t)
tree tmlen_plus (tree t1, tree t2)
tree tmlen_min (tree t1, tree t2)
tree tmlen_max (tree t1, tree t2)
tree tmlen_times (double sc, tree t)
tree tmlen_over (tree t1, tree t2)
double tmlen_div (tree t1, tree t2)
tree tmlen_mod (tree t1, tree t2)
void get_length_unit (string l, SI &un, string &un_str)
string add_lengths (string l1, string l2)
string multiply_length (double x, string l)
double divide_lengths (string l1, string l2)
tree as_tmlen (tree t)
SI as_length (tree t)
SI as_length (tree t, string perc)
space as_hspace (tree t)
space as_vspace (tree t)
point as_point (tree t)
bool get_bool (string var)
int get_int (string var)
double get_double (string var)
string get_string (string var)
SI get_length (string var)
space get_vspace (string var)
color get_color (string var)

Public Attributes

drd_infodrd
hashmap< string, pathsrc
list< hashmap< string, tree > > macro_arg
list< hashmap< string, path > > macro_src
array< boxdecorated_boxes
hashmap< string, int > & var_type
url base_file_name
url cur_file_name
bool secure
hashmap< string, tree > & local_ref
hashmap< string, tree > & global_ref
hashmap< string, tree > & local_aux
hashmap< string, tree > & global_aux
bool complete
bool read_only
link_repository link_env
int dpi
double inch
double magn
double mgfy
double flexibility
int mode
int mode_op
language lan
int hl_lan
font fn
int fn_size
int index_level
bool display_style
bool math_condensed
int vert_pos
int alpha
color col
SI lw
string point_style
bool preamble
int info_level
SI gw
SI gh
string gvalign
frame fr
point clip_lim1
point clip_lim2
int src_style
int src_special
int src_compact
int src_close
array< bool > dash_style
SI dash_style_unit
int fill_mode
color fill_color
array< treeline_arrows
string text_at_halign
string text_at_valign
int inactive_mode
tree recover_env
string page_type
bool page_landscape
bool page_automatic
int page_margin_mode
SI page_width
SI page_height
SI page_user_width
SI page_user_height
SI page_odd_margin
SI page_even_margin
SI page_right_margin
SI page_top_margin
SI page_bottom_margin
int ref_count

Private Member Functions

tree exec_formatting (tree t, string v)
void exec_until_formatting (tree t, path p, string v)
bool exec_until_formatting (tree t, path p, string var, int l, string v)
tree exec_table (tree t)
void exec_until_table (tree t, path p)
bool exec_until_table (tree t, path p, string var, int level)
tree exec_assign (tree t)
tree exec_with (tree t)
void exec_until_with (tree t, path p)
bool exec_until_with (tree t, path p, string var, int level)
tree exec_drd_props (tree t)
tree exec_compound (tree t)
void exec_until_compound (tree t, path p)
bool exec_until_compound (tree t, path p, string var, int level)
tree exec_provides (tree t)
tree exec_value (tree t)
tree exec_quote_value (tree t)
tree exec_arg (tree t)
bool exec_until_arg (tree t, path p, string var, int level)
tree exec_quote_arg (tree t)
tree exec_get_label (tree t)
tree exec_get_arity (tree t)
tree exec_eval_args (tree t)
bool exec_until_mark (tree t, path p, string var, int level)
bool exec_until_quasi (tree t, path p, string var, int level)
tree exec_quasiquoted (tree t)
tree exec_copy (tree t)
tree exec_if (tree t)
bool exec_until_if (tree t, path p, string var, int level)
tree exec_case (tree t)
bool exec_until_case (tree t, path p, string var, int level)
tree exec_while (tree t)
bool exec_until_while (tree t, path p, string var, int level)
tree exec_for_each (tree t)
tree exec_use_package (tree t)
tree exec_use_module (tree t)
tree exec_or (tree t)
tree exec_xor (tree t)
tree exec_and (tree t)
tree exec_not (tree t)
tree exec_plus_minus (tree t)
tree exec_min_max (tree t)
tree exec_times_over (tree t)
tree exec_divide (tree t)
tree exec_modulo (tree t)
tree exec_math_sqrt (tree t)
tree exec_exp (tree t)
tree exec_log (tree t)
tree exec_pow (tree t)
tree exec_cos (tree t)
tree exec_sin (tree t)
tree exec_tan (tree t)
tree exec_merge (tree t)
tree exec_length (tree t)
tree exec_range (tree t)
tree exec_number (tree t)
tree exec_date (tree t)
tree exec_translate (tree t)
tree exec_change_case (tree t, tree nc, bool exec_flag, bool first)
tree exec_change_case (tree t)
tree exec_find_file (tree t)
tree exec_is_tuple (tree t)
tree exec_lookup (tree t)
tree exec_equal (tree t)
tree exec_unequal (tree t)
tree exec_less (tree t)
tree exec_lesseq (tree t)
tree exec_greater (tree t)
tree exec_greatereq (tree t)
tree exec_cm_length ()
tree exec_mm_length ()
tree exec_in_length ()
tree exec_pt_length ()
tree exec_bp_length ()
tree exec_dd_length ()
tree exec_pc_length ()
tree exec_cc_length ()
tree exec_fs_length ()
tree exec_fbs_length ()
tree exec_em_length ()
tree exec_ln_length ()
tree exec_sep_length ()
tree exec_yfrac_length ()
tree exec_ex_length ()
tree exec_fn_length ()
tree exec_fns_length ()
tree exec_bls_length ()
tree exec_fnbot_length ()
tree exec_fntop_length ()
tree exec_spc_length ()
tree exec_xspc_length ()
tree exec_par_length ()
tree exec_pag_length ()
tree exec_tmpt_length ()
tree exec_px_length ()
tree exec_gw_length ()
tree exec_gh_length ()
tree exec_msec_length ()
tree exec_sec_length ()
tree exec_min_length ()
tree exec_hr_length ()
tree exec_hard_id (tree t)
tree exec_script (tree t)
tree exec_set_binding (tree t)
tree exec_get_binding (tree t)
tree exec_pattern (tree t)
tree exec_point (tree t)
tree exec_box_info (tree t)
tree exec_frame_direct (tree t)
tree exec_frame_inverse (tree t)
tree exec_rewrite (tree t)
bool exec_until_rewrite (tree t, path p, string var, int level)
tree rewrite_inactive_arg (tree t, tree var, int i, bool bl, bool fl)
tree rewrite_inactive_raw_data (tree t, tree var, bool block, bool flush)
tree rewrite_inactive_document (tree t, tree var, bool block, bool flush)
tree rewrite_inactive_concat (tree t, tree var, bool block, bool flush)
tree rewrite_inactive_value (tree t, tree var, bool block, bool flush)
tree rewrite_inactive_arg (tree t, tree var, bool block, bool flush)
tree rewrite_inactive_style_with (tree t, tree var, bool b, bool f, bool o)
tree rewrite_inactive_active (tree t, tree var, bool block, bool flush)
tree rewrite_inactive_var_active (tree t, tree var, bool block, bool flush)
tree rewrite_inactive_symbol (tree t, tree var, bool block, bool flush)
tree rewrite_inactive_hybrid (tree t, tree var, bool block, bool flush)
tree rewrite_inactive_default (tree t, tree var, bool block, bool flush)
tree rewrite_inactive (tree t, tree var, bool block, bool flush)
tree rewrite_inactive (tree t, tree var)

Private Attributes

hashmap< string, treeenv
hashmap< string, treeback

Friends

class edit_env
tm_ostreamoperator<< (tm_ostream &out, edit_env env)

Detailed Description

Definition at line 119 of file env.hpp.


Constructor & Destructor Documentation

edit_env_rep::edit_env_rep ( drd_info drd,
url  base_file_name,
hashmap< string, tree > &  local_ref,
hashmap< string, tree > &  global_ref,
hashmap< string, tree > &  local_aux,
hashmap< string, tree > &  global_aux 
)

Definition at line 24 of file env.cpp.

                                                           :
  drd (drd2),
  env (UNINIT), back (UNINIT), src (path (DECORATION)),
  var_type (default_var_type),
  base_file_name (base_file_name2),
  cur_file_name (base_file_name2),
  secure (is_secure (base_file_name2)),
  local_ref (local_ref2), global_ref (global_ref2),
  local_aux (local_aux2), global_aux (global_aux2)
{
  initialize_default_env ();
  initialize_default_var_type ();
  env= copy (default_env);
  style_init_env ();
  update ();
  complete= false;
  recover_env= tuple ();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 119 of file env_length.cpp.

                                               {
  SI l1= as_length (s1);
  SI l2= as_length (s2);
  SI un; string un_str;
  get_length_unit (s1, un, un_str);
  if (un==0) return "0tmpt";
  double x= ((double) (l1+l2)) / ((double) un);
  return as_string (x) * un_str;
}

Here is the call graph for this function:

Definition at line 204 of file env_length.cpp.

                               {
  tree r= as_tmlen (t);
  if (N(r) == 1)
    return space ((SI) (as_double (r[0]->label)));
  else if (N(r) < 3)
    return 0;
  else {
    SI _min= (SI) as_double (r[0]->label);
    SI _def= (SI) as_double (r[1]->label);
    SI _max= (SI) as_double (r[2]->label);
    return space (_min, _def, _max);
  }
}

Here is the call graph for this function:

Definition at line 184 of file env_length.cpp.

                               {
  tree r= as_tmlen (t);
  if (N(r) < 1) return 0;
  string s= r[N(r)==1? 0: 1]->label;
  return (SI) (as_double (s));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 192 of file env_length.cpp.

                                            {
  if (is_atomic (t) && N(t->label) > 0 && t->label [N(t->label) - 1] == '%')
    return as_length (t->label (0, N(t->label) - 1) * perc) / 100;
  else {
    tree r= as_tmlen (t);
    if (N(r) < 1) return 0;
    string s= r[N(r)==1? 0: 1]->label;
    return (SI) (as_double (s));
  }
}

Here is the call graph for this function:

Definition at line 236 of file env_length.cpp.

                              {
  if ((is_tuple (t) || is_point (t)) && ((N(t)==0) || is_double (t[0])))
    return ::as_point (t);
  if (is_tuple (t) || is_point (t)) {
    int i, n= N(t);
    point p(n);
    for (i=0; i<n; i++)
      p[i]= as_length (t[i]);
    return fr[p];
  }
  if (is_func (t, WITH)) {
    for (int i=0; i<N(t)-1; i+=2) {
      tree var= t[i+1];
      if (is_func (var, QUOTE, 1)) var= var[0];
      if (t[i] == GID && has_graphical_value (var)) {
        tree old_t= t[N(t)-1];
        tree new_t= get_graphical_value (var);
        if (new_t != old_t) {
          point old_p= as_point (old_t);
          point new_p= as_point (new_t);
          if (new_p != old_p) {
            graphics_require_update (var);
            return old_p;//return new_p;
          }
        }
      }
    }
    return as_point (t[N(t)-1]);
  }
  return point ();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 151 of file env_length.cpp.

                              {
  if (is_func (t, TMLEN)) {
    if (N(t) == 0) return t;
    if (is_double (t[0])) return t;
    if (N(t) < 3) return as_tmlen (t[0]);
    tree _min= as_tmlen (t[0]);
    tree _def= as_tmlen (t[1]);
    tree _max= as_tmlen (t[2]);
    if (N(_min) < 1) return t;
    if (N(_def) < 1) return t;
    if (N(_max) < 1) return t;
    _min= _min[N(_min) == 3? 1: 0];
    _def= _def[N(_def) == 3? 1: 0];
    _max= _max[N(_max) == 3? 1: 0];
    return tree (TMLEN, _min, _def, _max);
  }
  else if (is_atomic (t)) {
    string s= t->label;
    int start= 0, i, n=N(s);
    while ((start+1<n) && (s[start]=='-') && (s[start+1]=='-')) start += 2;
    for (i=start; (i<n) && ((s[i]<'a') || (s[i]>'z')); i++) {}
    string s1= s (start, i);
    string s2= s (i, n);
    if (!(is_double (s1) && is_locase_alpha (s2))) return tree (TMLEN, "0");
    return tmlen_times (as_double (s1),
                     as_tmlen (exec (compound (s2 * "-length"))));
  }
  else if (is_func (t, MACRO, 1))
    return as_tmlen (exec (t[0]));
  else return tree (TMLEN, "0");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 219 of file env_length.cpp.

                               {
  tree r= as_tmlen (t);
  if (N(r) == 1)
    return space ((SI) (as_double (r[0]->label)));
  else if (N(r) < 3)
    return 0;
  else {
    SI _min= (SI) as_double (r[0]->label);
    SI _def= (SI) as_double (r[1]->label);
    SI _max= (SI) as_double (r[2]->label);
    return space (_def + ((SI) (flexibility * (_min - _def))),
                _def,
                _def + ((SI) (flexibility * (_max - _def))));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void edit_env_rep::assign ( string  s,
tree  t 
) [inline]

Definition at line 366 of file env.hpp.

                                        {
    tree& val= env (s); t= exec(t); if (val != t) {
      back->write_back (s, env); val= t; update (s); } }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 453 of file env_semantics.cpp.

                                                      {
  if (is_string (t)) {
    string s= t->label;
    if (s == "" || s == "none") return "";
    double lx, hx;
    string lun, hun;
    decompose_length (l, lx, lun);
    decompose_length (h, hx, hun);
    if (s == "<less>")
      return tree (LINE,
                   tree (_POINT, l, h),
                   tree (_POINT, "0" * lun, "0" * hun),
                   tree (_POINT, l, as_string (-hx) * hun));
    if (s == "<gtr>")
      return tree (LINE,
                   tree (_POINT, as_string (-lx) * lun, h),
                   tree (_POINT, "0" * lun, "0" * hun),
                   tree (_POINT, as_string (-lx) * lun,
                                 as_string (-hx) * hun));
    if (s == "<less>|")
      return tree (WITH, FILL_COLOR, tree (VALUE, COLOR),
                   LINE_WIDTH, "0ln",
                   tree (CLINE,
                         tree (_POINT, l, h),
                         tree (_POINT, "0" * lun, "0" * hun),
                         tree (_POINT, l, as_string (-hx) * hun)));
    if (s == "|<gtr>")
      return tree (WITH, FILL_COLOR, tree (VALUE, COLOR),
                   LINE_WIDTH, "0ln",
                   tree (CLINE,
                         tree (_POINT, as_string (-lx) * lun, h),
                         tree (_POINT, "0" * lun, "0" * hun),
                         tree (_POINT, as_string (-lx) * lun,
                               as_string (-hx) * hun)));
    if (s == "<gtr>")
      return tree (LINE,
                   tree (_POINT, as_string (-lx) * lun, h),
                   tree (_POINT, "0" * lun, "0" * hun),
                   tree (_POINT, as_string (-lx) * lun,
                                 as_string (-hx) * hun));
    if (s == "<less><less>")
      return tree (GR_GROUP,
                   tree (LINE,
                         tree (_POINT, l, h),
                         tree (_POINT, "0" * lun, "0" * hun),
                         tree (_POINT, l, as_string (-hx) * hun)),
                   tree (LINE,
                         tree (_POINT, as_string (0 * lx) * lun, h),
                         tree (_POINT, as_string (-lx) * lun, "0" * hun),
                         tree (_POINT, as_string (0 * lx) * lun,
                               as_string (-hx) * hun)));
    if (s == "<gtr><gtr>")
      return tree (GR_GROUP,
                   tree (LINE,
                         tree (_POINT, as_string (-lx) * lun, h),
                         tree (_POINT, "0" * lun, "0" * hun),
                         tree (_POINT, as_string (-lx) * lun,
                               as_string (-hx) * hun)),
                   tree (LINE,
                         tree (_POINT, as_string (0 * lx) * lun, h),
                         tree (_POINT, as_string (lx) * lun, "0" * hun),
                         tree (_POINT, as_string (0 * lx) * lun,
                               as_string (-hx) * hun)));                   
    if (s == "|")
      return tree (LINE,
                   tree (_POINT, "0" * lun, h),
                   tree (_POINT, "0" * lun, as_string (-hx) * hun));
    if (s == "o")
      return tree (WITH, FILL_COLOR, tree (VALUE, COLOR),
                   LINE_WIDTH, "0ln",
                   tree (CARC,
                         tree (_POINT, "0" * lun, h),
                         tree (_POINT, l, "0" * hun),
                         tree (_POINT, "0" * lun, as_string (-hx) * hun)));
    return "";
  }
  else return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool edit_env_rep::depends ( tree  t,
string  s,
int  level 
)

Definition at line 2293 of file env_exec.cpp.

                                                  {
  /*
  cout << "Depends? " << t << ", " << s << ", " << level
       << " " << macro_arg << "\n";
  */

  if (is_atomic (t) || is_nil (macro_arg)) return false;
  else if (is_func (t, ARG) ||
          is_func (t, QUOTE_ARG) ||
          is_func (t, MAP_ARGS) ||
          is_func (t, EVAL_ARGS))
    {
      // FIXME: this does not handle more complex dependencies,
      // like those encountered after rewritings (INCLUDE, EXTERN, etc.)
      tree v= (L(t) == MAP_ARGS? t[2]: t[0]);
      if (is_compound (v)) return false;
      if (!macro_arg->item->contains (v->label)) return false;
      if (level == 0) return v->label == s;
      tree r= macro_arg->item [v->label];
      list<hashmap<string,tree> > old_var= macro_arg;
      list<hashmap<string,path> > old_src= macro_src;
      if (!is_nil (macro_arg)) macro_arg= macro_arg->next;
      if (!is_nil (macro_src)) macro_src= macro_src->next;
      bool dep= depends (r, s, level-1);
      macro_arg= old_var;
      macro_src= old_src;
      return dep;
    }
  else {
    int i, n= N(t);
    for (i=0; i<n; i++)
      if (depends (t[i], s, level))
       return true;
    return false;
  }
}

Here is the call graph for this function:

double edit_env_rep::divide_lengths ( string  l1,
string  l2 
)

Definition at line 140 of file env_length.cpp.

                                                  {
  SI l1= as_length (s1);
  SI l2= as_length (s2);
  return ((double) l1) / ((double) l2);
}

Here is the call graph for this function:

Definition at line 170 of file env_exec.cpp.

                          {
  // cout << "Execute: " << t << "\n";
  if (is_atomic (t)) return t;
  switch (L(t)) {
  case DATOMS:
    return exec_formatting (t, ATOM_DECORATIONS);
  case DLINES:
    return exec_formatting (t, LINE_DECORATIONS);
  case DPAGES:
    return exec_formatting (t, PAGE_DECORATIONS);
  case TFORMAT:
    return exec_formatting (t, CELL_FORMAT);
  case TABLE:
    return exec_table (t);
  case ASSIGN:
    return exec_assign (t);
  case WITH:
    return exec_with (t);
  case PROVIDES:
    return exec_provides (t);
  case VALUE:
    return exec_value (t);
  case QUOTE_VALUE:
    return exec_quote_value (t);
  case MACRO:
    return copy (t);
  case DRD_PROPS:
    return exec_drd_props (t);
  case ARG:
    return exec_arg (t);
  case QUOTE_ARG:
    return exec_quote_arg (t);
  case COMPOUND:
    return exec_compound (t);
  case XMACRO:
    return copy (t);
  case GET_LABEL:
    return exec_get_label (t);
  case GET_ARITY:
    return exec_get_arity (t);
  case MAP_ARGS:
    return exec_rewrite (t);
  case EVAL_ARGS:
    return exec_eval_args (t);
  case MARK:
    if (N(t) < 2)
      return tree (ERROR, "invalid mark");
    return tree (MARK, copy (t[0]), exec (t[1]));
  case EXPAND_AS:
    if (N(t) < 2)
      return tree (ERROR, "invalid expand-as");
    return exec (t[1]);
  case EVAL:
    if (N(t) < 1)
      return tree (ERROR, "invalid eval");
    return exec (exec (t[0]));
  case QUOTE:
    if (N(t) < 1)
      return tree (ERROR, "invalid quote");
    return t[0];
  case QUASI:
    if (N(t) < 1)
      return tree (ERROR, "invalid quasi");
    return exec (exec_quasiquoted (t[0]));
  case QUASIQUOTE:
    if (N(t) < 1)
      return tree (ERROR, "invalid quasiquote");
    return exec_quasiquoted (t[0]);
  case UNQUOTE:
    if (N(t) < 1)
      return tree (ERROR, "invalid unquote");
    return exec (t[0]);
  case VAR_UNQUOTE:
    if (N(t) < 1)
      return tree (ERROR, "invalid var-unquote");
    return exec (t[0]);
  case COPY:
    if (N(t) < 1)
      return tree (ERROR, "invalid copy");
    return copy (exec (t[0]));
  case IF:
  case VAR_IF:
    return exec_if (t);
  case CASE:
    return exec_case (t);
  case WHILE:
    return exec_while (t);
  case FOR_EACH:
    return exec_for_each (t);
  case EXTERN:
    return exec_rewrite (t);
  case INCLUDE:
    return exec_rewrite (t);
  case USE_PACKAGE:
    return exec_use_package (t);
  case USE_MODULE:
    return exec_use_module (t);

  case OR:
    return exec_or (t);
  case XOR:
    return exec_xor (t);
  case AND:
    return exec_and (t);
  case NOT:
    return exec_not (t);
  case PLUS:
  case MINUS:
    return exec_plus_minus (t);
  case TIMES:
  case OVER:
    return exec_times_over (t);
  case DIV:
    return exec_divide (t);
  case MOD:
    return exec_modulo (t);
  case MINIMUM:
  case MAXIMUM:
    return exec_min_max (t);
  case MATH_SQRT:
    return exec_math_sqrt (t);
  case EXP:
    return exec_exp (t);
  case LOG:
    return exec_log (t);
  case POW:
    return exec_pow (t);
  case COS:
    return exec_cos (t);
  case SIN:
    return exec_sin (t);
  case TAN:
    return exec_tan (t);
  case MERGE:
    return exec_merge (t);
  case LENGTH:
    return exec_length (t);
  case RANGE:
    return exec_range (t);
  case NUMBER:
    return exec_number (t);
  case _DATE:
    return exec_date (t);
  case TRANSLATE:
    return exec_translate (t);
  case CHANGE_CASE:
    return exec_change_case (t);
  case FIND_FILE:
    return exec_find_file (t);
  case IS_TUPLE:
    return exec_is_tuple (t);
  case LOOK_UP:
    return exec_lookup (t);
  case EQUAL:
    return exec_equal (t);
  case UNEQUAL:
    return exec_unequal (t);
  case LESS:
    return exec_less (t);
  case LESSEQ:
    return exec_lesseq (t);
  case GREATER:
    return exec_greater (t);
  case GREATEREQ:
    return exec_greatereq (t);

  case CM_LENGTH:
    return exec_cm_length ();
  case MM_LENGTH:
    return exec_mm_length ();
  case IN_LENGTH:
    return exec_in_length ();
  case PT_LENGTH:
    return exec_pt_length ();
  case BP_LENGTH:
    return exec_bp_length ();
  case DD_LENGTH:
    return exec_dd_length ();
  case PC_LENGTH:
    return exec_pc_length ();
  case CC_LENGTH:
    return exec_cc_length ();
  case FS_LENGTH:
    return exec_fs_length ();
  case FBS_LENGTH:
    return exec_fbs_length ();
  case EM_LENGTH:
    return exec_em_length ();
  case LN_LENGTH:
    return exec_ln_length ();
  case SEP_LENGTH:
    return exec_sep_length ();
  case YFRAC_LENGTH:
    return exec_yfrac_length ();
  case EX_LENGTH:
    return exec_ex_length ();
  case FN_LENGTH:
    return exec_fn_length ();
  case FNS_LENGTH:
    return exec_fns_length ();
  case BLS_LENGTH:
    return exec_bls_length ();
  case FNBOT_LENGTH:
    return exec_fnbot_length ();
  case FNTOP_LENGTH:
    return exec_fntop_length ();
  case SPC_LENGTH:
    return exec_spc_length ();
  case XSPC_LENGTH:
    return exec_xspc_length ();
  case PAR_LENGTH:
    return exec_par_length ();
  case PAG_LENGTH:
    return exec_pag_length ();
  case GW_LENGTH:
    return exec_gw_length ();
  case GH_LENGTH:
    return exec_gh_length ();
  case TMPT_LENGTH:
    return exec_tmpt_length ();
  case PX_LENGTH:
    return exec_px_length ();
  case MSEC_LENGTH:
    return exec_msec_length ();
  case SEC_LENGTH:
    return exec_sec_length ();
  case MIN_LENGTH:
    return exec_min_length ();
  case HR_LENGTH:
    return exec_hr_length ();

  case STYLE_WITH:
  case VAR_STYLE_WITH:
    if (N(t) < 1)
      return tree (ERROR, "invalid style-with");
    return exec (t[N(t)-1]);
  case STYLE_ONLY:
  case VAR_STYLE_ONLY:
  case ACTIVE:
  case VAR_ACTIVE:
  case INACTIVE:
  case VAR_INACTIVE:
    return exec_compound (t);
  case REWRITE_INACTIVE:
    return exec_rewrite (t);

  case HARD_ID:
    return exec_hard_id (t);
  case SCRIPT:
    return exec_script (t);
  case HLINK:
  case ACTION:
    return exec_compound (t);
  case SET_BINDING:
    return exec_set_binding (t);
  case GET_BINDING:
    return exec_get_binding (t);

  case PATTERN:
    return exec_pattern (t);

  case _POINT:
    return exec_point (t);
  case BOX_INFO:
    return exec_box_info (t);
  case FRAME_DIRECT:
    return exec_frame_direct (t);
  case FRAME_INVERSE:
    return exec_frame_inverse (t);

  default:
    if (L(t) < START_EXTENSIONS) {
      int i, n= N(t);
      // cout << "Executing " << t << "\n";
      tree r (t, n);
      for (i=0; i<n; i++) r[i]= exec (t[i]);
      // cout << "Executed " << t << " -> " << r << "\n";
      return r;
    }
    else return exec_compound (t);
  }
}
tree edit_env_rep::exec_and ( tree  t) [private]

Definition at line 969 of file env_exec.cpp.

                              {
  if (N(t)<2) return tree (ERROR, "bad and");
  for (int i=0; i<N(t); i++) {
    tree ti= exec (t[i]);
    if (is_compound (ti)) return tree (ERROR, "bad and");
    if (! is_bool (ti->label)) return tree (ERROR, "bad and");
    if (! as_bool (ti->label)) return as_string_bool (false);
  }
  return as_string_bool (true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree edit_env_rep::exec_arg ( tree  t) [private]

Definition at line 712 of file env_exec.cpp.

                              {
  if (N(t)<1) return tree (ERROR, "bad arg");
  tree r= t[0];
  if (is_compound (r))
    return tree (ERROR, "bad arg");
  if (is_nil (macro_arg) || (!macro_arg->item->contains (r->label)))
    return tree (ERROR, "arg " * r->label);
  r= macro_arg->item [r->label];
  list<hashmap<string,tree> > old_var= macro_arg;
  list<hashmap<string,path> > old_src= macro_src;
  if (!is_nil (macro_arg)) macro_arg= macro_arg->next;
  if (!is_nil (macro_src)) macro_src= macro_src->next;
  bool err= false;
  if (N(t) > 1) {
    int i, n= N(t);
    for (i=1; i<n; i++) {
      tree u= exec (t[i]);
      if (!is_int (u)) { err= true; break; }
      int nr= as_int (u);
      if ((!is_compound (r)) || (nr<0) || (nr>=N(r))) { err= true; break; }
      r= r[nr];
    }
  }
  if (err) r= tree (ERROR, "arg " * r->label);
  else r= exec (r);
  macro_arg= old_var;
  macro_src= old_src;
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 483 of file env_exec.cpp.

                                 {
  if (N(t)!=2) return tree (ERROR, "bad assign");
  tree r= exec (t[0]);
  if (is_compound (r)) return tree (ERROR, "bad assign");
  assign (r->label, copy (t[1]));
  return tree (ASSIGN, r, tree (QUOTE, read (r->label)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 374 of file env_length.cpp.

                               {
  double fn=
    (get_int(FONT_BASE_SIZE) * magn * inch * get_double(FONT_SIZE)) / 72.0;
  return tmlen_plus (tree (TMLEN, as_string (fn)), get_vspace (PAR_SEP));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1675 of file env_exec.cpp.

                                   {
  if (N(t)<2) return tree (ERROR, "bad box-info");
  tree t1= t[0];
  tree t2= t[1];
  if (!is_string (t2))
    return tree (ERROR, "bad box info");
  return box_info (edit_env (this), t1, as_string (t2));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 326 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (inch/72.0)); }

Here is the call graph for this function:

Here is the caller graph for this function:

tree edit_env_rep::exec_case ( tree  t) [private]

Definition at line 842 of file env_exec.cpp.

                               {
  // This case must be kept consistent with
  // concater_rep::typeset_case(tree, path)
  // in ../Concat/concat_active.cpp
  if (N(t)<2) return tree (ERROR, "bad case");
  int i, n= N(t);
  for (i=0; i<(n-1); i+=2) {
    tree tt= exec (t[i]);
    if (is_compound (tt) || ! is_bool (tt->label))
      return tree (ERROR, "bad case");
    if (as_bool (tt->label)) return exec (t[i+1]);
  }
  if (i<n) return exec (t[i]);
  return "";
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 332 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (4.531*inch/25.4)); }

Here is the call graph for this function:

Here is the caller graph for this function:

tree edit_env_rep::exec_change_case ( tree  t,
tree  nc,
bool  exec_flag,
bool  first 
) [private]

Definition at line 1342 of file env_exec.cpp.

                                                                           {
  if (is_atomic (t)) {
    string s= t->label;
    tree   r= copy (s);
    int i, n= N(s);

    bool all= true;
    bool up = false;
    bool lo = false;
    if (nc == "Upcase") { all= false; up= true; }
    else if (nc == "UPCASE") { up= true; }
    else if (nc == "locase") { lo= true; }

    for (i=0; i<n; tm_char_forwards (s, i))
      if (is_iso_alpha (s[i]) && (all || (first && (i==0)))) {
       if (up && is_locase (s[i])) r->label[i]= upcase (s[i]);
       if (lo && is_upcase (s[i])) r->label[i]= locase (s[i]);
      }
    r->obs= list_observer (ip_observer (obtain_ip (t)), r->obs);
    return r;
  }
  else if (is_concat (t)) {
    int i, n= N(t);
    tree r (t, n);
    for (i=0; i<n; i++)
      r[i]= exec_change_case (t[i], nc, exec_flag, first && (i==0));
    r->obs= list_observer (ip_observer (obtain_ip (t)), r->obs);
    return r;
  }
  else {
    if (exec_flag) return t;
    else return exec_change_case (exec (t), nc, true, first);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1378 of file env_exec.cpp.

                                      {
  if (N(t) < 2) return tree (ERROR, "bad change case");
  return exec_change_case (t[0], exec (t[1]), false, true);
}

Here is the call graph for this function:

Definition at line 318 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (inch/2.54)); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 532 of file env_exec.cpp.

                                   {
  int d; tree f;
  if (L(t) == COMPOUND) {
    if (N(t)<1) return tree (ERROR, "bad compound");
    d= 1;
    f= t[0];
    if (is_compound (f)) f= exec (f);
    if (is_atomic (f)) {
      string var= f->label;
      if (!provides (var)) return tree (ERROR, "compound " * var);
      f= read (var);
    }
  }
  else {
    string var= as_string (L(t));
    if (!provides (var)) return tree (ERROR, "compound " * var);
    d= 0;
    f= read (var);
  }

  if (is_applicable (f)) {
    int i, n=N(f)-1, m=N(t)-d;
    macro_arg= list<hashmap<string,tree> > (
      hashmap<string,tree> (UNINIT), macro_arg);
    macro_src= list<hashmap<string,path> > (
      hashmap<string,path> (path (DECORATION)), macro_src);
    if (L(f) == XMACRO) {
      if (is_atomic (f[0]))
       macro_arg->item (f[0]->label)= t;
    }
    else for (i=0; i<n; i++)
      if (is_atomic (f[i])) {
       tree st= i<m? t[i+d]: tree (UNINIT);
       macro_arg->item (f[i]->label)= st;
       macro_src->item (f[i]->label)= obtain_ip (st);
      }
    tree r= exec (f[n]);
    macro_arg= macro_arg->next;
    macro_src= macro_src->next;
    return r;
  }
  else return exec (f);
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree edit_env_rep::exec_copy ( tree  t) [private]
tree edit_env_rep::exec_cos ( tree  t) [private]

Definition at line 1196 of file env_exec.cpp.

                              {
  if (N(t)!=1) return tree (ERROR, "bad cos");
  tree t1= exec (t[0]);
  if (is_double (t1))
    return as_tree (cos (as_double (t1)));
  return tree (ERROR, "bad cos");
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree edit_env_rep::exec_date ( tree  t) [private]

Definition at line 1313 of file env_exec.cpp.

                               {
  if (N(t)>2) return tree (ERROR, "bad date");
  string lan= get_string (LANGUAGE);
  if (N(t) == 2) {
    tree u= exec (t[1]);
    if (is_compound (u)) return tree (ERROR, "bad date");
    lan= u->label;
  }
  string fm= "";
  if (N(t) != 0) {
    tree u= exec (t[0]);
    if (is_compound (u)) return tree (ERROR, "bad date");
    fm= u->label;
  }
  return get_date (lan, fm);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 328 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (0.376*inch/25.4)); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1112 of file env_exec.cpp.

                                 {
  /* this doesn't match the documentation */
  if (N(t)!=2) return tree (ERROR, "bad divide");
  tree t1= exec (t[0]);
  tree t2= exec (t[1]);
  if (is_compound (t1) || is_compound (t2))
    return tree (ERROR, "bad divide");
  if (is_int (t1->label) && (is_int (t2->label))) {
    int den= as_int (t2->label);
    if (den == 0) return tree (ERROR, "division by zero");
    return as_string (as_int (t1->label) / den);
  }
  if (is_double (t1->label) && (is_double (t2->label))) {
    double den= as_double (t2->label);
    if (den == 0) return tree (ERROR, "division by zero");
    return as_string (floor (as_double (t1->label) / den));
  }
  if (is_anylen (t1->label) && (is_anylen (t2->label)))
    return as_string (tmlen_div (as_tmlen (t1), as_tmlen (t2)));
  return tree (ERROR, "bad divide");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 577 of file env_exec.cpp.

                                    {
  int i, n= N(t);
  if ((n>=3) && is_atomic (t[0]))
    for (i=1; i<n-1; i+=2) {
      if (!is_atomic (t[i])) continue;
      string var  = t[0]->label;
      string prop = t[i]->label;
      tree   val  = t[i+1];
      tree_label l= make_tree_label (var);
      if (prop == "arity") {
       if (is_tuple (val, "repeat", 2))
         drd->set_arity (l, as_int (val [1]), as_int (val [2]),
                       ARITY_REPEAT, CHILD_BIFORM);
       else if (is_tuple (val, "options", 2))
         drd->set_arity (l, as_int (val [1]), as_int (val [2]),
                       ARITY_OPTIONS, CHILD_BIFORM);
       else
         drd->set_arity (l, as_int (val), 0,
                       ARITY_NORMAL, CHILD_DETAILED);
       drd->freeze_arity (l);
      }
      else if (prop == "name") {
       if (is_atomic (val))
         drd->set_attribute (l, prop, val->label);
      }
      else if (prop == "syntax")
        drd->set_syntax (l, val);
      else if (prop == "border") {
       if (val == "yes") drd->set_border (l, BORDER_YES);
       if (val == "inner") drd->set_border (l, BORDER_INNER);
       if (val == "outer") drd->set_border (l, BORDER_OUTER);
       if (val == "no") drd->set_border (l, BORDER_INNER);
       drd->freeze_border (l);
      }
      else if (prop == "with-like") {
       if (val == "yes") drd->set_with_like (l, true);
       if (val == "no") drd->set_with_like (l, false);
       drd->freeze_with_like (l);
      }
      else if (prop == "locals") {
       int i, n= drd->get_nr_indices (l);
       for (i=0; i<n; i++) {
         drd->set_env (l, i, val);
         drd->freeze_env (l, i);
       }
      }
      else if (prop == "unaccessible" ||
              prop == "hidden" ||
              prop == "accessible")
       {
         int prop_code= ACCESSIBLE_NEVER;
         if (prop == "hidden") prop_code= ACCESSIBLE_HIDDEN;
         if (prop == "accessible") prop_code= ACCESSIBLE_ALWAYS;
         if (val == "none") prop_code= ACCESSIBLE_NEVER;
         if (is_int (val)) {
           int i= as_int (val);
           drd->set_accessible (l, i, prop_code);
           drd->freeze_accessible (l, i);
         }
         else if (val == "none" || val == "all") {
           int i, n= drd->get_nr_indices (l);
           for (i=0; i<n; i++) {
             drd->set_accessible (l, i, prop_code);
             drd->freeze_accessible (l, i);
           }
         }
       }
      else if (prop == "normal-writability" ||
         prop == "disable-writability" ||
         prop == "enable-writability")
       {
         int prop_code= WRITABILITY_NORMAL;
         if (prop == "disable-writability") prop_code= WRITABILITY_DISABLE;
         if (prop == "enable-writability") prop_code= WRITABILITY_ENABLE;
         if (is_int (val)) {
           int i= as_int (val);
           drd->set_writability (l, i, prop_code);
           drd->freeze_writability (l, i);
         }
         else if (val == "all") {
           int i, n= drd->get_nr_indices (l);
           for (i=0; i<n; i++) {
             drd->set_writability (l, i, prop_code);
             drd->freeze_writability (l, i);
           }
         }
       }
      else if (prop == "returns" && drd_encode_type (as_string (val)) >= 0) {
       drd->set_type (l, drd_encode_type (as_string (val)));
       drd->freeze_type (l);
      }
      else if (drd_encode_type (prop) >= 0) {
       int tp= drd_encode_type (prop);
       if (is_int (val)) {
         int i= as_int (val);
         drd->set_type (l, i, tp);
         drd->freeze_type (l, i);
       }
       else if (val == "all") {
         int i, n= drd->get_nr_indices (l);
         for (i=0; i<n; i++) {
           drd->set_type (l, i, tp);
           drd->freeze_type (l, i);
         }
       }
      }
    }
  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 348 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (fn->wquad)); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1425 of file env_exec.cpp.

                                {
  if (N(t)!=2) return tree (ERROR, "bad equal");
  tree t1= exec (t[0]);
  tree t2= exec (t[1]);
  if (is_atomic (t1) && is_atomic (t2)
      && is_length (t1->label) && is_length (t2->label))
    return as_string_bool (as_length (t1) == as_length (t2));
  return as_string_bool (t1 == t2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 788 of file env_exec.cpp.

                                    {
  if (N(t)<1) return tree (ERROR, "bad eval-args");
  if(is_nil(macro_arg)) return tree(ERROR, "nil argument");
  tree v= macro_arg->item [as_string (t[0])];
  if (is_atomic (v)) return tree (ERROR, "eval arguments " * t[0]->label);
  list<hashmap<string,tree> > old_var= macro_arg;
  list<hashmap<string,path> > old_src= macro_src;
  if (!is_nil (macro_arg)) macro_arg= macro_arg->next;
  if (!is_nil (macro_src)) macro_src= macro_src->next;

  int i, n= N(v);
  tree r (v, n);
  for (i=0; i<n; i++)
    r[i]= exec (v[i]);

  macro_arg= old_var;
  macro_src= old_src;
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 356 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (fn->yx)); }

Here is the call graph for this function:

Here is the caller graph for this function:

tree edit_env_rep::exec_exp ( tree  t) [private]

Definition at line 1168 of file env_exec.cpp.

                              {
  if (N(t)!=1) return tree (ERROR, "bad exp");
  tree t1= exec (t[0]);
  if (is_double (t1))
    return as_tree (exp (as_double (t1)));
  return tree (ERROR, "bad exp");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 343 of file env_length.cpp.

                               {
  double fbs= (get_int(FONT_BASE_SIZE) * magn * inch) / 72.0;
  return tree (TMLEN, as_string (fbs));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1384 of file env_exec.cpp.

                                    {
  int i, n=N(t);
  array<tree> r (n);
  for (i=0; i<n; i++) {
    r[i]= exec (t[i]);
    if (is_compound (r[i]))
      return tree (ERROR, "bad find file");
  }
  for (i=0; i<(n-1); i++) {
    url u= resolve (url (r[i]->label, r[n-1]->label));
    if (!is_none (u)) {
      if (is_rooted (u, "default")) u= reroot (u, "file");
      return as_string (u);
    }
  }
  url u= resolve (base_file_name * url_parent () * r[n-1]->label);
  if (!is_none (u)) {
    if (is_rooted (u, "default")) u= reroot (u, "file");
    return as_string (u);
  }
  return "false";
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 360 of file env_length.cpp.

                              {
  double fn=
    (get_int(FONT_BASE_SIZE) * magn * inch * get_double(FONT_SIZE)) / 72.0;
  return tree (TMLEN, as_string (0.5*fn), as_string (fn), as_string (1.5*fn));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 381 of file env_length.cpp.

                                 {
  return tree (TMLEN, as_string (fn->y1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 367 of file env_length.cpp.

                               {
  double fn=
    (get_int(FONT_BASE_SIZE) * magn * inch * get_double(FONT_SIZE)) / 72.0;
  return tree (TMLEN, "0", "0", as_string (fn));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 386 of file env_length.cpp.

                                 {
  return tree (TMLEN, as_string (fn->y2));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 875 of file env_exec.cpp.

                                   {
  if (N(t)!=2) return tree (ERROR, "bad for-each");
  tree fun = exec (t[0]);
  tree args= exec (t[1]);
  if (!is_tuple (args)) return tree (ERROR, "bad for-each");
  int i, n= N(args);
  for (i=0; i<n; i++)
    exec (tree (COMPOUND, fun, args[i]));
  return "";
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree edit_env_rep::exec_formatting ( tree  t,
string  v 
) [private]

Definition at line 454 of file env_exec.cpp.

                                               {
  int i, n= N(t);
  if (n < 1)
    return tree (ERROR, "bad formatting");
  tree r (t, n);
  for (i=0; i<n-1; i++) r[i]= exec (t[i]);
  tree oldv= read (v);
  tree newv= oldv * r (0, n-1);
  // monitored_write_update (v, newv);
  write_update (v, newv);
  r[n-1]= exec (t[n-1]);
  write_update (v, oldv);
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1685 of file env_exec.cpp.

                                       {
  if (N(t)<1) return tree (ERROR, "bad frame-direct");
  tree t1= exec (t[0]);
  return as_tree (!is_nil (fr) ? fr (::as_point (t1)) : point ());
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1692 of file env_exec.cpp.

                                        {
  if (N(t)<1) return tree (ERROR, "bad frame-inverse");
  tree t1= exec (t[0]);
  return as_tree (!is_nil (fr) ? fr [::as_point (t1)] : point ());
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 336 of file env_length.cpp.

                              {
  double fs=
    (get_int(FONT_BASE_SIZE) * magn * inch * get_double(FONT_SIZE)) / 72.0;
  return tree (TMLEN, as_string (fs));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 781 of file env_exec.cpp.

                                    {
  if (N(t)<1) return tree (ERROR, "bad get-arity");
  tree r= exec (t[0]);
  return as_string (arity (r));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1601 of file env_exec.cpp.

                                      {
  if (N(t) != 1 && N(t) != 2) return tree (ERROR, "bad get binding");
  string key= exec_string (t[0]);
  tree value= local_ref->contains (key)? local_ref [key]: global_ref [key];
  int type= (N(t) == 1? 0: as_int (exec_string (t[1])));
  if (type != 0 && type != 1) type= 0;
  if (is_func (value, TUPLE) && (N(value) >= 2)) value= value[type];
  else if (type == 1) value= tree (UNINIT);
  if (complete && value == tree (UNINIT))
    system_warning ("Undefined reference", key);
  //cout << t << ": " << key << " -> " << value << "\n";
  return value;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 774 of file env_exec.cpp.

                                    {
  if (N(t)<1) return tree (ERROR, "bad get-label");
  tree r= exec (t[0]);
  return copy (as_string (L(r)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 436 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (gh)); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1479 of file env_exec.cpp.

                                  {
  if (N(t)!=2) return tree (ERROR, "bad greater");
  tree t1= exec (t[0]);
  tree t2= exec (t[1]);
  if (is_compound (t1) || is_compound (t2))
    return tree (ERROR, "bad greater");
  string s1= t1->label;
  string s2= t2->label;
  if (is_double (s1) && (is_double (s2)))
    return as_string_bool (as_double (s1) > as_double (s2));
  if (is_length (s1) && is_length (s2))
    return as_string_bool (as_length (s1) > as_length (s2));
  return tree (ERROR, "bad greater");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1495 of file env_exec.cpp.

                                    {
  if (N(t)!=2) return tree (ERROR, "bad greater or equal");
  tree t1= exec (t[0]);
  tree t2= exec (t[1]);
  if (is_compound (t1) || is_compound (t2))
    return tree (ERROR, "bad greater or equal");
  string s1= t1->label;
  string s2= t2->label;
  if (is_double (s1) && (is_double (s2)))
    return as_string_bool (as_double (s1) >= as_double (s2));
  if (is_length (s1) && is_length (s2))
    return as_string_bool (as_length (s1) >= as_length (s2));
  return tree (ERROR, "bad greater or equal");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 434 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (gw)); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1511 of file env_exec.cpp.

                                  {
  pointer ptr= (pointer) this;
  if (N(t) == 0)
    return "%" * as_hexadecimal (ptr);
  else {
    t= expand (t[0], true);
    pointer tptr= (pointer) t.operator -> ();
    if (is_accessible (obtain_ip (t)))
      return "%" * as_hexadecimal (ptr) *
             "-" * as_hexadecimal (tptr);
    else {
      int h= hash (t);
      return "%" * as_hexadecimal (ptr) *
             "-" * as_hexadecimal (tptr) *
             "-" * as_hexadecimal (h);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 442 of file env_length.cpp.

{ return tree (TMLEN, "3600000"); }

Here is the caller graph for this function:

tree edit_env_rep::exec_if ( tree  t) [private]

Definition at line 828 of file env_exec.cpp.

                             {
  // This case must be kept consistent with
  // concater_rep::typeset_if(tree, path)
  // in ../Concat/concat_active.cpp
  if ((N(t)!=2) && (N(t)!=3)) return tree (ERROR, "bad if");
  tree tt= exec (t[0]);
  if (is_compound (tt) || !is_bool (tt->label))
    return tree (ERROR, "bad if");
  if (as_bool (tt->label)) return exec (t[1]);
  if (N(t)==3) return exec (t[2]);
  return "";
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 322 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (inch)); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1408 of file env_exec.cpp.

                                   {
  if (N(t)!=1) return tree (ERROR, "bad tuple query");
  return as_string_bool(is_tuple (exec (t[0])));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1260 of file env_exec.cpp.

                                 {
  if (N(t)!=1) return tree (ERROR, "bad length");
  tree t1= exec (t[0]);
  if (is_compound (t1)) {
    if (is_tuple (t1)) return as_string (N (t1));
    return tree (ERROR, "bad length");
  }
  return as_string (N (t1->label));
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree edit_env_rep::exec_less ( tree  t) [private]

Definition at line 1447 of file env_exec.cpp.

                               {
  if (N(t)!=2) return tree (ERROR, "bad less");
  tree t1= exec (t[0]);
  tree t2= exec (t[1]);
  if (is_compound (t1) || is_compound (t2))
    return tree (ERROR, "bad less");
  string s1= t1->label;
  string s2= t2->label;
  if (is_double (s1) && is_double (s2))
    return as_string_bool (as_double (s1) < as_double (s2));
  if (is_length (s1) && is_length (s2))
    return as_string_bool (as_length (s1) < as_length (s2));
  return tree (ERROR, "bad less");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1463 of file env_exec.cpp.

                                 {
  if (N(t)!=2) return tree (ERROR, "bad less or equal");
  tree t1= exec (t[0]);
  tree t2= exec (t[1]);
  if (is_compound (t1) || is_compound (t2))
    return tree (ERROR, "bad less or equal");
  string s1= t1->label;
  string s2= t2->label;
  if (is_double (s1) && (is_double (s2)))
    return as_string_bool (as_double (s1) <= as_double (s2));
  if (is_length (s1) && is_length (s2))
    return as_string_bool (as_length (s1) <= as_length (s2));
  return tree (ERROR, "bad less or equal");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 350 of file env_length.cpp.

                                   {
  return tree (TMLEN, as_string (fn->wline)); }

Here is the call graph for this function:

Here is the caller graph for this function:

tree edit_env_rep::exec_log ( tree  t) [private]

Definition at line 1177 of file env_exec.cpp.

                              {
  if (N(t)!=1) return tree (ERROR, "bad log");
  tree t1= exec (t[0]);
  if (is_double (t1))
    return as_tree (log (as_double (t1)));
  return tree (ERROR, "bad log");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1414 of file env_exec.cpp.

                                 {
  if (N(t)!=2) return tree (ERROR, "bad look up");
  tree t1= exec (t[0]);
  tree t2= exec (t[1]);
  if (!(is_compound (t1) && is_int (t2))) return tree (ERROR, "bad look up");
  int i= as_int (t2);
  if (i<0 || i>=N(t1)) return tree (ERROR, "index out of range in look up");
  return t1[i];
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1159 of file env_exec.cpp.

                                    {
  if (N(t)!=1) return tree (ERROR, "bad sqrt");
  tree t1= exec (t[0]);
  if (is_double (t1))
    return as_tree (sqrt (as_double (t1)));
  return tree (ERROR, "bad sqrt");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1223 of file env_exec.cpp.

                                {
  int i, n= N(t);
  if (n == 0) return "";
  tree acc= exec (t[0]);
  if (is_concat (acc)) acc= tree_as_string (acc);
  for (i=1; i<n; i++) {
    tree add= exec (t[i]);
    if (is_atomic (acc) &&
       (is_atomic (add) || is_concat (add) || is_document (add)))
      acc= acc->label * tree_as_string (add);
    else if (is_tuple (acc) && is_tuple (add))
      acc= acc * add;
    else if (is_func (acc, MACRO) && is_func (add, MACRO) &&
            (N(acc) == N(add)) &&
            (acc (0, N(acc)-1) == add (0, N(add)-1)))
      {
       tree r = copy (acc);
       tree u1= copy (acc[N(acc)-1]);
       tree u2= copy (add[N(add)-1]);
       tree u (CONCAT, u1, u2);
       if (u1 == "") u= u2;
       else if (u2 == "") u= u1;
       else if (is_atomic (u1) && is_atomic (u2))
         u= u1->label * u2->label;
       r[N(r)-1]= u;
       acc= r;
      }
    else {
      //cout << "acc= " << acc << "\n";
      //cout << "add= " << add << "\n";
      return tree (ERROR, "bad merge");
    }
  }
  return acc;
}

Here is the call graph for this function:

Here is the caller graph for this function: