From: Taylor R. Campbell Date: Sun, 21 Jan 2007 22:19:06 +0000 (+0000) Subject: Hack STRINGIFY to support lap comments, in case the user set X-Git-Tag: 20090517-FFI~757 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d75b6e3c9cf0e681a90b31b33ed5a52865237cf7;p=mit-scheme.git Hack STRINGIFY to support lap comments, in case the user set COMPILER:GENERATE-LAP-FILES? and COMPILER:INTERSPERSE-RTL-IN-LAP?, so that it puts comments in the C output instead of signalling an obscure error, even though the resulting *.lap files are not very useful. --- diff --git a/v7/src/compiler/machines/C/cout.scm b/v7/src/compiler/machines/C/cout.scm index 66548e469..f5947ac6c 100644 --- a/v7/src/compiler/machines/C/cout.scm +++ b/v7/src/compiler/machines/C/cout.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: cout.scm,v 1.33 2007/01/05 21:19:20 cph Exp $ +$Id: cout.scm,v 1.34 2007/01/21 22:19:06 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -307,7 +307,7 @@ USA. (c:case #f (c:scall "UNCACHE_VARIABLES") (c:return (c:pc-reg)))) - (c:group* lap-code) + (c:group* (map maybe-lap-comment lap-code)) extra-code))) (if top-level? (c:group @@ -330,6 +330,20 @@ USA. (c:group (c:line) (c:data-section data-generator))))))) proxy)))) + +(define (maybe-lap-comment instruction) + (if (lap-comment? instruction) + (c:line (c:comment (write-to-string (lap-comment-text instruction)))) + instruction)) + +(define (lap-comment? object) + (and (pair? object) + (eq? 'COMMENT (car object)) + (pair? (cdr object)) + (null? (cddr object)))) + +(define (lap-comment-text comment) + (cadr comment)) (define (make-data-generator top-level? ntags