From 9f54f2222a180d2563433d267f5505881c69c71b Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 17 Dec 2015 20:02:02 +0100 Subject: some cripp fixes --- cripp/Makefile | 13 ++++++++++++- cripp/cripp | Bin 0 -> 41064 bytes cripp/cripp.cpp | 26 +++++++++++++++----------- 3 files changed, 27 insertions(+), 12 deletions(-) create mode 100755 cripp/cripp diff --git a/cripp/Makefile b/cripp/Makefile index 925e6f7..91015ae 100644 --- a/cripp/Makefile +++ b/cripp/Makefile @@ -1,2 +1,13 @@ CXX = g++ -CXXFLAGS = -Wall -Wextra -O2 -std=c++11 -lgmp -lgmpxx \ No newline at end of file +CXXFLAGS = -Wall -Wextra -O2 -std=c++11 -lgmp -lgmpxx -I/usr/local/include -L/usr/local/lib +BIN = cripp + +.PHONY: all clean remake + +all: $(BIN) + +clean: + rm -f $(BIN) + +remake: clean all + diff --git a/cripp/cripp b/cripp/cripp new file mode 100755 index 0000000..780f4dc Binary files /dev/null and b/cripp/cripp differ diff --git a/cripp/cripp.cpp b/cripp/cripp.cpp index 0e193b0..b3e879f 100644 --- a/cripp/cripp.cpp +++ b/cripp/cripp.cpp @@ -204,8 +204,8 @@ void runcode(const char *code,const int *jumpmap,Llist &stack,const int stack.pop_back(); break; case 'S':{ - const ripint b=stack.back(); stack.pop_back(); - const ripint a=stack.back(); stack.pop_back(); + const ripint b=move(stack.back()); stack.pop_back(); + const ripint a=move(stack.back()); stack.pop_back(); stack.push_back(b); stack.push_back(a); break; @@ -220,8 +220,8 @@ void runcode(const char *code,const int *jumpmap,Llist &stack,const int stack.back()--; break; case 'r':{ - const int n=integral(stack.back()); stack.pop_back(); - const ripint value=stack.back(); stack.pop_back(); + const int n=integral(move(stack.back())); stack.pop_back(); + const ripint value=move(stack.back()); stack.pop_back(); if(n==stack.size()+1)stack.push_front(value); else { void *const before=stack.itemp(-n); @@ -230,7 +230,7 @@ void runcode(const char *code,const int *jumpmap,Llist &stack,const int break; } case 'R':{ - const int n=integral(stack.back()); stack.pop_back(); + const int n=integral(move(stack.back())); stack.pop_back(); void *const p=stack.itemp(-n); stack.push_back(Llist::valueof(p)); stack.erase(p); @@ -240,8 +240,8 @@ void runcode(const char *code,const int *jumpmap,Llist &stack,const int stack.push_back(stack.size()); break; case 'a': case 's': case 'm': case 'q': case 'G': case 'L': case 'E':{ - const ripint b=stack.back(); stack.pop_back(); - const ripint a=stack.back(); stack.pop_back(); + const ripint b=move(stack.back()); stack.pop_back(); + const ripint a=move(stack.back()); stack.pop_back(); switch(code[i]){ case 'a': stack.push_back(a+b); break; case 's': stack.push_back(a-b); break; @@ -254,11 +254,11 @@ void runcode(const char *code,const int *jumpmap,Llist &stack,const int break; } case 'n': - stack.back()=!integral(stack.back()); + stack.back()=!integral(move(stack.back())); break; case 'I': { if(jumpmap[i]==0)riperror("No code block after 'I'"); - const int cond=integral(stack.back()); stack.pop_back(); + const int cond=integral(move(stack.back())); stack.pop_back(); if(cond){ runcode(code,jumpmap,stack,jumpmap[i]+1); } @@ -269,7 +269,7 @@ void runcode(const char *code,const int *jumpmap,Llist &stack,const int if(jumpmap[i]==0)riperror("No code block after 'W'"); int cond; while(true){ - cond=integral(stack.back()); stack.pop_back(); + cond=integral(move(stack.back())); stack.pop_back(); //cerr<<"whiling on "<