StdIO.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00013 #ifndef _SUPPORT_STDIO_H
00014 #define _SUPPORT_STDIO_H
00015 
00021 #include <support/Value.h>
00022 #include <support/IByteStream.h>
00023 #include <support/ITextStream.h>
00024 
00025 #if _SUPPORTS_NAMESPACE
00026 namespace palmos {
00027 namespace support {
00028 #endif
00029 
00034 /**************************************************************************************/
00035 /*
00036 This is defined here to be at the same location where btrace is defined.
00037 Thus using traces does not require to include several headers.
00038 Another approach could be to put this in TraceMgr.h and include this header here,
00039 but you would need to add several path to the search dir (and reduce the build time).
00040 */
00041 #if defined(TRACE_OUTPUT) && TRACE_OUTPUT == TRACE_OUTPUT_ON
00042 #   define TO(x)    x
00043 #else
00044 #   define TO(x)
00045 #endif
00046 
00047 // The new function names for raw byte streams.
00048 extern _IMPEXP_SUPPORT const sptr<IByteInput>& StandardByteInput(void);
00049 extern _IMPEXP_SUPPORT const sptr<IByteOutput>& StandardByteOutput(void);
00050 extern _IMPEXP_SUPPORT const sptr<IByteOutput>& StandardByteError(void);
00051 extern _IMPEXP_SUPPORT const sptr<IByteInput>& NullByteInput(void);
00052 extern _IMPEXP_SUPPORT const sptr<IByteOutput>& NullByteOutput(void);
00053 
00054 #if TARGET_HOST != TARGET_HOST_PALMOS
00055 
00056 // Raw byte streams for the standard C files.
00057 extern _IMPEXP_SUPPORT const sptr<IByteInput> Stdin;
00058 extern _IMPEXP_SUPPORT const sptr<IByteOutput> Stdout;
00059 extern _IMPEXP_SUPPORT const sptr<IByteOutput> Stderr;
00060 
00061 // Formatted text streams for C standard out, standard error,
00062 // and the debug serial port.
00063 extern _IMPEXP_SUPPORT sptr<ITextOutput> bout;
00064 extern _IMPEXP_SUPPORT sptr<ITextOutput> berr;
00065 
00066 #else 
00067 
00068 extern _IMPEXP_SUPPORT sptr<ITextOutput>& _get_bout(void);
00069 extern _IMPEXP_SUPPORT sptr<ITextOutput>& _get_berr(void);
00070 
00071 #define bout _get_bout()
00072 #define berr _get_berr()
00073 
00074 #endif
00075 
00076 /**************************************************************************************/
00077 
00080 #if _SUPPORTS_NAMESPACE
00081 } } // namespace palmos::support
00082 #endif
00083 
00084 #endif /* _SUPPORT_STDIO_H */