mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
I initially tried to use the existing .clang-format file, but it does not match the code style (at least with clang-format 11) and the formatting is not consistent across files. Therefore, I decided to rewrite the .clang-format with some personal preferences. Used command find . -iname "*.hpp" -o -iname "*.cpp" | xargs clang-format -i -style=file
17 lines
456 B
C++
17 lines
456 B
C++
#include "../static_libs/chaiscript_parser.hpp"
|
|
#include "../static_libs/chaiscript_stdlib.hpp"
|
|
#include <chaiscript/chaiscript_basic.hpp>
|
|
|
|
extern "C" {
|
|
int do_something(int i) {
|
|
return i % 2;
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(), create_chaiscript_parser());
|
|
chai.add(chaiscript::fun(&do_something), "do_something");
|
|
|
|
return chai.eval<int>("do_something(101)") == 101 % 2 ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
}
|