Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 678 lines (581 sloc) 19.652 kb
c2e0d3a @chobie for now, adding base render.
authored
1 /*
798c4cf @chobie change license to PHP License from MIT.
authored
2 +----------------------------------------------------------------------+
3 | PHP Version 5 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2011 The PHP Group |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Shuhei Tanuma <chobieee@gmail.com> |
16 +----------------------------------------------------------------------+
c2e0d3a @chobie for now, adding base render.
authored
17 */
18
19 #include "php_sundown.h"
20
21 zend_class_entry *sundown_render_base_class_entry;
22
d2a67c7 @chobie add create object functions to render_base
authored
23 static void php_sundown_render_base_free_storage(php_sundown_render_base_t *obj TSRMLS_DC)
24 {
25 zend_object_std_dtor(&obj->zo TSRMLS_CC);
26 efree(obj);
27 }
28
29 zend_object_value php_sundown_render_base_new(zend_class_entry *ce TSRMLS_DC)
30 {
31 zend_object_value retval;
32 php_sundown_render_base_t *obj;
33 zval *tmp;
34
35 obj = ecalloc(1, sizeof(*obj));
36 zend_object_std_init( &obj->zo, ce TSRMLS_CC);
4482819 @chobie PHP5.4 compatibility
authored
37 #if ZEND_MODULE_API_NO >= 20100525
38 object_properties_init(&(obj->zo), ce);
39 #else
d2a67c7 @chobie add create object functions to render_base
authored
40 zend_hash_copy(obj->zo.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
4482819 @chobie PHP5.4 compatibility
authored
41 #endif
d2a67c7 @chobie add create object functions to render_base
authored
42
43 retval.handle = zend_objects_store_put(obj,
44 (zend_objects_store_dtor_t)zend_objects_destroy_object,
45 (zend_objects_free_object_storage_t)php_sundown_render_base_free_storage,
46 NULL TSRMLS_CC);
47 retval.handlers = zend_get_std_object_handlers();
48 return retval;
49 }
50
498992e @chobie divided render_flags and extensions.
authored
51 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render___construct,0,0,1)
52 ZEND_ARG_INFO(0, render_flags)
53 ZEND_END_ARG_INFO()
54
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
55 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_block_code, 0, 0, 2)
c2e0d3a @chobie for now, adding base render.
authored
56 ZEND_ARG_INFO(0, code)
57 ZEND_ARG_INFO(0, language)
58 ZEND_END_ARG_INFO()
59
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
60 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_block_quote, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
61 ZEND_ARG_INFO(0, quote)
62 ZEND_END_ARG_INFO()
63
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
64 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_block_html, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
65 ZEND_ARG_INFO(0, raw_html)
66 ZEND_END_ARG_INFO()
67
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
68 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_header, 0, 0, 2)
c2e0d3a @chobie for now, adding base render.
authored
69 ZEND_ARG_INFO(0, htext)
70 ZEND_ARG_INFO(0, header_level)
71 ZEND_END_ARG_INFO()
72
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
73 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_hrule, 0, 0, 0)
c2e0d3a @chobie for now, adding base render.
authored
74 ZEND_END_ARG_INFO()
75
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
76 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_list_box, 0, 0, 2)
c2e0d3a @chobie for now, adding base render.
authored
77 ZEND_ARG_INFO(0, contents)
78 ZEND_ARG_INFO(0, list_type)
79 ZEND_END_ARG_INFO()
80
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
81 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_list_item, 0, 0, 2)
c2e0d3a @chobie for now, adding base render.
authored
82 ZEND_ARG_INFO(0, text)
83 ZEND_ARG_INFO(0, list_type)
84 ZEND_END_ARG_INFO()
85
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
86 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_paragraph, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
87 ZEND_ARG_INFO(0, text)
88 ZEND_END_ARG_INFO()
89
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
90 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_table, 0, 0, 2)
c2e0d3a @chobie for now, adding base render.
authored
91 ZEND_ARG_INFO(0, header)
92 ZEND_ARG_INFO(0, body)
93 ZEND_END_ARG_INFO()
94
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
95 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_table_row, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
96 ZEND_ARG_INFO(0, content)
97 ZEND_END_ARG_INFO()
98
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
99 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_table_cell, 0, 0, 2)
c2e0d3a @chobie for now, adding base render.
authored
100 ZEND_ARG_INFO(0, content)
101 ZEND_ARG_INFO(0, alignment)
102 ZEND_END_ARG_INFO()
103
e9bbe20 @chobie fixed misunderstood parameter count in Sundown\Render\Base and Sundown\R...
authored
104 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_autolink, 0, 0, 2)
c2e0d3a @chobie for now, adding base render.
authored
105 ZEND_ARG_INFO(0, link)
106 ZEND_ARG_INFO(0, link_type)
107 ZEND_END_ARG_INFO()
108
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
109 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_codespan, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
110 ZEND_ARG_INFO(0, code)
111 ZEND_END_ARG_INFO()
112
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
113 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_double_emphasis, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
114 ZEND_ARG_INFO(0, text)
115 ZEND_END_ARG_INFO()
116
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
117 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_emphasis, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
118 ZEND_ARG_INFO(0, text)
119 ZEND_END_ARG_INFO()
120
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
121 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_image, 0, 0, 3)
c2e0d3a @chobie for now, adding base render.
authored
122 ZEND_ARG_INFO(0, link)
123 ZEND_ARG_INFO(0, title)
124 ZEND_ARG_INFO(0, alt_text)
125 ZEND_END_ARG_INFO()
126
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
127 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_linebreak, 0, 0, 0)
c2e0d3a @chobie for now, adding base render.
authored
128 ZEND_END_ARG_INFO()
129
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
130 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_link, 0, 0, 3)
c2e0d3a @chobie for now, adding base render.
authored
131 ZEND_ARG_INFO(0, link)
132 ZEND_ARG_INFO(0, title)
133 ZEND_ARG_INFO(0, content)
134 ZEND_END_ARG_INFO()
135
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
136 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_raw_html, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
137 ZEND_ARG_INFO(0, raw_html)
138 ZEND_END_ARG_INFO()
139
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
140 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_triple_emphasis, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
141 ZEND_ARG_INFO(0, text)
142 ZEND_END_ARG_INFO()
143
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
144 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_strikethrough, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
145 ZEND_ARG_INFO(0, text)
146 ZEND_END_ARG_INFO()
147
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
148 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_superscript, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
149 ZEND_ARG_INFO(0, text)
150 ZEND_END_ARG_INFO()
151
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
152 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_entity, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
153 ZEND_ARG_INFO(0, text)
154 ZEND_END_ARG_INFO()
155
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
156 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_normal_text, 0, 0, 1)
c2e0d3a @chobie for now, adding base render.
authored
157 ZEND_ARG_INFO(0, text)
158 ZEND_END_ARG_INFO()
159
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
160 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_doc_header, 0, 0, 0)
c2e0d3a @chobie for now, adding base render.
authored
161 ZEND_END_ARG_INFO()
162
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
163 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_doc_footer, 0, 0, 0)
c2e0d3a @chobie for now, adding base render.
authored
164 ZEND_END_ARG_INFO()
165
caea2a8 @chobie fixed strict standards warnigs
authored
166 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_preprocess, 0, 0, 1)
167 ZEND_ARG_INFO(0, full_document)
c2e0d3a @chobie for now, adding base render.
authored
168 ZEND_END_ARG_INFO()
169
caea2a8 @chobie fixed strict standards warnigs
authored
170 ZEND_BEGIN_ARG_INFO_EX(arginfo_sundown_render_base_postprocess, 0, 0, 1)
171 ZEND_ARG_INFO(0, full_document)
c2e0d3a @chobie for now, adding base render.
authored
172 ZEND_END_ARG_INFO()
173
77af627 @chobie modified method comments
authored
174 /* {{{ proto string Sundown\Render\Base::block_code($code, $language)
c2e0d3a @chobie for now, adding base render.
authored
175 */
176 PHP_METHOD(sundown_render_base, block_code)
177 {
178 char *code, *block_code;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
179 int code_len, block_code_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
180 php_sundown_buffer_t *object;
181
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
182 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
183 "ss", &code, &code_len, &block_code, &block_code_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
184 return;
185 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
186 RETVAL_STRINGL(code,code_len,1);
c2e0d3a @chobie for now, adding base render.
authored
187 }
188 /* }}} */
189
77af627 @chobie modified method comments
authored
190 /* {{{ proto string Sundown\Render\Base::block_quote($quote)
c2e0d3a @chobie for now, adding base render.
authored
191 */
192 PHP_METHOD(sundown_render_base, block_quote)
193 {
194 char *quote;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
195 int quote_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
196 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
197
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
198 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
199 "s", &quote, &quote_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
200 return;
201 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
202 RETVAL_STRINGL(quote,quote_len,1);
c2e0d3a @chobie for now, adding base render.
authored
203 }
204 /* }}} */
205
77af627 @chobie modified method comments
authored
206 /* {{{ proto string Sundown\Render\Base::block_html($raw_html)
c2e0d3a @chobie for now, adding base render.
authored
207 */
208 PHP_METHOD(sundown_render_base, block_html)
209 {
210 char *raw;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
211 int raw_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
212 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
213
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
214 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
215 "s", &raw, &raw_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
216 return;
217 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
218 RETVAL_STRINGL(raw,raw_len,1);
c2e0d3a @chobie for now, adding base render.
authored
219 }
220 /* }}} */
221
77af627 @chobie modified method comments
authored
222 /* {{{ proto string Sundown\Render\Base::header($htext,$header_level)
c2e0d3a @chobie for now, adding base render.
authored
223 */
224 PHP_METHOD(sundown_render_base, header)
225 {
226 char *htext;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
227 int htext_len, header_level;
4b10a7e @chobie add Sundown\Buffer class.
authored
228 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
229
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
230 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
231 "sl",&htext, &htext_len, &header_level) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
232 return;
233 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
234 RETVAL_STRINGL(htext,htext_len,1);
c2e0d3a @chobie for now, adding base render.
authored
235 }
236 /* }}} */
237
77af627 @chobie modified method comments
authored
238 /* {{{ proto string Sundown\Render\Base::hrule()
c2e0d3a @chobie for now, adding base render.
authored
239 */
240 PHP_METHOD(sundown_render_base, hrule)
241 {
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
242 /**
243 * on Sundown\Render\Base, actually this method do nothing.
244 **/
c2e0d3a @chobie for now, adding base render.
authored
245 }
246 /* }}} */
247
77af627 @chobie modified method comments
authored
248 /* {{{ proto string Sundown\Render\Base::list_box($contents, $list_type)
c2e0d3a @chobie for now, adding base render.
authored
249 */
250 PHP_METHOD(sundown_render_base, list_box)
251 {
8016e3f @chobie fixed #3 Sundown\Render\HTML::list_box specifies unexpected variable typ...
authored
252 char *contents;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
253 int contents_len;
254 long list_type;
4b10a7e @chobie add Sundown\Buffer class.
authored
255 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
256
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
257 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
258 "sl", &contents, &contents_len, &list_type) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
259 return;
260 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
261 RETVAL_STRINGL(contents,contents_len,1);
c2e0d3a @chobie for now, adding base render.
authored
262 }
263 /* }}} */
264
77af627 @chobie modified method comments
authored
265 /* {{{ proto string Sundown\Render\Base::list_item($text, $list_type)
c2e0d3a @chobie for now, adding base render.
authored
266 */
267 PHP_METHOD(sundown_render_base, list_item)
268 {
8016e3f @chobie fixed #3 Sundown\Render\HTML::list_box specifies unexpected variable typ...
authored
269 char *text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
270 int text_len;
271 long list_type;
4b10a7e @chobie add Sundown\Buffer class.
authored
272 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
273
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
274 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
275 "sl",&text, &text_len, &list_type) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
276 return;
277 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
278 RETVAL_STRINGL(text,text_len,1);
c2e0d3a @chobie for now, adding base render.
authored
279 }
280 /* }}} */
281
77af627 @chobie modified method comments
authored
282 /* {{{ proto string Sundown\Render\Base::paragraph($text)
c2e0d3a @chobie for now, adding base render.
authored
283 */
284 PHP_METHOD(sundown_render_base, paragraph)
285 {
286 char *text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
287 int text_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
288 zval *buffer;
289 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
290
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
291 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
292 "s", &text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
293 return;
294 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
295 RETVAL_STRINGL(text,text_len,1);
c2e0d3a @chobie for now, adding base render.
authored
296 }
297 /* }}} */
298
77af627 @chobie modified method comments
authored
299 /* {{{ proto string Sundown\Render\Base::table($header, $body)
c2e0d3a @chobie for now, adding base render.
authored
300 */
301 PHP_METHOD(sundown_render_base, table)
302 {
303 char *header, *body;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
304 int header_len, body_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
305 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
306
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
307 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
308 "ss", &header, &header_len, &body, &body_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
309 return;
310 }
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
311 RETVAL_STRINGL(body,body_len,1);
c2e0d3a @chobie for now, adding base render.
authored
312 }
313 /* }}} */
314
77af627 @chobie modified method comments
authored
315 /* {{{ proto string Sundown\Render\Base::table_row($content)
c2e0d3a @chobie for now, adding base render.
authored
316 */
317 PHP_METHOD(sundown_render_base, table_row)
318 {
319 char *contents;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
320 int contents_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
321 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
322
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
323 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
324 "s", &contents, &contents_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
325 return;
326 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
327 RETVAL_STRINGL(contents,contents_len,1);
c2e0d3a @chobie for now, adding base render.
authored
328 }
329 /* }}} */
330
77af627 @chobie modified method comments
authored
331 /* {{{ proto string Sundown\Render\Base::table_cell($content, $alignment)
c2e0d3a @chobie for now, adding base render.
authored
332 */
333 PHP_METHOD(sundown_render_base, table_cell)
334 {
335 char *content, *alignment;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
336 int content_len, alignment_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
337 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
338
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
339 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
340 "ss", &content, &content_len, &alignment, &alignment_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
341 return;
342 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
343 RETVAL_STRINGL(content,content_len,1);
c2e0d3a @chobie for now, adding base render.
authored
344 }
345 /* }}} */
346
77af627 @chobie modified method comments
authored
347 /* {{{ proto string Sundown\Render\Base::autolink($link, $link_type)
c2e0d3a @chobie for now, adding base render.
authored
348 */
349 PHP_METHOD(sundown_render_base, autolink)
350 {
351 char *link, *link_type;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
352 int link_len, link_type_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
353 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
354
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
355 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
356 "ss",&link, &link_len, &link_type, &link_type_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
357 return;
358 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
359 RETVAL_STRINGL(link,link_len,1);
c2e0d3a @chobie for now, adding base render.
authored
360 }
361 /* }}} */
362
77af627 @chobie modified method comments
authored
363 /* {{{ proto string Sundown\Render\Base::codespan($code)
c2e0d3a @chobie for now, adding base render.
authored
364 */
365 PHP_METHOD(sundown_render_base, codespan)
366 {
367 char *code;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
368 int code_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
369 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
370
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
371 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
372 "s", &code, &code_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
373 return;
374 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
375 RETVAL_STRINGL(code,code_len,1);
c2e0d3a @chobie for now, adding base render.
authored
376 }
377 /* }}} */
378
77af627 @chobie modified method comments
authored
379 /* {{{ proto string Sundown\Render\Base::double_emphasis($text)
c2e0d3a @chobie for now, adding base render.
authored
380 */
381 PHP_METHOD(sundown_render_base, double_emphasis)
382 {
383 char *text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
384 int text_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
385 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
386
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
387 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
388 "s", &text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
389 return;
390 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
391 RETVAL_STRINGL(text,text_len,1);
c2e0d3a @chobie for now, adding base render.
authored
392 }
393 /* }}} */
394
77af627 @chobie modified method comments
authored
395 /* {{{ proto string Sundown\Render\Base::emphasis($text)
c2e0d3a @chobie for now, adding base render.
authored
396 */
397 PHP_METHOD(sundown_render_base, emphasis)
398 {
399 char *text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
400 int text_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
401 zval *buffer;
402 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
403
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
404 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
405 "s", &text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
406 return;
407 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
408 RETVAL_STRINGL(text,text_len,1);
c2e0d3a @chobie for now, adding base render.
authored
409 }
410 /* }}} */
411
77af627 @chobie modified method comments
authored
412 /* {{{ proto string Sundown\Render\Base::image($link, $title, $alt_text)
c2e0d3a @chobie for now, adding base render.
authored
413 */
414 PHP_METHOD(sundown_render_base, image)
415 {
416 char *link, *title, *alt_text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
417 int link_len, title_len, alt_text_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
418 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
419
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
420 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
421 "sss",&link, &link_len, &title, &title_len, &alt_text, &alt_text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
422 return;
423 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
424 RETVAL_STRINGL(link,link_len,1);
c2e0d3a @chobie for now, adding base render.
authored
425 }
426 /* }}} */
427
77af627 @chobie modified method comments
authored
428 /* {{{ proto string Sundown\Render\Base::linebreak()
c2e0d3a @chobie for now, adding base render.
authored
429 */
430 PHP_METHOD(sundown_render_base, linebreak)
431 {
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
432 /**
433 * on Sundown\Render\Base, actually this method do nothing.
434 **/
c2e0d3a @chobie for now, adding base render.
authored
435 }
436 /* }}} */
437
77af627 @chobie modified method comments
authored
438 /* {{{ proto string Sundown\Render\Base::link($link,$title,$content)
c2e0d3a @chobie for now, adding base render.
authored
439 */
440 PHP_METHOD(sundown_render_base, link)
441 {
442 char *link, *title, *content;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
443 int link_len, title_len, content_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
444 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
445
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
446 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
447 "sss",&link, &link_len, &title, &title_len, &content, &content_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
448 return;
449 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
450 RETVAL_STRINGL(link,link_len,1);
c2e0d3a @chobie for now, adding base render.
authored
451 }
452 /* }}} */
453
77af627 @chobie modified method comments
authored
454 /* {{{ proto string Sundown\Render\Base::raw_html($raw_html)
c2e0d3a @chobie for now, adding base render.
authored
455 */
456 PHP_METHOD(sundown_render_base, raw_html)
457 {
458 char *raw;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
459 int raw_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
460 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
461
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
462 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
463 "s", &raw, &raw_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
464 return;
465 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
466 RETVAL_STRINGL(raw,raw_len,1);
c2e0d3a @chobie for now, adding base render.
authored
467 }
468 /* }}} */
469
77af627 @chobie modified method comments
authored
470 /* {{{ proto string Sundown\Render\Base::triple_emphasis($text)
c2e0d3a @chobie for now, adding base render.
authored
471 */
472 PHP_METHOD(sundown_render_base, triple_emphasis)
473 {
474 char *text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
475 int text_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
476 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
477
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
478 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
479 "s", &text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
480 return;
481 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
482 RETVAL_STRINGL(text,text_len,1);
c2e0d3a @chobie for now, adding base render.
authored
483 }
484 /* }}} */
485
77af627 @chobie modified method comments
authored
486 /* {{{ proto string Sundown\Render\Base::strikethrough($text)
c2e0d3a @chobie for now, adding base render.
authored
487 */
488 PHP_METHOD(sundown_render_base, strikethrough)
489 {
490 char *text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
491 int text_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
492 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
493
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
494 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
495 "s", &text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
496 return;
497 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
498 RETVAL_STRINGL(text,text_len,1);
c2e0d3a @chobie for now, adding base render.
authored
499 }
500 /* }}} */
501
77af627 @chobie modified method comments
authored
502 /* {{{ proto string Sundown\Render\Base::superscript($text)
c2e0d3a @chobie for now, adding base render.
authored
503 */
504 PHP_METHOD(sundown_render_base, superscript)
505 {
506 char *text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
507 int text_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
508 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
509
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
510 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
511 "s", &text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
512 return;
513 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
514 RETVAL_STRINGL(text,text_len,1);
c2e0d3a @chobie for now, adding base render.
authored
515 }
516 /* }}} */
517
77af627 @chobie modified method comments
authored
518 /* {{{ proto string Sundown\Render\Base::entity($text)
c2e0d3a @chobie for now, adding base render.
authored
519 */
520 PHP_METHOD(sundown_render_base, entity)
521 {
522 char *text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
523 int text_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
524 php_sundown_buffer_t *object;
c2e0d3a @chobie for now, adding base render.
authored
525
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
526 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
527 "s", &text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
528 return;
529 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
530 RETVAL_STRINGL(text,text_len,1);
c2e0d3a @chobie for now, adding base render.
authored
531 }
532 /* }}} */
533
77af627 @chobie modified method comments
authored
534 /* {{{ proto string Sundown\Render\Base::normal_text($text)
c2e0d3a @chobie for now, adding base render.
authored
535 */
536 PHP_METHOD(sundown_render_base, normal_text)
537 {
538 char *text;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
539 int text_len;
4b10a7e @chobie add Sundown\Buffer class.
authored
540 php_sundown_buffer_t *object;
541
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
542 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
543 "s",&text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
544 return;
545 }
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
546 RETVAL_STRINGL(text,text_len,1);
c2e0d3a @chobie for now, adding base render.
authored
547 }
548 /* }}} */
549
77af627 @chobie modified method comments
authored
550 /* {{{ proto string Sundown\Render\Base::doc_header()
c2e0d3a @chobie for now, adding base render.
authored
551 */
552 PHP_METHOD(sundown_render_base, doc_header)
553 {
554 RETURN_FALSE;
555 }
556 /* }}} */
557
77af627 @chobie modified method comments
authored
558 /* {{{ proto string Sundown\Render\Base::doc_footer()
c2e0d3a @chobie for now, adding base render.
authored
559 */
560 PHP_METHOD(sundown_render_base, doc_footer)
561 {
562 RETURN_FALSE;
563 }
564 /* }}} */
565
77af627 @chobie modified method comments
authored
566 /* {{{ proto string Sundown\Render\Base::preprocess($full_document)
c2e0d3a @chobie for now, adding base render.
authored
567 */
568 PHP_METHOD(sundown_render_base, preprocess)
569 {
570 char *text;
ecc3f86 @chobie re-enable SmartyPants feature.
authored
571 int text_len;
c2e0d3a @chobie for now, adding base render.
authored
572
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
573 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
574 "s", &text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
575 return;
576 }
577
206b2ba @chobie improve Sundown\Render\Base method signature.
authored
578 RETVAL_STRINGL(text,text_len, 1);
c2e0d3a @chobie for now, adding base render.
authored
579 }
580 /* }}} */
581
77af627 @chobie modified method comments
authored
582 /* {{{ proto string Sundown\Render\Base::postprocess($full_document)
c2e0d3a @chobie for now, adding base render.
authored
583 */
584 PHP_METHOD(sundown_render_base, postprocess)
585 {
586 char *text;
ecc3f86 @chobie re-enable SmartyPants feature.
authored
587 int text_len;
c2e0d3a @chobie for now, adding base render.
authored
588
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
589 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
590 "s", &text, &text_len) == FAILURE) {
c2e0d3a @chobie for now, adding base render.
authored
591 return;
592 }
ecc3f86 @chobie re-enable SmartyPants feature.
authored
593
594 if (Z_BVAL_P(zend_read_property(Z_OBJCE_P(getThis()), getThis(),"enable_pants",sizeof("enable_pants")-1, 1 TSRMLS_CC))) {
595 struct buf *smart_buf = bufnew(128);
596 sdhtml_smartypants(smart_buf, text,text_len);
597 RETVAL_STRINGL(smart_buf->data, smart_buf->size,1);
598 bufrelease(smart_buf);
599 } else {
600 RETVAL_STRINGL(text,text_len, 1);
601 }
c2e0d3a @chobie for now, adding base render.
authored
602 }
603 /* }}} */
604
77af627 @chobie modified method comments
authored
605 /* {{{ proto Sundown\Render\Base::__construct([array render_flags])
498992e @chobie divided render_flags and extensions.
authored
606 */
607 PHP_METHOD(sundown_render_base, __construct)
608 {
3331433 @chobie fixed segv
authored
609 zval *render_flags = NULL, *c_flags = NULL;
498992e @chobie divided render_flags and extensions.
authored
610
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
611 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
612 "|z", &render_flags) == FAILURE) {
498992e @chobie divided render_flags and extensions.
authored
613 return;
614 }
615
80337e6 @chobie fixed segv
authored
616 if (render_flags != NULL && Z_TYPE_P(render_flags) == IS_ARRAY) {
665039a @chobie now, preprocess and postprocess methods are able to use.
authored
617 ALLOC_INIT_ZVAL(c_flags);
498992e @chobie divided render_flags and extensions.
authored
618 ZVAL_ZVAL(c_flags, render_flags, 1, 1);
619 add_property_zval_ex(getThis(),"render_flags",sizeof("render_flags"),c_flags TSRMLS_CC);
620 }
621 }
622 /* }}} */
623
77af627 @chobie modified method comments
authored
624 /* {{{ proto Sundown\Render\Base::__destruct()
498992e @chobie divided render_flags and extensions.
authored
625 */
626 PHP_METHOD(sundown_render_base, __destruct)
627 {
628 zval *render_flags;
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
629
498992e @chobie divided render_flags and extensions.
authored
630 render_flags = zend_read_property(sundown_render_base_class_entry, getThis(),"render_flags",sizeof("render_flags")-1, 0 TSRMLS_CC);
9273baa @chobie following K&R coding style and fix misunderstood zend_parameter_parse va...
authored
631 if (Z_TYPE_P(render_flags) == IS_ARRAY) {
498992e @chobie divided render_flags and extensions.
authored
632 zval_ptr_dtor(&render_flags);
633 }
634 }
635
c2e0d3a @chobie for now, adding base render.
authored
636 static zend_function_entry php_sundown_render_base_methods[] = {
16a4388 @chobie change function scopes
authored
637 PHP_ME(sundown_render_base, __construct, arginfo_sundown_render___construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
c2e0d3a @chobie for now, adding base render.
authored
638 PHP_ME(sundown_render_base, block_code, arginfo_sundown_render_base_block_code, ZEND_ACC_PUBLIC)
639 PHP_ME(sundown_render_base, block_quote, arginfo_sundown_render_base_block_quote, ZEND_ACC_PUBLIC)
640 PHP_ME(sundown_render_base, block_html, arginfo_sundown_render_base_block_html, ZEND_ACC_PUBLIC)
641 PHP_ME(sundown_render_base, header, arginfo_sundown_render_base_header, ZEND_ACC_PUBLIC)
642 PHP_ME(sundown_render_base, hrule, arginfo_sundown_render_base_hrule, ZEND_ACC_PUBLIC)
643 PHP_ME(sundown_render_base, list_box, arginfo_sundown_render_base_list_box, ZEND_ACC_PUBLIC)
644 PHP_ME(sundown_render_base, list_item, arginfo_sundown_render_base_list_item, ZEND_ACC_PUBLIC)
645 PHP_ME(sundown_render_base, paragraph, arginfo_sundown_render_base_paragraph, ZEND_ACC_PUBLIC)
646 PHP_ME(sundown_render_base, table, arginfo_sundown_render_base_table, ZEND_ACC_PUBLIC)
647 PHP_ME(sundown_render_base, table_row, arginfo_sundown_render_base_table_row, ZEND_ACC_PUBLIC)
648 PHP_ME(sundown_render_base, table_cell, arginfo_sundown_render_base_table_cell, ZEND_ACC_PUBLIC)
649 PHP_ME(sundown_render_base, autolink, arginfo_sundown_render_base_autolink, ZEND_ACC_PUBLIC)
650 PHP_ME(sundown_render_base, codespan, arginfo_sundown_render_base_codespan, ZEND_ACC_PUBLIC)
651 PHP_ME(sundown_render_base, double_emphasis, arginfo_sundown_render_base_double_emphasis, ZEND_ACC_PUBLIC)
652 PHP_ME(sundown_render_base, emphasis, arginfo_sundown_render_base_emphasis, ZEND_ACC_PUBLIC)
653 PHP_ME(sundown_render_base, image, arginfo_sundown_render_base_image, ZEND_ACC_PUBLIC)
654 PHP_ME(sundown_render_base, linebreak, arginfo_sundown_render_base_linebreak, ZEND_ACC_PUBLIC)
655 PHP_ME(sundown_render_base, link, arginfo_sundown_render_base_link, ZEND_ACC_PUBLIC)
656 PHP_ME(sundown_render_base, raw_html, arginfo_sundown_render_base_raw_html, ZEND_ACC_PUBLIC)
657 PHP_ME(sundown_render_base, triple_emphasis, arginfo_sundown_render_base_triple_emphasis, ZEND_ACC_PUBLIC)
658 PHP_ME(sundown_render_base, strikethrough, arginfo_sundown_render_base_strikethrough, ZEND_ACC_PUBLIC)
659 PHP_ME(sundown_render_base, superscript, arginfo_sundown_render_base_superscript, ZEND_ACC_PUBLIC)
660 PHP_ME(sundown_render_base, entity, arginfo_sundown_render_base_entity, ZEND_ACC_PUBLIC)
661 PHP_ME(sundown_render_base, normal_text, arginfo_sundown_render_base_normal_text, ZEND_ACC_PUBLIC)
662 PHP_ME(sundown_render_base, doc_header, arginfo_sundown_render_base_doc_header, ZEND_ACC_PUBLIC)
663 PHP_ME(sundown_render_base, doc_footer, arginfo_sundown_render_base_doc_footer, ZEND_ACC_PUBLIC)
664 PHP_ME(sundown_render_base, preprocess, arginfo_sundown_render_base_preprocess, ZEND_ACC_PUBLIC)
665 PHP_ME(sundown_render_base, postprocess, arginfo_sundown_render_base_postprocess, ZEND_ACC_PUBLIC)
498992e @chobie divided render_flags and extensions.
authored
666 PHP_ME(sundown_render_base, __destruct, NULL, ZEND_ACC_PUBLIC)
c2e0d3a @chobie for now, adding base render.
authored
667 {NULL,NULL,NULL}
668 };
669
670 void php_sundown_render_base_init(TSRMLS_D)
671 {
672 zend_class_entry ce;
673 INIT_NS_CLASS_ENTRY(ce, ZEND_NS_NAME("Sundown","Render"),"Base", php_sundown_render_base_methods);
674 sundown_render_base_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
d2a67c7 @chobie add create object functions to render_base
authored
675 sundown_render_base_class_entry->create_object = php_sundown_render_base_new;
498992e @chobie divided render_flags and extensions.
authored
676 zend_declare_property_null(sundown_render_base_class_entry, "render_flags", sizeof("render_flags")-1, ZEND_ACC_PUBLIC TSRMLS_CC);
c2e0d3a @chobie for now, adding base render.
authored
677 }
Something went wrong with that request. Please try again.