tidbits.h Source File

| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

tidbits.h
1 /**************************************************************************\
2 *
3 * This file is part of the Coin 3D visualization library.
4 * Copyright (C) by Kongsberg Oil & Gas Technologies.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * ("GPL") version 2 as published by the Free Software Foundation.
9 * See the file LICENSE.GPL at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using Coin with software that can not be combined with the GNU
13 * GPL, and for taking advantage of the additional benefits of our
14 * support services, please contact Kongsberg Oil & Gas Technologies
15 * about acquiring a Coin Professional Edition License.
16 *
17 * See http://www.coin3d.org/ for more information.
18 *
19 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
20 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
21 *
22 \**************************************************************************/
23
24 #ifndef COIN_TIDBITS_H
25 #define COIN_TIDBITS_H
26
27 #include <Inventor/C/basic.h>
28 #include <stdarg.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /*__cplusplus */
33
34 /* ********************************************************************** */
35
36 enum CoinEndiannessValues {
37 COIN_HOST_IS_UNKNOWNENDIAN = -1,
38 COIN_HOST_IS_LITTLEENDIAN = 0,
39 COIN_HOST_IS_BIGENDIAN = 1
40 };
41
42 COIN_DLL_API int coin_host_get_endianness(void);
43
44 COIN_DLL_API int coin_snprintf(char * dst, unsigned int n, const char * fmtstr, ...);
45 COIN_DLL_API int coin_vsnprintf(char * dst, unsigned int n, const char * fmtstr, va_list args);
46
47 COIN_DLL_API const char * coin_getenv(const char * name);
48 COIN_DLL_API SbBool coin_setenv(const char * name, const char * value, int overwrite);
49 COIN_DLL_API void coin_unsetenv(const char * name);
50
51 COIN_DLL_API int coin_strncasecmp(const char * str1, const char * str2, int len);
52
53 COIN_DLL_API uint16_t coin_hton_uint16(uint16_t value);
54 COIN_DLL_API uint16_t coin_ntoh_uint16(uint16_t value);
55 COIN_DLL_API uint32_t coin_hton_uint32(uint32_t value);
56 COIN_DLL_API uint32_t coin_ntoh_uint32(uint32_t value);
57 COIN_DLL_API uint64_t coin_hton_uint64(uint64_t value);
58 COIN_DLL_API uint64_t coin_ntoh_uint64(uint64_t value);
59
60 COIN_DLL_API void coin_hton_float_bytes(float value, char * result); /* expects room for 4 bytes in result*/
61 COIN_DLL_API float coin_ntoh_float_bytes(const char * value); /* expects 4 bytes input */
62
63 COIN_DLL_API void coin_hton_double_bytes(double value, char * result); /* expects room for 8 bytes in result */
64 COIN_DLL_API double coin_ntoh_double_bytes(const char * value); /* expects 8 bytes input */
65
66 COIN_DLL_API SbBool coin_isascii(const int c);
67 COIN_DLL_API SbBool coin_isspace(const char c);
68
69 COIN_DLL_API SbBool coin_is_power_of_two(uint32_t x);
70 COIN_DLL_API uint32_t coin_next_power_of_two(uint32_t x);
71 COIN_DLL_API uint32_t coin_geq_power_of_two(uint32_t x);
72
73 COIN_DLL_API void coin_viewvolume_jitter(int numpasses, int curpass, const int * vpsize, float * jitter);
74
75 typedef void coin_atexit_f(void);
76 COIN_DLL_API void cc_coin_atexit(coin_atexit_f * fp);
77
78 /* Used internally to clean up static data. Do not use in application code */
79 COIN_DLL_API void cc_coin_atexit_static_internal(coin_atexit_f * fp);
80
81 /* ********************************************************************** */
82
83 /* OBSOLETED! These are not safe. Don't use them. */
84 COIN_DLL_API float coin_hton_float(float value);
85 COIN_DLL_API float coin_ntoh_float(float value);
86
87 COIN_DLL_API double coin_hton_double(double value);
88 COIN_DLL_API double coin_ntoh_double(double value);
89
90 /* ********************************************************************** */
91
92 #ifdef __cplusplus
93 } /* extern "C" */
94 #endif /* __cplusplus */
95
96 #endif /* !COIN_TIDBITS_H */

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.