1
0
mirror of https://github.com/exaloop/codon.git synced 2025-06-03 15:03:52 +08:00
codon/extra/jupyter/jupyter.h

44 lines
1.3 KiB
C
Raw Normal View History

2021-11-01 03:31:24 -07:00
#pragma once
2021-11-09 03:47:41 -08:00
#ifdef CODON_JUPYTER
2021-11-05 15:26:32 -07:00
#include <codon/compiler/jit.h>
2021-11-01 03:31:24 -07:00
#include <nlohmann/json.hpp>
#include <xeus/xinterpreter.hpp>
using xeus::xinterpreter;
namespace nl = nlohmann;
namespace codon {
class CodonJupyter : public xinterpreter {
2021-11-05 15:26:32 -07:00
std::unique_ptr<codon::jit::JIT> jit;
2021-11-09 03:47:41 -08:00
std::string argv0;
2021-12-06 01:59:32 -08:00
std::vector<std::string> plugins;
2021-11-09 03:47:41 -08:00
public:
2021-12-06 01:59:32 -08:00
CodonJupyter(const std::string &argv0, const std::vector<std::string> &plugins);
2021-11-05 15:26:32 -07:00
2021-11-01 03:31:24 -07:00
private:
void configure_impl() override;
nl::json execute_request_impl(int execution_counter, const std::string &code,
bool silent, bool store_history,
nl::json user_expressions, bool allow_stdin) override;
nl::json complete_request_impl(const std::string &code, int cursor_pos) override;
nl::json inspect_request_impl(const std::string &code, int cursor_pos,
int detail_level) override;
nl::json is_complete_request_impl(const std::string &code) override;
nl::json kernel_info_request_impl() override;
void shutdown_request_impl() override;
};
2021-11-09 03:47:41 -08:00
2021-12-06 01:59:32 -08:00
int startJupyterKernel(const std::string &argv0,
const std::vector<std::string> &plugins,
const std::string &configPath);
2021-11-09 03:47:41 -08:00
2021-11-01 03:31:24 -07:00
} // namespace codon
2021-12-20 14:16:02 -05:00
#endif