home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacHaskell 2.2 / cl-support / cl-support.lisp < prev    next >
Encoding:
Text File  |  1994-09-27  |  3.3 KB  |  107 lines  |  [TEXT/CCL2]

  1. ;;; cl-support.lisp -- compile-time support for building mumble
  2. ;;;
  3. ;;; author :  Sandra Loosemore
  4. ;;; date   :  10 Oct 1991
  5. ;;;
  6. ;;; This file must be loaded before compiling the cl-definitions file.
  7. ;;; However, it is not needed when loading the compiled file.
  8.  
  9. (in-package "MUMBLE-IMPLEMENTATION")
  10.  
  11.  
  12. ;;; Use this macro for defining an exported mumble function.
  13.  
  14. (defmacro define-mumble-function (name &rest stuff)
  15.   `(progn
  16.      ;; CLisp's compiler is horribly broken about this...
  17.      #-clisp (eval-when (eval compile load) (export (list ',name) "MUMBLE"))
  18.      #+clisp (export ',(list name) "MUMBLE")
  19.      (defun ,name ,@stuff)))
  20.  
  21.  
  22. ;;; This is similar, but also does some stuff to try to inline the
  23. ;;; function definition.  
  24.  
  25. (defmacro define-mumble-function-inline (name &rest stuff)
  26.   `(progn
  27.      ;; CLisp's compiler is horribly broken about this...
  28.      #-clisp (eval-when (eval compile load) (export (list ',name) "MUMBLE"))
  29.      #+clisp (export ',(list name) "MUMBLE")
  30. #+lcl
  31.      (lcl:defsubst ,name ,@stuff)
  32. #-lcl
  33.      (progn
  34.        (proclaim '(inline ,name))
  35.        (defun ,name ,@stuff))
  36.      ',name))
  37.  
  38.  
  39. ;;; Use this macro for defining an exported mumble macro.
  40.  
  41. (defmacro define-mumble-macro (name &rest stuff)
  42.   `(progn
  43.      ;; CLisp's compiler is horribly broken about this...
  44.      #-clisp (eval-when (eval compile load) (export (list ',name) "MUMBLE"))
  45.      #+clisp (export ',(list name) "MUMBLE")
  46.      (defmacro ,name ,@stuff)))
  47.  
  48.  
  49. ;;; Use this macro for importing a random symbol into the MUMBLE
  50. ;;; package.  This is useful for things that can share directly with
  51. ;;; built-in Common Lisp definitions.
  52.  
  53. (defmacro define-mumble-import (name)
  54.   `(progn
  55.      ;; CLisp's compiler is horribly broken about this...
  56.      #-clisp (eval-when (eval compile load) (import (list ',name) "MUMBLE"))
  57.      #+clisp (import ',(list name) "MUMBLE")
  58.      #-clisp (eval-when (eval compile load) (export (list ',name) "MUMBLE"))
  59.      #+clisp (export ',(list name) "MUMBLE")
  60.      ',name))
  61.  
  62.  
  63. ;;; Use this macro for defining a function in the MUMBLE package that
  64. ;;; is a synonym for some Common Lisp function.  Try to do some stuff
  65. ;;; to make the function compile inline.
  66.  
  67. (defmacro define-mumble-synonym (name cl-name)
  68.   `(progn
  69.      ;; CLisp's compiler is horribly broken about this...
  70.      #-clisp (eval-when (eval compile load) (export (list ',name) "MUMBLE"))
  71.      #+clisp (export ',(list name) "MUMBLE")
  72.      (setf (symbol-function ',name) (symbol-function ',cl-name))
  73. #+lcl
  74.      (lcl:def-compiler-macro ,name (&rest args)
  75.        (cons ',cl-name args))
  76. #+(or cmu allegro mcl)
  77.      (define-compiler-macro ,name (&rest args)
  78.        (cons ',cl-name args))
  79. #+clisp
  80.      (when (gethash ',cl-name compiler::c-form-table)
  81.        (setf (gethash ',name compiler::c-form-table)
  82.              (gethash ',cl-name compiler::c-form-table)))
  83.      ',name))
  84.  
  85.  
  86.  
  87. ;;; Use this macro to define a type synonym.
  88.  
  89. (defmacro define-mumble-type (name &rest stuff)
  90.   `(progn
  91.      ;; CLisp's compiler is horribly broken about this...
  92.      #-clisp (eval-when (eval compile load) (export (list ',name) "MUMBLE"))
  93.      #+clisp (export ',(list name) "MUMBLE")
  94.      (deftype ,name ,@stuff)))
  95.  
  96.  
  97. ;;; This macro is used to signal a compile-time error in situations
  98. ;;; where an implementation-specific definition is missing.
  99.  
  100. (defmacro missing-mumble-definition (name)
  101.   (error "No definition has been provided for ~s." name))
  102.  
  103.  
  104.  
  105.  
  106.  
  107.