src/module-impl.lisp: Eliminate `define-fragment'.
[sod] / src / module-impl.lisp
index 08679ce..c15edda 100644 (file)
 (defmethod make-load-form ((fragment c-fragment) &optional environment)
   (make-load-form-saving-slots fragment :environment environment))
 
-(export 'code-fragment-item)
+(export '(code-fragment-item code-fragment code-fragment-reason
+         code-fragment-name code-fragment-constraints))
 (defclass code-fragment-item ()
   ((fragment :initarg :fragment :type c-fragment :reader code-fragment)
    (reason :initarg :reason :type keyword :reader code-fragment-reason)
   (:documentation
    "A plain fragment of C to be dropped in at top-level."))
 
-(defmacro define-fragment ((reason name) &body things)
-  (categorize (thing things)
-      ((constraints (listp thing))
-       (frags (typep thing '(or string c-fragment))))
-    (when (null frags)
-      (error "Missing code fragment"))
-    (when (cdr frags)
-      (error "Multiple code fragments"))
-    `(add-to-module
-      *module*
-      (make-instance 'code-fragment-item
-                    :fragment ',(car frags)
-                    :name ,name
-                    :reason ,reason
-                    :constraints (list ,@(mapcar (lambda (constraint)
-                                                   (cons 'list constraint))
-                                                 constraints))))))
-
 ;;;--------------------------------------------------------------------------
 ;;; File searching.