From 9fb73a392848b607a156a04bd02db74fd9b32c19 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 29 Nov 2019 01:15:06 +0100 Subject: [PATCH] A small enhancement for CIF / less ignorant reader The change is to allow lower-case cell and layer names when they are separated from the command with a blank. So "Layername XZY;": "L" is the command, "ayername" is ignored BUT: "L xyz;": "xyz" is not part of the command, but the layername. Same for "DS". This is a deviation from the "standard", but a useful one. Otherwise case sensitivity cannot be maintained anymore in a CIF/Magic loop. --- src/plugins/streamers/cif/db_plugin/dbCIFReader.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/streamers/cif/db_plugin/dbCIFReader.cc b/src/plugins/streamers/cif/db_plugin/dbCIFReader.cc index c24a97933..1a9cb5ccd 100644 --- a/src/plugins/streamers/cif/db_plugin/dbCIFReader.cc +++ b/src/plugins/streamers/cif/db_plugin/dbCIFReader.cc @@ -106,10 +106,17 @@ CIFReader::warn (const std::string &msg) void CIFReader::skip_blanks() { + bool had_space = false; while (! m_stream.at_end ()) { char c = m_stream.peek_char (); if (isupper (c) || isdigit (c) || c == '-' || c == '(' || c == ')' || c == ';') { return; + } else if (isspace (c)) { + had_space = true; + } else if (had_space) { + // an extension to allow lower-case cell and layer names and some more flexibility + // in general: after space (blank, tab ...) any character will end the sequence. + return; } m_stream.get_char (); } @@ -536,8 +543,6 @@ CIFReader::read_cell (db::Layout &layout, db::Cell &cell, double sf, int level) } else if (c == 'L') { - skip_blanks (); - ++layer_specs; std::string name = read_name ();