385abae
Description: <short summary of the patch>
385abae
 TODO: Put a short summary on the line above and replace this paragraph
385abae
 with a longer explanation of this change. Complete the meta-information
385abae
 with other relevant fields (see below for details). To make it easier, the
385abae
 information below has been extracted from the changelog. Adjust it or drop
385abae
 it.
385abae
 .
385abae
 gcl (2.6.12-45) unstable; urgency=high
385abae
 .
385abae
   * pathnames1.11
385abae
Author: Camm Maguire <camm@debian.org>
385abae
385abae
---
385abae
The information above should follow the Patch Tagging Guidelines, please
385abae
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
385abae
are templates for supplementary fields that you might want to add:
385abae
385abae
Origin: <vendor|upstream|other>, <url of original patch>
385abae
Bug: <url in upstream bugtracker>
385abae
Bug-Debian: https://bugs.debian.org/<bugnumber>
385abae
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
385abae
Forwarded: <no|not-needed|url proving that it has been forwarded>
385abae
Reviewed-By: <name and email of someone who approved the patch>
385abae
Last-Update: 2016-10-31
385abae
385abae
--- gcl-2.6.12.orig/cmpnew/gcl_lfun_list.lsp
385abae
+++ gcl-2.6.12/cmpnew/gcl_lfun_list.lsp
385abae
@@ -144,7 +144,7 @@
385abae
 (DEFSYSFUN 'SVREF "Lsvref" '(T T) 'T NIL NIL) 
385abae
 (DEFSYSFUN 'APPLY "Lapply" '(T T *) 'T NIL NIL) 
385abae
 (DEFSYSFUN 'DECODE-FLOAT "Ldecode_float" '(T) '(VALUES T T T) NIL NIL) 
385abae
-(DEFSYSFUN 'SUBST-IF-NOT "Lsubst_if_not" '(T T T *) 'T NIL NIL) 
385abae
+;(DEFSYSFUN 'SUBST-IF-NOT "Lsubst_if_not" '(T T T *) 'T NIL NIL)
385abae
 (DEFSYSFUN 'RPLACA "Lrplaca" '(T T) 'T NIL NIL) 
385abae
 (DEFSYSFUN 'SYMBOL-PLIST "Lsymbol_plist" '(T) 'T NIL NIL) 
385abae
 (DEFSYSFUN 'WRITE-STRING "Lwrite_string" '(T *) 'T NIL NIL) 
385abae
@@ -210,7 +210,7 @@
385abae
 (DEFSYSFUN 'NSUBLIS "Lnsublis" '(T T *) 'T NIL NIL) 
385abae
 (DEFSYSFUN 'CHAR-NOT-EQUAL "Lchar_not_equal" '(T *) 'T NIL T) 
385abae
 (DEFSYSFUN 'MACRO-FUNCTION "Lmacro_function" '(T) 'T NIL NIL) 
385abae
-(DEFSYSFUN 'SUBST-IF "Lsubst_if" '(T T T *) 'T NIL NIL) 
385abae
+;(DEFSYSFUN 'SUBST-IF "Lsubst_if" '(T T T *) 'T NIL NIL)
385abae
 (DEFSYSFUN 'COMPLEXP "Lcomplexp" '(T) 'T NIL T) 
385abae
 (DEFSYSFUN 'READ-LINE "Lread_line" '(*) '(VALUES T T) NIL NIL) 
385abae
 (DEFSYSFUN 'MAX "Lmax" '(T *) 'T NIL NIL) 
385abae
@@ -232,7 +232,7 @@
385abae
 (DEFSYSFUN 'FLOAT "Lfloat" '(T *) 'T NIL NIL) 
385abae
 ;(DEFSYSFUN 'FIRST "Lcar" '(T) 'T NIL NIL) 
385abae
 (DEFSYSFUN 'ROUND "Lround" '(T *) '(VALUES T T) NIL NIL) 
385abae
-(DEFSYSFUN 'SUBST "Lsubst" '(T T T *) 'T NIL NIL) 
385abae
+;(DEFSYSFUN 'SUBST "Lsubst" '(T T T *) 'T NIL NIL)
385abae
 (DEFSYSFUN 'UPPER-CASE-P "Lupper_case_p" '(T) 'T NIL T) 
385abae
 (DEFSYSFUN 'ARRAY-ELEMENT-TYPE "Larray_element_type" '(T) 'T NIL NIL) 
385abae
 (DEFSYSFUN 'ADJOIN "Ladjoin" '(T T *) 'T NIL NIL) 
385abae
--- gcl-2.6.12.orig/lsp/gcl_arraylib.lsp
385abae
+++ gcl-2.6.12/lsp/gcl_arraylib.lsp
385abae
@@ -262,8 +262,6 @@
385abae
 			  (static (staticp array))
385abae
                      &aux (fill-pointer (or fill-pointer (when (array-has-fill-pointer-p array) (fill-pointer array)))))
385abae
 
385abae
-  (declare (ignore element-type))
385abae
-
385abae
   (let ((x (if initial-contents-supplied-p
385abae
 	       (make-array new-dimensions
385abae
 		       :adjustable t
385abae
--- gcl-2.6.12.orig/lsp/gcl_iolib.lsp
385abae
+++ gcl-2.6.12/lsp/gcl_iolib.lsp
385abae
@@ -80,7 +80,7 @@
385abae
      0 l)))
385abae
 
385abae
 (defun get-string-input-stream-index (stream &aux (s (c-stream-object0 stream)))
385abae
-  (+ (fill-pointer s) (multiple-value-bind (a b) (array-displacement s) b)))
385abae
+  (+ (fill-pointer s) (multiple-value-bind (a b) (array-displacement s) (declare (ignore a)) b)))
385abae
 
385abae
 (defmacro with-input-from-string ((var string &key index (start 0) end) . body)
385abae
   (declare (optimize (safety 1)))
385abae
@@ -457,10 +457,10 @@
385abae
 		      if-exists iesp if-does-not-exist idnesp external-format)))
385abae
     (when (typep s 'stream) (c-set-stream-object1 s pf) s)))
385abae
 
385abae
-(defun load-pathname-exists (z)
385abae
-  (or (probe-file z)
385abae
-      (when *allow-gzipped-file*
385abae
-	(when (probe-file (string-concatenate (namestring z) ".gz"))
385abae
+(defun load-pathname-exists (z &aux (z (link-expand (namestring z))))
385abae
+  (cond ((eq (stat z) :file) z)
385abae
+	(*allow-gzipped-file*
385abae
+	 (when (eq (stat (string-concatenate (namestring z) ".gz")) :file)
385abae
 	  z))))
385abae
 
385abae
 (defun load-pathname (p print if-does-not-exist external-format
385abae
--- gcl-2.6.12.orig/lsp/gcl_listlib.lsp
385abae
+++ gcl-2.6.12/lsp/gcl_listlib.lsp
385abae
@@ -180,3 +180,34 @@
385abae
 (defmacro nth-value (n expr)
385abae
   (declare (optimize (safety 1)))
385abae
   `(nth ,n (multiple-value-list ,expr)))
385abae
+
385abae
+(eval-when (compile eval)
385abae
+
385abae
+  (defmacro repl-if (tc) `(labels ((l (tr &aux (k (if kf (funcall kf tr) tr)))
385abae
+				       (cond (,tc n)
385abae
+					     ((atom tr) tr)
385abae
+					     ((let* ((ca (car tr))(a (l ca))(cd (cdr tr))(d (l cd)))
385abae
+						(if (and (eq a ca) (eq d cd)) tr (cons a d)))))))
385abae
+			     (declare (ftype (function (t) t) l))
385abae
+			     (l tr))))
385abae
+
385abae
+(defun subst (n o tr &key key test test-not
385abae
+		&aux (kf (when key (coerce key 'function)))
385abae
+		(tf (when test (coerce test 'function)))
385abae
+		(ntf (when test-not (coerce test-not 'function))))
385abae
+  (declare (optimize (safety 1)))
385abae
+  (check-type key (or null function))
385abae
+  (check-type test (or null function))
385abae
+  (check-type test-not (or null function))
385abae
+  (repl-if (cond (tf (funcall tf o k))(ntf (not (funcall ntf o k)))((eql o k)))))
385abae
+
385abae
+(defun subst-if (n p tr &key key &aux (kf (when key (coerce key 'function))))
385abae
+  (declare (optimize (safety 1)))
385abae
+  (check-type p function)
385abae
+  (check-type key (or null function))
385abae
+  (repl-if (funcall p k)))
385abae
+(defun subst-if-not (n p tr &key key &aux (kf (when key (coerce key 'function))))
385abae
+  (declare (optimize (safety 1)))
385abae
+  (check-type p function)
385abae
+  (check-type key (or null function))
385abae
+  (repl-if (not (funcall p k)))))
385abae
--- gcl-2.6.12.orig/lsp/gcl_truename.lsp
385abae
+++ gcl-2.6.12/lsp/gcl_truename.lsp
385abae
@@ -23,7 +23,8 @@
385abae
   (check-type pd pathname-designator)
385abae
   (when (wild-pathname-p ns)
385abae
     (error 'file-error :pathname pd :format-control "Pathname is wild"))
385abae
-  (let* ((ns (ensure-dir-string (link-expand ns)))(ppd (pathname ns)))
385abae
+  (let* ((ns (ensure-dir-string (link-expand ns)))
385abae
+	 (ppd (if (eq (namestring pd) ns) pd (pathname ns))))
385abae
     (unless (or (zerop (length ns)) (stat ns))
385abae
       (error 'file-error :pathname ns :format-control "Pathname does not exist"))
385abae
     (let* ((d (pathname-directory ppd))
385abae
--- gcl-2.6.12.orig/o/list.d
385abae
+++ gcl-2.6.12/o/list.d
385abae
@@ -528,26 +528,26 @@ object x;
385abae
 		vs_check_push(x);
385abae
 }
385abae
 
385abae
-/*
385abae
-	Subst(new, tree) pushes
385abae
-	the result of substituting new in tree
385abae
-	onto vs.
385abae
-*/
385abae
-static void
385abae
-subst(new, tree)
385abae
-object new, tree;
385abae
-{
385abae
-	cs_check(new);
385abae
-
385abae
-	if (TEST(tree))
385abae
-		vs_check_push(new);
385abae
-	else if (type_of(tree) == t_cons) {
385abae
-		subst(new, tree->c.c_car);
385abae
-		subst(new, tree->c.c_cdr);
385abae
-		stack_cons();
385abae
-	} else
385abae
-		vs_check_push(tree);
385abae
-}
385abae
+/* /\* */
385abae
+/* 	Subst(new, tree) pushes */
385abae
+/* 	the result of substituting new in tree */
385abae
+/* 	onto vs. */
385abae
+/* *\/ */
385abae
+/* static void */
385abae
+/* subst(new, tree) */
385abae
+/* object new, tree; */
385abae
+/* { */
385abae
+/* 	cs_check(new); */
385abae
+
385abae
+/* 	if (TEST(tree)) */
385abae
+/* 		vs_check_push(new); */
385abae
+/* 	else if (type_of(tree) == t_cons) { */
385abae
+/* 		subst(new, tree->c.c_car); */
385abae
+/* 		subst(new, tree->c.c_cdr); */
385abae
+/* 		stack_cons(); */
385abae
+/* 	} else */
385abae
+/* 		vs_check_push(tree); */
385abae
+/* } */
385abae
 
385abae
 /* static object */
385abae
 /* subst1(object new, object tree) { */
385abae
@@ -1153,25 +1153,25 @@ LFD(Lrplacd)()
385abae
 	vs_popp;
385abae
 }
385abae
 
385abae
-@(defun subst (new old tree &key test test_not key)
385abae
-	saveTEST;
385abae
-@
385abae
-	protectTEST;
385abae
-	setupTEST(old, test, test_not, key);
385abae
-	subst(new, tree);
385abae
-	tree = vs_pop;
385abae
-        /* if (kf==identity && */
385abae
-	/*     tf==test_eql && */
385abae
-	/*     (is_imm_fixnum(item_compared) || */
385abae
-	/*      ({enum type tp=type_of(item_compared);tp>t_complex || tp
385abae
-	/*   tree=subst1qi(new,tree); */
385abae
-	/* else */
385abae
-	/*   tree=subst1(new,tree); */
385abae
-	restoreTEST;
385abae
-	@(return tree)
385abae
-@)
385abae
+/* @(defun subst (new old tree &key test test_not key) */
385abae
+/* 	saveTEST; */
385abae
+/* @ */
385abae
+/* 	protectTEST; */
385abae
+/* 	setupTEST(old, test, test_not, key); */
385abae
+/* 	subst(new, tree); */
385abae
+/* 	tree = vs_pop; */
385abae
+/*         /\* if (kf==identity && *\/ */
385abae
+/* 	/\*     tf==test_eql && *\/ */
385abae
+/* 	/\*     (is_imm_fixnum(item_compared) || *\/ */
385abae
+/* 	/\*      ({enum type tp=type_of(item_compared);tp>t_complex || tp
385abae
+/* 	/\*   tree=subst1qi(new,tree); *\/ */
385abae
+/* 	/\* else *\/ */
385abae
+/* 	/\*   tree=subst1(new,tree); *\/ */
385abae
+/* 	restoreTEST; */
385abae
+/* 	@(return tree) */
385abae
+/* @) */
385abae
 
385abae
-PREDICATE(Lsubst,Lsubst_if,Lsubst_if_not, 3)
385abae
+/* PREDICATE(Lsubst,Lsubst_if,Lsubst_if_not, 3) */
385abae
 
385abae
 
385abae
 @(defun nsubst (new old tree &key test test_not key)
385abae
@@ -1506,9 +1506,9 @@ gcl_init_list_function()
385abae
 	make_function("LDIFF", Lldiff);
385abae
 	make_function("RPLACA", Lrplaca);
385abae
 	make_function("RPLACD", Lrplacd);
385abae
-	make_function("SUBST", Lsubst);
385abae
-	make_function("SUBST-IF", Lsubst_if);
385abae
-	make_function("SUBST-IF-NOT", Lsubst_if_not);
385abae
+	/* make_function("SUBST", Lsubst); */
385abae
+	/* make_function("SUBST-IF", Lsubst_if); */
385abae
+	/* make_function("SUBST-IF-NOT", Lsubst_if_not); */
385abae
 	make_function("NSUBST", Lnsubst);
385abae
 	make_function("NSUBST-IF", Lnsubst_if);
385abae
 	make_function("NSUBST-IF-NOT", Lnsubst_if_not);