Back to index

texmacs  1.0.7.15
Functions
drd_info.cpp File Reference
#include "vars.hpp"
#include "drd_info.hpp"
#include "drd_std.hpp"
#include "drd_mode.hpp"
#include "iterator.hpp"
#include "analyze.hpp"

Go to the source code of this file.

Functions

tm_ostreamoperator<< (tm_ostream &out, drd_info drd)
static tree replace (tree t, hashmap< tree, tree > h)
tree drd_env_write (tree env, string var, tree val)
tree drd_env_merge (tree env, tree t)
tree drd_env_read (tree env, string var, tree val)
static void rewrite_symbolic_arguments (tree macro, tree &env)
static int minimal_arity (tree t, tree var)

Function Documentation

tree drd_env_merge ( tree  env,
tree  t 
)

Definition at line 636 of file drd_info.cpp.

                                 {
  int i, n= N(t);
  for (i=0; (i+1)<n; i+=2)
    if (is_atomic (t[i]))
      env= drd_env_write (env, t[i]->label, t[i+1]);
  return env;
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree drd_env_read ( tree  env,
string  var,
tree  val 
)

Definition at line 645 of file drd_info.cpp.

                                              {
  int i, n= N(env);
  for (i=0; i<n; i+=2)
    if (env[i] == var)
      return env[i+1];
  return val;
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree drd_env_write ( tree  env,
string  var,
tree  val 
)

Definition at line 623 of file drd_info.cpp.

                                               {
  for (int i=0; i<=N(env); i+=2)
    if (i == N(env))
      return env * tree (ATTR, var, val);
    else if (var <= env[i]->label) {
      if (var == env[i]->label)
       return env (0, i) * tree (ATTR, var, val) * env (i+2, N(env));
      return env (0, i) * tree (ATTR, var, val) * env (i, N(env));
    }
  return env;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int minimal_arity ( tree  t,
tree  var 
) [static]

Definition at line 868 of file drd_info.cpp.

                                 {
  if (is_atomic (t)) return 0;
  else if (is_func (t, ARG, 2) && (t[0] == var))
    return as_int (t[1]) + 1;
  else if (is_func (t, MAP_ARGS) && (N(t)>=4) && (t[2] == var))
    return as_int (t[3]);
  else {
    int i, n= N(t), m= 0;
    for (i=0; i<n; i++)
      m= max (m, minimal_arity (t[i], var));
    return m;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

tm_ostream& operator<< ( tm_ostream out,
drd_info  drd 
)

Definition at line 61 of file drd_info.cpp.

                                            {
  return out << "drd [" << drd->name << "]";
}
static tree replace ( tree  t,
hashmap< tree, tree h 
) [static]

Definition at line 362 of file drd_info.cpp.

                                       {
  if (h->contains (t)) return h[t];
  else if (is_atomic (t)) return t;
  else {
    int i, n= N(t);
    tree r (t, n);
    for (i=0; i<n; i++)
      r[i]= replace (t[i], h);
    return r;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void rewrite_symbolic_arguments ( tree  macro,
tree env 
) [static]

Definition at line 806 of file drd_info.cpp.

                                                   {
  if (!is_func (env, ATTR)) return;
  for (int i=1; i<N(env); i+=2)
    if (is_func (env[i], ARG, 1)) {
      for (int j=0; j+1<N(macro); j++)
       if (macro[j] == env[i][0])
         env[i]= tree (ARG, as_tree (j));
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: