1 ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: GLISP-TEMP; -*-
2 ;;; ---------------------------------------------------------------------------
3 ;;; Title: Generating a sane DEFPACKAGE for GLISP
4 ;;; Created: 1999-05-25
5 ;;; Author: Gilbert Baumann <gilbert@base-engineering.com>
6 ;;; License: MIT style (see below)
7 ;;; ---------------------------------------------------------------------------
8 ;;; (c) copyright 1999,2000 by Gilbert Baumann
10 ;;; Permission is hereby granted, free of charge, to any person obtaining
11 ;;; a copy of this software and associated documentation files (the
12 ;;; "Software"), to deal in the Software without restriction, including
13 ;;; without limitation the rights to use, copy, modify, merge, publish,
14 ;;; distribute, sublicense, and/or sell copies of the Software, and to
15 ;;; permit persons to whom the Software is furnished to do so, subject to
16 ;;; the following conditions:
18 ;;; The above copyright notice and this permission notice shall be
19 ;;; included in all copies or substantial portions of the Software.
21 ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 ;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 ;;; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25 ;;; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 ;;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 ;;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 (defpackage :glisp-temp
(:use
#:cl
))
30 (in-package :glisp-temp
)
32 (defpackage :glisp
(:use
))
35 (defvar *export-from-glisp
*
56 "G/READ-BYTE-SEQUENCE"
58 "G/READ-CHAR-SEQUENCE"
64 "G/WRITE-BYTE-SEQUENCE"
89 "USE-BYTE-FOR-CHAR-STREAM-FLAVOUR"
90 "USE-CHAR-FOR-BYTE-STREAM-FLAVOUR"
94 "CL-BYTE-STREAM->GSTREAM"
95 "CL-CHAR-STREAM->GSTREAM"
100 "DELETE-TEMPORARY-FILE"
101 "WITH-TEMPORARY-FILE"
104 "MAYBE-PARSE-INTEGER"
106 "WITH-STRUCTURE-SLOTS"
121 "MAKE-STRING-EQUAL-HASH-TABLE"
131 (defparameter *packages
*
132 #-GCL
'(:common-lisp
)
133 #+GCL
'(:lisp
:pcl
) )
135 (defparameter *gray-symbols
*
136 '("FUNDAMENTAL-STREAM"
137 "FUNDAMENTAL-INPUT-STREAM"
138 "FUNDAMENTAL-OUTPUT-STREAM"
139 "FUNDAMENTAL-CHARACTER-STREAM"
140 "FUNDAMENTAL-BINARY-STREAM"
141 "FUNDAMENTAL-CHARACTER-INPUT-STREAM"
142 "FUNDAMENTAL-CHARACTER-OUTPUT-STREAM"
143 "FUNDAMENTAL-BINARY-INPUT-STREAM"
147 "STREAM-READ-CHAR-NO-HANG"
155 "STREAM-START-LINE-P"
156 "STREAM-WRITE-STRING"
159 "STREAM-FINISH-OUTPUT"
160 "STREAM-FORCE-OUTPUT"
161 "STREAM-ADVANCE-TO-COLUMN"
164 "STREAM-WRITE-BYTE" ))
166 (defparameter *gray-packages
*
170 #+:sbcl
,@'(:sb-gray
)
171 #+:ALLEGRO
,@'(:common-lisp
:excl
:stream
)
172 #+:HARLEQUIN-COMMON-LISP
,@'(:stream
)
176 (defun seek-symbol (name packages
)
177 ;; Seek the a symbol named 'name' in `packages'
178 (or (some #'(lambda (p)
179 (multiple-value-bind (sym res
) (find-symbol name p
)
180 (if (eql res
:external
)
184 (progn (format T
"~&There is no ~A in ~A." name packages
)
188 (defun dump-defpackage (&aux imports export-gray
)
189 (labels ((grok (symbols packages
)
191 (dolist (nam symbols
)
192 (let ((sym (seek-symbol nam packages
)))
195 (cond ((multiple-value-bind (sym2 res
) (find-symbol nam
:glisp
)
196 (and sym2
(eq res
:external
)))
198 (format T
"~&;; ~S is pacthed." sym
) )
201 ;; CLISP has no (:import ..) ARG!
203 ,(package-name (symbol-package sym
))
207 (setf export-gray
(grok *gray-symbols
* *gray-packages
*))
213 ,@(mapcar #'symbol-name export-gray
)
214 ,@*export-from-glisp
*))
216 (:use
"CL" "GLISP")) )))
218 (defmacro define-glisp-package
()
222 (define-glisp-package)