#:continue (cdr (.continue info)))))
((do-while ,body ,test)
- (let* ((text-length (length text))
-
- (body-info ((ast->info info) body))
- (body-text (list-tail (.text body-info) text-length))
- (body-length (length (object->list body-text)))
-
- (empty (clone info #:text '()))
- (test-jump->info ((test->jump->info empty) test))
- (test+jump-info (test-jump->info 0))
- (test-length (length (object->list (.text test+jump-info))))
-
- (jump-text (wrap-as (i386:Xjump (- (+ body-length test-length)))))
- (jump-length (length (object->list jump-text)))
-
- (test-text (.text (test-jump->info jump-length))))
- (clone info #:text
- (append
- (.text body-info)
- test-text
- jump-text)
- #:globals (.globals body-info))))
+ (let* ((source (with-output-to-string (lambda () (pretty-print-c99 `(do-while ,test (ellipsis))))))
+ (info (append-text info (wrap-as `(#:comment ,source))))
+ (here (number->string (length text)))
+ (loop-label (string-append (.function info) "_loop_" here))
+ (continue-label (string-append (.function info) "_continue_" here))
+ (break-label (string-append (.function info) "_break_" here))
+ (info (clone info #:break (cons break-label (.break info))))
+ (info (clone info #:continue (cons continue-label (.continue info))))
+ (info (append-text info (wrap-as `(#:label ,loop-label))))
+ (info ((ast->info info) body))
+ (info (append-text info (wrap-as `(#:label ,continue-label))))
+ (info ((test-jump-label->info info break-label) test))
+ (info (append-text info (wrap-as (i386:jump-label `(#:local ,loop-label)))))
+ (info (append-text info (wrap-as `(#:label ,break-label)))))
+ (clone info
+ #:locals locals
+ #:break (cdr (.break info))
+ #:continue (cdr (.continue info)))))
((labeled-stmt (ident ,label) ,statement)
(let ((info (append-text info `((#:label ,label)))))