Changeset 8269 in project


Ignore:
Timestamp:
02/07/08 15:27:29 (12 years ago)
Author:
graham
Message:

changed hart printing, no longer flushes on every print action.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/hart/trunk/hart-support.scm

    r8227 r8269  
    22
    33(declare (export hart-parse hart-html-escape
    4                  hart-vector-for-each*))
     4                 hart-vector-for-each* hart-print))
    55
    66;; todo: general optimizations; extensible keyword syntax.
     
    2020(define (print-for-strings lst #!optional (acc '()))
    2121  ;; Given an emitted list, for each string-literal S in the list,
    22   ;; replace it with (print* S).
     22  ;; replace it with (hart-print S).
    2323  (cond ((null? lst) (reverse acc))
    2424        ((string? (car lst))
    2525         (print-for-strings (cdr lst)
    26                             (cons (list 'print* (car lst))
     26                            (cons (list 'hart-print (car lst))
    2727                                  acc)))
    2828        (#t (print-for-strings (cdr lst)
    2929                               (cons (car lst) acc)))))
     30
     31(define (hart-print . args)
     32  (for-each (lambda (a) (write-string (->string a))) args))
    3033
    3134;;; the parser
     
    8689                    ,(hart-parse (third body)))))
    8790        ((raw:)         
    88          (hart-emit `(print* ,@body)))
     91         (hart-emit `(hart-print ,@body)))
    8992        ((t: text:)         
    90          (hart-emit `(apply print* (map hart-html-escape
     93         (hart-emit `(apply hart-print (map hart-html-escape
    9194                                   (list ,@body)))))
    9295        ((fmt:)         
    93          (hart-emit `(print* (hart-html-escape (format ,@body)))))
     96         (hart-emit `(hart-print (hart-html-escape (format ,@body)))))
    9497        ((for:)
    9598         (match-let (((kwd (iter lst) . body) form))
     
    118121                                   `(let ((,val ,value))
    119122                                     (when ,val
    120                                        (print* ,(format " ~a=\"" key)
     123                                       (hart-print ,(format " ~a=\"" key)
    121124                                               (hart-html-escape ,val)
    122125                                               "\"")))))))
Note: See TracChangeset for help on using the changeset viewer.