X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=edge-table-storage.lisp;h=366aa90b84d19e75ed8dd4ca1131efc0df2dcb22;hb=20c849f483c381f84eae22eee807280c8d00e554;hp=34a3142da9d916af3c33e537c7adbb3479bad48c;hpb=b29c5d666cbd1d0c08d4da49b32e4ed41c6dabba;p=reversi.git diff --git a/edge-table-storage.lisp b/edge-table-storage.lisp index 34a3142..366aa90 100644 --- a/edge-table-storage.lisp +++ b/edge-table-storage.lisp @@ -2,25 +2,45 @@ ;;;; ;;;; FILE IDENTIFICATION ;;;; -;;;; Name: edge-table-storage.cl +;;;; Name: edge-table-storage.lisp ;;;; Purpose: Store precompiled edge table for reversi -;;;; Programer: Kevin M. Rosenberg, M.D. +;;;; Programer: Kevin Rosenberg ;;;; Date Started: 1 Nov 2001 -;;;; CVS Id: $Id: edge-table-storage.lisp,v 1.1 2002/10/25 08:36:42 kevin Exp $ ;;;; +;;;; $Id: edge-table-storage.lisp,v 1.4 2003/06/12 12:42:13 kevin Exp $ +;;;; +;;;; This file is Copyright (c) 2001-2003 by Kevin M. Rosenberg +;;;; +;;;; Reversi users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;;*************************************************************************** -(in-package :reversi) +(in-package #:reversi) (defparameter *et-path* nil) -(eval-when (:compile-toplevel :load-toplevel :execute) +(eval-when (:load-toplevel :execute) + (let ((precompiled-path (make-pathname + :directory '(:absolute "usr" "share" "common-lisp" + "source" "reversi") + :name "edge-table" + :type "dat"))) + (if (probe-file precompiled-path) + (setq *et-path* precompiled-path) + (setq *et-path* (make-pathname + :directory (pathname-directory *load-truename*) + :host (pathname-host *load-truename*) + :device (pathname-device *load-truename*) + :name "edge-table" + :type "dat")))) (defun store-edge-table (et &optional (path *et-path*)) (with-open-file (stream path :direction :output :if-exists :supersede) (print (length et) stream) (dotimes (i (length et)) + (declare (fixnum i)) (print (aref et i) stream)))) (defun load-edge-table (&optional (path *et-path*)) @@ -29,12 +49,12 @@ (let* ((length (read stream)) (et (make-array length :element-type 'fixnum))) (dotimes (i length) + (declare (fixnum i)) (setf (aref et i) (read stream))) et)))) - (setq *et-path* (make-pathname :defaults *load-truename* :name nil :type nil)) - (unless (probe-file *et-path*) + (format *trace-output* ";; Recompiling edge-table, this make take several minutes") (store-edge-table (make-edge-table))) (unless *edge-table*