Patch by Scott:
Make sure the comments are C style in headers that are included by POSIX headers. Thanks! Should fix #2870. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28598 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+46
-46
@@ -110,9 +110,9 @@ typedef struct port_info {
|
|||||||
port_id port;
|
port_id port;
|
||||||
team_id team;
|
team_id team;
|
||||||
char name[B_OS_NAME_LENGTH];
|
char name[B_OS_NAME_LENGTH];
|
||||||
int32 capacity; // queue depth
|
int32 capacity; /* queue depth */
|
||||||
int32 queue_count; // # msgs waiting to be read
|
int32 queue_count; /* # msgs waiting to be read */
|
||||||
int32 total_count; // total # msgs read so far
|
int32 total_count; /* total # msgs read so far */
|
||||||
} port_info;
|
} port_info;
|
||||||
|
|
||||||
extern port_id create_port(int32 capacity, const char *name);
|
extern port_id create_port(int32 capacity, const char *name);
|
||||||
@@ -142,8 +142,8 @@ extern status_t _get_next_port_info(team_id team, int32 *cookie, port_info *port
|
|||||||
_get_next_port_info((team), (cookie), (info), sizeof(*(info)))
|
_get_next_port_info((team), (cookie), (info), sizeof(*(info)))
|
||||||
|
|
||||||
|
|
||||||
// WARNING: The following is Haiku experimental API. It might be removed or
|
/* WARNING: The following is Haiku experimental API. It might be removed or
|
||||||
// changed in the future.
|
changed in the future. */
|
||||||
|
|
||||||
typedef struct port_message_info {
|
typedef struct port_message_info {
|
||||||
size_t size;
|
size_t size;
|
||||||
@@ -152,7 +152,7 @@ typedef struct port_message_info {
|
|||||||
team_id sender_team;
|
team_id sender_team;
|
||||||
} port_message_info;
|
} port_message_info;
|
||||||
|
|
||||||
// similar to port_buffer_size_etc(), but returns (more) info
|
/* similar to port_buffer_size_etc(), but returns (more) info */
|
||||||
extern status_t _get_port_message_info_etc(port_id port,
|
extern status_t _get_port_message_info_etc(port_id port,
|
||||||
port_message_info *info, size_t infoSize, uint32 flags,
|
port_message_info *info, size_t infoSize, uint32 flags,
|
||||||
bigtime_t timeout);
|
bigtime_t timeout);
|
||||||
@@ -174,21 +174,21 @@ typedef struct sem_info {
|
|||||||
|
|
||||||
/* semaphore flags */
|
/* semaphore flags */
|
||||||
enum {
|
enum {
|
||||||
B_CAN_INTERRUPT = 0x01, // acquisition of the semaphore can be
|
B_CAN_INTERRUPT = 0x01, /* acquisition of the semaphore can be
|
||||||
// interrupted (system use only)
|
interrupted (system use only) */
|
||||||
B_CHECK_PERMISSION = 0x04, // ownership will be checked (system use
|
B_CHECK_PERMISSION = 0x04, /* ownership will be checked (system use
|
||||||
// only)
|
only) */
|
||||||
B_KILL_CAN_INTERRUPT = 0x20, // acquisition of the semaphore can be
|
B_KILL_CAN_INTERRUPT = 0x20, /* acquisition of the semaphore can be
|
||||||
// interrupted by SIGKILL[THR], even
|
interrupted by SIGKILL[THR], even
|
||||||
// if not B_CAN_INTERRUPT (system use
|
if not B_CAN_INTERRUPT (system use
|
||||||
// only)
|
only) */
|
||||||
|
|
||||||
/* release_sem_etc() only flags */
|
/* release_sem_etc() only flags */
|
||||||
B_DO_NOT_RESCHEDULE = 0x02, // thread is not rescheduled
|
B_DO_NOT_RESCHEDULE = 0x02, /* thread is not rescheduled */
|
||||||
B_RELEASE_ALL = 0x08, // all waiting threads will be woken up,
|
B_RELEASE_ALL = 0x08, /* all waiting threads will be woken up,
|
||||||
// count will be zeroed
|
count will be zeroed */
|
||||||
B_RELEASE_IF_WAITING_ONLY = 0x10 // release count only if there are any
|
B_RELEASE_IF_WAITING_ONLY = 0x10 /* release count only if there are any
|
||||||
// threads waiting
|
threads waiting */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern sem_id create_sem(int32 count, const char *name);
|
extern sem_id create_sem(int32 count, const char *name);
|
||||||
@@ -197,8 +197,8 @@ extern status_t acquire_sem(sem_id id);
|
|||||||
extern status_t acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout);
|
extern status_t acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout);
|
||||||
extern status_t release_sem(sem_id id);
|
extern status_t release_sem(sem_id id);
|
||||||
extern status_t release_sem_etc(sem_id id, int32 count, uint32 flags);
|
extern status_t release_sem_etc(sem_id id, int32 count, uint32 flags);
|
||||||
// ToDo: the following two calls are not part of the BeOS API, and might be
|
/* ToDo: the following two calls are not part of the BeOS API, and might be
|
||||||
// changed or even removed for the final release of Haiku R1
|
changed or even removed for the final release of Haiku R1 */
|
||||||
extern status_t switch_sem(sem_id semToBeReleased, sem_id id);
|
extern status_t switch_sem(sem_id semToBeReleased, sem_id id);
|
||||||
extern status_t switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count,
|
extern status_t switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count,
|
||||||
uint32 flags, bigtime_t timeout);
|
uint32 flags, bigtime_t timeout);
|
||||||
@@ -382,7 +382,7 @@ extern void debugger(const char *message);
|
|||||||
*/
|
*/
|
||||||
extern int disable_debugger(int state);
|
extern int disable_debugger(int state);
|
||||||
|
|
||||||
// TODO: Remove. Temporary debug helper.
|
/* TODO: Remove. Temporary debug helper. */
|
||||||
extern void debug_printf(const char *format, ...)
|
extern void debug_printf(const char *format, ...)
|
||||||
__attribute__ ((format (__printf__, 1, 2)));
|
__attribute__ ((format (__printf__, 1, 2)));
|
||||||
extern void debug_vprintf(const char *format, va_list args);
|
extern void debug_vprintf(const char *format, va_list args);
|
||||||
@@ -410,7 +410,7 @@ extern void ktrace_vprintf(const char *format, va_list args);
|
|||||||
#define OBOS_CPU_TYPES
|
#define OBOS_CPU_TYPES
|
||||||
|
|
||||||
typedef enum cpu_types {
|
typedef enum cpu_types {
|
||||||
// ToDo: add latest models
|
/* ToDo: add latest models */
|
||||||
|
|
||||||
/* Motorola/IBM */
|
/* Motorola/IBM */
|
||||||
B_CPU_PPC_UNKNOWN = 0,
|
B_CPU_PPC_UNKNOWN = 0,
|
||||||
@@ -708,7 +708,7 @@ extern int32 is_computer_on(void);
|
|||||||
extern double is_computer_on_fire(void);
|
extern double is_computer_on_fire(void);
|
||||||
|
|
||||||
|
|
||||||
// WARNING: Experimental API!
|
/* WARNING: Experimental API! */
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
B_OBJECT_TYPE_FD = 0,
|
B_OBJECT_TYPE_FD = 0,
|
||||||
@@ -718,35 +718,35 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
B_EVENT_READ = 0x0001, // FD/port readable
|
B_EVENT_READ = 0x0001, /* FD/port readable */
|
||||||
B_EVENT_WRITE = 0x0002, // FD/port writable
|
B_EVENT_WRITE = 0x0002, /* FD/port writable */
|
||||||
B_EVENT_ERROR = 0x0004, // FD error
|
B_EVENT_ERROR = 0x0004, /* FD error */
|
||||||
B_EVENT_PRIORITY_READ = 0x0008, // FD priority readable
|
B_EVENT_PRIORITY_READ = 0x0008, /* FD priority readable */
|
||||||
B_EVENT_PRIORITY_WRITE = 0x0010, // FD priority writable
|
B_EVENT_PRIORITY_WRITE = 0x0010, /* FD priority writable */
|
||||||
B_EVENT_HIGH_PRIORITY_READ = 0x0020, // FD high priority readable
|
B_EVENT_HIGH_PRIORITY_READ = 0x0020, /* FD high priority readable */
|
||||||
B_EVENT_HIGH_PRIORITY_WRITE = 0x0040, // FD high priority writable
|
B_EVENT_HIGH_PRIORITY_WRITE = 0x0040, /* FD high priority writable */
|
||||||
B_EVENT_DISCONNECTED = 0x0080, // FD disconnected
|
B_EVENT_DISCONNECTED = 0x0080, /* FD disconnected */
|
||||||
|
|
||||||
B_EVENT_ACQUIRE_SEMAPHORE = 0x0001, // semaphore can be acquired
|
B_EVENT_ACQUIRE_SEMAPHORE = 0x0001, /* semaphore can be acquired */
|
||||||
|
|
||||||
B_EVENT_INVALID = 0x1000 // FD/port/sem/thread ID not or
|
B_EVENT_INVALID = 0x1000 /* FD/port/sem/thread ID not or
|
||||||
// no longer valid (e.g. has been
|
no longer valid (e.g. has been
|
||||||
// close/deleted)
|
close/deleted) */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct object_wait_info {
|
typedef struct object_wait_info {
|
||||||
int32 object; // ID of the object
|
int32 object; /* ID of the object */
|
||||||
uint16 type; // type of the object
|
uint16 type; /* type of the object */
|
||||||
uint16 events; // events mask
|
uint16 events; /* events mask */
|
||||||
} object_wait_info;
|
} object_wait_info;
|
||||||
|
|
||||||
// wait_for_objects[_etc]() waits until at least one of the specified events or,
|
/* wait_for_objects[_etc]() waits until at least one of the specified events or,
|
||||||
// if given, the timeout occurred. When entering the function the
|
if given, the timeout occurred. When entering the function the
|
||||||
// object_wait_info::events field specifies the events for each object the
|
object_wait_info::events field specifies the events for each object the
|
||||||
// caller is interested in. When the function returns the fields reflect the
|
caller is interested in. When the function returns the fields reflect the
|
||||||
// events that actually occurred. The events B_EVENT_INVALID, B_EVENT_ERROR,
|
events that actually occurred. The events B_EVENT_INVALID, B_EVENT_ERROR,
|
||||||
// and B_EVENT_DISCONNECTED don't need to be specified. They will always be
|
and B_EVENT_DISCONNECTED don't need to be specified. They will always be
|
||||||
// reported, when they occur.
|
reported, when they occur. */
|
||||||
|
|
||||||
extern ssize_t wait_for_objects(object_wait_info* infos, int numInfos);
|
extern ssize_t wait_for_objects(object_wait_info* infos, int numInfos);
|
||||||
extern ssize_t wait_for_objects_etc(object_wait_info* infos, int numInfos,
|
extern ssize_t wait_for_objects_etc(object_wait_info* infos, int numInfos,
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
// Per volume directories
|
/* Per volume directories */
|
||||||
B_DESKTOP_DIRECTORY = 0,
|
B_DESKTOP_DIRECTORY = 0,
|
||||||
B_TRASH_DIRECTORY,
|
B_TRASH_DIRECTORY,
|
||||||
|
|
||||||
// System directories
|
/* System directories */
|
||||||
B_BEOS_DIRECTORY = 1000,
|
B_BEOS_DIRECTORY = 1000,
|
||||||
B_BEOS_SYSTEM_DIRECTORY,
|
B_BEOS_SYSTEM_DIRECTORY,
|
||||||
B_BEOS_ADDONS_DIRECTORY,
|
B_BEOS_ADDONS_DIRECTORY,
|
||||||
@@ -32,7 +32,7 @@ typedef enum {
|
|||||||
B_BEOS_SOUNDS_DIRECTORY,
|
B_BEOS_SOUNDS_DIRECTORY,
|
||||||
B_BEOS_DATA_DIRECTORY,
|
B_BEOS_DATA_DIRECTORY,
|
||||||
|
|
||||||
// Common directories, shared among all users.
|
/* Common directories, shared among all users. */
|
||||||
B_COMMON_DIRECTORY = 2000,
|
B_COMMON_DIRECTORY = 2000,
|
||||||
B_COMMON_SYSTEM_DIRECTORY,
|
B_COMMON_SYSTEM_DIRECTORY,
|
||||||
B_COMMON_ADDONS_DIRECTORY,
|
B_COMMON_ADDONS_DIRECTORY,
|
||||||
@@ -55,8 +55,8 @@ typedef enum {
|
|||||||
B_COMMON_DATA_DIRECTORY,
|
B_COMMON_DATA_DIRECTORY,
|
||||||
|
|
||||||
|
|
||||||
// User directories. These are interpreted in the context
|
/* User directories. These are interpreted in the context
|
||||||
// of the user making the find_directory call.
|
of the user making the find_directory call. */
|
||||||
B_USER_DIRECTORY = 3000,
|
B_USER_DIRECTORY = 3000,
|
||||||
B_USER_CONFIG_DIRECTORY,
|
B_USER_CONFIG_DIRECTORY,
|
||||||
B_USER_ADDONS_DIRECTORY,
|
B_USER_ADDONS_DIRECTORY,
|
||||||
@@ -72,7 +72,7 @@ typedef enum {
|
|||||||
B_USER_DATA_DIRECTORY,
|
B_USER_DATA_DIRECTORY,
|
||||||
B_USER_CACHE_DIRECTORY,
|
B_USER_CACHE_DIRECTORY,
|
||||||
|
|
||||||
// Global directories.
|
/* Global directories. */
|
||||||
B_APPS_DIRECTORY = 4000,
|
B_APPS_DIRECTORY = 4000,
|
||||||
B_PREFERENCES_DIRECTORY,
|
B_PREFERENCES_DIRECTORY,
|
||||||
B_UTILITIES_DIRECTORY
|
B_UTILITIES_DIRECTORY
|
||||||
@@ -83,7 +83,7 @@ typedef enum {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// C interface
|
/* C interface */
|
||||||
|
|
||||||
status_t find_directory(directory_which which, dev_t volume, bool createIt,
|
status_t find_directory(directory_which which, dev_t volume, bool createIt,
|
||||||
char* pathString, int32 length);
|
char* pathString, int32 length);
|
||||||
@@ -91,7 +91,7 @@ status_t find_directory(directory_which which, dev_t volume, bool createIt,
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
||||||
// C++ interface
|
/* C++ interface */
|
||||||
|
|
||||||
class BVolume;
|
class BVolume;
|
||||||
class BPath;
|
class BPath;
|
||||||
@@ -99,6 +99,6 @@ class BPath;
|
|||||||
status_t find_directory(directory_which which, BPath* path,
|
status_t find_directory(directory_which which, BPath* path,
|
||||||
bool createIt = false, BVolume* volume = NULL);
|
bool createIt = false, BVolume* volume = NULL);
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif // _FIND_DIRECTORY_H
|
#endif /* _FIND_DIRECTORY_H */
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ enum icon_size {
|
|||||||
B_MINI_ICON = 16
|
B_MINI_ICON = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
// values for the "force" parameter of update_mime_info() (Haiku only)
|
/* values for the "force" parameter of update_mime_info() (Haiku only) */
|
||||||
enum {
|
enum {
|
||||||
B_UPDATE_MIME_INFO_NO_FORCE = 0,
|
B_UPDATE_MIME_INFO_NO_FORCE = 0,
|
||||||
B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE = 1,
|
B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE = 1,
|
||||||
@@ -27,7 +27,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// C functions
|
/* C functions */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -42,7 +42,7 @@ status_t get_device_icon(const char* device, void* icon, int32 size);
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
||||||
// C++ functions, Haiku only!
|
/* C++ functions, Haiku only! */
|
||||||
|
|
||||||
class BBitmap;
|
class BBitmap;
|
||||||
|
|
||||||
@@ -54,8 +54,8 @@ status_t get_named_icon(const char* name, BBitmap* icon, icon_size which);
|
|||||||
status_t get_named_icon(const char* name, uint8** _data, size_t* _size,
|
status_t get_named_icon(const char* name, uint8** _data, size_t* _size,
|
||||||
type_code* _type);
|
type_code* _type);
|
||||||
|
|
||||||
// include MimeType.h for convenience
|
/* include MimeType.h for convenience */
|
||||||
# include <MimeType.h>
|
# include <MimeType.h>
|
||||||
#endif // __cplusplus
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif // _MIME_H
|
#endif /* _MIME_H */
|
||||||
|
|||||||
@@ -10,10 +10,10 @@
|
|||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include <TypeConstants.h>
|
#include <TypeConstants.h>
|
||||||
// for convenience
|
/* for convenience */
|
||||||
|
|
||||||
|
|
||||||
// swap directions
|
/* swap directions */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
B_SWAP_HOST_TO_LENDIAN,
|
B_SWAP_HOST_TO_LENDIAN,
|
||||||
B_SWAP_HOST_TO_BENDIAN,
|
B_SWAP_HOST_TO_BENDIAN,
|
||||||
@@ -23,7 +23,7 @@ typedef enum {
|
|||||||
} swap_action;
|
} swap_action;
|
||||||
|
|
||||||
|
|
||||||
// BSD/networking macros
|
/* BSD/networking macros */
|
||||||
#ifndef htonl
|
#ifndef htonl
|
||||||
# define htonl(x) B_HOST_TO_BENDIAN_INT32(x)
|
# define htonl(x) B_HOST_TO_BENDIAN_INT32(x)
|
||||||
# define ntohl(x) B_BENDIAN_TO_HOST_INT32(x)
|
# define ntohl(x) B_BENDIAN_TO_HOST_INT32(x)
|
||||||
@@ -31,7 +31,7 @@ typedef enum {
|
|||||||
# define ntohs(x) B_BENDIAN_TO_HOST_INT16(x)
|
# define ntohs(x) B_BENDIAN_TO_HOST_INT16(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// always swap macros
|
/* always swap macros */
|
||||||
#define B_SWAP_DOUBLE(arg) __swap_double(arg)
|
#define B_SWAP_DOUBLE(arg) __swap_double(arg)
|
||||||
#define B_SWAP_FLOAT(arg) __swap_float(arg)
|
#define B_SWAP_FLOAT(arg) __swap_float(arg)
|
||||||
#define B_SWAP_INT64(arg) __swap_int64(arg)
|
#define B_SWAP_INT64(arg) __swap_int64(arg)
|
||||||
@@ -39,74 +39,74 @@ typedef enum {
|
|||||||
#define B_SWAP_INT16(arg) __swap_int16(arg)
|
#define B_SWAP_INT16(arg) __swap_int16(arg)
|
||||||
|
|
||||||
#if BYTE_ORDER == __LITTLE_ENDIAN
|
#if BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
// Host is little endian
|
/* Host is little endian */
|
||||||
|
|
||||||
#define B_HOST_IS_LENDIAN 1
|
#define B_HOST_IS_LENDIAN 1
|
||||||
#define B_HOST_IS_BENDIAN 0
|
#define B_HOST_IS_BENDIAN 0
|
||||||
|
|
||||||
// Host native to little endian
|
/* Host native to little endian */
|
||||||
#define B_HOST_TO_LENDIAN_DOUBLE(arg) (double)(arg)
|
#define B_HOST_TO_LENDIAN_DOUBLE(arg) (double)(arg)
|
||||||
#define B_HOST_TO_LENDIAN_FLOAT(arg) (float)(arg)
|
#define B_HOST_TO_LENDIAN_FLOAT(arg) (float)(arg)
|
||||||
#define B_HOST_TO_LENDIAN_INT64(arg) (uint64)(arg)
|
#define B_HOST_TO_LENDIAN_INT64(arg) (uint64)(arg)
|
||||||
#define B_HOST_TO_LENDIAN_INT32(arg) (uint32)(arg)
|
#define B_HOST_TO_LENDIAN_INT32(arg) (uint32)(arg)
|
||||||
#define B_HOST_TO_LENDIAN_INT16(arg) (uint16)(arg)
|
#define B_HOST_TO_LENDIAN_INT16(arg) (uint16)(arg)
|
||||||
|
|
||||||
// Little endian to host native
|
/* Little endian to host native */
|
||||||
#define B_LENDIAN_TO_HOST_DOUBLE(arg) (double)(arg)
|
#define B_LENDIAN_TO_HOST_DOUBLE(arg) (double)(arg)
|
||||||
#define B_LENDIAN_TO_HOST_FLOAT(arg) (float)(arg)
|
#define B_LENDIAN_TO_HOST_FLOAT(arg) (float)(arg)
|
||||||
#define B_LENDIAN_TO_HOST_INT64(arg) (uint64)(arg)
|
#define B_LENDIAN_TO_HOST_INT64(arg) (uint64)(arg)
|
||||||
#define B_LENDIAN_TO_HOST_INT32(arg) (uint32)(arg)
|
#define B_LENDIAN_TO_HOST_INT32(arg) (uint32)(arg)
|
||||||
#define B_LENDIAN_TO_HOST_INT16(arg) (uint16)(arg)
|
#define B_LENDIAN_TO_HOST_INT16(arg) (uint16)(arg)
|
||||||
|
|
||||||
// Host native to big endian
|
/* Host native to big endian */
|
||||||
#define B_HOST_TO_BENDIAN_DOUBLE(arg) __swap_double(arg)
|
#define B_HOST_TO_BENDIAN_DOUBLE(arg) __swap_double(arg)
|
||||||
#define B_HOST_TO_BENDIAN_FLOAT(arg) __swap_float(arg)
|
#define B_HOST_TO_BENDIAN_FLOAT(arg) __swap_float(arg)
|
||||||
#define B_HOST_TO_BENDIAN_INT64(arg) __swap_int64(arg)
|
#define B_HOST_TO_BENDIAN_INT64(arg) __swap_int64(arg)
|
||||||
#define B_HOST_TO_BENDIAN_INT32(arg) __swap_int32(arg)
|
#define B_HOST_TO_BENDIAN_INT32(arg) __swap_int32(arg)
|
||||||
#define B_HOST_TO_BENDIAN_INT16(arg) __swap_int16(arg)
|
#define B_HOST_TO_BENDIAN_INT16(arg) __swap_int16(arg)
|
||||||
|
|
||||||
// Big endian to host native
|
/* Big endian to host native */
|
||||||
#define B_BENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg)
|
#define B_BENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg)
|
||||||
#define B_BENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg)
|
#define B_BENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg)
|
||||||
#define B_BENDIAN_TO_HOST_INT64(arg) __swap_int64(arg)
|
#define B_BENDIAN_TO_HOST_INT64(arg) __swap_int64(arg)
|
||||||
#define B_BENDIAN_TO_HOST_INT32(arg) __swap_int32(arg)
|
#define B_BENDIAN_TO_HOST_INT32(arg) __swap_int32(arg)
|
||||||
#define B_BENDIAN_TO_HOST_INT16(arg) __swap_int16(arg)
|
#define B_BENDIAN_TO_HOST_INT16(arg) __swap_int16(arg)
|
||||||
|
|
||||||
#else // BYTE_ORDER
|
#else /* BYTE_ORDER */
|
||||||
// Host is big endian
|
/* Host is big endian */
|
||||||
|
|
||||||
#define B_HOST_IS_LENDIAN 0
|
#define B_HOST_IS_LENDIAN 0
|
||||||
#define B_HOST_IS_BENDIAN 1
|
#define B_HOST_IS_BENDIAN 1
|
||||||
|
|
||||||
// Host native to little endian
|
/* Host native to little endian */
|
||||||
#define B_HOST_TO_LENDIAN_DOUBLE(arg) __swap_double(arg)
|
#define B_HOST_TO_LENDIAN_DOUBLE(arg) __swap_double(arg)
|
||||||
#define B_HOST_TO_LENDIAN_FLOAT(arg) __swap_float(arg)
|
#define B_HOST_TO_LENDIAN_FLOAT(arg) __swap_float(arg)
|
||||||
#define B_HOST_TO_LENDIAN_INT64(arg) __swap_int64(arg)
|
#define B_HOST_TO_LENDIAN_INT64(arg) __swap_int64(arg)
|
||||||
#define B_HOST_TO_LENDIAN_INT32(arg) __swap_int32(arg)
|
#define B_HOST_TO_LENDIAN_INT32(arg) __swap_int32(arg)
|
||||||
#define B_HOST_TO_LENDIAN_INT16(arg) __swap_int16(arg)
|
#define B_HOST_TO_LENDIAN_INT16(arg) __swap_int16(arg)
|
||||||
|
|
||||||
// Little endian to host native
|
/* Little endian to host native */
|
||||||
#define B_LENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg)
|
#define B_LENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg)
|
||||||
#define B_LENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg)
|
#define B_LENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg)
|
||||||
#define B_LENDIAN_TO_HOST_INT64(arg) __swap_int64(arg)
|
#define B_LENDIAN_TO_HOST_INT64(arg) __swap_int64(arg)
|
||||||
#define B_LENDIAN_TO_HOST_INT32(arg) __swap_int32(arg)
|
#define B_LENDIAN_TO_HOST_INT32(arg) __swap_int32(arg)
|
||||||
#define B_LENDIAN_TO_HOST_INT16(arg) __swap_int16(arg)
|
#define B_LENDIAN_TO_HOST_INT16(arg) __swap_int16(arg)
|
||||||
|
|
||||||
// Host native to big endian
|
/* Host native to big endian */
|
||||||
#define B_HOST_TO_BENDIAN_DOUBLE(arg) (double)(arg)
|
#define B_HOST_TO_BENDIAN_DOUBLE(arg) (double)(arg)
|
||||||
#define B_HOST_TO_BENDIAN_FLOAT(arg) (float)(arg)
|
#define B_HOST_TO_BENDIAN_FLOAT(arg) (float)(arg)
|
||||||
#define B_HOST_TO_BENDIAN_INT64(arg) (uint64)(arg)
|
#define B_HOST_TO_BENDIAN_INT64(arg) (uint64)(arg)
|
||||||
#define B_HOST_TO_BENDIAN_INT32(arg) (uint32)(arg)
|
#define B_HOST_TO_BENDIAN_INT32(arg) (uint32)(arg)
|
||||||
#define B_HOST_TO_BENDIAN_INT16(arg) (uint16)(arg)
|
#define B_HOST_TO_BENDIAN_INT16(arg) (uint16)(arg)
|
||||||
|
|
||||||
// Big endian to host native
|
/* Big endian to host native */
|
||||||
#define B_BENDIAN_TO_HOST_DOUBLE(arg) (double)(arg)
|
#define B_BENDIAN_TO_HOST_DOUBLE(arg) (double)(arg)
|
||||||
#define B_BENDIAN_TO_HOST_FLOAT(arg) (float)(arg)
|
#define B_BENDIAN_TO_HOST_FLOAT(arg) (float)(arg)
|
||||||
#define B_BENDIAN_TO_HOST_INT64(arg) (uint64)(arg)
|
#define B_BENDIAN_TO_HOST_INT64(arg) (uint64)(arg)
|
||||||
#define B_BENDIAN_TO_HOST_INT32(arg) (uint32)(arg)
|
#define B_BENDIAN_TO_HOST_INT32(arg) (uint32)(arg)
|
||||||
#define B_BENDIAN_TO_HOST_INT16(arg) (uint16)(arg)
|
#define B_BENDIAN_TO_HOST_INT16(arg) (uint16)(arg)
|
||||||
|
|
||||||
#endif // BYTE_ORDER
|
#endif /* BYTE_ORDER */
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -118,7 +118,7 @@ extern status_t swap_data(type_code type, void *data, size_t length,
|
|||||||
extern bool is_type_swapped(type_code type);
|
extern bool is_type_swapped(type_code type);
|
||||||
|
|
||||||
|
|
||||||
// Private implementations
|
/* Private implementations */
|
||||||
extern double __swap_double(double arg);
|
extern double __swap_double(double arg);
|
||||||
extern float __swap_float(float arg);
|
extern float __swap_float(float arg);
|
||||||
extern uint64 __swap_int64(uint64 arg);
|
extern uint64 __swap_int64(uint64 arg);
|
||||||
@@ -129,4 +129,4 @@ extern uint16 __swap_int16(uint16 arg);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _BYTEORDER_H
|
#endif /* _BYTEORDER_H */
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ typedef unsigned short ushort;
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
||||||
// Shorthand type formats
|
/* Shorthand type formats */
|
||||||
typedef signed char int8;
|
typedef signed char int8;
|
||||||
typedef unsigned char uint8;
|
typedef unsigned char uint8;
|
||||||
typedef volatile signed char vint8;
|
typedef volatile signed char vint8;
|
||||||
@@ -57,20 +57,20 @@ typedef unsigned char uchar;
|
|||||||
typedef unsigned short unichar;
|
typedef unsigned short unichar;
|
||||||
|
|
||||||
|
|
||||||
// Descriptive formats
|
/* Descriptive formats */
|
||||||
typedef int32 status_t;
|
typedef int32 status_t;
|
||||||
typedef int64 bigtime_t;
|
typedef int64 bigtime_t;
|
||||||
typedef uint32 type_code;
|
typedef uint32 type_code;
|
||||||
typedef uint32 perform_code;
|
typedef uint32 perform_code;
|
||||||
|
|
||||||
|
|
||||||
// Empty string ("")
|
/* Empty string ("") */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern const char *B_EMPTY_STRING;
|
extern const char *B_EMPTY_STRING;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// min and max comparisons
|
/* min and max comparisons */
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
# ifndef min
|
# ifndef min
|
||||||
# define min(a,b) ((a)>(b)?(b):(a))
|
# define min(a,b) ((a)>(b)?(b):(a))
|
||||||
@@ -80,12 +80,12 @@ extern const char *B_EMPTY_STRING;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// min() and max() won't work in C++
|
/* min() and max() won't work in C++ */
|
||||||
#define min_c(a,b) ((a)>(b)?(b):(a))
|
#define min_c(a,b) ((a)>(b)?(b):(a))
|
||||||
#define max_c(a,b) ((a)>(b)?(a):(b))
|
#define max_c(a,b) ((a)>(b)?(a):(b))
|
||||||
|
|
||||||
|
|
||||||
// Grandfathering
|
/* Grandfathering */
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -99,7 +99,7 @@ extern const char *B_EMPTY_STRING;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Atomic functions; previous value is returned
|
/* Atomic functions; previous value is returned */
|
||||||
extern int32 atomic_set(vint32 *value, int32 newValue);
|
extern int32 atomic_set(vint32 *value, int32 newValue);
|
||||||
extern int32 atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst);
|
extern int32 atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst);
|
||||||
extern int32 atomic_add(vint32 *value, int32 addValue);
|
extern int32 atomic_add(vint32 *value, int32 addValue);
|
||||||
@@ -114,16 +114,16 @@ extern int64 atomic_and64(vint64 *value, int64 andValue);
|
|||||||
extern int64 atomic_or64(vint64 *value, int64 orValue);
|
extern int64 atomic_or64(vint64 *value, int64 orValue);
|
||||||
extern int64 atomic_get64(vint64 *value);
|
extern int64 atomic_get64(vint64 *value);
|
||||||
|
|
||||||
// Other stuff
|
/* Other stuff */
|
||||||
extern void* get_stack_frame(void);
|
extern void* get_stack_frame(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Obsolete or discouraged API
|
/* Obsolete or discouraged API */
|
||||||
|
|
||||||
// use 'true' and 'false'
|
/* use 'true' and 'false' */
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
# define FALSE 0
|
# define FALSE 0
|
||||||
#endif
|
#endif
|
||||||
@@ -131,4 +131,4 @@ extern void* get_stack_frame(void);
|
|||||||
# define TRUE 1
|
# define TRUE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _SUPPORT_DEFS_H
|
#endif /* _SUPPORT_DEFS_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user