src/: Write `NULL' for a null pointer, rather than plain `0'.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 10 Jan 2016 13:51:04 +0000 (13:51 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 13:40:41 +0000 (14:40 +0100)
This isn't my usual style, but others may like it more.  The output is
controlled by a new variable `*null-pointer*'.  Maybe it will be
configurable later.

doc/SYMBOLS
doc/clang.tex
src/codegen-proto.lisp
src/method-impl.lisp
src/method-proto.lisp

index 5ee51b3..bb6b944 100644 (file)
@@ -326,6 +326,7 @@ codegen-impl.lisp
   temporary-variable                            class
 
 codegen-proto.lisp
+  *null-pointer*                                variable
   *sod-ap*                                      variable
   *sod-master-ap*                               variable
   block-inst                                    class
index f5b16a8..9da2f36 100644 (file)
@@ -859,7 +859,8 @@ Temporary names are represented by objects which implement a simple protocol.
   \begin{tabular}[C]{*2{>{\codeface}l}}                            \hlx*{hv}
     \thd{\textbf{Variable}} & \thd{\textbf{Name format}}        \\ \hlx{vhv}
     {}*sod-ap*                  & sod__ap                       \\
-    {}*sod-master-ap*           & sod__master_ap                \\ \hlx*{vh}
+    {}*sod-master-ap*           & sod__master_ap                \\
+    {}*null-pointer*            & NULL                          \\ \hlx*{vh}
   \end{tabular}
   \caption{Well-known temporary names}
   \label{tab:codegen.codegen.well-known-temps}
index 4bfaeca..c115671 100644 (file)
@@ -67,6 +67,9 @@
 (defparameter *sod-tmp-val*
   (make-instance 'temporary-name :tag "sod__t"))
 
+(export '*null-pointer*)
+(defparameter *null-pointer* "NULL")
+
 ;;;--------------------------------------------------------------------------
 ;;; Instructions.
 
index 8501a02..e4aaae3 100644 (file)
                (sod-class-nickname message-class)
                (sod-message-name message)
                (sod-class-nickname chain-head))
-       0)))
+       *null-pointer*)))
 
 (defmethod method-entry-slot-name ((entry method-entry))
   (let* ((method (method-entry-effective-method entry))
index 069f7e4..36237d6 100644 (file)
                   (make-trampoline codegen (sod-method-class method)
                                    (lambda (target)
                                      (invoke chain target)))
-                  0))
+                  *null-pointer*))
             (invoke (chain target)
               (if (null chain)
                   (funcall kernel target)