Last active
September 9, 2020 17:11
-
-
Save mrryanjohnston/07d7b9da6b06e8ef2695ad381d156055 to your computer and use it in GitHub Desktop.
CLIPS via Ruby using FFI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Clips | |
extend FFI::Library | |
ffi_lib 'clips/libclips.so' | |
attach_function :create_environment, :CreateEnvironment, [], :pointer | |
attach_function :reroute_stdin, :RerouteStdin, [:pointer, :int, :pointer], :pointer | |
attach_function :command_loop, :CommandLoop, [:pointer], :void | |
end | |
the_env = Clips.create_environment | |
Clips.reroute_stdin(the_env, 0, FFI::MemoryPointer.new(:pointer)) | |
Clips.command_loop(the_env) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "clips.h" | |
int main( | |
int argc, | |
char *argv[]) | |
{ | |
void *theEnv; | |
theEnv = CreateEnvironment(); | |
RerouteStdin(theEnv,argc,argv); | |
CommandLoop(theEnv); | |
return(-1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment