X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=mware%2Ftext_format.c;h=954d1bc889990ab316c63af147d5b51e4b4e3acc;hb=38ced89fd9f856520a83833672cee0fe16eafcd2;hp=6defd13c43f11f9890506e0c00e649e6a8de8351;hpb=37d3acaa622b7f695ce57578e56311d031a22d22;p=bertos.git diff --git a/mware/text_format.c b/mware/text_format.c index 6defd13c..954d1bc8 100755 --- a/mware/text_format.c +++ b/mware/text_format.c @@ -1,10 +1,9 @@ /*! * \file - * * * * \version $Id$ @@ -17,6 +16,15 @@ /* * $Log$ + * Revision 1.4 2004/08/05 18:46:44 bernie + * Documentation improvements. + * + * Revision 1.3 2004/08/03 15:57:18 aleph + * Add include to fix warning for vsprintf() + * + * Revision 1.2 2004/06/03 11:27:09 bernie + * Add dual-license information. + * * Revision 1.1 2004/05/23 15:43:16 bernie * Import mware modules. * @@ -32,11 +40,19 @@ #include "formatwr.h" /* _formatted_write() */ #include "font.h" #include "gfx.h" +#include /* vsprintf() */ #include -#include /* strlen */ +#include /* strlen() */ /*! - * Render string str in bitmap + * Render string \a str in Bitmap \a bm at current cursor position + * + * \note Text formatting functions are also available with an _P suffix + * accepting the source string from program memory. This feature + * is only available (and useful) on Harvard microprocessors such + * as the AVR. + * + * \see text_putchar() */ int PGM_FUNC(text_puts)(const char * PGM_ATTR str, struct Bitmap *bm) { @@ -49,12 +65,30 @@ int PGM_FUNC(text_puts)(const char * PGM_ATTR str, struct Bitmap *bm) } +/*! + * vprintf()-like formatter to render text in a Bitmap. + * + * Perform vprintf()-like formatting on the \a fmt format string using the + * variable-argument list \a ap. + * Render the resulting string in Bitmap \a bm starting at the current + * cursor position. + * + * \see text_puts() text_putchar() text_printf() + */ int PGM_FUNC(text_vprintf)(struct Bitmap *bm, const char * PGM_ATTR fmt, va_list ap) { return PGM_FUNC(_formatted_write)(fmt, (void (*)(char, void *))text_putchar, bm, ap); } - +/*! + * printf()-like formatter to render text in a Bitmap. + * + * Perform printf()-like formatting on the \a fmt format string. + * Render the resulting string in Bitmap \a bm starting at the + * current cursor position. + * + * \see text_puts() text_putchar() text_vprintf() + */ int PGM_FUNC(text_printf)(struct Bitmap *bm, const char * PGM_ATTR fmt, ...) { int len; @@ -68,8 +102,23 @@ int PGM_FUNC(text_printf)(struct Bitmap *bm, const char * PGM_ATTR fmt, ...) } +/*! + * Render the result of printf()-like formatting in a specified position + * of a Bitmap. + * + * \param bm Bitmap where to render the text + * \param row Starting row in character units (zero based) + * \param col Starting column in character units (zero based) + * \param mode Formatting mode to use. Can be TEXT_NORMAL, + * TEXT_FILL, TEXT_INVERT or TEXT_RIGHT or a combination + * of these flags ORed together. + * \param fmt String possibly containing printf() formatting commands. + * + * \see text_puts() text_putchar() text_printf() text_vprintf() + * \see text_moveto() text_style() + */ int PGM_FUNC(text_xprintf)(struct Bitmap *bm, - uint8_t row, uint8_t col, uint8_t mode, const char * PGM_ATTR fmt, ...) + uint8_t row, uint8_t col, uint8_t mode, const char * PGM_ATTR fmt, ...) { int len; uint8_t oldstyle = 0;