From 06339d58e80cfb04604f00016f1c1e6921e87928 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 30 Aug 2015 10:58:38 +0100 Subject: [PATCH] src/codegen-{proto,impl}.lisp: Make *temporary-index* be a module var. This arranges for it to be reset properly. Also, move it into `impl', because users shouldn't mess with it. --- src/codegen-impl.lisp | 10 ++++++++++ src/codegen-proto.lisp | 12 ------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/codegen-impl.lisp b/src/codegen-impl.lisp index 170f4a8..c4f83e1 100644 --- a/src/codegen-impl.lisp +++ b/src/codegen-impl.lisp @@ -37,6 +37,16 @@ ((in-use-p :initarg :in-use-p :initform nil :type boolean :accessor var-in-use-p))) +(define-module-var *temporary-index* 0 + "Index for temporary name generation. + + This is automatically reset to zero before the output functions are + invoked to write a file. This way, we can ensure that the same output + file is always produced from the same input.") + +(define-clear-the-decks reset-codegen-index + (setf *temporary-index* 0)) + (defmethod commentify-argument-name ((name temporary-name)) nil) diff --git a/src/codegen-proto.lisp b/src/codegen-proto.lisp index 535839c..6b1f947 100644 --- a/src/codegen-proto.lisp +++ b/src/codegen-proto.lisp @@ -55,18 +55,6 @@ (:documentation "Base class for temporary variable and argument names.")) -;; Important variables. - -(defparameter *temporary-index* 0 - "Index for temporary name generation. - - This is automatically reset to zero before the output functions are - invoked to write a file. This way, we can ensure that the same output - file is always produced from the same input.") - -(define-clear-the-decks reset-codegen-index - (setf *temporary-index* 0)) - ;; Important temporary names. (export '(*sod-ap* *sod-master-ap*)) -- 2.11.0