<br><br><div class="gmail_quote">On Nov 26, 2007 8:56 PM, Matthew Flatt <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br></div>Well, one more example:<br><div class="Ih2E3d"><br> (define code-test #'(code "DrScheme" "DrScheme"<br> "DrScheme" (break one) (break two) "DrScheme"
<br></div><div class="Ih2E3d"> (break three) "DrScheme"))<br><br> (slide/center<br> (code #,code-test))<br><br></div>This example will format the way you wanted; I changed the `quote' to a
<br>`quote-syntax', and source information is preserved with the syntax<br>object.<br></blockquote><div><br> Thanks! I get your meaning. Many of my sexp are composed in a way like<br><br>(define w-prog1 `(int w-test (,arg1) "{" (,d1 ,d2) ";;" ,w-prog1-s "}"))
<br><br>It's a trial to change all the definitions, but I get the idea now.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br></div>I always just select a range of text in DrScheme and hit Tab to<br>reformat it. If new line breaks are needed to make the layout better, I<br>put them in manually.<br><div><div></div></div></blockquote>
<div><br>You missed my problem. I use scheme to modify scheme code, not manually<br><br>here is the code<br><br>(module subst mzscheme<br> (require (lib "file.ss"))<br> (require (lib "pretty.ss"))<br>
<br> (define (sub before after source target)<br> (let ([v ()])<br> (call-with-input-file source<br> (lambda (iport)<br> (set! v (read iport))))<br> (call-with-output-file target<br> (lambda (oport)
<br> (pretty-print (tsub before after v) oport))<br> 'truncate)))<br> <br> <br> (define (tsub origin after v)<br> (if (list? v)<br> (map (lambda (x)<br> (tsub origin after x)) v)
<br> (if (equal? origin v)<br> after<br> v)))<br>)<br><br>the problem here is when scheme "read iport", the comment is discarded, only essential things are read.<br><br>If I use (read-line port), it's a complexed case analysis on the source file. So ...
<br><br><br></div></div><br clear="all">Gang