Fix some range/retro issues and update the visual studio files
This commit is contained in:
@@ -50,7 +50,7 @@ namespace chaiscript
|
|||||||
template<typename Fun>
|
template<typename Fun>
|
||||||
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> ¶ms)
|
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> ¶ms)
|
||||||
{
|
{
|
||||||
return Handle_Return<Ret>::handle(call_func(fun, params, false));
|
return Handle_Return<Ret>::handle(call_func(fun, params));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ namespace chaiscript
|
|||||||
template<typename Fun>
|
template<typename Fun>
|
||||||
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> ¶ms)
|
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> ¶ms)
|
||||||
{
|
{
|
||||||
call_func(fun, params, false);
|
call_func(fun, params);
|
||||||
return Handle_Return<void>::handle();
|
return Handle_Return<void>::handle();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -100,7 +100,7 @@ namespace chaiscript
|
|||||||
*/
|
*/
|
||||||
template<typename Ret BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
template<typename Ret BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
||||||
Ret call_func(const boost::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))> &f,
|
Ret call_func(const boost::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))> &f,
|
||||||
const std::vector<Boxed_Value> ¶ms, bool t_test)
|
const std::vector<Boxed_Value> ¶ms)
|
||||||
{
|
{
|
||||||
if (params.size() != n)
|
if (params.size() != n)
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ namespace chaiscript
|
|||||||
*/
|
*/
|
||||||
template<typename Ret BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
template<typename Ret BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename Param)>
|
||||||
bool compare_types_cast(Ret (*)(BOOST_PP_ENUM_PARAMS(n, Param)),
|
bool compare_types_cast(Ret (*)(BOOST_PP_ENUM_PARAMS(n, Param)),
|
||||||
const std::vector<Boxed_Value> ¶ms)
|
const std::vector<Boxed_Value> & BOOST_PP_IF(n, params, ))
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
BOOST_PP_REPEAT(n, trycast, ~);
|
BOOST_PP_REPEAT(n, trycast, ~);
|
||||||
|
@@ -58,27 +58,31 @@ def reverse(container) {\n\
|
|||||||
r.pop_back(); \n\
|
r.pop_back(); \n\
|
||||||
} \n\
|
} \n\
|
||||||
retval; \n\
|
retval; \n\
|
||||||
} \
|
} \n\
|
||||||
|
# Return a range from a range \n\
|
||||||
|
def range(r) : call_exists(empty, r) && call_exists(pop_front, r) && call_exists(pop_back, r) && call_exists(back, r) && call_exists(front, r) { return clone(r); }\n\
|
||||||
# The retro attribute that contains the underlying range \n\
|
# The retro attribute that contains the underlying range \n\
|
||||||
attr retro::range; \n\
|
attr retro::m_range; \n\
|
||||||
# Creates a retro from a retro by returning the original range\n\
|
# Creates a retro from a retro by returning the original range\n\
|
||||||
def retro(r) : call_exists(get_type_name, r) && get_type_name(r) == "retro" { clone(r.range) }\n\
|
def retro(r) : call_exists(get_type_name, r) && get_type_name(r) == "retro" { clone(r.m_range) }\n\
|
||||||
# Creates a retro range from a range\n\
|
# Creates a retro range from a range\n\
|
||||||
def retro::retro(r) : call_exists(empty, r) && call_exists(pop_front, r) && call_exists(pop_back, r) && call_exists(back, r) && call_exists(front, r) { this.range = r; }\n\
|
def retro::retro(r) : call_exists(empty, r) && call_exists(pop_front, r) && call_exists(pop_back, r) && call_exists(back, r) && call_exists(front, r) { this.m_range = r; }\n\
|
||||||
# Returns the first value of a retro\n\
|
# Returns the first value of a retro\n\
|
||||||
def retro::front() { back(this.range) }\n\
|
def retro::front() { back(this.m_range) }\n\
|
||||||
# Returns the last value of a retro\n\
|
# Returns the last value of a retro\n\
|
||||||
def retro::back() { front(this.range) }\n\
|
def retro::back() { front(this.m_range) }\n\
|
||||||
# Moves the back iterator of a retro towards the front by one \n\
|
# Moves the back iterator of a retro towards the front by one \n\
|
||||||
def retro::pop_back() { pop_front(this.range) }\n\
|
def retro::pop_back() { pop_front(this.m_range) }\n\
|
||||||
# Moves the front iterator of a retro towards the back by one \n\
|
# Moves the front iterator of a retro towards the back by one \n\
|
||||||
def retro::pop_front() { pop_back(this.range) } \n\
|
def retro::pop_front() { pop_back(this.m_range) } \n\
|
||||||
|
# returns true if the retro is out of elements \n\
|
||||||
|
def retro::empty() { empty(this.m_range); } \n\
|
||||||
# Performs the second value function over the container first value\n\
|
# Performs the second value function over the container first value\n\
|
||||||
def for_each(container, func) : call_exists(range, container) { \n\
|
def for_each(container, func) : call_exists(range, container) { \n\
|
||||||
var range = range(container); \n\
|
var t_range = range(container); \n\
|
||||||
while (!range.empty()) { \n\
|
while (!t_range.empty()) { \n\
|
||||||
func(range.front()); \n\
|
func(t_range.front()); \n\
|
||||||
range.pop_front(); \n\
|
t_range.pop_front(); \n\
|
||||||
} \n\
|
} \n\
|
||||||
} \n\
|
} \n\
|
||||||
def back_inserter(container) { \n\
|
def back_inserter(container) { \n\
|
||||||
|
@@ -221,10 +221,18 @@
|
|||||||
RelativePath="..\..\include\chaiscript\language\chaiscript_prelude.hpp"
|
RelativePath="..\..\include\chaiscript\language\chaiscript_prelude.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\chaiscript\chaiscript_threading.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\chaiscript\dispatchkit\dispatchkit.hpp"
|
RelativePath="..\..\include\chaiscript\dispatchkit\dispatchkit.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\chaiscript\dispatchkit\dynamic_object.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\chaiscript\dispatchkit\function_call.hpp"
|
RelativePath="..\..\include\chaiscript\dispatchkit\function_call.hpp"
|
||||||
>
|
>
|
||||||
|
Reference in New Issue
Block a user