2018-07-23 14:46:30 -04:00
|
|
|
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
2018-07-18 16:44:09 -04:00
|
|
|
#![allow(dead_code)]
|
|
|
|
extern crate libc;
|
|
|
|
use libc::c_char;
|
|
|
|
use libc::c_int;
|
|
|
|
use libc::c_void;
|
|
|
|
|
|
|
|
#[repr(C)]
|
2018-09-22 08:47:44 -04:00
|
|
|
pub struct isolate {
|
2018-07-19 21:14:32 -04:00
|
|
|
_unused: [u8; 0],
|
2018-07-18 16:44:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(C)]
|
2018-08-15 23:36:48 -04:00
|
|
|
#[derive(PartialEq)]
|
2018-07-18 16:44:09 -04:00
|
|
|
pub struct deno_buf {
|
2018-07-23 14:13:12 -04:00
|
|
|
pub alloc_ptr: *mut u8,
|
|
|
|
pub alloc_len: usize,
|
|
|
|
pub data_ptr: *mut u8,
|
|
|
|
pub data_len: usize,
|
2018-07-18 16:44:09 -04:00
|
|
|
}
|
|
|
|
|
2018-09-27 17:33:10 -04:00
|
|
|
type DenoRecvCb = unsafe extern "C" fn(
|
2018-10-08 05:04:33 -04:00
|
|
|
user_data: *mut c_void,
|
2018-09-27 17:33:10 -04:00
|
|
|
req_id: i32,
|
|
|
|
buf: deno_buf,
|
|
|
|
data_buf: deno_buf,
|
|
|
|
);
|
2018-07-18 16:44:09 -04:00
|
|
|
|
|
|
|
extern "C" {
|
2018-07-19 21:14:32 -04:00
|
|
|
pub fn deno_init();
|
|
|
|
pub fn deno_v8_version() -> *const c_char;
|
2018-09-22 08:47:44 -04:00
|
|
|
pub fn deno_set_v8_flags(argc: *mut c_int, argv: *mut *mut c_char);
|
2018-10-07 17:48:06 -04:00
|
|
|
pub fn deno_new(cb: DenoRecvCb) -> *const isolate;
|
2018-09-22 08:47:44 -04:00
|
|
|
pub fn deno_delete(i: *const isolate);
|
|
|
|
pub fn deno_last_exception(i: *const isolate) -> *const c_char;
|
2018-10-07 17:48:06 -04:00
|
|
|
pub fn deno_respond(
|
|
|
|
i: *const isolate,
|
|
|
|
user_data: *mut c_void,
|
|
|
|
req_id: i32,
|
|
|
|
buf: deno_buf,
|
|
|
|
);
|
2018-07-19 21:14:32 -04:00
|
|
|
pub fn deno_execute(
|
2018-09-22 08:47:44 -04:00
|
|
|
i: *const isolate,
|
2018-10-07 17:48:06 -04:00
|
|
|
user_data: *mut c_void,
|
2018-07-19 21:14:32 -04:00
|
|
|
js_filename: *const c_char,
|
|
|
|
js_source: *const c_char,
|
|
|
|
) -> c_int;
|
2018-07-18 16:44:09 -04:00
|
|
|
}
|