summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flags.rs4
-rw-r--r--src/handlers.rs10
-rw-r--r--src/libdeno.rs (renamed from src/binding.rs)0
-rw-r--r--src/main.rs20
-rw-r--r--src/version.rs4
5 files changed, 19 insertions, 19 deletions
diff --git a/src/flags.rs b/src/flags.rs
index db04e42f7..1b6299e3c 100644
--- a/src/flags.rs
+++ b/src/flags.rs
@@ -1,6 +1,6 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
-use binding;
use libc::c_int;
+use libdeno;
use std::ffi::CStr;
use std::ffi::CString;
use std::mem;
@@ -208,7 +208,7 @@ pub fn v8_set_flags(args: Vec<String>) -> Vec<String> {
// Let v8 parse the arguments it recognizes and remove them from c_argv.
unsafe {
// TODO(ry) Rename deno_set_flags to deno_set_v8_flags().
- binding::deno_set_flags(&mut c_argc, c_argv.as_mut_ptr());
+ libdeno::deno_set_flags(&mut c_argc, c_argv.as_mut_ptr());
};
// If c_argc was updated we have to change the length of c_argv to match.
c_argv.truncate(c_argc as usize);
diff --git a/src/handlers.rs b/src/handlers.rs
index 141cc5d13..3e6623e3d 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -1,6 +1,4 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
-use binding;
-use binding::{deno_buf, DenoC};
use errors::DenoResult;
use flatbuffers::FlatBufferBuilder;
use from_c;
@@ -10,6 +8,8 @@ use futures::sync::oneshot;
use hyper;
use hyper::rt::{Future, Stream};
use hyper::Client;
+use libdeno;
+use libdeno::{deno_buf, DenoC};
use msg_generated::deno as msg;
use std;
use std::fs;
@@ -20,7 +20,7 @@ use tokio::prelude::future;
use tokio::prelude::*;
use tokio::timer::{Delay, Interval};
-type HandlerResult = DenoResult<binding::deno_buf>;
+type HandlerResult = DenoResult<libdeno::deno_buf>;
type Handler =
fn(d: *const DenoC, base: msg::Base, builder: &mut FlatBufferBuilder)
-> HandlerResult;
@@ -74,7 +74,7 @@ pub extern "C" fn msg_from_js(d: *const DenoC, buf: deno_buf) {
// Set the synchronous response, the value returned from deno.send().
// null_buf is a special case that indicates success.
if buf != null_buf() {
- unsafe { binding::deno_set_response(d, buf) }
+ unsafe { libdeno::deno_set_response(d, buf) }
}
}
@@ -156,7 +156,7 @@ fn send_base(
args: &msg::BaseArgs,
) {
let buf = create_msg(builder, args);
- unsafe { binding::deno_send(d, buf) }
+ unsafe { libdeno::deno_send(d, buf) }
}
// https://github.com/denoland/deno/blob/golang/os.go#L100-L154
diff --git a/src/binding.rs b/src/libdeno.rs
index 9789fc4e0..9789fc4e0 100644
--- a/src/binding.rs
+++ b/src/libdeno.rs
diff --git a/src/main.rs b/src/main.rs
index 7d59fe03d..ab9a72f79 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,12 +12,12 @@ extern crate log;
extern crate hyper_rustls;
extern crate ring;
-mod binding;
mod deno_dir;
mod errors;
mod flags;
mod fs;
pub mod handlers;
+mod libdeno;
mod net;
mod version;
@@ -30,7 +30,7 @@ use std::ffi::CString;
type DenoException<'a> = &'a str;
pub struct Deno {
- ptr: *const binding::DenoC,
+ ptr: *const libdeno::DenoC,
dir: deno_dir::DenoDir,
rt: tokio::runtime::current_thread::Runtime,
timers: HashMap<u32, futures::sync::oneshot::Sender<()>>,
@@ -43,13 +43,13 @@ static DENO_INIT: std::sync::Once = std::sync::ONCE_INIT;
impl Deno {
fn new(argv: Vec<String>) -> Box<Deno> {
DENO_INIT.call_once(|| {
- unsafe { binding::deno_init() };
+ unsafe { libdeno::deno_init() };
});
let (flags, argv_rest) = flags::set_flags(argv);
let mut deno_box = Box::new(Deno {
- ptr: 0 as *const binding::DenoC,
+ ptr: 0 as *const libdeno::DenoC,
dir: deno_dir::DenoDir::new(flags.reload, None).unwrap(),
rt: tokio::runtime::current_thread::Runtime::new().unwrap(),
timers: HashMap::new(),
@@ -58,7 +58,7 @@ impl Deno {
});
(*deno_box).ptr = unsafe {
- binding::deno_new(
+ libdeno::deno_new(
deno_box.as_ref() as *const _ as *const c_void,
handlers::msg_from_js,
)
@@ -75,10 +75,10 @@ impl Deno {
let filename = CString::new(js_filename).unwrap();
let source = CString::new(js_source).unwrap();
let r = unsafe {
- binding::deno_execute(self.ptr, filename.as_ptr(), source.as_ptr())
+ libdeno::deno_execute(self.ptr, filename.as_ptr(), source.as_ptr())
};
if r == 0 {
- let ptr = unsafe { binding::deno_last_exception(self.ptr) };
+ let ptr = unsafe { libdeno::deno_last_exception(self.ptr) };
let cstr = unsafe { CStr::from_ptr(ptr) };
return Err(cstr.to_str().unwrap());
}
@@ -88,12 +88,12 @@ impl Deno {
impl Drop for Deno {
fn drop(&mut self) {
- unsafe { binding::deno_delete(self.ptr) }
+ unsafe { libdeno::deno_delete(self.ptr) }
}
}
-pub fn from_c<'a>(d: *const binding::DenoC) -> &'a mut Deno {
- let ptr = unsafe { binding::deno_get_data(d) };
+pub fn from_c<'a>(d: *const libdeno::DenoC) -> &'a mut Deno {
+ let ptr = unsafe { libdeno::deno_get_data(d) };
let deno_ptr = ptr as *mut Deno;
let deno_box = unsafe { Box::from_raw(deno_ptr) };
Box::leak(deno_box)
diff --git a/src/version.rs b/src/version.rs
index 890b4d152..f40687770 100644
--- a/src/version.rs
+++ b/src/version.rs
@@ -1,12 +1,12 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
-use binding;
+use libdeno;
use std::ffi::CStr;
// This is the source of truth for the Deno version. Ignore the value in Cargo.toml.
const DENO_VERSION: &str = "0.1.2";
pub fn print_version() {
- let v = unsafe { binding::deno_v8_version() };
+ let v = unsafe { libdeno::deno_v8_version() };
let c_str = unsafe { CStr::from_ptr(v) };
let version = c_str.to_str().unwrap();
println!("deno: {}", DENO_VERSION);