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 struct sockaddr_storage { 28 uint8 ss_len; /* total length */ 29 uint8 ss_family; /* address family */ 30 uint8 __ss_pad1[6]; /* align to quad */ 31 uint64 __ss_pad2; /* force alignment to 64 bit */ 32 uint8 __ss_pad3[112]; /* pad to a total of 128 bytes */ 33 }; 34 35 typedef int socklen_t; 36 37 #ifndef DEFFILEMODE 38 # define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) 39 #endif 40 41 #ifndef FS_WRITE_FSINFO_NAME 42 # define FS_WRITE_FSINFO_NAME 0x0001 43 #endif 44 45 #ifndef B_CURRENT_TEAM 46 # define B_CURRENT_TEAM 0 47 #endif 48 49 #ifndef SYMLOOP_MAX 50 # define SYMLOOP_MAX (16) 51 #endif 52 53 #ifndef B_FIRST_REAL_TIME_PRIORITY 54 # define B_FIRST_REAL_TIME_PRIORITY B_REAL_TIME_DISPLAY_PRIORITY 55 #endif 56 57 #if __GNUC__ 58 # define _PRINTFLIKE(_format_, _args_) \ 59 __attribute__((format(__printf__, _format_, _args_))) 60 #endif 61 62 #ifdef HAIKU_TARGET_PLATFORM_LIBBE_TEST 63 // BeOS version of BeBuild.h defines this 64 # define _IMPEXP_ROOT __declspec(dllimport) 65 # define _IMPEXP_BE __declspec(dllimport) 66 # define _IMPEXP_MEDIA __declspec(dllimport) 67 # define _IMPEXP_TRACKER __declspec(dllimport) 68 # define _IMPEXP_TRANSLATION __declspec(dllimport) 69 # define _IMPEXP_DEVICE __declspec(dllimport) 70 #endif 71 72 #ifdef __cplusplus 73 class BBuffer; 74 class BBufferConsumer; 75 class BBufferGroup; 76 class BContinuousParameter; 77 class BControllable; 78 class BFileInterface; 79 class BMimeType; 80 class BParameterWeb; 81 class BRegion; 82 class BTextView; 83 class BTranslator; 84 class BTimeSource; 85 struct entry_ref; 86 struct media_node; 87 #endif 88 89 #ifdef __cplusplus 90 extern "C" { 91 #endif 92 93 extern int32 atomic_set(vint32 *value, int32 newValue); 94 extern int32 atomic_test_and_set(vint32 *value, int32 newValue, 95 int32 testAgainst); 96 extern int32 atomic_get(vint32 *value); 97 extern int64 atomic_set64(vint64 *value, int64 newValue); 98 extern int64 atomic_test_and_set64(vint64 *value, int64 newValue, 99 int64 testAgainst); 100 extern int64 atomic_get64(vint64 *value); 101 extern int64 atomic_add64(vint64 *value, int64 addValue); 102 extern int64 atomic_and64(vint64 *value, int64 andValue); 103 extern int64 atomic_or64(vint64 *value, int64 orValue); 104 105 extern size_t strnlen(const char *string, size_t count); 106 107 extern size_t strlcat(char *dest, const char *source, size_t length); 108 extern size_t strlcpy(char *dest, const char *source, size_t length); 109 110 extern char *strcasestr(const char *string, const char *searchString); 111 112 extern float roundf(float value); 113 114 #ifdef __cplusplus 115 } 116 #endif 117 118 // These are R1-specific extensions 119 #ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST 120 # define B_TRANSLATION_MAKE_VERSION(major,minor,revision) ((major << 8) | ((minor << 4) & 0xf0) | (revision & 0x0f)) 121 # define B_TRANSLATION_MAJOR_VERSION(v) (v >> 8) 122 # define B_TRANSLATION_MINOR_VERSION(v) ((v >> 4) & 0xf) 123 # define B_TRANSLATION_REVISION_VERSION(v) (v & 0xf) 124 # define B_LARGE_ICON_TYPE 'ICON' 125 # define B_MINI_ICON_TYPE 'MICN' 126 # define B_VECTOR_ICON_TYPE 'VICN' 127 # define B_BITMAP_NO_SERVER_LINK 0 128 #endif // HAIKU_TARGET_PLATFORM_LIBBE_TEST 129 130 #if defined(HAIKU_TARGET_PLATFORM_BEOS) || defined(HAIKU_TARGET_PLATFORM_BONE) 131 # define B_REDO 'REDO' 132 # define B_BAD_DATA (B_NOT_ALLOWED + 1) 133 # define B_DOCUMENT_BACKGROUND_COLOR B_PANEL_BACKGROUND_COLOR 134 # define B_DOCUMENT_TEXT_COLOR B_MENU_ITEM_TEXT_COLOR 135 #endif 136 137 #if !defined(HAIKU_TARGET_PLATFORM_HAIKU) && !defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) 138 # ifndef B_VECTOR_ICON_TYPE 139 # define B_VECTOR_ICON_TYPE 'VICN' 140 # endif 141 # define B_NOT_SUPPORTED (B_ERROR) 142 # define B_KERNEL_READ_AREA 0 143 # define B_KERNEL_WRITE_AREA 0 144 #endif 145 146 #if defined(HAIKU_TARGET_PLATFORM_BONE) || defined(HAIKU_TARGET_PLATFORM_DANO) 147 # define IF_NAMESIZE IFNAMSIZ 148 # define ifc_value ifc_val 149 # define IFF_AUTO_CONFIGURED 0 150 #endif 151 152 #ifndef INT64_MAX 153 # include <limits.h> 154 # define INT64_MAX LONGLONG_MAX 155 #endif 156 157 #define B_MPEG_2_AUDIO_LAYER_1 (enum mpeg_id)0x201 158 #define B_MPEG_2_AUDIO_LAYER_2 (enum mpeg_id)0x202 159 #define B_MPEG_2_AUDIO_LAYER_3 (enum mpeg_id)0x203 160 #define B_MPEG_2_VIDEO (enum mpeg_id)0x211 161 #define B_MPEG_2_5_AUDIO_LAYER_1 (enum mpeg_id)0x301 162 #define B_MPEG_2_5_AUDIO_LAYER_2 (enum mpeg_id)0x302 163 #define B_MPEG_2_5_AUDIO_LAYER_3 (enum mpeg_id)0x303 164 165 // TODO: experimental API (keep in sync with Accelerant.h) 166 typedef struct { 167 uint32 version; 168 char vendor[128]; 169 char name[128]; 170 char serial_number[128]; 171 uint32 product_id; 172 struct { 173 uint16 week; 174 uint16 year; 175 } produced; 176 float width; 177 float height; 178 uint32 min_horizontal_frequency; // in kHz 179 uint32 max_horizontal_frequency; 180 uint32 min_vertical_frequency; // in Hz 181 uint32 max_vertical_frequency; 182 uint32 max_pixel_clock; // in kHz 183 } monitor_info; 184 185 186 #endif // HAIKU_BUILD_COMPATIBILITY_H 187 188