Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 axiom (20120301-3) unstable; urgency=low
 .
   * Apply upstream patch for 64bit scanToken issue
   * use quilt patches to replace older debian/patches_applied
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- axiom-20120301.orig/lsp/Makefile.pamphlet
+++ axiom-20120301/lsp/Makefile.pamphlet
@@ -1321,13 +1321,7 @@ all:
 
 gcldir: 
 	@echo 2 building ${GCLVERSION}
-	@tar -zxf ${ZIPS}/${GCLVERSION}.tgz
-<<gcl-2.6.8pre4.socket.patch>>
-<<gcl-2.6.8pre4.libspad.patch>>
-<<gcl-2.6.8pre4.toploop.patch>>
-<<gcl-2.6.8pre4.collectfn.fix>>
-<<gcl-2.6.8pre4.read.patch>>
-<<gclConfigureMake>>
+	echo '(compiler::link (list (compile-file "${BOOKS}/tangle.lisp")) "${OUT}/lisp" (format nil "(progn (let ((*load-path* (cons ~S *load-path*))(si::*load-types* ~S)) (compiler::emit-fn t))(when (fboundp (quote si::sgc-on)) (si::sgc-on t))#-native-reloc(setq compiler::*default-system-p* t))" si::*system-directory* (quote (list #+native-reloc".o" ".lsp"))) "${OBJ}/${SYS}/lib/cfuns-c.o ${OBJ}/${SYS}/lib/sockio-c.o ${OBJ}/${SYS}/lib/libspad.a")' | gcl
 	@echo 13 finished system build on `date` | tee >gcldir
 
 ccldir: ${LSP}/ccl/Makefile
--- axiom-20120301.orig/books/bookvol5.pamphlet
+++ axiom-20120301/books/bookvol5.pamphlet
@@ -3791,6 +3791,83 @@ Note that incRgen recursively wraps this
 
 \chapter{The Token Scanner}
 
+\defvar{SPACE}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar SPACE (qenum '"    " 0)))
+
+\end{chunk}
+
+\defvar{ESCAPE}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar ESCAPE (qenum '"_   " 0)))
+
+\end{chunk}
+
+\defvar{STRINGCHAR}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar STRINGCHAR (qenum '"\"   " 0)))
+
+\end{chunk}
+
+\defvar{PLUSCOMMENT}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar PLUSCOMMENT (qenum '"+   " 0)))
+
+\end{chunk}
+
+\defvar{MINUSCOMMENT}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar MINUSCOMMENT (qenum '"-   " 0)))
+
+\end{chunk}
+
+\defvar{RADIXCHAR}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar RADIXCHAR (qenum '"r   " 0)))
+
+\end{chunk}
+
+\defvar{DOT}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar DOT (qenum '".   " 0)))
+
+\end{chunk}
+
+\defvar{EXPONENT1}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar EXPONENT1 (qenum '"E   " 0)))
+
+\end{chunk}
+
+\defvar{EXPONENT2}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar EXPONENT2 (qenum '"e   " 0)))
+
+\end{chunk}
+
+\defvar{CLOSEPAREN}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar CLOSEPAREN   (qenum '")   " 0)))
+
+\end{chunk}
+
+\defvar{QUESTION}
+\begin{chunk}{postvars}
+(eval-when (eval load)
+  (defvar QUESTION (qenum '"?   " 0)))
+
+\end{chunk}
+
 \defvar{scanKeyWords}
 \begin{chunk}{postvars}
 (eval-when (eval load)
@@ -4052,7 +4129,7 @@ returning the token-dq and the rest of t
    ((null n) n)
    (t
     (cond
-     ((char= (char ln 0) #\))
+     ((equal (qenum ln 0) CLOSEPAREN)
       (cond
         ((|incPrefix?| "command" 1 ln) t)
         (t nil)))
@@ -4108,15 +4185,15 @@ returning the token-dq and the rest of t
    (cond
     ((|startsComment?|) (|scanComment|) nil)
     ((|startsNegComment?|) (|scanNegComment|) nil)
-    ((char= ch #\?)
+    ((equal c QUESTION)
       (setq |$n| (+ |$n| 1))
       (|lfid| "?"))
     ((|punctuation?| c) (|scanPunct|))
     ((|startsId?| ch) (|scanWord| nil))
-    ((char= ch #\space) (|scanSpace|) nil)
-    ((char= ch #\") (|scanString|))
+    ((equal c SPACE) (|scanSpace|) nil)
+    ((equal c STRINGCHAR) (|scanString|))
     ((|digit?| ch) (|scanNumber|))
-    ((char= ch #\_) (|scanEscape|))
+    ((equal c ESCAPE) (|scanEscape|))
     (t (|scanError|))))
   (cond
     ((null b) nil)
@@ -4146,11 +4223,11 @@ To pair badge and badgee
   (cond
    ((< |$n| |$sz|)
     (cond
-     ((char= (qenum |$ln| |$n|) #\+)
+     ((equal (qenum |$ln| |$n|) PLUSCOMMENT)
        (setq www (+ |$n| 1))
        (cond
         ((not (< www |$sz|)) nil)
-        (t (char= (qenum |$ln| www) #\+))))
+        (t (equal (qenum |$ln| www) PLUSCOMMENT))))
      (t nil)))
    (t nil))))
 
@@ -4191,11 +4268,11 @@ To pair badge and badgee
   (cond
    ((< |$n| |$sz|)
     (cond
-     ((char= (qenum |$ln| |$n|) #\-)
+     ((equal (qenum |$ln| |$n|) MINUSCOMMENT)
        (setq www (+ |$n| 1))
        (cond
         ((not (< www |$sz|)) nil)
-        (t (char= (qenum |$ln| www) #\-))))
+        (t (equal (qenum |$ln| www) MINUSCOMMENT))))
      (t nil)))
    (t nil))))
 
@@ -4418,7 +4495,7 @@ To pair badge and badgee
       (t
        (setq |$n| (+ |$n| 1)))))))
   (cond
-   ((or (equal |$n| l) (not (char= (qenum |$ln| |$n|) #\_)))
+   ((or (equal |$n| l) (not (equal (qenum |$ln| |$n|) ESCAPE)))
     (cond
       ((and (equal n |$n|) zro) "0")
       (t (substring |$ln| n (- |$n| n)))))
@@ -4507,7 +4584,7 @@ To pair badge and badgee
          nil)
         (t nil)))
      ((equal |$n| n1) t)
-     ((char= (qenum |$ln| n1) #\_)
+     ((equal (qenum |$ln| n1) ESCAPE)
        (setq |$n| (+ n1 1))
        (|scanEsc|)
        nil)
@@ -4582,7 +4659,7 @@ To pair badge and badgee
     (setq n |$n|)
     (setq c (qenum |$ln| |$n|))
     (cond
-     ((or (char= c #\E) (char= c #\e))
+     ((or (equal c EXPONENT1) (equal c EXPONENT2))
       (setq |$n| (+ |$n| 1))
       (cond
        ((not (< |$n| |$sz|))
@@ -4594,7 +4671,7 @@ To pair badge and badgee
        (t
         (setq c1 (qenum |$ln| |$n|))
         (cond
-         ((or (char= c1 #\+) (char= c1 #\-))
+         ((or (equal c1 PLUSCOMMENT) (equal c1 MINUSCOMMENT))
            (setq |$n| (+ |$n| 1))
            (cond
             ((not (< |$n| |$sz|))
@@ -4604,7 +4681,7 @@ To pair badge and badgee
              (setq e (|spleI| #'|digit?|))
              (|lffloat| a w
               (cond
-               ((char= c1 #\-)
+               ((equal c1 MINUSCOMMENT)
                 (concat "-" e))
                (t e))))
             (t
@@ -4649,7 +4726,7 @@ To pair badge and badgee
   (setq l |$sz|)
   (setq endid (|posend| |$ln| |$n|))
   (cond
-   ((or (equal endid l) (not (char= (qenum |$ln| endid) #\_)))
+   ((or (equal endid l) (not (equal (qenum |$ln| endid) ESCAPE)))
     (setq |$n| endid)
     (list b (substring |$ln| n1 (- endid n1))))
    (t
@@ -4809,13 +4886,13 @@ NOTE: do not replace ``lyne'' with ``lin
   (cond
    ((not (< |$n| |$sz|))
     (|lfinteger| a))
-   ((not (char= (qenum |$ln| |$n|) #\r))
+   ((not (equal (qenum |$ln| |$n|) RADIXCHAR))
     (cond
-     ((and |$floatok| (char= (qenum |$ln| |$n|) #\.))
+     ((and |$floatok| (equal (qenum |$ln| |$n|) DOT))
       (setq n |$n|)
       (setq |$n| (+ |$n| 1))
       (cond
-       ((and (< |$n| |$sz|) (char= (qenum |$ln| |$n|) #\.))
+       ((and (< |$n| |$sz|) (equal (qenum |$ln| |$n|) DOT))
         (setq |$n| n)
         (|lfinteger| a))
        (t
@@ -4829,11 +4906,11 @@ NOTE: do not replace ``lyne'' with ``lin
     (cond
      ((not (< |$n| |$sz|))
       (|lfrinteger| a w))
-      ((char= (qenum |$ln| |$n|) #\.)
+      ((equal (qenum |$ln| |$n|) DOT)
        (setq n |$n|)
        (setq |$n| (+ |$n| 1))
        (cond
-        ((and (< |$n| |$sz|) (char= (qenum |$ln| |$n|) #\.))
+        ((and (< |$n| |$sz|) (equal (qenum |$ln| |$n|) DOT))
          (setq |$n| n)
          (|lfrinteger| a w))
         (t 
@@ -23321,7 +23398,7 @@ The last line of output is a summary:
    (setq outfile (concatenate 'string (subseq namestring 0) "." extension)))
   (if (probe-file outfile)
    (regress outfile)
-   (format t (concatenate 'string outfile ~%" file not found")))))
+   (format t (concatenate 'string outfile "~% file not found")))))
 
 \end{chunk}
 
@@ -31034,8 +31111,8 @@ matrix.input. The ``.input.pamphlet'' is
 
 \begin{chunk}{defun tangle}
 (defun |tangle| (arg)
- (let (|$InteractiveMode| fullopt namestring dot1 dot2 outfile 
-      (chunkname "*") (extension "input"))      
+ (let (|$InteractiveMode| namestring dot1 dot2 outfile 
+       (chunkname "*") (extension "input"))      
  (declare (special |$InteractiveMode| |$options|))
   (setq |$InteractiveMode| t)
   (setq namestring (symbol-name (car arg)))
--- axiom-20120301.orig/src/interp/Makefile.pamphlet
+++ axiom-20120301/src/interp/Makefile.pamphlet
@@ -395,15 +395,40 @@ the ``.fn'' files which are used to opti
 
 \subsection{save depsys image}
 Once the appropriate commands are in the [[${OUT}/makedep.lisp]] file
-we can load the file into a fresh image and save it. At least that's
+we can load the file into a fresh image and save it. At least that is
 how it used to work. In freebsd we cannot do this so we have to use
 a much more complicated procedure.
 This code used to read:
 \begin{verbatim}
 <<save depsys image>>=
 	@ (cd ${MNT}/${SYS}/bin ; \
-	   echo '(progn (load "${OUT}/makedep.lisp")' \
-                '(spad-save "${DEPSYS}"))' | ${LISPSYS})
+	   echo '#+native-reloc(progn\
+		    (load "${OUT}/makedep.lisp")\
+		    (spad-save "${DEPSYS}"))\
+		 #-native-reloc(progn\
+		    (setq si::*collect-binary-modules* t)\
+		    (load "${OUT}/makedep.lisp")\
+		    (compiler::link\
+			(remove-duplicates si::*binary-modules* :test (quote equal))\
+			"$(DEPSYS)"\
+			(format nil "\
+				(setq si::*collect-binary-modules* t)\
+				(let ((si::*load-path* (cons ~S si::*load-path*))\
+	                              (si::*load-types* ~S))\
+				  (compiler::emit-fn t))\
+				  (load \"$(OUT)/makedep.lisp\")\
+				  (gbc t)\
+				  (when si::*binary-modules*\
+					(error (apply (quote concatenate) (quote string)\
+					 \"Binary module load error: \" si::*binary-modules*)))\
+				  (setq si::collect-binary-modules* nil si::*binary-modules* nil)\
+				  (gbc t)\
+				  ;(fmakunbound (quote si::sgc-on))\
+				  (when (fboundp (quote si::sgc-on)) (si::sgc-on t))\
+				  (setq compiler::*default-system-p* t)"\
+				si::*system-directory* (quote (list ".lsp")))\
+				""\
+				nil))' | sed 's,\\$$,,g' | ${LISPSYS})
 @
 \end{verbatim}
 
@@ -667,7 +692,7 @@ ${SAVESYS}:	${DEPSYS} ${OBJS} ${OUT}/boo
 #	@ cp -p ${SRC}/doc/msgs/co-eng.msgs ${SPAD}/doc/msgs
 	@ echo '${PROCLAIMS}' > ${OUT}/makeint.lisp
 	@ echo '(load "${OUT}/nocompil")' >> ${OUT}/makeint.lisp
-	@ echo '(load "${OUT}/bookvol5")' >> ${OUT}/makeint.lisp
+	@ echo '(load "${OUT}/bookvol5.lsp")' >> ${OUT}/makeint.lisp
 	@ echo '(load "${OUT}/util")' >> ${OUT}/makeint.lisp
 	@ echo '(in-package "BOOT")' >> ${OUT}/makeint.lisp
 	@ touch ${TIMESTAMP}
@@ -695,11 +720,34 @@ ${SAVESYS}:	${DEPSYS} ${OBJS} ${OUT}/boo
 	@ echo '#+:akcl (setq compiler::*suppress-compiler-notes* t)' \
                 >> ${OUT}/makeint.lisp
 	@ echo '#+:akcl (si::gbc-time 0)' >> ${OUT}/makeint.lisp
-	@ echo '#+:akcl (setq si::*system-directory* "${SPAD}/bin/")' \
-               >> ${OUT}/makeint.lisp
-	@ (cd ${OBJ}/${SYS}/bin ; \
-	  echo '(progn (gbc t) (load "${OUT}/makeint.lisp")' \
-                 '(gbc t) (user::spad-save "${SAVESYS}"))' | ${LISPSYS} )
+	@ (cd ${OBJ}/${SYS}/bin ;\
+	   echo '#+native-reloc(progn \
+		      (load "${OUT}/makeint.lisp")\
+		      (gbc t)\
+		      (user::spad-save "${SAVESYS}"))\
+	        #-native-reloc(progn\
+		      (setq si::*collect-binary-modules* t)\
+		      (load "${OUT}/makeint.lisp")\
+		      (compiler::link\
+			(remove-duplicates si::*binary-modules* :test (quote equal))\
+			"$(SAVESYS)"\
+			(format nil "\
+				(let ((si::*load-path* (cons ~S si::*load-path*))\
+                                      (si::*load-types* ~S))\
+				 (compiler::emit-fn t))\
+				 (setq si::*collect-binary-modules* t)\
+				 (load \"$(OUT)/makeint.lisp\")\
+				 (when si::*binary-modules*\
+					(error (apply (quote concatenate) (quote string)\
+					 \"Binary module load error: \" si::*binary-modules*)))\
+				 (setq si::collect-binary-modules* nil si::*binary-modules* nil)\
+				 (gbc t)\
+				 ;(fmakunbound (quote si::sgc-on))\
+				 (when (fboundp (quote si::sgc-on)) (si::sgc-on t))\
+				 (setq compiler::*default-system-p* t boot::|$$SpadServer| nil boot::$$openServerIfTrue t)"\
+			        si::*system-directory* (quote (list ".lsp")))\
+		        "$(OBJ)/$(SYS)/lib/sockio-c.o $(OBJ)/$(SYS)/lib/cfuns-c.o $(OBJ)/$(SYS)/lib/libspad.a"\
+		        nil))' | sed 's,\\$$,,g' | $(LISPSYS))
 	@ echo 6 ${SAVESYS} created
 	@ cp ${SAVESYS} ${AXIOMSYS}
 	@ echo 6a ${AXIOMSYS} created
--- axiom-20120301.orig/src/lib/pixmap.c.pamphlet
+++ axiom-20120301/src/lib/pixmap.c.pamphlet
@@ -81,7 +81,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 /* returns true if the file exists */
 
 int
-file_exists(char *file)
+ax_file_exists(char *file)
 {
     FILE *f;
 
@@ -96,10 +96,10 @@ file_exists(char *file)
 {
     char com[512], zfile[512];
 
-    if (file_exists(file))
+    if (ax_file_exists(file))
         return fopen(file, mode);
     sprintf(zfile, "%s.Z", file);
-    if (file_exists(zfile)) {
+    if (ax_file_exists(zfile)) {
         sprintf(com, "gunzip -c %s.Z 2>/dev/null", file);
         return popen(com, mode);
     }
--- axiom-20120301.orig/src/input/monitortest.input.pamphlet
+++ axiom-20120301/src/input/monitortest.input.pamphlet
@@ -354,10 +354,11 @@ Check that monitoring is not occurring
 --RValue = (NIL NIL NIL NIL)
 --E 26
 
+\begin{chunk}{*}
 )spool 
 )lisp (bye)
  
-\end{chunk}
+\end{chunk}{*}
 \eject
 \begin{thebibliography}{99}
 \bibitem{1} nothing
--- axiom-20120301.orig/src/etc/Makefile.pamphlet
+++ axiom-20120301/src/etc/Makefile.pamphlet
@@ -24,7 +24,7 @@ ${MNT}/${SYS}/algebra/*.daase: ${INT}/al
 	@ cp ${SRC}/doc/topics.data ${INT}/algebra
 	@ cp ${SRC}/doc/topics.data ${INT}/algebra
 	@ (cd ${INT}/algebra ; \
-           echo ')lisp (make-databases "" nil)' | ${INTERPSYS} )
+           echo ')lisp #+native-reloc(make-databases "" nil) #-native-reloc(system "cp -pr ${SRC}/../debian/*.daase ${INT}/algebra/")' | ${INTERPSYS} )
 	@ cp -pr ${INT}/algebra/*.daase ${MNT}/${SYS}/algebra
 
 @
--- axiom-20120301.orig/src/algebra/Makefile.pamphlet
+++ axiom-20120301/src/algebra/Makefile.pamphlet
@@ -17251,7 +17251,7 @@ ${MID}/%.o: ${MID}/%.lsp
 	  else \
 	   echo '(progn (in-package (quote boot)) (compile-file "$*.lsp" :output-file "$*.o"))' | ${DEPSYS} >${TMP}/trace ; \
 	  fi )
-	@ cp ${MID}/$*.o ${OUT}/$*.o
+	@ mkdir -p $$(dirname $(OUT)/$*.o) && cp ${MID}/$*.o ${OUT}/$*.o
 
 @
 <<genericSPADfiles>>=
