Changed to using to_string as dispatch instead of print and puts
This commit is contained in:
parent
60b814f687
commit
6ddef8f918
@ -5,19 +5,17 @@
|
|||||||
#define CHAISCRIPT_PRELUDE_HPP_
|
#define CHAISCRIPT_PRELUDE_HPP_
|
||||||
|
|
||||||
const char *chaiscript_prelude = " \n\
|
const char *chaiscript_prelude = " \n\
|
||||||
def puts(x) : call_exists(range, x) { \n\
|
def to_string(x) : call_exists(range, x) { \n\
|
||||||
puts(\"[ \") \n\
|
var outstr = \"[\" + x.join(\", \") + \"]\"\n\
|
||||||
x.for_each(fun(x) { puts(x); puts(\" \") }) \n\
|
outstr \n\
|
||||||
puts(\"]\") \n\
|
}\n\
|
||||||
|
def to_string(x) { \n\
|
||||||
|
var outstr = x.internal_to_string()\n\
|
||||||
|
outstr \n\
|
||||||
}\n\
|
}\n\
|
||||||
def puts(x) { \n\
|
def puts(x) { \n\
|
||||||
print_string(x.to_string()) \n\
|
print_string(x.to_string()) \n\
|
||||||
}; \n\
|
}; \n\
|
||||||
def print(x) : call_exists(range, x) { \n\
|
|
||||||
puts(\"[ \") \n\
|
|
||||||
x.for_each(fun(x) { puts(x); puts(\" \") }) \n\
|
|
||||||
print(\"]\") \n\
|
|
||||||
} \n\
|
|
||||||
def print(x) { \n\
|
def print(x) { \n\
|
||||||
println_string(x.to_string()) \n\
|
println_string(x.to_string()) \n\
|
||||||
}; \n\
|
}; \n\
|
||||||
|
@ -472,8 +472,8 @@ namespace dispatchkit
|
|||||||
add_oper_assign<std::string>(s);
|
add_oper_assign<std::string>(s);
|
||||||
|
|
||||||
|
|
||||||
register_function(s, &to_string<const std::string &>, "to_string");
|
register_function(s, &to_string<const std::string &>, "internal_to_string");
|
||||||
register_function(s, &to_string<bool>, "to_string");
|
register_function(s, &to_string<bool>, "internal_to_string");
|
||||||
register_function(s, &unknown_assign, "=");
|
register_function(s, &unknown_assign, "=");
|
||||||
|
|
||||||
bootstrap_pod_type<double>(s, "double");
|
bootstrap_pod_type<double>(s, "double");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user