+/** This class stores information about a registered print_context class. */
+class print_context_options {
+public:
+ print_context_options(const char *n, const char *p, unsigned i)
+ : name(n), parent_name(p), id(i) {}
+
+ const char *get_name() const { return name; }
+ const char *get_parent_name() const { return parent_name; }
+ unsigned get_id() const { return id; }
+
+private:
+ const char *name; /**< Class name. */
+ const char *parent_name; /**< Name of superclass. */
+ unsigned id; /**< ID number (assigned automatically). */
+};
+
+typedef class_info<print_context_options> print_context_class_info;
+
+
+/** Flags to control the behavior of a print_context. */
+class print_options {
+public:
+ enum {
+ print_index_dimensions = 0x0001 ///< print the dimensions of indices
+ };
+};
+
+
+/** Macro for inclusion in the declaration of a print_context class.
+ * It declares some functions that are common to all classes derived
+ * from 'print_context' as well as all required stuff for the GiNaC
+ * registry. */
+#define GINAC_DECLARE_PRINT_CONTEXT(classname, supername) \
+public: \
+ typedef supername inherited; \
+ friend class function_options; \
+ friend class registered_class_options; \
+public: \
+ static const GiNaC::print_context_class_info &get_class_info_static(); \
+ virtual const GiNaC::print_context_class_info &get_class_info() const { return classname::get_class_info_static(); } \
+ virtual const char *class_name() const { return classname::get_class_info_static().options.get_name(); } \
+ \
+ classname(); \
+ virtual classname * duplicate() const { return new classname(*this); } \
+private:
+
+/** Macro for inclusion in the implementation of each print_context class. */
+#define GINAC_IMPLEMENT_PRINT_CONTEXT(classname, supername) \
+const GiNaC::print_context_class_info &classname::get_class_info_static() \
+{ \
+ static GiNaC::print_context_class_info reg_info = GiNaC::print_context_class_info(GiNaC::print_context_options(#classname, #supername, GiNaC::next_print_context_id++)); \
+ return reg_info; \
+}
+
+
+extern unsigned next_print_context_id;
+
+
+/** Base class for print_contexts. */