Back to index

texmacs  1.0.7.15
Functions | Variables
tree_modify.cpp File Reference
#include "tree_modify.hpp"
#include "drd_std.hpp"
#include "path.hpp"

Go to the source code of this file.

Functions

void correct_concat_node (tree &t, int done)
void correct_node (tree &t)
void correct_downwards (tree &t)
void correct_upwards (tree &t)

Variables

tree the_et

Function Documentation

void correct_concat_node ( tree t,
int  done 
)

Definition at line 23 of file tree_modify.cpp.

                                        {
  //cout << "Correct " << t << ", " << done << "\n";
  int i, n= N(t);
  if (n == 0) {
    assign (t, "");
    return;
  }
  for (i=done; i<n; i++) {
    if (t[i] == "") {
      remove (t, i, 1);
      correct_concat_node (t, i);
      return;
    }
    if ((i<n-1) && is_atomic (t[i]) && is_atomic (t[i+1])) {
      join (t, i);
      correct_concat_node (t, i);
      return;
    }
    if (is_concat (t[i])) {
      insert_node (t, 0, CONCAT);
      split (t, 0, i);
      split (t, 1, 1);
      remove_node (t[1], 0);
      if (t[0] == tree (CONCAT)) remove (t, 0, 1);
      else join (t, 0);
      if (t[1] == tree (CONCAT)) remove (t, 1, 1);
      else join (t, 0);
      remove_node (t, 0);
      correct_concat_node (t, max (i-1, 0));
      return;
    }    
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void correct_downwards ( tree t)

Definition at line 71 of file tree_modify.cpp.

                            {
  if (is_compound (t))
    for (int i=0; i<N(t); i++)
      correct_downwards (t[i]);
  correct_node (t);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void correct_node ( tree t)

Definition at line 58 of file tree_modify.cpp.

                       {
  // NOTE: this routine should only modify t and its descendants,
  // but not any ancestors
  if (is_compound (t)) {
    if (the_drd->contains (as_string (L(t))) &&
       !the_drd->correct_arity (L(t), N(t)))
      assign (t, "");
    if (is_concat (t))
      correct_concat_node (t, 0);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void correct_upwards ( tree t)

Definition at line 79 of file tree_modify.cpp.

                          {
  correct_node (t);
  path ip= obtain_ip (t);
  if (ip_attached (ip) && !is_nil (ip))
    correct_upwards (subtree (the_et, reverse (ip->next)));
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 18 of file new_document.cpp.