Back to index

texmacs  1.0.7.15
Functions | Variables
archiver.cpp File Reference
#include "archiver.hpp"
#include "hashset.hpp"
#include "iterator.hpp"

Go to the source code of this file.

Functions

array< patchsingleton (patch p)
static patch make_compound (array< patch > a)
static patch make_branches (array< patch > a)
void archive_announce (archiver_rep *arch, modification mod)
void global_clear_history ()
void global_confirm ()
static patch append_branches (patch p1, patch p2)
static patch make_history (patch undo, patch redo)
static int nr_undo (patch p)
static int nr_redo (patch p)
static patch get_undo (patch p)
static patch get_redo (patch p)
static patch car (patch p)
static patch cdr (patch p)
static bool is_marker (patch p, double m, bool birth)
static patch remove_marker (patch archive, double m)

Variables

tree the_et
static hashset< double > genuine_authors
static hashset< pointerarchs
static hashset< pointerpending_archs

Function Documentation

static patch append_branches ( patch  p1,
patch  p2 
) [static]

Definition at line 121 of file archiver.cpp.

                                     {
  return make_branches (append (branches (p1), branches (p2)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void archive_announce ( archiver_rep arch,
modification  mod 
)

Definition at line 73 of file archiver.cpp.

                                                        {
  //cout << "Archive " << mod << "\n";
  if (DEBUG_HISTORY) cout << "Archive " << mod << "\n";
  ASSERT (arch->rp <= mod->p, "invalid modification");
  if (!arch->versioning) {
    arch->add (mod);
    pending_archs->insert ((pointer) arch);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static patch car ( patch  p) [static]

Definition at line 156 of file archiver.cpp.

              {
  ASSERT (nr_children (branch (p, 0)) == 2, "car unavailable")
  return child (p, 0);
}

Here is the call graph for this function:

static patch cdr ( patch  p) [static]

Definition at line 162 of file archiver.cpp.

              {
  ASSERT (nr_children (branch (p, 0)) == 2, "cdr unavailable")
  return child (p, 1);
}

Here is the call graph for this function:

static patch get_redo ( patch  p) [static]

Definition at line 150 of file archiver.cpp.

                   {
  if (nr_branches (p) == 0) return make_branches (array<patch> ());
  return make_branches (branches (p, 1, nr_branches (p)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static patch get_undo ( patch  p) [static]

Definition at line 144 of file archiver.cpp.

                   {
  ASSERT (nr_branches (p) > 0, "undo part unavailable");
  return branch (p, 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 85 of file archiver.cpp.

                        {
  iterator<pointer> it = iterate (archs);
  while (it->busy()) {
    archiver_rep* arch= (archiver_rep*) it->next();
    arch->clear ();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void global_confirm ( )

Definition at line 94 of file archiver.cpp.

                  {
  iterator<pointer> it = iterate (pending_archs);
  while (it->busy()) {
    archiver_rep* arch= (archiver_rep*) it->next();
    arch->confirm ();
    arch->simplify ();
  }
  pending_archs= hashset<pointer> ();
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bool is_marker ( patch  p,
double  m,
bool  birth 
) [static]

Definition at line 508 of file archiver.cpp.

                                          {
  if (get_type (p) == PATCH_AUTHOR)
    return is_marker (p[0], m, birth);
  else if (get_type (p) == PATCH_BIRTH)
    return get_author (p) == m && get_birth (p) == birth;
  else return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static patch make_branches ( array< patch a) [static]

Definition at line 115 of file archiver.cpp.

                               {
  if (N(a) == 1) return a[0];
  else return patch (true, a);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static patch make_compound ( array< patch a) [static]

Definition at line 109 of file archiver.cpp.

                               {
  if (N(a) == 1) return a[0];
  else return patch (false, a);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static patch make_history ( patch  undo,
patch  redo 
) [static]

Definition at line 126 of file archiver.cpp.

                                      {
  array<patch> a;
  a << undo << branches (redo);
  return make_branches (a);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int nr_redo ( patch  p) [static]

Definition at line 139 of file archiver.cpp.

                  {
  return max (0, nr_branches (p) - 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int nr_undo ( patch  p) [static]

Definition at line 133 of file archiver.cpp.

                  {
  if (nr_branches (p) == 0 || nr_children (branch (p, 0)) != 2) return 0;
  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static patch remove_marker ( patch  archive,
double  m 
) [static]

Definition at line 517 of file archiver.cpp.

                                        {
  ASSERT (nr_undo (archive) != 0, "marker not found");
  if (is_marker (car (get_undo (archive)), m, false)) {
    ASSERT (nr_redo (archive) == 0, "cannot remove marker");
    return cdr (get_undo (archive));
  }
  else {
    patch un= get_undo (archive);
    patch re= get_redo (archive);
    return make_history (patch (car (un), remove_marker (cdr (un), m)), re);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 92 of file patch.cpp.

                    {
  array<patch> a (1);
  a[0]= p;
  return a;
}

Here is the caller graph for this function:


Variable Documentation

hashset<pointer> archs [static]

Definition at line 21 of file archiver.cpp.

hashset<double> genuine_authors [static]

Definition at line 20 of file archiver.cpp.

Definition at line 22 of file archiver.cpp.

Definition at line 18 of file new_document.cpp.