Merge branch 'master' into 2011-09-09-CxScript
Conflicts: CMakeLists.txt include/chaiscript/dispatchkit/boxed_value.hpp include/chaiscript/language/chaiscript_eval.hpp
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
|
||||
#include "boxed_value.hpp"
|
||||
@@ -896,6 +897,29 @@ namespace chaiscript
|
||||
m_state = t_state;
|
||||
}
|
||||
|
||||
void save_function_params(const std::vector<Boxed_Value> &t_params)
|
||||
{
|
||||
m_stack_holder->call_params.insert(m_stack_holder->call_params.begin(), t_params.begin(), t_params.end());
|
||||
}
|
||||
|
||||
void new_function_call()
|
||||
{
|
||||
++m_stack_holder->call_depth;
|
||||
}
|
||||
|
||||
void pop_function_call()
|
||||
{
|
||||
--m_stack_holder->call_depth;
|
||||
|
||||
assert(m_stack_holder->call_depth >= 0);
|
||||
|
||||
if (m_stack_holder->call_depth == 0)
|
||||
{
|
||||
/// \todo Critical: this needs to be smarter, memory can expand quickly
|
||||
/// in tight loops involving function calls
|
||||
m_stack_holder->call_params.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -1082,6 +1106,7 @@ namespace chaiscript
|
||||
struct Stack_Holder
|
||||
{
|
||||
Stack_Holder()
|
||||
: call_depth(0)
|
||||
{
|
||||
Stack s(new StackData());
|
||||
s->push_back(Scope());
|
||||
@@ -1089,6 +1114,9 @@ namespace chaiscript
|
||||
}
|
||||
|
||||
std::deque<Stack> stacks;
|
||||
|
||||
std::list<Boxed_Value> call_params;
|
||||
int call_depth;
|
||||
};
|
||||
|
||||
std::vector<Dynamic_Cast_Conversion> m_conversions;
|
||||
|
Reference in New Issue
Block a user