Split functions into many files, remove string from std.
This commit is contained in:
@@ -44,14 +44,6 @@ void abacus::add_operator_postfix(const std::string& op, const std::string& func
|
||||
}
|
||||
|
||||
void abacus::add_standard() {
|
||||
add_function("quit", function_quit, "()->unit");
|
||||
add_function("request_precision", function_request_precision, "(num)->unit");
|
||||
|
||||
add_function("print", function_print_string, "(str)->unit");
|
||||
add_function("to_string", function_to_string_num, "(num)->str");
|
||||
add_function("to_string", function_to_string_bool, "(bool)->str");
|
||||
add_function("to_string", function_to_string_unit, "(unit)->str");
|
||||
|
||||
add_function("lt", function_lt, "(num, num)->num");
|
||||
add_function("lte", function_lte, "(num, num)->num");
|
||||
add_function("equals", function_equals, "(num, num)->num");
|
||||
|
||||
11
src/main.cpp
11
src/main.cpp
@@ -7,7 +7,8 @@
|
||||
#include <sstream>
|
||||
#include "types.hpp"
|
||||
#include "ref.hpp"
|
||||
#include "function_utils.hpp"
|
||||
#include "repl_functions.hpp"
|
||||
#include "string_functions.hpp"
|
||||
#include "abacus.hpp"
|
||||
extern "C" {
|
||||
#include "libabacus.h"
|
||||
@@ -48,6 +49,14 @@ int main() {
|
||||
size_t index = 0;
|
||||
|
||||
ab.add_standard();
|
||||
ab.add_function("quit", function_quit, "()->unit");
|
||||
ab.add_function("request_precision", function_request_precision, "(num)->unit");
|
||||
|
||||
ab.add_function("print", function_print_string, "(str)->unit");
|
||||
ab.add_function("to_string", function_to_string_num, "(num)->str");
|
||||
ab.add_function("to_string", function_to_string_bool, "(bool)->str");
|
||||
ab.add_function("to_string", function_to_string_unit, "(unit)->str");
|
||||
|
||||
run_rc(ab);
|
||||
while(!close_requested) {
|
||||
char* data = readline(" > ");
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
#include "functions.hpp"
|
||||
#include "operator_functions.hpp"
|
||||
#include <mpfr.h>
|
||||
#include "types.hpp"
|
||||
#include "ref.hpp"
|
||||
#include "util.hpp"
|
||||
extern "C" {
|
||||
#include "util.h"
|
||||
}
|
||||
|
||||
FUNCTION_MPFR2(plus, add)
|
||||
FUNCTION_MPFR2(minus, sub)
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "functions.hpp"
|
||||
#include "other_functions.hpp"
|
||||
#include <mpfr.h>
|
||||
#include "types.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
FUNCTION_MPFR(ln, log);
|
||||
FUNCTION_MPFR(exp, exp);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "functions.hpp"
|
||||
#include "string_functions.hpp"
|
||||
#include "ref.hpp"
|
||||
#include "types.hpp"
|
||||
#include "util.hpp"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
#include "functions.hpp"
|
||||
#include "trig_functions.hpp"
|
||||
#include <mpfr.h>
|
||||
#include "ref.hpp"
|
||||
#include "types.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
FUNCTION_MPFR(sin, sin);
|
||||
FUNCTION_MPFR(cos, cos);
|
||||
|
||||
Reference in New Issue
Block a user