00001 00002 #include <basix/int.hpp> 00003 #include <basix/vector.hpp> 00004 #include <basix/port.hpp> 00005 #include <mmxlight/shell.hpp> 00006 #include <basix/alias.hpp> 00007 #include <basix/glue.hpp> 00008 00009 #define int_literal(x) as_int (as_string (x)) 00010 00011 namespace mmx { 00012 static bool 00013 GLUE_1 (const generic &arg_1) { 00014 return source_exists (arg_1); 00015 } 00016 00017 static string 00018 GLUE_2 (const generic &arg_1) { 00019 return source_file (arg_1); 00020 } 00021 00022 static int 00023 GLUE_3 (const generic &arg_1, const bool &arg_2) { 00024 return source_line (arg_1, arg_2); 00025 } 00026 00027 static int 00028 GLUE_4 (const generic &arg_1, const bool &arg_2) { 00029 return source_column (arg_1, arg_2); 00030 } 00031 00032 static string 00033 GLUE_5 (const generic &arg_1) { 00034 return source_string (arg_1); 00035 } 00036 00037 static string 00038 GLUE_6 (const generic &arg_1) { 00039 return source_string_unindented (arg_1); 00040 } 00041 00042 static string 00043 GLUE_7 (const generic &arg_1) { 00044 return source_underlined (arg_1); 00045 } 00046 00047 static string 00048 GLUE_8 (const generic &arg_1) { 00049 return source_begin (arg_1); 00050 } 00051 00052 static string 00053 GLUE_9 (const generic &arg_1) { 00054 return source_end (arg_1); 00055 } 00056 00057 static string 00058 GLUE_10 (const string &arg_1, const generic &arg_2) { 00059 return source_error (arg_1, arg_2); 00060 } 00061 00062 static vector<generic> 00063 GLUE_11 () { 00064 return itf_history (); 00065 } 00066 00067 static void 00068 GLUE_12 (const int &arg_1) { 00069 itf_exit (arg_1); 00070 } 00071 00072 static void 00073 GLUE_13 () { 00074 itf_quit (); 00075 } 00076 00077 void 00078 glue_interface () { 00079 static bool done = false; 00080 if (done) return; 00081 done = true; 00082 call_glue (string ("glue_int")); 00083 call_glue (string ("glue_string")); 00084 call_glue (string ("glue_basix_vector_generic")); 00085 static alias<bool> quiet_flag_alias = global_alias (((bool&) quiet_flag)); 00086 define_constant<alias<bool> > ("quiet_mode?", quiet_flag_alias); 00087 static alias<bool> debug_flag_alias = global_alias (((bool&) debug_flag)); 00088 define_constant<alias<bool> > ("debug_mode?", debug_flag_alias); 00089 static alias<bool> type_flag_alias = global_alias (((bool&) type_flag)); 00090 define_constant<alias<bool> > ("type_mode?", type_flag_alias); 00091 static alias<bool> time_flag_alias = global_alias (((bool&) time_flag)); 00092 define_constant<alias<bool> > ("time_mode?", time_flag_alias); 00093 static alias<bool> math_mode_alias = global_alias (((bool&) math_mode)); 00094 define_constant<alias<bool> > ("math_mode?", math_mode_alias); 00095 static alias<bool> batch_flag_alias = global_alias (((bool&) batch_flag)); 00096 define_constant<alias<bool> > ("batch_mode?", batch_flag_alias); 00097 static alias<bool> texmacs_mode_alias = global_alias (((bool&) texmacs_mode)); 00098 define_constant<alias<bool> > ("texmacs_mode?", texmacs_mode_alias); 00099 define ("source_exists?", GLUE_1); 00100 define ("source_file", GLUE_2); 00101 define ("source_line", GLUE_3); 00102 define ("source_column", GLUE_4); 00103 define ("source_string", GLUE_5); 00104 define ("source_string_unindented", GLUE_6); 00105 define ("source_underlined", GLUE_7); 00106 define ("source_begin", GLUE_8); 00107 define ("source_end", GLUE_9); 00108 define ("source_error", GLUE_10); 00109 static alias<int> history_len_alias = global_alias (((int&) history_len)); 00110 define_constant<alias<int> > ("history_len", history_len_alias); 00111 define ("history", GLUE_11); 00112 define ("exit", GLUE_12); 00113 define ("quit", GLUE_13); 00114 } 00115 }