1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-23 15:39:49 -05:00
denoland-deno/deno2/include/deno.h

45 lines
951 B
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 02:24:34 +02:00
namespace deno {
// Data that gets transmitted.
struct buf_s {
void* data;
size_t len;
};
typedef struct buf_s DenoBuf;
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.
typedef DenoBuf (*RecvCallback)(Deno* d, DenoBuf buf);
void v8_init();
const char* v8_version();
void v8_set_flags(int* argc, char** argv);
// Constructors:
Deno* from_snapshot(void* data, RecvCallback cb);
void* deno_get_data();
// Returns nonzero on error.
// Get error text with deno_last_exception().
int deno_load(Deno* d, const char* name_s, const char* source_s);
// Returns nonzero on error.
int deno_send(Deno* d, DenoBuf buf);
const char* deno_last_exception(Deno* d);
void deno_dispose(Deno* d);
void deno_terminate_execution(Deno* d);
2018-06-10 02:24:34 +02:00
} // namespace deno
2018-06-10 04:55:31 +02:00
#endif // INCLUDE_DENO_H_