basix_doc 0.1
|
00001 00002 #include <basix/vector.hpp> 00003 #include <basix/port.hpp> 00004 #include <basix/tuple.hpp> 00005 #include <basix/glue.hpp> 00006 00007 namespace mmx { 00008 static port 00009 GLUE_1 (const string &arg_1) { 00010 return input_string_port (arg_1); 00011 } 00012 00013 static port 00014 GLUE_2 (const string &arg_1) { 00015 return input_file_port (arg_1); 00016 } 00017 00018 static port 00019 GLUE_3 (const string &arg_1) { 00020 return output_file_port (arg_1); 00021 } 00022 00023 static port 00024 GLUE_4 (const string &arg_1, const int &arg_2) { 00025 return socket_server_port (arg_1, arg_2); 00026 } 00027 00028 static port 00029 GLUE_5 (const string &arg_1, const int &arg_2) { 00030 return socket_client_port (arg_1, arg_2); 00031 } 00032 00033 static port 00034 GLUE_6 (const string &arg_1) { 00035 return pipe_port (arg_1); 00036 } 00037 00038 static port 00039 GLUE_7 (const tuple<port> &arg_1) { 00040 return composite_port (as_vector (arg_1)); 00041 } 00042 00043 static port 00044 GLUE_8 (const string &arg_1) { 00045 return error_port (arg_1); 00046 } 00047 00048 static bool 00049 GLUE_9 (const port &arg_1) { 00050 return is_output_port (arg_1); 00051 } 00052 00053 static bool 00054 GLUE_10 (const port &arg_1) { 00055 return is_input_port (arg_1); 00056 } 00057 00058 static bool 00059 GLUE_11 (const port &arg_1) { 00060 return error_flag (arg_1); 00061 } 00062 00063 static string 00064 GLUE_12 (const port &arg_1) { 00065 return error_message (arg_1); 00066 } 00067 00068 static bool 00069 GLUE_13 (const port &arg_1) { 00070 return busy (arg_1); 00071 } 00072 00073 static int 00074 GLUE_14 (const port &arg_1) { 00075 return can_write (arg_1); 00076 } 00077 00078 static int 00079 GLUE_15 (const port &arg_1) { 00080 return can_read (arg_1); 00081 } 00082 00083 static void 00084 GLUE_16 (const port &arg_1, const string &arg_2) { 00085 write (arg_1, arg_2); 00086 } 00087 00088 static string 00089 GLUE_17 (const port &arg_1, const int &arg_2) { 00090 return read (arg_1, arg_2); 00091 } 00092 00093 static void 00094 GLUE_18 (const port &arg_1) { 00095 flush (arg_1); 00096 } 00097 00098 static bool 00099 GLUE_19 (const port &arg_1, const int &arg_2) { 00100 return wait (arg_1, arg_2); 00101 } 00102 00103 static port 00104 GLUE_20 (const port &arg_1) { 00105 return accept (arg_1); 00106 } 00107 00108 static port 00109 GLUE_21 (const port &arg_1, const string &arg_2) { 00110 return component (arg_1, arg_2); 00111 } 00112 00113 static int 00114 GLUE_22 (const int &arg_1) { 00115 return wait_port_event (arg_1); 00116 } 00117 00118 static port 00119 GLUE_23 (const port &arg_1, const generic &arg_2) { 00120 return arg_1 << arg_2; 00121 } 00122 00123 static port 00124 GLUE_24 (const port &arg_1, const string &arg_2) { 00125 return arg_1 << arg_2; 00126 } 00127 00128 static generic 00129 GLUE_25 (const generic &arg_1) { 00130 return generic_assemble (arg_1); 00131 } 00132 00133 static generic 00134 GLUE_26 (const generic &arg_1) { 00135 return generic_disassemble (arg_1); 00136 } 00137 00138 static void 00139 GLUE_27 (const port &arg_1, const generic &arg_2) { 00140 binary_write_generic (arg_1, arg_2); 00141 } 00142 00143 static generic 00144 GLUE_28 (const port &arg_1) { 00145 return binary_read_generic (arg_1); 00146 } 00147 00148 void 00149 glue_port () { 00150 static bool done = false; 00151 if (done) return; 00152 done = true; 00153 call_glue (string ("glue_string")); 00154 define_type<port > (lit ("Port")); 00155 define_constant<port > ("mmin", mmin); 00156 define_constant<port > ("mmout", mmout); 00157 define_constant<port > ("mmerr", mmerr); 00158 define ("input_string_port", GLUE_1); 00159 define ("input_file_port", GLUE_2); 00160 define ("output_file_port", GLUE_3); 00161 define ("socket_server_port", GLUE_4); 00162 define ("socket_client_port", GLUE_5); 00163 define ("pipe_port", GLUE_6); 00164 define ("composite_port", GLUE_7); 00165 define ("error_port", GLUE_8); 00166 define (".output_port?", GLUE_9); 00167 define (".input_port?", GLUE_10); 00168 define (".error?", GLUE_11); 00169 define (".error", GLUE_12); 00170 define (".busy?", GLUE_13); 00171 define (".can_write", GLUE_14); 00172 define (".can_read", GLUE_15); 00173 define ("write", GLUE_16); 00174 define ("read", GLUE_17); 00175 define ("flush", GLUE_18); 00176 define ("wait", GLUE_19); 00177 define ("accept", GLUE_20); 00178 define (".[]", GLUE_21); 00179 define ("wait", GLUE_22); 00180 define ("<<", GLUE_23); 00181 define ("<<", GLUE_24); 00182 define ("binary_assemble", GLUE_25); 00183 define ("binary_disassemble", GLUE_26); 00184 define ("binary_write", GLUE_27); 00185 define ("binary_read", GLUE_28); 00186 } 00187 }