Version 1.102 (other changes not in last commit)
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 18 Apr 2010 16:10:34 +0000 (10:10 -0600)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 18 Apr 2010 16:10:34 +0000 (10:10 -0600)
* btree.lisp: New file providing binary tree search for
  sorted vectors
* tests.list: Add tests for binary tree search
* mop.lisp: Change pushed cl:*features* to be in KMRCL
  package, not KEYWORD
* attrib-class.lisp: Use new mop *feature* names for reader
  conditionals
* io.lisp: Add def-unsigned-int-io, along with function
  definitions for binary io of 2 through 8 byte unsigned ints.

30 files changed:
ChangeLog
attrib-class.lisp
buff-input.lisp
byte-stream.lisp
color.lisp
console.lisp
datetime.lisp
equal.lisp
functions.lisp
impl.lisp
io.lisp
kmrcl.asd
listener.lisp
lists.lisp
macros.lisp
math.lisp
mop.lisp
os.lisp
package.lisp
processes.lisp
random.lisp
repl.lisp
seqs.lisp
signals.lisp
sockets.lisp
strings.lisp
strmatch.lisp
tests.lisp
web-utils.lisp
xml-utils.lisp

index 773f4cdd58710d662a9ae83be2f78b42c631615d..5426a9be7847488a7389c0b146a8eb6905a922fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,17 @@
-22 Apr 2010  Kevin Rosenberg <kevin@rosenberg.net>
+17 Apr 2010  Kevin Rosenberg <kevin@rosenberg.net>
+       * Version 1.102
+       * btree.lisp: New file providing binary tree search for
+       sorted vectors
+       * tests.list: Add tests for binary tree search
+       * mop.lisp: Change pushed cl:*features* to be in KMRCL
+       package, not KEYWORD
+       * attrib-class.lisp: Use new mop *feature* names for reader
+       conditionals
+       * io.lisp: Add def-unsigned-int-io, along with function
+       definitions for binary io of 2 through 8 byte unsigned ints.
+
+22 Mar 2010  Kevin Rosenberg <kevin@rosenberg.net>
+       * Version 1.101
        * lists.lisp: Reduce memory use by FLATTEN
 
 20 Aug 2009  Kevin Rosenberg <kevin@rosenberg.net>
        * lists.lisp: Reduce memory use by FLATTEN
 
 20 Aug 2009  Kevin Rosenberg <kevin@rosenberg.net>
index b102eca9300d33edb1e92ac8ce42dfc507b50cd6..453da1bfe5425c8e4524c7413cd01d4941e740da 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: kmrcl-*-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10-*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
@@ -7,9 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
-;;;; This file, part of KMRCL, is Copyright (c) 2002-2003 by Kevin M. Rosenberg
+;;;; This file, part of KMRCL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
@@ -41,22 +39,22 @@ on example from AMOP"))
 ;; encapsulating macro for Lispworks
 (kmr-mop:process-slot-option attributes-class :attributes)
 
 ;; encapsulating macro for Lispworks
 (kmr-mop:process-slot-option attributes-class :attributes)
 
-#+(or cmu scl sbcl openmcl)
+#+(or cmu scl sbcl ccl)
 (defmethod kmr-mop:validate-superclass ((class attributes-class)
                                         (superclass kmr-mop:standard-class))
   t)
 
 (defmethod kmr-mop:validate-superclass ((class attributes-class)
                                         (superclass kmr-mop:standard-class))
   t)
 
