Changeset 9527


Ignore:
Timestamp:
May 16, 2008, 2:16:37 AM (11 years ago)
Author:
gb
Message:

Move the istruct definitions to lispequ. Use TYPEP.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711-perf/ccl/lib/pprint.lisp

    r9237 r9527  
    128128  "initial print dispatch table.")
    129129
     130(eval-when (:compile-toplevel :execute)
     131  (declaim (inline xp-structure-p)))
     132
     133(defun xp-structure-p (x)
     134  (istruct-typep x 'xp-structure))
     135
     136
     137(defun entry-p (x)
     138  (istruct-typep x 'entry))
     139
     140 
     141
    130142;default (bad) definitions for the non-portable functions
    131143
     
    170182
    171183(progn
    172 (eval-when (:compile-toplevel :execute)
    173   (def-accessors uvref ; %svref
    174     ()                                  ;'entry
    175     entry-test                          ;predicate function or count of higher priority others.
    176     entry-fn                            ;pprint function
    177     entry-full-spec                     ;list of priority and type specifier
    178     ))
     184
    179185
    180186(defun make-entry (&key test fn full-spec)
     
    371377(progn
    372378  (eval-when (:compile-toplevel :execute)
    373     (def-accessors %svref
    374         ()                              ; 'xp-structure
    375       xp-base-stream;;The stream io eventually goes to.
    376       xp-linel;;The line length to use for formatting.
    377       xp-line-limit;;If non-NIL the max number of lines to print.
    378       xp-line-no;;number of next line to be printed.
    379       xp-char-mode;;NIL :UP :DOWN :CAP0 :CAP1 :CAPW
    380       xp-char-mode-counter              ;depth of nesting of ~(...~)
    381       xp-depth-in-blocks;;Number of logical blocks at QRIGHT that
    382       ;;are started but not ended.             
    383       xp-block-stack
    384       xp-block-stack-ptr
    385       ;;This stack is pushed and popped in accordance with the way blocks are
    386       ;;nested at the moment they are entered into the queue.  It contains the
    387       ;;following block specific value.
    388       ;;SECTION-START total position where the section (see AIM-1102)
    389       ;;that is rightmost in the queue started.
    390       xp-buffer
    391       xp-charpos
    392       xp-buffer-ptr
    393       xp-buffer-offset
    394       ;;This is a vector of characters (eg a string) that builds up the
    395       ;;line images that will be printed out.  BUFFER-PTR is the
    396       ;;buffer position where the next character should be inserted in
    397       ;;the string.  CHARPOS is the output character position of the
    398       ;;first character in the buffer (non-zero only if a partial line
    399       ;;has been output).  BUFFER-OFFSET is used in computing total lengths.
    400       ;;It is changed to reflect all shifting and insertion of prefixes so that
    401       ;;total length computes things as they would be if they were
    402       ;;all on one line.  Positions are kept three different ways
    403       ;; Buffer position (eg BUFFER-PTR)
    404       ;; Line position (eg (+ BUFFER-PTR CHARPOS)).  Indentations are stored in this form.
    405       ;; Total position if all on one line (eg (+ BUFFER-PTR BUFFER-OFFSET))
    406       ;;  Positions are stored in this form.
    407       xp-queue
    408       xp-qleft
    409       xp-qright
    410       ;;This holds a queue of action descriptors.  QLEFT and QRIGHT
    411       ;;point to the next entry to dequeue and the last entry enqueued
    412       ;;respectively.  The queue is empty when
    413       ;;(> QLEFT QRIGHT).  The queue entries have several parts:
    414       ;;QTYPE one of :NEWLINE/:IND/:START-BLOCK/:END-BLOCK
    415       ;;QKIND :LINEAR/:MISER/:FILL/:MANDATORY or :UNCONDITIONAL/:FRESH
    416       ;; or :BLOCK/:CURRENT
    417       ;;QPOS total position corresponding to this entry
    418       ;;QDEPTH depth in blocks of this entry.
    419       ;;QEND offset to entry marking end of section this entry starts. (NIL until known.)
    420       ;; Only :start-block and non-literal :newline entries can start sections.
    421       ;;QOFFSET offset to :END-BLOCK for :START-BLOCK (NIL until known).
    422       ;;QARG for :IND indentation delta
    423       ;;     for :START-BLOCK suffix in the block if any.
    424       ;;                      or if per-line-prefix then cons of suffix and
    425       ;;                      per-line-prefix.
    426       ;;     for :END-BLOCK suffix for the block if any.
    427       xp-prefix
    428       ;;this stores the prefix that should be used at the start of the line
    429       xp-prefix-stack
    430       xp-prefix-stack-ptr
    431       ;;This stack is pushed and popped in accordance with the way blocks
    432       ;;are nested at the moment things are taken off the queue and printed.
    433       ;;It contains the following block specific values.
    434       ;;PREFIX-PTR current length of PREFIX.
    435       ;;SUFFIX-PTR current length of pending suffix
    436       ;;NON-BLANK-PREFIX-PTR current length of non-blank prefix.
    437       ;;INITIAL-PREFIX-PTR prefix-ptr at the start of this block.
    438       ;;SECTION-START-LINE line-no value at last non-literal break at this level.
    439       xp-suffix
    440       ;;this stores the suffixes that have to be printed to close of the current
    441       ;;open blocks.  For convenient in popping, the whole suffix
    442       ;;is stored in reverse order.
    443       xp-stream  ;;; the xp-stream containing this structure
    444       xp-string-stream;; string-stream for output until first circularity (in case none)
    445       )
     379   
    446380    )
    447381
     
    488422    (write-internal-1 (xp-stream xp-struc) object level list-kludge))
    489423
    490   (defmacro xp-structure-p (x)
    491     `(istruct-typep ,x 'xp-structure))
     424
    492425
    493426  (defun get-xp-stream (pp)
Note: See TracChangeset for help on using the changeset viewer.