BRL-CAD
Loading...
Searching...
No Matches
bio.h
Go to the documentation of this file.
1
/* B I O . H
2
* BRL-CAD
3
*
4
* Copyright (c) 2008-2025 United States Government as represented by
5
* the U.S. Army Research Laboratory.
6
*
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public License
9
* version 2.1 as published by the Free Software Foundation.
10
*
11
* This library is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this file; see the file named COPYING for more
18
* information.
19
*/
20
/** @addtogroup bu_bio
21
*
22
* @brief
23
* BRL-CAD system compatibility wrapper header that provides declarations for
24
* native and standard system INPUT/OUTPUT routines.
25
*
26
* This header is commonly used in lieu of including the following: stdio.h,
27
* io.h, fcntl, unistd.h, and windows.h
28
*
29
* The logic in this header should not rely on common.h's HAVE_* defines and
30
* should not be including the common.h header. This is intended to be a
31
* stand-alone portability header intended to be independent of build system,
32
* reusable by external projects.
33
*/
34
35
/** @{ */
36
/** @file bio.h */
37
38
#ifndef BIO_H
39
#define BIO_H
40
41
#include <stdio.h>
42
43
/* strict mode may not declare fileno() */
44
# if !defined(fileno) && !defined(__cplusplus)
45
extern
int
fileno(FILE *stream);
46
# endif
47
48
#if defined(_WIN32) && !defined(__CYGWIN__)
49
50
# ifdef WIN32_LEAN_AND_MEAN
51
# undef WIN32_LEAN_AND_MEAN
52
# endif
53
# define WIN32_LEAN_AND_MEAN 434144
/* don't want winsock.h */
54
55
# ifdef NOMINMAX
56
# undef NOMINMAX
57
# endif
58
# define NOMINMAX 434144
/* don't break std::min and std::max */
59
60
# include <windows.h>
61
62
# undef WIN32_LEAN_AND_MEAN
/* unset to not interfere with calling apps */
63
# undef NOMINMAX
64
# include <io.h>
65
66
# undef rad1
/* Win32 radio button 1 */
67
# undef rad2
/* Win32 radio button 2 */
68
# undef small
/* defined as part of the Microsoft Interface Definition Language (MIDL) */
69
70
#else
71
72
# include <unistd.h>
73
74
/* provide a stub so we don't need to wrap all setmode() calls */
75
static
inline
int
setmode(
int
UNUSED
(a),
int
UNUSED
(b)) {
return
42;}
76
static
int (*
volatile
setmode_func)(int, int) = setmode;
/* quell use */
77
#endif
78
79
/* needed for testing O_TEMPORARY and O_BINARY */
80
#include <fcntl.h>
81
82
/* _O_TEMPORARY on Windows removes file when last descriptor is closed */
83
#ifndef O_TEMPORARY
84
# define O_TEMPORARY 0
85
#endif
86
87
/* _O_BINARY on Windows indicates whether to use binary or text (default) I/O */
88
#ifndef O_BINARY
89
# define O_BINARY 0
90
#endif
91
92
#endif
/* BIO_H */
93
94
/** @} */
95
96
/*
97
* Local Variables:
98
* tab-width: 8
99
* mode: C
100
* indent-tabs-mode: t
101
* c-file-style: "stroustrup"
102
* End:
103
* ex: shiftwidth=4 tabstop=8
104
*/
UNUSED
#define UNUSED(parameter)
Definition
common.h:335
include
bio.h
Generated on Sat Jul 5 2025 01:23:50 for BRL-CAD by
1.9.8