X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/3dca7758421664a838c54b273bd9221f02072045..fddbedf7b1b4b19add30eeb62281748cc77e6955:/src/module-proto.lisp diff --git a/src/module-proto.lisp b/src/module-proto.lisp index 9c7fcaf..ca0d511 100644 --- a/src/module-proto.lisp +++ b/src/module-proto.lisp @@ -7,7 +7,7 @@ ;;;----- Licensing notice --------------------------------------------------- ;;; -;;; This file is part of the Sensble Object Design, an object system for C. +;;; This file is part of the Sensible Object Design, an object system for C. ;;; ;;; SOD is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by @@ -84,7 +84,10 @@ When `clear-the-decks' is called, the BODY will be evaluated as a progn. The relative order of `clear-the-decks' operations is unspecified." - `(add-clear-the-decks-function ',name (lambda () ,@body))) + (multiple-value-bind (docs decls body) (parse-body body) + `(add-clear-the-decks-function ',name (lambda () + ,@docs ,@decls + (block ,name ,@body))))) (export 'clear-the-decks) (defun clear-the-decks () @@ -138,19 +141,22 @@ according to the class choice set in the module's `:module-class' property. This has the side effects of calling `shared-initialize', setting the module's state to `t', and checking for unrecognized - properties. (Therefore subclasses should add a method to - `shared-initialize' taking care of looking at interesting properties, just - to make sure they're ticked off.)")) + properties. (Therefore subclasses should add a method to `shared- + initialize' taking care of looking at interesting properties, just to make + sure they're ticked off.)")) ;;;-------------------------------------------------------------------------- ;;; Module objects. -(export '(module module-name module-pset module-items module-dependencies)) +(export '(module module-name module-pset module-errors + module-items module-files module-dependencies module-state)) (defclass module () ((name :initarg :name :type pathname :reader module-name) (%pset :initarg :pset :initform (make-pset) :type pset :reader module-pset) + (errors :initarg :errors :initform 0 :type fixnum :reader module-errors) (items :initarg :items :initform nil :type list :accessor module-items) + (files :initarg :files :initform nil :type list :accessor module-files) (dependencies :initarg :dependencies :initform nil :type list :accessor module-dependencies) (variables :initarg :variables :type list :accessor module-variables @@ -176,6 +182,8 @@ * A list of other modules that this one depends on. + * A list of other files this module has read. + * A list of module-variable values, in the order in which they're named in `*module-bindings-alist*'. @@ -219,4 +227,17 @@ "Evaluate BODY within the context of a temporary module." `(call-with-temporary-module (lambda () ,@body))) +;;;-------------------------------------------------------------------------- +;;; Code fragments. + +(export '(c-fragment c-fragment-text)) +(defclass c-fragment () + ((location :initarg :location :type file-location :reader file-location) + (text :initarg :text :type string :reader c-fragment-text)) + (:documentation + "Represents a fragment of C code to be written to an output file. + + A C fragment is aware of its original location, and will bear proper + `#line' markers when written out.")) + ;;;----- That's all, folks --------------------------------------------------