(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.
(:guard :start)
(:typedefs :start) :typedefs (:typedefs :end)
(:includes :start) :includes (:includes :end)
- (:classes :start) :classes (:classes :end)
+ (:classes :start) (:classes :end)
(:guard :end)
:epilogue)
(:prologue
(format stream "~
-/* -*-c-*-
+/* -*- mode: c; indent-tabs-mode: nil -*-
*
* Header file generated by SOD for ~A
*/~2%"
(:prologue
(format stream "~
-/* -*-c-*-
+/* -*- mode: c; indent-tabs-mode: nil -*-
*
* Implementation file generated by SOD for ~A
*/~2%"
((: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 --------------------------------------------------