Skip to content

Commit

Permalink
Fixed paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustaf Sjöberg committed Aug 24, 2015
1 parent 1c69055 commit 1f43f53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
19 changes: 12 additions & 7 deletions c_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ BUILD_ARCH_32 := ia32
BUILD_ARCH_64 := x64
BUILD_ARCH := $(BUILD_ARCH_$(ARCH))

LIB_DIR := ../lib
PRIV_DIR := ../priv

V8_REF := 49744859536225e7ac3b726e5b019dd99e127e6f
V8_DIR := ../lib/v8-$(V8_REF)
V8_DIR := $(LIB_DIR)/v8-$(V8_REF)
V8_LIB := $(V8_DIR)/out/$(BUILD_ARCH).release
V8_URL := https://codeload.github.com/v8/v8/tar.gz/$(V8_REF)

TARGET_BIN := ../priv/erlang_v8
TARGET_BIN := $(PRIV_DIR)/erlang_v8
TARGET_SRC := erlang_v8.cc

.PHONY: all v8 local-clean local-clean-all
Expand All @@ -31,10 +34,13 @@ local-clean-all::

v8: $(TARGET_BIN)

lib:
mkdir -p lib
$(LIB_DIR):
mkdir -p $(LIB_DIR)

$(PRIV_DIR):
mkdir -p $(PRIV_DIR)

$(V8_DIR): lib
$(V8_DIR): $(LIB_DIR)
curl -L $(V8_URL) | tar xvz -C ../lib

$(V8_DIR)/build/gyp: $(V8_DIR)
Expand All @@ -50,8 +56,7 @@ $(V8_LIB)/libv8_base.$(BUILD_ARCH).a: $(V8_DIR)/build/gyp
$(TARGET_SRC): $(V8_LIB)/libv8_base.$(BUILD_ARCH).a
@:

$(TARGET_BIN): $(TARGET_SRC)
@mkdir -p priv
$(TARGET_BIN): $(PRIV_DIR) $(TARGET_SRC)
ifeq ($(OS),Darwin)
# We need to link libstdc++ as XCode defaults to libc++, and use slightly
# different flags, on OS X. The following assumes Mavericks, XCode and
Expand Down
18 changes: 8 additions & 10 deletions c_src/erlang_v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,21 @@ void call(Isolate* isolate, string input) {
// name can be something like `lol.flop['hi']`. wrapping the call in a
// temporary function is much simpler than attempting to split the name
// and check all the individual parts.
Handle<String> prefix = String::NewFromUtf8(isolate, "function __call() { return ");
Handle<String> suffix = String::NewFromUtf8(isolate, ".apply(null, arguments); }");
Handle<String> source = String::Concat(String::Concat(prefix, function_name), suffix);
Handle<String> prefix = String::NewFromUtf8(isolate,
"function __call() { return ");
Handle<String> suffix = String::NewFromUtf8(isolate,
".apply(null, arguments); }");
Handle<String> source = String::Concat(String::Concat(prefix,
function_name), suffix);
Handle<Script> script = Script::Compile(source);
Handle<Value> eval_result = script->Run();

if (eval_result.IsEmpty()) {
Handle<Value> exception = trycatch.Exception();
error(isolate, exception);
} else {
Handle<Function> function = Handle<Function>::Cast(global->Get(String::NewFromUtf8(isolate, "__call")));
Handle<Function> function = Handle<Function>::Cast(
global->Get(String::NewFromUtf8(isolate, "__call")));
Handle<Value> result = function->Call(global, len, argz);

if (result.IsEmpty()) {
Expand All @@ -197,12 +201,6 @@ void call(Isolate* isolate, string input) {
ok(isolate, result);
}
}


// result = function->Call(global, len, argz);

// result = script->CallFunction(String::NewFromUtf8(isolate, "__call"), len, argz);

}

bool command_loop(int scriptc, char* scriptv[]) {
Expand Down

0 comments on commit 1f43f53

Please sign in to comment.