From 85e9e7cd11d22c8ad3fb8d75349b7e773912dffa Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 9 Aug 2019 19:03:29 +0200 Subject: [PATCH] changed //EX to #if HDR; removed #if EX --- binary-tiling.cpp | 2 +- makeh.cpp | 18 +++++++++++------- nonisotropic.cpp | 12 +++++++++--- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/binary-tiling.cpp b/binary-tiling.cpp index 5a4d0a07..e2a40f54 100644 --- a/binary-tiling.cpp +++ b/binary-tiling.cpp @@ -6,7 +6,7 @@ namespace hr { EX namespace binary { -#if EX CAP_BT +#if CAP_BT enum bindir { bd_right = 0, diff --git a/makeh.cpp b/makeh.cpp index ccdca1f1..6910a092 100644 --- a/makeh.cpp +++ b/makeh.cpp @@ -20,6 +20,7 @@ void mark_file() { bool do_endif; +bool in_hdr; void gen(string s) { which_file = s; @@ -28,16 +29,18 @@ void gen(string s) { while(getline(in, s)) { while(s != "" && s[0] == ' ') s = s.substr(1); while(s.back() == 10 || s.back() == 13) s = s.substr(0, s.size() - 1); - if(s.substr(0, 7) == "#if EX ") { - cout << ind() << s << "\n"; - do_endif = true; + if(in_hdr) { + if(s == "#endif" && in_hdr) { + in_hdr = false; + } + else cout << ind() << s << "\n"; + continue; } - if(s.substr(0, 4) == "//EX") { - auto t = s.substr(4); - while(t != "" && t[0] == ' ') t = t.substr(1); - cout << ind() << t << "\n"; + if(s == "#if HDR") { + in_hdr = true; } if(s.substr(0, 4) == "EX }") { + mark_file(); cout << ind() << "}\n"; indent -= 2; } @@ -49,6 +52,7 @@ void gen(string s) { indent += 2; } else { + mark_file(); for(int i=0;; i++) { if(i == int(t.size())) { cerr << "Error: unrecognizable EX: " << s << "\n"; } else if(t[i] == '{') { diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 0777ec75..82147de5 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -9,7 +9,9 @@ EX namespace nisot { typedef array ptlow; EX transmatrix local_perspective; - //EX inline bool local_perspective_used() { return nonisotropic; } + #if HDR + inline bool local_perspective_used() { return nonisotropic; } + #endif EX bool geodesic_movement = true; @@ -443,7 +445,9 @@ EX namespace nilv { hyperpoint mvec_to_point(mvec m) { return hpxy3(m[0], m[1], m[2]); } - //EX static const int nilv_S7 = 8; + #if HDR + static const int nilv_S7 = 8; + #endif array movevectors = {{ mvec(-1,0,0), mvec(-1,0,1), mvec(0,-1,0), mvec(0,0,-1), mvec(1,0,0), mvec(1,0,-1), mvec(0,1,0), mvec(0,0,1) }}; @@ -546,7 +550,9 @@ EX namespace nisot { return true; } - //EX enum iePrecision { iLazy, iTable }; + #if HDR + enum iePrecision { iLazy, iTable }; + #endif EX hyperpoint inverse_exp(const hyperpoint h, iePrecision p) { if(sol) return solv::get_inverse_exp(h, p == iLazy);