From 9372a9e0e83fb4f95bddf769b28bcbea787b45be Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 29 May 2020 12:51:21 -0400 Subject: [PATCH] Added more behavior to "lef read" annotation to include handling bracket characters in the LEF file that are escaped with backslashes. --- lef/lefRead.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lef/lefRead.c b/lef/lefRead.c index 4fa2f0ad..2ef844ad 100644 --- a/lef/lefRead.c +++ b/lef/lefRead.c @@ -1492,9 +1492,18 @@ LefReadPin(lefMacro, f, pinname, pinNum, oscale, is_imported) } else if ((delim = strchr(testpin, '[')) != NULL) { + char *delim2; *delim = '<'; - if ((delim = strchr(testpin, ']')) != NULL) - *delim = '>'; + if ((delim2 = strchr(testpin, ']')) != NULL) + *delim2 = '>'; + + /* In case the LEF file escapes the bracket, remove the backslashes */ + if ((delim > testpin) && (*(delim - 1) == '\\')) + { + memmove(delim - 1, delim, strlen(delim) + 1); + if (delim2 > delim) + memmove(delim2 - 2, delim2 - 1, strlen(delim2 - 1) + 1); + } } for (firstlab = lefMacro->cd_labels; firstlab; firstlab = firstlab->lab_next) if (!strcmp(firstlab->lab_text, testpin))