home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / runtime / sysmac.scm < prev    next >
Text File  |  1999-01-02  |  2KB  |  67 lines

  1. #| -*-Scheme-*-
  2.  
  3. $Id: sysmac.scm,v 14.3 1999/01/02 06:19:10 cph Exp $
  4.  
  5. Copyright (c) 1988, 1999 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. |#
  21.  
  22. ;;;; System Internal Syntax
  23. ;;; package: (runtime system-macros)
  24.  
  25. (declare (usual-integrations))
  26.  
  27. (define (initialize-package!)
  28.   (set! syntax-table/system-internal (make-system-internal-syntax-table)))
  29.  
  30. (define syntax-table/system-internal)
  31.  
  32. (define (make-system-internal-syntax-table)
  33.   (let ((table (make-syntax-table system-global-syntax-table)))
  34.     (for-each (lambda (entry)
  35.         (syntax-table-define table (car entry) (cadr entry)))
  36.           `((DEFINE-PRIMITIVES ,transform/define-primitives)
  37.         (UCODE-PRIMITIVE ,transform/ucode-primitive)
  38.         (UCODE-RETURN-ADDRESS ,transform/ucode-return-address)
  39.         (UCODE-TYPE ,transform/ucode-type)))
  40.     table))
  41.  
  42. (define transform/define-primitives
  43.   (macro names
  44.     `(BEGIN ,@(map (lambda (name)
  45.              (cond ((not (pair? name))
  46.                 (primitive-definition name (list name)))
  47.                ((not (symbol? (cadr name)))
  48.                 (primitive-definition (car name) name))
  49.                (else
  50.                 (primitive-definition (car name) (cdr name)))))
  51.            names))))
  52.  
  53. (define (primitive-definition variable-name primitive-args)
  54.   `(DEFINE-INTEGRABLE ,variable-name
  55.      ,(apply make-primitive-procedure primitive-args)))
  56.  
  57. (define transform/ucode-type
  58.   (macro arguments
  59.     (apply microcode-type arguments)))
  60.  
  61. (define transform/ucode-primitive
  62.   (macro arguments
  63.     (apply make-primitive-procedure arguments)))
  64.  
  65. (define transform/ucode-return-address
  66.   (macro arguments
  67.     (make-return-address (apply microcode-return arguments))))