2
* Copyright (c) 2002-2011 by XMLVM.org
4
* Project Info: http://www.xmlvm.org
6
* This program is free software; you can redistribute it and/or modify it
7
* under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation; either version 2.1 of the License, or
9
* (at your option) any later version.
11
* This library is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14
* License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22
#ifndef __XMLVM_HY_H__
24
#define __XMLVM_HY_H__
36
#define HYERROR_DEFAULT_BUFFER_SIZE 256 /**< default customized error message size if we need to create one */
38
#if defined(__linux__)
39
#define DIR_SEPARATOR '/'
43
typedef struct PortlibPTBuffers_struct
45
I_32 platformErrorCode; /**< error code as reported by the OS */
46
I_32 portableErrorCode; /**< error code translated to portable format by application */
47
char *errorMessageBuffer; /**< last saved error message, either customized or from OS */
48
U_32 errorMessageBufferSize; /**< error message buffer size */
49
I_32 reportedErrorCode; /**< last reported error code */
50
char *reportedMessageBuffer; /**< last reported error message, either customized or from OS */
51
U_32 reportedMessageBufferSize; /**< reported message buffer size */
54
#if HOSTENT_DATA_R||GLIBC_R||OTHER_R||NO_R
59
OSHOSTENT_DATA *hostent_data;
60
#elif GLIBC_R || OTHER_R || NO_R
61
int gethostBufferSize;
63
#endif /* HOSTENT_DATA_R */
65
} PortlibPTBuffers_struct;
67
typedef struct PortlibPTBuffers_struct *PortlibPTBuffers_t;
70
typedef pthread_mutex_t MUTEX;
73
#define MUTEX_INIT(mutex) (pthread_mutex_init(&(mutex), NULL) == 0)
76
#define MUTEX_DESTROY(mutex) pthread_mutex_destroy(&(mutex))
79
#define MUTEX_ENTER(mutex) pthread_mutex_lock(&(mutex))
83
* returns 0 on success
85
#define MUTEX_TRY_ENTER(mutex) pthread_mutex_trylock(&(mutex))
88
#define MUTEX_EXIT(mutex) pthread_mutex_unlock(&(mutex))
92
#define HySeekSet SEEK_SET /* Values for HyFileSeek */
98
#define HySeekCur SEEK_CUR
103
#if defined(SEEK_END)
104
#define HySeekEnd SEEK_END
110
typedef JAVA_INT jsize;
113
void* hyport_tls_get ();
114
void* hyport_tls_peek ();
115
const char* hyerror_last_error_message ();
116
I_32 hyerror_last_error_number ();
117
I_32 hyerror_set_last_error (I_32 platformCode, I_32 portableCode);
118
I_32 hyerror_set_last_error_with_message (I_32 portableCode, const char *errorMessage);