unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andreas Rottmann <a.rottmann@gmx.at>
Subject: RFD: [PATCH] Fixing symbol printing
Date: Tue, 07 Jun 2005 17:30:45 +0200	[thread overview]
Message-ID: <87acm2uqu2.fsf@ivanova.rotty.yi.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

Hi!

I've developed the following patch, which fixes R5RS-compatibility for
printing symbols starting/ending with ':'. The problem with the
current behaviour is that you end-up with files that can not be read
from other Schemes when you write out such symbols:

guile> (write ':foo) (newline)
#{:foo}#
guile>

My patch changes this behaviour to what you'd expect:

guile> (write ':foo) (newline)
:foo
guile>

However, when the keywords reader option is set, the old behaviour is
re-established, to allow writing out these symbols in "escaped form"
so that they can be read back when the prefix keywords reader option
is turned on.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: guile-1.6-symbol-print.patch --]
[-- Type: text/x-patch, Size: 813 bytes --]

--- guile-1.6.7/libguile/print.c	2003-04-20 20:16:40.000000000 +0200
+++ guile-1.6-1.6.7.mod/libguile/print.c	2005-05-29 18:38:31.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999,2000,2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999,2000,2001, 2003, 2005 Free Software Foundation, Inc.
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -324,7 +324,9 @@
 
   if (len == 0)
     scm_lfwrite ("#{}#", 4, port);
-  else if (str[0] == '#' || str[0] == ':' || str[len-1] == ':')
+  else if (str[0] == '#'
+           || (SCM_NFALSEP (SCM_PACK (SCM_KEYWORD_STYLE))
+               && (str[0] == ':' || str[len-1] == ':')))
     {
       scm_lfwrite ("#{", 2, port);
       weird = 1;

[-- Attachment #3: Type: text/plain, Size: 508 bytes --]


The patch is against 1.6, since I think that is a genuine bug in Guile
(being incompatible with R5RS).

Regards, Rotty
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62
v2sw7MYChw5pr5OFma7u7Lw2m5g/l7Di6e6t5BSb7en6g3/5HZa2Xs6MSr1/2p7 hackerkey.com

A. Because it breaks the logical sequence of discussion
Q. Why is top posting bad?

[-- Attachment #4: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

             reply	other threads:[~2005-06-07 15:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-07 15:30 Andreas Rottmann [this message]
2005-06-11 21:14 ` RFD: [PATCH] Fixing symbol printing Marius Vollmer
2005-06-11 23:40   ` Andreas Rottmann
2005-09-04 21:32     ` Marius Vollmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87acm2uqu2.fsf@ivanova.rotty.yi.org \
    --to=a.rottmann@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).