Back to index

texmacs  1.0.7.15
Functions | Variables
link.cpp File Reference
#include "modification.hpp"
#include "link.hpp"
#include "iterator.hpp"
#include "vars.hpp"

Go to the source code of this file.

Functions

void register_pointer (string id, observer which)
void unregister_pointer (string id, observer which)
void register_vertex (tree v, soft_link ln)
void unregister_vertex (tree v, soft_link ln)
void register_link (soft_link ln)
void unregister_link (soft_link ln)
list< stringget_ids (list< observer > l)
list< stringget_ids (tree t)
list< treeas_trees (list< observer > l)
list< treeget_trees (string id)
list< treeas_tree_list (list< soft_link > l)
list< treeget_links (tree v)
list< stringall_link_types ()
void set_locus_rendering (string var, string val)
string get_locus_rendering (string var)
void declare_visited (string id)
bool has_been_visited (string id)
treeget_reference (tree &t)
list< treenot_done (list< tree > l)
list< treeget_mirrors (tree ln, string id)
void link_announce (tree ln, string id, modification mod)
void link_announce (observer obs, modification mod)

Variables

hashmap< string, list< observer > > id_resolve
hashmap< observer, list< string > > pointer_resolve
hashmap< tree, list< soft_link > > vertex_occurrences
hashmap< string, int > type_count (0)
static string current_locus_on_paper = "preserve"
static string current_locus_color = "#404080"
static string current_visited_color = "#702070"
static hashset< stringvisited_table
tree the_et

Function Documentation

