IRC channel logs
2013-09-22.log
back to list of logs
<dje42>Is there a way for a smob print routine to know if it is being printed with ~A or ~S ? <dje42>Hmmm. scm_print_state.writingp ? <civodul>dje42: yes, but that's not really part of the public API <dje42>Seems like smob printers could make use of display/write, just like any other object. <civodul>display/write only makes a difference for strings and chars <dje42>I imagine it to be the generalized notion of machine-readable vs human-readable. <dje42>In the end I may abandon it though. For now I'm just playing with it. <civodul>yeah, perhaps that could be useful as a general mechanism <civodul>do you have a particular use case in mind? <dje42>E.g. if I have 42 in a gdb value smob, I could print it as <gdb:value 42> or just 42. <dje42>Plus I was also playing with display invoking a "pretty-printer" for a gdb value or printing the value in gdb "raw" format. <dje42>I'm not sure I *like* the choice. Again, just playing with it. <civodul>seems to me that you could have an accessor for gdb values <civodul>so you would do (display (value-of v)), where v is a gdb-value object <dje42>I currently don't have anything that will return a Scheme value for a gdb value, though I do have the opposite. The former is todo. <dje42>Certainly one way to go though. <civodul>hmm actually converting from gdb-value to Scheme cannot be done in the general case <civodul>like if you have a C struct or something <civodul>i was thinking of the Guile debugging support in GDB, which i had played with <dje42>I remember playing with it ages and ages ago. It's gone now. <civodul>relying on the inferior to do things, etc. <dje42>Yay, my gdb+guile pretty-printer test passes. <dje42>Does Guile have anything like atexit? <dsmith>dje42, It's not in the manual but (apropos "hook") shows it <dsmith>dje42, Though I think that might only be available from the repl <add^_>I wonder if trying out GNU/Hurd would be a good idea. <dsmith>add^_, There are some people in here that mess about with it I think. Can't remember who though... <add^_>Maybe I should use it in a vm first..