MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <ByteSink.h>
Public Member Functions | |
virtual void | WriteBytes (const u8 *data, const u32 len)=0 |
virtual s32 | CanWrite ()=0 |
virtual void | WriteByte (u8 ch) |
virtual void | WriteNewline () |
void | Print (const char *str, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (const u8 *str, u32 len, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (s32 decimal, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (u32 decimal, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (s64 decimal, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (u64 decimal, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (u32 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (s32 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (u64 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (s64 num, Format::Type code, s32 fieldWidth=-1, u8 padChar= ' ') |
void | Print (ByteSerializable &byteSerializble, s32 argument=0) |
void | Println () |
void | Println (u8 byte) |
void | Println (const char *str) |
void | Println (const u8 *str, u32 len) |
void | Println (s32 decimal) |
void | Println (u32 decimal) |
void | Println (u32 decimal, Format::Type code) |
void | Println (ByteSerializable &byteSerializable, s32 argument=0) |
void | Printf (const char *format,...) |
void | Vprintf (const char *format, va_list &ap) |
ByteSink is an abstract base class for byte stream output mechanisms. Concrete instantiations of ByteSink must implement two methods: WriteBytes to output a given sequence of bytes, in its entirety, blocking if need be to do so, and CanWrite to return the minimum number of bytes that can currently be written via WriteBytes without having it block.
|
pure virtual |
Return the number of bytes that can currently be written by WriteBytes without blocking, or return a negative value if the ByteSink has encountered an error.
XXX DOCUMENT ERROR VALUES
Implemented in MFM::DiscardBytes, MFM::TeeByteSink, MFM::LineTailByteSink< LINES, BYTES_PER_LINE >, MFM::LineTailByteSink< LINES, COLUMNS >, MFM::OverflowableCharBufferByteSink< BUFSIZE >, MFM::OverflowableCharBufferByteSink< 16+2 >, MFM::OverflowableCharBufferByteSink< MAX_PATH_LEN >, MFM::OverflowableCharBufferByteSink< 64+2 >, MFM::OverflowableCharBufferByteSink< BYTES_PER_LINE >, MFM::FileByteSink, and MFM::CharBufferByteSink< BUFSIZE >.
void MFM::ByteSink::Print | ( | const char * | str, |
s32 | fieldWidth = -1 , |
||
u8 | padChar = ' ' |
||
) |
Print the contents of a null-terminated string to the ByteSink. Compare to ::Print(const u8 * str, u32 len).
str | A pointer to the null-terminate string to print. |
void MFM::ByteSink::Print | ( | const u8 * | str, |
u32 | len, | ||
s32 | fieldWidth = -1 , |
||
u8 | padChar = ' ' |
||
) |
Print str, an array of bytes of length len, to the ByteSink. Compare to ::Print(const char * str).
str | A pointer to the byte array to print. Must be of length (at least) len; does not need to be null-terminated. |
len | The number of bytes in str to output. May be zero. |
void MFM::ByteSink::Print | ( | u32 | num, |
Format::Type | code, | ||
s32 | fieldWidth = -1 , |
||
u8 | padChar = ' ' |
||
) |
Print num, in a format selected by code, to the current xmit packet of face. The possible format codes are:
DEC
, and in #facePrintf(u8 face, const char * format,...) for an alternate way to print in this representation.HEX
, and in #facePrintf(u8 face, const char * format,...) for an alternate way to print in this representation.OCT
, and in #facePrintf(u8 face, const char * format,...) for an alternate way to print in this representation.BIN
, and in #facePrintf(u8 face, const char * format,...) for an alternate way to print in this representation.B36
, and in #facePrintf(u8 face, const char * format,...) for an alternate way to print in this representation.BEU32
, and in #facePrintf(u8 face, const char * format,...) for an alternate way to print in this representation.BEU32
is called a 'binary' code, but it must not be confused with #BIN. With BEU32
, each of the four output bytes may each contain any possible bit pattern, whereas with code #BIN each output byte is either the ASCII code for '0' or the ASCII code for '1'.BEU16
, and in #facePrintf(u8 face, const char * format,...) for an alternate way to print in this representation.BEU16
is called a 'binary' code, but it must not be confused with #BIN. With BEU16
, each of the two output bytes may each contain any possible bit pattern, whereas with code #BIN each output byte is either the ASCII code for '0' or the ASCII code for '1'.BYTE
, and in #facePrintf(u8 face, const char * format,...) for an alternate way to print in this representation.BYTE
is called a 'binary' code, but it must not be confused with #BIN. With BYTE
, the output byte may each contain any possible bit pattern, whereas with code #BIN each output byte is either the ASCII code for '0' or the ASCII code for '1'.In addition to those codes, it is also possible to print in other bases between 2 and 36, if there is call to do so. For example, using a code value of 13 will select printing in base 13, using the ASCII characters '0' through '9' and 'A' through 'C'.
num | A 32 bit number to be printed in a particular format. |
code | What format to use (see above). |
XXX Sample all-ASCII printable packet generation:
XXX Sample binary packet generation:
void MFM::ByteSink::Print | ( | s32 | num, |
Format::Type | code, | ||
s32 | fieldWidth = -1 , |
||
u8 | padChar = ' ' |
||
) |
The same as #Print(u32 num, Format code), except that if num is negative and code is DEC
, then prints num as a negative, with a leading '-'.
num | A 32 bit number to be printed in a particular format. |
code | What format to use |
|
inline |
str | Same as #Print(const char * str) followed by #Println(). |
|
inline |
len | Same as #Print(const u8 * str,u32 len) followed by #Println(). |
|
inline |
decimal | Same as #Print(s32 decimal)followed by #Println(). |
|
inline |
decimal | Same as #Print(u32 decimal) followed by #Println(). |
|
inline |
code | Same as #Print(u32 decimal, Format::Type code) followed by #Println(). |
|
inlinevirtual |
Overridable convenience method Same as
|
pure virtual |
Write the len consecutive bytes starting at data to the ByteSink, blocking if and as long as necessary to do so. It is not an error for len to be zero and WriteBytes will never block if it is.
Implemented in MFM::DiscardBytes, MFM::TeeByteSink, MFM::LineTailByteSink< LINES, BYTES_PER_LINE >, MFM::LineTailByteSink< LINES, COLUMNS >, MFM::FileByteSink, MFM::CharBufferByteSink< BUFSIZE >, MFM::OverflowableCharBufferByteSink< BUFSIZE >, MFM::OverflowableCharBufferByteSink< 16+2 >, MFM::OverflowableCharBufferByteSink< MAX_PATH_LEN >, MFM::OverflowableCharBufferByteSink< 64+2 >, and MFM::OverflowableCharBufferByteSink< BYTES_PER_LINE >.
|
inlinevirtual |
Overridable convenience method Same as