From 8d9a82c104fbb47fdbd4f43baaaf952636e97cef Mon Sep 17 00:00:00 2001 From: Ludovic 'Archivist' Lagouardette Date: Wed, 3 Oct 2018 21:22:05 +0200 Subject: [PATCH] Macro replacement bug fixed --- crank.h | 3 +-- main.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crank.h b/crank.h index a0af614..bbe3485 100644 --- a/crank.h +++ b/crank.h @@ -1,7 +1,6 @@ #pragma once #include "memory_pool.hpp" #include "string_view.hpp" -#include "2CL.hpp" class crank_context; @@ -165,7 +164,7 @@ public: crank_copy* cpy = (crank_copy*)memory.allocate(sizeof(crank_copy)); if(cpy) { - new(cpy) crank_copy{.next=std::move(copies), .data=kstd::string_view(ptr,src.size())}; + new(cpy) crank_copy{.next=std::move(copies), .data=kstd::string_view(ptr,new_len)}; copies = std::move(crank_ptr{cpy, &memory}); auto dest = kstd::string_view(ptr,new_len); diff --git a/main.cpp b/main.cpp index 18ae019..b58cb77 100644 --- a/main.cpp +++ b/main.cpp @@ -6,29 +6,30 @@ #include #include -kstd::string_view set2(kstd::string_view args, crank_context& ctx) +kstd::string_view put(kstd::string_view args, crank_context& ctx) { args = skip_whitespace(args); auto key = extract_token(args); auto value = skip_linearspace(kstd::string_view(args.begin()+key.size(),args.end())); - for(auto c : value) + for(auto c : args) std::cout< "; while((std::getline(std::cin,get)).good()) { auto ret = ctx.eval(kstd::string_view(get.data(), get.size())); + std::cout<<"&> "; for(auto c : ret) std::cout< "; } }