253 PHP_FUNCTION(aa_get_lines)
254 {
255 	int argc = ZEND_NUM_ARGS();
256 	int c_id = -1;
257 	zval *c = NULL;
258 	aa_context *ac;
259 	char *buffer;
260 	int i;
261 
262 	if (zend_parse_parameters(argc TSRMLS_CC, "r", &c) == FAILURE) 
263 		return;
264 
265 	if (c) {
266 		ZEND_FETCH_RESOURCE(ac, aa_context *, &c, c_id, "aa", le_aalib);
267 	}
268 
269 	if (array_init(return_value) == FAILURE) {
270 		RETURN_FALSE;
271 	}
272 	
273 	buffer = ecalloc(aa_scrheight(ac) * aa_scrwidth(ac) + 1, 1);
274 	memcpy(buffer, aa_text(ac), aa_scrheight(ac) * aa_scrwidth(ac));
275 
276 	for (i = 0; i < aa_scrheight(ac); i++) {
277 		add_index_stringl(return_value, i, buffer + ((aa_scrwidth(ac) * i)),
			aa_scrwidth(ac), 1);
278 	}
279 	efree(buffer);
280 }