ext/oj/oj.h in oj-1.2.9 vs ext/oj/oj.h in oj-1.2.10

- old
+ new

@@ -44,10 +44,11 @@ #if HAS_ENCODING_SUPPORT #include "ruby/encoding.h" #endif #include "stdint.h" +#include <pthread.h> // for SAFE_CACHE #include "cache.h" #ifdef RUBINIUS_RUBY #undef T_RATIONAL @@ -62,10 +63,12 @@ #endif #endif #define raise_error(msg, xml, current) _oj_raise_error(msg, xml, current, __FILE__, __LINE__) +#define MAX_ODD_ARGS 10 + typedef enum { Yes = 'y', No = 'n', NotSet = 0 } YesNo; @@ -99,10 +102,18 @@ char mode; // Mode const char *create_id; // 0 or string DumpOpts dump_opts; } *Options; +typedef struct _Odd { + VALUE clas; // Ruby class + VALUE create_obj; + ID create_op; + int attr_cnt; + ID attrs[MAX_ODD_ARGS]; // 0 terminated attr IDs +} *Odd; + enum { STR_VAL = 0x00, COL_VAL = 0x01, RUBY_VAL = 0x02 }; @@ -131,37 +142,44 @@ extern void _oj_raise_error(const char *msg, const char *xml, const char *current, const char* file, int line); extern void oj_init_doc(void); +extern Odd oj_get_odd(VALUE clas); + extern VALUE Oj; extern struct _Options oj_default_options; #if HAS_ENCODING_SUPPORT extern rb_encoding *oj_utf8_encoding; #endif extern VALUE oj_bag_class; -extern VALUE oj_date_class; +extern VALUE oj_bigdecimal_class; extern VALUE oj_doc_class; extern VALUE oj_stringio_class; extern VALUE oj_struct_class; extern VALUE oj_time_class; extern VALUE oj_slash_string; extern ID oj_as_json_id; extern ID oj_instance_variables_id; extern ID oj_json_create_id; +extern ID oj_new_id; extern ID oj_string_id; extern ID oj_to_hash_id; extern ID oj_to_json_id; +extern ID oj_to_s_id; extern ID oj_to_sym_id; +extern ID oj_to_time_id; extern ID oj_tv_nsec_id; extern ID oj_tv_sec_id; extern ID oj_tv_usec_id; extern Cache oj_class_cache; extern Cache oj_attr_cache; + +extern pthread_mutex_t oj_cache_mutex; #if defined(__cplusplus) #if 0 { /* satisfy cc-mode */ #endif