Definition at line 167 of file link.cpp.

                  {
  list<string> l;
  iterator<string> it= iterate (type_count);
  while (it->busy()) {
    string s= it->next();
    l= list<string> (s, l);
  }
  return l;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 156 of file link.cpp.

                                 {
  if (is_nil (l)) return list<tree> ();
  else return list<tree> (l->item->t, as_tree_list (l->next));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 145 of file link.cpp.

                            {
  if (is_nil (l)) return list<tree> ();
  else return list<tree> (obtain_tree (l->item), as_trees (l->next));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void declare_visited ( string  id)

Definition at line 197 of file link.cpp.

                            {
  visited_table->insert (id);
}

Here is the caller graph for this function:

Definition at line 132 of file link.cpp.

                           {
  if (is_nil (l)) return list<string> ();
  return pointer_resolve [l->item] * get_ids (l->next);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 138 of file link.cpp.

                 {
  if (is_nil (t->obs)) return list<string> ();
  list<observer> l= t->obs->get_tree_pointers ();
  return reverse (get_ids (l));
}

Here is the call graph for this function:

Definition at line 162 of file link.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 189 of file link.cpp.

                                 {
  if (var == "locus-on-paper") return current_locus_on_paper;
  if (var == LOCUS_COLOR) return current_locus_color;
  if (var == VISITED_COLOR) return current_visited_color;
  return "";
}

Here is the caller graph for this function:

list<tree> get_mirrors ( tree  ln,
string  id 
)

Definition at line 226 of file link.cpp.

                                 {
  if (!is_compound (ln, "link", 4) ||
      ln[0] != "mirror" ||
      !is_compound (ln[2], "id", 1) ||
      !is_atomic (ln[2][0]) ||
      !is_compound (ln[3], "id", 1) ||
      !is_atomic (ln[3][0]))
    return list<tree> ();
  if (ln[2][0] == id) return not_done (get_trees (ln[3][0]->label));
  if (ln[3][0] == id) return not_done (get_trees (ln[2][0]->label));
  return list<tree> ();
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree& get_reference ( tree t)

Definition at line 211 of file link.cpp.

                        {
  path ip= obtain_ip (t);
  if (ip_attached (ip)) return subtree (the_et, reverse (ip));
  else return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 151 of file link.cpp.

                      {
  return reverse (as_trees (id_resolve [id]));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool has_been_visited ( string  id)

Definition at line 202 of file link.cpp.

                             {
  return visited_table->contains (id);
}

Here is the caller graph for this function:

void link_announce ( tree  ln,
string  id,
modification  mod 
)

Definition at line 240 of file link.cpp.

                                                     {
  //cout << "Link event " << ln << ", " << id << ", " << mod << "\n";
  for (list<tree> l= get_mirrors (ln, id); !is_nil (l); l= l->next)
    if (is_applicable (l->item, mod))
      apply (get_reference (l->item), copy (mod));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void link_announce ( observer  obs,
modification  mod 
)

Definition at line 248 of file link.cpp.

                                               {
  //cout << "Link event " << mod << "\n";
  for (list<string> ids= pointer_resolve [obs];
       !is_nil (ids); ids= ids->next)
    for (list<tree> lns= get_links (compound ("id", ids->item));
        !is_nil (lns); lns= lns->next)
      link_announce (lns->item, ids->item, mod);
}

Here is the call graph for this function:

list<tree> not_done ( list< tree l)

Definition at line 218 of file link.cpp.

                        {
  if (is_nil (l)) return l;
  else if (versioning_busy || busy_tree (get_reference (l->item)))
    return not_done (l->next);
  return list<tree> (l->item, not_done (l->next));
}

Here is the call graph for this function:

void register_link ( soft_link  ln)

Definition at line 70 of file link.cpp.

                             {
  // cout << "Register: " << ln->t << "\n";
  int i, n= N(ln->t);
  if (is_atomic (ln->t[0]))
    type_count (ln->t[0]->label) ++;
  for (i=1; i<n; i++)
    register_vertex (ln->t[i], ln);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void register_pointer ( string  id,
observer  which 
)

Definition at line 35 of file link.cpp.

                                             {
  // cout << "Register: " << id << " -> " << which << "\n";
  // cout << "Register: " << id << " -> " << obtain_tree (which) << "\n";
  list<observer>& l1= id_resolve (id);
  l1= list<observer> (which, l1);
  list<string>& l2= pointer_resolve (which);
  l2= list<string> (id, l2);
}

Here is the caller graph for this function:

void register_vertex ( tree  v,
soft_link  ln 
)

Definition at line 57 of file link.cpp.

Here is the caller graph for this function:

void set_locus_rendering ( string  var,
string  val 
)

Definition at line 182 of file link.cpp.

                                             {
  if (var == "locus-on-paper") current_locus_on_paper= val;
  if (var == LOCUS_COLOR) current_locus_color= val;
  if (var == VISITED_COLOR) current_visited_color= val;
}

Here is the caller graph for this function:

void unregister_link ( soft_link  ln)

Definition at line 80 of file link.cpp.

                               {
  // cout << "Unregister: " << ln->t << "\n";
  int i, n= N(ln->t);
  if (is_atomic (ln->t[0])) {
    type_count (ln->t[0]->label) --;
    if (type_count (ln->t[0]->label) == 0)
      type_count->reset (ln->t[0]->label);
  }
  for (i=1; i<n; i++)
    unregister_vertex (ln->t[i], ln);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unregister_pointer ( string  id,
observer  which 
)

Definition at line 45 of file link.cpp.

                                               {
  // cout << "Unregister: " << id << " -> " << which << "\n";
  // cout << "Unregister: " << id << " -> " << obtain_tree (which) << "\n";
  list<observer>& l1= id_resolve (id);
  l1= remove (l1, which);
  if (is_nil (l1)) id_resolve->reset (id);
  list<string>& l2= pointer_resolve (which);
  l2= remove (l2, id);
  if (is_nil (l2)) pointer_resolve->reset (which);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unregister_vertex ( tree  v,
soft_link  ln 
)

Definition at line 63 of file link.cpp.

                                         {
  list<soft_link>& l= vertex_occurrences (v);
  l= remove (l, ln);
  if (is_nil (l)) vertex_occurrences->reset (v);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

string current_locus_color = "#404080" [static]

Definition at line 23 of file link.cpp.

string current_locus_on_paper = "preserve" [static]

Definition at line 22 of file link.cpp.

string current_visited_color = "#702070" [static]

Definition at line 24 of file link.cpp.

Definition at line 17 of file link.cpp.

Definition at line 18 of file link.cpp.

Definition at line 18 of file new_document.cpp.

Definition at line 19 of file link.cpp.

Definition at line 26 of file link.cpp.