From a7a140cc210758fd12b6b9bf350d18006cd79163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 12 Jan 2016 14:07:46 +0100 Subject: [PATCH 1/2] Fix setup.py script: handle unset OPT config var. --- setup.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 6b903d2..249ccef 100755 --- a/setup.py +++ b/setup.py @@ -1,12 +1,13 @@ from setuptools import setup, Extension import os -from distutils.sysconfig import get_config_vars +from distutils.sysconfig import get_config_var -(opt,) = get_config_vars('OPT') -os.environ['OPT'] = " ".join( - flag for flag in opt.split() if flag != '-Wstrict-prototypes' -) +opt = get_config_var('OPT') +if opt: + os.environ['OPT'] = " ".join( + flag for flag in opt.split() if flag != '-Wstrict-prototypes' + ) setup( # Name of this package @@ -41,4 +42,4 @@ 'serpent = serpent:main', ], } - ), +) From f6dd6512c91bc41c7f0fba3c2180102c40e6ed70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 12 Jan 2016 14:08:17 +0100 Subject: [PATCH 2/2] Fix compilation with Visual Studio. --- bignum.cpp | 6 ++---- bignum.h | 4 +++- compiler.h | 2 -- funcs.cpp | 2 -- tokenize.cpp | 5 +---- tokenize.h | 4 +--- util.h | 2 -- 7 files changed, 7 insertions(+), 18 deletions(-) diff --git a/bignum.cpp b/bignum.cpp index 4b8aed6..2fd554b 100644 --- a/bignum.cpp +++ b/bignum.cpp @@ -1,5 +1,3 @@ -#include -#include #include #include #include "bignum.h" @@ -66,7 +64,7 @@ bool decimalGt(const std::string &a, const std::string &b, bool eqAllowed) { //Remove leading zeros if needed static std::string removeRedundantLeadingZeros(const std::string &s) { int n_zeros = 0; - for (int i = 0; i < s.size() - 1 && s[i] == '0'; ++i) + for (size_t i = 0; i < s.size() - 1 && s[i] == '0'; ++i) n_zeros++; return s.substr(n_zeros); @@ -109,6 +107,6 @@ std::string decimalMod(const std::string &a, const std::string &b) { //String to int conversion unsigned decimalToUnsigned(const std::string &a) { if (a.size() == 0) return 0; - else return (a[a.size() - 1] - '0') + else return (a[a.size() - 1] - '0') + decimalToUnsigned(a.substr(0,a.size()-1)) * 10; } diff --git a/bignum.h b/bignum.h index 56c53a7..83f3a5e 100644 --- a/bignum.h +++ b/bignum.h @@ -1,9 +1,11 @@ #ifndef ETHSERP_BIGNUM #define ETHSERP_BIGNUM +#include + const std::string nums = "0123456789"; -const std::string tt256 = +const std::string tt256 = "115792089237316195423570985008687907853269984665640564039457584007913129639936" ; diff --git a/compiler.h b/compiler.h index aecaa37..babb76e 100644 --- a/compiler.h +++ b/compiler.h @@ -1,8 +1,6 @@ #ifndef ETHSERP_COMPILER #define ETHSERP_COMPILER -#include -#include #include #include #include "util.h" diff --git a/funcs.cpp b/funcs.cpp index ea9be14..b5556a3 100644 --- a/funcs.cpp +++ b/funcs.cpp @@ -1,5 +1,3 @@ -#include -#include #include #include "funcs.h" #include "bignum.h" diff --git a/tokenize.cpp b/tokenize.cpp index a5d3f1c..eb4a624 100644 --- a/tokenize.cpp +++ b/tokenize.cpp @@ -1,8 +1,7 @@ -#include -#include #include #include #include "util.h" +#include "tokenize.h" // These appear as independent tokens even if inside a stream of symbols const std::string atoms[] = { "#", "//", "(", ")", "[", "]", "{", "}" }; @@ -111,5 +110,3 @@ std::vector tokenize(std::string inp, Metadata metadata, bool lispMode) { } return out; } - - diff --git a/tokenize.h b/tokenize.h index 04a42f3..a3812d3 100644 --- a/tokenize.h +++ b/tokenize.h @@ -1,10 +1,8 @@ #ifndef ETHSERP_TOKENIZE #define ETHSERP_TOKENIZE -#include -#include #include -#include +#include #include "util.h" int chartype(char c); diff --git a/util.h b/util.h index 4fb19bb..8fd28ec 100644 --- a/util.h +++ b/util.h @@ -1,8 +1,6 @@ #ifndef ETHSERP_UTIL #define ETHSERP_UTIL -#include -#include #include #include #include