Back to index

texmacs  1.0.7.15
clean_copy.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : clean_copy.cpp
00004 * DESCRIPTION: maintain a clean copy of the edit tree
00005 * COPYRIGHT  : (C) 2006  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 "clean_copy.hpp"
00013 
00014 /******************************************************************************
00015 * Attaching ips
00016 ******************************************************************************/
00017 
00018 void
00019 copy_ip (tree src, tree dest) {
00020   path src_ip= obtain_ip (src);
00021   path dest_ip= obtain_ip (dest);
00022   if (dest_ip != src_ip) {
00023     dest->obs= list_observer (ip_observer (src_ip), dest->obs);
00024     if (is_compound (src)) {
00025       int i, n= N(src);
00026       for (i=0; i<n; i++)
00027        copy_ip (src[i], dest[i]);
00028     }
00029   }
00030 }
00031 
00032 /******************************************************************************
00033 * Clean copy callbacks
00034 ******************************************************************************/
00035 
00036 void
00037 copy_announce (tree src, tree& cct, modification mod) {
00038   //cout << "Announce copy " << mod << "\n";
00039   cct= clean_apply (cct, mod);
00040   copy_ip (src, cct);
00041 }