1 | /* $Id: stdio.h 20374 2009-06-08 00:43:21Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Our minimal stdio
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ___Sun_stdio_h
|
---|
23 | #define ___Sun_stdio_h
|
---|
24 |
|
---|
25 | #ifndef LOG_GROUP
|
---|
26 | # define UNDO_LOG_GROUP
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | #include <VBox/log.h>
|
---|
30 |
|
---|
31 | #ifdef UNDO_LOG_GROUP
|
---|
32 | # undef UNDO_LOG_GROUP
|
---|
33 | # undef LOG_GROUP
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | #ifndef LOG_USE_C99
|
---|
37 | # error "LOG_USE_C99 isn't defined."
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | RT_C_DECLS_BEGIN
|
---|
41 |
|
---|
42 | typedef struct FILE FILE;
|
---|
43 |
|
---|
44 | #if defined(RT_OS_SOLARIS)
|
---|
45 | /** @todo Check solaris' floatingpoint.h as to why we do this */
|
---|
46 | # define _FILEDEFED
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | DECLINLINE(int) fprintf(FILE *ignored, const char *pszFormat, ...)
|
---|
50 | {
|
---|
51 | /** @todo We don't support wrapping calls taking a va_list yet. It's not worth it yet,
|
---|
52 | * since there are only a couple of cases where this fprintf implementation is used.
|
---|
53 | * (The macro below will deal with the majority of the fprintf calls.) */
|
---|
54 | #if 0 /*def LOG_ENABLED*/
|
---|
55 | if (LogIsItEnabled(NULL, 0, LOG_GROUP_REM_PRINTF))
|
---|
56 | {
|
---|
57 | va_list va;
|
---|
58 | va_start(va, pszFormat);
|
---|
59 | RTLogLoggerExV(NULL, 0, LOG_GROUP_REM_PRINTF, pszFormat, va);
|
---|
60 | va_end(va);
|
---|
61 | }
|
---|
62 | #endif
|
---|
63 | return 0;
|
---|
64 | }
|
---|
65 |
|
---|
66 | #define fflush(file) RTLogFlush(NULL)
|
---|
67 | #define printf(...) LogIt(LOG_INSTANCE, 0, LOG_GROUP_REM_PRINTF, (__VA_ARGS__))
|
---|
68 | #define fprintf(logfile, ...) LogIt(LOG_INSTANCE, 0, LOG_GROUP_REM_PRINTF, (__VA_ARGS__))
|
---|
69 |
|
---|
70 | #ifdef DEBUG_TMP_LOGGING
|
---|
71 | # error "DEBUG_TMP_LOGGING doesn't work with the Sun/crt/stdio.h wrapper."
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | RT_C_DECLS_END
|
---|
75 |
|
---|
76 | #endif
|
---|
77 |
|
---|