Ruby 2.0.0p247(2013-06-27revision41674)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Functions | Variables
generator.c File Reference
`#include "../fbuffer/fbuffer.h"`
`#include "generator.h"`
Include dependency graph for generator.c:

Go to the source code of this file.

## Functions
static unsigned char | isLegalUTF8 (const UTF8 *source, unsigned long length)
static void | unicode_escape (char *buf, UTF16 character)
static void | unicode_escape_to_buffer (FBuffer *buffer, char buf[6], UTF16 character)
static void | convert_UTF8_to_JSON_ASCII (FBuffer *buffer, VALUE string)
static void | convert_UTF8_to_JSON (FBuffer *buffer, VALUE string)
static char * | fstrndup (const char *ptr, unsigned long len)
static VALUE | mHash_to_json (int argc, VALUE *argv, VALUE self)
static VALUE | mArray_to_json (int argc, VALUE *argv, VALUE self)
static VALUE | mFixnum_to_json (int argc, VALUE *argv, VALUE self)
static VALUE | mBignum_to_json (int argc, VALUE *argv, VALUE self)
static VALUE | mFloat_to_json (int argc, VALUE *argv, VALUE self)
static VALUE | mString_included_s (VALUE self, VALUE modul)
static VALUE | mString_to_json (int argc, VALUE *argv, VALUE self)
static VALUE | mString_to_json_raw_object (VALUE self)
static VALUE | mString_to_json_raw (int argc, VALUE *argv, VALUE self)
static VALUE | mString_Extend_json_create (VALUE self, VALUE o)
static VALUE | mTrueClass_to_json (int argc, VALUE *argv, VALUE self)
static VALUE | mFalseClass_to_json (int argc, VALUE *argv, VALUE self)
static VALUE | mNilClass_to_json (int argc, VALUE *argv, VALUE self)
static VALUE | mObject_to_json (int argc, VALUE *argv, VALUE self)
static void | State_free (JSON_Generator_State *state)
static JSON_Generator_State * | State_allocate ()
static VALUE | cState_s_allocate (VALUE klass)
static VALUE | cState_configure (VALUE self, VALUE opts)
static void | set_state_ivars (VALUE hash, VALUE state)
static VALUE | cState_to_h (VALUE self)
static VALUE | cState_aref (VALUE self, VALUE name)
static VALUE | cState_aset (VALUE self, VALUE name, VALUE value)
static void | generate_json_object (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static void | generate_json_array (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static void | generate_json_string (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static void | generate_json_null (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static void | generate_json_false (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static void | generate_json_true (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static void | generate_json_fixnum (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static void | generate_json_bignum (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static void | generate_json_float (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static void | generate_json (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
static FBuffer * | cState_prepare_buffer (VALUE self)
static VALUE | cState_partial_generate (VALUE self, VALUE obj)
static int | isArrayOrObject (VALUE string)
static VALUE | cState_generate (VALUE self, VALUE obj)
static VALUE | cState_initialize (int argc, VALUE *argv, VALUE self)
static VALUE | cState_init_copy (VALUE obj, VALUE orig)
static VALUE | cState_from_state_s (VALUE self, VALUE opts)
static VALUE | cState_indent (VALUE self)
static VALUE | cState_indent_set (VALUE self, VALUE indent)
static VALUE | cState_space (VALUE self)
static VALUE | cState_space_set (VALUE self, VALUE space)
static VALUE | cState_space_before (VALUE self)
static VALUE | cState_space_before_set (VALUE self, VALUE space_before)
static VALUE | cState_object_nl (VALUE self)
static VALUE | cState_object_nl_set (VALUE self, VALUE object_nl)
static VALUE | cState_array_nl (VALUE self)
static VALUE | cState_array_nl_set (VALUE self, VALUE array_nl)
static VALUE | cState_check_circular_p (VALUE self)
static VALUE | cState_max_nesting (VALUE self)
static VALUE | cState_max_nesting_set (VALUE self, VALUE depth)
static VALUE | cState_allow_nan_p (VALUE self)
static VALUE | cState_ascii_only_p (VALUE self)
static VALUE | cState_quirks_mode_p (VALUE self)
static VALUE | cState_quirks_mode_set (VALUE self, VALUE enable)
static VALUE | cState_depth (VALUE self)
static VALUE | cState_depth_set (VALUE self, VALUE depth)
static VALUE | cState_buffer_initial_length (VALUE self)
static VALUE | cState_buffer_initial_length_set (VALUE self, VALUE buffer_initial_length)
void | Init_generator ()

## Variables
static VALUE | CEncoding_UTF_8
static ID | i_encoding
static ID | i_encode
static VALUE | mJSON
static VALUE | mExt
static VALUE | mGenerator
static VALUE | cState
static VALUE | mGeneratorMethods
static VALUE | mObject
static VALUE | mHash
static VALUE | mArray
static VALUE | mFixnum
static VALUE | mBignum
static VALUE | mFloat
static VALUE | mString
static VALUE | mString_Extend
static VALUE | mTrueClass
static VALUE | mFalseClass
static VALUE | mNilClass
static VALUE | eGeneratorError
static VALUE | eNestingError
static VALUE | CRegexp_MULTILINE
static VALUE | CJSON_SAFE_STATE_PROTOTYPE
static VALUE | i_SAFE_STATE_PROTOTYPE
static ID | i_to_s
static ID | i_to_json
static ID | i_new
static ID | i_indent
static ID | i_space
static ID | i_space_before
static ID | i_object_nl
static ID | i_array_nl
static ID | i_max_nesting
static ID | i_allow_nan
static ID | i_ascii_only
static ID | i_quirks_mode
static ID | i_pack
static ID | i_unpack
static ID | i_create_id
static ID | i_extend
static ID | i_key_p
static ID | i_aref
static ID | i_send
static ID | i_respond_to_p
static ID | i_match
static ID | i_keys
static ID | i_depth
static ID | i_buffer_initial_length
static ID | i_dup
static const char | trailingBytesForUTF8 [256]
static const UTF32 | offsetsFromUTF8 [6]

## Function Documentation

static void convert_UTF8_to_JSON | ( | FBuffer * | buffer,
|  | VALUE | string
| ) |  |
| static

Definition at line 225 of file generator.c.

References buf, c, fbuffer_append(), NULL, p, RSTRING_LEN, RSTRING_PTR, and unicode_escape().

Referenced by generate_json_string().

static void convert_UTF8_to_JSON_ASCII | ( | FBuffer * | buffer,
|  | VALUE | string
| ) |  |
| static

Definition at line 127 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_string().

static VALUE cState_allow_nan_p | ( | VALUE | self) |  |
| static

Definition at line 1223 of file generator.c.

References GET_STATE, Qfalse, and Qtrue.

Referenced by Init_generator().

static VALUE cState_aref | ( | VALUE | self,
|  | VALUE | name
| ) |  |
| static

Definition at line 643 of file generator.c.

References i_respond_to_p, i_send, i_to_s, rb_funcall(), rb_intern_str, rb_ivar_get(), rb_str_concat(), rb_str_new2, and RTEST.

Referenced by Init_generator().

static VALUE cState_array_nl | ( | VALUE | self) |  |
| static

Definition at line 1149 of file generator.c.

References GET_STATE, rb_str_new(), and rb_str_new2.

Referenced by Init_generator().

static VALUE cState_array_nl_set | ( | VALUE | self,
|  | VALUE | array_nl
| ) |  |
| static

Definition at line 1160 of file generator.c.

References Check_Type, GET_STATE, NULL, Qnil, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.

Referenced by Init_generator().

static VALUE cState_ascii_only_p | ( | VALUE | self) |  |
| static

Definition at line 1235 of file generator.c.

References GET_STATE, Qfalse, and Qtrue.

Referenced by Init_generator().

static VALUE cState_aset | ( | VALUE | self,
|  | VALUE | name,
|  | VALUE | value
| ) |  |
| static

Definition at line 658 of file generator.c.

References i_respond_to_p, i_send, i_to_s, Qnil, rb_funcall(), rb_intern_str, rb_ivar_set(), rb_str_cat2(), rb_str_concat(), rb_str_dup(), rb_str_new2, and RTEST.

Referenced by Init_generator().

static VALUE cState_buffer_initial_length | ( | VALUE | self) |  |
| static

Definition at line 1294 of file generator.c.

References GET_STATE, and LONG2FIX.

Referenced by Init_generator().

static VALUE cState_buffer_initial_length_set | ( | VALUE | self,
|  | VALUE | buffer_initial_length
| ) |  |
| static

Definition at line 1306 of file generator.c.

References Check_Type, FIX2LONG, GET_STATE, Qnil, and T_FIXNUM.

Referenced by Init_generator().

static VALUE cState_check_circular_p | ( | VALUE | self) |  |
| static

Definition at line 1186 of file generator.c.

References GET_STATE, Qfalse, and Qtrue.

Referenced by Init_generator().

static VALUE cState_configure | ( | VALUE | self,
|  | VALUE | opts
| ) |  |
| static

Definition at line 510 of file generator.c.

References Check_Type, FIX2LONG, fstrndup(), GET_STATE, i_allow_nan, i_array_nl, i_ascii_only, i_buffer_initial_length, i_depth, i_indent, i_max_nesting, i_object_nl, i_quirks_mode, i_space, i_space_before, ID2SYM, 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().

static VALUE cState_depth | ( | VALUE | self) |  |
| static

Definition at line 1269 of file generator.c.

References GET_STATE, and LONG2FIX.

Referenced by Init_generator().

static VALUE cState_depth_set | ( | VALUE | self,
|  | VALUE | depth
| ) |  |
| static

Definition at line 1281 of file generator.c.

References Check_Type, FIX2LONG, GET_STATE, Qnil, and T_FIXNUM.

Referenced by Init_generator().

static VALUE cState_from_state_s | ( | VALUE | self,
|  | VALUE | opts
| ) |  |
| static

Definition at line 983 of file generator.c.

References CJSON_SAFE_STATE_PROTOTYPE, i_dup, i_new, i_SAFE_STATE_PROTOTYPE, mJSON, NIL_P, rb_cHash, rb_const_get(), rb_funcall(), and rb_obj_is_kind_of().

Referenced by Init_generator(), and mObject_to_json().

static VALUE cState_generate | ( | VALUE | self,
|  | VALUE | obj
| ) |  |
| static

Definition at line 909 of file generator.c.

References cState_partial_generate(), eGeneratorError, GET_STATE, isArrayOrObject(), rb_raise(), and result.

Referenced by Init_generator().

static VALUE cState_indent | ( | VALUE | self) |  |
| static

Definition at line 1002 of file generator.c.

References GET_STATE, rb_str_new(), and rb_str_new2.

Referenced by Init_generator().

static VALUE cState_indent_set | ( | VALUE | self,
|  | VALUE | indent
| ) |  |
| static

Definition at line 1013 of file generator.c.

References Check_Type, GET_STATE, NULL, Qnil, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.

Referenced by Init_generator().

static VALUE cState_init_copy | ( | VALUE | obj,
|  | VALUE | orig
| ) |  |
| static

Definition at line 956 of file generator.c.

References JSON_Generator_StateStruct::array_delim, JSON_Generator_StateStruct::array_nl, JSON_Generator_StateStruct::array_nl_len, Data_Get_Struct, 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().

static VALUE cState_initialize | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 939 of file generator.c.

References cState_configure(), FBUFFER_INITIAL_LENGTH_DEFAULT, GET_STATE, NIL_P, and rb_scan_args().

Referenced by Init_generator().

static VALUE cState_max_nesting | ( | VALUE | self) |  |
| static

Definition at line 1198 of file generator.c.

References GET_STATE, and LONG2FIX.

Referenced by Init_generator().

static VALUE cState_max_nesting_set | ( | VALUE | self,
|  | VALUE | depth
| ) |  |
| static

Definition at line 1210 of file generator.c.

References Check_Type, FIX2LONG, GET_STATE, and T_FIXNUM.

Referenced by Init_generator().

static VALUE cState_object_nl | ( | VALUE | self) |  |
| static

Definition at line 1113 of file generator.c.

References GET_STATE, rb_str_new(), and rb_str_new2.

Referenced by Init_generator().

static VALUE cState_object_nl_set | ( | VALUE | self,
|  | VALUE | object_nl
| ) |  |
| static

Definition at line 1125 of file generator.c.

References Check_Type, GET_STATE, NULL, Qnil, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.

Referenced by Init_generator().

static VALUE cState_partial_generate | ( | VALUE | self,
|  | VALUE | obj
| ) |  |
| static

Definition at line 879 of file generator.c.

References cState_prepare_buffer(), generate_json(), and GET_STATE.

Referenced by cState_generate(), and mObject_to_json().

static FBuffer* cState_prepare_buffer | ( | VALUE | self) |  |
| static

Definition at line 849 of file generator.c.

References fbuffer_alloc(), fbuffer_append(), fbuffer_append_char(), fbuffer_clear(), and GET_STATE.

Referenced by cState_partial_generate().

static VALUE cState_quirks_mode_p | ( | VALUE | self) |  |
| static

Definition at line 1246 of file generator.c.

References GET_STATE, Qfalse, and Qtrue.

Referenced by Init_generator().

static VALUE cState_quirks_mode_set | ( | VALUE | self,
|  | VALUE | enable
| ) |  |
| static

Definition at line 1257 of file generator.c.

References GET_STATE, Qnil, and RTEST.

Referenced by Init_generator().

static VALUE cState_s_allocate | ( | VALUE | klass) |  |
| static

Definition at line 498 of file generator.c.

References Data_Wrap_Struct, NULL, State_allocate(), and State_free().

Referenced by Init_generator().

static VALUE cState_space | ( | VALUE | self) |  |
| static

Definition at line 1039 of file generator.c.

References GET_STATE, rb_str_new(), and rb_str_new2.

Referenced by Init_generator().

static VALUE cState_space_before | ( | VALUE | self) |  |
| static

Definition at line 1076 of file generator.c.

References GET_STATE, rb_str_new(), and rb_str_new2.

Referenced by Init_generator().

static VALUE cState_space_before_set | ( | VALUE | self,
|  | VALUE | space_before
| ) |  |
| static

Definition at line 1087 of file generator.c.

References Check_Type, GET_STATE, NULL, Qnil, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.

Referenced by Init_generator().

static VALUE cState_space_set | ( | VALUE | self,
|  | VALUE | space
| ) |  |
| static

Definition at line 1051 of file generator.c.

References Check_Type, GET_STATE, NULL, Qnil, RSTRING_LEN, RSTRING_PTR, ruby_xfree(), strdup, and T_STRING.

Referenced by Init_generator().

static VALUE cState_to_h | ( | VALUE | self) |  |
| static

Definition at line 619 of file generator.c.

References GET_STATE, i_allow_nan, i_array_nl, i_ascii_only, i_buffer_initial_length, i_depth, i_indent, i_max_nesting, i_object_nl, i_quirks_mode, i_space, i_space_before, ID2SYM, LONG2FIX, Qfalse, Qtrue, rb_hash_aset(), rb_hash_new(), rb_str_new(), result, and set_state_ivars().

Referenced by Init_generator().

static char* fstrndup | ( | const char * | ptr,
|  | unsigned long | len
| ) |  |
| static

Definition at line 289 of file generator.c.

References ALLOC_N, NULL, and result.

Referenced by cState_configure(), and cState_init_copy().

static void generate_json | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 816 of file generator.c.

References Check_Type, CLASS_OF, generate_json_array(), generate_json_bignum(), generate_json_false(), generate_json_fixnum(), generate_json_float(), generate_json_null(), generate_json_object(), generate_json_string(), generate_json_true(), i_to_json, i_to_s, Qfalse, Qnil, Qtrue, rb_cArray, rb_cBignum, rb_cFixnum, rb_cFloat, rb_cHash, rb_cString, rb_funcall(), rb_respond_to(), and T_STRING.

Referenced by cState_partial_generate(), generate_json_array(), and generate_json_object().

static void generate_json_array | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 721 of file generator.c.

References JSON_Generator_StateStruct::array_delim, JSON_Generator_StateStruct::array_nl, JSON_Generator_StateStruct::array_nl_len, JSON_Generator_StateStruct::depth, eNestingError, fbuffer_append(), fbuffer_append_char(), fbuffer_free(), FBUFFER_LEN, FBUFFER_PTR, generate_json(), i, JSON_Generator_StateStruct::indent, JSON_Generator_StateStruct::indent_len, JSON_Generator_StateStruct::max_nesting, RARRAY_LEN, rb_ary_entry(), and rb_raise().

Referenced by generate_json().

static void generate_json_bignum | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 793 of file generator.c.

References i_to_s, and rb_funcall().

Referenced by generate_json().

static void generate_json_false | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 778 of file generator.c.

References fbuffer_append().

Referenced by generate_json().

static void generate_json_fixnum | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 788 of file generator.c.

References FIX2LONG.

Referenced by generate_json().

static void generate_json_float | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 799 of file generator.c.

References JSON_Generator_StateStruct::allow_nan, eGeneratorError, fbuffer_free(), i_to_s, isinf(), isnan, rb_funcall(), rb_raise(), RFLOAT_VALUE, and StringValueCStr.

Referenced by generate_json().

static void generate_json_null | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 773 of file generator.c.

References fbuffer_append().

Referenced by generate_json().

static void generate_json_object | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 672 of file generator.c.

References Check_Type, JSON_Generator_StateStruct::depth, eNestingError, fbuffer_append(), fbuffer_append_char(), fbuffer_free(), FBUFFER_LEN, FBUFFER_PTR, generate_json(), i, i_keys, i_to_s, JSON_Generator_StateStruct::indent, JSON_Generator_StateStruct::indent_len, key, 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_raise(), and T_STRING.

Referenced by generate_json().

static void generate_json_string | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 759 of file generator.c.

References JSON_Generator_StateStruct::ascii_only, CEncoding_UTF_8, convert_UTF8_to_JSON(), convert_UTF8_to_JSON_ASCII(), fbuffer_append_char(), i_encode, and rb_funcall().

Referenced by generate_json().

static void generate_json_true | ( | FBuffer * | buffer,
|  | VALUE | Vstate,
|  | JSON_Generator_State * | state,
|  | VALUE | obj
| ) |  |
| static

Definition at line 783 of file generator.c.

References fbuffer_append().

Referenced by generate_json().

void Init_generator | ( | ) |  |

Definition at line 1321 of file generator.c.

References CEncoding_UTF_8, 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_aset(), cState_buffer_initial_length(), cState_buffer_initial_length_set(), cState_check_circular_p(), cState_configure(), cState_depth(), cState_depth_set(), 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_quirks_mode_p(), cState_quirks_mode_set(), 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_buffer_initial_length, i_create_id, i_depth, i_dup, i_encode, i_encoding, i_extend, i_indent, i_key_p, i_keys, i_match, i_max_nesting, i_new, i_object_nl, i_pack, i_quirks_mode, i_respond_to_p, i_SAFE_STATE_PROTOTYPE, i_send, i_space, i_space_before, i_to_json, i_to_s, i_unpack, mArray, mArray_to_json(), mBignum, mBignum_to_json(), mExt, mFalseClass, mFalseClass_to_json(), mFixnum, mFixnum_to_json(), mFloat, mFloat_to_json(), mGenerator, mGeneratorMethods, mHash, mHash_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(), Qnil, rb_cObject, rb_const_get(), rb_cRegexp, rb_define_alias(), 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 int isArrayOrObject | ( | VALUE | string) |  |
| static

Definition at line 892 of file generator.c.

References p, RSTRING_LEN, and RSTRING_PTR.

Referenced by cState_generate().

static unsigned char isLegalUTF8 | ( | const UTF8 * | source,
|  | unsigned long | length
| ) |  |
| static

Definition at line 79 of file generator.c.

Referenced by convert_UTF8_to_JSON_ASCII().

static VALUE mArray_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 330 of file generator.c.

References GENERATE_JSON.

Referenced by Init_generator().

static VALUE mBignum_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 349 of file generator.c.

References GENERATE_JSON.

Referenced by Init_generator().

static VALUE mFalseClass_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 446 of file generator.c.

References GENERATE_JSON.

Referenced by Init_generator().

static VALUE mFixnum_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 339 of file generator.c.

References GENERATE_JSON.

Referenced by Init_generator().

static VALUE mFloat_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 359 of file generator.c.

References GENERATE_JSON.

Referenced by Init_generator().

static VALUE mHash_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 317 of file generator.c.

References GENERATE_JSON.

Referenced by Init_generator(), and mString_to_json_raw().

static VALUE mNilClass_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 456 of file generator.c.

References GENERATE_JSON.

Referenced by Init_generator().

static VALUE mObject_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 468 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().

static VALUE mString_Extend_json_create | ( | VALUE | self,
|  | VALUE | o
| ) |  |
| static

Definition at line 423 of file generator.c.

References Check_Type, i_pack, rb_funcall(), rb_hash_aref(), rb_str_new2, and T_HASH.

Referenced by Init_generator().

static VALUE mString_included_s | ( | VALUE | self,
|  | VALUE | modul
| ) |  |
| static

Definition at line 369 of file generator.c.

References i_extend, mString_Extend, rb_funcall(), and result.

Referenced by Init_generator().

static VALUE mString_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 381 of file generator.c.

References GENERATE_JSON.

Referenced by Init_generator().

static VALUE mString_to_json_raw | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 410 of file generator.c.

References Check_Type, mHash_to_json(), mString_to_json_raw_object(), and T_HASH.

Referenced by Init_generator().

static VALUE mString_to_json_raw_object | ( | VALUE | self) |  |
| static

Definition at line 394 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().

static VALUE mTrueClass_to_json | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 436 of file generator.c.

References GENERATE_JSON.

Referenced by Init_generator().

static void set_state_ivars | ( | VALUE | hash,
|  | VALUE | state
| ) |  |
| static

Definition at line 601 of file generator.c.

References i, i_to_s, key, RARRAY_LEN, rb_ary_entry(), rb_funcall(), rb_hash_aset(), rb_iv_get(), rb_obj_instance_variables, rb_str_intern(), rb_str_substr(), RSTRING_LEN, and StringValueCStr.

Referenced by cState_to_h().

static JSON_Generator_State* State_allocate | ( | ) |  |
| static

Definition at line 491 of file generator.c.

References ALLOC, and MEMZERO.

Referenced by cState_s_allocate().

static void State_free | ( | JSON_Generator_State * | state) |  |
| static

Definition at line 478 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 106 of file generator.c.

Referenced by convert_UTF8_to_JSON(), and unicode_escape_to_buffer().

static void unicode_escape_to_buffer | ( | FBuffer * | buffer,
|  | char | buf[6],
|  | UTF16 | character
| ) |  |
| static

Definition at line 118 of file generator.c.

References fbuffer_append(), and unicode_escape().

Referenced by convert_UTF8_to_JSON_ASCII().

## Variable Documentation

VALUE CEncoding_UTF_8
| static

Definition at line 5 of file generator.c.

Referenced by generate_json_string(), and Init_generator().

VALUE CJSON_SAFE_STATE_PROTOTYPE
| static

Definition at line 9 of file generator.c.

Referenced by cState_from_state_s(), and Init_generator().

VALUE CRegexp_MULTILINE
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE cState
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator(), and mObject_to_json().

VALUE eGeneratorError
| static

Definition at line 9 of file generator.c.

Referenced by cState_generate(), generate_json_float(), and Init_generator().

VALUE eNestingError
| static

Definition at line 9 of file generator.c.

Referenced by generate_json_array(), generate_json_object(), and Init_generator().

ID i_allow_nan
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_aref
| static

Definition at line 15 of file generator.c.

Referenced by Init_generator().

ID i_array_nl
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_ascii_only
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_buffer_initial_length
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_create_id
| static

Definition at line 15 of file generator.c.

Referenced by Init_generator(), and mString_to_json_raw_object().

ID i_depth
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_dup
| static

Definition at line 15 of file generator.c.

Referenced by cState_from_state_s(), and Init_generator().

ID i_encode
| static

Definition at line 6 of file generator.c.

Referenced by generate_json_string(), and Init_generator().

ID i_encoding
| static

Definition at line 6 of file generator.c.

Referenced by Init_generator().

ID i_extend
| static

Definition at line 15 of file generator.c.

Referenced by Init_generator(), and mString_included_s().

ID i_indent
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_key_p
| static

Definition at line 15 of file generator.c.

Referenced by Init_generator().

ID i_keys
| static

Definition at line 15 of file generator.c.

Referenced by generate_json_object(), and Init_generator().

ID i_match
| static

Definition at line 15 of file generator.c.

Referenced by Init_generator().

ID i_max_nesting
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_new
| static

Definition at line 15 of file generator.c.

Referenced by cState_from_state_s(), and Init_generator().

ID i_object_nl
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_pack
| static

Definition at line 15 of file generator.c.

Referenced by Init_generator(), and mString_Extend_json_create().

ID i_quirks_mode
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_respond_to_p
| static

Definition at line 15 of file generator.c.

Referenced by cState_aref(), cState_aset(), and Init_generator().

VALUE i_SAFE_STATE_PROTOTYPE
| static

Definition at line 9 of file generator.c.

Referenced by cState_from_state_s(), and Init_generator().

ID i_send
| static

Definition at line 15 of file generator.c.

Referenced by cState_aref(), cState_aset(), and Init_generator().

ID i_space
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_space_before
| static

Definition at line 15 of file generator.c.

Referenced by cState_configure(), cState_to_h(), and Init_generator().

ID i_to_json
| static

Definition at line 15 of file generator.c.

Referenced by generate_json(), and Init_generator().

ID i_to_s
| static

Definition at line 15 of file generator.c.

Referenced by cState_aref(), cState_aset(), generate_json(), generate_json_bignum(), generate_json_float(), generate_json_object(), Init_generator(), mObject_to_json(), and set_state_ivars().

ID i_unpack
| static

Definition at line 15 of file generator.c.

Referenced by Init_generator(), and mString_to_json_raw_object().

VALUE mArray
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mBignum
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mExt
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mFalseClass
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mFixnum
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mFloat
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mGenerator
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mGeneratorMethods
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mHash
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mJSON
| static

Definition at line 9 of file generator.c.

Referenced by cState_from_state_s(), Init_generator(), and mString_to_json_raw_object().

VALUE mNilClass
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mObject
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mString
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

VALUE mString_Extend
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator(), and mString_included_s().

VALUE mTrueClass
| static

Definition at line 9 of file generator.c.

Referenced by Init_generator().

const UTF32 offsetsFromUTF8[6]
| static

Initial value:
= { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL }

Definition at line 66 of file generator.c.

Referenced by convert_UTF8_to_JSON_ASCII().

const char trailingBytesForUTF8[256]
| static

Initial value:
= {
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 50 of file generator.c.

Referenced by convert_UTF8_to_JSON_ASCII().