diff options
Diffstat (limited to 'firmware/include/vuprintf.h')
-rw-r--r-- | firmware/include/vuprintf.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/firmware/include/vuprintf.h b/firmware/include/vuprintf.h new file mode 100644 index 0000000000..3876482fb2 --- /dev/null +++ b/firmware/include/vuprintf.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Felix Arends | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef __VUPRINTF_H__ | ||
23 | #define __VUPRINTF_H__ | ||
24 | |||
25 | #include <stdarg.h> | ||
26 | |||
27 | /* callback function is called for every output character (byte) in the | ||
28 | * output with userp | ||
29 | * | ||
30 | * it must return > 0 to continue (increments counter) | ||
31 | * it may return 0 to stop (increments counter) | ||
32 | * it may return < 0 to stop (does not increment counter) | ||
33 | * a zero in the format string stops (does not increment counter) | ||
34 | * | ||
35 | * caller is reponsible for stopping formatting in order to keep the return | ||
36 | * value from overflowing (assuming they have a reason to care) | ||
37 | */ | ||
38 | typedef int (* vuprintf_push_cb)(void *userp, int c); | ||
39 | |||
40 | /* | ||
41 | * returns the number of times push() was called and returned >= 0 | ||
42 | */ | ||
43 | int vuprintf(vuprintf_push_cb push, void *userp, const char *fmt, va_list ap); | ||
44 | |||
45 | #endif /* __VUPRINTF_H__ */ | ||