1 #ifndef HAIKU_BUILD_COMPATIBILITY_H 2 #define HAIKU_BUILD_COMPATIBILITY_H 3 4 /*! 5 This header is automatically included in all Haiku applications 6 that are built for BeOS. 7 It will make BeOS a bit more Haiku compatible, and slightly more 8 POSIX compatible, too. It is supposed to keep the BeOS compatibility 9 kludges in our source files at a minimum. 10 */ 11 12 #include <sys/types.h> 13 #include <SupportDefs.h> 14 15 #ifdef HAIKU_TARGET_PLATFORM_LIBBE_TEST 16 # define _BE_ERRNO_H_ 17 // this is what Dano/Zeta is using 18 # include <Errors.h> 19 #endif 20 21 #include <string.h> 22 23 // no addr_t under standard BeOS 24 typedef unsigned long haiku_build_addr_t; 25 #define addr_t haiku_build_addr_t 26 27 typedef int socklen_t; 28 29 #ifndef DEFFILEMODE 30 # define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) 31 #endif 32 33 #ifndef FS_WRITE_FSINFO_NAME 34 # define FS_WRITE_FSINFO_NAME 0x0001 35 #endif 36 37 #ifndef B_CURRENT_TEAM 38 # define B_CURRENT_TEAM 0 39 #endif 40 41 42 #ifndef SYMLOOP_MAX 43 # define SYMLOOP_MAX (16) 44 #endif 45 46 #ifndef B_FIRST_REAL_TIME_PRIORITY 47 # define B_FIRST_REAL_TIME_PRIORITY B_REAL_TIME_DISPLAY_PRIORITY 48 #endif 49 50 #if __GNUC__ 51 # define _PRINTFLIKE(_format_, _args_) \ 52 __attribute__((format(__printf__, _format_, _args_))) 53 #endif 54 55 #ifdef HAIKU_TARGET_PLATFORM_LIBBE_TEST 56 // BeOS version of BeBuild.h defines this 57 # define _IMPEXP_ROOT __declspec(dllimport) 58 # define _IMPEXP_BE __declspec(dllimport) 59 # define _IMPEXP_MEDIA __declspec(dllimport) 60 # define _IMPEXP_TRACKER __declspec(dllimport) 61 # define _IMPEXP_TRANSLATION __declspec(dllimport) 62 # define _IMPEXP_DEVICE __declspec(dllimport) 63 #endif 64 65 #ifdef __cplusplus 66 class BBuffer; 67 class BBufferConsumer; 68 class BBufferGroup; 69 class BContinuousParameter; 70 class BControllable; 71 class BFileInterface; 72 class BMimeType; 73 class BParameterWeb; 74 class BRegion; 75 class BTextView; 76 class BTranslator; 77 class BTimeSource; 78 struct entry_ref; 79 struct media_node; 80 #endif 81 82 #ifdef __cplusplus 83 extern "C" { 84 #endif 85 86 extern int32 atomic_set(vint32 *value, int32 newValue); 87 extern int32 atomic_test_and_set(vint32 *value, int32 newValue, 88 int32 testAgainst); 89 extern int32 atomic_get(vint32 *value); 90 extern int64 atomic_set64(vint64 *value, int64 newValue); 91 extern int64 atomic_test_and_set64(vint64 *value, int64 newValue, 92 int64 testAgainst); 93 extern int64 atomic_get64(vint64 *value); 94 extern int64 atomic_add64(vint64 *value, int64 addValue); 95 extern int64 atomic_and64(vint64 *value, int64 andValue); 96 extern int64 atomic_or64(vint64 *value, int64 orValue); 97 98 extern size_t strnlen(const char *string, size_t count); 99 100 extern size_t strlcat(char *dest, const char *source, size_t length); 101 extern size_t strlcpy(char *dest, const char *source, size_t length); 102 103 extern char *strcasestr(const char *string, const char *searchString); 104 105 extern float roundf(float value); 106 107 #ifdef __cplusplus 108 } 109 #endif 110 111 // These are R1-specific extensions 112 #ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST 113 # define B_TRANSLATION_MAKE_VERSION(major,minor,revision) ((major << 8) | ((minor << 4) & 0xf0) | (revision & 0x0f)) 114 # define B_TRANSLATION_MAJOR_VERSION(v) (v >> 8) 115 # define B_TRANSLATION_MINOR_VERSION(v) ((v >> 4) & 0xf) 116 # define B_TRANSLATION_REVISION_VERSION(v) (v & 0xf) 117 # define B_LARGE_ICON_TYPE 'ICON' 118 # define B_MINI_ICON_TYPE 'MICN' 119 # define B_VECTOR_ICON_TYPE 'VICN' 120 # define B_BITMAP_NO_SERVER_LINK 0 121 #endif // HAIKU_TARGET_PLATFORM_LIBBE_TEST 122 123 #if defined(HAIKU_TARGET_PLATFORM_BEOS) || defined(HAIKU_TARGET_PLATFORM_BONE) 124 # define B_REDO 'REDO' 125 # define B_BAD_DATA (B_NOT_ALLOWED + 1) 126 # define B_DOCUMENT_BACKGROUND_COLOR B_PANEL_BACKGROUND_COLOR 127 # define B_DOCUMENT_TEXT_COLOR B_MENU_ITEM_TEXT_COLOR 128 #endif 129 130 #if !defined(HAIKU_TARGET_PLATFORM_HAIKU) && !defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) 131 #ifndef B_VECTOR_ICON_TYPE 132 #define B_VECTOR_ICON_TYPE 'VICN' 133 #endif 134 #endif 135 136 #if defined(HAIKU_TARGET_PLATFORM_BONE) || defined(HAIKU_TARGET_PLATFORM_DANO) 137 # define IF_NAMESIZE IFNAMSIZ 138 # define ifc_value ifc_val 139 # define IFF_AUTO_CONFIGURED 0 140 #endif 141 142 #ifndef INT64_MAX 143 #include <limits.h> 144 #define INT64_MAX LONGLONG_MAX 145 #endif 146 147 #define B_MPEG_2_AUDIO_LAYER_1 (enum mpeg_id)0x201 148 #define B_MPEG_2_AUDIO_LAYER_2 (enum mpeg_id)0x202 149 #define B_MPEG_2_AUDIO_LAYER_3 (enum mpeg_id)0x203 150 #define B_MPEG_2_VIDEO (enum mpeg_id)0x211 151 #define B_MPEG_2_5_AUDIO_LAYER_1 (enum mpeg_id)0x301 152 #define B_MPEG_2_5_AUDIO_LAYER_2 (enum mpeg_id)0x302 153 #define B_MPEG_2_5_AUDIO_LAYER_3 (enum mpeg_id)0x303 154 155 // TODO: experimental API (keep in sync with Accelerant.h) 156 typedef struct { 157 uint32 version; 158 char vendor[128]; 159 char name[128]; 160 char serial_number[128]; 161 uint32 product_id; 162 struct { 163 uint16 week; 164 uint16 year; 165 } produced; 166 float width; 167 float height; 168 uint32 min_horizontal_frequency; // in kHz 169 uint32 max_horizontal_frequency; 170 uint32 min_vertical_frequency; // in Hz 171 uint32 max_vertical_frequency; 172 uint32 max_pixel_clock; // in kHz 173 } monitor_info; 174 175 176 #endif // HAIKU_BUILD_COMPATIBILITY_H 177 178