File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / json / JSON_parser.h
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:40 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

    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: #include "php_json.h"
    9: 
   10: #define JSON_PARSER_DEFAULT_DEPTH 512
   11: 
   12: typedef struct JSON_parser_struct {
   13:     int state;
   14:     int depth;
   15:     int top;
   16: 	int error_code;
   17:     int* stack;
   18:     zval **the_zstack;
   19:     zval *the_static_zstack[JSON_PARSER_DEFAULT_DEPTH];
   20: } * JSON_parser;
   21: 
   22: enum error_codes {
   23: 	PHP_JSON_ERROR_NONE = 0,
   24:     PHP_JSON_ERROR_DEPTH, 
   25:     PHP_JSON_ERROR_STATE_MISMATCH,  
   26:     PHP_JSON_ERROR_CTRL_CHAR,   
   27:     PHP_JSON_ERROR_SYNTAX,
   28:     PHP_JSON_ERROR_UTF8
   29: };
   30: 
   31: extern JSON_parser new_JSON_parser(int depth);
   32: extern int parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int options TSRMLS_DC);
   33: extern int free_JSON_parser(JSON_parser jp);
   34: 
   35: static inline int parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc TSRMLS_DC)
   36: {
   37: 	return parse_JSON_ex(jp, z, utf16_json, length, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0 TSRMLS_CC);
   38: }
   39: 
   40: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>