Back to index

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

#include <drd_info.hpp>

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

List of all members.

Public Member Functions

 drd_info_rep (string name)
 drd_info_rep (string name, drd_info base)
tree get_locals ()
bool set_locals (tree t)
bool contains (string l)
void set_type (tree_label tag, int tp)
int get_type (tree_label tag)
void freeze_type (tree_label tag)
int get_type (tree t)
void set_arity (tree_label tag, int arity, int extra, int am, int cm)
int get_arity_mode (tree_label tag)
int get_arity_base (tree_label tag)
int get_arity_extra (tree_label tag)
int get_child_mode (tree_label tag)
int get_nr_indices (tree_label tag)
void freeze_arity (tree_label tag)
int get_old_arity (tree_label l)
int get_minimal_arity (tree_label l)
int get_maximal_arity (tree_label l)
bool correct_arity (tree_label l, int i)
bool insert_point (tree_label l, int i, int n)
bool is_dynamic (tree t, bool hack=true)
void set_border (tree_label tag, int mode)
int get_border (tree_label tag)
void freeze_border (tree_label tag)
bool is_child_enforcing (tree t)
bool is_parent_enforcing (tree t)
bool var_without_border (tree_label tag)
void set_block (tree_label tag, int is_block)
int get_block (tree_label tag)
void freeze_block (tree_label tag)
void set_with_like (tree_label tag, bool is_with_like)
bool get_with_like (tree_label tag)
void freeze_with_like (tree_label tag)
bool is_with_like (tree t)
void set_attribute (tree_label tag, string which, tree val)
tree get_attribute (tree_label tag, string which)
void set_name (tree_label tag, string val)
void set_long_name (tree_label tag, string val)
void set_syntax (tree_label tag, tree val)
string get_name (tree_label tag)
string get_long_name (tree_label tag)
tree get_syntax (tree_label tag)
tree get_syntax (tree t, path p=path(-1))
void set_type (tree_label tag, int nr, int tp)
int get_type (tree_label tag, int nr)
void freeze_type (tree_label tag, int nr)
int get_type_child (tree t, int child)
void set_accessible (tree_label tag, int nr, int access_mode)
int get_accessible (tree_label tag, int nr)
void freeze_accessible (tree_label tag, int nr)
bool all_accessible (tree_label tag)
bool none_accessible (tree_label tag)
bool is_accessible_child (tree t, int child)
void set_writability (tree_label tag, int nr, int writability)
int get_writability (tree_label tag, int nr)
void freeze_writability (tree_label tag, int nr)
int get_writability_child (tree t, int child)
void set_block (tree_label tag, int nr, int require_block)
int get_block (tree_label tag, int nr)
void freeze_block (tree_label tag, int nr)
void set_env (tree_label tag, int nr, tree env)
tree get_env (tree_label tag, int nr)
void freeze_env (tree_label tag, int nr)
tree get_env_child (tree t, int child, tree env)
tree get_env_child (tree t, int child, string var, tree val)
tree get_env_descendant (tree t, path p, tree env)
void set_child_name (tree_label tag, int nr, string val)
void set_child_long_name (tree_label tag, int nr, string val)
string get_child_name (tree_label tag, int nr)
string get_child_long_name (tree_label tag, int nr)
string get_child_name (tree t, int child)
string get_child_long_name (tree t, int child)
void set_environment (hashmap< string, tree > env)
tree arg_access (tree t, tree arg, tree env, int &type)
bool heuristic_with_like (tree t, tree arg)
bool heuristic_init_macro (string var, tree macro)
bool heuristic_init_xmacro (string var, tree xmacro)
void heuristic_init (hashmap< string, tree > env)

Public Attributes

string name
rel_hashmap< tree_label, tag_infoinfo
hashmap< string, treeenv

Private Attributes

int ref_count

Friends

class drd_info
tm_ostreamoperator<< (tm_ostream &out, drd_info drd)

Detailed Description

Definition at line 19 of file drd_info.hpp.


Constructor & Destructor Documentation

Definition at line 23 of file drd_info.cpp.

                                       :
  name (name2), info (tag_info ()), env (UNINIT) {}

Definition at line 25 of file drd_info.cpp.

                                                      :
  name (name2), info (tag_info (), base->info), env (UNINIT) {}

Member Function Documentation

