Back to index

Go to the documentation of this file.
00002 /******************************************************************************
00003 * MODULE     : concater.hpp
00004 * DESCRIPTION: Typesetting concatenations in two stages.
00005 *                - produce an array of line items
00006 *                - handle brackets and scripts
00007 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00008 *******************************************************************************
00009 * This software falls under the GNU general public license version 3 or later.
00010 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00011 * in the root directory or <>.
00012 ******************************************************************************/
00014 #ifndef CONCATER_H
00015 #define CONCATER_H
00016 #include "typesetter.hpp"
00017 #include "Format/line_item.hpp"
00018 #include "Boxes/construct.hpp"
00020 #define MODE_JUSTIFY   0
00021 #define MODE_LEFT      1
00022 #define MODE_CENTER    2
00023 #define MODE_RIGHT     3
00025 class concater_rep {
00026   edit_env              env;        // the environment
00027   array<line_item>      a;          // the line items
00028   bool                  rigid;      // when surely not wrappable
00030   // useful subroutines
00031   void print (box b);
00032   void print (int type, int op_type, box b);
00033   void control (tree t, path ip);
00034   void marker (path ip);
00035   void ghost (string s, path ip);
00036   void ghost (string s, path ip, color col);
00037   void flag_ok (string s, path ip, color col);
00038   void flag (string s, path ip, color col);
00039   void print (space spc);
00040   void penalty_min (int p);
00041   void penalty_max (int p);
00042   void with_limits (int status);
00044   // textual markup
00045   void typeset_substring (string s, path ip, int pos);
00046   void typeset_math_substring (string s, path ip, int pos, int op_type);
00047   void typeset_colored_substring (string s, path ip, int pos, string col);
00048   void typeset_text_string (tree t, path ip, int start, int end);
00049   void typeset_math_string (tree t, path ip, int start, int end);
00050   void typeset_prog_string (tree t, path ip, int start, int end);
00051   void typeset_document (tree t, path ip);
00052   void typeset_paragraph (tree t, path ip);
00053   void typeset_surround (tree t, path ip);
00054   void typeset_concat (tree t, path ip);
00055   void typeset_rigid (tree t, path ip);
00056   void typeset_hspace (tree t, path ip);
00057   void typeset_space (tree t, path ip);
00058   void typeset_move (tree t, path ip);
00059   void typeset_shift (tree t, path ip);
00060   void typeset_resize (tree t, path ip);
00061   void typeset_clipped (tree t, path ip);
00062   void typeset_float (tree t, path ip);
00063   void typeset_repeat (tree t, path ip);
00064   void typeset_formatting (tree t, path ip, string var);
00065   void typeset_decorated_box (tree t, path ip);
00067   // mathematical markup
00068   void typeset_around (tree t, path ip, bool colored);
00069   void typeset_large (tree t, path ip, int type, int op_type, string prefix);
00070   //void typeset_left (tree t, path ip);
00071   //void typeset_middle (tree t, path ip);
00072   //void typeset_right (tree t, path ip);
00073   void typeset_bigop (tree t, path ip);
00074   void typeset_long_arrow (tree t, path ip);
00075   void typeset_lprime (tree t, path ip);
00076   void typeset_rprime (tree t, path ip);
00077   void typeset_below (tree t, path ip);
00078   void typeset_above (tree t, path ip);
00079   void typeset_script (tree t, path ip, bool right);
00080   void typeset_frac (tree t, path ip);
00081   void typeset_sqrt (tree t, path ip);
00082   void typeset_wide (tree t, path ip, bool above);
00083   void typeset_neg (tree t, path ip);
00084   void typeset_tree (tree t, path ip);
00085   void typeset_table (tree t, path ip);
00086   void typeset_syntax (tree t, path ip);
00088   // disactivated markup
00089   void typeset_blue (tree t, path ip);
00090   void typeset_src_open (tree t, path ip, string extra);
00091   void typeset_src_middle (tree t, path ip, int i);
00092   void typeset_src_close (tree t, path ip);
00093   void typeset_src_args (tree t, path ip);
00094   void typeset_src_tag (tree t, path ip);
00095   void typeset_inactive (tree t, path ip);
00096   void typeset_error (tree t, path ip);
00098   // active macro mechanisms
00099   void typeset_assign (tree t, path ip);
00100   void typeset_with (tree t, path ip);
00101   void typeset_compound (tree t, path ip);
00102   void typeset_auto (tree t, path ip, tree macro);
00103   void typeset_include (tree t, path ip);
00104   void typeset_drd_props (tree t, path ip);
00105   void typeset_eval (tree t, path ip);
00106   void typeset_value (tree t, path ip);
00107   void typeset_argument (tree t, path ip);
00108   void typeset_eval_args (tree t, path ip);
00109   void typeset_mark (tree t, path ip);
00110   void typeset_expand_as (tree t, path ip);
00111   void typeset_dynamic (tree t, path ip);
00112   void typeset_executable (tree t, path ip);
00113   void typeset_rewrite (tree t, path ip);
00115   // miscellaneous active markup
00116   void typeset_if (tree t, path ip);
00117   void typeset_var_if (tree t, path ip);
00118   void typeset_case (tree t, path ip);
00119   void typeset_range (tree t, path ip);
00120   void typeset_locus (tree t, path ip);
00121   void typeset_set_binding (tree t, path ip);
00122   void typeset_write (tree t, path ip);
00123   void typeset_specific (tree t, path ip);
00124   void typeset_flag (tree t, path ip);
00126   // animations
00127   void typeset_anim_compose (tree t, path ip);
00128   void typeset_anim_repeat (tree t, path ip);
00129   void typeset_anim_constant (tree t, path ip);
00130   void typeset_anim_translate (tree t, path ip);
00131   void typeset_anim_progressive (tree t, path ip);
00132   void typeset_video (tree t, path ip);
00133   void typeset_sound (tree t, path ip);
00135   // graphical markup
00136   void typeset_graphical (array<box>& bs, tree t, path ip);
00137   void typeset_graphics (tree t, path ip);
00138   void typeset_superpose (tree t, path ip);
00139   void typeset_gr_group (tree t, path ip);
00140   void typeset_gr_linear_transform (tree t, path ip);
00141   void typeset_text_at (tree t, path ip);
00142   void typeset_math_at (tree t, path ip);
00143   void typeset_point (tree t, path ip);
00144   array<box> typeset_line_arrows (path ip);
00145   void typeset_line (tree t, path ip, bool close);
00146   void typeset_arc (tree t, path ip, bool close);
00147   void typeset_spline (tree t, path ip, bool close);
00148   void typeset_var_spline (tree t, path ip);
00149   void typeset_cspline (tree t, path ip);
00150   void typeset_fill (tree t, path ip);
00151   void typeset_image (tree t, path ip);
00153   // markup for graphical user interface
00154   void typeset_canvas (tree t, path ip);
00155   void typeset_ornament (tree t, path ip);
00157   // postprocessing of brackets and scripts
00158   int  prec (int i);
00159   int  succ (int i);
00160   void pre_glue ();
00161   void glue (box b, int ref, int arg);
00162   void glue (box b, int ref, int arg1, int arg2);
00163   void clean_and_correct ();
00164   void handle_scripts (int start, int end);
00165   void handle_matching (int start, int end);
00166   void handle_brackets ();
00167   void kill_spaces ();
00169 public:
00170   concater_rep (edit_env env, bool rigid= false);
00171   void typeset (tree t, path ip);
00172   void finish ();
00174   friend class liner_rep;
00175   friend class par_line_rep;
00176   friend class typesetter_rep;
00177   friend class document_rep;
00179   friend box              typeset_as_concat (edit_env env, tree t, path ip);
00180   friend box              typeset_as_box (edit_env env, tree t, path ip);
00181   friend box              typeset_as_atomic (edit_env env, tree t, path ip);
00182   friend array<line_item> typeset_concat (edit_env env, tree t, path ip);
00183   friend array<line_item> typeset_concat_range (edit_env env, tree t, path ip,
00184                                           int i1, int i2);
00185   friend array<line_item> typeset_marker (edit_env env, path ip);
00186 };
00188 typedef concater_rep* concater;
00190 box typeset_as_concat (edit_env env, tree t, path ip);
00191 array<line_item> typeset_concat (edit_env env, tree t, path ip);
00192 array<line_item> typeset_concat_range (edit_env env, tree t, path ip,
00193                                    int i1, int i2);
00194 array<line_item> typeset_marker (edit_env env, path ip);
00196 #endif // defined CONCATER_H