xref: /haiku/headers/build/HaikuBuildCompatibility.h (revision 6a45488dd93a920bccd174756ad44613d844189c)
1 #ifndef HAIKU_BUILD_COMPATIBILITY_H
2 #define HAIKU_BUILD_COMPATIBILITY_H
3 
4 #include <sys/types.h>
5 #include <SupportDefs.h>
6 
7 #ifdef HAIKU_TARGET_PLATFORM_LIBBE_TEST
8 #	define _BE_ERRNO_H_
9 		// this is what Dano/Zeta is using
10 #	include <Errors.h>
11 #endif
12 
13 #include <string.h>
14 
15 // no addr_t under standard BeOS
16 typedef unsigned long haiku_build_addr_t;
17 #define addr_t haiku_build_addr_t
18 
19 #ifndef DEFFILEMODE
20 #	define	DEFFILEMODE	(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
21 #endif
22 
23 #ifndef FS_WRITE_FSINFO_NAME
24 #	define	FS_WRITE_FSINFO_NAME	0x0001
25 #endif
26 
27 #ifndef B_CURRENT_TEAM
28 #	define B_CURRENT_TEAM	0
29 #endif
30 
31 
32 #ifndef SYMLOOP_MAX
33 #	define SYMLOOP_MAX	(16)
34 #endif
35 
36 #ifndef B_FIRST_REAL_TIME_PRIORITY
37 #	define B_FIRST_REAL_TIME_PRIORITY B_REAL_TIME_DISPLAY_PRIORITY
38 #endif
39 
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 extern int32	atomic_set(vint32 *value, int32 newValue);
46 extern int32	atomic_test_and_set(vint32 *value, int32 newValue,
47 					int32 testAgainst);
48 extern int32	atomic_get(vint32 *value);
49 extern int64	atomic_set64(vint64 *value, int64 newValue);
50 extern int64	atomic_test_and_set64(vint64 *value, int64 newValue,
51 					int64 testAgainst);
52 extern int64	atomic_get64(vint64 *value);
53 extern int64	atomic_add64(vint64 *value, int64 addValue);
54 extern int64	atomic_and64(vint64 *value, int64 andValue);
55 extern int64	atomic_or64(vint64 *value, int64 orValue);
56 
57 extern size_t	strnlen(const char *string, size_t count);
58 
59 extern size_t	strlcat(char *dest, const char *source, size_t length);
60 extern size_t   strlcpy(char *dest, const char *source, size_t length);
61 
62 extern char		*strcasestr(const char *string, const char *searchString);
63 
64 extern float	roundf(float value);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 // These are R1-specific extensions
71 #ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
72 #	define B_TRANSLATION_MAKE_VERSION(major,minor,revision) ((major << 8) | ((minor << 4) & 0xf0) | (revision & 0x0f))
73 #	define B_TRANSLATION_MAJOR_VERSION(v) (v >> 8)
74 #	define B_TRANSLATION_MINOR_VERSION(v) ((v >> 4) & 0xf)
75 #	define B_TRANSLATION_REVISION_VERSION(v) (v & 0xf)
76 #	define B_LARGE_ICON_TYPE		'ICON'
77 #	define B_MINI_ICON_TYPE			'MICN'
78 #	define B_VECTOR_ICON_TYPE		'VICN'
79 #	define B_BITMAP_NO_SERVER_LINK	0
80 #endif	// HAIKU_TARGET_PLATFORM_LIBBE_TEST
81 
82 #if defined(HAIKU_TARGET_PLATFORM_BEOS) || defined(HAIKU_TARGET_PLATFORM_BONE)
83 #	define B_REDO						'REDO'
84 #	define B_BAD_DATA					(B_NOT_ALLOWED + 1)
85 #	define B_DOCUMENT_BACKGROUND_COLOR	B_PANEL_BACKGROUND_COLOR
86 #	define B_DOCUMENT_TEXT_COLOR		B_MENU_ITEM_TEXT_COLOR
87 #endif
88 
89 #if !defined(HAIKU_TARGET_PLATFORM_HAIKU) && !defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST)
90 #ifndef B_VECTOR_ICON_TYPE
91 #define B_VECTOR_ICON_TYPE 'VICN'
92 #endif
93 #endif
94 
95 #ifndef INT64_MAX
96 #include <limits.h>
97 #define INT64_MAX LONGLONG_MAX
98 #endif
99 
100 #define	B_MPEG_2_AUDIO_LAYER_1 (enum mpeg_id)0x201
101 #define	B_MPEG_2_AUDIO_LAYER_2 (enum mpeg_id)0x202
102 #define	B_MPEG_2_AUDIO_LAYER_3 (enum mpeg_id)0x203
103 #define	B_MPEG_2_VIDEO (enum mpeg_id)0x211
104 #define	B_MPEG_2_5_AUDIO_LAYER_1 (enum mpeg_id)0x301
105 #define	B_MPEG_2_5_AUDIO_LAYER_2 (enum mpeg_id)0x302
106 #define	B_MPEG_2_5_AUDIO_LAYER_3 (enum mpeg_id)0x303
107 
108 #endif	// HAIKU_BUILD_COMPATIBILITY_H
109 
110