Back to index

texmacs  1.0.7.15
new_document.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : new_document.cpp
00004 * DESCRIPTION: Management of the global TeXmacs tree
00005 * COPYRIGHT  : (C) 1999-2011  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #include "new_document.hpp"
00013 
00014 /******************************************************************************
00015 * Management of all edit trees
00016 ******************************************************************************/
00017 
00018 tree the_et;
00019 
00020 path
00021 new_document () {
00022   int i, n= N(the_et);
00023   for (i=0; i<n; i++)
00024     if (the_et[i] == UNINIT) {
00025       assign (the_et[i], tree (DOCUMENT, ""));
00026       return path (i); // obtain_ip (the_et[i]);
00027     }
00028   insert (the_et, n, tuple (tree (DOCUMENT, "")));
00029   return path (n); // obtain_ip (the_et[n]);
00030 }
00031 
00032 void
00033 delete_document (path rp) {
00034   assign (subtree (the_et, rp), UNINIT);
00035   clean_observers (subtree (the_et, rp));
00036 }
00037 
00038 void
00039 set_document (path rp, tree t) {
00040   //assign (subtree (the_et, rp), t);
00041   assign (subtree (the_et, rp), copy (t));
00042 }