1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-26 00:47:50 -05:00
denoland-deno/deno2/include/deno.h

47 lines
1.1 KiB
C
Raw Normal View History

// Copyright 2018 Ryan Dahl <ry@tinyclouds.org>
// All rights reserved. MIT License.
2018-06-10 04:55:31 +02:00
#ifndef INCLUDE_DENO_H_
#define INCLUDE_DENO_H_
2018-06-10 14:18:15 +02:00
// Neither Rust nor Go support calling directly into C++ functions, therefore
// the public interface to libdeno is done in C.
#ifdef __cplusplus
extern "C" {
#endif
2018-06-10 02:24:34 +02:00
// Data that gets transmitted.
2018-06-10 14:18:15 +02:00
typedef struct {
void* data;
size_t len;
2018-06-10 14:18:15 +02:00
} deno_buf;
2018-06-10 03:44:56 +02:00
struct deno_s;
typedef struct deno_s Deno;
2018-06-10 03:44:56 +02:00
// The callback from V8 when data is sent.
2018-06-11 19:18:53 +02:00
typedef deno_buf (*deno_sub_cb)(Deno* d, deno_buf buf);
2018-06-10 14:18:15 +02:00
void deno_init();
2018-06-10 14:34:59 +02:00
const char* deno_v8_version();
void deno_set_flags(int* argc, char** argv);
2018-06-10 14:18:15 +02:00
// Constructor
2018-06-11 19:18:53 +02:00
Deno* deno_new(void* data, deno_sub_cb cb);
2018-06-11 17:01:35 +02:00
// Returns false on error.
// Get error text with deno_last_exception().
2018-06-11 20:49:57 +02:00
bool deno_execute(Deno* d, const char* js_filename, const char* js_source);
2018-06-11 18:17:28 +02:00
// Returns false on error.
// Get error text with deno_last_exception().
2018-06-11 19:18:53 +02:00
bool deno_pub(Deno* d, deno_buf buf);
const char* deno_last_exception(Deno* d);
void deno_dispose(Deno* d);
void deno_terminate_execution(Deno* d);
2018-06-10 14:18:15 +02:00
#ifdef __cplusplus
} // extern "C"
#endif
2018-06-10 04:55:31 +02:00
#endif // INCLUDE_DENO_H_