wip commit. acpi button driver.
[AROS.git] / compiler / arossupport / rkprintf.c
blob7ccc17057d8ae5c00ba561a9627251a1d55fb066
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Formats a message and makes sure the user will see it.
6 Lang: english
7 */
9 #include <aros/config.h>
10 #include <aros/arossupportbase.h>
11 #include <stdarg.h>
12 #include <aros/system.h>
13 #include <proto/exec.h>
14 #include <proto/arossupport.h>
15 #undef rkprintf
17 #define AROSBase ((struct AROSBase *)(SysBase->DebugAROSBase))
19 /* Can't use ctypt.h *sigh* */
20 #define isdigit(x) ((x) >= '0' && (x) <= '9')
21 #define isprint(x) (((x) >= ' ' && (x) <= 128) || (x) >= 160)
23 /*****************************************************************************
25 NAME */
26 #include <proto/arossupport.h>
28 int rkprintf (
30 /* SYNOPSIS */
31 const STRPTR mainSystem,
32 const STRPTR subSystem,
33 int level,
34 const UBYTE * fmt,
35 ...)
37 /* FUNCTION
38 Call kprintf if debugging for this main and subsystem is enabled
39 at a level larger than the level above. The minimal level is 1
40 (this way, debugging can be disabled in the debug config file
41 by giving a level of 0).
43 You should not call this function directly but use the rbug
44 macro. The rbug macro does some magic to make the handling
45 more simple.
47 INPUTS
48 mainSystem - The main system. Use one of the DBG_MAINSYSTEM_*
49 macros to avoid typos.
50 subSystem - The part of the main system. Use one of the
51 DBG_*_SUBSYSTEM_* macros.
52 level - The debug level. Higher levels should give more details.
53 The lowest level is 1.
54 fmt - printf()-style format string
56 RESULT
57 The number of characters output.
59 NOTES
60 This function is not part of a library and may thus be called
61 any time.
63 EXAMPLE
64 if (cache)
66 ...
67 D(rbug(INTUITION, INPUTHANDLER, 3,
68 "allocating event from cache (%p)", event
69 ));
70 ...
73 BUGS
75 SEE ALSO
77 INTERNALS
79 HISTORY
80 24-12-95 digulla created
82 ******************************************************************************/
84 va_list ap;
85 int ret;
87 /* FIXME check the systems and the debug level */
88 // Check SysBase->DebugAROSBase->DebugConfig
90 va_start(ap, fmt);
91 ret = vkprintf((const char *)fmt, ap);
92 va_end(ap);
94 return ret;