Created
April 4, 2012 17:31
-
-
Save nasser/2304065 to your computer and use it in GitHub Desktop.
Generic Ruby Embedding API
This file contains 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
/** | |
* VM supplies rb_ctx and rb_obj definitions here | |
*/ | |
#include "vm_specific.h" | |
extern "C" { | |
/** | |
* Create a embedded ruby context | |
*/ | |
rb_ctx rb_create_ctx(); | |
/** | |
* Requires a ruby file (like require 'file' in ruby) | |
* | |
* Returns true if it executed without exception, false if there was an error. | |
* Finding out what went wrong will be defined later. | |
*/ | |
int rb_require_file(rb_ctx ctx, const char * file); | |
/** | |
* Evaulate a ruby file | |
* | |
* Returns true if it executed without exception, false if there was an error. | |
* Finding out what went wrong will be defined later. | |
*/ | |
int rb_eval_file(rb_ctx ctx, const char * file); | |
/** | |
* Evaluate a ruby string | |
* | |
* Returns true if it executed without exception, false if there was an error. | |
* Finding out what went wrong will be defined later. | |
*/ | |
int rb_eval(rb_ctx ctx, const char * code); | |
/** | |
* Send a message to an object | |
* | |
* Send +msg+ to object +recv+ with arguments specified by +argc+ and the | |
* variadic parameters that follow. All arguments *must* be of type rb_obj. | |
*/ | |
rb_obj rb_send(rb_ctx ctx, rb_obj recv, const char* msg, int argc, ...); | |
/** | |
* Clean up a context | |
*/ | |
void rb_close_ctx(rb_ctx ctx); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment