\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/interp debugsys.lisp}
\author{Timothy Daly}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{An explanation}

This file is basically the same as the one created during the build of
interpsys. See the echo lines in the {\bf SAVESYS} block in the
Makefile.pamphlet file. These are echoed into a temporary file which
gets loaded into the lisp image to create interpsys.  We simply
captured that temporary file, replaced the .o files with .lisp files
(or .lsp or .clisp) and saved it here.

This is a file that can be loaded into a raw lisp image to create a
running interpreter. Note that almost all of the files are loaded as
lisp code. cfuns and sockio are exceptions because they depend on the
loader to link to externs in the lisp image which cannot be done in
interpreted code. 

We assume that debugsys is being built after interpsys has been built
as the only use for a debugsys image is to debug a deep system
problem in interpsys. Thus we can assume that all of these files
exist. Note that these files are {\bf hard coded} to assume they
live under {\bf /home/axiomgnu/new}. You need to do a global
search and replace if you don't place them there. We should write
lisp code to grab the {\bf AXIOM} shell variable but since (a)
there is hardly any reason to use this level of debugging and (b)
if you're screwing around here you've got much harder problems
to solve so this is not an issue.

For debugging purposes you can add anything to this file
and it will show up in the debugsys image. 

Note that the nag files have been removed as there is a bug
in the handling of their autoload code.
\section{Non-portable code}
\subsection{GCL only code}
\subsubsection{use-fast-links}
The use-fast-links function is a speed optimization on function
calls. It basically assumes that the call has been properly
constructed so the compiler can skip argument checks. 
<<use-fast-links>>=
#+:gcl (si::use-fast-links nil)
@ 
\section{The debugsys.lisp code}
<<*>>=
<<use-fast-links>>
(unless (system:getenv "AXIOM") 
 (format t "The AXIOM shell variable must be set~%")
 (format t "The likely value is axiom/mnt/linux~%"))
(unless (system:getenv "SYS")   
 (format t "The SYS shell variable must be set~%") 
 (format t "The likely value is linux~%"))
(unless (system:getenv "DAASE")
 (format t "The DAASE shell variable must be set~%")
 (format t "The likely value is axiom/mnt/linux~%"))
