srfi-7.stk 1.77 KB
Newer Older
eg's avatar
eg committed
1 2
;;;; srfi-7.stk 				-- SRFI-7 (PROGRAM)
;;;;
3
;;;; Copyright © 1999-2007 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
eg's avatar
eg committed
4 5 6 7 8
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 2 of the License, or
;;;; (at your option) any later version.
9
;;;;
eg's avatar
eg committed
10 11 12 13
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;; GNU General Public License for more details.
14
;;;;
eg's avatar
eg committed
15 16
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program; if not, write to the Free Software
17
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
eg's avatar
eg committed
18 19
;;;; USA.
;;;;
20
;;;; This is an implementation of SRFI-7 (Richard Kelsey). This implementation
eg's avatar
eg committed
21 22 23 24
;;;; corresponds to the second implementation given in the reference document.
;;;;
;;;;           Author: Erick Gallesio [eg@unice.fr]
;;;;    Creation date: 31-Aug-1999 16:10 (eg)
Erick Gallesio's avatar
Erick Gallesio committed
25
;;;; Last file update:  4-May-2007 19:46 (eg)
eg's avatar
eg committed
26 27 28 29 30 31 32 33 34 35 36 37 38


(define-syntax program
  (syntax-rules (requires files code feature-cond)
     ((program)
      (begin))
     ((program (requires feature-id ...) more ...)
      (begin (cond-expand ((and feature-id ...) 'okay)) (program more ...)))
     ((program (files filename ...) more ...)
      (begin (load filename) ... (program more ...)))
     ((program (code stuff ...) more ...)
      (begin stuff ... (program more ...)))
     ((program (feature-cond (requirement stuff ...) ...) more ...)
39
      (begin (cond-expand (requirement (program stuff ...)) ...)
eg's avatar
eg committed
40 41
	     (program more ...)))))

Erick Gallesio's avatar
Erick Gallesio committed
42
(export-syntax program)
eg's avatar
eg committed
43 44
(provide "srfi-7")