X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/1d8cc67a3f4ded443f5efc673a616883cbae9c50..9ec578d9fe450b7e7f9030dc9d930185593aa991:/src/module-output.lisp diff --git a/src/module-output.lisp b/src/module-output.lisp index f04bdd6..f61eb92 100644 --- a/src/module-output.lisp +++ b/src/module-output.lisp @@ -79,8 +79,9 @@ (make-instance 'position-aware-output-stream :stream stream :file (stream-pathname stream))))) - (hook-output module reason sequencer) - (invoke-sequencer-items sequencer stream))) + (with-module-environment (module) + (hook-output module reason sequencer) + (invoke-sequencer-items sequencer stream)))) ;;;-------------------------------------------------------------------------- ;;; Output implementation. @@ -118,7 +119,7 @@ (:prologue (format stream "~ -/* -*-c-*- +/* -*- mode: c; indent-tabs-mode: nil -*- * * Header file generated by SOD for ~A */~2%" @@ -165,7 +166,7 @@ (:prologue (format stream "~ -/* -*-c-*- +/* -*- mode: c; indent-tabs-mode: nil -*- * * Implementation file generated by SOD for ~A */~2%" @@ -179,4 +180,33 @@ ((:includes :end) (terpri stream)))) +;;;-------------------------------------------------------------------------- +;;; Output types. + +(defvar *output-types* nil + "List of known output types.") + +(export 'declare-output-type) +(defun declare-output-type (reason pathname) + "Record that REASON is a valid user-level output type. + + The output file name will be constructed by merging the module's pathname + with PATHNAME." + (setf (get reason 'output-type) pathname)) + +(export 'output-type-pathname) +(defun output-type-pathname (reason) + "Return the PATHNAME template for the output type REASON. + + Report an error if there is no such output type." + (or (get reason 'output-type) + (error "Unknown output type `~(~A~)'" reason))) + +(define-clear-the-decks reset-output-types + "Clear out the registered output types." + (dolist (reason *output-types*) (remprop reason 'output-type)) + (setf *output-types* nil) + (declare-output-type :c (make-pathname :type "C" :case :common)) + (declare-output-type :h (make-pathname :type "H" :case :common))) + ;;;----- That's all, folks --------------------------------------------------