home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume10 / comobj.lisp / part01 / kcl-low.l < prev    next >
Encoding:
Text File  |  1987-07-30  |  2.8 KB  |  83 lines

  1. ;;; -*- Mode: LISP; Syntax: Common-lisp; Package: (PCL Lisp 1000); Base: 10. -*-
  2. ;;;
  3. ;;; *************************************************************************
  4. ;;; Copyright (c) 1985 Xerox Corporation.  All rights reserved.
  5. ;;;
  6. ;;; Use and copying of this software and preparation of derivative works
  7. ;;; based upon this software are permitted.  Any distribution of this
  8. ;;; software or derivative works must comply with all applicable United
  9. ;;; States export control laws.
  10. ;;; 
  11. ;;; This software is made available AS IS, and Xerox Corporation makes no
  12. ;;; warranty about the software, its performance or its conformity to any
  13. ;;; specification.
  14. ;;; 
  15. ;;; Any person obtaining a copy of this software is requested to send their
  16. ;;; name and post office or electronic mail address to:
  17. ;;;   CommonLoops Coordinator
  18. ;;;   Xerox Artifical Intelligence Systems
  19. ;;;   2400 Hanover St.
  20. ;;;   Palo Alto, CA 94303
  21. ;;; (or send Arpanet mail to CommonLoops-Coordinator.pa@Xerox.arpa)
  22. ;;;
  23. ;;; Suggestions, comments and requests for improvements are also welcome.
  24. ;;; *************************************************************************
  25. ;;;
  26. ;;; The version of low for Kyoto Common Lisp (KCL)
  27. (in-package 'pcl)
  28.  
  29.   ;;   
  30. ;;;;;; Load Time Eval
  31.   ;;
  32. ;;; 
  33.  
  34. ;;; This doesn't work because it looks at a global variable to see if it is
  35. ;;; in the compiler rather than looking at the macroexpansion environment.
  36. ;;; 
  37. ;;; The result is that if in the process of compiling a file, we evaluate a
  38. ;;; form that has a call to load-time-eval, we will get faked into thinking
  39. ;;; that we are compiling that form.
  40. ;;;
  41. ;;; THIS NEEDS TO BE DONE RIGHT!!!
  42. ;;; 
  43. ;(defmacro load-time-eval (form)
  44. ;  ;; In KCL there is no compile-to-core case.  For things that we are 
  45. ;  ;; "compiling to core" we just expand the same way as if were are
  46. ;  ;; compiling a file since the form will be evaluated in just a little
  47. ;  ;; bit when gazonk.o is loaded.
  48. ;  (if (and (boundp 'compiler::*compiler-input*)  ;Hack to see of we are
  49. ;       compiler::*compiler-input*)          ;in the compiler!
  50. ;      `'(si:|#,| . ,form)
  51. ;      `(progn ,form)))
  52.  
  53.  
  54.   ;;   
  55. ;;;;;; The %instance datastructure.
  56.   ;;   
  57.  
  58.  
  59.   ;;   
  60. ;;;;;; Generating CACHE numbers
  61.   ;;
  62. ;;; This needs more work to be sure it is going as fast as possible.
  63. ;;;   -  The calls to si:address should be open-coded.
  64. ;;;   -  The logand should be open coded.
  65. ;;;   
  66.  
  67. (defmacro symbol-cache-no (symbol mask)
  68.   (if (and (constantp symbol)
  69.        (constantp mask))
  70.       `(load-time-eval (logand (ash (si:address ,symbol) -2) ,mask))
  71.       `(logand (ash (the fixnum (si:address ,symbol)) -2) ,mask)))
  72.  
  73. (defmacro object-cache-no (object mask)
  74.   `(logand (the fixnum (si:address ,object)) ,mask))
  75.  
  76.   ;;   
  77. ;;;;;; printing-random-thing-internal
  78.   ;;
  79. (defun printing-random-thing-internal (thing stream)
  80.   (format stream "~O" (si:address thing)))
  81.  
  82.  
  83.