Changeset 36 in CGBLisp


Ignore:
Timestamp:
Feb 1, 2009, 11:01:15 AM (15 years ago)
Author:
Marek Rychlik
Message:

Changed order of functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/infix-printer.lisp

    r35 r36  
    1515
    1616(in-package "INFIX-PRINTER")
     17
     18
     19
     20(defun infix-print-separated-list (lst sep stream op print-level
     21                                   &optional (alt-op nil) (alt-sep alt-op)
     22                                   &aux
     23                                   (beg t)
     24                                   (count 0)
     25                                   true-sep)
     26  (cond
     27   ((endp lst) nil)
     28   ((and (numberp *print-level*) (> print-level *print-level*))
     29    (format stream "#"))
     30   (t
     31    (dolist (arg lst)
     32      (setf true-sep sep)
     33      (incf count)
     34      (when (and alt-op (> count 1) (consp arg) (eq alt-op (car arg)))
     35          (setf arg (cadr arg)
     36                true-sep alt-sep))
     37      (if beg
     38          (setf beg nil)
     39        (format stream "~a" true-sep))
     40      (when (and (numberp *print-length*) (> count *print-length*))
     41        (format stream "..." true-sep)
     42        (return-from infix-print-separated-list))
     43      (infix-print arg stream op print-level)))))
     44
    1745
    1846(defun infix-print (expr &optional (stream t) (op nil) (print-level 0))
     
    6997         (infix-print-separated-list (cdr expr) '\, stream '\, (1+ print-level))
    7098         (format stream ")"))))))))
    71 
    72 (defun infix-print-separated-list (lst sep stream op print-level
    73                                    &optional (alt-op nil) (alt-sep alt-op)
    74                                    &aux
    75                                    (beg t)
    76                                    (count 0)
    77                                    true-sep)
    78   (cond
    79    ((endp lst) nil)
    80    ((and (numberp *print-level*) (> print-level *print-level*))
    81     (format stream "#"))
    82    (t
    83     (dolist (arg lst)
    84       (setf true-sep sep)
    85       (incf count)
    86       (when (and alt-op (> count 1) (consp arg) (eq alt-op (car arg)))
    87           (setf arg (cadr arg)
    88                 true-sep alt-sep))
    89       (if beg
    90           (setf beg nil)
    91         (format stream "~a" true-sep))
    92       (when (and (numberp *print-length*) (> count *print-length*))
    93         (format stream "..." true-sep)
    94         (return-from infix-print-separated-list))
    95       (infix-print arg stream op print-level)))))
    96 
    97 
Note: See TracChangeset for help on using the changeset viewer.