-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathhprose_raw_reader.c
67 lines (55 loc) · 2.56 KB
/
hprose_raw_reader.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**********************************************************\
| |
| hprose |
| |
| Official WebSite: http://www.hprose.com/ |
| http://www.hprose.org/ |
| |
\**********************************************************/
/**********************************************************\
* *
* hprose_raw_reader.c *
* *
* hprose raw reader for pecl source file. *
* *
* LastModified: Apr 8, 2015 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/
#include "hprose_raw_reader.h"
ZEND_METHOD(hprose_raw_reader, __construct) {
zval *obj = NULL;
HPROSE_OBJECT_INTERN(raw_reader);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &obj) == SUCCESS) {
intern->_this = hprose_raw_reader_create(HPROSE_GET_OBJECT_P(bytes_io, obj)->_this);
}
}
ZEND_METHOD(hprose_raw_reader, readRaw) {
HPROSE_THIS(raw_reader);
object_init_ex(return_value, get_hprose_bytes_io_ce());
HPROSE_GET_OBJECT_P(bytes_io, return_value)->_this = hprose_raw_reader_read_raw(_this TSRMLS_CC);
HPROSE_GET_OBJECT_P(bytes_io, return_value)->mark = -1;
}
ZEND_BEGIN_ARG_INFO_EX(hprose_raw_reader_construct_arginfo, 0, 0, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(hprose_raw_reader_read_raw_arginfo, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry hprose_raw_reader_methods[] = {
ZEND_ME(hprose_raw_reader, __construct, hprose_raw_reader_construct_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
ZEND_ME(hprose_raw_reader, readRaw, hprose_raw_reader_read_raw_arginfo, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
HPROSE_OBJECT_HANDLERS(raw_reader)
HPROSE_OBJECT_FREE_BEGIN(raw_reader)
if (intern->_this) {
hprose_raw_reader_free(intern->_this);
intern->_this = NULL;
}
HPROSE_OBJECT_FREE_END
HPROSE_OBJECT_SIMPLE_NEW(raw_reader)
HPROSE_CLASS_ENTRY(raw_reader)
HPROSE_STARTUP_FUNCTION(raw_reader) {
HPROSE_REGISTER_CLASS("Hprose", "RawReader", raw_reader);
HPROSE_REGISTER_CLASS_HANDLERS(raw_reader);
return SUCCESS;
}