[gambit-list] Where is macro-character-port-rlo defined?
Marc Feeley
feeley at iro.umontreal.ca
Thu May 24 01:19:29 EDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 24-May-07, at 1:11 AM, |/|/ Bendick wrote:
> While on the thread of the mysteries of the internals of gambit... I
> decided I was going to fix the output-port-width bug, specifically,
> thru emacs
>
> (output-port-width (current-output-port)) => 80
>
> no matter what the actual width is. But I ran into a brick wall. Line
> 3750 of _io.scm references macro-character-port-output-width.
>
> % grep -r macro-character-port-output-width gambc-4.0b22
> gambc-4.0b22/lib/_io.scm: ((macro-character-port-output-width
> port) port))
> %
>
> So that's the only occurrence of macro-character-port-output-width....
> how does that work?
In _io#.scm you will find this type definition:
(define-type-of-port character-port
id: 85099702-35ec-4cb8-ae55-13c4b9b05d10
type-exhibitor: macro-type-character-port
constructor: macro-make-character-port
implementer: implement-type-character-port
macros:
prefix: macro-
opaque:
unprintable:
extender: define-type-of-character-port
rbuf ; character read buffer (a string)
rlo ; low pointer (start of unread characters)
rhi ; high pointer (end of unread characters)
rchars ; number of characters read at start of read
buffer
rlines ; number of lines read up to low pointer
rcurline ; absolute character position where current
line starts
rbuf-fill ; procedure to read characters into the read
buffer
peek-eof? ; peeking the next character should return end-
of-file?
wbuf ; character write buffer (a string)
wlo ; low pointer (start of unwritten characters)
whi ; high pointer (end of unwritten characters)
wchars ; number of characters written at start of
write buffer
wlines ; number of lines written up to high pointer
wcurline ; absolute character position where current
line starts
wbuf-drain ; procedure to write characters from the write
buffer
input-readtable ; readtable for reading
output-readtable ; readtable for writing
output-width ; procedure to get the output width in characters
)
As with other type definitions it defines a constructor, predicate
and accessors based on the name of the type and the name of the
fields. So this type definition creates the accessor for the
character port's output-width. But because of the "macros:"
attribute, the accessor is defined as a macro, and because of the
"prefix: macro-" line the name will be prefixed with "macro-", so the
name of the accessor is
macro-character-port-output-width
Next question?
Marc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFGVSBh//V9Zc2T/v4RAuBwAJ4pmmnlKG9qrPb38ZVDjGSL+Y0P4QCgm23S
LWEaEBG6TXIcfEl/EBrLvoo=
=sDEu
-----END PGP SIGNATURE-----
More information about the Gambit-list
mailing list