Back to index

php5  5.3.10
JSON_parser.h
Go to the documentation of this file.
00001 /* JSON_parser.h */
00002 
00003 #ifndef JSON_PARSER_H
00004 #define JSON_PARSER_H
00005 
00006 #include "php.h"
00007 #include "ext/standard/php_smart_str.h"
00008 
00009 #define JSON_PARSER_DEFAULT_DEPTH 512
00010 
00011 typedef struct JSON_parser_struct {
00012     int state;
00013     int depth;
00014     int top;
00015        int error_code;
00016     int* stack;
00017     zval **the_zstack;
00018     zval *the_static_zstack[JSON_PARSER_DEFAULT_DEPTH];
00019 } * JSON_parser;
00020 
00021 enum error_codes {
00022        PHP_JSON_ERROR_NONE = 0,
00023     PHP_JSON_ERROR_DEPTH, 
00024     PHP_JSON_ERROR_STATE_MISMATCH,  
00025     PHP_JSON_ERROR_CTRL_CHAR,   
00026     PHP_JSON_ERROR_SYNTAX,
00027     PHP_JSON_ERROR_UTF8
00028 };
00029 
00030 extern JSON_parser new_JSON_parser(int depth);
00031 extern int parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc TSRMLS_DC);
00032 extern int free_JSON_parser(JSON_parser jp);
00033 #endif