| routine mmx::access_routine | ( | nat | i, |
| nat | a, | ||
| nat | d | ||
| ) |
Definition at line 230 of file glue_class.cpp.
Referenced by mmx_class_intern().
{
return new access_routine_rep (i, a, d);
}
| routine mmx::alias_access_routine | ( | nat | i, |
| nat | a | ||
| ) |
Definition at line 275 of file glue_class.cpp.
Referenced by mmx_class_intern().
{
return new alias_access_routine_rep (i, a);
}
| evaluator base_evaluator | ( | const evaluator & | ev ) |
Definition at line 31 of file base_evaluator.cpp.
{
return new base_evaluator_rep (ev);
}
| evaluator base_evaluator | ( | ) |
Definition at line 26 of file base_evaluator.cpp.
Referenced by closure_routine_rep::apply(), mmx_class_module(), mmx_loop(), mmx_where(), and mmxlight_evaluator().
{
return new base_evaluator_rep ();
}
| static routine mmx::build | ( | const environment & | env, |
| const routine & | fun, | ||
| const vector< nat > & | ids1, | ||
| const vector< nat > & | ids2 | ||
| ) | [static] |
Definition at line 244 of file overload.cpp.
References untuple(), and via_tuple_routine().
Referenced by overloaded_routine_rep::resolve().
{
if (is_tuple_type (ids2[N(ids2)-1])) {
vector<nat> ids3= untuple (ids2, N(ids1));
routine vtfun= via_tuple_routine (fun, ids3, N(ids2));
return build (env, vtfun, ids1, ids3);
}
nat i, n= N(ids1) - 1;
vector<routine> v= fill<routine> (n);
for (i=0; i<n; i++) {
nat penalty;
generic r= env->get_converter (ids1[i+1], ids2[i+1], penalty);
ASSERT (is<routine> (r), "routine expected (build)");
v[i]= as<routine> (r);
}
return compose (fun, v);
}
| routine mmx::closure | ( | const evaluator & | ev, |
| const vector< nat > & | sig, | ||
| const generic & | args, | ||
| const generic & | body | ||
| ) |
Definition at line 396 of file glue_declare.cpp.
Referenced by mmx_lambda().
{
return new closure_routine_rep (ev, sig, args, body);
}
| static void mmx::complete | ( | const string & | text ) | [static] |
Definition at line 43 of file texmacs.cpp.
References get_environment(), identifiers_for_completion, is_nil(), matches(), output_completion(), and strings_for_completion().
Referenced by handle_completion_request().
{
list<string> matches, tomatch;
string name;
tomatch = identifiers_for_completion
* strings_for_completion (get_environment (current_ev));
while (!is_nil (tomatch)) {
name = car (tomatch);
tomatch = cdr (tomatch);
if (starts (name, text))
matches = cons (name (N(text), N(name)), matches);
}
output_completion (text, matches);
}
| static nat mmx::conversion_penalty | ( | const environment & | env, |
| const vector< nat > & | ids1, | ||
| const vector< nat > & | ids2 | ||
| ) | [static] |
Definition at line 230 of file overload.cpp.
References conversion_penalty(), and untuple().
{
if (N(ids1) < N(ids2)-1) return PENALTY_INVALID;
if (is_tuple_type (ids2[N(ids2)-1]))
return conversion_penalty (env, ids1, untuple (ids2, N(ids1)));
if (N(ids1) != N(ids2)) return PENALTY_INVALID;
nat i, n= N(ids1), penalty= 0;
for (i=1; i<n; i++)
penalty= max (penalty, conversion_penalty (env, ids1[i], ids2[i]));
return penalty;
}
| static nat mmx::conversion_penalty | ( | const environment & | env, |
| nat | id1, | ||
| nat | id2 | ||
| ) | [static] |
Definition at line 210 of file overload.cpp.
Referenced by conversion_penalty(), and overloaded_routine_rep::resolve().
{
nat penalty;
generic r= env->get_converter (id1, id2, penalty);
//mmout << " Convert " << id1 << ", " << id2 << " -> " << r << "\n";
ASSERT (is<routine> (r), "routine expected (conversion_penalty)");
return penalty;
}
| generic convert_to | ( | const generic & | r, |
| nat | t_id, | ||
| const generic & | where | ||
| ) |
Definition at line 22 of file glue_class.cpp.
References get_environment(), type(), and type_name().
Referenced by closure_routine_rep::apply(), eval_as(), mmx_assign(), mmx_loop(), mmx_op_assign(), and mmx_transtype().
{
nat r_id= type (r);
if (r_id == type_id<alias<generic> > ())
return convert_to (specialize_alias (r), t_id, where);
if (r_id == type_id<tuple<generic> > ())
if (is_tuple_type (t_id))
return r;
if (r_id == t_id) return r;
else {
nat pen;
generic cv= get_environment (current_ev)->get_converter (r_id, t_id, pen);
if (is<routine> (cv) && pen < PENALTY_INVALID)
return as<routine> (cv) -> apply (r);
else if (r == as<generic> (vec<generic> ())) {
generic sqbr;
if (current_ev->get (GEN_SQTUPLE, sqbr) && is<routine> (sqbr)) {
vector<routine> funs= as<routine> (sqbr) -> meanings ();
for (nat i=0; i<N(funs); i++) {
vector<nat> sig = funs[i]->signature();
if (sig[0] == t_id) {
if (N (sig) == 1) return funs[i]->apply ();
if (N (sig) == 2 && is_tuple_type (sig[1])) {
static generic empty= eval (gen (GEN_TUPLE));
return funs[i]->apply (empty);
}
}
}
}
}
return type_mismatch (type_name (t_id), where);
}
}
| static iterator<generic> mmx::count_iterator | ( | const int & | start, |
| const int & | end | ||
| ) | [static] |
Definition at line 204 of file glue_control.cpp.
Referenced by mmx_count().
{
return iterator<generic> (new count_iterator_rep (start, end));
}
| routine mmx::dynamic_routine | ( | const routine & | r ) |
Definition at line 80 of file overload.cpp.
Referenced by overloaded_routine_rep::resolve().
{
return new dynamic_routine_rep (r);
}
| generic equalize | ( | const generic & | fun, |
| const vector< generic > & | args | ||
| ) |
Definition at line 110 of file overload.cpp.
Referenced by equalize_grouped_routine_rep::apply(), and base_evaluator_rep::apply().
{
vector<generic> v= equalize (args);
if (N(v)>0 && is<exception> (v[N(v)-1])) return v[N(v)-1];
return gen (name, v);
}
| vector<generic> mmx::equalize | ( | const vector< generic > & | args ) |
Definition at line 89 of file overload.cpp.
References type().
{
vector<generic> v= vec<generic> ();
for (nat i=0; i<N(args); i++) {
if (is_tuple_type (type (args[i]))) {
vector<generic> w= compound_to_vector (*as<tuple<generic> > (args[i]));
v << cdr (w);
}
else if (is<iterator<generic> > (args[i])) {
iterator<generic> it= as<iterator<generic> > (args[i]);
while (busy (it)) {
generic next= *it; ++it;
v << next;
if (is<exception> (next)) return v;
}
}
else v << args[i];
}
return v;
}
| routine mmx::equalize_grouped_routine | ( | const routine & | fun, |
| const vector< nat > & | sig | ||
| ) |
Definition at line 131 of file overload.cpp.
Referenced by overloaded_routine_rep::resolve().
{
return new equalize_grouped_routine_rep (fun, sig);
}
| generic mmx::eval_as | ( | const generic & | g ) |
Definition at line 26 of file mmxlight_glue.hpp.
References convert_to().
{
generic r= eval (g);
if (is<C> (r) || is<exception> (r)) return r;
nat t_id= type_id<C> ();
return convert_to (r, t_id, g);
}
| routine mmx::exception_routine | ( | ) |
Definition at line 50 of file overload.cpp.
Referenced by overloaded_routine_rep::resolve().
{
return new exception_routine_rep ();
}
| routine mmx::exception_routine | ( | const generic & | f ) |
Definition at line 55 of file overload.cpp.
{
return new exception_routine_rep (f);
}
| iterator<generic> mmx::extract_iterator | ( | const evaluator & | ev, |
| const generic & | var, | ||
| const iterator< generic > & | it, | ||
| const generic & | cond, | ||
| const generic & | v | ||
| ) | [inline] |
Definition at line 290 of file glue_control.cpp.
Referenced by mmx_where().
{
return iterator<generic> (new extract_iterator_rep (ev, var, it, cond, v));
}
| syntactic mmx::flatten | ( | const var_exception & | e ) | [inline] |
| syntactic mmx::flatten | ( | const environment & | env ) | [inline] |
Definition at line 110 of file environment.hpp.
References is_nil().
Referenced by flatten(), and INDIRECT_IMPL().
{
if (is_nil (env)) return as_syntactic (GEN_NIL);
else return as_syntactic (env->name ()); }
| environment get_environment | ( | const evaluator & | ev ) |
Definition at line 45 of file base_evaluator.cpp.
Referenced by complete(), convert_to(), get_environment_type(), mmx_definition(), mmx_is_defined(), mmx_symbol_table(), mmx_use(), and set_environment_type().
{
return *((environment*) ev->get_internal_data ());
}
| nat get_environment_type | ( | const evaluator & | ev ) |
Definition at line 56 of file base_evaluator.cpp.
References get_environment().
{
return get_environment (ev) -> env_type;
}
| environment mmx::global_environment | ( | ) | [inline] |
Definition at line 114 of file environment.hpp.
{
return new environment_rep (); }
| static bool mmx::GLUE_1 | ( | const generic & | arg_1 ) | [static] |
Definition at line 13 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_exists (arg_1);
}
| static string mmx::GLUE_10 | ( | const string & | arg_1, |
| const generic & | arg_2 | ||
| ) | [static] |
Definition at line 58 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_error (arg_1, arg_2);
}
| static vector<generic> mmx::GLUE_11 | ( | ) | [static] |
Definition at line 63 of file glue_interface.cpp.
References mmx_history().
Referenced by glue_interface().
{
return mmx_history ();
}
| static void mmx::GLUE_12 | ( | const int & | arg_1 ) | [static] |
Definition at line 68 of file glue_interface.cpp.
References mmx_exit().
Referenced by glue_interface().
{
mmx_exit (arg_1);
}
| static void mmx::GLUE_13 | ( | ) | [static] |
Definition at line 73 of file glue_interface.cpp.
References mmx_quit().
Referenced by glue_interface().
{
mmx_quit ();
}
| static string mmx::GLUE_2 | ( | const generic & | arg_1 ) | [static] |
Definition at line 18 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_file (arg_1);
}
| static int mmx::GLUE_3 | ( | const generic & | arg_1, |
| const bool & | arg_2 | ||
| ) | [static] |
Definition at line 23 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_line (arg_1, arg_2);
}
| static int mmx::GLUE_4 | ( | const generic & | arg_1, |
| const bool & | arg_2 | ||
| ) | [static] |
Definition at line 28 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_column (arg_1, arg_2);
}
| static string mmx::GLUE_5 | ( | const generic & | arg_1 ) | [static] |
Definition at line 33 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_string (arg_1);
}
| static string mmx::GLUE_6 | ( | const generic & | arg_1 ) | [static] |
Definition at line 38 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_string_unindented (arg_1);
}
| static string mmx::GLUE_7 | ( | const generic & | arg_1 ) | [static] |
Definition at line 43 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_underlined (arg_1);
}
| static string mmx::GLUE_8 | ( | const generic & | arg_1 ) | [static] |
Definition at line 48 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_begin (arg_1);
}
| static string mmx::GLUE_9 | ( | const generic & | arg_1 ) | [static] |
Definition at line 53 of file glue_interface.cpp.
Referenced by glue_interface().
{
return source_end (arg_1);
}
| void mmx::glue_algebramix | ( | ) |
| void mmx::glue_analyziz | ( | ) |
| void mmx::glue_asymptotix | ( | ) |
| void mmx::glue_automagix | ( | ) |
| void mmx::glue_basix | ( | ) |
| void glue_class | ( | ) |
Definition at line 523 of file glue_class.cpp.
References make_literal_string(), mmx_category(), mmx_class(), mmx_module(), mmx_object(), mmx_transtype(), and mmx_unobject().
Referenced by glue_mmxlight().
{
current_ev->set (GEN_VOID_TYPE, GEN_GENERIC_TYPE);
define_type<string> ("String");
define ("literal_string", make_literal_string);
define (GEN_DUPLICATE, (generic (*) (const generic&)) duplicate);
define_primitive (GEN_TRANSTYPE, mmx_transtype);
define ("object", mmx_object);
define ("unobject", mmx_unobject);
define_type<module> ("Module");
define_primitive (GEN_CLASS, mmx_class);
define_primitive (GEN_MODULE, mmx_module);
define_primitive (GEN_CATEGORY, mmx_category);
define (GEN_IMPORT, mmx_import);
define ("contents", mmx_module_contents);
define ("resolve", mmx_module_resolve);
}
| void mmx::glue_columbus | ( | ) |
| void mmx::glue_continewz | ( | ) |
| void mmx::glue_control | ( | ) |
Referenced by glue_mmxlight().
| void glue_declare | ( | ) |
Definition at line 550 of file glue_declare.cpp.
References matches(), mmx_assign(), mmx_assign_macro(), mmx_assume(), mmx_backquote(), mmx_compose_compound(), mmx_compose_function(), mmx_compose_literal(), mmx_define(), mmx_define_macro(), mmx_forall(), mmx_lambda(), mmx_macro(), mmx_mapsto(), mmx_minus_assign(), mmx_over_assign(), mmx_penalty(), mmx_plus_assign(), mmx_quote(), mmx_return(), and mmx_times_assign().
Referenced by glue_mmxlight().
{
define_primitive (GEN_ASSUME, mmx_assume);
define_primitive (GEN_PENALTY, mmx_penalty);
define_primitive (GEN_FORALL, mmx_forall);
define_primitive (GEN_DEFINE, mmx_define);
define_primitive (GEN_ASSIGN, mmx_assign);
define_primitive (GEN_PLUS_ASSIGN, mmx_plus_assign);
define_primitive (GEN_MINUS_ASSIGN, mmx_minus_assign);
define_primitive (GEN_TIMES_ASSIGN, mmx_times_assign);
define_primitive (GEN_OVER_ASSIGN, mmx_over_assign);
define_primitive (GEN_LAMBDA, mmx_lambda);
define_primitive (GEN_MAPSTO, mmx_mapsto);
define_primitive (GEN_RETURN, mmx_return);
define_primitive (GEN_QUOTE, mmx_quote);
define_primitive (GEN_BACKQUOTE, mmx_backquote);
define_primitive (GEN_MACRO, mmx_macro);
define_primitive (GEN_DEFINE_MACRO, mmx_define_macro);
define_primitive (GEN_ASSIGN_MACRO, mmx_assign_macro);
define (GEN_COMPOSE, mmx_compose_function);
define (GEN_COMPOSE, mmx_compose_literal);
define (GEN_COMPOSE, mmx_compose_compound);
define ("matches_category?", matches);
}
| void mmx::glue_factorix | ( | ) |
| void mmx::glue_finitefieldz | ( | ) |
| void mmx::glue_graphix | ( | ) |
| void mmx::glue_gregorix | ( | ) |
| void mmx::glue_holonomix | ( | ) |
| void glue_inspect | ( | ) |
Definition at line 152 of file glue_inspect.cpp.
References mmx_add(), mmx_add_int(), mmx_conv(), mmx_definition(), mmx_div(), mmx_div_int(), mmx_function_body(), mmx_function_forms(), mmx_function_type(), mmx_int_add(), mmx_int_div(), mmx_int_mul(), mmx_int_sub(), mmx_inv(), mmx_is_defined(), mmx_is_type(), mmx_mul(), mmx_mul_int(), mmx_neg(), mmx_sqr(), mmx_sub(), mmx_sub_int(), mmx_symbol_table(), mmx_type(), mmx_type_name(), and mmx_type_table().
Referenced by glue_mmxlight().
{
define ("type_table", mmx_type_table);
define_primitive ("type", mmx_type);
define ("type?", mmx_is_type);
define ("type_name", mmx_type_name);
define ("symbol_table", mmx_symbol_table);
define ("defined?", mmx_is_defined);
define ("definition", mmx_definition);
define ("function_name", mmx_function_body);
define ("function_type", mmx_function_type);
define ("function_body", mmx_function_body);
define ("function_forms", mmx_function_forms);
define ("conv", mmx_conv);
define ("neg", mmx_neg);
define ("sqr", mmx_sqr);
define ("inv", mmx_inv);
define ("add", mmx_add);
define ("sub", mmx_sub);
define ("mul", mmx_mul);
define ("div", mmx_div);
define ("add_int", mmx_add_int);
define ("sub_int", mmx_sub_int);
define ("mul_int", mmx_mul_int);
define ("div_int", mmx_div_int);
define ("int_add", mmx_int_add);
define ("int_sub", mmx_int_sub);
define ("int_mul", mmx_int_mul);
define ("int_div", mmx_int_div);
}
| void glue_interface | ( | ) |
Definition at line 78 of file glue_interface.cpp.
References batch_mode, debug_mode, GLUE_1(), GLUE_10(), GLUE_11(), GLUE_12(), GLUE_13(), GLUE_2(), GLUE_3(), GLUE_4(), GLUE_5(), GLUE_6(), GLUE_7(), GLUE_8(), GLUE_9(), history_size, quiet_mode, time_mode, and type_mode.
Referenced by glue_mmxlight().
{
static bool done = false;
if (done) return;
done = true;
call_glue (string ("glue_int"));
call_glue (string ("glue_string"));
call_glue (string ("glue_vector_generic"));
static alias<bool> quiet_mode_alias = global_alias (((bool&) quiet_mode));
define_constant<alias<bool> > ("quiet_mode?", quiet_mode_alias);
static alias<bool> debug_mode_alias = global_alias (((bool&) debug_mode));
define_constant<alias<bool> > ("debug_mode?", debug_mode_alias);
static alias<bool> type_mode_alias = global_alias (((bool&) type_mode));
define_constant<alias<bool> > ("type_mode?", type_mode_alias);
static alias<bool> time_mode_alias = global_alias (((bool&) time_mode));
define_constant<alias<bool> > ("time_mode?", time_mode_alias);
static alias<bool> math_mode_alias = global_alias (((bool&) math_mode));
define_constant<alias<bool> > ("math_mode?", math_mode_alias);
static alias<bool> batch_mode_alias = global_alias (((bool&) batch_mode));
define_constant<alias<bool> > ("batch_mode?", batch_mode_alias);
static alias<bool> texmacs_mode_alias = global_alias (((bool&) texmacs_mode));
define_constant<alias<bool> > ("texmacs_mode?", texmacs_mode_alias);
define ("source_exists?", GLUE_1);
define ("source_file", GLUE_2);
define ("source_line", GLUE_3);
define ("source_column", GLUE_4);
define ("source_string", GLUE_5);
define ("source_string_unindented", GLUE_6);
define ("source_underlined", GLUE_7);
define ("source_begin", GLUE_8);
define ("source_end", GLUE_9);
define ("source_error", GLUE_10);
static alias<int> history_size_alias = global_alias (((int&) history_size));
define_constant<alias<int> > ("history_size", history_size_alias);
define ("history", GLUE_11);
define ("exit", GLUE_12);
define ("quit", GLUE_13);
}
| void mmx::glue_jorix | ( | ) |
| void mmx::glue_lattiz | ( | ) |
| void mmx::glue_linalg | ( | ) |
| void mmx::glue_mfgb | ( | ) |
| void mmx::glue_mgf2x | ( | ) |
| void mmx::glue_mlinbox | ( | ) |
| void mmx::glue_mmancient | ( | ) |
| void mmx::glue_mmcompiler | ( | ) |
| void mmx::glue_mmps | ( | ) |
| void glue_mmxlight | ( | ) |
Definition at line 14 of file glue_mmxlight.cpp.
References glue_class(), glue_control(), glue_declare(), glue_inspect(), glue_interface(), and glue_system().
{
static bool done = false;
if (done) return;
done = true;
register_glue (string ("glue_class"), (& (glue_class)));
register_glue (string ("glue_control"), (& (glue_control)));
register_glue (string ("glue_declare"), (& (glue_declare)));
register_glue (string ("glue_inspect"), (& (glue_inspect)));
register_glue (string ("glue_interface"), (& (glue_interface)));
register_glue (string ("glue_system"), (& (glue_system)));
register_glue (string ("glue_mmxlight"), (& (glue_mmxlight)));
dl_link ("basix");
glue_class ();
glue_control ();
glue_declare ();
glue_inspect ();
glue_interface ();
glue_system ();
}
| void mmx::glue_mmxtools | ( | ) |
| void mmx::glue_multimix | ( | ) |
| void mmx::glue_newmac | ( | ) |
| void mmx::glue_numerix | ( | ) |
| void mmx::glue_polytopix | ( | ) |
| void mmx::glue_quintix | ( | ) |
| void mmx::glue_realroot | ( | ) |
| void mmx::glue_shape | ( | ) |
| void mmx::glue_symbolix | ( | ) |
| void glue_system | ( | ) |
Definition at line 225 of file glue_system.cpp.
References mmx_foobar(), mmx_include(), mmx_is_readable(), mmx_load_directory(), mmx_load_string(), mmx_parse(), mmx_recompose(), mmx_reinclude(), mmx_save_string(), mmx_supports(), mmx_system(), mmx_tokenize(), mmx_update_string(), mmx_use(), and simple_loop().
Referenced by glue_mmxlight().
{
define ("relative_name", relative_name);
define ("resolve_name", resolve_name);
define ("follow_link", follow_link);
define ("path_name", path_name);
define_primitive ("readable?", mmx_is_readable);
define ("file?", file_is_file);
define ("directory?", file_is_directory);
define ("last_modified", file_last_modified);
define_primitive ("load", mmx_load_string);
define_primitive ("save", mmx_save_string);
define_primitive ("update", mmx_update_string);
define_primitive ("parse", mmx_parse);
define_primitive ("include", mmx_include);
define_primitive ("reinclude", mmx_reinclude);
define_primitive ("load_directory", mmx_load_directory);
define_primitive ("supports?", mmx_supports);
define_primitive ("use", mmx_use);
define ("flatten_as_cpp", flatten_as_cpp);
define ("flatten_as_mmx", flatten_as_mmx);
define ("get_env", get_env);
// define ("set_env", set_env);
define ("system", mmx_system);
define ("eval_system", eval_system);
define ("prefix_dir", prefix_dir);
define ("user_dir", user_dir);
define ("sysconf_dir", user_dir);
define ("file_exists?", file_exists);
define ("strip_directory", strip_directory);
define ("get_directory", get_directory);
define ("strip_extension", strip_extension);
define ("get_extension", get_extension);
define ("get_number_threads", threads_get_number);
define ("set_number_threads", threads_set_number);
define ("get_number_cores", get_number_cores);
define ("tokenize", mmx_tokenize);
define ("recompose", mmx_recompose);
define ("simple_loop", simple_loop);
define ("foobar", mmx_foobar);
define ("time", mmx_var_time);
}
| static list<string> mmx::handle_cmdline_options | ( | int | argc, |
| char ** | argv | ||
| ) | [static] |
Definition at line 59 of file init.cpp.
References completion_mode, debug_mode, help(), MMXLIGHT_VERSION, no_boot, quiet_mode, and replay_mode.
Referenced by shell_initialize().
{
int c;
int option_index = 0;
string arg, tmp;
list<string> to_load;
string progname = string(argv[0]);
opterr=0;
struct option long_options[] =
{
{"version", 0, 0, 0},
{"noboot", 0, 0, 0},
{"replay", 0, 0, 0},
{"debug", 0, 0, 0},
{"texmacs", 0, 0, 0},
{"help", 0, 0, 0},
{0, 0, 0, 0}
};
while (1) {
option_index = 0;
c = getopt_long (argc, argv, "c:q:",
long_options, &option_index);
if (c == -1)
break;
if (optarg)
arg = string(optarg);
switch (c)
{
case 0:
tmp = string((char*)long_options[option_index].name);
if (tmp=="texmacs") {
texmacs_mode=true;
math_mode=true;
break;
}
if (tmp=="debug") {
debug_mode=true;
break;
}
if (tmp=="noboot") {
no_boot=true;
break;
}
if (tmp=="version") {
mmout << MMXLIGHT_VERSION << "\n";
exit(0);
}
if (tmp=="replay") {
replay_mode = true;
break;
}
if (tmp=="help") {
help(progname);
exit(0);
}
mmerr << progname << " error in command line\n";
help(progname);
exit(-1);
case 'c':
tmp = "-c " * arg;
if (arg=="off") {
completion_mode=false;
break;
}
if (arg=="on") {
completion_mode=true;
break;
}
mmerr << progname << " error in command line\n";
help(progname);
exit(-1);
case 'q':
tmp = "-q";
if (arg=="off") {
quiet_mode=false;
break;
}
if (arg=="on") {
quiet_mode=true;
break;
}
mmerr << progname << " error in command line\n";
help(progname);
exit(-1);
case '?':
mmerr << progname << " : bad command line\n";
help(progname);
exit(-1);
default:
mmerr << progname << " : error in command line\n";
}
}
if (optind < argc) {
while (optind < argc)
to_load = cons(string(argv[optind++]), to_load);
}
return reverse (to_load);
}
| static void mmx::handle_completion_request | ( | const string & | request ) | [static] |
Definition at line 129 of file texmacs.cpp.
References complete(), output_completion(), and parse_completion_request().
Referenced by shell_texmacs_input().
{
string text;
nat pos, i, p;
p = 0;
pos = 0;
if (!parse_completion_request (request, pos, text, p)
|| p < 1 || p >= N(request)) {
output_completion ("", list<string>());
mmerr << "mmx warning: ignoring texmacs request" << "\n";
return;
}
i=p-1;
while (i+1 > 0 && ((text[i] >= 'a' && text[i] <= 'z')
|| (text[i] >= 'A' && text[i] <= 'Z')
|| text[i] == '_'))
i--;
complete (text (i+1, p));
}
| nat mmx::hash | ( | const environment & | env ) | [inline] |
Definition at line 108 of file environment.hpp.
{
return as_hash (env.rep); }
| static void mmx::help | ( | string | progname ) | [static] |
Definition at line 46 of file init.cpp.
Referenced by handle_cmdline_options().
{
mmerr << "Usage: " << progname << " [-c on|off] [-q] [--version] [--debug] [--texmacs] [--help] [filelist]\n";
mmerr << " -c on|off\t" << "enable|disable the completion mode; default is on.\n";
mmerr << " -q on|off\t" << "quiet mode: do not display prompts and output; default is off.\n";
mmerr << " --noboot\t" << "do not load boot file.\n";
mmerr << " --replay\t" << "replay previous session.\n";
mmerr << " --version\t" << "display version number.\n";
mmerr << " --debug\t" << "enable debug mode.\n";
mmerr << " --texmacs\t" << "enable texmacs mode; should be enabled by texmacs only.\n";
mmerr << " --help\t" << "display this message.\n";
}
| static table<string,string> mmx::include_cache | ( | "" | ) | [static] |
Referenced by mmx_do_include().
| mmx::INDIRECT_IMPL | ( | module | , |
| module_rep | |||
| ) | const |
| mmx::INDIRECT_NULL_IMPL | ( | environment | , |
| environment_rep | |||
| ) |
Definition at line 70 of file environment.hpp.
:
serial (0), next_serial (0), env_type (0) {}
| bool mmx::is_grouped | ( | const generic & | x ) | [inline] |
Definition at line 289 of file base_evaluator.cpp.
References type().
Referenced by base_evaluator_rep::apply().
{
return is_tuple_type (type (x)) || is<iterator<generic> > (x);
}
| bool mmx::is_nil | ( | const environment & | env ) | [inline] |
Definition at line 106 of file environment.hpp.
Referenced by overloaded_routine_rep::apply(), complete(), environment_rep::contains(), environment_rep::ensure_up_to_date(), flatten(), environment_rep::get(), mmx_symbol_table(), environment_rep::name(), output_completion(), overloaded_routine_rep::resolve(), shell_initialize(), shell_terminal_print_exception(), and overloaded_routine_rep::up_to_date().
{
return env.rep == NULL; }
| environment mmx::local_environment | ( | const environment & | next ) | [inline] |
Definition at line 116 of file environment.hpp.
{
return new environment_rep (next); }
| string mmx::make_literal_string | ( | const literal & | lit ) |
Definition at line 517 of file glue_class.cpp.
Referenced by glue_class().
{
string s= as_string (lit);
return unquote (s);
}
| static bool matches | ( | const generic & | tp, |
| const generic & | cat | ||
| ) | [static] |
Definition at line 102 of file glue_declare.cpp.
References matches_compute().
Referenced by complete(), glue_declare(), matches_compute(), mmx_forall(), and output_completion().
{
if (!current_ev->contains (gen ("matches?", tp, cat)))
current_ev->set (gen ("matches?", tp, cat),
as<generic> (matches_compute (tp, cat)));
return as<bool> (current_ev->get (gen ("matches?", tp, cat)));
}
| static bool mmx::matches_compute | ( | const generic & | tp, |
| const generic & | cat | ||
| ) | [static] |
Definition at line 55 of file glue_declare.cpp.
References matches(), and replace().
Referenced by matches().
{
generic rad= (is<compound> (cat)? cat[0]: cat);
if (!current_ev->contains (gen (GEN_CATEGORY, rad))) return false;
if (cat == "Class") return true;
if (tp == GEN_GENERIC_TYPE)
return
!is_func (cat, "Over") &&
!is_func (cat, "Normed_Over") &&
!is_func (cat, "Complex_Over");
generic val = current_ev->get (gen (GEN_CATEGORY, rad));
generic body= replace (val[2], GEN_THIS_TYPE, tp);
if (is<compound> (cat)) {
if (!is<compound> (val[1]) || N(val[1]) != N(cat)) return false;
for (nat i=1; i<N(cat); i++)
if (!is_func (val[1][i], GEN_TYPE, 2)) return false;
else body= replace (body, val[1][i][1], cat[i]);
//mmout << "Body " << body << "\n";
}
if (!is_func (body, GEN_BEGIN)) return false;
for (nat i=1; i<N(body); i++) {
//mmout << "Checking " << body[i] << "\n";
if (is_func (body[i], GEN_TYPE, 2)) {
if (is_func (body[i][2], GEN_INTO, 2)) {
vector<generic> args= vec<generic> (body[i][2][2]);
if (is_func (body[i][2][1], GEN_TUPLE))
args << cdr (compound_to_vector (body[i][2][1]));
else if (body[i][2][1] != GEN_VOID_TYPE)
args << vec<generic> (body[i][2][1]);
generic what= gen ("Function", args);
//mmout << " what= " << what << "\n";
if (!current_ev->contains (body[i][1])) return false;
generic rout= current_ev->get (body[i][1]);
if (!is<routine> (rout)) return false;
generic have= as<routine> (rout) -> function_type ();
//mmout << " have= " << have << "\n";
bool ok= false;
for (nat i=1; i<N(have); i++) ok= ok || have[i] == what;
if (!ok) return false;
}
else if (!matches (body[i][1], body[i][2]))
return false;
}
}
return true;
}
| static generic mmx::methodize | ( | const generic & | x ) | [static] |
Definition at line 319 of file glue_class.cpp.
Referenced by mmx_class_method().
{
if (is_func (x, GEN_DEFINE, 2) || is_func (x, GEN_TYPE, 2))
return gen (x[0], methodize (x[1]), x[2]);
else if (is<compound> (x)) {
vector<generic> v= compound_to_vector (x);
v[0]= methodize (v[0]);
return vector_to_compound (v);
}
else if (is<literal> (x)) {
current_ev->set (gen (GEN_METHOD, x), as<generic> (true));
generic sym= dottify (x);
generic cl = current_ev->get (GEN_CLASS_NAME);
if (current_ev->get (GEN_CLASS_ACCESS) == "mutable")
cl= gen (GEN_ALIAS_TYPE, cl);
return gen (sym, gen (GEN_TYPE, GEN_THIS, cl));
}
else ERROR ("syntax error");
}
| generic mmx::mmx_add | ( | const generic & | x, |
| const generic & | y | ||
| ) |
| generic mmx::mmx_add_int | ( | const generic & | x, |
| const int & | y | ||
| ) |
| generic mmx::mmx_assign | ( | const generic & | x ) |
Definition at line 309 of file glue_declare.cpp.
References convert_to(), mmx_op_assign(), and mmx_set().
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
if (is_func (x[1], GEN_TYPE, 2)) {
if (is<compound> (x[1][1])) {
generic var= gen (GEN_TYPE, car (x[1][1]), GEN_GENERIC_TYPE);
generic lambda= gen (GEN_LAMBDA, x[1][1], x[2], x[1][2]);
return mmx_assign (gen (GEN_ASSIGN, var, lambda));
}
else {
if (!is<literal> (x[1][1]))
return type_mismatch (GEN_SYMBOL_TYPE, x[1][1]);
generic t= eval (x[1][2]);
if (is<exception> (t)) return t;
nat tid= type_id (t);
if (tid == 1) return type_mismatch (GEN_TYPE_TYPE, x[1][2]);
generic r= eval (x[2]);
if (is<exception> (r)) return r;
r= convert_to (r, tid, x[2]);
if (is<exception> (r)) return r;
if (tid == 0) r= as<generic> (alias<generic> (r));
else r= current_ev->apply (GEN_ALIAS, r);
mmx_set (x[1][1], r);
return r;
}
}
else if (is<literal> (x[1]) &&
!current_ev->contains (x[1]) &&
!current_ev->contains (gen (GEN_METHOD, x[1]))) {
generic var= gen (GEN_TYPE, x[1], GEN_GENERIC_TYPE);
return mmx_assign (gen (GEN_ASSIGN, var, x[2]));
}
else return mmx_op_assign (x, 0);
}
| generic mmx::mmx_assign_macro | ( | const generic & | x ) |
Definition at line 516 of file glue_declare.cpp.
Referenced by glue_declare().
{
static string file_var ("current_file");
if (!current_ev->contains (gen (file_var)))
current_ev->set (file_var, as<generic> (string ("")));
string name= as<string> (current_ev->get (gen (file_var)));
if (!ends (name, "basix/mmx/categories.mmx"))
mmerr << "Warning: transcription " << x << " not implemented\n";
return void_value ();
}
| generic mmx::mmx_assume | ( | const generic & | x ) |
Definition at line 170 of file glue_declare.cpp.
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
if (x[1] == "interpreted") return eval (x[2]);
return void_value ();
}
| generic mmx::mmx_backquote | ( | const generic & | x ) |
Definition at line 480 of file glue_declare.cpp.
Referenced by glue_declare().
{
if (N(x) != 2) return wrong_nr_args (x);
generic r= eval (x[1]);
if (is<exception> (r)) return r;
else return eval (r);
}
| generic mmx::mmx_begin | ( | const generic & | x ) |
Definition at line 33 of file glue_control.cpp.
{
nat i, n= N(x);
if (n==1) return void_value ();
for (i=1; i<n-1; i++) {
//mmout << "Evaluate " << x[i] << "\n";
generic aux= eval (x[i]);
if (is<exception> (aux)) return aux;
}
return eval (x[i]);
}
| generic mmx::mmx_break | ( | const generic & | x ) |
Definition at line 175 of file glue_control.cpp.
{
if (N(x) != 1) return wrong_nr_args (x);
return as<generic> (exception (gen (GEN_BREAK)));
}
| generic mmx::mmx_category | ( | const generic & | x ) |
Definition at line 503 of file glue_class.cpp.
Referenced by glue_class().
{
if (N(x) != 2 && N(x) != 3) return wrong_nr_args (x);
if (N(x) == 2) return void_value ();
generic name= x[1];
if (is<compound> (name)) name= name[0];
current_ev->set (gen (GEN_CATEGORY, name), x);
return void_value ();
}
| generic mmx::mmx_class | ( | const generic & | x ) |
Definition at line 493 of file glue_class.cpp.
References mmx_class_module().
Referenced by glue_class().
{
return mmx_class_module (x, false);
}
| generic mmx::mmx_class_constructor | ( | const generic & | x ) |
Definition at line 367 of file glue_class.cpp.
References mmx_define().
Referenced by mmx_class_declaration().
{
//mmout << "Constructor: " << x << "\n";
if (!is_func (x, GEN_DEFINE, 2))
return std_exception ("invalid constructor", x);
generic head= x[1];
if (is_func (head, GEN_TYPE, 2))
return std_exception ("type is implicit", head);
generic body= x[2];
if (!is_func (body, GEN_BEGIN))
body= gen (GEN_BEGIN, body);
vector<generic> lhs=
as<vector<generic> > (current_ev->get (GEN_CLASS_FIELDS));
vector<generic> rhs= cdr (compound_to_vector (body));
vector<generic> tup;
if (N(lhs) != N(rhs))
return std_exception ("initializers do not match", body);
for (nat j=0; j<N(rhs); j++)
if (!is_func (rhs[j], GEN_DEFINE, 2))
return std_exception ("incorrect initializer", rhs[j]);
else if (rhs[j][1] != lhs[j][1])
return std_exception ("initializer does not match", rhs[j]);
else tup << gen (GEN_TRANSTYPE, rhs[j][2], lhs[j][2]);
generic cl = current_ev->get (GEN_CLASS_NAME);
generic new_head= gen (GEN_TYPE, head, cl);
generic new_body= gen ("object", gen (GEN_SQTUPLE, tup), cl);
generic r= mmx_define (gen (GEN_DEFINE, new_head, new_body));
if (is<exception> (r)) return r;
return void_value ();
}
| generic mmx_class_declaration | ( | const generic & | x ) |
Definition at line 420 of file glue_class.cpp.
References mmx_class_constructor(), mmx_class_destructor(), mmx_class_extern(), mmx_class_intern(), mmx_class_method(), and mmx_class_modified().
Referenced by mmx_class_modified(), and mmx_class_module().
{
//mmout << "Declaration: " << x << "\n";
if (is_func (x, GEN_BEGIN))
for (nat i=1; i<N(x); i++) {
generic r= mmx_class_declaration (x[i]);
if (is<exception> (r)) return r;
}
else if (is_func (x, GEN_INTERN, 1))
return mmx_class_modified (x[1], GEN_CLASS_MODE, "intern");
else if (is_func (x, GEN_METHOD, 1))
return mmx_class_modified (x[1], GEN_CLASS_MODE, "method");
else if (is_func (x, GEN_EXTERN, 1))
return mmx_class_modified (x[1], GEN_CLASS_MODE, "extern");
else if (is_func (x, GEN_CONSTRUCTOR, 1))
return mmx_class_modified (x[1], GEN_CLASS_MODE, "constructor");
else if (is_func (x, GEN_DESTRUCTOR, 1))
return mmx_class_destructor (x[1]);
else if (is_func (x, GEN_CONSTANT, 1))
return mmx_class_modified (x[1], GEN_CLASS_ACCESS, "constant");
else if (is_func (x, GEN_MUTABLE, 1))
return mmx_class_modified (x[1], GEN_CLASS_ACCESS, "mutable");
else if (is_func (x, GEN_PRIVATE, 1))
return mmx_class_modified (x[1], GEN_CLASS_ENCAPSULATION, "private");
else if (is_func (x, GEN_PUBLIC, 1))
return mmx_class_modified (x[1], GEN_CLASS_ENCAPSULATION, "public");
else if (current_ev->get (GEN_CLASS_MODE) == "intern")
return mmx_class_intern (x);
else if (current_ev->get (GEN_CLASS_MODE) == "method")
return mmx_class_method (x);
else if (current_ev->get (GEN_CLASS_MODE) == "extern")
return mmx_class_extern (x);
else if (current_ev->get (GEN_CLASS_MODE) == "constructor")
return mmx_class_constructor (x);
else return std_exception ("invalid class declaration", x);
return void_value ();
}
| generic mmx::mmx_class_destructor | ( | const generic & | x ) |
Definition at line 398 of file glue_class.cpp.
Referenced by mmx_class_declaration().
{
// TODO: implement destructors
(void) x;
return void_value ();
}
| generic mmx::mmx_class_extern | ( | const generic & | x ) |
Definition at line 355 of file glue_class.cpp.
Referenced by mmx_class_declaration().
{
// mmout << "Extern: " << x << "\n";
generic r= eval (x);
if (is<exception> (r)) return r;
return void_value ();
}
| generic mmx::mmx_class_intern | ( | const generic & | x ) |
Definition at line 284 of file glue_class.cpp.
References access_routine(), alias_access_routine(), and mmx_overload().
Referenced by mmx_class_declaration().
{
// mmout << "Intern: " << x << "\n";
if (!is_func (x, GEN_TYPE, 2))
return std_exception ("invalid intern data field", x);
if (!is<literal> (x[1]))
return std_exception ("literal expected", x[1]);
generic var= x[1];
generic tp = eval (x[2]);
if (is<exception> (tp)) return tp;
if (type_id (tp) == 1)
return std_exception ("type expected", x[2]);
current_ev->set (gen (GEN_METHOD, var), as<generic> (true));
generic sym= dottify (var);
generic cl = current_ev->get (GEN_CLASS_NAME);
vector<generic> fields=
as<vector<generic> > (current_ev->get (GEN_CLASS_FIELDS));
if (true) { // read access
routine r= access_routine (N(fields), type_id (cl), type_id (tp));
mmx_overload (sym, as<generic> (r));
}
if (current_ev->get (GEN_CLASS_ACCESS) == "mutable") { // write access
routine r=
alias_access_routine (N(fields), scalar_to_alias (type_id (cl)));
mmx_overload (sym, as<generic> (r));
}
fields << gen (GEN_TYPE, var, tp);
current_ev->set (GEN_CLASS_FIELDS, as<generic> (fields));
return void_value ();
}
| generic mmx::mmx_class_method | ( | const generic & | x ) |
Definition at line 339 of file glue_class.cpp.
References methodize(), and mmx_define().
Referenced by mmx_class_declaration().
{
//mmout << "Method: " << x << "\n";
if (!is_func (x, GEN_DEFINE, 2))
return std_exception ("invalid method declaration", x);
generic def= methodize (x);
//mmout << "def= " << def << "\n";
generic r= mmx_define (def);
if (is<exception> (r)) return r;
return void_value ();
}
| generic mmx::mmx_class_modified | ( | const generic & | x, |
| const generic & | var, | ||
| const generic & | val | ||
| ) |
Definition at line 411 of file glue_class.cpp.
References mmx_class_declaration().
Referenced by mmx_class_declaration().
{
generic old= current_ev->get (var);
current_ev->set (var, val);
generic r= mmx_class_declaration (x);
current_ev->set (var, old);
return r;
}
| generic mmx::mmx_class_module | ( | const generic & | x, |
| bool | module_flag | ||
| ) |
Definition at line 462 of file glue_class.cpp.
References base_evaluator(), mmx_class_declaration(), mmx_import_resolvers(), mmx_set(), and set_environment_type().
Referenced by mmx_class(), and mmx_module().
{
if (N(x) != 2 && N(x) != 3) return wrong_nr_args (x);
generic t= eval (x[1]);
if (is<exception> (t)) return t;
if (!module_flag) (void) as_object (generic (), t);
if (N(x) == 2) return void_value ();
select_evaluator (base_evaluator (current_ev));
set_environment_type (current_ev, 1);
current_ev->set (GEN_CLASS_NAME, t);
current_ev->set (GEN_CLASS_MODE, module_flag? "extern": "intern");
current_ev->set (GEN_CLASS_ENCAPSULATION, "public");
current_ev->set (GEN_CLASS_ACCESS, "constant");
current_ev->set (GEN_CLASS_FIELDS, as<generic> (vec<generic> ()));
current_ev->set (GEN_CLASS_EXPORT, as<generic> (module (t)));
generic r= mmx_class_declaration (x[2]);
generic exports= current_ev->get (GEN_CLASS_EXPORT);
restore_evaluator ();
if (module_flag) {
if (!is<literal> (t))
return std_exception ("literal expected", x[1]);
mmx_import_resolvers (as<module> (exports));
mmx_set (t, exports);
return exports;
}
else {
mmx_import (as<module> (exports));
return r;
}
}
| routine mmx::mmx_compose_compound | ( | const compound & | f, |
| const generic & | g | ||
| ) |
Definition at line 541 of file glue_declare.cpp.
References mmx_compose_function().
Referenced by glue_declare().
{
return mmx_compose_function (default_routine (as<generic> (f)), g);
}
| routine mmx::mmx_compose_function | ( | const routine & | f, |
| const generic & | g | ||
| ) |
Definition at line 531 of file glue_declare.cpp.
Referenced by glue_declare(), mmx_compose_compound(), and mmx_compose_literal().
{
return compose (f, vec (default_routine (g)));
}
| routine mmx::mmx_compose_literal | ( | const literal & | f, |
| const generic & | g | ||
| ) |
Definition at line 536 of file glue_declare.cpp.
References mmx_compose_function().
Referenced by glue_declare().
{
return mmx_compose_function (default_routine (as<generic> (f)), g);
}
| generic mmx::mmx_continue | ( | const generic & | x ) |
Definition at line 181 of file glue_control.cpp.
{
if (N(x) != 1) return wrong_nr_args (x);
return as<generic> (exception (gen (GEN_CONTINUE)));
}
| generic mmx::mmx_conv | ( | const generic & | x, |
| const generic & | y | ||
| ) |
Definition at line 130 of file glue_inspect.cpp.
Referenced by glue_inspect().
{ return convert (x,y); }
| generic mmx::mmx_count | ( | const int & | end ) |
Definition at line 209 of file glue_control.cpp.
References count_iterator().
{
return as<generic> (count_iterator (0, end));
}
| generic mmx_define | ( | const generic & | x ) |
Definition at line 276 of file glue_declare.cpp.
References mmx_overload().
Referenced by glue_declare(), mmx_class_constructor(), and mmx_class_method().
{
if (N(x) != 3) return wrong_nr_args (x);
if (is_func (x[1], GEN_TYPE, 2)) {
if (is<compound> (x[1][1])) {
generic lambda= gen (GEN_LAMBDA, x[1][1], x[2], x[1][2]);
return mmx_define (gen (GEN_DEFINE, car (x[1][1]), lambda));
}
else {
if (!is<literal> (x[1][1]))
return type_mismatch (GEN_SYMBOL_TYPE, x[1][1]);
generic r= eval (gen (GEN_TRANSTYPE, x[2], x[1][2]));
if (!is<exception> (r))
mmx_overload (x[1][1], r);
return r;
}
}
else {
if (is<compound> (x[1])) {
generic lambda= gen (GEN_LAMBDA, x[1], x[2]);
return mmx_define (gen (GEN_DEFINE, car (x[1]), lambda));
}
else {
if (!is<literal> (x[1]))
return type_mismatch (GEN_LITERAL_TYPE, x[1]);
generic r= eval (gen (GEN_TRANSTYPE, x[2], GEN_GENERIC_TYPE));
if (!is<exception> (r))
mmx_overload (x[1], r);
return r;
}
}
}
| generic mmx::mmx_define_macro | ( | const generic & | x ) |
Definition at line 499 of file glue_declare.cpp.
References mmx_set().
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
if (is<compound> (x[1])) {
generic macro= gen (GEN_MACRO, x[1], x[2]);
return mmx_define_macro (gen (GEN_DEFINE_MACRO, car (x[1]), macro));
}
else {
if (!is<literal> (x[1]))
return type_mismatch (GEN_LITERAL_TYPE, x[1]);
generic r= eval (x[2]);
if (!is<exception> (r))
mmx_set (x[1], r);
return r;
}
}
| generic mmx::mmx_definition | ( | const generic & | g ) |
Definition at line 80 of file glue_inspect.cpp.
References get_environment().
Referenced by glue_inspect().
{
environment env= get_environment (current_ev);
ASSERT (env->contains (g), "symbol not defined");
return env[g];
}
| generic mmx::mmx_div | ( | const generic & | x, |
| const generic & | y | ||
| ) |
| generic mmx::mmx_div_int | ( | const generic & | x, |
| const int & | y | ||
| ) |
| generic mmx::mmx_do_include | ( | const generic & | x, |
| bool | always | ||
| ) |
Definition at line 141 of file glue_system.cpp.
References include_cache(), mmx_load_file(), and mmx_parse().
Referenced by mmx_include(), and mmx_reinclude().
{
static string file_var ("current_file");
generic name_contents= mmx_load_file (x);
if (is<exception> (name_contents)) return name_contents;
string file_name= as<string> (name_contents[1]);
string contents = as<string> (name_contents[2]);
if (always || include_cache[file_name] != contents) {
include_cache[file_name]= contents;
generic y = mmx_parse (file_name, contents);
string cur_file = as<string> (current_ev->get (gen (file_var)));
current_ev->set (gen (file_var), as<generic> (file_name));
generic r= eval (y);
current_ev->set (gen (file_var), as<generic> (cur_file));
if (is<exception> (r)) return r;
//return r;
}
return void_value ();
}
| generic mmx::mmx_downto | ( | const generic & | start, |
| const generic & | end | ||
| ) |
Definition at line 224 of file glue_control.cpp.
{
return as<generic> (range_iterator<generic> (start, end, -1, false));
}
| void mmx_exit | ( | const int & | i ) |
Definition at line 219 of file init.cpp.
References batch_mode, shell_save_history(), and shell_save_session().
Referenced by GLUE_12(), and mmx_quit().
{
mmerr << flush_now;
mmout << flush_now;
if (!batch_mode) {
shell_save_history ();
shell_save_session ();
}
restore_evaluator ();
exit (i);
}
| iterator<generic> mmx::mmx_explode | ( | const iterator< generic > & | it ) |
Definition at line 395 of file glue_control.cpp.
{
return it;
}
| tuple<generic> mmx::mmx_fill | ( | const generic & | x, |
| const int & | nr | ||
| ) |
Definition at line 384 of file glue_control.cpp.
{
ASSERT (nr >= 0, "positive integer expected");
return as_tuple (fill<generic> (x, nr));
}
| generic mmx::mmx_foobar | ( | ) |
Definition at line 216 of file glue_system.cpp.
Referenced by glue_system().
{
return generic ((nat) 1);
}
| generic mmx::mmx_forall | ( | const generic & | x ) |
Definition at line 141 of file glue_declare.cpp.
References matches(), replace(), and types_defined().
Referenced by glue_declare().
{
if (N(x) < 2) return wrong_nr_args (x);
if (N(x) == 2) return eval (x[1]);
if (N(x) > 3)
return eval (gen (x[0], gen (x[1]),
gen (x[0], cdr (compound_to_vector (x)))));
generic tvar= x[1];
generic var = (is_func (tvar, GEN_TYPE, 2)? tvar[1]: tvar);
generic cat = (is_func (tvar, GEN_TYPE, 2)? tvar[2]: generic ("Class"));
if (!is<literal> (var)) return type_mismatch (GEN_LITERAL_TYPE, var);
const vector<generic> all= all_type_names ();
ASSERT (N(all) > 0 && all[0] == GEN_GENERIC_TYPE, "missing generic type");
//const vector<generic> all= vec<generic> (GEN_GENERIC_TYPE);
for (nat i=0; i<N(all); i++) {
if (!matches (all[i], cat)) continue;
generic w= replace (x[2], var, all[i]);
if (!types_defined (w, all)) continue;
//mmout << "Handling " << all[i] << "\n";
generic r= eval (w);
if (is<exception> (r)) return r;
}
return void_value ();
}
| generic mmx::mmx_foreign | ( | const generic & | x ) |
Definition at line 23 of file glue_control.cpp.
{
(void) x;
return void_value ();
}
| generic mmx::mmx_function_body | ( | const routine & | fun ) |
Definition at line 96 of file glue_inspect.cpp.
Referenced by glue_inspect().
{
generic g= fun->function_body ();
if (is_func (g, GEN_SQTUPLE)) {
vector<generic> v;
for (nat i=1; i<N(g); i++) v << g[i];
return as<generic> (v);
}
else return as<generic> (vec (g));
}
| generic mmx::mmx_function_forms | ( | const routine & | fun ) |
Definition at line 118 of file glue_inspect.cpp.
Referenced by glue_inspect().
{
vector<generic> r;
vector<routine> v= fun->meanings ();
if (N(v) == 0) r << as<generic> (fun);
else for (nat i=0; i<N(v); i++) r << as<generic> (v[i]);
return as<generic> (r);
}
| generic mmx::mmx_function_name | ( | const routine & | fun ) |
Definition at line 91 of file glue_inspect.cpp.
{
return fun->name;
}
| generic mmx::mmx_function_type | ( | const routine & | fun ) |
Definition at line 107 of file glue_inspect.cpp.
Referenced by glue_inspect().
{
generic g= fun->function_type ();
if (is_func (g, GEN_SQTUPLE)) {
vector<generic> v;
for (nat i=1; i<N(g); i++) v << g[i];
return as<generic> (v);
}
else return as<generic> (vec (g));
}
| vector< generic > mmx_history | ( | ) |
| generic mmx::mmx_if | ( | const generic & | x ) |
Definition at line 79 of file glue_control.cpp.
{
if (N(x) < 3 || N(x) > 4) return wrong_nr_args (x);
generic cond= eval_as<bool> (x[1]);
if (is<exception> (cond)) return cond;
if (as<bool> (cond)) return eval (x[2]);
else if (N(x) == 4) return eval (x[3]);
else return void_value ();
}
| void mmx::mmx_import_resolvers | ( | const module & | m ) |
Definition at line 190 of file glue_class.cpp.
References mmx_overload(), and resolve_routine().
Referenced by mmx_class_module().
{
vector<generic> vars= mmx_module_contents (m);
for (nat i=0; i<N(vars); i++) {
generic var= vars[i];
while (true) {
mmx_overload (dottify (var), as<generic> (resolve_routine (var)));
if (undottify (var) == var) break;
var= undottify (var);
}
}
}
| generic mmx::mmx_include | ( | const generic & | x ) |
Definition at line 161 of file glue_system.cpp.
References mmx_do_include().
Referenced by glue_system().
{
return mmx_do_include (x, false);
}
| generic mmx::mmx_int_add | ( | const int & | x, |
| const generic & | y | ||
| ) |
| generic mmx::mmx_int_div | ( | const int & | x, |
| const generic & | y | ||
| ) |
| generic mmx::mmx_int_mul | ( | const int & | x, |
| const generic & | y | ||
| ) |
| generic mmx::mmx_int_sub | ( | const int & | x, |
| const generic & | y | ||
| ) |
| generic mmx::mmx_inv | ( | const generic & | x ) |
Definition at line 133 of file glue_inspect.cpp.
Referenced by glue_inspect().
{ return invert (x); }
| bool mmx::mmx_is_defined | ( | const generic & | g ) |
Definition at line 74 of file glue_inspect.cpp.
References get_environment().
Referenced by glue_inspect().
{
environment env= get_environment (current_ev);
return env->contains (g);
}
| generic mmx::mmx_is_readable | ( | const generic & | x ) |
Definition at line 54 of file glue_system.cpp.
References mmx_resolve_name().
Referenced by glue_system().
{
if (N(x) != 2) return wrong_nr_args (x);
generic name= eval_as<string> (x[1]);
if (is<exception> (name) || !is<string> (name)) return name;
string file_name= mmx_resolve_name (as<string> (name));
return as<generic> (file_name != "" && file_exists (file_name));
}
| bool mmx::mmx_is_type | ( | const generic & | g ) |
Definition at line 38 of file glue_inspect.cpp.
Referenced by glue_inspect().
{
vector<generic> v= all_type_names ();
for (nat i=0; i<N(v); i++)
if (g == v[i]) return true;
if (is_func (g, GEN_ALIAS_TYPE))
return mmx_is_type (g[1]);
if (is_func (g, GEN_TUPLE_TYPE))
return mmx_is_type (g[1]);
return false;
}
| generic mmx::mmx_lambda | ( | const generic & | x ) |
Definition at line 403 of file glue_declare.cpp.
References closure().
Referenced by glue_declare(), mmx_macro(), and mmx_mapsto().
{
if (N(x) < 3 || N(x) > 4) return wrong_nr_args (x);
vector<generic> args= compound_to_vector (x[1]);
vector<nat> sig= fill<nat> ((nat) 0, N(args));
for (nat i=1; i<N(args); i++)
if (is_func (args[i], GEN_TYPE)) {
generic t= eval (args[i][2]);
if (is<exception> (t)) return t;
nat tid= type_id (t);
if (tid == 1) return type_mismatch (GEN_TYPE_TYPE, args[i][2]);
sig [i]= tid;
args [i]= args[i][1];
}
if (N(x) == 4) {
generic t= eval (x[3]);
if (is<exception> (t)) return t;
nat tid= type_id (t);
if (tid == 1) return type_mismatch (GEN_TYPE_TYPE, x[3]);
sig [0]= tid;
}
generic vars= vector_to_compound (args);
return as<generic> (closure (current_ev, sig, vars, x[2]));
}
| generic mmx::mmx_load_directory | ( | const generic & | x ) |
Definition at line 98 of file glue_system.cpp.
References mmx_relative_name().
Referenced by glue_system().
{
if (N(x) != 2) return wrong_nr_args (x);
generic name= eval_as<string> (x[1]);
if (is<exception> (name) || !is<string> (name)) return name;
string dir_name= mmx_relative_name (as<string> (name));
vector<string> dir;
if (load_directory (dir_name, dir))
ERROR ("directory " * dir_name * " not found");
vector<generic> gdir;
for (nat i=0; i<N(dir); i++)
gdir << as<generic> (dir[i]);
return as<generic> (gdir);
}
| static generic mmx::mmx_load_file | ( | const generic & | x ) | [static] |
Definition at line 63 of file glue_system.cpp.
References mmx_resolve_name(), and mmx_strip_preamble().
Referenced by mmx_do_include(), mmx_load_string(), and mmx_parse().
{
if (N(x) != 2) return wrong_nr_args (x);
generic name= eval_as<string> (x[1]);
if (is<exception> (name) || !is<string> (name)) return name;
string file_name= mmx_resolve_name (as<string> (name));
ASSERT (file_name != "", "file " * as<string> (name) * " not found");
string ucontents;
if (load ("$MMX_LOAD_PATH", file_name, ucontents))
ERROR ("file " * file_name * " could not be loaded");
string contents= mmx_strip_preamble (ucontents);
store_file_source (file_name, contents);
return gen (GEN_TUPLE, as<generic> (file_name), as<generic> (contents));
}
| generic mmx::mmx_load_string | ( | const generic & | x ) |
Definition at line 78 of file glue_system.cpp.
References mmx_load_file().
Referenced by glue_system().
{
generic name_contents= mmx_load_file (x);
if (is<exception> (name_contents)) return name_contents;
return name_contents[2];
}
| generic mmx::mmx_loop | ( | const generic & | x ) |
Definition at line 93 of file glue_control.cpp.
References base_evaluator(), convert_to(), and read().
{
nat i, n= N(x)-1;
if (n < 1) return wrong_nr_args (x);
bool stop= false;
generic aux, ret= void_value ();
select_evaluator (base_evaluator (current_ev));
table<iterator<generic>, generic> its;
table<nat, generic> tps (0);
for (i=1; i<n; i++)
if (is_func (x[i], GEN_FOR, 1) && is_func (x[i][1], GEN_IN, 2)) {
generic var= x[i][1][1];
if (is_func (var, GEN_TYPE, 2)) {
generic tp= eval (var[2]);
if (is<exception> (tp)) { ret= tp; stop= true; break; }
nat tid= type_id (tp);
if (tid == 1) {
ret= type_mismatch (GEN_TYPE_TYPE, var[2]); stop= true; break; }
var= var[1];
tps [var]= tid;
}
generic val= eval_as<iterator<generic> > (x[i][1][2]);
if (is<exception> (val)) { ret= val; stop= true; break; }
its [var]= as<iterator<generic> > (val);
}
else if (is_func (x[i], GEN_FOR, 1)) {
aux= eval (x[i][1]);
if (is<exception> (aux)) {
stop= true;
ret= aux;
break;
}
}
while (!stop) {
for (i=1; i<n; i++)
if (is_func (x[i], GEN_FOR, 1) && is_func (x[i][1], GEN_IN, 2)) {
generic var= x[i][1][1];
bool typed= is_func (var, GEN_TYPE, 2);
if (typed) var= var[1];
iterator<generic>& it= its [var];
if (done (it)) { stop= true; break; }
aux= *it; ++it;
if (typed) aux= convert_to (aux, read (tps, var), x[i][1][2]);
if (is<exception> (aux)) { ret= aux; stop= true; break; }
current_ev->set (var, aux);
}
else if (is_func (x[i], GEN_WHILE, 1)) {
generic cond= eval_as<bool> (x[i][1]);
if (is<exception> (cond)) { ret= cond; stop= true; break; }
if (!as<bool> (cond)) { stop= true; break; }
}
if (stop) break;
select_evaluator (base_evaluator (current_ev));
aux= eval (x[n]);
restore_evaluator ();
if (is<exception> (aux)) {
generic msg= *as<exception> (aux);
if (exact_eq (msg, gen (GEN_CONTINUE)));
else if (exact_eq (msg, gen (GEN_BREAK))) break;
else { ret= aux; break; }
}
for (i=1; i<n; i++)
if (is_func (x[i], GEN_UNTIL, 1)) {
generic cond= eval_as<bool> (x[i][1]);
if (is<exception> (cond)) { ret= cond; stop= true; break; }
if (as<bool> (cond)) { stop= true; break; }
}
else if (is_func (x[i], GEN_STEP, 1)) {
aux= eval (x[i][1]);
if (is<exception> (aux)) { ret= aux; stop= true; break; }
}
}
restore_evaluator ();
return ret;
}
| generic mmx::mmx_macro | ( | const generic & | x ) |
Definition at line 488 of file glue_declare.cpp.
References mmx_lambda().
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
generic r= mmx_lambda (gen (x[0], x[1], gen (GEN_BACKQUOTE, x[2])));
if (is<routine> (r)) {
routine fun= as<routine> (r);
return as<generic> (primitive (fun));
}
else return r;
}
| generic mmx::mmx_mapsto | ( | const generic & | x ) |
Definition at line 428 of file glue_declare.cpp.
References mmx_lambda().
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
vector<generic> args= vec<generic> (generic (GEN_TUPLE));
if (is_func (x[1], GEN_TUPLE)) args << cdr (compound_to_vector (x[1]));
else args << x[1];
generic vars= vector_to_compound (args);
if (is_func (x[2], GEN_TYPE, 2))
return mmx_lambda (gen (GEN_LAMBDA, vars, x[2][1], x[2][2]));
else return mmx_lambda (gen (GEN_LAMBDA, vars, x[2]));
}
| generic mmx::mmx_minus_assign | ( | const generic & | x ) |
Definition at line 254 of file glue_declare.cpp.
References mmx_op_assign().
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
return mmx_op_assign (x, 2);
}
| generic mmx::mmx_module | ( | const generic & | x ) |
Definition at line 498 of file glue_class.cpp.
References mmx_class_module().
Referenced by glue_class().
{
return mmx_class_module (x, true);
}
| generic mmx::mmx_mul | ( | const generic & | x, |
| const generic & | y | ||
| ) |
| generic mmx::mmx_mul_int | ( | const generic & | x, |
| const int & | y | ||
| ) |
| generic mmx::mmx_neg | ( | const generic & | x ) |
| bool mmx::mmx_not | ( | const bool & | x ) |
Definition at line 65 of file glue_control.cpp.
{
return !x;
}
| generic mmx::mmx_object | ( | const generic & | x, |
| const generic & | t | ||
| ) |
Definition at line 207 of file glue_class.cpp.
Referenced by glue_class().
{
return as_object (x, t);
}
| static generic mmx::mmx_op_assign | ( | const generic & | x, |
| nat | op | ||
| ) | [static] |
Definition at line 198 of file glue_declare.cpp.
References convert_to(), perform_op(), and type().
Referenced by mmx_assign(), mmx_minus_assign(), mmx_over_assign(), mmx_plus_assign(), and mmx_times_assign().
{
generic var= eval (x[1]);
if (is<exception> (var)) return var;
if (is_alias_type (type (var))) {
generic val= eval (x[2]);
if (is<exception> (val)) return val;
if (op != 0) {
val= perform_op (op, get_alias (var), val);
if (is<exception> (val)) return val;
}
val= convert_to (val, alias_to_scalar (type (var)), x[2]);
if (is<exception> (val)) return val;
return set_alias (var, val);
}
if (is_tuple_type (type (var))) {
generic val= eval (x[2]);
if (is<exception> (val)) return val;
if (!is_tuple_type (type (val)))
return type_mismatch (GEN_TUPLE_TYPE, x[1]);
generic vars= *as<tuple<generic> > (var);
generic vals= *as<tuple<generic> > (val);
if (N(vars) != N(vals))
return wrong_nr_args (x[2]);
vector<generic> ret= fill<generic> (GEN_TUPLE, N(vars));
for (nat i=1; i<N(vars); i++) {
nat tid= type (vars[i]);
if (!is_alias_type (tid))
return type_mismatch (gen (GEN_TUPLE_TYPE, GEN_ALIAS_TYPE), x[1]);
generic val= vals[i];
if (op != 0) {
val= perform_op (op, get_alias (vars[i]), val);
if (is<exception> (val)) return val;
}
val= convert_to (val, alias_to_scalar (tid), x[2]);
if (is<exception> (val)) return val;
ret[i]= val;
}
for (nat i=1; i<N(vars); i++)
ret[i]= set_alias (vars[i], ret[i]);
return as<generic> (tuple<generic> (vector_to_compound (ret)));
}
if (is<dynamic> (var)) {
generic val= eval (x[2]);
assign (as<dynamic> (var), val);
return val;
}
return type_mismatch (gen (GEN_OR, GEN_ALIAS_TYPE, GEN_TUPLE_TYPE), x[1]);
}
| generic mmx::mmx_over_assign | ( | const generic & | x ) |
Definition at line 266 of file glue_declare.cpp.
References mmx_op_assign().
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
return mmx_op_assign (x, 4);
}
| void mmx::mmx_overload | ( | const generic & | var, |
| const generic & | val | ||
| ) |
Referenced by mmx_class_intern(), mmx_define(), and mmx_import_resolvers().
| generic mmx::mmx_parse | ( | const generic & | x ) |
Definition at line 132 of file glue_system.cpp.
References mmx_load_file().
Referenced by glue_system(), and mmx_do_include().
{
generic name_contents= mmx_load_file (x);
if (is<exception> (name_contents)) return name_contents;
string file_name= as<string> (name_contents[1]);
string contents = as<string> (name_contents[2]);
return mmx_parse (file_name, contents);
}
| generic mmx::mmx_penalty | ( | const generic & | x ) |
Definition at line 177 of file glue_declare.cpp.
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
return void_value ();
}
| generic mmx::mmx_plus_assign | ( | const generic & | x ) |
Definition at line 248 of file glue_declare.cpp.
References mmx_op_assign().
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
return mmx_op_assign (x, 1);
}
| generic mmx::mmx_protect | ( | const generic & | x ) |
Definition at line 400 of file glue_control.cpp.
{
if (N(x) != 2) return wrong_nr_args (x);
generic it= eval (x[1]);
if (is<exception> (it)) return it;
else return gen ("protect", it);
}
| void mmx_quit | ( | ) |
Definition at line 231 of file init.cpp.
References mmx_exit().
Referenced by GLUE_13().
{
mmx_exit (0);
}
| generic mmx::mmx_quote | ( | const generic & | x ) |
Definition at line 474 of file glue_declare.cpp.
References quote().
Referenced by glue_declare().
{
if (N(x) != 2) return wrong_nr_args (x);
return quote (x[1], 0);
}
| generic mmx::mmx_range | ( | const generic & | start, |
| const generic & | end | ||
| ) |
Definition at line 214 of file glue_control.cpp.
{
return as<generic> (range_iterator<generic> (start, end, 1, true));
}
| string mmx::mmx_recompose | ( | const vector< generic > & | v, |
| const string & | sep, | ||
| const bool & | flag | ||
| ) |
Definition at line 205 of file glue_system.cpp.
Referenced by glue_system().
{
return recompose (as<vector<string> > (v), sep, flag);
}
| generic mmx::mmx_reinclude | ( | const generic & | x ) |
Definition at line 166 of file glue_system.cpp.
References mmx_do_include().
Referenced by glue_system().
{
return mmx_do_include (x, true);
}
| static string mmx::mmx_relative_name | ( | const string & | name ) | [static] |
Definition at line 30 of file glue_system.cpp.
Referenced by mmx_load_directory(), and mmx_save_string().
{
static string file_var ("current_file");
if (!current_ev->contains (gen (file_var)))
current_ev->set (file_var, as<generic> (string ("")));
return relative_name (as<string> (current_ev->get (gen (file_var))), name);
}
| static string mmx::mmx_resolve_name | ( | const string & | name ) | [static] |
Definition at line 38 of file glue_system.cpp.
Referenced by mmx_is_readable(), mmx_load_file(), and mmx_update_string().
{
static string file_var ("current_file");
if (!current_ev->contains (gen (file_var)))
current_ev->set (file_var, as<generic> (string ("")));
return resolve_name (as<string> (current_ev->get (gen (file_var))), name);
}
| generic mmx::mmx_return | ( | const generic & | x ) |
Definition at line 440 of file glue_declare.cpp.
Referenced by glue_declare().
{
if (N(x) == 1)
return as<generic> (exception (gen (GEN_RETURN, void_value ())));
if (N(x) != 2) return wrong_nr_args (x);
generic ret= eval (x[1]);
if (is<exception> (ret)) return ret;
else return as<generic> (exception (gen (GEN_RETURN, ret)));
}
| generic mmx::mmx_save_string | ( | const generic & | x ) |
Definition at line 85 of file glue_system.cpp.
References mmx_relative_name().
Referenced by glue_system().
{
if (N(x) != 3) return wrong_nr_args (x);
generic name= eval_as<string> (x[1]);
if (is<exception> (name) || !is<string> (name)) return name;
generic contents= eval_as<string> (x[2]);
if (is<exception> (contents) || !is<string> (contents)) return contents;
string file_name= mmx_relative_name (as<string> (name));
if (save (file_name, as<string> (contents)))
ERROR ("file " * file_name * " not writable");
return void_value ();
}
| generic mmx::mmx_seqand | ( | const generic & | x ) |
Definition at line 49 of file glue_control.cpp.
{
if (N(x) != 3) return wrong_nr_args (x);
generic r= eval_as<bool> (x[1]);
if (is<exception> (r) || !as<bool> (r)) return r;
return eval_as<bool> (x[2]);
}
| generic mmx::mmx_seqor | ( | const generic & | x ) |
Definition at line 57 of file glue_control.cpp.
{
if (N(x) != 3) return wrong_nr_args (x);
generic r= eval_as<bool> (x[1]);
if (is<exception> (r) || as<bool> (r)) return r;
return eval_as<bool> (x[2]);
}
| void mmx::mmx_set | ( | const generic & | var, |
| const generic & | val | ||
| ) |
Referenced by mmx_assign(), mmx_class_module(), and mmx_define_macro().
| generic mmx::mmx_sqr | ( | const generic & | x ) |
Definition at line 132 of file glue_inspect.cpp.
Referenced by glue_inspect().
{ return square (x); }
| static string mmx::mmx_strip_preamble | ( | const string & | s ) | [static] |
Definition at line 46 of file glue_system.cpp.
Referenced by mmx_load_file().
{
string preamble= "#!/usr/bin/env mmx-light\n";
if (N(s) >= N(preamble) && s (0, N(preamble)) == preamble)
return s (N(preamble)-1, N(s));
return s;
}
| generic mmx::mmx_sub | ( | const generic & | x, |
| const generic & | y | ||
| ) |
| generic mmx::mmx_sub_int | ( | const generic & | x, |
| const int & | y | ||
| ) |
| generic mmx::mmx_supports | ( | const generic & | x ) |
Definition at line 171 of file glue_system.cpp.
Referenced by glue_system().
{
if (N(x) != 2) return wrong_nr_args (x);
generic r= eval_as<string> (x[1]);
if (is<exception> (r) || !is<string> (r)) return r;
string name= as<string> (r);
return as<generic> (dl_exists (name));
}
| generic mmx::mmx_symbol_table | ( | ) |
Definition at line 60 of file glue_inspect.cpp.
References get_environment(), is_nil(), and strings_for_completion().
Referenced by glue_inspect().
{
environment env= get_environment (current_ev);
while (!is_nil (env->next)) env= env->next;
list<string> sl= env -> strings_for_completion ();
table<generic,generic> t (as<generic> (false));
while (!is_nil (sl)) {
generic v= car (sl);
t[v]= as<generic> (true);
sl= cdr (sl);
}
return as<generic> (t);
}
| int mmx::mmx_system | ( | const string & | s ) |
Definition at line 191 of file glue_system.cpp.
Referenced by glue_system().
{
return mmx::system (s);
}
| generic mmx::mmx_times_assign | ( | const generic & | x ) |
Definition at line 260 of file glue_declare.cpp.
References mmx_op_assign().
Referenced by glue_declare().
{
if (N(x) != 3) return wrong_nr_args (x);
return mmx_op_assign (x, 3);
}
| generic mmx::mmx_to | ( | const generic & | start, |
| const generic & | end | ||
| ) |
Definition at line 219 of file glue_control.cpp.
{
return as<generic> (range_iterator<generic> (start, end, 1, false));
}
| vector<generic> mmx::mmx_tokenize | ( | const string & | s, |
| const string & | sep, | ||
| const bool & | flag | ||
| ) |
Definition at line 200 of file glue_system.cpp.
Referenced by glue_system().
{
return as<vector<generic> > (tokenize (s, sep, flag));
}
| generic mmx::mmx_transtype | ( | const generic & | g ) |
Definition at line 56 of file glue_class.cpp.
References convert_to().
Referenced by glue_class().
{
if (N(g) != 3) return wrong_nr_args (g);
generic t= eval (g[2]);
if (is<exception> (t)) return t;
nat t_id= type_id (t);
if (t_id == 1) return type_mismatch (GEN_TYPE_TYPE, g[2]);
generic r= eval (g[1]);
if (is<exception> (r)) return r;
return convert_to (r, t_id, g[1]);
}
| tuple<generic> mmx::mmx_tuple | ( | const tuple< generic > & | t ) |
Definition at line 390 of file glue_control.cpp.
{
return t;
}
| generic mmx::mmx_type | ( | const generic & | g ) |
Definition at line 30 of file glue_inspect.cpp.
References type(), and type_name().
Referenced by glue_inspect().
| generic mmx::mmx_type_name | ( | const int & | i ) |
Definition at line 50 of file glue_inspect.cpp.
References type_name().
Referenced by glue_inspect().
{
nat id= (nat) i;
return type_name (id);
}
| generic mmx::mmx_type_table | ( | ) |
Definition at line 22 of file glue_inspect.cpp.
Referenced by glue_inspect().
{
vector<generic> v= all_type_names ();
table<generic,generic> t (as<generic> (false));
for (nat i=0; i<N(v); i++) t[v[i]]= as<generic> (true);
return as<generic> (t);
}
| generic mmx::mmx_unobject | ( | const generic & | x ) |
Definition at line 212 of file glue_class.cpp.
References type().
Referenced by object_field_rep::close(), object_field_rep::get(), glue_class(), and object_field_rep::open().
{
return as_generic (x, type (x));
}
| generic mmx::mmx_unprotect | ( | const generic & | x ) |
Definition at line 408 of file glue_control.cpp.
{
if (N(x) != 2) return wrong_nr_args (x);
generic it= eval (x[1]);
if (is<compound> (it) && N(it) == 2 && it[0] == "protect") return it[1];
return std_exception ("protected generator expected", x[1]);
}
| generic mmx::mmx_update_string | ( | const generic & | x ) |
Definition at line 113 of file glue_system.cpp.
References mmx_resolve_name().
Referenced by glue_system().
{
if (N(x) != 3) return wrong_nr_args (x);
generic name= eval_as<string> (x[1]);
if (is<exception> (name) || !is<string> (name)) return name;
generic contents= eval_as<string> (x[2]);
if (is<exception> (contents) || !is<string> (contents)) return contents;
string old_contents;
string new_contents= as<string> (contents);
string file_name= mmx_resolve_name (as<string> (name));
ASSERT (file_name != "", "file " * as<string> (name) * " not found");
if (load (file_name, old_contents))
old_contents= (new_contents == ""? string ("x"): string (""));
if (new_contents != old_contents)
if (save (file_name, new_contents))
ERROR ("file " * file_name * " not writable");
return void_value ();
}
| generic mmx::mmx_use | ( | const generic & | x ) |
Definition at line 180 of file glue_system.cpp.
References get_environment(), and verify_if_unknown_types().
Referenced by glue_system().
{
if (N(x) != 2) return wrong_nr_args (x);
generic r= eval_as<string> (x[1]);
if (is<exception> (r) || !is<string> (r)) return r;
string name= as<string> (r);
dl_link (name);
verify_if_unknown_types (get_environment (current_ev));
return void_value ();
}
| generic mmx::mmx_where | ( | const generic & | x ) |
Definition at line 335 of file glue_control.cpp.
References base_evaluator(), extract_iterator(), and unnest_iterator().
{
nat i, n= N(x);
if (n < 3) return wrong_nr_args (x);
if (is_func (x[1], GEN_IN, 2)) {
// TODO: generalize syntax when x[1] is a tuple
// with elements of the form 'variable in generator'.
return mmx_where (append (gen (x[0], x[1][1], x[1]), range (x, 2, N(x))));
}
if (!is_func (x[2], GEN_IN, 2))
return std_exception ("'variable in generator' expected", x[2]);
for (i=3; i<n; i++)
if (is_func (x[i], GEN_IN, 2))
break;
if (i == n) {
generic cond= GEN_TRUE;
if (i > 3) {
cond= x[i-1];
for (nat j=i-2; j>=3; j--)
cond= gen (GEN_SEQAND, x[j], cond);
}
generic body= x[1];
generic var = x[2][1];
if (is_func (var, GEN_TYPE, 2)) {
// FIXME: should really declare variable of specified type
var = var[1];
}
if (!is<literal> (var)) return type_mismatch (GEN_LITERAL_TYPE, var);
generic val= eval_as<iterator<generic> > (x[2][2]);
if (is<exception> (val)) return val;
evaluator ev= base_evaluator (current_ev);
iterator<generic> it= as<iterator<generic> > (val);
iterator<generic> r = extract_iterator (ev, var, it, cond, body);
generic ret= as<generic> (r);
return ret;
}
else {
generic inner= append (gen (x[0], x[1]), range (x, i, n));
generic outer= append (gen (x[0], inner), range (x, 2, i));
generic it= mmx_where (outer);
if (is<exception> (it)) return it;
return as<generic> (unnest_iterator (as<iterator<generic> > (it)));
}
}
| bool mmx::mmx_xor | ( | const bool & | x1, |
| const bool & | x2 | ||
| ) |
Definition at line 70 of file glue_control.cpp.
{
return x1 ^ x2;
}
| evaluator mmx::mmxlight_evaluator | ( | ) |
Definition at line 48 of file mmxlight_evaluator.cpp.
References base_evaluator().
{
evaluator ev= base_evaluator ();
select_evaluator (ev);
define_prerequisites ();
#ifdef BASIX_ENABLE_EMBEDDED
embedded_link= embedded_link_impl;
dl_link ("mmxlight");
dl_link ("basix");
dl_link ("mathemagix");
#else
if (dl_exists ("mmxlight")) dl_link ("mmxlight");
else mmerr << "WARNING: mmxlight library could not be loaded\n";
if (dl_exists ("basix")) dl_link ("basix");
else mmerr << "WARNING: basix library could not be loaded\n";
if (dl_exists ("mathemagix")) dl_link ("mathemagix");
#endif
restore_evaluator ();
return ev;
}
| alias<generic> mmx::object_field | ( | const alias< generic > & | a, |
| const nat & | i | ||
| ) |
Definition at line 258 of file glue_class.cpp.
Referenced by alias_access_routine_rep::apply().
{
return new object_field_rep (a, i); }
| static bool mmx::occurs | ( | const generic & | var, |
| const generic & | x | ||
| ) | [static] |
Definition at line 23 of file glue_declare.cpp.
Referenced by replace().
{
if (x == var) return true;
else if (is<compound> (x)) {
for (nat i=0; i<N(x); i++)
if (occurs (var, x[i]))
return true;
}
return false;
}
| static void mmx::output_banner | ( | ) | [static] |
Definition at line 169 of file init.cpp.
References DATA_BEGIN, DATA_END, and MMXLIGHT_VERSION.
Referenced by shell_initialize().
{
if (texmacs_mode) {
string title= "Welcome to Mathemagix-light " * string (MMXLIGHT_VERSION);
string license= "This software falls under the GNU General Public License";
string warning= "It comes without any warranty whatsoever";
string copyright0= "www.mathemagix.org";
string copyright1= "(c) 2001-2010";
mmout << DATA_BEGIN << "scheme:(document";
mmout << "(tformat (cwith 1 5 1 1 \"cell-halign\" \"c\") (table ";
mmout << "(row (with \"color\" \"blue\" (with \"font-base-size\" 14 \""
* title * "\"))) ";
mmout << "(row (with \"color\" \"blue\" \"" * license * "\")) ";
mmout << "(row (with \"color\" \"orange\" \"" * warning * "\"))";
mmout << "(row \"" << copyright0 << "\")";
mmout << "(row \"" << copyright1 << "\")";
mmout << ")))";
mmout << DATA_END;
}
else {
mmout << "--------------------------------------------------------------\n";
mmout << "|:*) Welcome to Mathemagix-light " << MMXLIGHT_VERSION;
for (nat i=0; i<16-N(string(MMXLIGHT_VERSION)); i++) mmout << " ";
mmout << "(*:|\n";
mmout << "|------------------------------------------------------------|\n";
mmout << "| This software falls under the GNU General Public License |\n";
mmout << "| It comes without any warranty whatsoever |\n";
mmout << "| www.mathemagix.org |\n";
mmout << "| (c) 2001--2010 |\n";
mmout << "--------------------------------------------------------------\n";
}
}
| static void mmx::output_completion | ( | const string & | text, |
| const list< string > & | matches2 | ||
| ) | [static] |
Definition at line 29 of file texmacs.cpp.
References DATA_BEGIN, DATA_END, is_nil(), and matches().
Referenced by complete(), and handle_completion_request().
{
list<string> matches= matches2;
mmout << DATA_BEGIN << "scheme:(tuple ";
mmout << '\"' << text << '\"';
while (!is_nil (matches)) {
if (N (car (matches)) >0)
mmout << " \"" << car (matches) << '\"';
matches = cdr (matches);
}
mmout << ')';
mmout << DATA_END << flush_now;
}
| routine overloaded_routine | ( | const generic & | name, |
| const environment & | env | ||
| ) |
Definition at line 463 of file overload.cpp.
Referenced by base_evaluator_rep::overload(), and REP_STRUCT::resolve().
{
return new overloaded_routine_rep (name, env);
}
| static bool mmx::parse_blanks | ( | const string & | text, |
| nat & | pos | ||
| ) | [static] |
Definition at line 69 of file texmacs.cpp.
Referenced by parse_completion_request().
{
nat beg= pos;
while (pos < N(text) &&
(text[pos] == ' ' || text[pos] == '\t' || text[pos] == '\n'))
++pos;
return (pos > beg);
}
| static bool mmx::parse_char | ( | const string & | text, |
| char | c, | ||
| nat & | pos | ||
| ) | [static] |
Definition at line 62 of file texmacs.cpp.
Referenced by parse_completion_request(), and parse_string().
{
if ((pos >= N(text)) || (text[pos]!=c)) return false;
++pos;
return true;
}
| static bool mmx::parse_completion_request | ( | const string & | text, |
| nat & | pos, | ||
| string & | s, | ||
| nat & | p | ||
| ) | [static] |
Definition at line 113 of file texmacs.cpp.
References parse_blanks(), parse_char(), parse_identifier(), parse_nat(), and parse_string().
Referenced by handle_completion_request().
{
nat i=pos;
if (!parse_char(text, '(', i)) return false;
parse_blanks(text, i);
if (!parse_identifier(text, "complete", i)) return false;
parse_blanks(text, i);
if (!parse_string(text, i, s)) return false;
parse_blanks(text, i);
if (!parse_nat(text, i, p)) return false;
parse_blanks(text, i);
if (!parse_char(text, ')', i)) return false;
pos = i;
return true;
}
| static bool mmx::parse_identifier | ( | const string & | text, |
| const string & | id, | ||
| nat & | pos | ||
| ) | [static] |
Definition at line 87 of file texmacs.cpp.
Referenced by parse_completion_request().
{
nat beg = pos;
for(nat j=0; j < N(id); pos++,j++)
if ((pos >= N(text)) || (text[pos]!=id[j])) {
pos = beg;
return false;
}
return true;
}
| static bool mmx::parse_nat | ( | const string & | text, |
| nat & | pos, | ||
| nat & | out | ||
| ) | [static] |
Definition at line 78 of file texmacs.cpp.
Referenced by parse_completion_request().
{
nat beg= pos;
while (pos < N(text) && text[pos] >= '0' && text[pos] <= '9')
++pos;
out= as_int (text (beg, pos));
return (pos > beg);
}
| static bool mmx::parse_string | ( | const string & | text, |
| nat & | pos, | ||
| string & | out | ||
| ) | [static] |
Definition at line 98 of file texmacs.cpp.
References parse_char().
Referenced by parse_completion_request().
{
bool esc= false;
nat i= pos;
if (!parse_char(text, '\"', i)) return false;
while ((i < N(text)) && (esc || text[i]!='\"')) {
esc = (!esc) && (text[i]=='\\');
++i;
}
out = text(pos+1,i);
if (!parse_char(text,'\"',i)) return false;
pos = i;
return true;
}
| static generic mmx::perform_op | ( | nat | op, |
| const generic & | x, | ||
| const generic & | y | ||
| ) | [static] |
Definition at line 187 of file glue_declare.cpp.
Referenced by mmx_op_assign().
{
switch (op) {
case 1: return x+y;
case 2: return x-y;
case 3: return x*y;
case 4: return x/y;
default: ERROR ("invalid operation (perform_op)");
}
}
| static generic mmx::quote | ( | const generic & | x, |
| nat | level | ||
| ) | [static] |
Definition at line 454 of file glue_declare.cpp.
Referenced by mmx_quote().
{
if (is<compound> (x)) {
if (N(x) == 2 && exact_eq (x[0], GEN_QUOTE))
return gen (x[0], quote (x[1], level+1));
if (N(x) == 2 && exact_eq (x[0], GEN_BACKQUOTE)) {
if (level == 0) return eval (x[1]);
else return gen (x[0], quote (x[1], level-1));
}
else {
const vector<generic> a= compound_to_vector (x);
vector<generic> b= fill<generic> (N(a));
for (nat i=0; i<N(a); i++)
b[i]= quote (a[i], level);
return vector_to_compound (b);
}
}
else return x;
}
| static bool mmx::raw_read_line | ( | string & | line ) | [static] |
Definition at line 41 of file input.cpp.
Referenced by shell_read_line(), and shell_terminal_batch_input().
{
char c;
line = "";
while (busy (mmin)) {
mmin >> c;
if (c == '\n' || c == '\r')
return true;
line << c;
}
return false;
}
| generic mmx::read | ( | const environment & | env, |
| const generic & | x | ||
| ) | [inline] |
Definition at line 93 of file environment.hpp.
Referenced by object_field_rep::get(), environment_rep::get_converter(), mmx_loop(), object_field_rep::open(), and base_evaluator_rep::overload().
{
return env[x]; }
| static generic mmx::replace | ( | const generic & | x, |
| const generic & | var, | ||
| const generic & | by | ||
| ) | [static] |
Definition at line 34 of file glue_declare.cpp.
References occurs().
Referenced by matches_compute(), mmx_forall(), and types_defined().
{
if (x == var) return by;
else if (by == GEN_GENERIC_TYPE && is_func (x, GEN_TYPE, 2) &&
is<compound> (x[1]) && occurs (var, x[2]))
return gen (GEN_TYPE, replace (x[1], var, by), GEN_GENERIC_TYPE);
else if (is<compound> (x)) {
vector<generic> s= compound_to_vector (x);
vector<generic> r= fill<generic> (N(s));
for (nat i=0; i<N(s); i++) r[i]= replace (s[i], var, by);
return vector_to_compound (r);
}
else return x;
}
| void mmx::reset | ( | const environment & | env, |
| const generic & | x | ||
| ) | [inline] |
Definition at line 95 of file environment.hpp.
References environment::reset.
{
return env.rep->reset (x); }
| routine mmx::resolve_routine | ( | const generic & | sym ) |
Definition at line 185 of file glue_class.cpp.
Referenced by mmx_import_resolvers().
{
return new resolve_routine_rep (sym);
}
| void set_environment_type | ( | const evaluator & | ev, |
| nat | tp | ||
| ) |
Definition at line 50 of file base_evaluator.cpp.
References environment_rep::env_type, and get_environment().
Referenced by mmx_class_module().
{
environment_rep* env= inside (get_environment (ev));
env->env_type= tp;
}
| list< string > shell_initialize | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 202 of file init.cpp.
References handle_cmdline_options(), is_nil(), output_banner(), quiet_mode, script_mode, and shell_texmacs_initialize().
{
string first= (argc <= 1? string (""): string (argv[1]));
if (argc >= 2 && file_is_script (argv[1])) {
script_mode= true;
return list<string> (string (argv[1]));
}
else {
list<string> to_load;
to_load = handle_cmdline_options(argc, argv);
if (!quiet_mode && is_nil (to_load)) output_banner();
if (texmacs_mode)
shell_texmacs_initialize();
return to_load;
}
}
| static bool mmx::shell_read_line | ( | string | prompt, |
| string & | line | ||
| ) | [static] |
Definition at line 95 of file input.cpp.
References raw_read_line().
Referenced by shell_terminal_input().
{
mmout << prompt << flush_now;
return raw_read_line (line);
}
| vector< string > shell_restore_session | ( | void | ) |
Definition at line 124 of file input.cpp.
{
string dir = user_dir ();
string file_name = dir * "/var/session";
string data;
load (file_name, data);
store_interactive_number (0);
string sep= "\n\n"; sep[0]= '\0';
vector<string> inputs= tokenize (data, sep);
vector<string> v;
for (nat i=0; i<N(inputs); i++) {
v << tokenize (inputs[i], "\n", true);
store_interactive_source (inputs[i]);
}
return v;
}
| void shell_save_history | ( | void | ) |
| void shell_save_session | ( | void | ) |
Definition at line 109 of file input.cpp.
Referenced by mmx_exit().
{
nat i;
string dir = user_dir ();
string contents = "";
char z = 0;
if (dir == "") return;
string file_name = dir * "/var/session";
for (i = 0; i < get_interactive_number (); ++i) {
contents << get_interactive_source (i);
contents << z << "\n";
}
save (file_name, contents);
}
| bool shell_terminal_batch_input | ( | string & | in ) |
Definition at line 347 of file input.cpp.
References raw_read_line().
{
string s;
bool b;
vector<string> v;
buffer = "";
while (true) {
b = raw_read_line (s);
buffer << s << "\n";
v << s;
if (!b) {
store_interactive_source (recompose (v, "\n"));
return b;
}
}
}
| bool shell_terminal_input | ( | string & | in ) |
Definition at line 325 of file input.cpp.
References quiet_mode, and shell_read_line().
{
vector<string> v;
string prompt;
bool b;
buffer = "";
// entering interactive input
if (quiet_mode)
prompt = "";
else
prompt = as_string (get_interactive_number () + 1) * "] ";
b = shell_read_line (prompt, buffer);
if (N(buffer) != 0) {
v << buffer;
store_interactive_source (recompose (v, "\n"));
buffer << "\n";
}
return b;
}
| void shell_terminal_output | ( | const generic & | g, |
| const generic & | t | ||
| ) |
Definition at line 34 of file output.cpp.
{
if (math_mode) mmout << flatten_as_texmacs_scheme (g);
else mmout << g;
if (exact_neq (t, "None") && exact_neq (t, "Document"))
mmout << ": " << t;
mmout << "\n";
}
| bool shell_terminal_print_exception | ( | const generic & | g ) |
Definition at line 60 of file output.cpp.
References is_nil().
Referenced by shell_terminal_print_parse_errors().
{
nat i;
string s;
generic err;
source_location l;
ASSERT (is <exception> (g), "invalid exception");
if (has_trace (g)) {
shell_terminal_print_exception (trace_pull (g));
shell_terminal_print_exception (trace_top (g));
return true;
}
err = *as <exception> (g);
ASSERT (is <compound> (err), "invalid error message");
ASSERT (N(err) > 2, "invalid error message");
source_locate (err[N(err)-1], l);
if (is_nil (l)) mmerr << "Inside " << err[N(err)-1] << ": ";
else {
if (l.file_name != "")
mmerr << l.file_name << ":";
mmerr << l.begin.line+1 << ":"
<< l.begin.column+1 << ": ";
}
if (err[1] == "error") mmerr << err[0] << ", ";
else if (err[1] == "warning") mmerr << "warning, ";
else {
mmerr << err[0] << ", ";
mmerr << err[1] << " ";
}
for (i = 2; i+1 < N(err); i++)
mmerr << err[i] << " ";
mmerr << "\n";
mmerr << source_underlined (err[N(err)-1]);
return true;
}
| bool shell_terminal_print_parse_errors | ( | const list< generic > & | errors ) |
Definition at line 47 of file output.cpp.
References shell_terminal_print_exception().
{
bool raise_error= false;
iterator<generic> it = iterate (reverse (errors));
for (; busy(it); ++it) {
generic err= *it;
string msg= literal_to_string ((*as<exception> (err)) [1]);
if (!starts (msg, "warning")) raise_error = true;
shell_terminal_print_exception (err);
}
return raise_error;
}
| void shell_texmacs_initialize | ( | void | ) |
Definition at line 151 of file texmacs.cpp.
References completion_mode, DATA_BEGIN, and DATA_END.
Referenced by shell_initialize().
{
dynamic_event= texmacs_dynamic_event;
mmout << DATA_BEGIN << "verbatim:";
if (completion_mode) {
mmout << DATA_BEGIN << "command:";
mmout << "(plugin-configure mathemagix (:tab-completion #t))";
mmout << DATA_END;
}
}
| bool shell_texmacs_input | ( | string & | in ) |
Definition at line 162 of file texmacs.cpp.
References completion_mode, DATA_BEGIN, DATA_COMMAND, DATA_END, and handle_completion_request().
{
static nat nr= 1;
string next= "\"" * as_string (nr++) * "\"";
mmout << DATA_BEGIN << "channel:prompt" << DATA_END;
mmout << DATA_BEGIN << "scheme:(mmx-prompt " << next << ")" << DATA_END;
mmout << texmacs_flush_commands ();
mmout << DATA_END << flush_now;
string in;
string request;
char c;
nat discard=0;
while (busy (mmin)) {
mmin >> c;
if (c==DATA_COMMAND) {
discard++;
continue;
}
if (c=='\n' && discard) {
discard--;
if (discard==0) {
if (completion_mode)
handle_completion_request(request);
request = string("");
}
continue;
}
if (discard) {
request << c;
continue;
}
if (c=='\n' && !discard) break;
in << c;
}
mmout << DATA_BEGIN << "verbatim:";
if (N(in)==0 && c==EOF) {
mmout << DATA_END << flush_now;
return false;
}
line = recompose (tokenize (in, "/{CR}/"), "\n", true);
store_interactive_source (line);
return true;
}
| void shell_texmacs_output | ( | const generic & | g, |
| const generic & | t | ||
| ) |
Definition at line 208 of file texmacs.cpp.
References DATA_BEGIN, and DATA_END.
{
if (math_mode) {
mmout << DATA_BEGIN << "scheme:";
mmout << flatten_as_texmacs_scheme (g);
mmout << DATA_END;
}
else
mmout << g;
if (exact_neq (t, "None") && exact_neq (t, "Document"))
mmout << ": " << t;
mmout << "\n";
}
| int mmx::simple_loop | ( | const int & | i, |
| const int & | j | ||
| ) |
Definition at line 210 of file glue_system.cpp.
Referenced by glue_system().
{
threads_simple_loop (i, j);
return 0;
}
| routine mmx::specialize_alias_routine | ( | const routine & | fun, |
| const vector< nat > & | sig | ||
| ) |
Definition at line 183 of file overload.cpp.
Referenced by overloaded_routine_rep::resolve().
{
return new specialize_alias_routine_rep (fun, sig);
}
| list<string> mmx::strings_for_completion | ( | const environment & | env ) | [inline] |
Return the list of all the litterals which are entries of the bindings.
Definition at line 99 of file environment.hpp.
References environment::strings_for_completion.
Referenced by complete(), and mmx_symbol_table().
{
return env.rep->strings_for_completion (); }
| generic mmx::tag | ( | const generic & | name, |
| nat | id1, | ||
| nat | id2 | ||
| ) | [inline] |
Definition at line 123 of file environment.cpp.
{
return gen (name, as<generic> (id1), as<generic> (id2)); }
| generic mmx::tag | ( | const generic & | name, |
| nat | id | ||
| ) | [inline] |
Definition at line 121 of file environment.cpp.
Referenced by environment_rep::get_converter(), and environment_rep::set_converter().
{
return gen (name, as<generic> (id)); }
| static vector<nat> mmx::type | ( | const vector< generic > & | args ) | [static] |
Definition at line 192 of file overload.cpp.
Referenced by overloaded_routine_rep::apply(), specialize_alias_routine_rep::apply(), base_evaluator_rep::apply(), object_field_rep::close(), base_evaluator_rep::construct(), convert_to(), equalize(), is_grouped(), mmx_op_assign(), mmx_type(), mmx_unobject(), and overloaded_routine_rep::resolve().
{
nat i, n= N(args);
vector<nat> r= fill<nat> ((nat) 0, n);
for (i=0; i<n; i++)
r[i]= type (args[i]);
return r;
}
| vector<generic> mmx::type_name | ( | const vector< nat > & | ids ) |
Definition at line 201 of file overload.cpp.
Referenced by exception_routine_rep::apply(), convert_to(), mmx_type(), mmx_type_name(), and environment_rep::verify_if_unknown_types().
{
nat i, n= N(ids);
vector<generic> r= fill<generic> (n);
for (i=0; i<n; i++)
r[i]= type_name (ids[i]);
return r;
}
| static bool mmx::types_defined | ( | const generic & | x, |
| const vector< generic > & | all | ||
| ) | [static] |
Definition at line 114 of file glue_declare.cpp.
References replace().
Referenced by mmx_forall().
{
if (is_func (x, GEN_FORALL)) {
if (N(x) > 3)
return types_defined (gen (x[0], gen (x[1]),
gen (x[0], cdr (compound_to_vector (x)))),
all);
else {
ASSERT (is_func (x[1], GEN_TYPE, 2), "syntax error");
return types_defined (replace (x[2], x[1][1], GEN_GENERIC_TYPE), all);
}
}
else if (is_func (x, GEN_TYPE, 2) || is_func (x, GEN_CONVERT, 2)) {
generic tp= x[2];
if (is_func (tp, GEN_ALIAS_TYPE, 1)) tp= tp[1];
if (is_func (tp, GEN_TUPLE_TYPE, 1)) tp= tp[1];
if (!contains (all, tp)) return false;
return types_defined (x[1], all);
}
else if (is<compound> (x)) {
for (nat i=0; i<N(x); i++)
if (!types_defined (x[i], all))
return false;
}
return true;
}
| iterator<generic> mmx::unnest_iterator | ( | const iterator< generic > & | it ) | [inline] |
Definition at line 330 of file glue_control.cpp.
Referenced by mmx_where().
{
return iterator<generic> (new unnest_iterator_rep (it));
}
| static vector<nat> mmx::untuple | ( | const vector< nat > & | ids, |
| nat | total | ||
| ) | [static] |
Definition at line 219 of file overload.cpp.
Referenced by build(), and conversion_penalty().
{
nat i, n= N(ids), tupid= tuple_to_scalar (ids[n-1]);
vector<nat> r= fill<nat> ((nat) 0, total);
for (i=0; i<n-1; i++)
r[i]= ids[i];
for (; i<total; i++)
r[i]= tupid;
return r;
}
| void mmx::verify_if_unknown_types | ( | const environment & | env ) | [inline] |
Check if Unknown type occurs in signatures.
Definition at line 103 of file environment.hpp.
References environment::verify_if_unknown_types.
Referenced by mmx_use().
{
return env.rep->verify_if_unknown_types (); }
| routine mmx::via_tuple_routine | ( | const routine & | fun, |
| const vector< nat > & | sig, | ||
| nat | n | ||
| ) |
Definition at line 156 of file overload.cpp.
Referenced by build(), and overloaded_routine_rep::overload().
{
return new via_tuple_routine_rep (fun, sig, n);
}
| mmx::WRAP_INDIRECT_IMPL | ( | inline | , |
| var_exception | |||
| ) | const |
| mmx::WRAP_INDIRECT_IMPL | ( | inline | , |
| module | |||
| ) | const |
| nat backtrace_depth |
Referenced by backtrace_depth_rep::get(), and backtrace_depth_rep::open().
| bool batch_mode = true |
Definition at line 33 of file init.cpp.
Referenced by glue_interface(), and mmx_exit().
| bool completion_mode = true |
Definition at line 32 of file init.cpp.
Referenced by handle_cmdline_options(), shell_texmacs_initialize(), and shell_texmacs_input().
| bool debug_mode = false |
Definition at line 27 of file init.cpp.
Referenced by glue_interface(), and handle_cmdline_options().
| nat history_size = 100 |
Definition at line 30 of file init.cpp.
Referenced by glue_interface().
| list< string > identifiers_for_completion |
list<string> ("case", "continue", "else", "error") * list<string> ("exists", "for", "generate", "in") * list<string> ("operator", "postfix", "prefix", "step") * list<string> ("until", "while")
Definition at line 39 of file init.cpp.
Referenced by complete().
| bool no_boot = false |
Definition at line 36 of file init.cpp.
Referenced by handle_cmdline_options().
| bool quiet_mode = false |
Definition at line 26 of file init.cpp.
Referenced by glue_interface(), handle_cmdline_options(), shell_initialize(), and shell_terminal_input().
| bool replay_mode = false |
Definition at line 34 of file init.cpp.
Referenced by handle_cmdline_options().
| bool script_mode = false |
Definition at line 25 of file init.cpp.
Referenced by shell_initialize().
| bool time_mode = false |
Definition at line 29 of file init.cpp.
Referenced by glue_interface().
| bool type_mode = false |
Definition at line 28 of file init.cpp.
Referenced by glue_interface().
1.7.2