Back to index

texmacs  1.0.7.15
drd_info.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : drd_info.hpp
00004 * DESCRIPTION: data relation descriptions
00005 * COPYRIGHT  : (C) 2003  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 DRD_INFO_H
00013 #define DRD_INFO_H
00014 #include "tree.hpp"
00015 #include "rel_hashmap.hpp"
00016 #include "tag_info.hpp"
00017 
00018 class drd_info;
00019 class drd_info_rep: concrete_struct {
00020 public:
00021   string name;
00022   rel_hashmap<tree_label,tag_info> info;
00023   hashmap<string,tree> env;
00024 
00025 public:
00026   drd_info_rep (string name);
00027   drd_info_rep (string name, drd_info base);
00028   tree get_locals ();
00029   bool set_locals (tree t);
00030   bool contains (string l);
00031 
00032   /* Properties of the tag itself */
00033   void set_type (tree_label tag, int tp);
00034   int  get_type (tree_label tag);
00035   void freeze_type (tree_label tag);
00036   int  get_type (tree t);
00037 
00038   void set_arity (tree_label tag, int arity, int extra, int am, int cm);
00039   int  get_arity_mode (tree_label tag);
00040   int  get_arity_base (tree_label tag);
00041   int  get_arity_extra (tree_label tag);
00042   int  get_child_mode (tree_label tag);
00043   int  get_nr_indices (tree_label tag);
00044   void freeze_arity (tree_label tag);
00045   int  get_old_arity (tree_label l);
00046   int  get_minimal_arity (tree_label l);
00047   int  get_maximal_arity (tree_label l);
00048   bool correct_arity (tree_label l, int i);
00049   bool insert_point (tree_label l, int i, int n);
00050   bool is_dynamic (tree t, bool hack= true);
00051 
00052   void set_border (tree_label tag, int mode);
00053   int  get_border (tree_label tag);
00054   void freeze_border (tree_label tag);
00055   bool is_child_enforcing (tree t);
00056   bool is_parent_enforcing (tree t);
00057   bool var_without_border (tree_label tag);
00058 
00059   void set_block (tree_label tag, int is_block);
00060   int  get_block (tree_label tag);
00061   void freeze_block (tree_label tag);
00062 
00063   void set_with_like (tree_label tag, bool is_with_like);
00064   bool get_with_like (tree_label tag);
00065   void freeze_with_like (tree_label tag);
00066   bool is_with_like (tree t);
00067 
00068   void set_attribute (tree_label tag, string which, tree val);
00069   tree get_attribute (tree_label tag, string which);
00070   void set_name (tree_label tag, string val);
00071   void set_long_name (tree_label tag, string val);
00072   void set_syntax (tree_label tag, tree val);
00073   string get_name (tree_label tag);
00074   string get_long_name (tree_label tag);
00075   tree   get_syntax (tree_label tag);
00076   tree   get_syntax (tree t, path p= path (-1));
00077 
00078   /* Properties of the children of the tag */
00079   void set_type (tree_label tag, int nr, int tp);
00080   int  get_type (tree_label tag, int nr);
00081   void freeze_type (tree_label tag, int nr);
00082   int  get_type_child (tree t, int child);
00083 
00084   void set_accessible (tree_label tag, int nr, int access_mode);
00085   int  get_accessible (tree_label tag, int nr);
00086   void freeze_accessible (tree_label tag, int nr);
00087   bool all_accessible (tree_label tag);
00088   bool none_accessible (tree_label tag);
00089   bool is_accessible_child (tree t, int child);
00090 
00091   void set_writability (tree_label tag, int nr, int writability);
00092   int  get_writability (tree_label tag, int nr);
00093   void freeze_writability (tree_label tag, int nr);
00094   int  get_writability_child (tree t, int child);
00095 
00096   void set_block (tree_label tag, int nr, int require_block);
00097   int  get_block (tree_label tag, int nr);
00098   void freeze_block (tree_label tag, int nr);
00099 
00100   void set_env (tree_label tag, int nr, tree env);
00101   tree get_env (tree_label tag, int nr);
00102   void freeze_env (tree_label tag, int nr);
00103   tree get_env_child (tree t, int child, tree env);
00104   tree get_env_child (tree t, int child, string var, tree val);
00105   tree get_env_descendant (tree t, path p, tree env);
00106 
00107   void set_child_name (tree_label tag, int nr, string val);
00108   void set_child_long_name (tree_label tag, int nr, string val);
00109   string get_child_name (tree_label tag, int nr);
00110   string get_child_long_name (tree_label tag, int nr);
00111   string get_child_name (tree t, int child);
00112   string get_child_long_name (tree t, int child);
00113 
00114   /* Heuristic initialization */
00115   void set_environment (hashmap<string,tree> env);
00116   tree arg_access (tree t, tree arg, tree env, int& type);
00117   bool heuristic_with_like (tree t, tree arg);
00118   bool heuristic_init_macro (string var, tree macro);
00119   bool heuristic_init_xmacro (string var, tree xmacro);
00120   void heuristic_init (hashmap<string,tree> env);
00121 
00122   friend class drd_info;
00123   friend tm_ostream& operator << (tm_ostream& out, drd_info drd);
00124 };
00125 
00126 class drd_info {
00127   CONCRETE(drd_info);
00128   drd_info (string name);
00129   drd_info (string name, drd_info base);
00130   operator tree ();
00131 };
00132 CONCRETE_CODE(drd_info);
00133 
00134 tree drd_env_write (tree env, string var, tree val);
00135 tree drd_env_merge (tree env, tree t);
00136 tree drd_env_read (tree env, string var, tree val= tree (UNINIT));
00137 
00138 #endif // defined DRD_INFO_H