unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* port patch
@ 2003-05-28 12:57 Dr. Peter Ivanyi
  2003-06-01 22:04 ` Marius Vollmer
  0 siblings, 1 reply; 2+ messages in thread
From: Dr. Peter Ivanyi @ 2003-05-28 12:57 UTC (permalink / raw)


Hi,

I would like to propose this tiny patch. It modifies the peek-char function.
The problem is that if the peeked character is a new line, then the
column number is reset to zero (in scm_ungetc function). This does
not solve the problem of what to do with new line characters when ungetting
a character or a string but provides a consistent interface where peeking
and reading keeps a proper track of line and column numbers.

Probably it would also be good to mention in the documentation that when
ungetting a character or string the column number may not be consistent
with the actual value.

Thanx,

				Peter Ivanyi

-------------------------------------------------------------------------

--- guile-1.6.4/libguile/ports.c        Sat Dec  7 22:41:32 2002
+++ guile-1.6.4-new/libguile/ports.c    Wed May 28 13:51:10 2003
@@ -1225,15 +1225,17 @@
            "to @code{read-char} would have hung.}")
 #define FUNC_NAME s_scm_peek_char
 {
-  int c;
+  int c, column;
   if (SCM_UNBNDP (port))
     port = scm_cur_inp;
   else
     SCM_VALIDATE_OPINPORT (1,port);
+  column = SCM_COL(port);
   c = scm_getc (port);
   if (EOF == c)
     return SCM_EOF_VAL;
   scm_ungetc (c, port);
+  SCM_COL(port) = column;
   return SCM_MAKE_CHAR (c);
 }
 #undef FUNC_NAME


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: port patch
  2003-05-28 12:57 port patch Dr. Peter Ivanyi
@ 2003-06-01 22:04 ` Marius Vollmer
  0 siblings, 0 replies; 2+ messages in thread
From: Marius Vollmer @ 2003-06-01 22:04 UTC (permalink / raw)
  Cc: guile-user@gnu.org

"Dr. Peter Ivanyi" <peteri@carme.sect.mce.hw.ac.uk> writes:

> I would like to propose this tiny patch.

Applied, thanks!

> Probably it would also be good to mention in the documentation that when
> ungetting a character or string the column number may not be consistent
> with the actual value.

Do you have a patch for that as well? ;)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-01 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-28 12:57 port patch Dr. Peter Ivanyi
2003-06-01 22:04 ` Marius Vollmer

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).