Back to index

texmacs  1.0.7.15
bridge.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : bridge.hpp
00004 * DESCRIPTION: Bridge between logical and physically typesetted document
00005 * COPYRIGHT  : (C) 1999  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 #ifndef BRIDGE_H
00013 #define BRIDGE_H
00014 #include "typesetter.hpp"
00015 #include "Concat/concater.hpp"
00016 #include "Stack/stacker.hpp"
00017 #include "Format/page_item.hpp"
00018 #include "Page/vpenalty.hpp"
00019 #include "Page/skeleton.hpp"
00020 #include "Page/pager.hpp"
00021 
00022 #define VALID_MASK        1
00023 #define CORRUPTED         0
00024 #define PROCESSED         1
00025 
00026 #define WANTED_MASK       2
00027 #define WANTED_PARAGRAPH  0
00028 #define WANTED_PARUNIT    2
00029 
00030 #define MACRO_ASSIGN      0
00031 #define MACRO_INSERT      1
00032 #define MACRO_REMOVE      2
00033 
00034 class bridge;
00035 class bridge_rep: public abstract_struct {
00036 public:
00037   typesetter           ttt;      // the underlying typesetter
00038   edit_env&            env;      // the environment
00039   tree                 st;       // the present subtree
00040   path                 ip;       // source location of the paragraph
00041   int                  status;   // status among above values
00042   hashmap<string,tree> changes;  // changes in the environment
00043 
00044   array<page_item>     l;        // the typesetted lines of st
00045   stack_border         sb;       // border properties of l
00046   link_repository      link_env; // loci and links declared inside bridge
00047 
00048 public:
00049   bridge_rep (typesetter ttt, tree st, path ip);
00050   inline virtual ~bridge_rep () {}
00051 
00052   virtual void notify_assign (path p, tree u) = 0;
00053   virtual void notify_insert (path p, tree u);
00054   virtual void notify_remove (path p, int nr);
00055   virtual void notify_split  (path p);
00056   virtual void notify_join   (path p);
00057   virtual bool notify_macro  (int type, string var, int l, path p, tree u) = 0;
00058   virtual void notify_change () = 0;
00059 
00060   virtual void my_clean_links ();
00061   virtual void my_exec_until (path p);
00062   virtual bool my_typeset_will_be_complete ();
00063   virtual void my_typeset (int desired_status);
00064   virtual void exec_until (path p, bool skip_flag= false);
00065   void typeset (int desired_status);
00066 };
00067 
00068 class bridge {
00069   ABSTRACT_NULL(bridge);
00070   bool operator == (bridge br2);
00071   bool operator != (bridge br2);
00072   friend bridge make_bridge (typesetter ttt, tree st, path ip);
00073   friend void replace_bridge (bridge& br, tree st, path ip);
00074   friend void replace_bridge (bridge& br, path p, tree ot, tree nt, path ip);
00075 };
00076 ABSTRACT_NULL_CODE(bridge);
00077 
00078 bridge make_bridge (typesetter ttt, tree t, path p);
00079 tm_ostream& operator << (tm_ostream& out, bridge br);
00080 extern bridge nil_bridge;
00081 tree substitute (tree t, path p, tree u);
00082 
00083 #include "impl_typesetter.hpp"
00084 
00085 #endif // defined BRIDGE_H