From d75b6e3c9cf0e681a90b31b33ed5a52865237cf7 Mon Sep 17 00:00:00 2001 From: "Taylor R. Campbell" Date: Sun, 21 Jan 2007 22:19:06 +0000 Subject: [PATCH] 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. --- v7/src/compiler/machines/C/cout.scm | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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 -- 2.25.1