1 /* JSON_parser.h */ 2 3 #ifndef JSON_PARSER_H 4 #define JSON_PARSER_H 5 6 #include "php.h" 7 #include "ext/standard/php_smart_str.h" 8 9 #define JSON_PARSER_DEFAULT_DEPTH 512 10 11 typedef struct JSON_parser_struct { 12 int state; 13 int depth; 14 int top; 15 int error_code; 16 int* stack; 17 zval **the_zstack; 18 zval *the_static_zstack[JSON_PARSER_DEFAULT_DEPTH]; 19 } * JSON_parser; 20 21 enum error_codes { 22 PHP_JSON_ERROR_NONE = 0, 23 PHP_JSON_ERROR_DEPTH, 24 PHP_JSON_ERROR_STATE_MISMATCH, 25 PHP_JSON_ERROR_CTRL_CHAR, 26 PHP_JSON_ERROR_SYNTAX, 27 PHP_JSON_ERROR_UTF8 28 }; 29 30 extern JSON_parser new_JSON_parser(int depth); 31 extern int parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc TSRMLS_DC); 32 extern int free_JSON_parser(JSON_parser jp); 33 #endif 34