28 #include "common_decimal.h"
30 #if defined(__GNUC__) || defined(__xlC__)
33 #ifdef SDB_STATIC_BUILD
35 #elif defined(SDB_DLL_BUILD)
36 #define SDB_EXPORT __declspec(dllexport)
38 #define SDB_EXPORT __declspec(dllimport)
43 #define SDB_EXTERN_C_START extern "C" {
44 #define SDB_EXTERN_C_END }
46 #define SDB_EXTERN_C_START
47 #define SDB_EXTERN_C_END
70 #define bson_little_endian64(out, in) ( memcpy(out, in, 8) )
71 #define bson_little_endian32(out, in) ( memcpy(out, in, 4) )
72 #define bson_little_endian16(out, in) ( memcpy(out, in, 2) )
73 #define bson_big_endian64(out, in) ( bson_swap_endian64(out, in) )
74 #define bson_big_endian32(out, in) ( bson_swap_endian32(out, in) )
75 #define bson_big_endian16(out, in) ( bson_swap_endian16(out, in) )
131 typedef int bson_bool_t;
138 #define BSON_MAX_STACK_SIZE 32
144 int stack[BSON_MAX_STACK_SIZE];
145 char stackType[BSON_MAX_STACK_SIZE];
159 typedef int64_t bson_date_t;
223 SDB_EXPORT
int bson_sprint(
char *buffer,
int bufsize,
const bson *b );
266 SDB_EXPORT
int bson_sprint_raw (
char **pbuf,
int *left,
const char *data,
int isobj );
401 int *sign,
int *scale ) ;
441 bson_decimal *decimal ) ;
454 SDB_EXPORT
int bson_iterator_timestamp_time(
const bson_iterator *i );
455 SDB_EXPORT
int bson_iterator_timestamp_increment(
const bson_iterator *i );
859 const bson_decimal *decimal ) ;
873 const char *value,
int precision,
885 const char *value ) ;
1047 SDB_EXPORT
int bson_append_regex(
bson *b,
const char *name,
const char *pattern,
const char *opts );
1198 void bson_numstr(
char *str,
int i );
1200 void bson_incnumstr(
char *str );
1206 typedef void( *bson_err_handler )(
const char *errmsg );
1208 typedef int (*bson_printf_func)(
const char *, ... );
1209 typedef int (*bson_fprintf_func)( FILE *,
const char *, ... );
1210 typedef int (*bson_sprintf_func)(
char *,
const char *, ... );
1212 extern void *( *bson_malloc_func )( size_t );
1213 extern void *( *bson_realloc_func )(
void *, size_t );
1214 extern void ( *bson_free_func )(
void * );
1216 extern bson_printf_func bson_printf;
1217 extern bson_fprintf_func bson_fprintf;
1218 extern bson_sprintf_func bson_sprintf;
1219 extern bson_printf_func bson_errprintf;
1221 SDB_EXPORT
void bson_free(
void *ptr );
1286 SDB_EXPORT
void bson_swap_endian32(
void *outp,
const void *inp );
1287 SDB_EXPORT
void bson_swap_endian64(
void *outp,
const void *inp );
1289 SDB_EXPORT bson_bool_t bson_is_inf(
double d,
int *pSign ) ;