ChaiScript / ChaiScript
1
#include <chaiscript/chaiscript_basic.hpp>
2
#include "../static_libs/chaiscript_parser.hpp"
3
#include "../static_libs/chaiscript_stdlib.hpp"
4

5

6
extern "C"
7
{
8 1
  int do_something(int i)
9
  {
10 1
    return i % 2;
11
  }
12
}
13

14 1
int main()
15
{
16 1
  chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(),create_chaiscript_parser());
17 1
  chai.add(chaiscript::fun(&do_something), "do_something");
18

19 1
  return chai.eval<int>("do_something(101)") == 101 % 2?EXIT_SUCCESS:EXIT_FAILURE;
20

21
}

Read our documentation on viewing source code .

Loading