16 #define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key)) 22 typedef unsigned char UTF8;
24 #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD 25 #define UNI_SUR_HIGH_START (UTF32)0xD800 26 #define UNI_SUR_HIGH_END (UTF32)0xDBFF 27 #define UNI_SUR_LOW_START (UTF32)0xDC00 28 #define UNI_SUR_LOW_END (UTF32)0xDFFF 50 if (!json->Vsource) rb_raise(rb_eTypeError, "uninitialized instance") 51 #define GET_PARSER_INIT \ 53 TypedData_Get_Struct(self, JSON_Parser, &JSON_Parser_type, json) 55 #define MinusInfinity "-Infinity" 58 static UTF32 unescape_unicode(
const unsigned char *p);
59 static int convert_UTF32_to_UTF8(
char *
buf,
UTF32 ch);
60 static char *JSON_parse_object(
JSON_Parser *json,
char *p,
char *pe,
VALUE *result,
int current_nesting);
61 static char *JSON_parse_value(
JSON_Parser *json,
char *p,
char *pe,
VALUE *result,
int current_nesting);
62 static char *JSON_parse_integer(
JSON_Parser *json,
char *p,
char *pe,
VALUE *result);
63 static char *JSON_parse_float(
JSON_Parser *json,
char *p,
char *pe,
VALUE *result);
64 static char *JSON_parse_array(
JSON_Parser *json,
char *p,
char *pe,
VALUE *result,
int current_nesting);
65 static VALUE json_string_unescape(
VALUE result,
char *
string,
char *stringEnd);
66 static char *JSON_parse_string(
JSON_Parser *json,
char *p,
char *pe,
VALUE *result);
70 static void JSON_mark(
void *json);
71 static void JSON_free(
void *json);
72 static VALUE cJSON_parser_s_allocate(
VALUE klass);
75 #define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type))) 76 static inline void *ruby_zalloc(
size_t n)
83 #ifdef TypedData_Make_Struct 85 #define NEW_TYPEDDATA_WRAPPER 1 87 #define TypedData_Make_Struct(klass, type, ignore, json) Data_Make_Struct(klass, type, NULL, JSON_free, json) 88 #define TypedData_Get_Struct(self, JSON_Parser, ignore, json) Data_Get_Struct(self, JSON_Parser, json)
unsigned char buf[MIME_BUF_SIZE]
void * ruby_xmalloc(size_t size)
struct JSON_ParserStruct JSON_Parser