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)]
|
|
|
|
pub struct DenoC {
|
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
|
|
|
}
|
|
|
|
|
|
|
|
type DenoRecvCb = unsafe extern "C" fn(d: *const DenoC, buf: deno_buf);
|
|
|
|
|
|
|
|
extern "C" {
|
2018-07-19 21:14:32 -04:00
|
|
|
pub fn deno_init();
|
|
|
|
pub fn deno_v8_version() -> *const c_char;
|
|
|
|
pub fn deno_set_flags(argc: *mut c_int, argv: *mut *mut c_char);
|
|
|
|
pub fn deno_new(data: *const c_void, cb: DenoRecvCb) -> *const DenoC;
|
|
|
|
pub fn deno_delete(d: *const DenoC);
|
|
|
|
pub fn deno_last_exception(d: *const DenoC) -> *const c_char;
|
2018-07-26 17:47:42 -04:00
|
|
|
pub fn deno_get_data(d: *const DenoC) -> *const c_void;
|
2018-07-19 21:14:32 -04:00
|
|
|
pub fn deno_set_response(d: *const DenoC, buf: deno_buf);
|
2018-08-09 15:17:08 -04:00
|
|
|
pub fn deno_send(d: *const DenoC, buf: deno_buf);
|
2018-07-19 21:14:32 -04:00
|
|
|
pub fn deno_execute(
|
|
|
|
d: *const DenoC,
|
|
|
|
js_filename: *const c_char,
|
|
|
|
js_source: *const c_char,
|
|
|
|
) -> c_int;
|
2018-07-18 16:44:09 -04:00
|
|
|
}
|