some header files to be R5 compatible
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1617 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: Beep.h
|
||||
/
|
||||
/ Description: System beep function.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated
|
||||
/
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _BEEP_H
|
||||
#define _BEEP_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
_IMPEXP_BE status_t beep();
|
||||
_IMPEXP_BE status_t system_beep(const char * event_name);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define _BEEP_FLAGS = 0
|
||||
#else
|
||||
#define _BEEP_FLAGS
|
||||
#endif
|
||||
_IMPEXP_BE status_t add_system_beep_event(const char * event_name, uint32 flags _BEEP_FLAGS);
|
||||
|
||||
|
||||
#endif /* _BEEP_H */
|
||||
@@ -0,0 +1,73 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: BufferIO.h
|
||||
/
|
||||
/ Description: A buffered adapter for BPositionIO
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated
|
||||
/
|
||||
******************************************************************************/
|
||||
|
||||
#if !defined(_BUFFER_IO_H)
|
||||
#define _BUFFER_IO_H
|
||||
|
||||
#include <DataIO.h>
|
||||
|
||||
class BBufferIO : public BPositionIO
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
DEFAULT_BUF_SIZE = 65536L
|
||||
};
|
||||
|
||||
BBufferIO(
|
||||
BPositionIO * stream,
|
||||
size_t buf_size = DEFAULT_BUF_SIZE,
|
||||
bool owns_stream = true);
|
||||
virtual ~BBufferIO();
|
||||
|
||||
virtual ssize_t ReadAt(
|
||||
off_t pos,
|
||||
void *buffer,
|
||||
size_t size);
|
||||
virtual ssize_t WriteAt(
|
||||
off_t pos,
|
||||
const void *buffer,
|
||||
size_t size);
|
||||
virtual off_t Seek(
|
||||
off_t position,
|
||||
uint32 seek_mode);
|
||||
virtual off_t Position() const;
|
||||
virtual status_t SetSize(
|
||||
off_t size);
|
||||
virtual status_t Flush();
|
||||
BPositionIO * Stream() const;
|
||||
size_t BufferSize() const;
|
||||
bool OwnsStream() const;
|
||||
void SetOwnsStream(
|
||||
bool owns_stream);
|
||||
|
||||
void PrintToStream() const;
|
||||
|
||||
private:
|
||||
|
||||
off_t m_buffer_start;
|
||||
BPositionIO * m_stream;
|
||||
char * m_buffer;
|
||||
size_t m_buffer_phys;
|
||||
size_t m_buffer_used;
|
||||
uint32 _reserved_ints[6];
|
||||
bool m_buffer_dirty;
|
||||
bool m_owns_stream;
|
||||
bool _reserved_bools[6];
|
||||
|
||||
virtual status_t _Reserved_BufferIO_0(void *);
|
||||
virtual status_t _Reserved_BufferIO_1(void *);
|
||||
virtual status_t _Reserved_BufferIO_2(void *);
|
||||
virtual status_t _Reserved_BufferIO_3(void *);
|
||||
virtual status_t _Reserved_BufferIO_4(void *);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* _BUFFER_IO_H */
|
||||
@@ -0,0 +1,114 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: Debug.h
|
||||
/
|
||||
/ Description: Compile time and runtime switchable debug macros.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated
|
||||
/
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _DEBUG_H
|
||||
#define _DEBUG_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <OS.h>
|
||||
|
||||
/*------------------------------*/
|
||||
/*----- Private... -------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern _IMPEXP_ROOT bool _rtDebugFlag;
|
||||
|
||||
_IMPEXP_ROOT bool _debugFlag();
|
||||
_IMPEXP_ROOT bool _setDebugFlag(bool);
|
||||
|
||||
_IMPEXP_ROOT int _debugPrintf(const char *, ...);
|
||||
_IMPEXP_ROOT int _sPrintf(const char *, ...);
|
||||
_IMPEXP_ROOT int _xdebugPrintf(const char *, ...);
|
||||
_IMPEXP_ROOT int _debuggerAssert(const char *, int, char *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*-------- ...to here ----------*/
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Debug macros ------------------------------------------*/
|
||||
|
||||
|
||||
#if DEBUG
|
||||
#define SET_DEBUG_ENABLED(FLAG) _setDebugFlag(FLAG)
|
||||
#define IS_DEBUG_ENABLED() _debugFlag()
|
||||
|
||||
#define SERIAL_PRINT(ARGS) _sPrintf ARGS
|
||||
#define PRINT(ARGS) _debugPrintf ARGS
|
||||
#define PRINT_OBJECT(OBJ) if (_rtDebugFlag) { \
|
||||
PRINT(("%s\t", #OBJ)); \
|
||||
(OBJ).PrintToStream(); \
|
||||
} ((void) 0)
|
||||
#define TRACE() _debugPrintf("File: %s, Line: %d, Thread: %d\n", \
|
||||
__FILE__, __LINE__, find_thread(NULL))
|
||||
|
||||
#define SERIAL_TRACE() _sPrintf("File: %s, Line: %d, Thread: %d\n", \
|
||||
__FILE__, __LINE__, find_thread(NULL))
|
||||
|
||||
#define DEBUGGER(MSG) if (_rtDebugFlag) debugger(MSG)
|
||||
#if !defined(ASSERT)
|
||||
#define ASSERT(E) (!(E) ? _debuggerAssert(__FILE__,__LINE__, #E) \
|
||||
: (int)0)
|
||||
#endif
|
||||
|
||||
#define ASSERT_WITH_MESSAGE(expr, msg) \
|
||||
(!(expr) ? _debuggerAssert( __FILE__,__LINE__, msg) \
|
||||
: (int)0)
|
||||
|
||||
#define TRESPASS() DEBUGGER("Should not be here");
|
||||
|
||||
#define DEBUG_ONLY(arg) arg
|
||||
|
||||
#else /* DEBUG == 0 */
|
||||
#define SET_DEBUG_ENABLED(FLAG) (void)0
|
||||
#define IS_DEBUG_ENABLED() (void)0
|
||||
|
||||
#define SERIAL_PRINT(ARGS) (void)0
|
||||
#define PRINT(ARGS) (void)0
|
||||
#define PRINT_OBJECT(OBJ) (void)0
|
||||
#define TRACE() (void)0
|
||||
#define SERIAL_TRACE() (void)0
|
||||
|
||||
#define DEBUGGER(MSG) (void)0
|
||||
#if !defined(ASSERT)
|
||||
#define ASSERT(E) (void)0
|
||||
#endif
|
||||
#define ASSERT_WITH_MESSAGE(expr, msg) \
|
||||
(void)0
|
||||
#define TRESPASS() (void)0
|
||||
#define DEBUG_ONLY(x)
|
||||
#endif
|
||||
|
||||
|
||||
#if !__MWERKS__
|
||||
// STATIC_ASSERT is a compile-time check that can be used to
|
||||
// verify static expressions such as: STATIC_ASSERT(sizeof(int64) == 8);
|
||||
#define STATIC_ASSERT(x) \
|
||||
do { \
|
||||
struct __staticAssertStruct__ { \
|
||||
char __static_assert_failed__[2*(x) - 1]; \
|
||||
}; \
|
||||
} while (false)
|
||||
#else
|
||||
#define STATIC_ASSERT(x)
|
||||
// the STATIC_ASSERT above doesn't work too well with mwcc because
|
||||
// of scoping bugs; for now make it do nothing
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _DEBUG_H */
|
||||
@@ -0,0 +1,51 @@
|
||||
#ifndef _TLS_H
|
||||
#define _TLS_H 1
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern _IMPEXP_ROOT int32 tls_allocate(void);
|
||||
|
||||
#if __INTEL__
|
||||
|
||||
static inline void * tls_get(int32 index) {
|
||||
void *ret;
|
||||
__asm__ __volatile__ (
|
||||
"movl %%fs:(,%%edx, 4), %%eax \n\t"
|
||||
: "=a"(ret) : "d"(index) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void * tls_address(int32 index) {
|
||||
void *ret;
|
||||
__asm__ __volatile__ (
|
||||
"movl %%fs:0, %%eax \n\t"
|
||||
"leal (%%eax, %%edx, 4), %%eax \n\t"
|
||||
: "=a"(ret) : "d"(index) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void tls_set(int32 index, void *value) {
|
||||
__asm__ __volatile__ (
|
||||
"movl %%eax, %%fs:(,%%edx, 4) \n\t"
|
||||
: : "d"(index), "a"(value) );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
extern _IMPEXP_ROOT void * tls_get(int32 index);
|
||||
extern _IMPEXP_ROOT void ** tls_address(int32 index);
|
||||
extern _IMPEXP_ROOT void tls_set(int32 index, void *value);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: UTF8.h
|
||||
/
|
||||
/ Description: UTF-8 conversion functions.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated
|
||||
/
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _UTF8_H
|
||||
#define _UTF8_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
/*------- Conversion Flavors ---------------------------------*/
|
||||
enum {
|
||||
B_ISO1_CONVERSION, /* ISO 8859-1 */
|
||||
B_ISO2_CONVERSION, /* ISO 8859-2 */
|
||||
B_ISO3_CONVERSION, /* ISO 8859-3 */
|
||||
B_ISO4_CONVERSION, /* ISO 8859-4 */
|
||||
B_ISO5_CONVERSION, /* ISO 8859-5 */
|
||||
B_ISO6_CONVERSION, /* ISO 8859-6 */
|
||||
B_ISO7_CONVERSION, /* ISO 8859-7 */
|
||||
B_ISO8_CONVERSION, /* ISO 8859-8 */
|
||||
B_ISO9_CONVERSION, /* ISO 8859-9 */
|
||||
B_ISO10_CONVERSION, /* ISO 8859-10 */
|
||||
B_MAC_ROMAN_CONVERSION, /* Macintosh Roman */
|
||||
B_SJIS_CONVERSION, /* Shift-JIS */
|
||||
B_EUC_CONVERSION, /* EUC Packed Japanese */
|
||||
B_JIS_CONVERSION, /* JIS X 0208-1990 */
|
||||
B_MS_WINDOWS_CONVERSION, /* MS-Windows Codepage 1252 */
|
||||
B_UNICODE_CONVERSION, /* Unicode 2.0 */
|
||||
B_KOI8R_CONVERSION, /* KOI8-R */
|
||||
B_MS_WINDOWS_1251_CONVERSION, /* MS-Windows Codepage 1251 */
|
||||
B_MS_DOS_866_CONVERSION, /* MS-DOS Codepage 866 */
|
||||
B_MS_DOS_CONVERSION, /* MS-DOS Codepage 437 */
|
||||
B_EUC_KR_CONVERSION /* EUC Korean */
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*------- Conversion Functions --------------------------------*/
|
||||
|
||||
_IMPEXP_TEXTENCODING status_t convert_to_utf8(uint32 srcEncoding,
|
||||
const char *src,
|
||||
int32 *srcLen,
|
||||
char *dst,
|
||||
int32 *dstLen,
|
||||
int32 *state,
|
||||
char substitute = B_SUBSTITUTE);
|
||||
|
||||
_IMPEXP_TEXTENCODING status_t convert_from_utf8(uint32 dstEncoding,
|
||||
const char *src,
|
||||
int32 *srcLen,
|
||||
char *dst,
|
||||
int32 *dstLen,
|
||||
int32 *state,
|
||||
char substitute = B_SUBSTITUTE);
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _UTF8_H */
|
||||
@@ -0,0 +1,185 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: syslog.h
|
||||
/
|
||||
/ Description: System event logging mechanism.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)syslog.h 7.20 (Berkeley) 2/23/91
|
||||
*/
|
||||
|
||||
#ifndef _SYS_LOG_H
|
||||
#define _SYS_LOG_H
|
||||
|
||||
#ifndef _BE_BUILD_H
|
||||
#include <BeBuild.h>
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Priority ----------------------------------------------*/
|
||||
|
||||
#define LOG_EMERG 0
|
||||
#define LOG_PANIC LOG_EMERG
|
||||
#define LOG_ALERT 1
|
||||
#define LOG_CRIT 2
|
||||
#define LOG_ERR 3
|
||||
#define LOG_WARNING 4
|
||||
#define LOG_NOTICE 5
|
||||
#define LOG_INFO 6
|
||||
#define LOG_DEBUG 7
|
||||
|
||||
#define LOG_NPRIORITIES 8
|
||||
|
||||
#define LOG_PRIMASK 0x07
|
||||
#define LOG_PRI(p) ((p) & LOG_PRIMASK)
|
||||
#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
|
||||
|
||||
#ifdef SYSLOG_NAMES
|
||||
#define INTERNAL_NOPRI 0x8
|
||||
#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0)
|
||||
|
||||
static char *prioritynames[] = {
|
||||
"panic",
|
||||
"alert",
|
||||
"crit",
|
||||
"err",
|
||||
"warning",
|
||||
"notice",
|
||||
"info",
|
||||
"debug",
|
||||
"none",
|
||||
NULL
|
||||
};
|
||||
|
||||
#endif /* SYSLOG_NAMES */
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Facility ----------------------------------------------*/
|
||||
|
||||
#define LOG_KERN (0<<3)
|
||||
#define LOG_USER (1<<3)
|
||||
#define LOG_MAIL (2<<3)
|
||||
#define LOG_DAEMON (3<<3)
|
||||
#define LOG_AUTH (4<<3)
|
||||
#define LOG_SYSLOG (5<<3)
|
||||
#define LOG_LPR (6<<3)
|
||||
#define LOG_NEWS (7<<3)
|
||||
#define LOG_UUCP (8<<3)
|
||||
#define LOG_CRON (9<<3)
|
||||
#define LOG_AUTHPRIV (10<<3)
|
||||
|
||||
/*----- Private or reserved ---------------*/
|
||||
#define LOG_LOCAL0 (16<<3)
|
||||
#define LOG_LOCAL1 (17<<3)
|
||||
#define LOG_LOCAL2 (18<<3)
|
||||
#define LOG_LOCAL3 (19<<3)
|
||||
#define LOG_LOCAL4 (20<<3)
|
||||
#define LOG_LOCAL5 (21<<3)
|
||||
#define LOG_LOCAL6 (22<<3)
|
||||
#define LOG_LOCAL7 (23<<3)
|
||||
/*-----------------------------------------*/
|
||||
|
||||
#define LOG_NFACILITIES 24
|
||||
#define LOG_FACMASK 0x03f8
|
||||
#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
|
||||
|
||||
#ifdef SYSLOG_NAMES
|
||||
|
||||
static char *facilitynames[] = {
|
||||
"kern", "user", "mail", "daemon",
|
||||
"auth", "syslogd", "lpr", "news",
|
||||
"uucp", "cron", "authpriv", "",
|
||||
"", "", "", "",
|
||||
"local0", "local1", "local2", "local3",
|
||||
"local4", "local5", "local6", "local7",
|
||||
NULL
|
||||
};
|
||||
|
||||
#endif /* SYSLOG_NAMES */
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Logging ----------------------------------------------*/
|
||||
|
||||
#ifdef KERNEL
|
||||
#define LOG_PRINTF -1
|
||||
#endif
|
||||
|
||||
/*----- setlogmask args ---------------*/
|
||||
#define LOG_MASK(pri) (1 << (pri))
|
||||
#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1)
|
||||
|
||||
/*----- openlog options ---------------*/
|
||||
#define LOG_OPTIONSMASK 0x000ff000
|
||||
#define LOG_OPTIONS(p) ((p) & LOG_OPTIONSMASK)
|
||||
|
||||
#define LOG_PID (0x01<<12)
|
||||
#define LOG_THID LOG_PID
|
||||
#define LOG_TMID LOG_PID
|
||||
#define LOG_CONS (0x02<<12) /* no-op */
|
||||
#define LOG_ODELAY (0x04<<12) /* no-op */
|
||||
#define LOG_NDELAY (0x08<<12) /* no-op */
|
||||
#define LOG_SERIAL (0x10<<12)
|
||||
#define LOG_PERROR (0x20<<12)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*----- Logging Functions ---------------*/
|
||||
|
||||
_IMPEXP_BE void closelog (void);
|
||||
_IMPEXP_BE void closelog_team (void);
|
||||
_IMPEXP_BE void closelog_thread (void);
|
||||
_IMPEXP_BE void openlog (char *, int, int);
|
||||
_IMPEXP_BE void openlog_team (char *, int, int);
|
||||
_IMPEXP_BE void openlog_thread (char *, int, int);
|
||||
_IMPEXP_BE void syslog (int, char *, ...);
|
||||
_IMPEXP_BE void log_team (int, char *, ...);
|
||||
_IMPEXP_BE void log_thread (int, char *, ...);
|
||||
_IMPEXP_BE int setlogmask (int);
|
||||
_IMPEXP_BE int setlogmask_team (int);
|
||||
_IMPEXP_BE int setlogmask_thread (int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _SYS_LOG_H */
|
||||
Reference in New Issue
Block a user