diff --git a/CMakeLists.txt b/CMakeLists.txt index b84c2dd..de1ad18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,9 @@ +#[=============================================================================[ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2021 Sarita Singh +# SPDX-FileCopyrightText: 2021 Avinal Kumar +#]=============================================================================] + cmake_minimum_required(VERSION 3.16 FATAL_ERROR) # ---- Project ---- diff --git a/include/xbasic/xbasic_interpreter.hpp b/include/xbasic/xbasic_interpreter.hpp index 4aed8da..8d48afd 100644 --- a/include/xbasic/xbasic_interpreter.hpp +++ b/include/xbasic/xbasic_interpreter.hpp @@ -1,3 +1,12 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2021 Sarita Singh + * SPDX-FileCopyrightText: 2021 Avinal Kumar + * + * @file xbasic_interpreter.hpp + * @brief Jupyter Kernel Interpreter header file + */ + #ifndef XBASIC_INTERPRETER_HPP_ #define XBASIC_INTERPRETER_HPP_ diff --git a/libs/basic/CMakeLists.txt b/libs/basic/CMakeLists.txt index 3911060..45e8ecb 100644 --- a/libs/basic/CMakeLists.txt +++ b/libs/basic/CMakeLists.txt @@ -1,7 +1,7 @@ -#[=======================================================================[ -SPDX-License-Identifier: Apache-2.0 -SPDX-FileCopyrightText: 2021 Avinal Kumar -#]=======================================================================] +#[=============================================================================[ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2021 Avinal Kumar +#]=============================================================================] cmake_minimum_required(VERSION 3.16) project(basic LANGUAGES C) @@ -11,8 +11,8 @@ add_library(basic "") target_sources(basic PRIVATE ${BASIC_SRC}) target_include_directories(basic PRIVATE include/basic) -#add_executable(basic_exec main.cc) -#target_include_directories(basic_exec PRIVATE include/basic) -#target_link_libraries(basic_exec PRIVATE basic) +add_executable(basic_exec main.cc) +target_include_directories(basic_exec PRIVATE include/basic) +target_link_libraries(basic_exec PRIVATE basic) diff --git a/libs/basic/main.cc b/libs/basic/main.cc index 33020c6..a41874b 100644 --- a/libs/basic/main.cc +++ b/libs/basic/main.cc @@ -6,49 +6,13 @@ * @brief Driver Code */ -// #include -// #include -// #include -// #include -// #include -// #include -// #include - #include #include #include -#include "basic.hpp" +#include "basic/basic.hpp" -// extern bool __RUNNING; -// extern bool __STOPPED; - -// static void sigint_handler(int signum) { -// signal(SIGINT, sigint_handler); -// if (__RUNNING) { -// __RUNNING = false; -// __STOPPED = true; -// printf("STOP\n"); -// fflush(stdout); -// } -// } - -// static char *readline_gets() { -// char *line_read = readline(""); - -// if (line_read && *line_read) { -// add_history(line_read); -// } - -// return line_read; -// } std::string outputs; -// int out(int ch) { -// outputs += char(ch); -// return 1; -// } - -// int in(void) { return getchar(); } void replcc() { std::cout << " _ _ \n" @@ -57,56 +21,22 @@ void replcc() { << "| |_) | (_| \\__ \\ | (__ \n" << "|_.__/ \\__,_|___/_|\\___|\n" << "(c) 2015-2016 Johan Van den Brande\n"; - // using_history(); std::string input; basic check; while (getline(std::cin, input)) { if (!input.compare("QUIT")) { - // check.~basic(); break; } if (!check.evaluate_line(input)) { std::cerr << check.get_error() << "\n"; } - // basic_eval((char *)input.c_str()); if (input == "RUN") { std::cout << check.run(); } - // if (evaluate_last_error()) { - // std::cerr << "ERROR: " << evaluate_last_error() << "\n"; - // clear_last_error(); - // } } - // clear_history(); -} - -void runcc(std::string filename) { - // std::fstream file(filename, std::ios::in); - - // if (!file.is_open()) { - // std::cerr << "Can't open " << filename << std::endl; - // exit(EXIT_FAILURE); - // } - // std::string line; - // while (getline(file, line)) { - // basic_eval((char *)line.c_str()); - // } - // file.close(); - // basic_run(); } int main(int argc, char *argv[]) { - // signal(SIGINT, sigint_handler); - // basic_init(1024 * 8, 2048); - // basic_register_io(out, in); - - if (argc > 1) { - runcc(argv[1]); - } else { - replcc(); - } - - // basic_destroy(); - + replcc(); return EXIT_SUCCESS; } diff --git a/src/main.cc b/src/main.cc index 3d1d6e0..6c2c5aa 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,3 +1,12 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2021 Sarita Singh + * SPDX-FileCopyrightText: 2021 Avinal Kumar + * + * @file main.cc + * @brief Jupyter Kernel main program + */ + #include #include "xbasic/xbasic_interpreter.hpp" diff --git a/src/xbasic_interpreter.cpp b/src/xbasic_interpreter.cpp index 93184ac..d2d4017 100644 --- a/src/xbasic_interpreter.cpp +++ b/src/xbasic_interpreter.cpp @@ -1,3 +1,11 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2021 Sarita Singh + * SPDX-FileCopyrightText: 2021 Avinal Kumar + * + * @file xbasic_interpreter.cpp + * @brief Jupyter Kernel Interpreter Implementation + */ #include "xbasic/xbasic_interpreter.hpp"