Skip to content

Instantly share code, notes, and snippets.

@aq1018
Created November 7, 2009 13:46
Show Gist options
  • Save aq1018/228710 to your computer and use it in GitHub Desktop.
Save aq1018/228710 to your computer and use it in GitHub Desktop.
flusspferd dies with this...
#include <boost/spirit/home/phoenix/core.hpp>
#include <boost/spirit/home/phoenix/bind.hpp>
#include <boost/spirit/home/phoenix/operator.hpp>
#include <boost/bind.hpp>
#include "flusspferd.hpp"
using namespace flusspferd;
using namespace std;
namespace phoenix = boost::phoenix;
namespace args = phoenix::arg_names;
void callback(function& fn){
fn.call(global());
}
int main(int argc, char **argv)
{
try {
init::initialize();
context co = context::create();
current_context_scope scope(co);
object g = global();
security::create(g);
load_core(g, argv[0]);
create_native_function(g, "gc", &gc);
create_native_function(g, "execute", &callback);
gc();
execute("test.js");
return 0;
} catch (flusspferd::exception &fe) {
std::cout << fe.what();
return 0;
} catch (std::exception &e) {
std::cout << e.what();
return 1;
}
}
var test2 = require("./test2");
execute(test2.callback);
var sys = require("system");
var print = function(){
sys.stdout.print.apply(sys.stdout, arguments);
}
exports.callback = function(){print("running callback");};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment