home *** CD-ROM | disk | FTP | other *** search
- ;; -*- package: oou -*-
- (provide :oou)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; oou-init.Lisp
- ;;
- ;; Copyright ⌐ 1991 Northwestern University Institute for the Learning Sciences
- ;; All Rights Reserved
- ;;
- ;; author: Michael S. Engber
- ;;
- ;; load this file before using oodles-of-utils
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
- (defpackage :oou
- (:nicknames :oodles-of-utils)
- (:use :common-lisp :ccl)
- (:import-from :ccl
- :find-field-descriptor
- :with-cstrs
- :%put-point
- :%getport
- :%clear-block
- :window-erase-region
- :*simple-view-clip-region*
- :color-list
- :rletz
- ))
-
- (in-package :oou)
-
- (export '(oou-dependencies compile-oou))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;set up logical pathnames
-
- (setf (logical-pathname-translations "mcl")
- `((#P"**;*.*" "ccl:**;*.*"))
-
- (logical-pathname-translations "oou-top")
- `((#P"**;" "mcl:oodles-of-utils;**;"))
-
- (logical-pathname-translations "oou-fasl")
- `((#P"**;+*.*" "oou-top:NotInROM;*.*")
- (#P"**;*.*" "oou-top:oou-fasl;*.*"))
-
- (logical-pathname-translations "oou-mods")
- `((#P"**;*.*" "oou-top:oou-mods;*.*"))
-
- (logical-pathname-translations "oou-patches")
- `((#P"**;*.*" "oou-top:patches;*.*"))
-
- (logical-pathname-translations "oou")
- `((#P"**;*.fasl" "oou-fasl:*.*")
- (#P"**;*.*" "oou-top:**;*.*")))
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; primitive dependency/require facility - should be improved
- ;; or maybe switched over to defsystem
-
- (defvar *oou-modules* nil)
-
- (defun oou-pick-load-file (name)
- (let ((mods (merge-pathnames name "oou-mods:*.lisp"))
- (fasl (merge-pathnames name "oou-fasl:*.fasl"))
- (lisp (first (directory (merge-pathnames name "oou:**;*.lisp")))))
- (cond
- ((probe-file mods) (merge-pathnames name "oou-mods:*"))
- ((null (probe-file fasl)) lisp)
- ((null (probe-file lisp)) fasl)
- ((> (file-write-date lisp) (file-write-date fasl)) lisp)
- (fasl))))
-
- (defun oou-require (module)
- (let ((module-string (etypecase module
- (symbol (symbol-name module))
- (string module))))
- (unless (find module-string *oou-modules* :test #'string-equal)
- (let ((path (oou-pick-load-file module-string))
- (loaded-p nil))
- (unless path (error "couldn't find file named ~a in oodles-of-utils" module-string))
- (unwind-protect
- (progn
- (pushnew module-string *oou-modules* :test #'string-equal)
- (load path)
- (setf loaded-p t))
- (unless loaded-p
- (setf *oou-modules* (delete module-string *oou-modules* :test #'string-equal))))))))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; primitive compilation facility
-
- (defparameter *oou-no-compile-paths* `("**;work-in-progress;**;"
- "**;boondoggles;**;"
- "**;examples;**;"
- "**;oou-fasl;**;"
- "**;oou-mods;**;"
- "**;*-example.lisp"
- "**;*-test.lisp"
- "**;*-scrap.lisp"
- "oou-init.lisp"
- ))
-
- (defun oou-source-files ()
- (directory
- "oou:**;*.lisp"
- :test #'(lambda (file) (not (find file *oou-no-compile-paths* :test #'pathname-match-p)))))
-
- (defun compile-oou ()
- (dolist (lisp-path (oou-source-files))
- (let ((fasl-path (merge-pathnames "oou-fasl:.fasl" lisp-path)))
- (when (or (null (probe-file fasl-path))
- (< (file-write-date fasl-path) (file-write-date lisp-path)))
- (format t "~%;Compiling ~s~%" lisp-path)
- (compile-file lisp-path :output-file fasl-path :verbose *compile-verbose* :print *compile-print*)))))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
-
- (defun load-oou ()
- (dolist (file (oou-source-files))
- (load (oou-pick-load-file (pathname-name file)))))
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; oou's version of provide and require
-
- (defmacro oou-provide (module) (declare (ignore module)) (values))
-
- (defmacro oou-dependencies (&rest modules)
- `(eval-when (:compile-toplevel :load-toplevel :execute)
- ,@(mapcar #'(lambda (m) `(oou-require ,m)) modules)))
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;executed forms
-
- (use-package :oou :cl-user) ;cl-user uses oou
-
- (push #4P"oou:NotInRom;" *module-search-path*)
-
- (oou-require :patches)
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- #|
- (compile-oou)
-
- (load-oou)
- |#