![]() |
Boron 2.1.0
|
The UPortDevice struct holds methods for a class of input/ouput device. More...
Data Fields | |
| int(* | open )(UThread *, const UPortDevice *, const UCell *from, int opt, UCell *res) |
| Create and open a new port. | |
| void(* | close )(UBuffer *) |
| Close port. | |
| int(* | read )(UThread *, UBuffer *, UCell *, int len) |
| Read data from port. | |
| int(* | write )(UThread *, UBuffer *, const UCell *) |
| Write data to port. | |
| int(* | seek )(UThread *, UBuffer *, UCell *, int where) |
| Seek to position. | |
| int | defaultReadLen |
| Number of bytes to read if script does not specify a length. | |
The UPortDevice struct holds methods for a class of input/ouput device.
| void(* UPortDevice::close) (UBuffer *) |
Close port.
| pbuf | Buffer created by UPortDevice::open. |
| int UPortDevice::defaultReadLen |
Number of bytes to read if script does not specify a length.
This should be set to zero if UPortDevice::read does not expect a UT_BINARY or UT_STRING buffer.
| int(* UPortDevice::open) (UThread *, const UPortDevice *, const UCell *from, int opt, UCell *res) |
Create and open a new port.
| pdev | This device class. |
| from | Specification of port. |
| opt | Port options. |
| res | Cell for new port. |
Open will normally call boron_makePort() to generate a port buffer and set res.
Read data from port.
If UPortDevice::defaultReadLen is greater than zero then dest will reference a UT_BINARY or UT_STRING buffer with enough memory reserved for len bytes.
| pbuf | Port buffer created by UPortDevice::open. |
| dest | Destination buffer or result. |
| len | Number of bytes to read into dest. |
Seek to position.
| pbuf | Buffer created by UPortDevice::open. |
| pos | New position relative to where. |
| where | SEEK_SET, SEEK_END, or SEEK_CUR. |
If the device cannot seek then call ur_error().
Write data to port.
| pbuf | Buffer created by UPortDevice::open. |
| data | Data to write. |