Implement efficient 'scm_unget_bytes' and 'unget-bytevector'.
authorMark H Weaver <mhw@netris.org>
Sat, 6 Apr 2013 05:42:45 +0000 (01:42 -0400)
committerMark H Weaver <mhw@netris.org>
Sun, 7 Apr 2013 14:14:44 +0000 (10:14 -0400)
commit7f6c3f8f0012e916469fa6c50b44c621ebdc89ac
tree220b67e9dc1ee7482a66dc3a5a2e6898499d2f45
parente1966d0e214b0967c19da71b235196adb057d2b5
Implement efficient 'scm_unget_bytes' and 'unget-bytevector'.

* libguile/ports.c (scm_i_unget_bytes): New static function.
  (scm_unget_bytes): New API function.
  (scm_unget_byte): Rewrite to simply call 'scm_i_unget_bytes'.
  (scm_ungetc, scm_peek_char, looking_at_bytes): Use 'scm_i_unget_bytes'.

* libguile/ports.h: Add prototype for 'scm_unget_bytes'.

* libguile/fports.c (scm_setvbuf): Use 'scm_unget_bytes'.

* libguile/r6rs-ports.c (scm_unget_bytevector): New procedure.

* module/ice-9/binary-ports.scm (unget-bytevector): New export.

* doc/ref/api-io.texi (R6RS Binary Input): Add documentation.
  (R6RS I/O Ports): Update brief description of (ice-9 binary-ports) to
  reflect the new reality: it is no longer a subset of (rnrs io ports).

* test-suite/tests/ports.test ("unget-bytevector"): Add test.
doc/ref/api-io.texi
libguile/fports.c
libguile/ports.c
libguile/ports.h
libguile/r6rs-ports.c
module/ice-9/binary-ports.scm
test-suite/tests/ports.test