Ensure IBLOCK names are unique
This commit is contained in:
parent
7171398c07
commit
094f01d258
1 changed files with 16 additions and 1 deletions
|
@ -40,6 +40,19 @@
|
||||||
|
|
||||||
;;; Compilation setup
|
;;; Compilation setup
|
||||||
|
|
||||||
|
(defun make-iblock-names-unique (start-iblock)
|
||||||
|
(let ((encountered '()))
|
||||||
|
(do-iblocks (iblock start-iblock)
|
||||||
|
(let ((existing (assoc (name iblock) encountered :test #'equalp)))
|
||||||
|
(if existing
|
||||||
|
(progn
|
||||||
|
(setf (name iblock)
|
||||||
|
(format nil "~A_~A" (name iblock) (incf (cdr existing)))))
|
||||||
|
(progn
|
||||||
|
(push (cons (copy-seq (name iblock)) 1) encountered)
|
||||||
|
(setf (name iblock)
|
||||||
|
(format nil "~A_1" (name iblock)))))))))
|
||||||
|
|
||||||
(defun fix-iblock-flow (start-iblock)
|
(defun fix-iblock-flow (start-iblock)
|
||||||
(let ((reached '())
|
(let ((reached '())
|
||||||
(last nil)
|
(last nil)
|
||||||
|
@ -77,7 +90,9 @@
|
||||||
,@body)
|
,@body)
|
||||||
(when ,add-return-p
|
(when ,add-return-p
|
||||||
(build-insert-end (make-instance 'ir-return) ,builder))
|
(build-insert-end (make-instance 'ir-return) ,builder))
|
||||||
(fix-iblock-flow ,iblock))))
|
(fix-iblock-flow ,iblock)
|
||||||
|
(unless (null (next ,iblock))
|
||||||
|
(make-iblock-names-unique (next ,iblock))))))
|
||||||
|
|
||||||
;;; Some quick example code
|
;;; Some quick example code
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue