basix_doc 0.1
/Users/mourrain/Devel/mmx/basix/glue/glue_document.cpp
Go to the documentation of this file.
00001 
00002 #include <basix/vector.hpp>
00003 #include <basix/port.hpp>
00004 #include <basix/literal.hpp>
00005 #include <basix/document.hpp>
00006 #include <basix/mmx_syntax.hpp>
00007 #include <basix/tuple.hpp>
00008 #include <basix/glue.hpp>
00009 
00010 #define is_generic_literal is<literal>
00011 #define literal_apply(f,v) gen (as<generic> (f), v)
00012 #define literal_access(f,v) access (as<generic> (f), v)
00013 #define empty_vector() as<generic> (vec<generic> ())
00014 
00015 namespace mmx {
00016   static document
00017   GLUE_1 (const generic &arg_1) {
00018     return as_document (arg_1);
00019   }
00020   
00021   static document
00022   GLUE_2 (const document &arg_1) {
00023     return document (arg_1);
00024   }
00025   
00026   static generic
00027   GLUE_3 (const document &arg_1) {
00028     return as_generic (arg_1);
00029   }
00030   
00031   static document
00032   GLUE_4 (const string &arg_1) {
00033     return document (arg_1);
00034   }
00035   
00036   static document
00037   GLUE_5 (const string &arg_1, const tuple<document> &arg_2) {
00038     return make_texmacs (arg_1, as_vector (arg_2));
00039   }
00040   
00041   static document
00042   GLUE_6 (const literal &arg_1, const tuple<document> &arg_2) {
00043     return make_texmacs (arg_1, as_vector (arg_2));
00044   }
00045   
00046   static document
00047   GLUE_7 (const generic &arg_1) {
00048     return make_text (arg_1);
00049   }
00050   
00051   static document
00052   GLUE_8 (const document &arg_1) {
00053     return make_text (arg_1);
00054   }
00055   
00056   static document
00057   GLUE_9 (const generic &arg_1) {
00058     return make_math (arg_1);
00059   }
00060   
00061   static document
00062   GLUE_10 (const document &arg_1) {
00063     return make_math (arg_1);
00064   }
00065   
00066   static document
00067   GLUE_11 (const tuple<document> &arg_1) {
00068     return make_inline (as_vector (arg_1));
00069   }
00070   
00071   static document
00072   GLUE_12 (const tuple<document> &arg_1) {
00073     return make_block (as_vector (arg_1));
00074   }
00075   
00076   static document
00077   GLUE_13 (const tuple<document> &arg_1) {
00078     return make_row (as_vector (arg_1));
00079   }
00080   
00081   void
00082   glue_document () {
00083     static bool done = false;
00084     if (done) return;
00085     done = true;
00086     call_glue (string ("glue_literal"));
00087     define_type<document > (lit ("Document"));
00088     define ("document", GLUE_1);
00089     define ("document", GLUE_2);
00090     define ("as_generic", GLUE_3);
00091     define_converter ("upgrade", GLUE_4, PENALTY_INCLUSION);
00092     define ("$tm", GLUE_5);
00093     define ("$tm", GLUE_6);
00094     define ("$text", GLUE_7);
00095     define ("$text", GLUE_8);
00096     define ("$math", GLUE_9);
00097     define ("$math", GLUE_10);
00098     define ("$inline", GLUE_11);
00099     define ("$block", GLUE_12);
00100     define ("(.)", GLUE_13);
00101   }
00102 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines