Handbook
Glossary
buffer
Factor handbook
»
The language
»
Collections
»
Locked I/O buffers
Next:
<buffer> ( n -- buffer )
Vocabulary
io
.
buffers
Class description
The class of I/O buffers, which resemble FIFO queues, but are optimized for holding bytes, are have underlying storage allocated at a fixed address. Buffers must be de-allocated manually. It has the following slots:
size
The total size, in bytes, of the buffer
ptr
The
c-ptr
memory where data is stored
fill
The fill pointer, a write index where new data is added
pos
The position, a read index where data is consumed
Definition
USING:
alien
alien.syntax
math
;
IN:
io.buffers
TUPLE:
buffer
{
size
fixnum
initial:
0
}
{
ptr
alien
initial:
BAD-ALIEN
}
{
fill
fixnum
initial:
0
}
{
pos
fixnum
initial:
0
}
disposed
;
Methods
USING:
accessors
destructors
io.buffers
libc
;
M:
buffer
dispose*
ptr>>
free
;
inline