#include <string.h>#include <math.h>#include <ctype.h>#include "ruby.h"#include "re.h"Go to the source code of this file.
Data Structures | |
| struct | JSON_Generator_StateStruct |
Defines | |
| #define | rb_intern_str(string) SYM2ID(rb_str_intern(string)) |
| #define | rb_obj_instance_variables(object) rb_funcall(object, rb_intern("instance_variables"), 0) |
| #define | option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key)) |
| #define | UNI_STRICT_CONVERSION 1 |
| #define | UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD |
| #define | UNI_MAX_BMP (UTF32)0x0000FFFF |
| #define | UNI_MAX_UTF16 (UTF32)0x0010FFFF |
| #define | UNI_MAX_UTF32 (UTF32)0x7FFFFFFF |
| #define | UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF |
| #define | UNI_SUR_HIGH_START (UTF32)0xD800 |
| #define | UNI_SUR_HIGH_END (UTF32)0xDBFF |
| #define | UNI_SUR_LOW_START (UTF32)0xDC00 |
| #define | UNI_SUR_LOW_END (UTF32)0xDFFF |
| #define | GET_STATE(self) |
| #define | GENERATE_JSON(type) |
Typedefs | |
| typedef unsigned long | UTF32 |
| typedef unsigned short | UTF16 |
| typedef unsigned char | UTF8 |
| typedef struct JSON_Generator_StateStruct | JSON_Generator_State |
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 VALUE | cState_to_h (VALUE self) |
| static void | generate_json (FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj) |
| 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 VALUE | cState_partial_generate (VALUE self, VALUE obj) |
| static VALUE | cState_generate (VALUE self, VALUE obj) |
| static VALUE | cState_initialize (int argc, VALUE *argv, VALUE self) |
| 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_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_depth (VALUE self) |
| static VALUE | cState_depth_set (VALUE self, VALUE depth) |
| static FBuffer * | cState_prepare_buffer (VALUE self) |
Variables | |
| static const int | halfShift = 10 |
| static const UTF32 | halfBase = 0x0010000UL |
| static const UTF32 | halfMask = 0x3FFUL |
| #define GENERATE_JSON | ( | type | ) |
FBuffer *buffer; \ VALUE Vstate; \ JSON_Generator_State *state; \ \ rb_scan_args(argc, argv, "01", &Vstate); \ Vstate = cState_from_state_s(cState, Vstate); \ Data_Get_Struct(Vstate, JSON_Generator_State, state); \ buffer = cState_prepare_buffer(Vstate); \ generate_json_##type(buffer, Vstate, state, self); \ return fbuffer_to_s(buffer)
Definition at line 85 of file generator.h.
Referenced by mArray_to_json(), mBignum_to_json(), mFalseClass_to_json(), mFixnum_to_json(), mFloat_to_json(), mHash_to_json(), mNilClass_to_json(), mString_to_json(), and mTrueClass_to_json().
| #define GET_STATE | ( | self | ) |
JSON_Generator_State *state; \ Data_Get_Struct(self, JSON_Generator_State, state)
Definition at line 81 of file generator.h.
Referenced by cState_allow_nan_p(), cState_array_nl(), cState_array_nl_set(), cState_ascii_only_p(), cState_buffer_initial_length(), cState_buffer_initial_length_set(), cState_check_circular_p(), cState_configure(), cState_depth(), cState_depth_set(), cState_generate(), cState_indent(), cState_indent_set(), cState_initialize(), cState_max_nesting(), cState_max_nesting_set(), cState_object_nl(), cState_object_nl_set(), cState_partial_generate(), cState_prepare_buffer(), cState_quirks_mode_p(), cState_quirks_mode_set(), cState_space(), cState_space_before(), cState_space_before_set(), cState_space_set(), and cState_to_h().
Definition at line 24 of file generator.h.
Referenced by cParser_initialize(), and cState_configure().
| #define rb_intern_str | ( | string | ) | SYM2ID(rb_str_intern(string)) |
Definition at line 17 of file generator.h.
Referenced by cbsubst_get_subst_arg(), cbsubst_sym_to_subst(), cbsubst_table_setup(), cState_aref(), cState_aset(), dsym_node_gen(), each_attr_def(), r_symreal(), rb_attr(), rb_set_class_path_string(), rb_str_intern(), w_unique(), and yyparse().
| #define rb_obj_instance_variables | ( | object | ) | rb_funcall(object, rb_intern("instance_variables"), 0) |
Definition at line 21 of file generator.h.
Referenced by Init_Object(), and set_state_ivars().
| #define UNI_MAX_BMP (UTF32)0x0000FFFF |
Definition at line 35 of file generator.h.
Referenced by convert_UTF8_to_JSON_ASCII().
| #define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF |
Definition at line 38 of file generator.h.
| #define UNI_MAX_UTF16 (UTF32)0x0010FFFF |
Definition at line 36 of file generator.h.
Referenced by convert_UTF8_to_JSON_ASCII().
| #define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF |
Definition at line 37 of file generator.h.
| #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD |
Definition at line 34 of file generator.h.
Referenced by convert_UTF8_to_JSON_ASCII(), and unescape_unicode().
| #define UNI_STRICT_CONVERSION 1 |
Definition at line 28 of file generator.h.
| #define UNI_SUR_HIGH_END (UTF32)0xDBFF |
Definition at line 41 of file generator.h.
| #define UNI_SUR_HIGH_START (UTF32)0xD800 |
Definition at line 40 of file generator.h.
Referenced by convert_UTF8_to_JSON_ASCII(), and json_string_unescape().
| #define UNI_SUR_LOW_END (UTF32)0xDFFF |
Definition at line 43 of file generator.h.
Referenced by convert_UTF8_to_JSON_ASCII().
| #define UNI_SUR_LOW_START (UTF32)0xDC00 |
Definition at line 42 of file generator.h.
Referenced by convert_UTF8_to_JSON_ASCII().
| typedef struct JSON_Generator_StateStruct JSON_Generator_State |
| typedef unsigned short UTF16 |
Definition at line 31 of file generator.h.
| typedef unsigned long UTF32 |
Definition at line 30 of file generator.h.
| typedef unsigned char UTF8 |
Definition at line 32 of file generator.h.
| static void convert_UTF8_to_JSON | ( | FBuffer * | buffer, | |
| VALUE | string | |||
| ) | [static] |
| static void convert_UTF8_to_JSON_ASCII | ( | FBuffer * | buffer, | |
| VALUE | string | |||
| ) | [static] |
| static VALUE cState_allow_nan_p | ( | VALUE | self | ) | [static] |
| static VALUE cState_array_nl | ( | VALUE | self | ) | [static] |
| static VALUE cState_array_nl_set | ( | VALUE | self, | |
| VALUE | array_nl | |||
| ) | [static] |
| static VALUE cState_ascii_only_p | ( | VALUE | self | ) | [static] |
| static VALUE cState_configure | ( | VALUE | self, | |
| VALUE | opts | |||
| ) | [static] |
| static VALUE cState_depth | ( | VALUE | self | ) | [static] |
| static VALUE cState_depth_set | ( | VALUE | self, | |
| VALUE | depth | |||
| ) | [static] |
| static VALUE cState_from_state_s | ( | VALUE | self, | |
| VALUE | opts | |||
| ) | [static] |
| static VALUE cState_generate | ( | VALUE | self, | |
| VALUE | obj | |||
| ) | [static] |
| static VALUE cState_indent | ( | VALUE | self | ) | [static] |
| static VALUE cState_indent_set | ( | VALUE | self, | |
| VALUE | indent | |||
| ) | [static] |
| static VALUE cState_initialize | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE cState_max_nesting | ( | VALUE | self | ) | [static] |
| static VALUE cState_max_nesting_set | ( | VALUE | self, | |
| VALUE | depth | |||
| ) | [static] |
| static VALUE cState_object_nl | ( | VALUE | self | ) | [static] |
| static VALUE cState_object_nl_set | ( | VALUE | self, | |
| VALUE | object_nl | |||
| ) | [static] |
| static VALUE cState_partial_generate | ( | VALUE | self, | |
| VALUE | obj | |||
| ) | [static] |
| static FBuffer* cState_prepare_buffer | ( | VALUE | self | ) | [static] |
| static VALUE cState_s_allocate | ( | VALUE | klass | ) | [static] |
| static VALUE cState_space | ( | VALUE | self | ) | [static] |
| static VALUE cState_space_before | ( | VALUE | self | ) | [static] |
| static VALUE cState_space_before_set | ( | VALUE | self, | |
| VALUE | space_before | |||
| ) | [static] |
| static VALUE cState_space_set | ( | VALUE | self, | |
| VALUE | space | |||
| ) | [static] |
| static VALUE cState_to_h | ( | VALUE | self | ) | [static] |
| static char* fstrndup | ( | const char * | ptr, | |
| unsigned long | len | |||
| ) | [static] |
| static void generate_json | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static void generate_json_array | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static void generate_json_bignum | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static void generate_json_false | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static void generate_json_fixnum | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static void generate_json_float | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static void generate_json_null | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static void generate_json_object | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static void generate_json_string | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static void generate_json_true | ( | FBuffer * | buffer, | |
| VALUE | Vstate, | |||
| JSON_Generator_State * | state, | |||
| VALUE | obj | |||
| ) | [static] |
| static unsigned char isLegalUTF8 | ( | const UTF8 * | source, | |
| unsigned long | length | |||
| ) | [static] |
| static VALUE mArray_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mBignum_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mFalseClass_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mFixnum_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mFloat_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mHash_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mNilClass_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mObject_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mString_Extend_json_create | ( | VALUE | self, | |
| VALUE | o | |||
| ) | [static] |
| static VALUE mString_included_s | ( | VALUE | self, | |
| VALUE | modul | |||
| ) | [static] |
| static VALUE mString_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mString_to_json_raw | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static VALUE mString_to_json_raw_object | ( | VALUE | self | ) | [static] |
| static VALUE mTrueClass_to_json | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | self | |||
| ) | [static] |
| static JSON_Generator_State* State_allocate | ( | ) | [static] |
| static void State_free | ( | JSON_Generator_State * | state | ) | [static] |
| static void unicode_escape | ( | char * | buf, | |
| UTF16 | character | |||
| ) | [static] |
Definition at line 47 of file generator.h.
Referenced by convert_UTF8_to_JSON_ASCII().
Definition at line 48 of file generator.h.
Referenced by convert_UTF8_to_JSON_ASCII().
const int halfShift = 10 [static] |
Definition at line 45 of file generator.h.
Referenced by convert_UTF8_to_JSON_ASCII().
1.6.1