This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Questions about SRFI-38


On 05/11/2011 03:06 PM, Jamison Hope wrote:
Per, a comment near the top of gnu.text.PrettyWriter mentions that it's
based upon SBCL's pprint.lisp; how slight is that connection at this point?
Would reading the analogous Lisp source help Charles to understand what's
going on, or just confuse him more?

I guess it might. I don't remember how well-commented pprint.lisp is -
probably not any better than PrettyWriter.java. It also depends on how fluent
Charles is on reading Lisp as opposed to reading Java.



Also consider the Swing ReplPane console. We'd like to re-do the
line-breaking of *prior* output lines, if the window width is changed.
...
I don't think it would be that much of a change. In fact, I think it
might simplify the algorithm: The first pass has the formatting methods
call methods like startLogicalBlock - which just append formatting tokens
to queueInt. No attempt to do line-breaking during this pass, which
would happen in a completely different section of the code.

Will the output of the first pass be saved somewhere for the entire contents of the ReplDocument, or will the pretty printer just take the document contents as previously displayed (i.e. one huge String), remove all the line breaks, and insert new line breaks appropriate for the new width?

The latter will not do correct pretty-printing - you have to save the first pass output somehow.

In a Swing context it would make sense to combine the "formatting token"
data structure with the Swing View structure.  See the "new ViewFactory"
code in ReplPane.java.  It is used to create custom View objects for
embedded pictures etc. One could add similar custom Views for pretty
printing groups, etc.

The problem is this ties us to Swing, which is rather old and not
super-portable: We want to able to pretty-print when outputting to
a terminal/console, to a webpage, to swt, and so on.

I suppose my real question is: what information is there in the output
of the first pass which is lost by the time s-expressions (or whatever)
are written to the Document?

The logical structure (grouping). Also, the different kinds of spaces and newlines. -- --Per Bothner per@bothner.com http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]