Changeset 2594

Show
Ignore:
Timestamp:
02/22/08 13:39:15 (9 months ago)
Author:
hans
Message:

Indices tutorial and documentation updates.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bknr/datastore/doc/Makefile

    r969 r2594  
     1PBOOK=../../tools/pbook.py 
     2 
    13all: manual.pdf 
    24 
    35manual.pdf: manual.tex introduction.tex guidedtour.tex indices2.tex datastore2.tex impex2.tex  
    46        pdflatex manual && pdflatex manual 
    5         cp manual.pdf /home/manuel/public_html
     7        cp manual.pdf ../../../projects/bknr-website/pdf
    68 
    79indices2.tex: ../src/indices/tutorial.lisp 
    8         /usr/local/bin/pbook.py -c BknrTexFile -t "BKNR Indices" -o indices2.tex ../src/indices/tutorial.lisp 
     10        $(PBOOK) -c BknrTexFile -t "BKNR Indices" -o indices2.tex ../src/indices/tutorial.lisp 
    911 
    1012datastore2.tex: ../src/data/tutorial.lisp 
    11         /usr/local/bin/pbook.py -c BknrTexFile -t "BKNR Datastore" -o datastore2.tex ../src/data/tutorial.lisp 
     13        $(PBOOK) -c BknrTexFile -t "BKNR Datastore" -o datastore2.tex ../src/data/tutorial.lisp 
    1214 
    1315impex2.tex: ../src/xml-impex/tutorial.lisp 
    14         /usr/local/bin/pbook.py -c BknrTexFile -t "BKNR XML Import/Export" -o impex2.tex ../src/xml-impex/tutorial.lisp 
     16        $(PBOOK) -c BknrTexFile -t "BKNR XML Import/Export" -o impex2.tex ../src/xml-impex/tutorial.lisp 
    1517 
    1618clean: 
  • trunk/bknr/datastore/doc/indices.tex

    r999 r2594  
    449449\begin{Verbatim}[fontsize=\small,frame=leftline,framerule=0.9mm,rulecolor=\color{gray},framesep=5.1mm,xleftmargin=5mm,fontfamily=cmtt] 
    450450(defvar *class-index* 
    451   (index-create 'class-index :index-subclasses t)) 
     451  (index-create 'class-index :index-subclasses t :slot-name 'id)) 
     452(defvar *object-id* 0) 
    452453 
    453454(defclass base-object () 
    454   (
     455  ((id :initform (incf *object-id*))
    455456  (:metaclass indexed-class) 
    456457  (:class-indices (class :index *class-index* 
    457           :slots nil 
    458458          :index-reader objects-of-class 
    459459          :index-values all-objects 
     
    462462        (classes :index-type class-index 
    463463            :index-initargs (:index-superclasses t) 
    464             :slots nil 
     464            :slots (id) 
    465465            :index-subclasses t 
    466466            :index-reader objects-with-class))) 
  • trunk/bknr/datastore/src/indices/tutorial.lisp

    r2584 r2594  
    118118;;; 
    119119;;; Using the `INDEXED-CLASS', we can redefine our gorilla example. 
     120 
     121;;; Before we are able to refine GORILLA with a new metaclass, we need 
     122;;; to delete the old class definition: 
     123 
     124(setf (find-class 'gorilla) nil) 
    120125 
    121126(defclass gorilla () 
     
    130135                :index-reader gorillas-with-description)) 
    131136  (:metaclass indexed-class)) 
     137 
     138(defmethod print-object ((gorilla gorilla) stream) 
     139  (print-unreadable-object (gorilla stream :type t) 
     140    (format stream "~S" (gorilla-name gorilla)))) 
    132141 
    133142;;; We have to recreate the gorillas though, as the old instances 
     
    419428; => #<TEST-CLASS2 5,5,0> 
    420429 
     430#| 
     431 
     432;;; XXX the class index tutorial needs updating, please skip to next section! 
     433 
    421434;;; Another example of a class index is the `CLASS-INDEX' index. 
    422435 
     
    475488; => NIL 
    476489; NIL 
     490|# 
    477491 
    478492;;;## Destroying objects 
     
    485499 
    486500(let ((obj (test-with-coords '(5 5 0)))) 
    487                 (destroy-object obj)
     501  (destroy-object obj
    488502 
    489503;;; This will throw an error. 
    490504;;; 
    491505 
    492 (test-class-x obj
     506  (test-class-x obj)
    493507 
    494508;;;## Class and object reinitialization