summaryrefslogtreecommitdiffstats
path: root/src/livecode/api/context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/livecode/api/context.cpp')
-rw-r--r--src/livecode/api/context.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/livecode/api/context.cpp b/src/livecode/api/context.cpp
index 43c6881d1..f5da3f7cd 100644
--- a/src/livecode/api/context.cpp
+++ b/src/livecode/api/context.cpp
@@ -13,8 +13,51 @@ Context &ctx() {
return *_context;
}
+extern "C" Janet cfun_input_point(int32_t argc, Janet *argv) {
+ janet_fixarity(argc, 2);
+ ctx().input_point(janet_getcstring(argv, 0),
+ &janet_unwrap_point(argv[1]));
+ return janet_wrap_nil();
+}
+
+extern "C" Janet cfun_input_line(int32_t argc, Janet *argv) {
+ janet_fixarity(argc, 3);
+ ctx().input_line(janet_getcstring(argv, 0),
+ &janet_unwrap_point(argv[1]),
+ &janet_unwrap_point(argv[2]));
+ return janet_wrap_nil();
+}
+
+extern "C" Janet cfun_input_arrow(int32_t argc, Janet *argv) {
+ janet_fixarity(argc, 3);
+ ctx().input_arrow(janet_getcstring(argv, 0),
+ &janet_unwrap_point(argv[1]),
+ &janet_unwrap_point(argv[2]));
+ return janet_wrap_nil();
+}
+
+const JanetReg it_cfuns[] = {
+ {
+ "input/point", cfun_input_point,
+ "(input/point id p)\n\nMake p modifiable via a handle.\n"
+ "This function mutates p."
+ },
+ {
+ "input/line", cfun_input_line,
+ "(input/line id p1 p2)\n\nMake a modifiable line between p1 and p2\n"
+ "This function mutates p1 and p2."
+ },
+ {
+ "input/arrow", cfun_input_arrow,
+ "(input/arrow id from to)\n\nMake a modifiable arrow between from and to\n"
+ "This function mutates from and to."
+ },
+ {NULL, NULL, NULL}
+};
+
void janet_lib_context(JanetTable *env, Context &context) {
_context = &context;
+ janet_cfuns(env, NULL, it_cfuns);
}
}