Definition at line 484 of file drd_info.cpp.

                                          {
  int i, n= N(info[l]->ci);
  for (i=0; i<n; i++)
    if (info[l]->ci[i].accessible != ACCESSIBLE_ALWAYS)
      return false;
  return n>0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree drd_info_rep::arg_access ( tree  t,
tree  arg,
tree  env,
int &  type 
)

Definition at line 743 of file drd_info.cpp.

                                                               {
  // returns "" if unaccessible and the env if accessible
  //cout << "  arg_access " << t << ", " << arg << ", " << env << "\n";
  if (is_atomic (t)) return "";
  else if (t == arg) return env;
  else if (is_func (t, QUOTE_ARG, 1) && N(arg) == 1 && t[0] == arg[0])
    return env;
  else if (is_func (t, MAP_ARGS) && (t[2] == arg[0])) {
    if ((N(t) >= 4) && (N(arg) >= 2) && (as_int (t[3]) > as_int (arg[1])))
      return "";
    if ((N(t) == 5) && (N(arg) >= 2) && (as_int (t[3]) <= as_int (arg[1])))
      return "";
    tree_label inner= make_tree_label (as_string (t[0]));
    tree_label outer= make_tree_label (as_string (t[1]));
    if (get_nr_indices (inner) > 0)
      type= get_type_child (tree (inner, arg), 0);
    if ((get_nr_indices (inner) > 0) &&
       (get_accessible (inner, 0) == ACCESSIBLE_ALWAYS) &&
       all_accessible (outer))
      return env;
    return "";
  }
  else if (is_func (t, MACRO)) return "";
  else if (is_func (t, WITH)) {
    int n= N(t)-1;
    //cout << "env= " << drd_env_merge (env, t (0, n)) << "\n";
    return arg_access (t[n], arg, drd_env_merge (env, t (0, n)), type);
  }
  else if (is_func (t, TFORMAT)) {
    int n= N(t)-1;
    tree oldf= drd_env_read (env, CELL_FORMAT, tree (TFORMAT));
    tree newf= oldf * tree (TFORMAT, A (t (0, n)));
    tree w   = tree (ATTR, CELL_FORMAT, newf);
    tree cenv= get_env_child (t, n, drd_env_merge (env, w));
    return arg_access (t[n], arg, cenv, type);
  }
  else if (is_func (t, COMPOUND) && N(t) >= 1 && is_atomic (t[0]))
    return arg_access (compound (t[0]->label, A (t (1, N(t)))),
                     arg, env, type);
  else if ((is_func (t, IF) || is_func (t, VAR_IF)) && N(t) >= 2)
    return arg_access (t[1], arg, env, type);
  else {
    int i, n= N(t);
    for (i=0; i<n; i++) {
      int  ctype= get_type_child (t, i);
      tree cenv = get_env_child (t, i, env);
      tree aenv = arg_access (t[i], arg, cenv, ctype);
      if (aenv != "") {
       if (ctype != TYPE_INVALID) type= ctype;
       if (is_accessible_child (t, i)) return aenv;
      }
      else if (type == TYPE_UNKNOWN &&
               ctype != TYPE_INVALID &&
               ctype != TYPE_UNKNOWN) {
        type= ctype;
        //cout << "  found type " << t << ", " << arg << ", " << type << "\n";
      }
    }
    return "";
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 56 of file drd_info.cpp.

                                {
  return existing_tree_label (l) && info->contains (as_tree_label (l));
}

Here is the call graph for this function:

bool drd_info_rep::correct_arity ( tree_label  l,
int  i 
)

Definition at line 189 of file drd_info.cpp.

                                                {
  parent_info pi= info[l]->pi;
  switch (pi.arity_mode) {
  case ARITY_NORMAL:
    return i == ((int) pi.arity_base) + ((int) pi.arity_extra);
  case ARITY_OPTIONS:
    return (i >= ((int) pi.arity_base)) &&
           (i <= ((int) pi.arity_base) + ((int) pi.arity_extra));
  case ARITY_REPEAT:
  case ARITY_VAR_REPEAT:
    return (i >= ((int) pi.arity_base)) &&
           (((i-pi.arity_base) % pi.arity_extra) == 0);
  }
  return false; // NOT REACHED
}
void drd_info_rep::freeze_accessible ( tree_label  tag,
int  nr 
)

Definition at line 475 of file drd_info.cpp.

                                                     {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info  & ti= info(l);
  if (nr >= N(ti->ci)) return;
  child_info& ci= ti->ci[nr];
  ci.freeze_accessible= true;
}

Here is the call graph for this function:

Definition at line 147 of file drd_info.cpp.

                                        {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info& ti= info(l);
  ti->pi.freeze_arity= true;
}

Here is the call graph for this function:

void drd_info_rep::freeze_block ( tree_label  tag,
int  nr 
)

Definition at line 253 of file drd_info.cpp.

                                         {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info& ti= info(l);
  ti->pi.freeze_border= true;
}

Here is the call graph for this function:

void drd_info_rep::freeze_env ( tree_label  tag,
int  nr 
)

Definition at line 674 of file drd_info.cpp.

                                              {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info  & ti= info(l);
  if (nr >= N(ti->ci)) return;
  child_info& ci= ti->ci[nr];
  ci.freeze_env= true;
}

Here is the call graph for this function:

Definition at line 83 of file drd_info.cpp.

                                       {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info& ti= info(l);
  ti->pi.freeze_type= true;
}

Here is the call graph for this function:

void drd_info_rep::freeze_type ( tree_label  tag,
int  nr 
)

Definition at line 431 of file drd_info.cpp.

                                               {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info  & ti= info(l);
  if (nr >= N(ti->ci)) return;
  child_info& ci= ti->ci[nr];
  ci.freeze_type= true;
}

Here is the call graph for this function:

Definition at line 296 of file drd_info.cpp.

                                            {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info& ti= info(l);
  ti->pi.freeze_with= true;
}

Here is the call graph for this function:

void drd_info_rep::freeze_writability ( tree_label  tag,
int  nr 
)

Definition at line 548 of file drd_info.cpp.

                                                      {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info  & ti= info(l);
  if (nr >= N(ti->ci)) return;
  child_info& ci= ti->ci[nr];
  ci.freeze_writability= true;
}

Here is the call graph for this function:

int drd_info_rep::get_accessible ( tree_label  tag,
int  nr 
)

Definition at line 469 of file drd_info.cpp.

                                                  {
  if (nr >= N(info[l]->ci)) return ACCESSIBLE_NEVER;
  return info[l]->ci[nr].accessible;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 132 of file drd_info.cpp.

                                          {
  return info[l]->pi.arity_base;
}

Definition at line 137 of file drd_info.cpp.

                                           {
  return info[l]->pi.arity_extra;
}

Definition at line 122 of file drd_info.cpp.

                                          {
  return info[l]->pi.arity_mode;
}

Definition at line 319 of file drd_info.cpp.

                                                       {
  tree val= info[l]->get_attribute (which);
  if ((which == "name") && (val == ""))
    return as_string (l);
  return val;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int drd_info_rep::get_block ( tree_label  tag,
int  nr 
)

Definition at line 248 of file drd_info.cpp.

                                      {
  return info[l]->pi.border_mode;
}

Definition at line 588 of file drd_info.cpp.

                                                       {
  return as_string (get_attribute (l, "long-name-" * as_string (nr)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 605 of file drd_info.cpp.

                                                {
  tag_info ti= info[L(t)];
  int index= ti->get_index (i, N(t));
  if (is_func (t, EXTERN) && N(t)>0 && is_atomic (t[0])) {
    ti= info[make_tree_label ("extern:" * t[0]->label)];
    index= ti->get_index (i-1, N(t));
  }
  if ((index<0) || (index>=N(ti->ci))) return "";
  string r= get_child_long_name (L(t), index);
  if (r != "") return r;
  return get_child_name (L(t), index);
}

Here is the call graph for this function:

Definition at line 127 of file drd_info.cpp.

                                          {
  return info[l]->pi.child_mode;
}

Definition at line 583 of file drd_info.cpp.

                                                  {
  return as_string (get_attribute (l, "name-" * as_string (nr)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

string drd_info_rep::get_child_name ( tree  t,
int  child 
)

Definition at line 593 of file drd_info.cpp.

                                           {
  tag_info ti= info[L(t)];
  int index= ti->get_index (i, N(t));
  if (is_func (t, EXTERN) && N(t)>0 && is_atomic (t[0])) {
    ti= info[make_tree_label ("extern:" * t[0]->label)];
    index= ti->get_index (i-1, N(t));
  }
  if ((index<0) || (index>=N(ti->ci))) return "";
  return get_child_name (L(t), index);
}

Here is the call graph for this function:

tree drd_info_rep::get_env ( tree_label  tag,
int  nr 
)

Definition at line 668 of file drd_info.cpp.

                                           {
  if (nr >= N(info[l]->ci)) return tree (ATTR);
  return drd_decode (info[l]->ci[nr].env);
}

Here is the call graph for this function:

tree drd_info_rep::get_env_child ( tree  t,
int  child,
tree  env 
)

Definition at line 683 of file drd_info.cpp.

                                                    {
  if (L(t) == WITH && i == N(t)-1)
    return drd_env_merge (env, t (0, N(t)-1));
  else {
    /* makes cursor movement (is_accessible_cursor) slow for large preambles
    if (L(t) == DOCUMENT && N(t) > 0 &&
       (is_compound (t[0], "hide-preamble", 1) ||
        is_compound (t[0], "show-preamble", 1)))
      {
       tree u= t[0][0];
       if (!is_func (u, DOCUMENT)) u= tree (DOCUMENT, u);
       tree cenv (ATTR);
       for (int i=0; i<N(u); i++)
         if (is_func (u[i], ASSIGN, 2))
           cenv << copy (u[i][0]) << copy (u[i][1]);
       env= drd_env_merge (env, cenv);
      }
    */

    tag_info ti= info[L(t)];
    int index= ti->get_index (i, N(t));
    if ((index<0) || (index>=N(ti->ci))) return "";
    tree cenv= drd_decode (ti->ci[index].env);
    for (int i=1; i<N(cenv); i+=2)
      if (is_func (cenv[i], ARG, 1) && is_int (cenv[i][0])) {
       cenv= copy (cenv);
       int j= as_int (cenv[i][0]);
       if (j>=0 && j<N(t)) cenv[i]= copy (t[j]);
      }
    return drd_env_merge (env, cenv);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree drd_info_rep::get_env_child ( tree  t,
int  child,
string  var,
tree  val 
)

Definition at line 718 of file drd_info.cpp.

                                                                {
  tree env= get_env_child (t, i, tree (ATTR));
  return drd_env_read (env, var, val);
}

Here is the call graph for this function:

Definition at line 724 of file drd_info.cpp.

                                                          {
  if (is_nil (p) || env == "") return env;
  int  i= p->item;
  path q= p->next;
  if (is_compound (t) && i >= 0 && i < N(t))
    return get_env_descendant (t[i], q, get_env_child (t, i, env));
  return "";
}

Here is the call graph for this function:

Definition at line 33 of file drd_info.cpp.

                          {
  tree t (COLLECTION);
  iterator<tree_label> it= iterate (info->item);
  while (it->busy()) {
    tree_label l= it->next();
    tree v= (tree) info->item[l];
    t << tree (ASSOCIATE, as_string (l), v);
  }
  return t;
}

Here is the call graph for this function:

Definition at line 347 of file drd_info.cpp.

                                         {
  string r= as_string (get_attribute (l, "long-name"));
  if (r != "") return r;
  return as_string (get_attribute (l, "name"));
}

Here is the call graph for this function:

Definition at line 175 of file drd_info.cpp.

                                             {
  parent_info pi= info[l]->pi;
  switch (pi.arity_mode) {
  case ARITY_NORMAL:
  case ARITY_OPTIONS:
    return ((int) pi.arity_base) + ((int) pi.arity_extra);
  case ARITY_REPEAT:
  case ARITY_VAR_REPEAT:
    return 0x7fffffff;
  }
  return 0; // NOT REACHED
}

Definition at line 161 of file drd_info.cpp.

                                             {
  parent_info pi= info[l]->pi;
  switch (pi.arity_mode) {
  case ARITY_NORMAL:
    return ((int) pi.arity_base) + ((int) pi.arity_extra);
  case ARITY_OPTIONS:
  case ARITY_REPEAT:
  case ARITY_VAR_REPEAT:
    return ((int) pi.arity_base);
  }
  return 0; // NOT REACHED
}

Definition at line 342 of file drd_info.cpp.

                                    {
  return as_string (get_attribute (l, "name"));
}

Here is the call graph for this function:

Definition at line 142 of file drd_info.cpp.

                                          {
  return N(info[l]->ci);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 154 of file drd_info.cpp.

                                         {
  tag_info ti= info[l];
  if (ti->pi.arity_mode != ARITY_NORMAL) return -1;
  else return ((int) ti->pi.arity_base) + ((int) ti->pi.arity_extra);
}

Definition at line 354 of file drd_info.cpp.

                                      {
  tree r= get_attribute (l, "syntax");
  if (r != "") return r;
  if (env->contains (as_string (l))) return env[as_string (l)];
  return UNINIT;
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree drd_info_rep::get_syntax ( tree  t,
path  p = path (-1) 
)

Definition at line 375 of file drd_info.cpp.

                                        {
  if (is_atomic (t)) {
    string s= t->label;
    if (N(s) == 1 || !existing_tree_label (s)) return UNINIT;
    return get_syntax (as_tree_label (s));
  }
  else if (is_func (t, VALUE, 1) && is_atomic (t[0])) {
    string s= t[0]->label;
    if (!existing_tree_label (s)) return UNINIT;
    return get_syntax (as_tree_label (s));
  }
  else if (L(t) < START_EXTENSIONS)
    return UNINIT;
  else {
    tree fun= the_drd->get_syntax (L(t));
    if (fun == UNINIT) return UNINIT;
    else if (N(t) == 0 && !is_func (fun, MACRO)) return fun;
    else if (!is_func (fun, MACRO)) return UNINIT;
    else {
      int i, n= N(fun)-1;
      hashmap<tree,tree> tab (UNINIT);
      for (i=0; i<n; i++) {
        tree var= tree (ARG, fun[i]);
        tree val= "";
        if (i < N(t)) {
          if (p == path (-1)) val= t[i];
          else val= tree (QUASI, t[i], (tree) (p * i));
        }
        tab (var)= val;
      }
      return replace (fun[n], tab);
    }
  }
}

Here is the call graph for this function:

Definition at line 78 of file drd_info.cpp.

                                    {
  return info[l]->pi.type;
}

Here is the caller graph for this function:

Definition at line 90 of file drd_info.cpp.

                              {
  return info[L(t)]->pi.type;
}
int drd_info_rep::get_type ( tree_label  tag,
int  nr 
)

Definition at line 425 of file drd_info.cpp.

                                            {
  if (nr >= N(info[l]->ci)) return TYPE_ADHOC;
  return info[l]->ci[nr].type;
}

Here is the call graph for this function:

int drd_info_rep::get_type_child ( tree  t,
int  child 
)

Definition at line 440 of file drd_info.cpp.

                                           {
  tag_info ti= info[L(t)];
  int index= ti->get_index (i, N(t));
  if (is_func (t, EXTERN) && N(t)>0 && is_atomic (t[0])) {
    ti= info[make_tree_label ("extern:" * t[0]->label)];
    index= ti->get_index (i-1, N(t));
  }
  if ((index<0) || (index>=N(ti->ci))) return TYPE_INVALID;
  int r= ti->ci[index].type;
  if (r != TYPE_BINDING) return r;
  if ((i & 1) == 0) return TYPE_VARIABLE;
  return TYPE_REGULAR;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 291 of file drd_info.cpp.

                                         {
  return info[l]->pi.with_like;
}
int drd_info_rep::get_writability ( tree_label  tag,
int  nr 
)

Definition at line 542 of file drd_info.cpp.

                                                   {
  if (nr >= N(info[l]->ci)) return WRITABILITY_NORMAL;
  return info[l]->ci[nr].writability;
}

Here is the call graph for this function:

int drd_info_rep::get_writability_child ( tree  t,
int  child 
)

Definition at line 557 of file drd_info.cpp.

                                                  {
  tag_info ti= info[L(t)];
  int index= ti->get_index (i, N(t));
  if (is_func (t, EXTERN) && N(t)>0 && is_atomic (t[0])) {
    ti= info[make_tree_label ("extern:" * t[0]->label)];
    index= ti->get_index (i-1, N(t));
  }
  if ((index<0) || (index>=N(ti->ci))) return WRITABILITY_DISABLE;
  return ti->ci[index].writability;
}

Here is the call graph for this function:

Definition at line 906 of file drd_info.cpp.

                                                       {
  // time_t tt= texmacs_time ();
  set_environment (env2);
  bool flag= true;
  int round= 0;
  while (flag) {
    // cout << HRULE;
    flag= false;
    iterator<string> it= iterate (env);
    while (it->busy()) {
      string var= it->next();
      tree   val= env[var];
      if (is_func (val, MACRO))
       flag= heuristic_init_macro (var, val) | flag;
      if (is_func (val, XMACRO))
       flag= heuristic_init_xmacro (var, val) | flag;
    }
    if ((round++) == 10) {
      cout << "TeXmacs] Warning: bad heuristic drd convergence\n";
      flag= false;
    }
  }
  // cout << "--> " << (texmacs_time ()-tt) << "ms\n";
}

Here is the call graph for this function:

bool drd_info_rep::heuristic_init_macro ( string  var,
tree  macro 
)

Definition at line 830 of file drd_info.cpp.

                                                          {
  //cout << "init_macro " << var << " -> " << macro << "\n";
  tree_label l = make_tree_label (var);
  tag_info old_ti= copy (info[l]);
  int i, n= N(macro)-1;
  set_arity (l, n, 0, ARITY_NORMAL, CHILD_DETAILED);
  set_type (l, get_type (macro[n]));
  set_with_like (l, heuristic_with_like (macro, ""));
  //if (heuristic_with_like (macro, ""))
  //cout << "With-like: " << var << LF;
  for (i=0; i<n; i++) {
    if (is_atomic (macro[i]))
      if (l >= START_EXTENSIONS || get_child_name (l, i) == "")
        set_child_name (l, i, macro[i]->label);
    int  type= TYPE_UNKNOWN;
    tree arg (ARG, macro[i]);
    tree env= arg_access (macro[n], arg, tree (ATTR), type);
    //if (var == "section" || var == "section-title")
    //cout << var << " -> " << env << ", " << macro << "\n";
    //if (var == "math")
    //cout << var << ", " << i << " -> " << type << ", " << env << ", " << macro << "\n";
    set_type (l, i, type);
    if (env != "") {
      //if (var == "eqnarray*")
      //cout << var << " -> " << env << "\n";
      //if (var == "session")
      //cout << var << " = " << macro << ", " << i << " -> " << env << "\n";
      rewrite_symbolic_arguments (macro, env);
      set_accessible (l, i, ACCESSIBLE_ALWAYS);
      set_env (l, i, env);
    }
  }
  //if (old_ti != info[l])
  //cout << var << ": " << old_ti << " -> " << info[l] << "\n";
  return (old_ti != info[l]);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool drd_info_rep::heuristic_init_xmacro ( string  var,
tree  xmacro 
)

Definition at line 883 of file drd_info.cpp.

                                                            {
  tree_label l = make_tree_label (var);
  tag_info old_ti= copy (info[l]);
  int i, m= minimal_arity (xmacro[1], xmacro[0]);
  set_arity (l, m, 1, ARITY_REPEAT, CHILD_DETAILED);
  set_type (l, get_type (xmacro[1]));
  for (i=0; i<=m; i++) {
    int type= TYPE_UNKNOWN;
    tree arg (ARG, xmacro[0], as_string (i));
    tree env= arg_access (xmacro[1], arg, tree (ATTR), type);
    //cout << var << ", " << xmacro << ", " << i << " -> " << type << "\n";
    set_type (l, i, type);
    if (env != "") {
      set_accessible (l, i, ACCESSIBLE_ALWAYS);
      set_env (l, i, env);
    }
  }
  // if (old_ti != info[l])
  //   cout << var << ": " << old_ti << " -> " << info[l] << "\n";
  return (old_ti != info[l]);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 817 of file drd_info.cpp.

                                                   {
  if (arg == "") {
    if (!is_func (t, MACRO) || N(t) < 2) return false;
    return heuristic_with_like (t[N(t)-1], t[N(t)-2]);
  }
  else if (t == tree (ARG, arg))
    return true;
  else if (is_with_like (t))
    return heuristic_with_like (t[N(t)-1], arg);
  else return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool drd_info_rep::insert_point ( tree_label  l,
int  i,
int  n 
)

Definition at line 206 of file drd_info.cpp.

                                                      {
  parent_info pi= info[l]->pi;
  switch (pi.arity_mode) {
  case ARITY_NORMAL:
    return false;
  case ARITY_OPTIONS:
    return (i >= ((int) pi.arity_base)) && (i <= n) &&
           (n < ((int) pi.arity_base) + ((int) pi.arity_extra));
  case ARITY_REPEAT:
    return (i >= 0) &&
           ((i < ((int) pi.arity_base)) ||
           ((i - pi.arity_base) % pi.arity_extra) == 0);
  case ARITY_VAR_REPEAT:
    return (i >= 0) &&
           ((i > (n - ((int) pi.arity_base))) ||
           (i % pi.arity_extra == 0));
  }
  return false; // NOT REACHED
}
bool drd_info_rep::is_accessible_child ( tree  t,
int  child 
)

Definition at line 502 of file drd_info.cpp.

                                                {
  //cout << "l= " << as_string (L(t)) << "\n";
  tag_info ti= info[L(t)];
  int index= ti->get_index (i, N(t));
  if (is_func (t, EXTERN) && N(t)>0 && is_atomic (t[0])) {
    ti= info[make_tree_label ("extern:" * t[0]->label)];
    index= ti->get_index (i-1, N(t));
  }
  if ((index<0) || (index>=N(ti->ci))) {
    if (get_access_mode () == DRD_ACCESS_SOURCE)
      return !is_atomic (t) && i >= 0 && i < N(t);
    else return false;
  }
  switch (get_access_mode ()) {
  case DRD_ACCESS_NORMAL:
    return ti->ci[index].accessible == ACCESSIBLE_ALWAYS;
  case DRD_ACCESS_HIDDEN:
    return ti->ci[index].accessible == ACCESSIBLE_ALWAYS ||
           ti->ci[index].accessible == ACCESSIBLE_HIDDEN;
  case DRD_ACCESS_SOURCE:
    return true;
  }
  return true; // NOT REACHED
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 260 of file drd_info.cpp.

                                        {
  return ((info[L(t)]->pi.border_mode & BORDER_INNER) != 0) &&
         (N(t) != 0);
}

Here is the call graph for this function:

bool drd_info_rep::is_dynamic ( tree  t,
bool  hack = true 
)

Definition at line 227 of file drd_info.cpp.

                                           {
  if (hack && L(t) >= START_EXTENSIONS) return true; // FIXME: temporary fix
  if (is_atomic (t)) return false;
  if (is_func (t, DOCUMENT) || is_func (t, PARA) || is_func (t, CONCAT) ||
      is_func (t, TABLE) || is_func (t, ROW)) return false;
  return info[L(t)]->pi.arity_mode != ARITY_NORMAL;
}

Here is the call graph for this function:

Definition at line 266 of file drd_info.cpp.

                                         {
  return ((info[L(t)]->pi.border_mode & BORDER_OUTER) != 0) &&
         (N(t) != 0);
}

Here is the call graph for this function:

Definition at line 303 of file drd_info.cpp.

                                  {
  return info[L(t)]->pi.with_like && N(t) > 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 493 of file drd_info.cpp.

                                           {
  int i, n= N(info[l]->ci);
  for (i=0; i<n; i++)
    if (info[l]->ci[i].accessible != ACCESSIBLE_NEVER)
      return false;
  return true;
}

Here is the call graph for this function:

void drd_info_rep::set_accessible ( tree_label  tag,
int  nr,
int  access_mode 
)

Definition at line 459 of file drd_info.cpp.

                                                                     {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info  & ti= info(l);
  if (nr >= N(ti->ci)) return;
  child_info& ci= ti->ci[nr];
  if (ci.freeze_accessible) return;
  ci.accessible= is_accessible;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void drd_info_rep::set_arity ( tree_label  tag,
int  arity,
int  extra,
int  am,
int  cm 
)

Definition at line 99 of file drd_info.cpp.

                                                                           {
  if (info[l]->pi.freeze_arity) return;
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info& ti= info(l);
  ti->pi.arity_mode= am;
  ti->pi.child_mode= cm;
  if (am != ARITY_VAR_REPEAT) {
    ti->pi.arity_base = arity;
    ti->pi.arity_extra= extra;
  }
  else {
    ti->pi.arity_base = extra;
    ti->pi.arity_extra= arity;
  }
  int n;
  if (arity+extra == 0) n= 0;
  else if (cm == CHILD_UNIFORM) n= 1;
  else if (cm == CHILD_BIFORM) n= 2;
  else n= arity+extra;
  if (N(ti->ci) != n) ti->ci= array<child_info> (n);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void drd_info_rep::set_attribute ( tree_label  tag,
string  which,
tree  val 
)

Definition at line 312 of file drd_info.cpp.

                                                                 {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info& ti= info(l);
  ti->set_attribute (which, val);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void drd_info_rep::set_block ( tree_label  tag,
int  is_block 
)
void drd_info_rep::set_block ( tree_label  tag,
int  nr,
int  require_block 
)
void drd_info_rep::set_border ( tree_label  tag,
int  mode 
)

Definition at line 240 of file drd_info.cpp.

                                                {
  if (info[l]->pi.freeze_border) return;
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info& ti= info(l);
  ti->pi.border_mode= mode;
}

Here is the call graph for this function:

void drd_info_rep::set_child_long_name ( tree_label  tag,
int  nr,
string  val 
)

Definition at line 578 of file drd_info.cpp.

                                                                   {
  set_attribute (l, "long-name-" * as_string (nr), val);
}

Here is the call graph for this function:

void drd_info_rep::set_child_name ( tree_label  tag,
int  nr,
string  val 
)

Definition at line 573 of file drd_info.cpp.

                                                              {
  set_attribute (l, "name-" * as_string (nr), val);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void drd_info_rep::set_env ( tree_label  tag,
int  nr,
tree  env 
)

Definition at line 654 of file drd_info.cpp.

                                                     {
  //if (as_string (l) == "section")
  //cout << as_string (l) << ", " << nr << " -> " << env << "\n";
  //if (as_string (l) == "session")
  //cout << as_string (l) << ", " << nr << " -> " << env << "\n";
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info  & ti= info(l);
  if (nr >= N(ti->ci)) return;
  child_info& ci= ti->ci[nr];
  if (ci.freeze_env) return;
  ci.env= drd_encode (env);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 738 of file drd_info.cpp.

                                                        {
  env= env2;
}

Here is the caller graph for this function:

Definition at line 45 of file drd_info.cpp.

                                {
  if (!is_func (t, COLLECTION))
    return false;
  int i, n= N(t);
  for (i=0; i<n; i++)
    if (is_func (t[i], ASSOCIATE, 2) && is_atomic (t[i][0]))
      info (make_tree_label (t[i][0]->label))= tag_info (t[i][1]);
  return true;
}

Here is the call graph for this function:

Definition at line 332 of file drd_info.cpp.

                                                     {
  set_attribute (l, "long-name", val);
}

Here is the call graph for this function:

void drd_info_rep::set_name ( tree_label  tag,
string  val 
)

Definition at line 327 of file drd_info.cpp.

                                                {
  set_attribute (l, "name", val);
}

Here is the call graph for this function:

void drd_info_rep::set_syntax ( tree_label  tag,
tree  val 
)

Definition at line 337 of file drd_info.cpp.

                                                {
  set_attribute (l, "syntax", val);
}

Here is the call graph for this function:

void drd_info_rep::set_type ( tree_label  tag,
int  tp 
)

Definition at line 70 of file drd_info.cpp.

                                            {
  if (info[l]->pi.freeze_type) return;
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info& ti= info(l);
  ti->pi.type= tp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void drd_info_rep::set_type ( tree_label  tag,
int  nr,
int  tp 
)

Definition at line 415 of file drd_info.cpp.

                                                    {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info  & ti= info(l);
  if (nr >= N(ti->ci)) return;
  child_info& ci= ti->ci[nr];
  if (ci.freeze_type) return;
  ci.type= tp;
}

Here is the call graph for this function:

void drd_info_rep::set_with_like ( tree_label  tag,
bool  is_with_like 
)

Definition at line 283 of file drd_info.cpp.

                                                            {
  if (info[l]->pi.freeze_with) return;
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info& ti= info(l);
  ti->pi.with_like= is_with_like;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void drd_info_rep::set_writability ( tree_label  tag,
int  nr,
int  writability 
)

Definition at line 532 of file drd_info.cpp.

                                                                    {
  if (!info->contains (l)) info(l)= copy (info[l]);
  tag_info  & ti= info(l);
  if (nr >= N(ti->ci)) return;
  child_info& ci= ti->ci[nr];
  if (ci.freeze_writability) return;
  ci.writability= writability;
}

Here is the call graph for this function:

Definition at line 272 of file drd_info.cpp.

                                              {
  return ((info[l]->pi.border_mode & BORDER_INNER) != 0) &&
         (!std_contains (as_string (l)));
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class drd_info [friend]

Definition at line 122 of file drd_info.hpp.

tm_ostream& operator<< ( tm_ostream out,
drd_info  drd 
) [friend]

Definition at line 61 of file drd_info.cpp.

                                            {
  return out << "drd [" << drd->name << "]";
}

Member Data Documentation

Definition at line 23 of file drd_info.hpp.

Definition at line 22 of file drd_info.hpp.

Definition at line 21 of file drd_info.hpp.

int concrete_struct::ref_count [inherited]

Definition at line 135 of file basic.hpp.


The documentation for this class was generated from the following files: