285 PHP_FUNCTION(aa_get_array)
286 {
287     int argc = ZEND_NUM_ARGS();
288     int c_id = -1;
289     zval *c = NULL;
290     aa_context *ac;
291     char *buffer;
292     zval *line;
293     int i, j;

302     if (array_init(return_value) == FAILURE) {
303         RETURN_FALSE;
304     }
305     
306     buffer = ecalloc(aa_scrheight(ac) * aa_scrwidth(ac) + 1, 1);
307     memcpy(buffer, aa_text(ac), aa_scrheight(ac) * aa_scrwidth(ac));
308 
309     for (i = 0; i < aa_scrheight(ac); i++) {
310         MAKE_STD_ZVAL(line);
311         if (array_init(line) == FAILURE) {
312             FREE_ZVAL(line);
313             return;
314         }
315         for (j = 0; j < aa_scrwidth(ac); j++) {
316             add_index_stringl(line, j, buffer + ((aa_scrwidth(ac) * i)) + j, 1, 1);
317         }
318         add_index_zval(return_value, i, line);
319     }
320     efree(buffer);
321 }