-(defmethod kmr-mop:direct-slot-definition-class ((cl attributes-class) #+kmr-normal-dsdc &rest initargs)
+(defmethod kmr-mop:direct-slot-definition-class ((cl attributes-class) #+kmrcl::normal-dsdc &rest initargs)
   (declare (ignore initargs))
   (kmr-mop:find-class 'attributes-dsd))
 
   (declare (ignore initargs))
   (kmr-mop:find-class 'attributes-dsd))
 
-(defmethod kmr-mop:effective-slot-definition-class ((cl attributes-class) #+kmr-normal-dsdc &rest initargs)
+(defmethod kmr-mop:effective-slot-definition-class ((cl attributes-class) #+kmrcl::normal-dsdc &rest initargs)
   (declare (ignore initargs))
   (kmr-mop:find-class 'attributes-esd))
 
 (defmethod kmr-mop:compute-effective-slot-definition
   (declare (ignore initargs))
   (kmr-mop:find-class 'attributes-esd))
 
 (defmethod kmr-mop:compute-effective-slot-definition
-    ((cl attributes-class) #+kmr-normal-cesd name dsds)
-  #+kmr-normal-cesd (declare (ignore name))
+    ((cl attributes-class) #+kmrcl::normal-cesd name dsds)
+  #+kmrcl::normal-cesd (declare (ignore name))
   (let ((esd (call-next-method)))
     (setf (esd-attributes esd) (remove-duplicates (mapappend #'dsd-attributes dsds)))
     esd))
   (let ((esd (call-next-method)))
     (setf (esd-attributes esd) (remove-duplicates (mapappend #'dsd-attributes dsds)))
     esd))
index 0e98ad2ca3c3459c5442e180df2e4d855d425df1..1f2b2f6297fcb98fc495cdb1f4d6c6e1d73d6124 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index e3036074a00034224864fd7b3dfcef8767a98ff8..0021022e8f78c6ec5aab769a79f946f4fe47b3b1 100644 (file)
@@ -1,4 +1,4 @@
-;;; -*- Syntax: Ansi-Common-Lisp; Base: 10; Mode: lisp; Package: kmrcl -*-
+;;; -*- Syntax: Ansi-Common-Lisp; Base: 10; Mode: lisp -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  June 2003
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  June 2003
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; Works for CMUCL, SBCL, and AllergoCL only
 ;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2003 by Kevin M. Rosenberg
 ;;;; Works for CMUCL, SBCL, and AllergoCL only
 ;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2003 by Kevin M. Rosenberg
@@ -21,7 +19,7 @@
 
 (in-package #:kmrcl)
 
 
 (in-package #:kmrcl)
 
-;; Intial CMUCL version by OnShored. Ported to SBCL by Kevin Rosenberg
+;; Intial CMUCL version by OnShored. Ported to AllegroCL, SBCL by Kevin Rosenberg
 
 #+sbcl
 (eval-when (:compile-toplevel :load-toplevel :execute)
 
 #+sbcl
 (eval-when (:compile-toplevel :load-toplevel :execute)
index 52d5b46f1fd5c4b13ea366073bee62300e94c9f4..aa3caae12edab769d516174af2315dcb3759f6eb 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: kmrcl -*-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Oct 2003
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Oct 2003
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002-2003 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002-2003 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index 75feac4f905eada91c9f711998c245c0ddc5dba9..acd7723cb84abd4772dddc82e63d82bed183deec 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Dec 2002
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Dec 2002
 ;;;;
-;;;; $Id$
-;;;;a
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and by onShore Development, Inc.
 ;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and by onShore Development, Inc.
 ;;;;
index 30c815c9d01d5bf482e084c5c6ee6ed8b9c0dd7d..0e587ceac42f49bf37033ff2c68cb616136cfcd9 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index 2b063b99caa675a446c37738cb698900e879b8a1..d58ff2947176132b09dc5af235dfe6772dc69e44 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index 9b4f6ed876bee6115b4b3a3b3d5a9c693759453c..e9b30741de3378117d0c0e3507881d290fd48321 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index 762d27ffafddeeba3baf772707a3bf3c577f6121..7135eb0e4ea1005b97aa420de3bf743bfe4574c6 100644 (file)
--- a/impl.lisp
+++ b/impl.lisp
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Sep 2003
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Sep 2003
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
diff --git a/io.lisp b/io.lisp
index 851c3718eae62f98c828b812fefbc691c70db937..7f06bd9b51b2f97ef6e62f791a09260c28ecd139 100644 (file)
--- a/io.lisp
+++ b/io.lisp
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002-2003 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002-2003 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
       ((zerop pos))
     (write-sequence buf out :end pos)))
 
       ((zerop pos))
     (write-sequence buf out :end pos)))
 
+
+(defmacro def-unsigned-int-io (len r-name w-name &key (big-endian nil))
+  "Defines read and write functions for an unsigned integer with LEN bytes from STREAM."
+  (when (< len 1)
+    (error "Number of bytes must be greater than 0.~%"))
+  (let ((endian-string (if big-endian "big" "little")))
+    `(eval-when (:compile-toplevel :load-toplevel :execute)
+       (defun ,r-name (stream)
+         ,(format nil "Reads an ~A byte unsigned integer (~A-endian)."
+                  len endian-string)
+         (declare (optimize (speed 3) (compilation-speed 0) (safety 0)
+                            (space 0) (debug 0))
+                  (type stream stream))
+         (let ((val 0))
+           (declare (type
+                     ,(if (< (expt 256 len) most-positive-fixnum)
+                          'fixnum
+                          `(integer 0 ,(1- (expt 256 len))))
+                     val))
+           ,@(loop for i from 1 upto len
+                collect
+                  `(setf (ldb (byte 8 ,(* (if big-endian (1- i) (- len i))
+                                          8)) val) (read-byte stream)))
+           val))
+       (defun ,w-name (val stream &key (bounds-check t))
+         ,(format nil "Writes an ~A byte unsigned integer as binary to STREAM (~A-endian)."
+                  len endian-string)
+         (declare (optimize (speed 3) (compilation-speed 0) (safety 0)
+                            (space 0) (debug 0))
+                  (type stream stream)
+                  ,(if (< (expt 256 len) most-positive-fixnum)
+                       '(type fixnum val)
+                       '(type integer val)))
+         (when bounds-check
+           (when (>= val ,(expt 256 len))
+             (error "Number ~D is too large to fit in ~D bytes.~%" val ,len))
+           (when (minusp val)
+             (error "Number ~D can't be written as unsigned integer." val)))
+         (locally (declare (type (integer 0 ,(1- (expt 256 len))) val))
+           ,@(loop for i from 1 upto len
+                collect
+                  `(write-byte (ldb (byte 8 ,(* (if big-endian (1- i) (- len i))
+                                                8)) val) stream)))
+         val)
+       nil)))
+
+(defmacro make-unsigned-int-io-fn (len)
+  "Makes reader and writer functions for unsigned byte input/output of
+LEN bytes with both little and big endian order. Function names are in the
+form of {READ,WRITE}-UINT<LEN>-{be,le}."
+  `(progn
+     (def-unsigned-int-io
+         ,len
+         ,(intern (format nil "~A~D-~A" (symbol-name '#:read-uint) len (symbol-name '#:le)))
+       ,(intern (format nil "~A~D-~A" (symbol-name '#:write-uint) len (symbol-name '#:le)))
+       :big-endian nil)
+     (def-unsigned-int-io
+         ,len
+         ,(intern (format nil "~A~D-~A" (symbol-name '#:read-uint) len (symbol-name '#:be)))
+       ,(intern (format nil "~A~D-~A" (symbol-name '#:write-uint) len (symbol-name '#:be)))
+       :big-endian t)))
+
+(make-unsigned-int-io-fn 2)
+(make-unsigned-int-io-fn 3)
+(make-unsigned-int-io-fn 4)
+(make-unsigned-int-io-fn 5)
+(make-unsigned-int-io-fn 6)
+(make-unsigned-int-io-fn 7)
+(make-unsigned-int-io-fn 8)
index 153bf6f918ee0705468a386f8c09beace3fe3492..da12a61d4faac5ae9320fae91e824bd7b8c514d7 100644 (file)
--- a/kmrcl.asd
+++ b/kmrcl.asd
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
@@ -59,6 +57,7 @@
      (:file "repl" :depends-on ("listener" "strings"))
      (:file "os" :depends-on ("macros" "impl"))
      (:file "signals" :depends-on ("package"))
      (:file "repl" :depends-on ("listener" "strings"))
      (:file "os" :depends-on ("macros" "impl"))
      (:file "signals" :depends-on ("package"))
+     (:file "btree" :depends-on ("macros"))
      ))
 
 (defmethod perform ((o test-op) (c (eql (find-system 'kmrcl))))
      ))
 
 (defmethod perform ((o test-op) (c (eql (find-system 'kmrcl))))
index 6c511cf9260b08976e2658af04b0ce106f7689f9..042d57fdd6b194fe1636120f2e58d0f03c48ce99 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: modlisp -*-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Jun 2003
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Jun 2003
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002-2003 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002-2003 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index a2ae23ff6c34d4c6ee20d0e2d7c1f426542d2018..ecdd003f993ec85dd20ee160f23017cb0c2eefb3 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index eb2cef0d6decff1728ed820450c18017a084eae2..cc39ad41b871947c57f85f3edfde6aa983463c4b 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index 327de3f6f5b87cea8c2422d735d62dceb8492188..badf329ee941cffb4b32c9f037795b545efc59dd 100644 (file)
--- a/math.lisp
+++ b/math.lisp
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Nov 2002
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Nov 2002
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index f6bd037d1fb8cba81ba694c2ed969fd2ebd45723..f8aba54c1f26ae47ed39b74987ed1c056938e15f 100644 (file)
--- a/mop.lisp
+++ b/mop.lisp
@@ -7,9 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2003
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2003
 ;;;;
-;;;; $Id$
-;;;;
-;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
+;;;; This file, part of KMRCL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
 #+sbcl
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (if (find-package 'sb-mop)
 #+sbcl
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (if (find-package 'sb-mop)
-      (pushnew :kmr-sbcl-mop cl:*features*)
-      (pushnew :kmr-sbcl-pcl cl:*features*)))
+      (pushnew 'kmrcl::sbcl-mop cl:*features*)
+      (pushnew 'kmrcl::sbcl-pcl cl:*features*)))
 
 #+cmu
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (if (eq (symbol-package 'pcl:find-class)
           (find-package 'common-lisp))
 
 #+cmu
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (if (eq (symbol-package 'pcl:find-class)
           (find-package 'common-lisp))
-      (pushnew :kmr-cmucl-mop cl:*features*)
-      (pushnew :kmr-cmucl-pcl cl:*features*)))
+      (pushnew 'kmrcl::cmucl-mop cl:*features*)
+      (pushnew 'kmrcl::cmucl-pcl cl:*features*)))
 
 (defpackage #:kmr-mop
   (:use
    #:cl
    #:kmrcl
 
 (defpackage #:kmr-mop
   (:use
    #:cl
    #:kmrcl
-   #+kmr-sbcl-mop #:sb-mop
-   #+kmr-cmucl-mop #:mop
+   #+kmrcl::sbcl-mop #:sb-mop
+   #+kmrcl::cmucl-mop #:mop
    #+allegro #:mop
    #+lispworks #:clos
    #+clisp #:clos
    #+scl #:clos
    #+allegro #:mop
    #+lispworks #:clos
    #+clisp #:clos
    #+scl #:clos
-   #+openmcl #:openmcl-mop
+   #+ccl #:openmcl-mop
    )
   )
 
    )
   )
 
    #+clisp
    '(clos::compute-effective-slot-definition-initargs)
    #+sbcl
    #+clisp
    '(clos::compute-effective-slot-definition-initargs)
    #+sbcl
-   '(#+kmr-sbcl-mop class-of #-kmr-sbcl-mop sb-pcl:class-of
-     #+kmr-sbcl-mop class-name #-kmr-sbcl-mop sb-pcl:class-name
-     #+kmr-sbcl-mop class-slots #-kmr-sbcl-mop sb-pcl:class-slots
-     #+kmr-sbcl-mop find-class #-kmr-sbcl-mop sb-pcl:find-class
+   '(#+kmrcl::sbcl-mop class-of #-kmrcl::sbcl-mop sb-pcl:class-of
+     #+kmrcl::sbcl-mop class-name #-kmrcl::sbcl-mop sb-pcl:class-name
+     #+kmrcl::sbcl-mop class-slots #-kmrcl::sbcl-mop sb-pcl:class-slots
+     #+kmrcl::sbcl-mop find-class #-kmrcl::sbcl-mop sb-pcl:find-class
      sb-pcl::standard-class
      sb-pcl:slot-definition-name sb-pcl::finalize-inheritance
      sb-pcl::standard-direct-slot-definition
      sb-pcl::standard-class
      sb-pcl:slot-definition-name sb-pcl::finalize-inheritance
      sb-pcl::standard-direct-slot-definition
      clos::compute-slots
      ;; note: make-method-lambda is not fbound
      )
      clos::compute-slots
      ;; note: make-method-lambda is not fbound
      )
-   #+openmcl
+   #+ccl
    '(openmcl-mop::slot-definition-name openmcl-mop:finalize-inheritance
      openmcl-mop::standard-direct-slot-definition openmcl-mop::standard-effective-slot-definition
      openmcl-mop::validate-superclass openmcl-mop:direct-slot-definition-class openmcl-mop::effective-slot-definition-class
    '(openmcl-mop::slot-definition-name openmcl-mop:finalize-inheritance
      openmcl-mop::standard-direct-slot-definition openmcl-mop::standard-effective-slot-definition
      openmcl-mop::validate-superclass openmcl-mop:direct-slot-definition-class openmcl-mop::effective-slot-definition-class
 
   #+sbcl
   (if (find-package 'sb-mop)
 
   #+sbcl
   (if (find-package 'sb-mop)
-      (setq cl:*features* (delete :kmr-sbcl-mop cl:*features*))
-      (setq cl:*features* (delete :kmr-sbcl-pcl cl:*features*)))
+      (setq cl:*features* (delete 'kmrcl::sbcl-mop cl:*features*))
+      (setq cl:*features* (delete 'kmrcl::sbcl-pcl cl:*features*)))
 
   #+cmu
   (if (find-package 'mop)
 
   #+cmu
   (if (find-package 'mop)
-      (setq cl:*features* (delete :kmr-cmucl-mop cl:*features*))
-      (setq cl:*features* (delete :kmr-cmucl-pcl cl:*features*)))
+      (setq cl:*features* (delete 'kmrcl::cmucl-mop cl:*features*))
+      (setq cl:*features* (delete 'kmrcl::cmucl-pcl cl:*features*)))
 
 
-  (when (>= (length (generic-function-lambda-list
+  (when (< (length (generic-function-lambda-list
                      (ensure-generic-function
                       'compute-effective-slot-definition)))
             3)
                      (ensure-generic-function
                       'compute-effective-slot-definition)))
             3)
-    (pushnew :kmr-normal-cesd cl:*features*))
+    (pushnew 'short-arg-cesd cl:*features*))
 
 
-  (when (>= (length (generic-function-lambda-list
-                     (ensure-generic-function
-                      'direct-slot-definition-class)))
-            3)
-    (pushnew :kmr-normal-dsdc cl:*features*))
+  (when (< (length (generic-function-lambda-list
+                    (ensure-generic-function
+                     'direct-slot-definition-class)))
+           3)
+    (pushnew 'short-arg-dsdc cl:*features*))
 
   )  ;; eval-when
 
   )  ;; eval-when
diff --git a/os.lisp b/os.lisp
index 9714f5f3568cf7c5e2fd897d25e126dfacfb4655..feeefc82b87486f922b4a34c00885cc0a4e177ae 100644 (file)
--- a/os.lisp
+++ b/os.lisp
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Jul 2003
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Jul 2003
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; *************************************************************************
 
 (in-package #:kmrcl)
 ;;;; *************************************************************************
 
 (in-package #:kmrcl)
index 14ca9d66dc7fcc8e7f20677a32c7c29dad9a27b5..c8fa236af5ddd7562178db98250c24b0c80fff92 100644 (file)
@@ -7,9 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
-;;;; This file, part of KMRCL, is Copyright (c) 2002-2006 by Kevin M. Rosenberg
+;;;; This file, part of KMRCL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
    #:+datetime-number-strings+
    #:utc-offset
    #:copy-binary-stream
    #:+datetime-number-strings+
    #:utc-offset
    #:copy-binary-stream
+   #:def-unsigned-int-io
+   #:make-unsigned-int-io-fn
+   #:read-uint2-le #:read-uint2-be #:write-uint2-le #:write-uint2-be
+   #:read-uint3-le #:read-uint3-be #:write-uint3-le #:write-uint3-be
+   #:read-uint4-le #:read-uint4-be #:write-uint4-le #:write-uint4-be
+   #:read-uint5-le #:read-uint5-be #:write-uint5-le #:write-uint5-be
+   #:read-uint6-le #:read-uint6-be #:write-uint6-le #:write-uint6-be
+   #:read-uint7-le #:read-uint7-be #:write-uint7-le #:write-uint7-be
+   #:read-uint8-le #:read-uint8-be #:write-uint8-le #:write-uint8-be
 
    ;; impl.lisp
    #:probe-directory
 
    ;; impl.lisp
    #:probe-directory
    ;; signals.lisp
    #:set-signal-handler
    #:remove-signal-handler
    ;; signals.lisp
    #:set-signal-handler
    #:remove-signal-handler
+
+   ;; btree.lisp
+   #:sorted-vector-find
+   #:string-tricmp
+   #:simple-string-tricmp
+   #:number-tricmp
+   #:complex-number-tricmp
+
+   ;; mop.lisp
+   #:short-arg-cesd
+   #:short-arg-dsdc
    ))
    ))
index b598639f3b1b6a92c802e788fd0d43cc1f94770c..7017ce74e73d95f9cc8fe4fdd57e64d4919f5965 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: modlisp -*-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
@@ -6,8 +6,6 @@
 ;;;; Purpose:       Multiprocessing functions
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  June 2003
 ;;;; Purpose:       Multiprocessing functions
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  June 2003
-;;;;
-;;;; $Id$
 ;;;; *************************************************************************
 
 (in-package #:kmrcl)
 ;;;; *************************************************************************
 
 (in-package #:kmrcl)
index 756cc5f38d902c6a6926587595cd2c0f6dc18b11..bc9ca7546b97dc54b086030256bc1c400a61055b 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index 6848b47497f12f0af5d2cdf44a176b3e11272989..5729a57e8e01f2e01e039c0deae9170ff8e4ce5d 100644 (file)
--- a/repl.lisp
+++ b/repl.lisp
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index 4cc4659e9ba7abff3f7c3a4168ff31e407eba790..8ef74673c0c54c4d67fd14f57c2952675e1f0e70 100644 (file)
--- a/seqs.lisp
+++ b/seqs.lisp
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
@@ -16,7 +14,7 @@
 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
 ;;;; *************************************************************************
 
 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
 ;;;; *************************************************************************
 
-(in-package :kmrcl)
+(in-package #:kmrcl)
 
 
 (defun nsubseq (sequence start &optional end)
 
 
 (defun nsubseq (sequence start &optional end)
index 40e144ba78a5568bf25e701529c5ab57b3e7dfa0..cd40a60aca34d800c3f7018a7b90825b47639fd9 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: modlisp -*-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
index c8c9b58df0aaa6463e0dbc7b075d2afd895aa51a..a75d77dfe38953b56aa35a34aa10c21b7c5ba917 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: modlisp -*-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
@@ -6,8 +6,6 @@
 ;;;; Purpose:       Socket functions
 ;;;; Programmer:    Kevin M. Rosenberg with excerpts from portableaserve
 ;;;; Date Started:  Jun 2003
 ;;;; Purpose:       Socket functions
 ;;;; Programmer:    Kevin M. Rosenberg with excerpts from portableaserve
 ;;;; Date Started:  Jun 2003
-;;;;
-;;;; $Id$
 ;;;; *************************************************************************
 
 (in-package #:kmrcl)
 ;;;; *************************************************************************
 
 (in-package #:kmrcl)
index 9a9f42d8a354985df274ac5829ad0118b21e1eea..4dcda494249b45e44b6166bf304f0c154f0ce8a2 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002-2006 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002-2006 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index e48e2309728be96d07adbdbc2416e09cafbb94a6..38a52fe18dc6689bce87018500add568e7935af7 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; package: kmrcl -*-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index 0b0daa2d4a709c92720a79a9234a1b3d2b8f6019..fb6f977cc5c63481c8e242eb4552aebafa854f11 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Package: kmrcl-tests -*-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
@@ -7,9 +7,7 @@
 ;;;; Author:        Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2003
 ;;;;
 ;;;; Author:        Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2003
 ;;;;
-;;;; $Id$
-;;;;
-;;;; This file is Copyright (c) 2000-2006 by Kevin M. Rosenberg
+;;;; This file is Copyright (c) 2000-2010 by Kevin M. Rosenberg
 ;;;;
 ;;;; *************************************************************************
 
 ;;;;
 ;;;; *************************************************************************
 
 
 (deftest :pis.4 (prefixed-integer-string 234134 #\C 7) "C0234134")
 
 
 (deftest :pis.4 (prefixed-integer-string 234134 #\C 7) "C0234134")
 
- ;;; MOP Testing
+;;; Binary tree search tests
+
+(defvar *btree-vector*)
+
+(defun init-btree-vector (len)
+  (make-random-state t)
+  (setq *btree-vector* (make-array (list len)
+                                   :element-type 'fixnum
+                                   :initial-element 0))
+  (dotimes (i (length *btree-vector*))
+    (setf (aref *btree-vector* i) (random most-positive-fixnum)))
+  (setq *btree-vector* (sort *btree-vector* #'<)))
+
+(defun test-btree-vector (len)
+  (init-btree-vector len)
+  (dotimes (i (length *btree-vector*) t)
+    (let ((stored (aref *btree-vector* i)))
+      (multiple-value-bind (pos value last-pos count)
+          (sorted-vector-find stored *btree-vector*)
+        (declare (ignore last-pos))
+        (when (or (not (eql i pos)) (not (eql stored value)))
+          (format t "~&Error: btree value ~D at pos ~D: found ~D at pos ~D [count ~D].~%"
+                  stored i value pos count)
+          (return nil))))))
+
+(deftest :btree.1
+    (dotimes (i 1000 t)
+      (test-btree-vector i))
+  t)
+
+(defun time-btree (&optional (fn #'sorted-vector-find) (return-on-error nil))
+  (time
+   (let ((total-count 0))
+     (declare (fixnum total-count))
+     (dotimes (i (length *btree-vector*) t)
+       (let ((stored (aref *btree-vector* i)))
+         (multiple-value-bind (value pos count)
+             (funcall fn stored *btree-vector*)
+           (incf total-count count)
+           (when (or (/= i pos) (/= stored value))
+             (format t "~&Error: btree value ~D at pos ~D: found ~D at pos ~D [count ~D].~%"
+                     stored i value pos count)
+             (when return-on-error
+               (return-from time-btree nil))))))
+     (float (/ total-count (length *btree-vector*))))))
+
+;;; MOP Testing
 
 ;; Disable attrib class until understand changes in sbcl/cmucl
 ;; using COMPUTE-SLOT-ACCESSOR-INFO and defining method
 
 ;; Disable attrib class until understand changes in sbcl/cmucl
 ;; using COMPUTE-SLOT-ACCESSOR-INFO and defining method
index ecd8565f3114cb455f38963db9d934ec0133ef73..d22e7b98fcfe49b2612ca4a8551f92a4653080d7 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
index 860d6750a4e4a7e28686a2c4e2f6419935975558..a3305caa097ce68ed1d2b45df4e9f2acd565e8fe 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software