(trace load)
#+:GCL
(defun thepath (file) 
  (concatenate 'string (system:getenv "AXIOM") "/../.." file))
(load "sys-pkg.lisp")
(load "nocompil.lisp")
(load "bookvol5.lisp")
(load "util.lisp")
(in-package "BOOT")
(setq *sys* (system:getenv "SYS"))
#+:GCL
(defun thesymb (file) (intern
  (concatenate 'string (system:getenv "AXIOM") "/../.." file)))
(progn (setq timestamp (user::thepath "/src/timestamp")) (yearweek))
@
The [[*build-version*]] variable is only introduced into the system
from the Makefile. Since this isn't going thru the Makefile when
loaded by hand we need to establish a value.
<<*>>=
(setq *build-version* "debug")
(build-interpsys 
 (append 
   (list 
      "vmlisp.lisp"
      "hash.lisp"
      "bootfuns.lisp"
      "macros.lisp"
      "unlisp.lisp"
      "setq.lisp"
      "astr.clisp"
      "bits.lisp"
      "alql.clisp"
      (thesymb "/int/interp/buildom.clisp")
      (thesymb "/int/interp/cattable.clisp")
      "cformat.clisp"
      (thesymb (concatenate 'string "/obj/" *sys* "/interp/cfuns.o"))
      (thesymb "/int/interp/clam.clisp")
      (thesymb "/int/interp/clammed.clisp")
      "comp.lisp"
      (thesymb "/int/interp/compat.clisp")
      (thesymb "/int/interp/compress.clisp")
      "cparse.clisp"
      "cstream.clisp"
      (thesymb "/int/interp/database.clisp")
      "debug.lisp"
      "dq.clisp"
      "fname.lisp"
      (thesymb "/int/interp/format.clisp")
      (thesymb "/int/interp/g-boot.clisp")
      (thesymb "/int/interp/g-cndata.clisp")
      (thesymb "/int/interp/g-error.clisp")
      (thesymb "/int/interp/g-opt.clisp")
      (thesymb "/int/interp/g-timer.clisp")
      (thesymb "/int/interp/g-util.clisp")
      "ggreater.lisp"
      (thesymb "/int/interp/hypertex.clisp")
      (thesymb "/int/interp/i-analy.clisp")
      (thesymb "/int/interp/i-code.clisp")
      (thesymb "/int/interp/i-coerce.clisp")
      (thesymb "/int/interp/i-coerfn.clisp")
      (thesymb "/int/interp/i-eval.clisp")
      (thesymb "/int/interp/i-funsel.clisp")
      (thesymb "/int/interp/i-intern.clisp")
      (thesymb "/int/interp/i-map.clisp")
      (thesymb "/int/interp/i-output.clisp")
      (thesymb "/int/interp/i-resolv.clisp")
      (thesymb "/int/interp/i-spec1.clisp")
      (thesymb "/int/interp/i-spec2.clisp")
      (thesymb "/int/interp/i-syscmd.clisp")
      (thesymb "/int/interp/i-toplev.clisp")
      (thesymb "/int/interp/i-util.clisp")
      "incl.clisp"
      "int-top.clisp"
      "intfile.clisp"
      (thesymb "/int/interp/lisplib.clisp")
      "macex.clisp"
      (thesymb "/int/interp/match.clisp")
      "monitor.lisp"
      "msg.clisp"
      (thesymb "/int/interp/msgdb.clisp")
      "nci.lisp"
      "newaux.lisp"
      (thesymb "/int/interp/newfort.clisp")
      "nlib.lisp"
      (thesymb "/int/interp/nrunfast.clisp")
      (thesymb "/int/interp/nrungo.clisp")
      (thesymb "/int/interp/nrunopt.clisp")
      (thesymb "/int/interp/nruntime.clisp")
      "osyscmd.clisp"
      "packtran.clisp"
      (thesymb "/int/interp/pathname.clisp")
      "pf2sex.clisp"
      "pile.clisp"
      "posit.clisp"
      "property.lisp"
      "ptrees.clisp"
      "ptrop.clisp"
      (thesymb "/int/interp/record.clisp")
      (thesymb "/int/interp/rulesets.clisp")
      "scan.clisp"
      "serror.clisp"
      (thesymb "/int/interp/server.clisp")
      (thesymb "/int/interp/setvars.clisp")
      "sfsfun-l.lisp"
      "sfsfun.clisp"
      (thesymb "/int/interp/simpbool.clisp")
      (thesymb "/int/interp/slam.clisp")
      (thesymb (concatenate 'string "/obj/" *sys* "/interp/sockio.o"))
      "spad.lisp"
      "spaderror.lisp"
      (thesymb "/int/interp/template.clisp")
      (thesymb "/int/interp/termrw.clisp")
      (thesymb "/int/interp/trace.clisp")
      "union.lisp"
      "daase.lisp"
      (thesymb "/int/interp/fortcall.clisp"))
  (list
    (thesymb "/int/interp/hashcode.clisp")
    (thesymb "/int/interp/as.clisp")
    "foam_l.lisp"
    "axext_l.lisp")
  (list
    "varini.clisp"
    "parini.clisp"
    (thesymb "/int/interp/setvart.clisp")
    "intint.lisp"
    (thesymb "/int/interp/xrun.clisp")
    (thesymb "/int/interp/interop.clisp")
    "patches.lisp"))
  (list
    "bootlex.lisp"
    "def.lisp"
    "fnewmeta.lisp"
    "metalex.lisp"
    "metameta.lisp"
    "parsing.lisp"
    "parse.clisp"
    "postpar.clisp"
    "postprop.lisp"
    "preparse.lisp")
  (list
    (thesymb "/int/interp/apply.clisp")
    (thesymb "/int/interp/c-doc.clisp")
    (thesymb "/int/interp/c-util.clisp")
    (thesymb "/int/interp/profile.clisp")
    (thesymb "/int/interp/category.clisp")
    (thesymb "/int/interp/compiler.clisp")
    (thesymb "/int/interp/define.clisp")
    (thesymb "/int/interp/functor.clisp")
    (thesymb "/int/interp/info.clisp")
    (thesymb "/int/interp/iterator.clisp")
    (thesymb "/int/interp/modemap.clisp")
    (thesymb "/int/interp/nruncomp.clisp")
    (thesymb "/int/interp/package.clisp")
    (thesymb "/int/interp/htcheck.clisp")
    (thesymb "/int/interp/xruncomp.clisp"))
  (list
    (thesymb "/int/interp/bc-matrix.clisp")
    (thesymb "/int/interp/bc-misc.clisp")
    (thesymb "/int/interp/bc-solve.clisp")
    (thesymb "/int/interp/bc-util.clisp")
    (thesymb "/int/interp/ht-util.clisp")
    (thesymb "/int/interp/htsetvar.clisp")
    (thesymb "/int/interp/ht-root.clisp")
    (thesymb "/int/interp/br-con.clisp")
    (thesymb "/int/interp/br-data.clisp")
    "showimp.clisp"
    (thesymb "/int/interp/br-op1.clisp")
    (thesymb "/int/interp/br-op2.clisp")
    (thesymb "/int/interp/br-search.clisp")
    (thesymb "/int/interp/br-util.clisp")
    (thesymb "/int/interp/topics.clisp")
    (thesymb "/int/interp/br-prof.clisp")
    (thesymb "/int/interp/br-saturn.clisp"))
  (list
    (thesymb "/int/interp/wi1.clisp")
    (thesymb "/int/interp/wi2.clisp")
    (thesymb "/int/interp/pspad1.clisp")
    (thesymb "/int/interp/pspad2.clisp")
    (thesymb "/int/interp/mark.clisp")
    "nspadaux.lisp"
    "def.lisp")
  (quote 
   ())
  (list 
   (thesymb "/int/interp/ax.clisp"))
  (system:getenv "AXIOM"))
(in-package "SCRATCHPAD-COMPILER")
(boot::set-restart-hook)
(in-package "BOOT")
(load (user::thepath "/int/algebra/warm.data"))
(|clearClams|)
(load "obey.lisp")
;(si::multiply-bignum-stack 10)
(si::gbc-time 0)
(setq si::*system-directory* 
  (user::thepath (concatenate 'string "/mnt/" *sys* "/bin/")))
(gbc t)

@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}