From ab283002f1ab9796603af7bf146530110a0a262b Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 27 Dec 2019 01:43:58 +0100 Subject: [PATCH] arb:: comments, named tilings --- arbitrile.cpp | 13 ++++++++++++- classes.cpp | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arbitrile.cpp b/arbitrile.cpp index e4a92d0f..f20d7b6b 100644 --- a/arbitrile.cpp +++ b/arbitrile.cpp @@ -27,6 +27,7 @@ struct shape { struct arbi_tiling { vector shapes; + string name; geometryinfo1& get_geometry(); eGeometryClass get_class() { return get_geometry().kind; } @@ -63,6 +64,8 @@ template bool correct_index(int index, const T& v) { return correct_ind template void verify_index(int index, const T& v) { if(!correct_index(index, v)) throw hr_parse_exception("bad index"); } +string unnamed = "unnamed"; + void load(const string& fname) { fhstream f(fname, "rt"); string s; @@ -73,13 +76,20 @@ void load(const string& fname) { } auto& c = current; c.shapes.clear(); + c.name = unnamed; exp_parser ep; ep.s = s; ld angleunit = 1, distunit = 1, angleofs = 0; while(true) { ep.skip_white(); if(ep.next() == 0) break; - if(ep.eat("e2.")) { + if(ep.eat("#")) { + while(ep.eat(" ")) ; + string s = ""; + while(ep.next() >= 32) s += ep.next(), ep.at++; + if(c.name == unnamed) c.name = s; + } + else if(ep.eat("e2.")) { ginf[gArbitrary].g = giEuclid2; set_flag(ginf[gArbitrary].flags, qBOUNDED, false); } @@ -334,6 +344,7 @@ int readArgs() { println(hlog, "failed: ", ex.s); exit(3); } + ginf[gArbitrary].tiling_name = current.name; } else return 1; return 0; diff --git a/classes.cpp b/classes.cpp index 96cf67a3..992981b6 100644 --- a/classes.cpp +++ b/classes.cpp @@ -886,7 +886,7 @@ EX vector ginf = { {"{3,4,4}","none", "{3,4,4} hyperbolic honeycomb", "344", 8, 4, qIDEAL, giHyperb3, 0x50000, {{7, 2}}, eVariation::pure}, {"{3,4,4}","Crystal", "4D crystal in H3", "Cryst3" , 8, 4, qIDEAL | qANYQ | qCRYSTAL, giHyperb3, 0x52000, {{7, 3}}, eVariation::pure}, {"cat", "cat", "Arnold's cat mapping torus", "cat", 12, 3, qBINARY | qSOL | qsBQ | qOPTQ, giSolNIH, 0x52200, {{6, 4}}, eVariation::pure}, - {"arb", "arb", "arbitrary", "arb", 7, 3, qEXPERIMENTAL, giEuclid2, 0, {{7, 5}}, eVariation::pure}, + {"arb", "none", "arbitrary", "arb", 7, 3, qEXPERIMENTAL, giEuclid2, 0, {{7, 5}}, eVariation::pure}, {"{4,oo}", "none", "{4,∞} (infinite squares)", "oox4", 4, 100, qIDEAL, giHyperb2, 0x49400, {{5, 5}}, eVariation::pure}, }; // bits: 9, 10, 15, 16, (reserved for later) 17, 18