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 );
886 const bson_decimal *decimal ) ;
900 const char *value,
int precision,
912 const char *value ) ;
1074 SDB_EXPORT
int bson_append_regex(
bson *b,
const char *name,
const char *pattern,
const char *opts );
1224 void bson_numstr(
char *str,
int i );
1226 void bson_incnumstr(
char *str );
1232 typedef void( *bson_err_handler )(
const char *errmsg );
1234 typedef int (*bson_printf_func)(
const char *, ... );
1235 typedef int (*bson_fprintf_func)( FILE *,
const char *, ... );
1236 typedef int (*bson_sprintf_func)(
char *,
const char *, ... );
1238 typedef void* (*bson_malloc_func_p)( size_t ) ;
1239 typedef void* (*bson_realloc_func_p)(
void*, size_t ) ;
1240 typedef void (*bson_free_func_p)(
void* ) ;
1242 void bson_set_malloc_func( bson_malloc_func_p func ) ;
1243 void bson_set_realloc_func( bson_realloc_func_p func ) ;
1244 void bson_set_free_func( bson_free_func_p func ) ;
1246 extern bson_printf_func bson_printf;
1247 extern bson_fprintf_func bson_fprintf;
1248 extern bson_sprintf_func bson_sprintf;
1249 extern bson_printf_func bson_errprintf;
1251 SDB_EXPORT
void bson_free(
void *ptr );
1316 SDB_EXPORT
void bson_swap_endian32(
void *outp,
const void *inp );
1317 SDB_EXPORT
void bson_swap_endian64(
void *outp,
const void *inp );
1319 SDB_EXPORT bson_bool_t bson_is_inf(
double d,
int *pSign ) ;