Merge branch 'develop' of github.com:ChaiScript/ChaiScript into develop

This commit is contained in:
Jason Turner 2016-01-29 13:57:57 -07:00
commit d8fa6061a2
6 changed files with 15 additions and 16 deletions

View File

@ -596,13 +596,13 @@ namespace chaiscript
/// Pushes a new stack on to the list of stacks /// Pushes a new stack on to the list of stacks
void new_stack(Stack_Holder &t_holder) static void new_stack(Stack_Holder &t_holder)
{ {
// add a new Stack with 1 element // add a new Stack with 1 element
t_holder.stacks.emplace_back(1); t_holder.stacks.emplace_back(1);
} }
void pop_stack(Stack_Holder &t_holder) static void pop_stack(Stack_Holder &t_holder)
{ {
t_holder.stacks.pop_back(); t_holder.stacks.pop_back();
} }
@ -1082,7 +1082,7 @@ namespace chaiscript
/// Returns true if a call can be made that consists of the first parameter /// Returns true if a call can be made that consists of the first parameter
/// (the function) with the remaining parameters as its arguments. /// (the function) with the remaining parameters as its arguments.
Boxed_Value call_exists(const std::vector<Boxed_Value> &params) Boxed_Value call_exists(const std::vector<Boxed_Value> &params) const
{ {
if (params.empty()) if (params.empty())
{ {
@ -1160,12 +1160,12 @@ namespace chaiscript
m_state = t_state; m_state = t_state;
} }
void save_function_params(Stack_Holder &t_s, std::initializer_list<Boxed_Value> t_params) static void save_function_params(Stack_Holder &t_s, std::initializer_list<Boxed_Value> t_params)
{ {
t_s.call_params.back().insert(t_s.call_params.back().begin(), std::move(t_params)); t_s.call_params.back().insert(t_s.call_params.back().begin(), std::move(t_params));
} }
void save_function_params(Stack_Holder &t_s, std::vector<Boxed_Value> &&t_params) static void save_function_params(Stack_Holder &t_s, std::vector<Boxed_Value> &&t_params)
{ {
for (auto &&param : t_params) for (auto &&param : t_params)
{ {
@ -1173,7 +1173,7 @@ namespace chaiscript
} }
} }
void save_function_params(Stack_Holder &t_s, const std::vector<Boxed_Value> &t_params) static void save_function_params(Stack_Holder &t_s, const std::vector<Boxed_Value> &t_params)
{ {
t_s.call_params.back().insert(t_s.call_params.back().begin(), t_params.begin(), t_params.end()); t_s.call_params.back().insert(t_s.call_params.back().begin(), t_params.begin(), t_params.end());
} }
@ -1240,7 +1240,7 @@ namespace chaiscript
return m_stack_holder->stacks.back(); return m_stack_holder->stacks.back();
} }
StackData &get_stack_data(Stack_Holder &t_holder) static StackData &get_stack_data(Stack_Holder &t_holder)
{ {
return t_holder.stacks.back(); return t_holder.stacks.back();
} }

View File

@ -32,7 +32,7 @@ namespace chaiscript
protected: protected:
template<typename T> template<typename T>
void throw_type(const Boxed_Value &bv, const Dispatch_Engine &t_engine) static void throw_type(const Boxed_Value &bv, const Dispatch_Engine &t_engine)
{ {
try { T t = t_engine.boxed_cast<T>(bv); throw t; } catch (const chaiscript::exception::bad_boxed_cast &) {} try { T t = t_engine.boxed_cast<T>(bv); throw t; } catch (const chaiscript::exception::bad_boxed_cast &) {}
} }

View File

@ -177,11 +177,11 @@ namespace chaiscript
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, nullptr,
t_err, t_err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
reinterpret_cast<StringType>(&lpMsgBuf), reinterpret_cast<StringType>(&lpMsgBuf),
0, NULL ) != 0 && lpMsgBuf) 0, nullptr ) != 0 && lpMsgBuf)
{ {
retval = lpMsgBuf; retval = lpMsgBuf;
LocalFree(lpMsgBuf); LocalFree(lpMsgBuf);

View File

@ -278,7 +278,7 @@ namespace chaiscript
bool char_in_alphabet(char c, detail::Alphabet a) const { return m_alphabet[a][static_cast<uint8_t>(c)]; } bool char_in_alphabet(char c, detail::Alphabet a) const { return m_alphabet[a][static_cast<uint8_t>(c)]; }
/// Prints the parsed ast_nodes as a tree /// Prints the parsed ast_nodes as a tree
void debug_print(AST_NodePtr t, std::string prepend = "") { void debug_print(AST_NodePtr t, std::string prepend = "") const {
std::cout << prepend << "(" << ast_node_type_to_string(t->identifier) << ") " << t->text << " : " << t->start().line << ", " << t->start().column << '\n'; std::cout << prepend << "(" << ast_node_type_to_string(t->identifier) << ") " << t->text << " : " << t->start().line << ", " << t->start().column << '\n';
for (unsigned int j = 0; j < t->children.size(); ++j) { for (unsigned int j = 0; j < t->children.size(); ++j) {
debug_print(t->children[j], prepend + " "); debug_print(t->children[j], prepend + " ");

View File

@ -66,7 +66,7 @@ std::vector<std::string> default_search_paths()
#ifdef CHAISCRIPT_WINDOWS // force no unicode #ifdef CHAISCRIPT_WINDOWS // force no unicode
CHAR path[4096]; CHAR path[4096];
int size = GetModuleFileNameA(0, path, sizeof(path)-1); int size = GetModuleFileNameA(nullptr, path, sizeof(path)-1);
std::string exepath(path, size); std::string exepath(path, size);
@ -344,17 +344,16 @@ int main(int argc, char *argv[])
mode = eFile; mode = eFile;
} }
chaiscript::Boxed_Value val ;
try { try {
switch ( mode ) { switch ( mode ) {
case eInteractive: case eInteractive:
interactive(chai); interactive(chai);
break; break;
case eCommand: case eCommand:
val = chai.eval(arg); chai.eval(arg);
break; break;
case eFile: case eFile:
val = chai.eval_file(arg); chai.eval_file(arg);
} }
} }
catch (const chaiscript::exception::eval_error &ee) { catch (const chaiscript::exception::eval_error &ee) {

View File

@ -397,7 +397,7 @@ class Short_Comparison_Test {
public: public:
Short_Comparison_Test() : value_(5) {} Short_Comparison_Test() : value_(5) {}
short get_value() { return value_; } short get_value() const { return value_; }
short value_; short value_;
}; };