(C) 1998 AROS - The Amiga Research OS


NAME

APTR RawDoFmt ( FormatString , DataStream , PutChProc , PutChData)

LOCATION
In SysBase at offset 87

SYNOPSIS
STRPTR FormatString
APTR DataStream
VOID_FUNC PutChProc
APTR PutChData

FUNCTION
printf-style formatting function with callback hook.

INPUTS
FormatString
Pointer to the format string with any of the following stream formatting options allowed:

%[leftalign][minwidth.][maxwidth][size][type]

leftalign
'-' means align left. Default: align right.
minwidth
minimum width of field. Defaults to 0.
maxwidth
maximum width of field (for strings only). Defaults to no limit.
size
'l' means longword. Defaults to word.
type
'b' BCPL string. A BPTR to a one byte byte count followed by the characters. 'c' single character. 'd' signed decimal number. 's' C string. NUL terminated. 'u' unsigned decimal number. 'x' unsigned sedecimal number.

DataStream
Array of the data items.
PutChProc
Callback function. Called for each character, including the NUL terminator.
PutChData
Data propagated to each call of the callback hook.

RESULT
Pointer to the rest of the DataStream.

EXAMPLE
build a sprintf style function

static void callback(UBYTE chr, UBYTE **data)
{   *(*data)++=chr;   }

void my_sprintf(UBYTE *buffer, UBYTE *format, ...)
{   RawDoFmt(format, &format+1, &callback, &buffer);   }
SEE ALSO

NOTES
The field size defaults to words which may be different from the default integer size of the compiler.

BUGS
PutChData cannot be modified from the callback hook on non-m68k systems.

INTERNALS

HISTORY