www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

22.3.3-format.lisp (805B)


      1 (defun my-format (destination control-string &rest arguments)
      2   (let ((current nil)
      3         (pos -1)
      4         (length 0)
      5         (stack '()))
      6     (labels ((get-char () (setq current (char control-string (setq pos (+ pos 1))))))
      7       (tagbody
      8        (setq length (length control-string))
      9        
     10        main
     11        (get-char)
     12        (when (char= current #\~)
     13          (go special))
     14        (push 'main-after-write stack)
     15        (go write)
     16        main-after-write
     17        (setq pos (+ pos 1))
     18        (when (>= pos length)
     19          (go end-of-string))
     20        (go main)
     21 
     22        special
     23        (error "niy")
     24        
     25        write
     26        (write-char current destination)
     27        (go return)
     28        
     29        return
     30        (case stack
     31          (main-after-write (go main-after-write)))
     32        
     33        end-of-string))))