#include "generator.h"
Go to the source code of this file.
Definition at line 222 of file generator.c.
References buf, fbuffer_append(), len, RSTRING_LEN, RSTRING_PTR, and unicode_escape().
Referenced by generate_json().
Definition at line 124 of file generator.c.
References buf, fbuffer_append(), fbuffer_append_char(), halfBase, halfMask, halfShift, isLegalUTF8(), offsetsFromUTF8, rb_path2class(), rb_raise(), RSTRING_LEN, RSTRING_PTR, trailingBytesForUTF8, UNI_MAX_BMP, UNI_MAX_UTF16, UNI_REPLACEMENT_CHAR, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, UNI_SUR_LOW_START, and unicode_escape_to_buffer().
Referenced by generate_json().
Definition at line 1231 of file generator.c.
References GET_STATE, and Qtrue.
Referenced by Init_generator().
Definition at line 728 of file generator.c.
References GET_STATE, i_respond_to_p, i_send, rb_funcall(), and RTEST.
Referenced by Init_generator().
Definition at line 1160 of file generator.c.
References GET_STATE, and rb_str_new2().
Referenced by Init_generator().
Definition at line 1171 of file generator.c.
References Check_Type, GET_STATE, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.
Referenced by Init_generator().
Definition at line 1243 of file generator.c.
References GET_STATE, and Qtrue.
Referenced by Init_generator().
Definition at line 1194 of file generator.c.
References GET_STATE, and Qtrue.
Referenced by Init_generator().
Definition at line 634 of file generator.c.
References Check_Type, FIX2LONG, fstrndup(), GET_STATE, i_allow_nan, i_array_nl, i_ascii_only, i_indent, i_max_nesting, i_object_nl, i_space, i_space_before, ID2SYM, len, NIL_P, option_given_p, rb_convert_type(), rb_eArgError, rb_hash_aref(), rb_raise(), RSTRING_LEN, RSTRING_PTR, RTEST, T_FIXNUM, T_HASH, and T_STRING.
Referenced by cState_initialize(), and Init_generator().
Definition at line 1009 of file generator.c.
References CJSON_SAFE_STATE_PROTOTYPE, i_new, mJSON, NIL_P, rb_cHash, rb_const_get(), rb_funcall(), rb_intern, and rb_obj_is_kind_of().
Referenced by Init_generator(), mArray_to_json(), mFalseClass_to_json(), mFloat_to_json(), mHash_to_json(), mInteger_to_json(), mNilClass_to_json(), mObject_to_json(), mString_to_json(), and mTrueClass_to_json().
Definition at line 936 of file generator.c.
References CRegexp_MULTILINE, cState_partial_generate(), eGeneratorError, i_match, NIL_P, Qnil, rb_class_new_instance(), rb_cRegexp, rb_funcall(), rb_raise(), rb_str_new2(), and result.
Referenced by Init_generator().
Definition at line 1028 of file generator.c.
References GET_STATE, and rb_str_new2().
Referenced by Init_generator().
Definition at line 1039 of file generator.c.
References Check_Type, GET_STATE, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.
Referenced by Init_generator().
Definition at line 982 of file generator.c.
References JSON_Generator_StateStruct::array_delim, JSON_Generator_StateStruct::array_nl, JSON_Generator_StateStruct::array_nl_len, Data_Get_Struct, fbuffer_dup(), fstrndup(), JSON_Generator_StateStruct::indent, JSON_Generator_StateStruct::indent_len, MEMCPY, JSON_Generator_StateStruct::object_delim, JSON_Generator_StateStruct::object_delim2, JSON_Generator_StateStruct::object_nl, JSON_Generator_StateStruct::object_nl_len, rb_eArgError, rb_raise(), JSON_Generator_StateStruct::space, JSON_Generator_StateStruct::space_before, JSON_Generator_StateStruct::space_before_len, and JSON_Generator_StateStruct::space_len.
Referenced by Init_generator().
Definition at line 965 of file generator.c.
References cState_configure(), GET_STATE, MEMZERO, NIL_P, and rb_scan_args().
Referenced by Init_generator().
Definition at line 1206 of file generator.c.
References GET_STATE, and LONG2FIX.
Referenced by Init_generator().
Definition at line 1218 of file generator.c.
References Check_Type, FIX2LONG, GET_STATE, and T_FIXNUM.
Referenced by Init_generator().
Definition at line 1127 of file generator.c.
References GET_STATE, and rb_str_new2().
Referenced by Init_generator().
Definition at line 1139 of file generator.c.
References Check_Type, GET_STATE, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.
Referenced by Init_generator().
Definition at line 894 of file generator.c.
References fbuffer_alloc(), fbuffer_alloc_with_length(), fbuffer_append(), fbuffer_append_char(), fbuffer_clear(), fbuffer_free(), FBUFFER_PAIR, FIX2INT, FORCE_UTF8, generate_json(), GET_STATE, NIL_P, rb_str_new(), and result.
Referenced by cState_generate(), Init_generator(), mArray_to_json(), mFalseClass_to_json(), mFloat_to_json(), mHash_to_json(), mInteger_to_json(), mNilClass_to_json(), mObject_to_json(), mString_to_json(), and mTrueClass_to_json().
Definition at line 622 of file generator.c.
References Data_Wrap_Struct, NULL, State_allocate(), and State_free().
Referenced by Init_generator().
Definition at line 1061 of file generator.c.
References GET_STATE, and rb_str_new2().
Referenced by Init_generator().
Definition at line 1094 of file generator.c.
References GET_STATE, and rb_str_new2().
Referenced by Init_generator().
Definition at line 1105 of file generator.c.
References Check_Type, GET_STATE, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.
Referenced by Init_generator().
Definition at line 1073 of file generator.c.
References Check_Type, GET_STATE, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.
Referenced by Init_generator().
Definition at line 708 of file generator.c.
References GET_STATE, i_allow_nan, i_array_nl, i_ascii_only, i_indent, i_max_nesting, i_object_nl, i_space, i_space_before, ID2SYM, LONG2FIX, Qfalse, Qtrue, rb_hash_aset(), rb_hash_new(), rb_str_new(), and result.
Referenced by Init_generator().
static FBuffer* fbuffer_alloc | ( | ) | [static] |
Definition at line 296 of file generator.c.
References ALLOC.
Referenced by cState_partial_generate(), and fbuffer_dup().
static FBuffer* fbuffer_alloc_with_length | ( | unsigned int | initial_length | ) | [static] |
Definition at line 304 of file generator.c.
Referenced by cState_partial_generate(), and fbuffer_dup().
static void fbuffer_append | ( | FBuffer * | fb, | |
const char * | newstr, | |||
unsigned int | len | |||
) | [static] |
Definition at line 347 of file generator.c.
References fbuffer_inc_capa(), FBufferStruct::len, MEMCPY, and FBufferStruct::ptr.
Referenced by convert_UTF8_to_JSON(), convert_UTF8_to_JSON_ASCII(), cState_partial_generate(), fbuffer_append_long(), fbuffer_dup(), generate_json(), and unicode_escape_to_buffer().
static void fbuffer_append_char | ( | FBuffer * | fb, | |
char | newchr | |||
) | [static] |
Definition at line 356 of file generator.c.
References fbuffer_inc_capa(), FBufferStruct::len, and FBufferStruct::ptr.
Referenced by convert_UTF8_to_JSON_ASCII(), cState_partial_generate(), and generate_json().
static void fbuffer_append_long | ( | FBuffer * | fb, | |
long | number | |||
) | [static] |
Definition at line 385 of file generator.c.
References buf, fbuffer_append(), fltoa(), and len.
Referenced by generate_json().
static void fbuffer_clear | ( | FBuffer * | fb | ) | [static] |
Definition at line 325 of file generator.c.
References FBufferStruct::len.
Referenced by cState_partial_generate().
Definition at line 392 of file generator.c.
References fbuffer_alloc(), fbuffer_alloc_with_length(), fbuffer_append(), FBUFFER_PAIR, FBufferStruct::len, len, and result.
Referenced by cState_init_copy().
static void fbuffer_free | ( | FBuffer * | fb | ) | [static] |
Definition at line 314 of file generator.c.
References FBufferStruct::ptr, and ruby_xfree().
Referenced by cState_partial_generate(), generate_json(), and State_free().
static void fbuffer_free_only_buffer | ( | FBuffer * | fb | ) | [static] |
Definition at line 320 of file generator.c.
References ruby_xfree().
static void fbuffer_inc_capa | ( | FBuffer * | fb, | |
unsigned int | requested | |||
) | [static] |
Definition at line 330 of file generator.c.
References ALLOC_N, FBufferStruct::capa, FBufferStruct::initial_length, FBufferStruct::len, FBufferStruct::ptr, and REALLOC_N.
Referenced by fbuffer_append(), and fbuffer_append_char().
static int fltoa | ( | long | number, | |
char * | buf | |||
) | [static] |
Definition at line 372 of file generator.c.
References freverse().
Referenced by fbuffer_append_long().
static void freverse | ( | char * | start, | |
char * | end | |||
) | [static] |
Definition at line 363 of file generator.c.
Referenced by fltoa().
static char* fstrndup | ( | const char * | ptr, | |
int | len | |||
) | [static] |
Definition at line 286 of file generator.c.
References ALLOC_N, and result.
Referenced by cState_configure(), and cState_init_copy().
static void generate_json | ( | FBuffer * | buffer, | |
VALUE | Vstate, | |||
JSON_Generator_State * | state, | |||
VALUE | obj, | |||
long | depth | |||
) | [static] |
Definition at line 738 of file generator.c.
References JSON_Generator_StateStruct::allow_nan, JSON_Generator_StateStruct::array_delim, JSON_Generator_StateStruct::array_nl, JSON_Generator_StateStruct::array_nl_len, JSON_Generator_StateStruct::ascii_only, Check_Type, convert_UTF8_to_JSON(), convert_UTF8_to_JSON_ASCII(), eGeneratorError, eNestingError, fbuffer_append(), fbuffer_append_char(), fbuffer_append_long(), fbuffer_free(), FBUFFER_LEN, FBUFFER_PTR, FIX2LONG, i_to_json, i_to_s, JSON_Generator_StateStruct::indent, JSON_Generator_StateStruct::indent_len, INT2FIX, isinf(), isnan, JSON_Generator_StateStruct::max_nesting, JSON_Generator_StateStruct::object_delim, JSON_Generator_StateStruct::object_delim2, JSON_Generator_StateStruct::object_nl, JSON_Generator_StateStruct::object_nl_len, RARRAY_LEN, rb_ary_entry(), rb_funcall(), rb_hash_aref(), rb_intern, rb_raise(), rb_respond_to(), RFLOAT_VALUE, RSTRING_PAIR, StringValueCStr, T_ARRAY, T_BIGNUM, T_FALSE, T_FIXNUM, T_FLOAT, T_HASH, T_NIL, T_STRING, T_TRUE, and TYPE.
Referenced by cState_partial_generate().
void Init_generator | ( | ) |
Definition at line 1252 of file generator.c.
References CJSON_SAFE_STATE_PROTOTYPE, CRegexp_MULTILINE, cState, cState_allow_nan_p(), cState_aref(), cState_array_nl(), cState_array_nl_set(), cState_ascii_only_p(), cState_check_circular_p(), cState_configure(), cState_from_state_s(), cState_generate(), cState_indent(), cState_indent_set(), cState_init_copy(), cState_initialize(), cState_max_nesting(), cState_max_nesting_set(), cState_object_nl(), cState_object_nl_set(), cState_partial_generate(), cState_s_allocate(), cState_space(), cState_space_before(), cState_space_before_set(), cState_space_set(), cState_to_h(), eGeneratorError, eNestingError, i_allow_nan, i_aref, i_array_nl, i_ascii_only, i_create_id, i_extend, i_indent, i_key_p, i_match, i_max_nesting, i_new, i_object_nl, i_pack, i_respond_to_p, i_send, i_space, i_space_before, i_to_json, i_to_s, i_unpack, mArray, mArray_to_json(), mExt, mFalseClass, mFalseClass_to_json(), mFloat, mFloat_to_json(), mGenerator, mGeneratorMethods, mHash, mHash_to_json(), mInteger, mInteger_to_json(), mJSON, mNilClass, mNilClass_to_json(), mObject, mObject_to_json(), mString, mString_Extend, mString_Extend_json_create(), mString_included_s(), mString_to_json(), mString_to_json_raw(), mString_to_json_raw_object(), mTrueClass, mTrueClass_to_json(), rb_cObject, rb_const_get(), rb_cRegexp, rb_define_alloc_func(), rb_define_class_under(), rb_define_method(), rb_define_module(), rb_define_module_under(), rb_define_singleton_method(), rb_funcall(), rb_intern, rb_path2class(), rb_require(), and rb_str_new2().
static unsigned char isLegalUTF8 | ( | const UTF8 * | source, | |
int | length | |||
) | [static] |
Definition at line 76 of file generator.c.
Referenced by convert_UTF8_to_JSON_ASCII().
Definition at line 445 of file generator.c.
References cState, cState_from_state_s(), cState_partial_generate(), and rb_scan_args().
Referenced by Init_generator().
Definition at line 566 of file generator.c.
References cState, cState_from_state_s(), cState_partial_generate(), and rb_scan_args().
Referenced by Init_generator().
Definition at line 470 of file generator.c.
References cState, cState_from_state_s(), cState_partial_generate(), and rb_scan_args().
Referenced by Init_generator().
Definition at line 427 of file generator.c.
References cState, cState_from_state_s(), cState_partial_generate(), and rb_scan_args().
Referenced by Init_generator(), and mString_to_json_raw().
Definition at line 457 of file generator.c.
References cState, cState_from_state_s(), cState_partial_generate(), and rb_scan_args().
Referenced by Init_generator().
Definition at line 578 of file generator.c.
References cState, cState_from_state_s(), cState_partial_generate(), and rb_scan_args().
Referenced by Init_generator().
Definition at line 593 of file generator.c.
References Check_Type, cState, cState_from_state_s(), cState_partial_generate(), i_to_s, rb_funcall(), rb_scan_args(), and T_STRING.
Referenced by Init_generator().
Definition at line 540 of file generator.c.
References Check_Type, i_pack, rb_funcall(), rb_hash_aref(), rb_str_new2(), and T_HASH.
Referenced by Init_generator().
Definition at line 483 of file generator.c.
References i_extend, mString_Extend, rb_funcall(), and result.
Referenced by Init_generator().
Definition at line 495 of file generator.c.
References cState, cState_from_state_s(), cState_partial_generate(), and rb_scan_args().
Referenced by Init_generator().
Definition at line 527 of file generator.c.
References Check_Type, mHash_to_json(), mString_to_json_raw_object(), and T_HASH.
Referenced by Init_generator().
Definition at line 511 of file generator.c.
References i_create_id, i_unpack, mJSON, rb_class_name(), rb_funcall(), rb_hash_aset(), rb_hash_new(), rb_obj_class(), rb_str_new2(), and result.
Referenced by Init_generator(), and mString_to_json_raw().
Definition at line 553 of file generator.c.
References cState, cState_from_state_s(), cState_partial_generate(), and rb_scan_args().
Referenced by Init_generator().
static JSON_Generator_State* State_allocate | ( | ) | [static] |
static void State_free | ( | JSON_Generator_State * | state | ) | [static] |
Definition at line 603 of file generator.c.
References JSON_Generator_StateStruct::array_delim, JSON_Generator_StateStruct::array_nl, fbuffer_free(), JSON_Generator_StateStruct::indent, JSON_Generator_StateStruct::object_delim, JSON_Generator_StateStruct::object_delim2, JSON_Generator_StateStruct::object_nl, ruby_xfree(), JSON_Generator_StateStruct::space, and JSON_Generator_StateStruct::space_before.
Referenced by cState_s_allocate().
static void unicode_escape | ( | char * | buf, | |
UTF16 | character | |||
) | [static] |
Definition at line 103 of file generator.c.
Referenced by convert_UTF8_to_JSON(), and unicode_escape_to_buffer().
Definition at line 115 of file generator.c.
References fbuffer_append(), and unicode_escape().
Referenced by convert_UTF8_to_JSON_ASCII().
VALUE CJSON_SAFE_STATE_PROTOTYPE [static] |
Definition at line 8 of file generator.c.
Referenced by cState_from_state_s(), and Init_generator().
VALUE CRegexp_MULTILINE [static] |
Definition at line 8 of file generator.c.
Referenced by cState_generate(), and Init_generator().
Definition at line 8 of file generator.c.
Referenced by Init_generator(), mArray_to_json(), mFalseClass_to_json(), mFloat_to_json(), mHash_to_json(), mInteger_to_json(), mNilClass_to_json(), mObject_to_json(), mString_to_json(), and mTrueClass_to_json().
VALUE eGeneratorError [static] |
Definition at line 8 of file generator.c.
Referenced by cState_generate(), generate_json(), and Init_generator().
VALUE eNestingError [static] |
Definition at line 8 of file generator.c.
Referenced by generate_json(), and Init_generator().
ID i_allow_nan [static] |
Definition at line 13 of file generator.c.
Referenced by cState_configure(), cState_to_h(), and Init_generator().
Definition at line 13 of file generator.c.
Referenced by Init_generator().
ID i_array_nl [static] |
Definition at line 13 of file generator.c.
Referenced by cState_configure(), cState_to_h(), and Init_generator().
ID i_ascii_only [static] |
Definition at line 13 of file generator.c.
Referenced by cState_configure(), cState_to_h(), and Init_generator().
ID i_create_id [static] |
Definition at line 13 of file generator.c.
Referenced by Init_generator(), and mString_to_json_raw_object().
Definition at line 13 of file generator.c.
Referenced by Init_generator(), and mString_included_s().
Definition at line 13 of file generator.c.
Referenced by cState_configure(), cState_to_h(), and Init_generator().
Definition at line 13 of file generator.c.
Referenced by Init_generator().
Definition at line 13 of file generator.c.
Referenced by cState_generate(), and Init_generator().
ID i_max_nesting [static] |
Definition at line 13 of file generator.c.
Referenced by cState_configure(), cState_to_h(), and Init_generator().
Definition at line 13 of file generator.c.
Referenced by cState_from_state_s(), and Init_generator().
ID i_object_nl [static] |
Definition at line 13 of file generator.c.
Referenced by cState_configure(), cState_to_h(), and Init_generator().
Definition at line 13 of file generator.c.
Referenced by Init_generator(), and mString_Extend_json_create().
ID i_respond_to_p [static] |
Definition at line 13 of file generator.c.
Referenced by cState_aref(), and Init_generator().
Definition at line 13 of file generator.c.
Referenced by cState_aref(), and Init_generator().
Definition at line 13 of file generator.c.
Referenced by cState_configure(), cState_to_h(), and Init_generator().
ID i_space_before [static] |
Definition at line 13 of file generator.c.
Referenced by cState_configure(), cState_to_h(), and Init_generator().
Definition at line 13 of file generator.c.
Referenced by generate_json(), and Init_generator().
Definition at line 13 of file generator.c.
Referenced by generate_json(), Init_generator(), and mObject_to_json().
Definition at line 13 of file generator.c.
Referenced by Init_generator(), and mString_to_json_raw_object().
Definition at line 8 of file generator.c.
Referenced by Init_generator().
Definition at line 8 of file generator.c.
Referenced by Init_generator().
VALUE mFalseClass [static] |
Definition at line 8 of file generator.c.
Referenced by Init_generator().
Definition at line 8 of file generator.c.
Referenced by Init_generator().
VALUE mGenerator [static] |
Definition at line 8 of file generator.c.
Referenced by Init_generator().
VALUE mGeneratorMethods [static] |
Definition at line 8 of file generator.c.
Referenced by Init_generator().
Definition at line 8 of file generator.c.
Referenced by Init_generator().
Definition at line 8 of file generator.c.
Referenced by Init_generator().
Definition at line 8 of file generator.c.
Referenced by cState_from_state_s(), Init_generator(), and mString_to_json_raw_object().
Definition at line 8 of file generator.c.
Referenced by Init_generator().
Definition at line 8 of file generator.c.
Referenced by Init_generator().
Definition at line 8 of file generator.c.
Referenced by Init_generator().
VALUE mString_Extend [static] |
Definition at line 8 of file generator.c.
Referenced by Init_generator(), and mString_included_s().
VALUE mTrueClass [static] |
Definition at line 8 of file generator.c.
Referenced by Init_generator().
const UTF32 offsetsFromUTF8[6] [static] |
{ 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }
Definition at line 63 of file generator.c.
Referenced by convert_UTF8_to_JSON_ASCII().
const char trailingBytesForUTF8[256] [static] |
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 }
Definition at line 47 of file generator.c.
Referenced by convert_UTF8_to_JSON_ASCII().