From 6d223931fb0a07fd5cc0b1e7d9a540f9ae6fd360 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 21 Jun 2021 20:03:32 +0100 Subject: [PATCH] Convert overbar syntax in bus aliases. Fixes https://gitlab.com/kicad/code/kicad/issues/8647 --- eeschema/sch_file_versions.h | 3 ++- .../sch_plugins/kicad/sch_sexpr_parser.cpp | 21 ++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_file_versions.h b/eeschema/sch_file_versions.h index c13ce21f8c..fc8d5aa6bb 100644 --- a/eeschema/sch_file_versions.h +++ b/eeschema/sch_file_versions.h @@ -63,4 +63,5 @@ //#define SEXPR_SCHEMATIC_FILE_VERSION 20210126 // Fix bug with writing pin uuids. //#define SEXPR_SCHEMATIC_FILE_VERSION 20210406 // Add schematic level uuids. //#define SEXPR_SCHEMATIC_FILE_VERSION 20210606 // Change overbar syntax from `~...~` to `~{...}`. -#define SEXPR_SCHEMATIC_FILE_VERSION 20210615 // Update overbar syntax in net names. +//#define SEXPR_SCHEMATIC_FILE_VERSION 20210615 // Update overbar syntax in net names. +#define SEXPR_SCHEMATIC_FILE_VERSION 20210621 // Update overbar syntax in bus aliases. diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index 56a049e67f..36cb960048 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -3013,10 +3013,19 @@ void SCH_SEXPR_PARSER::parseBusAlias( SCH_SCREEN* aScreen ) wxCHECK( aScreen, /* void */ ); T token; - auto busAlias = std::make_shared( aScreen ); + std::shared_ptr busAlias = std::make_shared( aScreen ); + wxString alias; + wxString member; NeedSYMBOL(); - busAlias->SetName( FromUTF8() ); + + alias = FromUTF8(); + + if( m_requiredVersion < 20210621 ) + alias = ConvertToNewOverbarNotation( alias ); + + busAlias->SetName( alias ); + NeedLEFT(); token = NextTok(); @@ -3030,7 +3039,13 @@ void SCH_SEXPR_PARSER::parseBusAlias( SCH_SCREEN* aScreen ) if( !IsSymbol( token ) ) Expecting( "quoted string" ); - busAlias->AddMember( FromUTF8() ); + member = FromUTF8(); + + if( m_requiredVersion < 20210621 ) + member = ConvertToNewOverbarNotation( member ); + + busAlias->AddMember( member ); + token = NextTok(); }