Spelling fixes, phase 1.
This commit is contained in:
parent
e5d723621f
commit
4018c873dc
@ -297,11 +297,11 @@ if(BUILD_TESTING)
|
||||
|
||||
add_executable(simultaneous_chaiscript_test unittests/simultaneous_chaiscript_test.cpp)
|
||||
target_link_libraries(simultaneous_chaiscript_test ${LIBS})
|
||||
add_test(NAME Simultaneous_Chaiscript_Test COMMAND simultaneous_chaiscript_test)
|
||||
add_test(NAME Simultaneous_ChaiScript_Test COMMAND simultaneous_chaiscript_test)
|
||||
|
||||
add_executable(heap_allocated_chaiscript_test unittests/heap_allocated_chaiscript_test.cpp)
|
||||
target_link_libraries(heap_allocated_chaiscript_test ${LIBS})
|
||||
add_test(NAME Heap_Allocated_Chaiscript_Test COMMAND heap_allocated_chaiscript_test)
|
||||
add_test(NAME Heap_Allocated_ChaiScript_Test COMMAND heap_allocated_chaiscript_test)
|
||||
|
||||
add_executable(c_linkage_test unittests/c_linkage_test.cpp)
|
||||
target_link_libraries(c_linkage_test ${LIBS})
|
||||
|
@ -38,7 +38,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
$language_data = array (
|
||||
'LANG_NAME' => 'Chaiscript',
|
||||
'LANG_NAME' => 'ChaiScript',
|
||||
'COMMENT_SINGLE' => array(1 => '//'),
|
||||
'COMMENT_MULTI' => array('/*' => '*/'),
|
||||
//Regular Expressions
|
||||
|
@ -39,10 +39,10 @@
|
||||
/// - @ref basics
|
||||
/// - @ref compiling
|
||||
/// - @ref eval
|
||||
/// - @ref addingitems
|
||||
/// - @ref adding_items
|
||||
/// - @ref operatoroverloading
|
||||
/// - @ref add_class
|
||||
/// - @ref pointerconversions
|
||||
/// - @ref pointer_conversions
|
||||
/// - @ref baseclasses
|
||||
/// - @ref functionobjects
|
||||
/// - @ref threading
|
||||
@ -138,11 +138,11 @@
|
||||
///
|
||||
/// --------------------------------------------------
|
||||
///
|
||||
/// @subsection addingitems Adding Items to ChaiScript
|
||||
/// @subsection adding_items Adding Items to ChaiScript
|
||||
///
|
||||
/// ChaiScript supports 4 basic things that can be added: objects, functions, type infos and Modules
|
||||
///
|
||||
/// @subsubsection addingobjects Adding Objects
|
||||
/// @subsubsection adding_objects Adding Objects
|
||||
///
|
||||
/// Named objects can be created with the chaiscript::var function. Note: adding a object
|
||||
/// adds it to the current thread scope, not to a global scope. If you have multiple
|
||||
@ -173,7 +173,7 @@
|
||||
/// chai("def somefun() { print(i); }; sumfun();");
|
||||
/// ~~~~~~~~~
|
||||
///
|
||||
/// @subsubsection addingfunctions Adding Functions
|
||||
/// @subsubsection adding_functions Adding Functions
|
||||
///
|
||||
/// Functions, methods and members are all added using the same function: chaiscript::fun.
|
||||
///
|
||||
@ -227,7 +227,7 @@
|
||||
/// chai.add(user_type<MyClass>(), "MyClass");
|
||||
/// ~~~~~~~~
|
||||
///
|
||||
/// @subsubsection addingmodules Adding Modules
|
||||
/// @subsubsection adding_modules Adding Modules
|
||||
///
|
||||
/// Modules are holders for collections of ChaiScript registrations.
|
||||
///
|
||||
@ -261,7 +261,7 @@
|
||||
/// chai.add(fun(append_string_int), "+");
|
||||
/// ~~~~~~~~
|
||||
///
|
||||
/// @sa @ref addingfunctions
|
||||
/// @sa @ref adding_functions
|
||||
///
|
||||
/// -----------------------------------------------------------------------
|
||||
///
|
||||
@ -302,11 +302,11 @@
|
||||
/// }
|
||||
/// ~~~~~~~~
|
||||
///
|
||||
/// @sa @ref addingmodules
|
||||
/// @sa @ref adding_modules
|
||||
///
|
||||
/// -----------------------------------------------------------------------
|
||||
///
|
||||
/// @subsection pointerconversions Pointer / Object Conversions
|
||||
/// @subsection pointer_conversions Pointer / Object Conversions
|
||||
///
|
||||
/// As much as possible, ChaiScript attempts to convert between &, *, const &, const *, std::shared_ptr<T>,
|
||||
/// std::shared_ptr<const T>, std::reference_wrapper<T>, std::reference_wrapper<const T> and value types automatically.
|
||||
@ -389,7 +389,7 @@
|
||||
///
|
||||
/// @subsection functionobjects Function Objects
|
||||
///
|
||||
/// Functions are first class objects in Chaiscript and ChaiScript supports automatic conversion
|
||||
/// Functions are first class objects in ChaiScript and ChaiScript supports automatic conversion
|
||||
/// between ChaiScript functions and std::function objects.
|
||||
///
|
||||
/// ~~~~~~~~{.cpp}
|
||||
@ -614,8 +614,8 @@
|
||||
///
|
||||
/// ~~~~~~~~
|
||||
/// eval> def callfunc(f, lhs, rhs) { return f(lhs, rhs); }
|
||||
/// eval> def dosomething(lhs, rhs) { print("lhs: ${lhs}, rhs: ${rhs}"); }
|
||||
/// eval> callfunc(dosomething, 1, 2);
|
||||
/// eval> def do_something(lhs, rhs) { print("lhs: ${lhs}, rhs: ${rhs}"); }
|
||||
/// eval> callfunc(do_something, 1, 2);
|
||||
/// lhs: 1, rhs: 2
|
||||
/// ~~~~~~~~
|
||||
///
|
||||
|
@ -334,8 +334,8 @@ namespace chaiscript
|
||||
push_back_name = "push_back";
|
||||
}
|
||||
|
||||
typedef void (ContainerType::*pushback)(const typename ContainerType::value_type &);
|
||||
m->add(fun(static_cast<pushback>(&ContainerType::push_back)), push_back_name);
|
||||
typedef void (ContainerType::*push_back)(const typename ContainerType::value_type &);
|
||||
m->add(fun(static_cast<push_back>(&ContainerType::push_back)), push_back_name);
|
||||
m->add(fun(&ContainerType::pop_back), "pop_back");
|
||||
return m;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ namespace chaiscript
|
||||
/// chai.add(chaiscript::var(&i), "ip");
|
||||
/// ~~~
|
||||
///
|
||||
/// @sa @ref addingobjects
|
||||
/// @sa @ref adding_objects
|
||||
template<typename T>
|
||||
Boxed_Value var(T t)
|
||||
{
|
||||
@ -328,7 +328,7 @@ namespace chaiscript
|
||||
/// \endcode
|
||||
///
|
||||
/// \todo support C++11 strongly typed enums
|
||||
/// \sa \ref addingobjects
|
||||
/// \sa \ref adding_objects
|
||||
template<typename T>
|
||||
Boxed_Value const_var(const T &t)
|
||||
{
|
||||
|
@ -365,7 +365,7 @@ namespace chaiscript
|
||||
|
||||
++begin;
|
||||
|
||||
bool sizemismatch = false;
|
||||
bool size_mismatch = false;
|
||||
|
||||
while (begin != end)
|
||||
{
|
||||
@ -373,7 +373,7 @@ namespace chaiscript
|
||||
|
||||
if (param_types.size() != type_infos.size())
|
||||
{
|
||||
sizemismatch = true;
|
||||
size_mismatch = true;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < type_infos.size() && i < param_types.size(); ++i)
|
||||
@ -389,7 +389,7 @@ namespace chaiscript
|
||||
|
||||
assert(type_infos.size() > 0 && " type_info vector size is < 0, this is only possible if something else is broken");
|
||||
|
||||
if (sizemismatch)
|
||||
if (size_mismatch)
|
||||
{
|
||||
type_infos.resize(1);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ namespace chaiscript
|
||||
/// chai.add(fun(&MyClass::memberdata), "memberdata");
|
||||
/// \endcode
|
||||
///
|
||||
/// \sa \ref addingfunctions
|
||||
/// \sa \ref adding_functions
|
||||
template<typename T>
|
||||
Proxy_Function fun(T t)
|
||||
{
|
||||
@ -114,7 +114,7 @@ namespace chaiscript
|
||||
/// chai.add(fun(f), "some_function");
|
||||
/// \endcode
|
||||
///
|
||||
/// \sa \ref addingfunctions
|
||||
/// \sa \ref adding_functions
|
||||
template<typename T>
|
||||
Proxy_Function fun(const std::function<T> &f)
|
||||
{
|
||||
@ -139,7 +139,7 @@ namespace chaiscript
|
||||
/// chai.add(fun(&MyClass::memberfunction, std::ref(obj)), "memberfunction");
|
||||
/// \endcode
|
||||
///
|
||||
/// \sa \ref addingfunctions
|
||||
/// \sa \ref adding_functions
|
||||
template<typename T, typename Q>
|
||||
Proxy_Function fun(T t, const Q &q)
|
||||
{
|
||||
@ -165,7 +165,7 @@ namespace chaiscript
|
||||
/// chai.add(fun(&MyClass::memberfunction, std::ref(obj), 1), "memberfunction");
|
||||
/// \endcode
|
||||
///
|
||||
/// \sa \ref addingfunctions
|
||||
/// \sa \ref adding_functions
|
||||
template<typename T, typename Q, typename R>
|
||||
Proxy_Function fun(T t, const Q &q, const R &r)
|
||||
{
|
||||
|
@ -530,7 +530,7 @@ namespace chaiscript
|
||||
chaiscript::detail::Dispatch_Engine &m_de;
|
||||
};
|
||||
|
||||
/// Creates a new functon call and pops it on destruction
|
||||
/// Creates a new function call and pops it on destruction
|
||||
struct Function_Push_Pop
|
||||
{
|
||||
Function_Push_Pop(chaiscript::detail::Dispatch_Engine &t_de)
|
||||
|
@ -140,32 +140,32 @@ namespace chaiscript
|
||||
struct Loadable_Module
|
||||
{
|
||||
template<typename T>
|
||||
static std::wstring towstring(const T &t_str)
|
||||
static std::wstring to_wstring(const T &t_str)
|
||||
{
|
||||
return std::wstring(t_str.begin(), t_str.end());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static std::string tostring(const T &t_str)
|
||||
static std::string to_string(const T &t_str)
|
||||
{
|
||||
return std::string(t_str.begin(), t_str.end());
|
||||
}
|
||||
|
||||
#ifdef _UNICODE
|
||||
template<typename T>
|
||||
static std::wstring toproperstring(const T &t_str)
|
||||
static std::wstring to_proper_string(const T &t_str)
|
||||
{
|
||||
return towstring(t_str);
|
||||
return to_wstring(t_str);
|
||||
}
|
||||
#else
|
||||
template<typename T>
|
||||
static std::string toproperstring(const T &t_str)
|
||||
static std::string to_proper_string(const T &t_str)
|
||||
{
|
||||
return tostring(t_str);
|
||||
return to_string(t_str);
|
||||
}
|
||||
#endif
|
||||
|
||||
static std::string GetErrorMessage(DWORD t_err)
|
||||
static std::string get_error_message(DWORD t_err)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
typedef LPWSTR StringType;
|
||||
@ -190,17 +190,17 @@ namespace chaiscript
|
||||
LocalFree(lpMsgBuf);
|
||||
}
|
||||
|
||||
return tostring(retval);
|
||||
return to_string(retval);
|
||||
}
|
||||
|
||||
struct DLModule
|
||||
{
|
||||
DLModule(const std::string &t_filename)
|
||||
: m_data(LoadLibrary(toproperstring(t_filename).c_str()))
|
||||
: m_data(LoadLibrary(to_proper_string(t_filename).c_str()))
|
||||
{
|
||||
if (!m_data)
|
||||
{
|
||||
throw chaiscript::exception::load_module_error(GetErrorMessage(GetLastError()));
|
||||
throw chaiscript::exception::load_module_error(get_error_message(GetLastError()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ namespace chaiscript
|
||||
{
|
||||
if (!m_symbol)
|
||||
{
|
||||
throw chaiscript::exception::load_module_error(GetErrorMessage(GetLastError()));
|
||||
throw chaiscript::exception::load_module_error(get_error_message(GetLastError()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,7 +366,6 @@ namespace chaiscript
|
||||
m_engine.add(fun(&ChaiScript::version_patch, this), "version_patch");
|
||||
m_engine.add(fun(&ChaiScript::version, this), "version");
|
||||
|
||||
|
||||
do_eval(ChaiScript_Prelude::chaiscript_prelude(), "standard prelude");
|
||||
}
|
||||
|
||||
@ -647,7 +646,7 @@ namespace chaiscript
|
||||
/// chai.add(chaiscript::var(&obj), "obj"); // Add a pointer to a locally defined object
|
||||
/// \endcode
|
||||
///
|
||||
/// \sa \ref addingitems
|
||||
/// \sa \ref adding_items
|
||||
template<typename T>
|
||||
ChaiScript &add(const T &t_t, const std::string &t_name)
|
||||
{
|
||||
@ -713,12 +712,12 @@ namespace chaiscript
|
||||
|
||||
for (auto & elem : m_modulepaths)
|
||||
{
|
||||
for (auto & prefixe : prefixes)
|
||||
for (auto & prefix : prefixes)
|
||||
{
|
||||
for (auto & postfixe : postfixes)
|
||||
for (auto & postfix : postfixes)
|
||||
{
|
||||
try {
|
||||
std::string name = elem + prefixe + t_module_name + postfixe;
|
||||
std::string name = elem + prefix + t_module_name + postfix;
|
||||
// std::cerr << "trying location: " << name << std::endl;
|
||||
load_module(version_stripped_name, name);
|
||||
return name;
|
||||
|
@ -1487,7 +1487,7 @@ namespace chaiscript
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an if/elseif/else block from input
|
||||
* Reads an if/else if/else block from input
|
||||
*/
|
||||
bool If() {
|
||||
bool retval = false;
|
||||
|
@ -5,7 +5,7 @@
|
||||
namespace ChaiScript_Language
|
||||
{
|
||||
|
||||
/// \page LangStandardLibraryRef ChaiScript Language Standard Libary Reference
|
||||
/// \page LangStandardLibraryRef ChaiScript Language Standard Library Reference
|
||||
///
|
||||
/// ChaiScript, at its core, has some very functional programming-inspired habits. Few places show this off as clearly
|
||||
/// as the prelude, itself a name taken as a nod to the popular functional language Haskell. This prelude is available
|
||||
|
@ -25,15 +25,15 @@ namespace chaiscript
|
||||
|
||||
template<typename Class, typename ModuleType>
|
||||
void add_class(ModuleType &t_module,
|
||||
const std::string &t_classname,
|
||||
const std::string &t_class_name,
|
||||
const std::vector<chaiscript::Proxy_Function> &t_constructors,
|
||||
const std::vector<std::pair<chaiscript::Proxy_Function, std::string>> &t_funcs)
|
||||
{
|
||||
t_module.add(chaiscript::user_type<Class>(), t_classname);
|
||||
t_module.add(chaiscript::user_type<Class>(), t_class_name);
|
||||
|
||||
for(const chaiscript::Proxy_Function &ctor: t_constructors)
|
||||
{
|
||||
t_module.add(ctor, t_classname);
|
||||
t_module.add(ctor, t_class_name);
|
||||
}
|
||||
|
||||
for(auto fun: t_funcs)
|
||||
|
@ -137,7 +137,7 @@ int main(int /*argc*/, char * /*argv*/[]) {
|
||||
|
||||
//To do: Add examples of handling Boxed_Values directly when needed
|
||||
|
||||
//Creating a functor on the stack and using it immediatly
|
||||
//Creating a functor on the stack and using it immediately
|
||||
int x = chai.eval<std::function<int (int, int)> >("fun (x, y) { return x + y; }")(5, 6);
|
||||
|
||||
std::stringstream ss;
|
||||
|
@ -24,7 +24,7 @@ std::string get_next_command() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void fuction(void)
|
||||
void function(void)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
@ -45,7 +45,7 @@ class test
|
||||
void ResetState()
|
||||
{
|
||||
chai.set_state(backupState);
|
||||
chai.add(chaiscript::fun(&fuction),"Whatever()");
|
||||
chai.add(chaiscript::fun(&function),"Whatever()");
|
||||
}
|
||||
|
||||
void RunFile(std::string sFile)
|
||||
@ -70,7 +70,7 @@ int main(int /*argc*/, char * /*argv*/[]) {
|
||||
std::string command = "";
|
||||
|
||||
//
|
||||
// this loop increases memoryusage, if RunFile is not called (just hittin enter)
|
||||
// this loop increases memoryusage, if RunFile is not called (just hitting enter)
|
||||
// as soon RunFile gets called, memory will be freed.
|
||||
//
|
||||
// scenario1 - RunFile gets called every Loop: memoryusage does not change
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int dosomething(int i)
|
||||
int do_something(int i)
|
||||
{
|
||||
return i % 2;
|
||||
}
|
||||
@ -13,8 +13,8 @@ int main()
|
||||
{
|
||||
|
||||
chaiscript::ChaiScript chai;
|
||||
chai.add(chaiscript::fun(&dosomething), "dosomething");
|
||||
chai.add(chaiscript::fun(&do_something), "do_something");
|
||||
|
||||
return chai.eval<int>("dosomething(101)") == 101 % 2?EXIT_SUCCESS:EXIT_FAILURE;
|
||||
return chai.eval<int>("do_something(101)") == 101 % 2?EXIT_SUCCESS:EXIT_FAILURE;
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ int main()
|
||||
// Dot notation
|
||||
|
||||
try {
|
||||
// non-existant function
|
||||
// non-existent function
|
||||
chai.eval("\"test\".test_one()");
|
||||
eval_error = false;
|
||||
} catch (const chaiscript::exception::eval_error &) {
|
||||
@ -51,7 +51,7 @@ int main()
|
||||
// regular notation
|
||||
|
||||
try {
|
||||
// non-existant function
|
||||
// non-existent function
|
||||
chai.eval("test_one(\"test\")");
|
||||
eval_error = false;
|
||||
} catch (const chaiscript::exception::eval_error &) {
|
||||
|
@ -35,7 +35,7 @@ int main()
|
||||
{
|
||||
// Disable deprecation warning for getenv call.
|
||||
#ifdef CHAISCRIPT_MSVC
|
||||
#ifdef max // Why microsoft? why?
|
||||
#ifdef max // Why Microsoft? why?
|
||||
#undef max
|
||||
#endif
|
||||
#pragma warning(push)
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include <chaiscript/chaiscript.hpp>
|
||||
|
||||
int dosomething(int i)
|
||||
int do_something(int i)
|
||||
{
|
||||
return i + 2;
|
||||
}
|
||||
|
||||
int dosomethingelse(int i)
|
||||
int do_something_else(int i)
|
||||
{
|
||||
return i * 2;
|
||||
}
|
||||
@ -15,29 +15,29 @@ int dosomethingelse(int i)
|
||||
int main()
|
||||
{
|
||||
chaiscript::ChaiScript chai;
|
||||
chai.add(chaiscript::fun(&dosomething), "dosomething");
|
||||
chai.add(chaiscript::fun(&do_something), "do_something");
|
||||
chai.add(chaiscript::var(1), "i");
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
chaiscript::ChaiScript chai2;
|
||||
chai2.add(chaiscript::fun(&dosomethingelse), "dosomethingelse");
|
||||
chai2.add(chaiscript::fun(&do_something_else), "do_something_else");
|
||||
|
||||
std::stringstream ss;
|
||||
ss << i;
|
||||
|
||||
if (chai.eval<int>("dosomething(" + ss.str() + ")") != i + 2)
|
||||
if (chai.eval<int>("do_something(" + ss.str() + ")") != i + 2)
|
||||
{
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (chai2.eval<int>("dosomethingelse(" + ss.str() + ")") != i * 2)
|
||||
if (chai2.eval<int>("do_something_else(" + ss.str() + ")") != i * 2)
|
||||
{
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
try {
|
||||
chai2.eval("dosomething(1)");
|
||||
chai2.eval("do_something(1)");
|
||||
return EXIT_FAILURE; // should not get here
|
||||
} catch (const chaiscript::exception::eval_error &) {
|
||||
// nothing to do, expected case
|
||||
@ -51,7 +51,7 @@ int main()
|
||||
}
|
||||
|
||||
try {
|
||||
chai.eval("dosomethingelse(1)");
|
||||
chai.eval("do_something_else(1)");
|
||||
return EXIT_FAILURE; // should not get here
|
||||
} catch (const chaiscript::exception::eval_error &) {
|
||||
// nothing to do, expected case
|
||||
|
Loading…
x
Reference in New Issue
Block a user