ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

_stdio_file.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */
00018 
00019 #ifndef _STLP_STDIO_FILE_H
00020 #define _STLP_STDIO_FILE_H
00021 
00022 /* This file provides a low-level interface between the internal
00023  * representation of struct FILE, from the C stdio library, and
00024  * the C++ I/O library. */
00025 
00026 #ifndef _STLP_CSTDIO
00027 #  include <cstdio>
00028 #endif
00029 #ifndef _STLP_CSTDDEF
00030 #  include <cstddef>
00031 #endif
00032 
00033 #if defined (__MSL__)
00034 #  include <unix.h>  /* get the definition of fileno */
00035 #endif
00036 
00037 _STLP_BEGIN_NAMESPACE
00038 
00039 #if defined (_STLP_WCE)
00040 
00041 inline int _FILE_fd(const FILE *__f) {
00042   /* Check if FILE is one of the three standard streams
00043      We do this check first, because invoking _fileno() on one of them
00044      causes a terminal window to be created. This also happens if you do
00045      any IO on them, but merely retrieving the filedescriptor shouldn't
00046      already do that.
00047 
00048      Obviously this is pretty implementation-specific because it requires
00049      that indeed the first three FDs are always the same, but that is not
00050      only common but almost guaranteed. */
00051   for (int __fd = 0; __fd != 3; ++__fd) {
00052     if (__f == _getstdfilex(__fd))
00053       return __fd;
00054   }
00055 
00056   /* Normal files. */
00057   return (int)::_fileno((FILE*)__f); 
00058 }
00059 
00060 # elif defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
00061 
00062 inline int _FILE_fd(const FILE *__f) { return __f->__file; }
00063 
00064 # elif defined (__sun) && defined (_LP64)
00065 
00066 inline int _FILE_fd(const FILE *__f) { return (int) __f->__pad[2]; }
00067 
00068 #elif defined (__hpux) /* && defined(__hppa) && defined(__HP_aCC)) */ || \
00069       defined (__MVS__) || \
00070       defined (_STLP_USE_UCLIBC) /* should be before _STLP_USE_GLIBC */
00071 
00072 inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE*, __f)); }
00073 
00074 #elif defined (_STLP_USE_GLIBC)
00075 
00076 inline int _FILE_fd(const FILE *__f) { return __f->_fileno; }
00077 
00078 #elif defined (__BORLANDC__)
00079 
00080 inline int _FILE_fd(const FILE *__f) { return __f->fd; }
00081 
00082 #elif defined (__MWERKS__)
00083 
00084 /* using MWERKS-specific defines here to detect other OS targets
00085  * dwa: I'm not sure they provide fileno for all OS's, but this should
00086  * work for Win32 and WinCE
00087 
00088  * Hmm, at least for Novell NetWare __dest_os == __mac_os true too..
00089  * May be both __dest_os and __mac_os defined and empty?   - ptr */
00090 #  if __dest_os == __mac_os
00091 inline int _FILE_fd(const FILE *__f) { return ::fileno(__CONST_CAST(FILE*, __f)); }
00092 #  else
00093 inline int _FILE_fd(const FILE *__f) { return ::_fileno(__CONST_CAST(FILE*, __f)); }
00094 #  endif
00095 
00096 #elif defined (__QNXNTO__) || defined (__WATCOMC__) || defined (__EMX__)
00097 
00098 inline int _FILE_fd(const FILE *__f) { return __f->_handle; }
00099 
00100 #elif defined (__Lynx__)
00101 
00102 /* the prototypes are taken from LynxOS patch for STLport 4.0 */
00103 inline int _FILE_fd(const FILE *__f) { return __f->_fd; }
00104 
00105 #else  /* The most common access to file descriptor. */
00106 
00107 inline int _FILE_fd(const FILE *__f) { return __f->_file; }
00108 
00109 #endif
00110 
00111 _STLP_END_NAMESPACE
00112 
00113 #endif /* _STLP_STDIO_FILE_H */
00114 
00115 /* Local Variables:
00116  * mode:C++
00117  * End: */

Generated on Sun May 27 2012 04:35:09 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.