update porting to new machine
[wikipedia-parser-hphp.git] / parser / ParserOutput.php.c
blob21678315a017cb45d89a8cab2b6e0e4de236b8c3
1 // BEGIN INCLUDED FILES
2 /* The difference between zend_symtable_X and zend_hash_X is that
3 * the _symtable version will check if the key is a string of an
4 * integer, and if so, use the int version instead. We can use the
5 * zend_hash_X versions safely for symbol tables, since
6 * variables cant be integer strings, but we cant safely use
7 * zend_hash_X versions for hashtable lookups. Well-named, they are.
8 */
10 /* An important note of zval*s and zval**s. Frequently, zval** are
11 * fetched from arrays and symbol tables. The zval** will point into
12 * the array, and so updating it will update the relevant array
13 * entry. It is normally not the same to dereference it to a local
14 * variable, and pass a reference to that.
19 // Some common functions
20 #include "php.h"
23 * The runtime needs its own initialization and finalization. phc is
24 * responsible for generating calls to these functions.
27 void
28 init_runtime ()
32 void
33 finalize_runtime ()
37 static void
38 ht_debug (HashTable * ht)
40 printf ("\nHASH\n");
41 if (ht == NULL)
43 printf ("NULL\n");
44 return;
46 for (zend_hash_internal_pointer_reset (ht);
47 zend_hash_has_more_elements (ht) == SUCCESS;
48 zend_hash_move_forward (ht))
50 char *key;
51 unsigned keylen;
52 unsigned long idx;
53 int type;
54 zval **ppzval;
55 zval *zvp;
57 type = zend_hash_get_current_key_ex (ht, &key, &keylen, &idx, 0, NULL);
58 zend_hash_get_current_data (ht, (void **) &ppzval);
60 zvp = *ppzval;
62 if (type == HASH_KEY_IS_STRING)
64 printf ("%s", key);
66 else
68 printf ("%ld", idx);
71 printf (": addr = %08lX, refcount = %d, is_ref = %d ",
72 (long unsigned int) (*ppzval), (*ppzval)->refcount,
73 (*ppzval)->is_ref);
74 switch (Z_TYPE_P (zvp))
76 case IS_NULL:
77 printf ("(NULL)");
78 break;
79 case IS_LONG:
80 printf ("(%ldL)", Z_LVAL_P (zvp));
81 break;
82 case IS_DOUBLE:
83 printf ("(%lff)", Z_DVAL_P (zvp));
84 break;
85 case IS_BOOL:
86 printf (Z_BVAL_P (zvp) ? "(true)" : "(false)");
87 break;
88 case IS_ARRAY:
89 printf ("(array(%d))", Z_ARRVAL_P (zvp)->nNumOfElements);
90 break;
91 case IS_OBJECT:
92 printf ("(Object)");
93 break;
94 case IS_STRING:
95 printf ("(\"%s\")", Z_STRVAL_P (zvp));
96 break;
97 case IS_RESOURCE:
98 printf ("(Resource)");
99 break;
100 default:
101 printf ("(Invalid: %d)", Z_TYPE_P (zvp));
104 printf ("\n");
107 printf ("END HASH\n");
110 // Call ht_debug on the named var in the given symbol table
111 static void
112 ht_var_debug (HashTable * st, char *name)
114 zval **p_zvp;
115 if (zend_symtable_find (st, name, strlen (name) + 1,
116 (void **) &p_zvp) != SUCCESS)
118 printf ("VAR NOT IN SYMBOL TABLE: '%s'\n", name);
119 return;
122 if (Z_TYPE_P (*p_zvp) != IS_ARRAY)
124 printf ("NOT HASH\n");
125 return;
128 ht_debug ((*p_zvp)->value.ht);
131 static zval* counters;
133 static void init_counters ()
135 ALLOC_INIT_ZVAL (counters);
136 array_init (counters);
139 // Dump and cleanup memory
140 static void finalize_counters ()
142 HashTable* ht = Z_ARRVAL_P (counters);
143 for (zend_hash_internal_pointer_reset (ht);
144 zend_hash_has_more_elements (ht) == SUCCESS;
145 zend_hash_move_forward (ht))
147 char *key;
148 zval **p_zvp;
150 zend_hash_get_current_key_ex (ht, &key, NULL, NULL, 0, NULL);
151 zend_hash_get_current_data (ht, (void **) &p_zvp);
153 fprintf (stderr, "COUNTER:%s:%ld\n", key, Z_LVAL_P (*p_zvp));
156 zval_ptr_dtor (&counters);
159 static void increment_counter (char* name, int length, ulong hashval)
161 zval** p_zvp;
162 int success = zend_hash_quick_find (Z_ARRVAL_P (counters),
163 name,
164 length,
165 hashval,
166 (void **) &p_zvp);
168 if (success == SUCCESS)
170 Z_LVAL_PP (p_zvp)++;
172 else
175 zval* new_val;
176 ALLOC_INIT_ZVAL (new_val);
177 ZVAL_LONG (new_val, 1);
179 zend_hash_quick_add (Z_ARRVAL_P (counters),
180 name,
181 length,
182 hashval,
183 &new_val,
184 sizeof (zval *),
185 NULL);
191 /* Make a copy of *P_ZVP, storing it in *P_ZVP. */
192 static zval *
193 zvp_clone_ex (zval * zvp)
195 // TODO: use INIT_PZVAL_COPY
196 zval *clone;
197 MAKE_STD_ZVAL (clone);
198 clone->value = zvp->value;
199 clone->type = zvp->type;
200 zval_copy_ctor (clone);
201 return clone;
205 static inline int
206 in_copy_on_write (zval * zvp)
208 return (zvp->refcount > 1 && !zvp->is_ref);
211 static inline int
212 in_change_on_write (zval * zvp)
214 return (zvp->refcount > 1 && zvp->is_ref);
217 /* If *P_ZVP is in a copy-on-write set, separate it by overwriting
218 * *P_ZVP with a clone of itself, and lowering the refcount on the
219 * original. */
220 static void
221 sep_copy_on_write (zval ** p_zvp)
223 if (!in_copy_on_write (*p_zvp))
224 return;
226 zval *old = *p_zvp;
228 *p_zvp = zvp_clone_ex (*p_zvp);
230 zval_ptr_dtor (&old);
233 /* If *P_ZVP is in a copy-on-write set, separate it by overwriting
234 * *P_ZVP with a clone of itself, and lowering the refcount on the
235 * original. */
236 static void
237 sep_change_on_write (zval ** p_zvp)
239 assert (in_change_on_write (*p_zvp));
241 zval *old = *p_zvp;
243 *p_zvp = zvp_clone_ex (*p_zvp);
245 zval_ptr_dtor (&old);
248 /* Assign RHS into LHS, by reference. After this, LHS will point to the same
249 * zval* as RHS. */
250 static void
251 copy_into_ref (zval ** lhs, zval ** rhs)
253 (*rhs)->is_ref = 1;
254 (*rhs)->refcount++;
255 zval_ptr_dtor (lhs);
256 *lhs = *rhs;
260 // Overwrite one zval with another
261 static void
262 overwrite_lhs (zval * lhs, zval * rhs)
264 // First, call the destructor to remove any data structures
265 // associated with lhs that will now be overwritten
266 zval_dtor (lhs);
267 // Overwrite LHS
268 lhs->value = rhs->value;
269 lhs->type = rhs->type;
270 zval_copy_ctor (lhs);
273 // Overwrite one zval with another
274 static void
275 overwrite_lhs_no_copy (zval * lhs, zval * rhs)
277 // First, call the destructor to remove any data structures
278 // associated with lhs that will now be overwritten
279 zval_dtor (lhs);
280 // Overwrite LHS
281 lhs->value = rhs->value;
282 lhs->type = rhs->type;
285 /* Write P_RHS into the symbol table as a variable named VAR_NAME. */
286 // NOTE: We do not alter p_rhs's refcount, unless p_lhs joins its
287 // Copy-on-write set.
288 // TODO: this is crying out to be inlined.
289 static void
290 write_var (zval ** p_lhs, zval * rhs)
292 if (!(*p_lhs)->is_ref)
294 zval_ptr_dtor (p_lhs);
295 // Take a copy of RHS for LHS.
296 if (rhs->is_ref)
298 *p_lhs = zvp_clone_ex (rhs);
300 else // share a copy
302 rhs->refcount++;
303 *p_lhs = rhs;
306 else
308 overwrite_lhs (*p_lhs, rhs);
312 // TODO: this functino does too much, and much might be redundant
313 static zval **
314 get_st_entry (HashTable * st, char *name, int length, ulong hashval TSRMLS_DC)
316 zval **p_zvp;
317 if (zend_hash_quick_find
318 (st, name, length, hashval, (void **) &p_zvp) == SUCCESS)
320 assert (p_zvp != NULL);
321 return p_zvp;
324 // If we dont find it, put EG (uninitialized_zval_ptr) into the
325 // hashtable, and return a pointer to its container.
326 EG (uninitialized_zval_ptr)->refcount++;
327 int result = zend_hash_quick_add (st, name, length, hashval,
328 &EG (uninitialized_zval_ptr),
329 sizeof (zval *), (void **) &p_zvp);
330 assert (result == SUCCESS);
331 assert (p_zvp != NULL);
333 return p_zvp;
336 /* Read the variable named VAR_NAME from the local symbol table and
337 * return it. If the variable doent exist, a new one is created and
338 * *IS_NEW is set. */
339 static zval *
340 read_var (HashTable * st, char *name, int length, ulong hashval TSRMLS_DC)
342 zval **p_zvp;
343 if (zend_hash_quick_find
344 (st, name, length, hashval, (void **) &p_zvp) == SUCCESS)
345 return *p_zvp;
347 return EG (uninitialized_zval_ptr);
350 static long
351 get_integer_index (zval * ind TSRMLS_DC)
353 long index;
354 switch (Z_TYPE_P (ind))
356 case IS_DOUBLE:
357 return (long) Z_DVAL_P (ind);
359 case IS_LONG:
360 case IS_BOOL:
361 return Z_LVAL_P (ind);
363 case IS_NULL:
364 return 0;
366 default:
367 php_error_docref (NULL TSRMLS_CC, E_WARNING, "Illegal offset type");
371 static zval *
372 read_string_index (zval * var, zval * ind TSRMLS_DC)
374 // This must always allocate memory, since we cant return the
375 // passed string.
376 assert (Z_TYPE_P (var) == IS_STRING);
377 long index = get_integer_index (ind TSRMLS_CC);
379 zval *result;
380 ALLOC_INIT_ZVAL (result);
382 if (index >= Z_STRLEN_P (var) || index < 0)
384 // this is 1 byte long, must be copied
385 ZVAL_STRINGL (result, "", 0, 1);
387 else
389 char *string = Z_STRVAL_P (var);
390 ZVAL_STRINGL (result, &string[index], 1, 1);
393 return result;
396 /* Given a string (p_lhs), write into it for $x[i] = $y; */
397 void
398 write_string_index (zval ** p_lhs, zval * ind, zval * rhs TSRMLS_DC)
400 assert (Z_TYPE_P (*p_lhs) == IS_STRING);
402 long index = get_integer_index (ind TSRMLS_CC);
404 // Get the appropriate character
405 char new_char;
406 if (Z_TYPE_P (rhs) != IS_STRING)
408 // TODO: remove allocate
409 zval *copy = zvp_clone_ex (rhs);
410 convert_to_string (copy);
411 new_char = Z_STRVAL_P (copy)[0];
412 zval_ptr_dtor (&copy);
414 else
416 new_char = Z_STRVAL_P (rhs)[0];
419 // Bounds check
420 if (index < 0)
422 php_error_docref (NULL TSRMLS_CC, E_WARNING,
423 "Illegal string offset: %ld", index);
424 return;
427 // We overwrite if it's change-on-write
428 sep_copy_on_write (p_lhs);
430 if (index > Z_STRLEN_PP (p_lhs))
432 // Extend to fix new
433 int len = Z_STRLEN_PP (p_lhs);
434 int new_length = index + 1; // space for the new character
435 Z_STRVAL_PP (p_lhs) = erealloc (Z_STRVAL_PP (p_lhs), new_length + 1);
437 // pad with ' '
438 memset (&Z_STRVAL_PP (p_lhs)[len], ' ', index - len);
440 // change the strlen
441 Z_STRLEN_PP (p_lhs) = new_length;
443 // add a null terminator
444 Z_STRVAL_PP (p_lhs)[new_length] = '\0';
447 // write in the first character of the new value
448 Z_STRVAL_PP (p_lhs)[index] = new_char;
451 // index < 0: E_WARNING illegal string offset
454 // Extract the hashtable from a hash-valued zval
455 static HashTable *
456 extract_ht_ex (zval * arr TSRMLS_DC)
458 // TODO: this likely should be inlined somewhere.
459 assert (!in_copy_on_write (arr));
460 if (Z_TYPE_P (arr) == IS_NULL)
462 array_init (arr);
464 else if (Z_TYPE_P (arr) != IS_ARRAY)
466 php_error_docref (NULL TSRMLS_CC, E_WARNING,
467 "Cannot use a scalar value as an array");
468 array_init (arr);
470 return Z_ARRVAL_P (arr);
474 /* P_VAR points into a symbol table, at a variable which we wish to index as a hashtable. */
475 static HashTable *
476 extract_ht (zval ** p_var TSRMLS_DC)
478 sep_copy_on_write (p_var);
480 return extract_ht_ex (*p_var TSRMLS_CC);
483 /* Using IND as a key to HT, call the appropriate zend_index_X
484 * function with data as a parameter, and return its result. This
485 * updates the zval** pointed to by DATA. */
486 static int
487 ht_find (HashTable * ht, zval * ind, zval *** data)
489 int result;
490 if (Z_TYPE_P (ind) == IS_LONG || Z_TYPE_P (ind) == IS_BOOL)
492 result = zend_hash_index_find (ht, Z_LVAL_P (ind), (void **) data);
494 else if (Z_TYPE_P (ind) == IS_DOUBLE)
496 result = zend_hash_index_find (ht, (long) Z_DVAL_P (ind),
497 (void **) data);
499 else if (Z_TYPE_P (ind) == IS_NULL)
501 result = zend_hash_find (ht, "", sizeof (""), (void **)data);
503 else if (Z_TYPE_P (ind) == IS_STRING)
505 result = zend_symtable_find (ht, Z_STRVAL_P (ind),
506 Z_STRLEN_P (ind) + 1, (void **) data);
508 else
510 // TODO: I believe this might need a warning.
512 // TODO avoid alloc
513 // use a string index for other types
514 zval *string_index;
515 MAKE_STD_ZVAL (string_index);
516 string_index->value = ind->value;
517 string_index->type = ind->type;
518 zval_copy_ctor (string_index);
519 convert_to_string (string_index);
521 result = zend_symtable_find (ht, Z_STRVAL_P (string_index),
522 Z_STRLEN_P (string_index) + 1,
523 (void **) data);
524 zval_ptr_dtor (&string_index);
526 return result;
530 static int
531 check_array_index_type (zval * ind TSRMLS_DC)
533 if (Z_TYPE_P (ind) == IS_OBJECT || Z_TYPE_P (ind) == IS_ARRAY)
535 php_error_docref (NULL TSRMLS_CC, E_WARNING, "Illegal offset type");
536 return 0;
539 return 1;
542 // Update a hashtable using a zval* index
543 static void
544 ht_update (HashTable * ht, zval * ind, zval * val, zval *** dest)
546 int result;
547 if (Z_TYPE_P (ind) == IS_LONG || Z_TYPE_P (ind) == IS_BOOL)
549 result = zend_hash_index_update (ht, Z_LVAL_P (ind), &val,
550 sizeof (zval *), (void **) dest);
552 else if (Z_TYPE_P (ind) == IS_DOUBLE)
554 result = zend_hash_index_update (ht, (long) Z_DVAL_P (ind),
555 &val, sizeof (zval *), (void **) dest);
557 else if (Z_TYPE_P (ind) == IS_NULL)
559 result = zend_hash_update (ht, "", sizeof (""), &val,
560 sizeof (zval *), (void **) dest);
562 else if (Z_TYPE_P (ind) == IS_STRING)
564 result = zend_symtable_update (ht, Z_STRVAL_P (ind),
565 Z_STRLEN_P (ind) + 1,
566 &val, sizeof (zval *), (void **) dest);
568 else
570 // TODO avoid alloc
571 zval *string_index;
572 MAKE_STD_ZVAL (string_index);
573 string_index->value = ind->value;
574 string_index->type = ind->type;
575 zval_copy_ctor (string_index);
576 convert_to_string (string_index);
577 result = zend_symtable_update (ht, Z_STRVAL_P (string_index),
578 Z_STRLEN_P (string_index) + 1,
579 &val, sizeof (zval *), (void **) dest);
581 zval_ptr_dtor (&string_index);
583 assert (result == SUCCESS);
586 // Delete from a hashtable using a zval* index
587 static void
588 ht_delete (HashTable * ht, zval * ind)
590 // This may fail if the index doesnt exist, which is fine.
591 if (Z_TYPE_P (ind) == IS_LONG || Z_TYPE_P (ind) == IS_BOOL)
593 zend_hash_index_del (ht, Z_LVAL_P (ind));
595 else if (Z_TYPE_P (ind) == IS_DOUBLE)
597 zend_hash_index_del (ht, (long) Z_DVAL_P (ind));
599 else if (Z_TYPE_P (ind) == IS_NULL)
601 zend_hash_del (ht, "", sizeof (""));
603 else if (Z_TYPE_P (ind) == IS_STRING)
605 zend_hash_del (ht, Z_STRVAL_P (ind), Z_STRLEN_P (ind) + 1);
607 else
609 // TODO avoid alloc
610 zval *string_index;
611 MAKE_STD_ZVAL (string_index);
612 string_index->value = ind->value;
613 string_index->type = ind->type;
614 zval_copy_ctor (string_index);
615 convert_to_string (string_index);
616 zend_hash_del (ht, Z_STRVAL_P (string_index),
617 Z_STRLEN_P (string_index) + 1);
619 zval_ptr_dtor (&string_index);
623 // Check if a key exists in a hashtable
624 static int
625 ht_exists (HashTable * ht, zval * ind)
627 if (Z_TYPE_P (ind) == IS_LONG || Z_TYPE_P (ind) == IS_BOOL)
629 return zend_hash_index_exists (ht, Z_LVAL_P (ind));
631 else if (Z_TYPE_P (ind) == IS_DOUBLE)
633 return zend_hash_index_exists (ht, (long) Z_DVAL_P (ind));
635 else if (Z_TYPE_P (ind) == IS_NULL)
637 return zend_hash_exists (ht, "", sizeof (""));
639 else if (Z_TYPE_P (ind) == IS_STRING)
641 return zend_hash_exists (ht, Z_STRVAL_P (ind), Z_STRLEN_P (ind) + 1);
643 else
645 // TODO avoid alloc
646 int result;
647 zval *string_index;
648 MAKE_STD_ZVAL (string_index);
649 string_index->value = ind->value;
650 string_index->type = ind->type;
651 zval_copy_ctor (string_index);
652 convert_to_string (string_index);
653 result = zend_hash_exists (ht, Z_STRVAL_P (string_index),
654 Z_STRLEN_P (string_index) + 1);
655 zval_ptr_dtor (&string_index);
656 return result;
658 assert (0);
661 static zval **
662 get_ht_entry (zval ** p_var, zval * ind TSRMLS_DC)
664 if (Z_TYPE_P (*p_var) == IS_STRING)
666 if (Z_STRLEN_PP (p_var) > 0)
668 php_error_docref (NULL TSRMLS_CC, E_ERROR,
669 "Cannot create references to/from string offsets nor overloaded objects");
673 if (Z_TYPE_P (*p_var) != IS_ARRAY)
675 zval_ptr_dtor (p_var);
676 ALLOC_INIT_ZVAL (*p_var);
677 array_init (*p_var);
680 HashTable *ht = extract_ht (p_var TSRMLS_CC);
682 zval **data;
683 if (ht_find (ht, ind, &data) == SUCCESS)
685 assert (data != NULL);
686 return data;
689 // If we dont find it, put EG (uninitialized_zval_ptr) into the
690 // hashtable, and return a pointer to its container.
691 EG (uninitialized_zval_ptr)->refcount++;
692 ht_update (ht, ind, EG (uninitialized_zval_ptr), &data);
694 assert (data != NULL);
696 return data;
700 // Like extract_ht_ex, but for objects
701 static HashTable *
702 extract_field_ex (zval * obj TSRMLS_DC)
704 // TODO: this likely should be inlined somewhere.
705 assert (!in_copy_on_write (obj));
706 if (Z_TYPE_P (obj) == IS_NULL)
708 assert (0);
709 // TODO: implement initialization
711 else if (Z_TYPE_P (obj) != IS_OBJECT)
713 // TODO: test if this is the right error message
714 php_error_docref (NULL TSRMLS_CC, E_WARNING,
715 "Cannot use a scalar value as an object");
716 // TODO: implement initialization
717 assert (0);
719 return Z_OBJPROP_P (obj);
722 // Like extract_ht, but for objects
723 static HashTable *
724 extract_field (zval ** p_var TSRMLS_DC)
726 sep_copy_on_write (p_var);
728 return extract_field_ex (*p_var TSRMLS_CC);
731 // Like get_ht_entry, but for objects
732 static zval **
733 get_field (zval ** p_var, char *ind TSRMLS_DC)
735 if (Z_TYPE_P (*p_var) != IS_OBJECT)
737 // TODO: implement initialization
738 assert (0);
741 HashTable *ht = extract_field (p_var TSRMLS_CC);
743 zval **data;
744 if (zend_symtable_find (ht, ind, strlen (ind) + 1, (void **) &data) ==
745 SUCCESS)
747 assert (data != NULL);
748 return data;
751 // If we dont find it, put EG (uninitialized_zval_ptr) into the
752 // hashtable, and return a pointer to its container.
753 EG (uninitialized_zval_ptr)->refcount++;
754 zend_symtable_update (ht, ind, strlen (ind) + 1,
755 &EG (uninitialized_zval_ptr), sizeof (zval *),
756 (void **) &data);
758 assert (data != NULL);
760 return data;
763 void
764 read_array (zval ** result, zval * array, zval * ind TSRMLS_DC)
766 // Memory can be allocated in read_string_index
767 if (array == EG (uninitialized_zval_ptr))
769 *result = array;
770 return;
773 // Since we know its an array, and we dont write to it, we dont need
774 // to separate it.
775 HashTable *ht = Z_ARRVAL_P (array);
777 // find the result
778 zval **p_result;
779 if (ht_find (ht, ind, &p_result) == SUCCESS)
781 *result = *p_result;
782 return;
785 *result = EG (uninitialized_zval_ptr);
788 /* If its not an array, convert it into an array. */
789 static void
790 check_array_type (zval ** p_var TSRMLS_DC)
792 if ((Z_TYPE_P (*p_var) == IS_BOOL && !Z_BVAL_PP (p_var))
793 || Z_TYPE_P (*p_var) == IS_NULL
794 || (Z_TYPE_P (*p_var) == IS_STRING && Z_STRLEN_PP (p_var) == 0))
796 // Non ref use new values
797 if (!PZVAL_IS_REF (*p_var))
799 zval_ptr_dtor (p_var);
800 ALLOC_INIT_ZVAL (*p_var);
802 else
803 // Refs are just replaced
804 zval_dtor (*p_var);
806 array_init (*p_var);
808 else if (Z_TYPE_PP (p_var) != IS_STRING && Z_TYPE_PP (p_var) != IS_ARRAY)
810 // TODO: why are these different types than pushing
811 php_error_docref (NULL TSRMLS_CC, E_WARNING,
812 "Cannot use a scalar value as an array");
816 /* If its not an array, convert it into an object. */
817 static void
818 check_object_type (zval ** p_var TSRMLS_DC)
820 // TODO: implement
823 /* Push EG (uninitialized_zval_ptr) and return a pointer into the ht
824 * for it */
826 * Converted to array automatically:
827 * ""
828 * NULL
829 * false
831 * Warning, no conversion:
832 * ints
833 * floats
834 * true
836 * Error, no conversion:
837 * strings other than ""
839 // TODO: objects, resources, etc
840 static zval **
841 push_and_index_ht (zval ** p_var TSRMLS_DC)
843 // Check for errors conditions
845 if (Z_TYPE_P (*p_var) == IS_STRING && Z_STRLEN_PP (p_var) > 0)
847 php_error_docref (NULL TSRMLS_CC, E_ERROR,
848 "[] operator not supported for strings");
849 assert (0); // unreachable
852 if (Z_TYPE_P (*p_var) == IS_BOOL && Z_BVAL_PP (p_var)
853 || Z_TYPE_P (*p_var) == IS_LONG || Z_TYPE_P (*p_var) == IS_DOUBLE)
855 php_error_docref (NULL TSRMLS_CC, E_WARNING,
856 "Cannot use a scalar value as an array");
857 return NULL;
860 if (Z_TYPE_P (*p_var) != IS_ARRAY)
862 zval_ptr_dtor (p_var);
863 ALLOC_INIT_ZVAL (*p_var);
864 array_init (*p_var);
867 // if its not an array, make it an array
868 HashTable *ht = extract_ht (p_var TSRMLS_CC);
869 zval **data;
871 EG (uninitialized_zval_ptr)->refcount++;
872 int result = zend_hash_next_index_insert (ht, &EG (uninitialized_zval_ptr),
873 sizeof (zval *), (void **) &data);
874 assert (result == SUCCESS);
876 assert (data);
878 return data;
883 * isset
885 static int
886 isset_var (HashTable * st, char *name, int length)
888 return zend_hash_exists (st, name, length);
891 static int
892 isset_array (zval ** p_var, zval * ind)
894 if (Z_TYPE_P (*p_var) == IS_STRING)
896 ind = zvp_clone_ex (ind);
897 convert_to_long (ind);
898 int result = (Z_LVAL_P (ind) >= 0
899 && Z_LVAL_P (ind) < Z_STRLEN_PP (p_var));
900 assert (ind->refcount == 1);
901 zval_ptr_dtor (&ind);
902 return result;
905 // NO error required; return false
906 if (Z_TYPE_P (*p_var) != IS_ARRAY)
907 return 0;
909 // if its not an array, make it an array
910 HashTable *ht = Z_ARRVAL_P (*p_var);
912 zval **data;
913 if (ht_find (ht, ind, &data) == SUCCESS)
915 return !ZVAL_IS_NULL (*data);
917 else
918 return 0;
922 static zval **
923 fetch_var_arg_by_ref (zval ** p_arg)
925 // We are passing by reference
926 sep_copy_on_write (p_arg);
928 // We don't need to restore ->is_ref afterwards,
929 // because the called function will reduce the
930 // refcount of arg on return, and will reset is_ref to
931 // 0 when refcount drops to 1. If the refcount does
932 // not drop to 1 when the function returns, but we did
933 // set is_ref to 1 here, that means that is_ref must
934 // already have been 1 to start with (since if it had
935 // not, that means that the variable would have been
936 // in a copy-on-write set, and would have been
937 // seperated above).
938 (*p_arg)->is_ref = 1;
940 return p_arg;
943 /* Dont pass-by-ref */
944 static zval *
945 fetch_var_arg (zval * arg, int *is_arg_new)
947 if (arg->is_ref)
949 // We dont separate since we don't own one of ARG's references.
950 arg = zvp_clone_ex (arg);
951 *is_arg_new = 1;
953 // It seems we get incorrect refcounts without this.
954 // TODO This decreases the refcount to zero, which seems wrong,
955 // but gives the right answer. We should look at how zend does
956 // this.
958 arg->refcount--;
960 return arg;
963 // TODO dont overwrite line numbers if we're compiling an extension
964 static void
965 phc_setup_error (int init, char *filename, int line_number,
966 zend_function * function TSRMLS_DC)
968 static int old_in_compilation;
969 static int old_in_execution;
970 static char *old_filename;
971 static int old_lineno;
972 static zend_function *old_function;
973 if (init)
975 if (filename == NULL)
976 filename = "[phc_compiled_file]";
977 // Save old values
978 old_in_compilation = CG (in_compilation);
979 old_in_execution = EG (in_execution);
980 old_filename = CG (compiled_filename);
981 old_lineno = CG (zend_lineno);
982 old_function = EG (function_state_ptr)->function;
983 // Put in our values
984 CG (in_compilation) = 1;
985 EG (in_execution) = 1;
986 CG (compiled_filename) = filename;
987 CG (zend_lineno) = line_number;
988 if (function)
989 EG (function_state_ptr)->function = function;
991 else
993 CG (in_compilation) = old_in_compilation;
994 EG (in_execution) = old_in_execution;
995 CG (compiled_filename) = old_filename;
996 CG (zend_lineno) = old_lineno;
997 EG (function_state_ptr)->function = old_function;
1001 static void
1002 initialize_function_call (zend_fcall_info * fci, zend_fcall_info_cache * fcic,
1003 char *function_name, char *filename,
1004 int line_number TSRMLS_DC)
1006 if (fcic->initialized)
1007 return;
1009 zval fn;
1010 INIT_PZVAL (&fn);
1011 ZVAL_STRING (&fn, function_name, 0);
1012 int result = zend_fcall_info_init (&fn, fci, fcic TSRMLS_CC);
1013 if (result != SUCCESS)
1015 phc_setup_error (1, filename, line_number, NULL TSRMLS_CC);
1016 php_error_docref (NULL TSRMLS_CC, E_ERROR,
1017 "Call to undefined function %s()", function_name);
1022 * Initialize zend_fcall_info for a method lookup
1024 * Implementation partly based on zend_call_method in Zend/zend_interfaces.c
1025 * Main difference is that we use Z_OBJ_HTT_PP(obj)->get_method to retrieve
1026 * the function handler for the method instead of looking it up directly;
1027 * this means that we correctly deal with __call.
1030 static void
1031 initialize_method_call (zend_fcall_info * fci, zend_fcall_info_cache * fcic,
1032 zval ** obj, char *function_name,
1033 char *filename, int line_number TSRMLS_DC)
1035 if (fcic->initialized)
1036 return;
1038 zend_class_entry *obj_ce;
1039 obj_ce = Z_OBJCE_PP (obj);
1042 * we do not initialize fci.
1043 * function_table -- not initialized by zend_call_method
1044 * function_name -- zend_call_method initializes this to a pointer to
1045 * a zval 'z_fname', but does not initialize z_fname
1046 * in case of a method invocation
1047 * retval_ptr_ptr -- should be initialized by caller
1048 * param_count -- should be initialized by caller
1049 * params -- should be initialized by caller
1051 fci->size = sizeof (*fci);
1052 fci->object_pp = obj;
1053 fci->no_separation = 1;
1054 fci->symbol_table = NULL;
1056 fcic->initialized = 1;
1057 fcic->calling_scope = obj_ce;
1058 fcic->object_pp = obj;
1059 fcic->function_handler
1060 = Z_OBJ_HT_PP (obj)->get_method (obj,
1061 function_name,
1062 strlen (function_name) TSRMLS_CC);
1064 if (fcic->function_handler == NULL)
1066 phc_setup_error (1, filename, line_number, NULL TSRMLS_CC);
1067 php_error_docref (NULL TSRMLS_CC, E_ERROR,
1068 "Call to undefined method %s::%s",
1069 obj_ce->name, function_name);
1074 * Like initialize_method_call, but return 0 if no constructor is defined
1075 * rather than giving an error.
1078 static int
1079 initialize_constructor_call (zend_fcall_info * fci,
1080 zend_fcall_info_cache * fcic, zval ** obj,
1081 char *filename, int line_number TSRMLS_DC)
1083 if (fcic->initialized)
1084 return;
1086 zend_class_entry *obj_ce;
1087 obj_ce = Z_OBJCE_PP (obj);
1090 * we do not initialize fci.
1091 * function_table -- not initialized by zend_call_method
1092 * function_name -- zend_call_method initializes this to a pointer to
1093 * a zval 'z_fname', but does not initialize z_fname
1094 * in case of a method invocation
1095 * retval_ptr_ptr -- should be initialized by caller
1096 * param_count -- should be initialized by caller
1097 * params -- should be initialized by caller
1099 fci->size = sizeof (*fci);
1100 fci->object_pp = obj;
1101 fci->no_separation = 1;
1102 fci->symbol_table = NULL;
1104 fcic->initialized = 1;
1105 fcic->calling_scope = obj_ce;
1106 fcic->object_pp = obj;
1107 fcic->function_handler
1108 = Z_OBJ_HT_PP (obj)->get_constructor (*obj TSRMLS_CC);
1110 return (fcic->function_handler != NULL);
1112 // vi:set ts=8:
1115 * Creates a copy of *in using persistent memory, optionally destroying *in
1117 * Does not work for objects/resources and will loop on self-recursive arrays.
1120 zval *
1121 persistent_clone (zval * in, int destroy_in TSRMLS_DC)
1123 zval *out = pemalloc (sizeof (zval), 1);
1124 *out = *in;
1126 switch (Z_TYPE_P (in))
1128 case IS_NULL:
1129 case IS_LONG:
1130 case IS_DOUBLE:
1131 case IS_BOOL:
1132 /* nothing more to be done */
1133 break;
1134 case IS_STRING:
1135 Z_STRVAL_P (out) = pemalloc (Z_STRLEN_P (in) + 1, 1);
1136 memcpy (Z_STRVAL_P (out), Z_STRVAL_P (in), Z_STRLEN_P (in) + 1);
1137 break;
1138 case IS_ARRAY:
1140 HashTable *old_arr = Z_ARRVAL_P (in);
1141 HashTable *new_arr = pemalloc (sizeof (HashTable), 1);
1142 zend_hash_init (new_arr, old_arr->nNumOfElements, NULL, ZVAL_PTR_DTOR,
1143 /* persistent */ 1);
1145 for (zend_hash_internal_pointer_reset (old_arr);
1146 zend_hash_has_more_elements (old_arr) == SUCCESS;
1147 zend_hash_move_forward (old_arr))
1149 char *key;
1150 uint keylen;
1151 ulong idx;
1152 int type;
1153 zval **old_elem, *new_elem;
1155 type =
1156 zend_hash_get_current_key_ex (old_arr, &key, &keylen, &idx, 0,
1157 NULL);
1158 assert (zend_hash_get_current_data
1159 (old_arr, (void **) &old_elem) == SUCCESS);
1161 new_elem = persistent_clone (*old_elem, destroy_in TSRMLS_CC);
1163 if (type == HASH_KEY_IS_STRING)
1164 zend_hash_add (new_arr, key, keylen, &new_elem, sizeof (zval *),
1165 NULL);
1166 else
1167 zend_hash_index_update (new_arr, idx, &new_elem,
1168 sizeof (zval *), NULL);
1172 Z_ARRVAL_P (out) = new_arr;
1174 break;
1175 default:
1176 /* other types are not supported */
1177 assert (0);
1180 zval_ptr_dtor (&in);
1181 return out;
1185 * Wrapper around zend_declare_property which
1187 * - Asserts that the ZEND_INTERNAL_CLASS flag is cleared
1188 * (otherwise we cannot add complex (i.e., array) properties)
1189 * - Creates a persistent clone of the property to be added before
1190 * calling zend_declare_property, since the memory for this property
1191 * should only be deallocated when the module is shut down
1192 * (and not when the request finishes)
1193 * - Cleans up after zend_declare_property by re-allocating the name of
1194 * the property using persistent memory, for much the same reason
1197 static int
1198 phc_declare_property (zend_class_entry * ce, char *name, int name_length,
1199 zval * property, int access_type TSRMLS_DC)
1201 assert (!(ce->type & ZEND_INTERNAL_CLASS));
1202 assert (zend_declare_property
1203 (ce, name, name_length, persistent_clone (property, 1 TSRMLS_CC),
1204 access_type TSRMLS_CC) == SUCCESS);
1206 zend_property_info *property_info;
1207 assert (zend_hash_find
1208 (&ce->properties_info, name, name_length + 1,
1209 (void **) &property_info) == SUCCESS);
1210 efree (property_info->name);
1211 property_info->name = name;
1213 return SUCCESS;
1216 // vi:set ts=8:
1219 static void
1220 cast_var (zval ** p_zvp, int type)
1222 assert (type >= 0 && type <= 6);
1223 if ((*p_zvp)->type == type)
1224 return;
1226 sep_copy_on_write (p_zvp);
1227 zval *zvp = *p_zvp;
1229 switch (type)
1231 case IS_NULL:
1232 convert_to_null (zvp);
1233 break;
1234 case IS_BOOL:
1235 convert_to_boolean (zvp);
1236 break;
1237 case IS_LONG:
1238 convert_to_long (zvp);
1239 break;
1240 case IS_DOUBLE:
1241 convert_to_double (zvp);
1242 break;
1243 case IS_STRING:
1244 convert_to_string (zvp);
1245 break;
1246 case IS_ARRAY:
1247 convert_to_array (zvp);
1248 break;
1249 case IS_OBJECT:
1250 convert_to_object (zvp);
1251 break;
1252 default:
1253 assert (0); // TODO unimplemented
1254 break;
1258 /* Copies a constant into ZVP. Note that LENGTH does not include the NULL-terminating byte. */
1259 static void
1260 get_constant (char *name, int length, zval ** p_zvp TSRMLS_DC)
1262 MAKE_STD_ZVAL (*p_zvp);
1263 // zend_get_constant returns 1 for success, not SUCCESS
1264 int result = zend_get_constant (name, length, *p_zvp TSRMLS_CC);
1265 if (result == 0)
1266 ZVAL_STRINGL (*p_zvp, name, length, 1);
1269 /* The function call mechanism deals specially with EG(uninitialize_zval_ptr)
1270 * (or sometime EG(uninitialize_zval)), so we need to use this too. This
1271 * particular zval can also be set, but there is an implicit guarantee
1272 * of the information below.
1274 * If assertions are off, this should be inlined to nothing.
1276 static void
1277 phc_check_invariants (TSRMLS_D)
1279 assert (EG (uninitialized_zval_ptr) == &EG (uninitialized_zval));
1280 assert (EG (uninitialized_zval).refcount >= 1);
1281 assert (EG (uninitialized_zval).value.lval == 0);
1282 assert (EG (uninitialized_zval).type == IS_NULL);
1283 assert (EG (uninitialized_zval).is_ref == 0);
1287 static int
1288 check_unset_index_type (zval * ind TSRMLS_DC)
1290 if (Z_TYPE_P (ind) == IS_OBJECT || Z_TYPE_P (ind) == IS_ARRAY)
1292 php_error_docref (NULL TSRMLS_CC, E_WARNING,
1293 "Illegal offset type in unset");
1294 return 0;
1297 return 1;
1303 * unset
1306 static void
1307 unset_var (HashTable * st, char *name, int length)
1309 zend_hash_del (st, name, length);
1312 static void
1313 unset_array (zval ** p_var, zval * ind TSRMLS_DC)
1315 // NO error required
1316 if (Z_TYPE_PP (p_var) != IS_ARRAY)
1318 if (Z_TYPE_PP (p_var) == IS_STRING)
1320 php_error_docref (NULL TSRMLS_CC, E_ERROR,
1321 "Cannot unset string offsets");
1323 else if (Z_TYPE_PP (p_var) != IS_NULL)
1325 php_error_docref (NULL TSRMLS_CC, E_WARNING,
1326 "Cannot unset offsets in a non-array variable");
1329 return;
1332 // if its not an array, make it an array
1333 HashTable *ht = Z_ARRVAL_P (*p_var);
1335 ht_delete (ht, ind);
1339 * Lookup variable whose name is var_var in st. We do not call
1340 * ht_find because ht_find uses zend_symtable_find to search for strings
1341 * rather than zend_hash_find. The difference is that zend_symtable_find
1342 * will convert strings to integers where possible: arrays are always
1343 * integer-indexed if at all possible. Variable names however should
1344 * _always_ be treated as strings.
1349 * If the parameter is a string, returns the parameter, with the refcount
1350 * incremented. If its not a string, returns a new zval, with a refcount of
1351 * 1. Either way, zval_dtor_ptr must be run by the caller on the return
1352 * value.
1354 zval*
1355 get_string_val (zval* zvp)
1357 if (Z_TYPE_P (zvp) == IS_STRING)
1359 zvp->refcount++;
1360 return zvp;
1362 else
1364 zval* clone = zvp_clone_ex (zvp);
1365 convert_to_string (clone);
1366 return clone;
1370 zval **
1371 get_var_var (HashTable * st, zval * index TSRMLS_DC)
1373 zval* str_index = get_string_val (index);
1374 char* name = Z_STRVAL_P (str_index);
1375 int length = Z_STRLEN_P (str_index) + 1;
1376 unsigned long hash = zend_get_hash_value (name, length);
1378 zval** result = get_st_entry (st, name, length, hash TSRMLS_CC);
1379 zval_ptr_dtor (&str_index);
1380 return result;
1384 * Read the variable described by var_var from symbol table st
1385 * See comments for get_var_var
1387 zval *
1388 read_var_var (HashTable * st, zval * index TSRMLS_DC)
1390 zval* str_index = get_string_val (index);
1391 char* name = Z_STRVAL_P (str_index);
1392 int length = Z_STRLEN_P (str_index) + 1;
1393 unsigned long hash = zend_get_hash_value (name, length);
1395 zval* result = read_var (st, name, length, hash TSRMLS_CC);
1396 zval_ptr_dtor (&str_index);
1397 return result;
1400 static void
1401 phc_builtin_eval (zval * arg, zval ** p_result, char *filename TSRMLS_DC)
1403 // If the user wrote "return ..", we need to store the
1404 // return value; however, in that case, zend_eval_string
1405 // will slap an extra "return" onto the front of the string,
1406 // so we must remove the "return" from the string the user
1407 // wrote. If the user did not write "return", he is not
1408 // interested in the return value, and we must pass NULL
1409 // instead or rhs to avoid zend_eval_string adding "return".
1411 // convert to a string
1412 // TODO avoid allocation
1413 zval *copy = zvp_clone_ex (arg);
1414 convert_to_string (copy);
1416 if (*p_result && !strncmp (Z_STRVAL_P (copy), "return ", 7))
1418 zend_eval_string (Z_STRVAL_P (copy) + 7, *p_result,
1419 "eval'd code" TSRMLS_CC);
1421 else
1423 zend_eval_string (Z_STRVAL_P (copy), NULL, "eval'd code" TSRMLS_CC);
1426 // cleanup
1427 assert (copy->refcount == 1);
1428 zval_ptr_dtor (&copy);
1431 static void
1432 phc_builtin_exit (zval * arg, zval ** p_result, char *filename TSRMLS_DC)
1434 if (Z_TYPE_P (arg) == IS_LONG)
1435 EG (exit_status) = Z_LVAL_P (arg);
1436 else
1437 zend_print_variable (arg);
1439 zend_bailout ();
1442 static void
1443 phc_builtin_die (zval * arg, zval ** p_result, char *filename TSRMLS_DC)
1445 phc_builtin_exit (arg, p_result, filename TSRMLS_CC);
1448 static void
1449 phc_builtin_echo (zval * arg, zval ** p_result TSRMLS_DC)
1451 assert (*p_result == NULL);
1452 zend_print_variable (arg);
1455 static void
1456 phc_builtin_print (zval * arg, zval ** p_result, char *filename TSRMLS_DC)
1458 zval *echo_arg = NULL;
1459 phc_builtin_echo (arg, &echo_arg TSRMLS_CC);
1461 if (*p_result)
1462 ZVAL_LONG (*p_result, 1);
1465 // TODO is there a memory leak here is result has a value?
1466 // TOOD isnt this just the same as isset
1467 static void
1468 phc_builtin_empty (zval * arg, zval ** p_result, char *filename TSRMLS_DC)
1470 assert (*p_result);
1471 ZVAL_BOOL (*p_result, !zend_is_true (arg));
1474 // For require, include, require_once and include_once.
1476 // Include:
1477 // return 1 for success
1478 // Warning, and return false for failure
1479 // Require:
1480 // return 1 for success
1481 // Fail for failure
1482 // Include_once
1483 // Return true if already included
1484 // Return 1 for success
1485 // Warning and return false for failure
1486 // Require_once:
1487 // Return true if already included
1488 // return 1 for success
1489 // Fail for failure
1491 static void
1492 include_backend (zval * arg, zval ** p_result, char *filename, int type, int is_once, char* error, char* error_function TSRMLS_DC)
1494 // In the event that the Zend engine cannot find the file, after checking the
1495 // include path, it tries the current directory. It does this only if the
1496 // interpreter is executing, and it checks the interpreters opcodes for a
1497 // filename (see streams/plain_wrapper.c:1352)
1499 // An alternative is to add the directory to include_path, but its
1500 // semantically incorrect (get_included_path() would give the wrong answer),
1501 // and error prone (if people overwrite include_path).
1502 // TODO: though we could add it for this function only
1504 assert (EG (active_op_array) == NULL);
1505 assert (filename != NULL);
1507 zval *arg_file = arg;
1508 // Check we have a string
1509 if (Z_TYPE_P (arg_file) != IS_STRING)
1511 arg_file = zvp_clone_ex (arg_file);
1512 convert_to_string (arg_file);
1515 zend_file_handle handle;
1516 zend_op_array* new_op_array;
1517 zend_function zf;
1519 // Check the _ONCE varieties (based on zend_vm_def.h)
1520 if (is_once)
1522 if (IS_ABSOLUTE_PATH (Z_STRVAL_P (arg_file), Z_STRLEN_P (arg_file)))
1524 // Get the proper path name for require
1525 cwd_state state;
1527 state.cwd_length = 0;
1528 state.cwd = malloc(1);
1529 state.cwd[0] = 0;
1530 int success = !virtual_file_ex(&state, Z_STRVAL_P(arg_file), NULL, 1)
1531 && zend_hash_exists(&EG(included_files), state.cwd,
1532 state.cwd_length+1);
1534 free (state.cwd);
1536 if (!success)
1537 goto cleanup;
1542 // Compile the file
1543 // Pretend the interpreter is running
1544 EG (in_execution) = 1;
1546 int success = zend_stream_open (Z_STRVAL_P (arg_file), &handle TSRMLS_CC);
1548 // Stop pretending
1549 EG (in_execution) = 0;
1550 EG (active_op_array) = NULL;
1552 if (success != SUCCESS)
1553 goto fail;
1556 if (is_once)
1558 // Check it hadnt been included already
1559 int once_success = zend_hash_add_empty_element(&EG(included_files),
1560 handle.opened_path,
1561 strlen (handle.opened_path)+1);
1562 // Return true
1563 if (once_success != SUCCESS)
1565 ZVAL_BOOL (*p_result, 1);
1566 goto cleanup;
1570 if (!handle.opened_path)
1571 handle.opened_path = estrndup (Z_STRVAL_P(arg_file), Z_STRLEN_P (arg_file));
1573 // run it
1574 success = zend_execute_scripts (type TSRMLS_CC, p_result, 1, &handle);
1575 assert (success == SUCCESS);
1576 zend_stream_close (&handle);
1578 // Success
1579 if (*p_result)
1580 ZVAL_LONG (*p_result, 1);
1583 goto cleanup;
1586 fail:
1588 php_error_docref (error_function
1589 TSRMLS_CC,
1590 (type == ZEND_INCLUDE) ? E_WARNING : E_ERROR,
1591 error,
1592 php_strip_url_passwd (Z_STRVAL_P (arg_file)),
1593 STR_PRINT (PG (include_path)));
1596 // Failure
1597 if (*p_result)
1598 ZVAL_BOOL (*p_result, 0);
1600 cleanup:
1602 if (handle.opened_path)
1603 efree (handle.opened_path);
1604 zend_destroy_file_handle (&handle TSRMLS_CC);
1607 if (arg != arg_file)
1608 zval_ptr_dtor (&arg_file);
1611 static void
1612 phc_builtin_include (zval * arg, zval ** p_result, char *filename TSRMLS_DC)
1614 include_backend ( arg,
1615 p_result,
1616 filename,
1617 ZEND_INCLUDE,
1619 "Failed opening '%s' for inclusion (include_path='%s')",
1620 "function.include"
1621 TSRMLS_CC);
1624 static void
1625 phc_builtin_require (zval * arg, zval ** p_result, char *filename TSRMLS_DC)
1627 include_backend ( arg,
1628 p_result,
1629 filename,
1630 ZEND_REQUIRE,
1632 "Failed opening required '%s' (include_path='%s')",
1633 "function.require"
1634 TSRMLS_CC);
1637 static void
1638 phc_builtin_include_once (zval * arg, zval ** p_result, char *filename TSRMLS_DC)
1640 include_backend ( arg,
1641 p_result,
1642 filename,
1643 ZEND_INCLUDE,
1645 "Failed opening '%s' for inclusion (include_path='%s')",
1646 "function.include_once"
1647 TSRMLS_CC);
1650 static void
1651 phc_builtin_require_once (zval * arg, zval ** p_result, char *filename TSRMLS_DC)
1653 include_backend ( arg,
1654 p_result,
1655 filename,
1656 ZEND_REQUIRE,
1658 "Failed opening required '%s' (include_path='%s')",
1659 "function.require_once"
1660 TSRMLS_CC);
1663 // END INCLUDED FILES
1664 int saved_refcount;
1665 static zend_fcall_info array_keys_fci;
1666 static zend_fcall_info_cache array_keys_fcic = {0,NULL,NULL,NULL};
1667 static zend_fcall_info is_null_fci;
1668 static zend_fcall_info_cache is_null_fcic = {0,NULL,NULL,NULL};
1669 static zend_fcall_info version_compare_fci;
1670 static zend_fcall_info_cache version_compare_fcic = {0,NULL,NULL,NULL};
1671 static zend_fcall_info wfsetvar_fci;
1672 static zend_fcall_info_cache wfsetvar_fcic = {0,NULL,NULL,NULL};
1673 // class ParserOutput
1674 // {
1675 // var $mText = NULL;
1676 // var $mLanguageLinks = NULL;
1677 // var $mCategories = NULL;
1678 // var $mContainsOldMagic = NULL;
1679 // var $mTitleText = NULL;
1680 // var $mCacheTime = '';
1681 // var $mVersion = Parser::VERSION;
1682 // var $mLinks = array();
1683 // var $mTemplates = array();
1684 // var $mTemplateIds = array();
1685 // var $mImages = array();
1686 // var $mExternalLinks = array();
1687 // var $mNewSection = False;
1688 // var $mNoGallery = False;
1689 // var $mHeadItems = array();
1690 // var $mOutputHooks = array();
1691 // var $mWarnings = array();
1692 // var $mSections = array();
1693 // var $mProperties = array();
1694 // private $mIndexPolicy = '';
1695 // private $displayTitle = False;
1696 // function parseroutput($text = '', $languageLinks = array(), $categoryLinks = array(), $containsOldMagic = False, $titletext = '')
1697 // {
1698 // $this->mText = $text;
1699 // $this->mLanguageLinks = $languageLinks;
1700 // $this->mCategories = $categoryLinks;
1701 // $this->mContainsOldMagic = $containsOldMagic;
1702 // $this->mTitleText = $titletext;
1703 // }
1704 // function gettext()
1705 // {
1706 // $TSt9 = $this->mText;
1707 // return $TSt9;
1708 // }
1709 // function &getlanguagelinks()
1710 // {
1711 // $TSt10 =& $this->mLanguageLinks;
1712 // return $TSt10;
1713 // }
1714 // function getcategorylinks()
1715 // {
1716 // $TLE100 = param_is_ref (NULL, "array_keys", 0);
1717 // ;
1718 // if (TLE100) goto L128 else goto L129;
1719 // L128:
1720 // $TMIt99 =& $this->mCategories;
1721 // goto L130;
1722 // L129:
1723 // $TMIt99 = $this->mCategories;
1724 // goto L130;
1725 // L130:
1726 // $TLE11 = array_keys($TMIt99);
1727 // return $TLE11;
1728 // }
1729 // function &getcategories()
1730 // {
1731 // $TSt12 =& $this->mCategories;
1732 // return $TSt12;
1733 // }
1734 // function getcachetime()
1735 // {
1736 // $TSt13 = $this->mCacheTime;
1737 // return $TSt13;
1738 // }
1739 // function gettitletext()
1740 // {
1741 // $TSt14 = $this->mTitleText;
1742 // return $TSt14;
1743 // }
1744 // function getsections()
1745 // {
1746 // $TSt15 = $this->mSections;
1747 // return $TSt15;
1748 // }
1749 // function &getlinks()
1750 // {
1751 // $TSt16 =& $this->mLinks;
1752 // return $TSt16;
1753 // }
1754 // function &gettemplates()
1755 // {
1756 // $TSt17 =& $this->mTemplates;
1757 // return $TSt17;
1758 // }
1759 // function &getimages()
1760 // {
1761 // $TSt18 =& $this->mImages;
1762 // return $TSt18;
1763 // }
1764 // function &getexternallinks()
1765 // {
1766 // $TSt19 =& $this->mExternalLinks;
1767 // return $TSt19;
1768 // }
1769 // function getnogallery()
1770 // {
1771 // $TSt20 = $this->mNoGallery;
1772 // return $TSt20;
1773 // }
1774 // function getsubtitle()
1775 // {
1776 // $TSt21 = $this->mSubtitle;
1777 // return $TSt21;
1778 // }
1779 // function getoutputhooks()
1780 // {
1781 // $TSt22 = $this->mOutputHooks;
1782 // $TLE23 = (array) $TSt22;
1783 // return $TLE23;
1784 // }
1785 // function getwarnings()
1786 // {
1787 // $TLE102 = param_is_ref (NULL, "array_keys", 0);
1788 // ;
1789 // if (TLE102) goto L131 else goto L132;
1790 // L131:
1791 // $TMIt101 =& $this->mWarnings;
1792 // goto L133;
1793 // L132:
1794 // $TMIt101 = $this->mWarnings;
1795 // goto L133;
1796 // L133:
1797 // $TLE24 = array_keys($TMIt101);
1798 // return $TLE24;
1799 // }
1800 // function getindexpolicy()
1801 // {
1802 // $TSt25 = $this->mIndexPolicy;
1803 // return $TSt25;
1804 // }
1805 // function containsoldmagic()
1806 // {
1807 // $TSt26 = $this->mContainsOldMagic;
1808 // return $TSt26;
1809 // }
1810 // function settext($text)
1811 // {
1812 // $TLE104 = param_is_ref (NULL, "wfsetvar", 0);
1813 // ;
1814 // if (TLE104) goto L134 else goto L135;
1815 // L134:
1816 // $TMIt103 =& $this->mText;
1817 // goto L136;
1818 // L135:
1819 // $TMIt103 = $this->mText;
1820 // goto L136;
1821 // L136:
1822 // $TLE27 = wfsetvar($TMIt103, $text);
1823 // return $TLE27;
1824 // }
1825 // function setlanguagelinks($ll)
1826 // {
1827 // $TLE106 = param_is_ref (NULL, "wfsetvar", 0);
1828 // ;
1829 // if (TLE106) goto L137 else goto L138;
1830 // L137:
1831 // $TMIt105 =& $this->mLanguageLinks;
1832 // goto L139;
1833 // L138:
1834 // $TMIt105 = $this->mLanguageLinks;
1835 // goto L139;
1836 // L139:
1837 // $TLE28 = wfsetvar($TMIt105, $ll);
1838 // return $TLE28;
1839 // }
1840 // function setcategorylinks($cl)
1841 // {
1842 // $TLE108 = param_is_ref (NULL, "wfsetvar", 0);
1843 // ;
1844 // if (TLE108) goto L140 else goto L141;
1845 // L140:
1846 // $TMIt107 =& $this->mCategories;
1847 // goto L142;
1848 // L141:
1849 // $TMIt107 = $this->mCategories;
1850 // goto L142;
1851 // L142:
1852 // $TLE29 = wfsetvar($TMIt107, $cl);
1853 // return $TLE29;
1854 // }
1855 // function setcontainsoldmagic($com)
1856 // {
1857 // $TLE110 = param_is_ref (NULL, "wfsetvar", 0);
1858 // ;
1859 // if (TLE110) goto L143 else goto L144;
1860 // L143:
1861 // $TMIt109 =& $this->mContainsOldMagic;
1862 // goto L145;
1863 // L144:
1864 // $TMIt109 = $this->mContainsOldMagic;
1865 // goto L145;
1866 // L145:
1867 // $TLE30 = wfsetvar($TMIt109, $com);
1868 // return $TLE30;
1869 // }
1870 // function setcachetime($t)
1871 // {
1872 // $TLE112 = param_is_ref (NULL, "wfsetvar", 0);
1873 // ;
1874 // if (TLE112) goto L146 else goto L147;
1875 // L146:
1876 // $TMIt111 =& $this->mCacheTime;
1877 // goto L148;
1878 // L147:
1879 // $TMIt111 = $this->mCacheTime;
1880 // goto L148;
1881 // L148:
1882 // $TLE31 = wfsetvar($TMIt111, $t);
1883 // return $TLE31;
1884 // }
1885 // function settitletext($t)
1886 // {
1887 // $TLE114 = param_is_ref (NULL, "wfsetvar", 0);
1888 // ;
1889 // if (TLE114) goto L149 else goto L150;
1890 // L149:
1891 // $TMIt113 =& $this->mTitleText;
1892 // goto L151;
1893 // L150:
1894 // $TMIt113 = $this->mTitleText;
1895 // goto L151;
1896 // L151:
1897 // $TLE32 = wfsetvar($TMIt113, $t);
1898 // return $TLE32;
1899 // }
1900 // function setsections($toc)
1901 // {
1902 // $TLE116 = param_is_ref (NULL, "wfsetvar", 0);
1903 // ;
1904 // if (TLE116) goto L152 else goto L153;
1905 // L152:
1906 // $TMIt115 =& $this->mSections;
1907 // goto L154;
1908 // L153:
1909 // $TMIt115 = $this->mSections;
1910 // goto L154;
1911 // L154:
1912 // $TLE33 = wfsetvar($TMIt115, $toc);
1913 // return $TLE33;
1914 // }
1915 // function setindexpolicy($policy)
1916 // {
1917 // $TLE118 = param_is_ref (NULL, "wfsetvar", 0);
1918 // ;
1919 // if (TLE118) goto L155 else goto L156;
1920 // L155:
1921 // $TMIt117 =& $this->mIndexPolicy;
1922 // goto L157;
1923 // L156:
1924 // $TMIt117 = $this->mIndexPolicy;
1925 // goto L157;
1926 // L157:
1927 // $TLE34 = wfsetvar($TMIt117, $policy);
1928 // return $TLE34;
1929 // }
1930 // function addcategory($c, $sort)
1931 // {
1932 // $TSt35 =& $this->mCategories;
1933 // $TSt35[$c] = $sort;
1934 // }
1935 // function addlanguagelink($t)
1936 // {
1937 // $TSt36 =& $this->mLanguageLinks;
1938 // $TSt36[] = $t;
1939 // }
1940 // function addexternallink($url)
1941 // {
1942 // $TSt37 =& $this->mExternalLinks;
1943 // $TLE38 = 1;
1944 // $TSt37[$url] = $TLE38;
1945 // }
1946 // function addwarning($s)
1947 // {
1948 // $TSt39 =& $this->mWarnings;
1949 // $TLE40 = 1;
1950 // $TSt39[$s] = $TLE40;
1951 // }
1952 // function addoutputhook($hook, $data = False)
1953 // {
1954 // $TSt41 =& $this->mOutputHooks;
1955 // unset($TSa42);
1956 // $TSa42 = (array) $TSa42;
1957 // $TSa42[] = $hook;
1958 // $TSa42[] = $data;
1959 // $TSt41[] = $TSa42;
1960 // }
1961 // function setnewsection($value)
1962 // {
1963 // $TLE43 = (bool) $value;
1964 // $this->mNewSection = $TLE43;
1965 // }
1966 // function getnewsection()
1967 // {
1968 // $TSt44 = $this->mNewSection;
1969 // $TLE45 = (bool) $TSt44;
1970 // return $TLE45;
1971 // }
1972 // function addlink($title, $id = NULL)
1973 // {
1974 // $ns = $title->getnamespace();
1975 // $dbk = $title->getdbkey();
1976 // $TLE46 = NS_MEDIA;
1977 // $TLE47 = ($ns == $TLE46);
1978 // if (TLE47) goto L164 else goto L165;
1979 // L164:
1980 // $ns = NS_FILE;
1981 // goto L166;
1982 // L165:
1983 // $TLE48 = NS_SPECIAL;
1984 // $TLE49 = ($ns == $TLE48);
1985 // if (TLE49) goto L161 else goto L162;
1986 // L161:
1987 // $TLE50 = NULL;
1988 // return $TLE50;
1989 // goto L163;
1990 // L162:
1991 // $TLE51 = '';
1992 // $TLE52 = ($dbk === $TLE51);
1993 // if (TLE52) goto L158 else goto L159;
1994 // L158:
1995 // $TLE53 = NULL;
1996 // return $TLE53;
1997 // goto L160;
1998 // L159:
1999 // goto L160;
2000 // L160:
2001 // goto L163;
2002 // L163:
2003 // goto L166;
2004 // L166:
2005 // $TMIt119 = $this->mLinks;
2006 // $TLE54 = isset($TMIt119[$ns]);
2007 // $TLE55 = !$TLE54;
2008 // if (TLE55) goto L167 else goto L168;
2009 // L167:
2010 // $TSt56 =& $this->mLinks;
2011 // unset($TSa57);
2012 // $TSa57 = (array) $TSa57;
2013 // $TSt56[$ns] = $TSa57;
2014 // goto L169;
2015 // L168:
2016 // goto L169;
2017 // L169:
2018 // $TLE58 = is_null($id);
2019 // if (TLE58) goto L170 else goto L171;
2020 // L170:
2021 // $id = $title->getarticleid();
2022 // goto L172;
2023 // L171:
2024 // goto L172;
2025 // L172:
2026 // $TSt59 =& $this->mLinks;
2027 // $TSi60 =& $TSt59[$ns];
2028 // $TSi60[$dbk] = $id;
2029 // }
2030 // function addimage($name)
2031 // {
2032 // $TSt61 =& $this->mImages;
2033 // $TLE62 = 1;
2034 // $TSt61[$name] = $TLE62;
2035 // }
2036 // function addtemplate($title, $page_id, $rev_id)
2037 // {
2038 // $ns = $title->getnamespace();
2039 // $dbk = $title->getdbkey();
2040 // $TMIt120 = $this->mTemplates;
2041 // $TLE63 = isset($TMIt120[$ns]);
2042 // $TLE64 = !$TLE63;
2043 // if (TLE64) goto L173 else goto L174;
2044 // L173:
2045 // $TSt65 =& $this->mTemplates;
2046 // unset($TSa66);
2047 // $TSa66 = (array) $TSa66;
2048 // $TSt65[$ns] = $TSa66;
2049 // goto L175;
2050 // L174:
2051 // goto L175;
2052 // L175:
2053 // $TSt67 =& $this->mTemplates;
2054 // $TSi68 =& $TSt67[$ns];
2055 // $TSi68[$dbk] = $page_id;
2056 // $TMIt121 = $this->mTemplateIds;
2057 // $TLE69 = isset($TMIt121[$ns]);
2058 // $TLE70 = !$TLE69;
2059 // if (TLE70) goto L176 else goto L177;
2060 // L176:
2061 // $TSt71 =& $this->mTemplateIds;
2062 // unset($TSa72);
2063 // $TSa72 = (array) $TSa72;
2064 // $TSt71[$ns] = $TSa72;
2065 // goto L178;
2066 // L177:
2067 // goto L178;
2068 // L178:
2069 // $TSt73 =& $this->mTemplateIds;
2070 // $TSi74 =& $TSt73[$ns];
2071 // $TSi74[$dbk] = $rev_id;
2072 // }
2073 // function expired($touched)
2074 // {
2075 // global $wgCacheEpoch;
2076 // $TLE75 = $this->getcachetime();
2077 // $TLE76 = -1;
2078 // $TLE0 = ($TLE75 == $TLE76);
2079 // if (TLE0) goto L179 else goto L180;
2080 // L179:
2081 // $TEF1 = $TLE0;
2082 // goto L181;
2083 // L180:
2084 // $TLE77 = $this->getcachetime();
2085 // $TEF1 = ($TLE77 < $touched);
2086 // goto L181;
2087 // L181:
2088 // $TLE2 = (bool) $TEF1;
2089 // if (TLE2) goto L182 else goto L183;
2090 // L182:
2091 // $TEF3 = $TLE2;
2092 // goto L184;
2093 // L183:
2094 // $TLE78 = $this->getcachetime();
2095 // $TEF3 = ($TLE78 <= $wgCacheEpoch);
2096 // goto L184;
2097 // L184:
2098 // $TLE4 = (bool) $TEF3;
2099 // if (TLE4) goto L185 else goto L186;
2100 // L185:
2101 // $TEF5 = $TLE4;
2102 // goto L187;
2103 // L186:
2104 // $TMIt122 = $this->mVersion;
2105 // $TLE79 = isset($TMIt122);
2106 // $TEF5 = !$TLE79;
2107 // goto L187;
2108 // L187:
2109 // $TLE6 = (bool) $TEF5;
2110 // if (TLE6) goto L191 else goto L192;
2111 // L191:
2112 // $TEF7 = $TLE6;
2113 // goto L193;
2114 // L192:
2115 // $TLE80 = Parser::VERSION;
2116 // $TLE81 = 'lt';
2117 // $TLE124 = param_is_ref (NULL, "version_compare", 0);
2118 // ;
2119 // if (TLE124) goto L188 else goto L189;
2120 // L188:
2121 // $TMIt123 =& $this->mVersion;
2122 // goto L190;
2123 // L189:
2124 // $TMIt123 = $this->mVersion;
2125 // goto L190;
2126 // L190:
2127 // $TEF7 = version_compare($TMIt123, $TLE80, $TLE81);
2128 // goto L193;
2129 // L193:
2130 // $TLE82 = (bool) $TEF7;
2131 // return $TLE82;
2132 // }
2133 // function addheaditem($section, $tag = False)
2134 // {
2135 // $TLE83 = False;
2136 // $TLE84 = ($tag !== $TLE83);
2137 // if (TLE84) goto L194 else goto L195;
2138 // L194:
2139 // $TSt85 =& $this->mHeadItems;
2140 // $TSt85[$tag] = $section;
2141 // goto L196;
2142 // L195:
2143 // $TSt86 =& $this->mHeadItems;
2144 // $TSt86[] = $section;
2145 // goto L196;
2146 // L196:
2147 // }
2148 // public function setdisplaytitle($text)
2149 // {
2150 // $this->displayTitle = $text;
2151 // }
2152 // public function getdisplaytitle()
2153 // {
2154 // $TSt87 = $this->displayTitle;
2155 // return $TSt87;
2156 // }
2157 // public function setflag($flag)
2158 // {
2159 // $TSt88 =& $this->mFlags;
2160 // $TLE89 = True;
2161 // $TSt88[$flag] = $TLE89;
2162 // }
2163 // public function getflag($flag)
2164 // {
2165 // $TMIt125 = $this->mFlags;
2166 // $TLE90 = isset($TMIt125[$flag]);
2167 // return $TLE90;
2168 // }
2169 // public function setproperty($name, $value)
2170 // {
2171 // $TSt91 =& $this->mProperties;
2172 // $TSt91[$name] = $value;
2173 // }
2174 // public function getproperty($name)
2175 // {
2176 // $TMIt126 = $this->mProperties;
2177 // $TLE92 = isset($TMIt126[$name]);
2178 // if (TLE92) goto L197 else goto L198;
2179 // L197:
2180 // $TSt93 = $this->mProperties;
2181 // $TSi94 = $TSt93[$name];
2182 // $TEF8 = $TSi94;
2183 // goto L199;
2184 // L198:
2185 // $TEF8 = False;
2186 // goto L199;
2187 // L199:
2188 // return $TEF8;
2189 // }
2190 // public function getproperties()
2191 // {
2192 // $TMIt127 = $this->mProperties;
2193 // $TLE95 = isset($TMIt127);
2194 // $TLE96 = !$TLE95;
2195 // if (TLE96) goto L200 else goto L201;
2196 // L200:
2197 // unset($TSa97);
2198 // $TSa97 = (array) $TSa97;
2199 // $this->mProperties = $TSa97;
2200 // goto L202;
2201 // L201:
2202 // goto L202;
2203 // L202:
2204 // $TSt98 = $this->mProperties;
2205 // return $TSt98;
2206 // }
2207 // }
2208 // function parseroutput($text = '', $languageLinks = array(), $categoryLinks = array(), $containsOldMagic = False, $titletext = '')
2209 // {
2210 // $this->mText = $text;
2211 // $this->mLanguageLinks = $languageLinks;
2212 // $this->mCategories = $categoryLinks;
2213 // $this->mContainsOldMagic = $containsOldMagic;
2214 // $this->mTitleText = $titletext;
2215 // }
2216 PHP_METHOD(ParserOutput, parseroutput)
2218 zval* local_categoryLinks = NULL;
2219 zval* local_containsOldMagic = NULL;
2220 zval* local_languageLinks = NULL;
2221 zval* local_text = NULL;
2222 zval* local_this = getThis();
2223 zval* local_titletext = NULL;
2224 // Add all parameters as local variables
2226 int num_args = ZEND_NUM_ARGS ();
2227 zval* params[5];
2228 zend_get_parameters_array(0, num_args, params);
2229 // param 0
2230 if (num_args <= 0)
2232 zval* default_value;
2234 zval* local___static_value__ = NULL;
2235 // $__static_value__ = '';
2237 if (local___static_value__ == NULL)
2239 local___static_value__ = EG (uninitialized_zval_ptr);
2240 local___static_value__->refcount++;
2242 zval** p_lhs = &local___static_value__;
2244 zval* value;
2245 if ((*p_lhs)->is_ref)
2247 // Always overwrite the current value
2248 value = *p_lhs;
2249 zval_dtor (value);
2251 else
2253 ALLOC_INIT_ZVAL (value);
2254 zval_ptr_dtor (p_lhs);
2255 *p_lhs = value;
2258 ZVAL_STRINGL(value, "", 0, 1);
2260 phc_check_invariants (TSRMLS_C);
2262 default_value = local___static_value__;
2263 assert(!default_value->is_ref);
2264 default_value->refcount++;
2265 if (local___static_value__ != NULL)
2267 zval_ptr_dtor (&local___static_value__);
2270 default_value->refcount--;
2271 params[0] = default_value;
2273 params[0]->refcount++;
2274 if (local_text != NULL)
2276 zval_ptr_dtor (&local_text);
2278 local_text = params[0];
2279 // param 1
2280 if (num_args <= 1)
2282 zval* default_value;
2284 zval* local_TSa203 = NULL;
2285 zval* local___static_value__ = NULL;
2286 // unset($TSa203);
2288 if (local_TSa203 != NULL)
2290 zval_ptr_dtor (&local_TSa203);
2291 local_TSa203 = NULL;
2293 phc_check_invariants (TSRMLS_C);
2295 // $TSa203 = (array) $TSa203;
2297 if (local_TSa203 == NULL)
2299 local_TSa203 = EG (uninitialized_zval_ptr);
2300 local_TSa203->refcount++;
2302 zval** p_lhs = &local_TSa203;
2304 zval* rhs;
2305 if (local_TSa203 == NULL)
2306 rhs = EG (uninitialized_zval_ptr);
2307 else
2308 rhs = local_TSa203;
2310 if (*p_lhs != rhs)
2312 if ((*p_lhs)->is_ref)
2313 overwrite_lhs (*p_lhs, rhs);
2314 else
2316 zval_ptr_dtor (p_lhs);
2317 if (rhs->is_ref)
2319 // Take a copy of RHS for LHS
2320 *p_lhs = zvp_clone_ex (rhs);
2322 else
2324 // Share a copy
2325 rhs->refcount++;
2326 *p_lhs = rhs;
2333 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
2334 if ((*p_lhs)->type != IS_ARRAY)
2336 sep_copy_on_write (p_lhs);
2337 convert_to_array (*p_lhs);
2340 phc_check_invariants (TSRMLS_C);
2342 // $__static_value__ = $TSa203;
2344 if (local___static_value__ == NULL)
2346 local___static_value__ = EG (uninitialized_zval_ptr);
2347 local___static_value__->refcount++;
2349 zval** p_lhs = &local___static_value__;
2351 zval* rhs;
2352 if (local_TSa203 == NULL)
2353 rhs = EG (uninitialized_zval_ptr);
2354 else
2355 rhs = local_TSa203;
2357 if (*p_lhs != rhs)
2359 if ((*p_lhs)->is_ref)
2360 overwrite_lhs (*p_lhs, rhs);
2361 else
2363 zval_ptr_dtor (p_lhs);
2364 if (rhs->is_ref)
2366 // Take a copy of RHS for LHS
2367 *p_lhs = zvp_clone_ex (rhs);
2369 else
2371 // Share a copy
2372 rhs->refcount++;
2373 *p_lhs = rhs;
2379 phc_check_invariants (TSRMLS_C);
2381 default_value = local___static_value__;
2382 assert(!default_value->is_ref);
2383 default_value->refcount++;
2384 if (local_TSa203 != NULL)
2386 zval_ptr_dtor (&local_TSa203);
2388 if (local___static_value__ != NULL)
2390 zval_ptr_dtor (&local___static_value__);
2393 default_value->refcount--;
2394 params[1] = default_value;
2396 params[1]->refcount++;
2397 if (local_languageLinks != NULL)
2399 zval_ptr_dtor (&local_languageLinks);
2401 local_languageLinks = params[1];
2402 // param 2
2403 if (num_args <= 2)
2405 zval* default_value;
2407 zval* local_TSa204 = NULL;
2408 zval* local___static_value__ = NULL;
2409 // unset($TSa204);
2411 if (local_TSa204 != NULL)
2413 zval_ptr_dtor (&local_TSa204);
2414 local_TSa204 = NULL;
2416 phc_check_invariants (TSRMLS_C);
2418 // $TSa204 = (array) $TSa204;
2420 if (local_TSa204 == NULL)
2422 local_TSa204 = EG (uninitialized_zval_ptr);
2423 local_TSa204->refcount++;
2425 zval** p_lhs = &local_TSa204;
2427 zval* rhs;
2428 if (local_TSa204 == NULL)
2429 rhs = EG (uninitialized_zval_ptr);
2430 else
2431 rhs = local_TSa204;
2433 if (*p_lhs != rhs)
2435 if ((*p_lhs)->is_ref)
2436 overwrite_lhs (*p_lhs, rhs);
2437 else
2439 zval_ptr_dtor (p_lhs);
2440 if (rhs->is_ref)
2442 // Take a copy of RHS for LHS
2443 *p_lhs = zvp_clone_ex (rhs);
2445 else
2447 // Share a copy
2448 rhs->refcount++;
2449 *p_lhs = rhs;
2456 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
2457 if ((*p_lhs)->type != IS_ARRAY)
2459 sep_copy_on_write (p_lhs);
2460 convert_to_array (*p_lhs);
2463 phc_check_invariants (TSRMLS_C);
2465 // $__static_value__ = $TSa204;
2467 if (local___static_value__ == NULL)
2469 local___static_value__ = EG (uninitialized_zval_ptr);
2470 local___static_value__->refcount++;
2472 zval** p_lhs = &local___static_value__;
2474 zval* rhs;
2475 if (local_TSa204 == NULL)
2476 rhs = EG (uninitialized_zval_ptr);
2477 else
2478 rhs = local_TSa204;
2480 if (*p_lhs != rhs)
2482 if ((*p_lhs)->is_ref)
2483 overwrite_lhs (*p_lhs, rhs);
2484 else
2486 zval_ptr_dtor (p_lhs);
2487 if (rhs->is_ref)
2489 // Take a copy of RHS for LHS
2490 *p_lhs = zvp_clone_ex (rhs);
2492 else
2494 // Share a copy
2495 rhs->refcount++;
2496 *p_lhs = rhs;
2502 phc_check_invariants (TSRMLS_C);
2504 default_value = local___static_value__;
2505 assert(!default_value->is_ref);
2506 default_value->refcount++;
2507 if (local_TSa204 != NULL)
2509 zval_ptr_dtor (&local_TSa204);
2511 if (local___static_value__ != NULL)
2513 zval_ptr_dtor (&local___static_value__);
2516 default_value->refcount--;
2517 params[2] = default_value;
2519 params[2]->refcount++;
2520 if (local_categoryLinks != NULL)
2522 zval_ptr_dtor (&local_categoryLinks);
2524 local_categoryLinks = params[2];
2525 // param 3
2526 if (num_args <= 3)
2528 zval* default_value;
2530 zval* local___static_value__ = NULL;
2531 // $__static_value__ = False;
2533 if (local___static_value__ == NULL)
2535 local___static_value__ = EG (uninitialized_zval_ptr);
2536 local___static_value__->refcount++;
2538 zval** p_lhs = &local___static_value__;
2540 zval* value;
2541 if ((*p_lhs)->is_ref)
2543 // Always overwrite the current value
2544 value = *p_lhs;
2545 zval_dtor (value);
2547 else
2549 ALLOC_INIT_ZVAL (value);
2550 zval_ptr_dtor (p_lhs);
2551 *p_lhs = value;
2554 ZVAL_BOOL (value, 0);
2556 phc_check_invariants (TSRMLS_C);
2558 default_value = local___static_value__;
2559 assert(!default_value->is_ref);
2560 default_value->refcount++;
2561 if (local___static_value__ != NULL)
2563 zval_ptr_dtor (&local___static_value__);
2566 default_value->refcount--;
2567 params[3] = default_value;
2569 params[3]->refcount++;
2570 if (local_containsOldMagic != NULL)
2572 zval_ptr_dtor (&local_containsOldMagic);
2574 local_containsOldMagic = params[3];
2575 // param 4
2576 if (num_args <= 4)
2578 zval* default_value;
2580 zval* local___static_value__ = NULL;
2581 // $__static_value__ = '';
2583 if (local___static_value__ == NULL)
2585 local___static_value__ = EG (uninitialized_zval_ptr);
2586 local___static_value__->refcount++;
2588 zval** p_lhs = &local___static_value__;
2590 zval* value;
2591 if ((*p_lhs)->is_ref)
2593 // Always overwrite the current value
2594 value = *p_lhs;
2595 zval_dtor (value);
2597 else
2599 ALLOC_INIT_ZVAL (value);
2600 zval_ptr_dtor (p_lhs);
2601 *p_lhs = value;
2604 ZVAL_STRINGL(value, "", 0, 1);
2606 phc_check_invariants (TSRMLS_C);
2608 default_value = local___static_value__;
2609 assert(!default_value->is_ref);
2610 default_value->refcount++;
2611 if (local___static_value__ != NULL)
2613 zval_ptr_dtor (&local___static_value__);
2616 default_value->refcount--;
2617 params[4] = default_value;
2619 params[4]->refcount++;
2620 if (local_titletext != NULL)
2622 zval_ptr_dtor (&local_titletext);
2624 local_titletext = params[4];
2626 // Function body
2627 // $this->mText = $text;
2629 if (local_this == NULL)
2631 local_this = EG (uninitialized_zval_ptr);
2632 local_this->refcount++;
2634 zval** p_obj = &local_this;
2636 zval* rhs;
2637 if (local_text == NULL)
2638 rhs = EG (uninitialized_zval_ptr);
2639 else
2640 rhs = local_text;
2642 zval field_name;
2643 INIT_ZVAL (field_name);
2644 ZVAL_STRING (&field_name, "mText", 0);
2646 Z_OBJ_HT_PP(p_obj)->write_property(*p_obj, &field_name, rhs TSRMLS_CC);
2647 phc_check_invariants (TSRMLS_C);
2649 // $this->mLanguageLinks = $languageLinks;
2651 if (local_this == NULL)
2653 local_this = EG (uninitialized_zval_ptr);
2654 local_this->refcount++;
2656 zval** p_obj = &local_this;
2658 zval* rhs;
2659 if (local_languageLinks == NULL)
2660 rhs = EG (uninitialized_zval_ptr);
2661 else
2662 rhs = local_languageLinks;
2664 zval field_name;
2665 INIT_ZVAL (field_name);
2666 ZVAL_STRING (&field_name, "mLanguageLinks", 0);
2668 Z_OBJ_HT_PP(p_obj)->write_property(*p_obj, &field_name, rhs TSRMLS_CC);
2669 phc_check_invariants (TSRMLS_C);
2671 // $this->mCategories = $categoryLinks;
2673 if (local_this == NULL)
2675 local_this = EG (uninitialized_zval_ptr);
2676 local_this->refcount++;
2678 zval** p_obj = &local_this;
2680 zval* rhs;
2681 if (local_categoryLinks == NULL)
2682 rhs = EG (uninitialized_zval_ptr);
2683 else
2684 rhs = local_categoryLinks;
2686 zval field_name;
2687 INIT_ZVAL (field_name);
2688 ZVAL_STRING (&field_name, "mCategories", 0);
2690 Z_OBJ_HT_PP(p_obj)->write_property(*p_obj, &field_name, rhs TSRMLS_CC);
2691 phc_check_invariants (TSRMLS_C);
2693 // $this->mContainsOldMagic = $containsOldMagic;
2695 if (local_this == NULL)
2697 local_this = EG (uninitialized_zval_ptr);
2698 local_this->refcount++;
2700 zval** p_obj = &local_this;
2702 zval* rhs;
2703 if (local_containsOldMagic == NULL)
2704 rhs = EG (uninitialized_zval_ptr);
2705 else
2706 rhs = local_containsOldMagic;
2708 zval field_name;
2709 INIT_ZVAL (field_name);
2710 ZVAL_STRING (&field_name, "mContainsOldMagic", 0);
2712 Z_OBJ_HT_PP(p_obj)->write_property(*p_obj, &field_name, rhs TSRMLS_CC);
2713 phc_check_invariants (TSRMLS_C);
2715 // $this->mTitleText = $titletext;
2717 if (local_this == NULL)
2719 local_this = EG (uninitialized_zval_ptr);
2720 local_this->refcount++;
2722 zval** p_obj = &local_this;
2724 zval* rhs;
2725 if (local_titletext == NULL)
2726 rhs = EG (uninitialized_zval_ptr);
2727 else
2728 rhs = local_titletext;
2730 zval field_name;
2731 INIT_ZVAL (field_name);
2732 ZVAL_STRING (&field_name, "mTitleText", 0);
2734 Z_OBJ_HT_PP(p_obj)->write_property(*p_obj, &field_name, rhs TSRMLS_CC);
2735 phc_check_invariants (TSRMLS_C);
2737 // Method exit
2738 end_of_function:__attribute__((unused));
2739 if (local_categoryLinks != NULL)
2741 zval_ptr_dtor (&local_categoryLinks);
2743 if (local_containsOldMagic != NULL)
2745 zval_ptr_dtor (&local_containsOldMagic);
2747 if (local_languageLinks != NULL)
2749 zval_ptr_dtor (&local_languageLinks);
2751 if (local_text != NULL)
2753 zval_ptr_dtor (&local_text);
2755 if (local_titletext != NULL)
2757 zval_ptr_dtor (&local_titletext);
2760 // function gettext()
2761 // {
2762 // $TSt9 = $this->mText;
2763 // return $TSt9;
2764 // }
2765 PHP_METHOD(ParserOutput, gettext)
2767 zval* local_TSt9 = NULL;
2768 zval* local_this = getThis();
2769 // Function body
2770 // $TSt9 = $this->mText;
2772 if (local_this == NULL)
2774 local_this = EG (uninitialized_zval_ptr);
2775 local_this->refcount++;
2777 zval** p_obj = &local_this;
2779 zval field_name;
2780 INIT_ZVAL (field_name);
2781 ZVAL_STRING (&field_name, "mText", 0);
2783 // I *think* this is correct, but documentation of the Zend API is scarce :)
2784 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
2785 if (local_TSt9 == NULL)
2787 local_TSt9 = EG (uninitialized_zval_ptr);
2788 local_TSt9->refcount++;
2790 zval** p_lhs = &local_TSt9;
2792 write_var (p_lhs, field);
2793 phc_check_invariants (TSRMLS_C);
2795 // return $TSt9;
2797 zval* rhs;
2798 if (local_TSt9 == NULL)
2799 rhs = EG (uninitialized_zval_ptr);
2800 else
2801 rhs = local_TSt9;
2803 // Run-time return by reference has different semantics to compile-time.
2804 // If the function has CTRBR and RTRBR, the the assignment will be
2805 // reference. If one or the other is return-by-copy, the result will be
2806 // by copy. Its a question of whether its separated at return-time (which
2807 // we do here) or at the call-site.
2808 return_value->value = rhs->value;
2809 return_value->type = rhs->type;
2810 zval_copy_ctor (return_value);
2811 goto end_of_function;
2812 phc_check_invariants (TSRMLS_C);
2814 // Method exit
2815 end_of_function:__attribute__((unused));
2816 if (local_TSt9 != NULL)
2818 zval_ptr_dtor (&local_TSt9);
2821 // function &getlanguagelinks()
2822 // {
2823 // $TSt10 =& $this->mLanguageLinks;
2824 // return $TSt10;
2825 // }
2826 PHP_METHOD(ParserOutput, getlanguagelinks)
2828 zval* local_TSt10 = NULL;
2829 zval* local_this = getThis();
2830 // Function body
2831 // $TSt10 =& $this->mLanguageLinks;
2833 if (local_this == NULL)
2835 local_this = EG (uninitialized_zval_ptr);
2836 local_this->refcount++;
2838 zval** p_obj = &local_this;
2840 zval field_name;
2841 INIT_ZVAL (field_name);
2842 ZVAL_STRING (&field_name, "mLanguageLinks", 0);
2844 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
2845 sep_copy_on_write (field);
2846 if (local_TSt10 == NULL)
2848 local_TSt10 = EG (uninitialized_zval_ptr);
2849 local_TSt10->refcount++;
2851 zval** p_lhs = &local_TSt10;
2853 copy_into_ref (p_lhs, field);
2854 phc_check_invariants (TSRMLS_C);
2856 // return $TSt10;
2858 if (local_TSt10 == NULL)
2860 local_TSt10 = EG (uninitialized_zval_ptr);
2861 local_TSt10->refcount++;
2863 zval** p_rhs = &local_TSt10;
2865 sep_copy_on_write (p_rhs);
2866 zval_ptr_dtor (return_value_ptr);
2867 (*p_rhs)->is_ref = 1;
2868 (*p_rhs)->refcount++;
2869 *return_value_ptr = *p_rhs;
2870 goto end_of_function;
2871 phc_check_invariants (TSRMLS_C);
2873 // Method exit
2874 end_of_function:__attribute__((unused));
2875 if (local_TSt10 != NULL)
2877 zval_ptr_dtor (&local_TSt10);
2879 if (*return_value_ptr)
2880 saved_refcount = (*return_value_ptr)->refcount;
2882 // function getcategorylinks()
2883 // {
2884 // $TLE100 = param_is_ref (NULL, "array_keys", 0);
2885 // ;
2886 // if (TLE100) goto L128 else goto L129;
2887 // L128:
2888 // $TMIt99 =& $this->mCategories;
2889 // goto L130;
2890 // L129:
2891 // $TMIt99 = $this->mCategories;
2892 // goto L130;
2893 // L130:
2894 // $TLE11 = array_keys($TMIt99);
2895 // return $TLE11;
2896 // }
2897 PHP_METHOD(ParserOutput, getcategorylinks)
2899 zval* local_TLE100 = NULL;
2900 zval* local_TLE11 = NULL;
2901 zval* local_TMIt99 = NULL;
2902 zval* local_this = getThis();
2903 // Function body
2904 // $TLE100 = param_is_ref (NULL, "array_keys", 0);
2905 // ;
2907 initialize_function_call (&array_keys_fci, &array_keys_fcic, "array_keys", "<unknown>", 0 TSRMLS_CC);
2908 zend_function* signature = array_keys_fcic.function_handler;
2909 zend_arg_info* arg_info = signature->common.arg_info;
2910 int count = 0;
2911 while (arg_info && count < 0)
2913 count++;
2914 arg_info++;
2917 if (local_TLE100 == NULL)
2919 local_TLE100 = EG (uninitialized_zval_ptr);
2920 local_TLE100->refcount++;
2922 zval** p_lhs = &local_TLE100;
2924 zval* rhs;
2925 ALLOC_INIT_ZVAL (rhs);
2926 if (arg_info && count == 0)
2928 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
2930 else
2932 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
2934 write_var (p_lhs, rhs);
2935 zval_ptr_dtor (&rhs);
2936 phc_check_invariants (TSRMLS_C);
2938 // if (TLE100) goto L128 else goto L129;
2940 zval* p_cond;
2941 if (local_TLE100 == NULL)
2942 p_cond = EG (uninitialized_zval_ptr);
2943 else
2944 p_cond = local_TLE100;
2946 zend_bool bcond = zend_is_true (p_cond);
2947 if (bcond)
2948 goto L128;
2949 else
2950 goto L129;
2951 phc_check_invariants (TSRMLS_C);
2953 // L128:
2954 L128:;
2955 // $TMIt99 =& $this->mCategories;
2957 if (local_this == NULL)
2959 local_this = EG (uninitialized_zval_ptr);
2960 local_this->refcount++;
2962 zval** p_obj = &local_this;
2964 zval field_name;
2965 INIT_ZVAL (field_name);
2966 ZVAL_STRING (&field_name, "mCategories", 0);
2968 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
2969 sep_copy_on_write (field);
2970 if (local_TMIt99 == NULL)
2972 local_TMIt99 = EG (uninitialized_zval_ptr);
2973 local_TMIt99->refcount++;
2975 zval** p_lhs = &local_TMIt99;
2977 copy_into_ref (p_lhs, field);
2978 phc_check_invariants (TSRMLS_C);
2980 // goto L130;
2982 goto L130;
2983 phc_check_invariants (TSRMLS_C);
2985 // L129:
2986 L129:;
2987 // $TMIt99 = $this->mCategories;
2989 if (local_this == NULL)
2991 local_this = EG (uninitialized_zval_ptr);
2992 local_this->refcount++;
2994 zval** p_obj = &local_this;
2996 zval field_name;
2997 INIT_ZVAL (field_name);
2998 ZVAL_STRING (&field_name, "mCategories", 0);
3000 // I *think* this is correct, but documentation of the Zend API is scarce :)
3001 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
3002 if (local_TMIt99 == NULL)
3004 local_TMIt99 = EG (uninitialized_zval_ptr);
3005 local_TMIt99->refcount++;
3007 zval** p_lhs = &local_TMIt99;
3009 write_var (p_lhs, field);
3010 phc_check_invariants (TSRMLS_C);
3012 // goto L130;
3014 goto L130;
3015 phc_check_invariants (TSRMLS_C);
3017 // L130:
3018 L130:;
3019 // $TLE11 = array_keys($TMIt99);
3021 initialize_function_call (&array_keys_fci, &array_keys_fcic, "array_keys", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 46 TSRMLS_CC);
3022 zend_function* signature = array_keys_fcic.function_handler;
3023 zend_arg_info* arg_info = signature->common.arg_info; // optional
3025 int by_ref[1];
3026 int abr_index = 0;
3027 // TODO: find names to replace index
3028 if (arg_info)
3030 by_ref[abr_index] = arg_info->pass_by_reference;
3031 arg_info++;
3033 else
3034 by_ref[abr_index] = signature->common.pass_rest_by_reference;
3036 abr_index++;
3039 // Setup array of arguments
3040 // TODO: i think arrays of size 0 is an error
3041 int destruct [1];
3042 zval* args [1];
3043 zval** args_ind [1];
3045 int af_index = 0;
3046 destruct[af_index] = 0;
3047 if (by_ref[af_index])
3049 if (local_TMIt99 == NULL)
3051 local_TMIt99 = EG (uninitialized_zval_ptr);
3052 local_TMIt99->refcount++;
3054 zval** p_arg = &local_TMIt99;
3056 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
3057 assert (!in_copy_on_write (*args_ind[af_index]));
3058 args[af_index] = *args_ind[af_index];
3060 else
3062 zval* arg;
3063 if (local_TMIt99 == NULL)
3064 arg = EG (uninitialized_zval_ptr);
3065 else
3066 arg = local_TMIt99;
3068 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
3069 args_ind[af_index] = &args[af_index];
3071 af_index++;
3074 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 46, NULL TSRMLS_CC);
3076 // save existing parameters, in case of recursion
3077 int param_count_save = array_keys_fci.param_count;
3078 zval*** params_save = array_keys_fci.params;
3079 zval** retval_save = array_keys_fci.retval_ptr_ptr;
3081 zval* rhs = NULL;
3083 // set up params
3084 array_keys_fci.params = args_ind;
3085 array_keys_fci.param_count = 1;
3086 array_keys_fci.retval_ptr_ptr = &rhs;
3088 // call the function
3089 int success = zend_call_function (&array_keys_fci, &array_keys_fcic TSRMLS_CC);
3090 assert(success == SUCCESS);
3092 // restore params
3093 array_keys_fci.params = params_save;
3094 array_keys_fci.param_count = param_count_save;
3095 array_keys_fci.retval_ptr_ptr = retval_save;
3097 // unset the errors
3098 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
3100 int i;
3101 for (i = 0; i < 1; i++)
3103 if (destruct[i])
3105 assert (destruct[i]);
3106 zval_ptr_dtor (args_ind[i]);
3111 // When the Zend engine returns by reference, it allocates a zval into
3112 // retval_ptr_ptr. To return by reference, the callee writes into the
3113 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
3114 // not actually return anything). So the zval returned - whether we return
3115 // it, or it is the allocated zval - has a refcount of 1.
3117 // The caller is responsible for cleaning that up (note, this is unaffected
3118 // by whether it is added to some COW set).
3120 // For reasons unknown, the Zend API resets the refcount and is_ref fields
3121 // of the return value after the function returns (unless the callee is
3122 // interpreted). If the function is supposed to return by reference, this
3123 // loses the refcount. This only happens when non-interpreted code is
3124 // called. We work around it, when compiled code is called, by saving the
3125 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
3126 // that we may create an error if our code is called by a callback, and
3127 // returns by reference, and the callback returns by reference. At least
3128 // this is an obscure case.
3129 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
3131 assert (rhs != EG(uninitialized_zval_ptr));
3132 rhs->is_ref = 1;
3133 if (saved_refcount != 0)
3135 rhs->refcount = saved_refcount;
3137 rhs->refcount++;
3139 saved_refcount = 0; // for 'obscure cases'
3141 if (local_TLE11 == NULL)
3143 local_TLE11 = EG (uninitialized_zval_ptr);
3144 local_TLE11->refcount++;
3146 zval** p_lhs = &local_TLE11;
3148 write_var (p_lhs, rhs);
3151 zval_ptr_dtor (&rhs);
3152 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
3153 zval_ptr_dtor (&rhs);
3155 phc_check_invariants (TSRMLS_C);
3157 // return $TLE11;
3159 zval* rhs;
3160 if (local_TLE11 == NULL)
3161 rhs = EG (uninitialized_zval_ptr);
3162 else
3163 rhs = local_TLE11;
3165 // Run-time return by reference has different semantics to compile-time.
3166 // If the function has CTRBR and RTRBR, the the assignment will be
3167 // reference. If one or the other is return-by-copy, the result will be
3168 // by copy. Its a question of whether its separated at return-time (which
3169 // we do here) or at the call-site.
3170 return_value->value = rhs->value;
3171 return_value->type = rhs->type;
3172 zval_copy_ctor (return_value);
3173 goto end_of_function;
3174 phc_check_invariants (TSRMLS_C);
3176 // Method exit
3177 end_of_function:__attribute__((unused));
3178 if (local_TLE100 != NULL)
3180 zval_ptr_dtor (&local_TLE100);
3182 if (local_TLE11 != NULL)
3184 zval_ptr_dtor (&local_TLE11);
3186 if (local_TMIt99 != NULL)
3188 zval_ptr_dtor (&local_TMIt99);
3191 // function &getcategories()
3192 // {
3193 // $TSt12 =& $this->mCategories;
3194 // return $TSt12;
3195 // }
3196 PHP_METHOD(ParserOutput, getcategories)
3198 zval* local_TSt12 = NULL;
3199 zval* local_this = getThis();
3200 // Function body
3201 // $TSt12 =& $this->mCategories;
3203 if (local_this == NULL)
3205 local_this = EG (uninitialized_zval_ptr);
3206 local_this->refcount++;
3208 zval** p_obj = &local_this;
3210 zval field_name;
3211 INIT_ZVAL (field_name);
3212 ZVAL_STRING (&field_name, "mCategories", 0);
3214 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
3215 sep_copy_on_write (field);
3216 if (local_TSt12 == NULL)
3218 local_TSt12 = EG (uninitialized_zval_ptr);
3219 local_TSt12->refcount++;
3221 zval** p_lhs = &local_TSt12;
3223 copy_into_ref (p_lhs, field);
3224 phc_check_invariants (TSRMLS_C);
3226 // return $TSt12;
3228 if (local_TSt12 == NULL)
3230 local_TSt12 = EG (uninitialized_zval_ptr);
3231 local_TSt12->refcount++;
3233 zval** p_rhs = &local_TSt12;
3235 sep_copy_on_write (p_rhs);
3236 zval_ptr_dtor (return_value_ptr);
3237 (*p_rhs)->is_ref = 1;
3238 (*p_rhs)->refcount++;
3239 *return_value_ptr = *p_rhs;
3240 goto end_of_function;
3241 phc_check_invariants (TSRMLS_C);
3243 // Method exit
3244 end_of_function:__attribute__((unused));
3245 if (local_TSt12 != NULL)
3247 zval_ptr_dtor (&local_TSt12);
3249 if (*return_value_ptr)
3250 saved_refcount = (*return_value_ptr)->refcount;
3252 // function getcachetime()
3253 // {
3254 // $TSt13 = $this->mCacheTime;
3255 // return $TSt13;
3256 // }
3257 PHP_METHOD(ParserOutput, getcachetime)
3259 zval* local_TSt13 = NULL;
3260 zval* local_this = getThis();
3261 // Function body
3262 // $TSt13 = $this->mCacheTime;
3264 if (local_this == NULL)
3266 local_this = EG (uninitialized_zval_ptr);
3267 local_this->refcount++;
3269 zval** p_obj = &local_this;
3271 zval field_name;
3272 INIT_ZVAL (field_name);
3273 ZVAL_STRING (&field_name, "mCacheTime", 0);
3275 // I *think* this is correct, but documentation of the Zend API is scarce :)
3276 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
3277 if (local_TSt13 == NULL)
3279 local_TSt13 = EG (uninitialized_zval_ptr);
3280 local_TSt13->refcount++;
3282 zval** p_lhs = &local_TSt13;
3284 write_var (p_lhs, field);
3285 phc_check_invariants (TSRMLS_C);
3287 // return $TSt13;
3289 zval* rhs;
3290 if (local_TSt13 == NULL)
3291 rhs = EG (uninitialized_zval_ptr);
3292 else
3293 rhs = local_TSt13;
3295 // Run-time return by reference has different semantics to compile-time.
3296 // If the function has CTRBR and RTRBR, the the assignment will be
3297 // reference. If one or the other is return-by-copy, the result will be
3298 // by copy. Its a question of whether its separated at return-time (which
3299 // we do here) or at the call-site.
3300 return_value->value = rhs->value;
3301 return_value->type = rhs->type;
3302 zval_copy_ctor (return_value);
3303 goto end_of_function;
3304 phc_check_invariants (TSRMLS_C);
3306 // Method exit
3307 end_of_function:__attribute__((unused));
3308 if (local_TSt13 != NULL)
3310 zval_ptr_dtor (&local_TSt13);
3313 // function gettitletext()
3314 // {
3315 // $TSt14 = $this->mTitleText;
3316 // return $TSt14;
3317 // }
3318 PHP_METHOD(ParserOutput, gettitletext)
3320 zval* local_TSt14 = NULL;
3321 zval* local_this = getThis();
3322 // Function body
3323 // $TSt14 = $this->mTitleText;
3325 if (local_this == NULL)
3327 local_this = EG (uninitialized_zval_ptr);
3328 local_this->refcount++;
3330 zval** p_obj = &local_this;
3332 zval field_name;
3333 INIT_ZVAL (field_name);
3334 ZVAL_STRING (&field_name, "mTitleText", 0);
3336 // I *think* this is correct, but documentation of the Zend API is scarce :)
3337 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
3338 if (local_TSt14 == NULL)
3340 local_TSt14 = EG (uninitialized_zval_ptr);
3341 local_TSt14->refcount++;
3343 zval** p_lhs = &local_TSt14;
3345 write_var (p_lhs, field);
3346 phc_check_invariants (TSRMLS_C);
3348 // return $TSt14;
3350 zval* rhs;
3351 if (local_TSt14 == NULL)
3352 rhs = EG (uninitialized_zval_ptr);
3353 else
3354 rhs = local_TSt14;
3356 // Run-time return by reference has different semantics to compile-time.
3357 // If the function has CTRBR and RTRBR, the the assignment will be
3358 // reference. If one or the other is return-by-copy, the result will be
3359 // by copy. Its a question of whether its separated at return-time (which
3360 // we do here) or at the call-site.
3361 return_value->value = rhs->value;
3362 return_value->type = rhs->type;
3363 zval_copy_ctor (return_value);
3364 goto end_of_function;
3365 phc_check_invariants (TSRMLS_C);
3367 // Method exit
3368 end_of_function:__attribute__((unused));
3369 if (local_TSt14 != NULL)
3371 zval_ptr_dtor (&local_TSt14);
3374 // function getsections()
3375 // {
3376 // $TSt15 = $this->mSections;
3377 // return $TSt15;
3378 // }
3379 PHP_METHOD(ParserOutput, getsections)
3381 zval* local_TSt15 = NULL;
3382 zval* local_this = getThis();
3383 // Function body
3384 // $TSt15 = $this->mSections;
3386 if (local_this == NULL)
3388 local_this = EG (uninitialized_zval_ptr);
3389 local_this->refcount++;
3391 zval** p_obj = &local_this;
3393 zval field_name;
3394 INIT_ZVAL (field_name);
3395 ZVAL_STRING (&field_name, "mSections", 0);
3397 // I *think* this is correct, but documentation of the Zend API is scarce :)
3398 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
3399 if (local_TSt15 == NULL)
3401 local_TSt15 = EG (uninitialized_zval_ptr);
3402 local_TSt15->refcount++;
3404 zval** p_lhs = &local_TSt15;
3406 write_var (p_lhs, field);
3407 phc_check_invariants (TSRMLS_C);
3409 // return $TSt15;
3411 zval* rhs;
3412 if (local_TSt15 == NULL)
3413 rhs = EG (uninitialized_zval_ptr);
3414 else
3415 rhs = local_TSt15;
3417 // Run-time return by reference has different semantics to compile-time.
3418 // If the function has CTRBR and RTRBR, the the assignment will be
3419 // reference. If one or the other is return-by-copy, the result will be
3420 // by copy. Its a question of whether its separated at return-time (which
3421 // we do here) or at the call-site.
3422 return_value->value = rhs->value;
3423 return_value->type = rhs->type;
3424 zval_copy_ctor (return_value);
3425 goto end_of_function;
3426 phc_check_invariants (TSRMLS_C);
3428 // Method exit
3429 end_of_function:__attribute__((unused));
3430 if (local_TSt15 != NULL)
3432 zval_ptr_dtor (&local_TSt15);
3435 // function &getlinks()
3436 // {
3437 // $TSt16 =& $this->mLinks;
3438 // return $TSt16;
3439 // }
3440 PHP_METHOD(ParserOutput, getlinks)
3442 zval* local_TSt16 = NULL;
3443 zval* local_this = getThis();
3444 // Function body
3445 // $TSt16 =& $this->mLinks;
3447 if (local_this == NULL)
3449 local_this = EG (uninitialized_zval_ptr);
3450 local_this->refcount++;
3452 zval** p_obj = &local_this;
3454 zval field_name;
3455 INIT_ZVAL (field_name);
3456 ZVAL_STRING (&field_name, "mLinks", 0);
3458 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
3459 sep_copy_on_write (field);
3460 if (local_TSt16 == NULL)
3462 local_TSt16 = EG (uninitialized_zval_ptr);
3463 local_TSt16->refcount++;
3465 zval** p_lhs = &local_TSt16;
3467 copy_into_ref (p_lhs, field);
3468 phc_check_invariants (TSRMLS_C);
3470 // return $TSt16;
3472 if (local_TSt16 == NULL)
3474 local_TSt16 = EG (uninitialized_zval_ptr);
3475 local_TSt16->refcount++;
3477 zval** p_rhs = &local_TSt16;
3479 sep_copy_on_write (p_rhs);
3480 zval_ptr_dtor (return_value_ptr);
3481 (*p_rhs)->is_ref = 1;
3482 (*p_rhs)->refcount++;
3483 *return_value_ptr = *p_rhs;
3484 goto end_of_function;
3485 phc_check_invariants (TSRMLS_C);
3487 // Method exit
3488 end_of_function:__attribute__((unused));
3489 if (local_TSt16 != NULL)
3491 zval_ptr_dtor (&local_TSt16);
3493 if (*return_value_ptr)
3494 saved_refcount = (*return_value_ptr)->refcount;
3496 // function &gettemplates()
3497 // {
3498 // $TSt17 =& $this->mTemplates;
3499 // return $TSt17;
3500 // }
3501 PHP_METHOD(ParserOutput, gettemplates)
3503 zval* local_TSt17 = NULL;
3504 zval* local_this = getThis();
3505 // Function body
3506 // $TSt17 =& $this->mTemplates;
3508 if (local_this == NULL)
3510 local_this = EG (uninitialized_zval_ptr);
3511 local_this->refcount++;
3513 zval** p_obj = &local_this;
3515 zval field_name;
3516 INIT_ZVAL (field_name);
3517 ZVAL_STRING (&field_name, "mTemplates", 0);
3519 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
3520 sep_copy_on_write (field);
3521 if (local_TSt17 == NULL)
3523 local_TSt17 = EG (uninitialized_zval_ptr);
3524 local_TSt17->refcount++;
3526 zval** p_lhs = &local_TSt17;
3528 copy_into_ref (p_lhs, field);
3529 phc_check_invariants (TSRMLS_C);
3531 // return $TSt17;
3533 if (local_TSt17 == NULL)
3535 local_TSt17 = EG (uninitialized_zval_ptr);
3536 local_TSt17->refcount++;
3538 zval** p_rhs = &local_TSt17;
3540 sep_copy_on_write (p_rhs);
3541 zval_ptr_dtor (return_value_ptr);
3542 (*p_rhs)->is_ref = 1;
3543 (*p_rhs)->refcount++;
3544 *return_value_ptr = *p_rhs;
3545 goto end_of_function;
3546 phc_check_invariants (TSRMLS_C);
3548 // Method exit
3549 end_of_function:__attribute__((unused));
3550 if (local_TSt17 != NULL)
3552 zval_ptr_dtor (&local_TSt17);
3554 if (*return_value_ptr)
3555 saved_refcount = (*return_value_ptr)->refcount;
3557 // function &getimages()
3558 // {
3559 // $TSt18 =& $this->mImages;
3560 // return $TSt18;
3561 // }
3562 PHP_METHOD(ParserOutput, getimages)
3564 zval* local_TSt18 = NULL;
3565 zval* local_this = getThis();
3566 // Function body
3567 // $TSt18 =& $this->mImages;
3569 if (local_this == NULL)
3571 local_this = EG (uninitialized_zval_ptr);
3572 local_this->refcount++;
3574 zval** p_obj = &local_this;
3576 zval field_name;
3577 INIT_ZVAL (field_name);
3578 ZVAL_STRING (&field_name, "mImages", 0);
3580 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
3581 sep_copy_on_write (field);
3582 if (local_TSt18 == NULL)
3584 local_TSt18 = EG (uninitialized_zval_ptr);
3585 local_TSt18->refcount++;
3587 zval** p_lhs = &local_TSt18;
3589 copy_into_ref (p_lhs, field);
3590 phc_check_invariants (TSRMLS_C);
3592 // return $TSt18;
3594 if (local_TSt18 == NULL)
3596 local_TSt18 = EG (uninitialized_zval_ptr);
3597 local_TSt18->refcount++;
3599 zval** p_rhs = &local_TSt18;
3601 sep_copy_on_write (p_rhs);
3602 zval_ptr_dtor (return_value_ptr);
3603 (*p_rhs)->is_ref = 1;
3604 (*p_rhs)->refcount++;
3605 *return_value_ptr = *p_rhs;
3606 goto end_of_function;
3607 phc_check_invariants (TSRMLS_C);
3609 // Method exit
3610 end_of_function:__attribute__((unused));
3611 if (local_TSt18 != NULL)
3613 zval_ptr_dtor (&local_TSt18);
3615 if (*return_value_ptr)
3616 saved_refcount = (*return_value_ptr)->refcount;
3618 // function &getexternallinks()
3619 // {
3620 // $TSt19 =& $this->mExternalLinks;
3621 // return $TSt19;
3622 // }
3623 PHP_METHOD(ParserOutput, getexternallinks)
3625 zval* local_TSt19 = NULL;
3626 zval* local_this = getThis();
3627 // Function body
3628 // $TSt19 =& $this->mExternalLinks;
3630 if (local_this == NULL)
3632 local_this = EG (uninitialized_zval_ptr);
3633 local_this->refcount++;
3635 zval** p_obj = &local_this;
3637 zval field_name;
3638 INIT_ZVAL (field_name);
3639 ZVAL_STRING (&field_name, "mExternalLinks", 0);
3641 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
3642 sep_copy_on_write (field);
3643 if (local_TSt19 == NULL)
3645 local_TSt19 = EG (uninitialized_zval_ptr);
3646 local_TSt19->refcount++;
3648 zval** p_lhs = &local_TSt19;
3650 copy_into_ref (p_lhs, field);
3651 phc_check_invariants (TSRMLS_C);
3653 // return $TSt19;
3655 if (local_TSt19 == NULL)
3657 local_TSt19 = EG (uninitialized_zval_ptr);
3658 local_TSt19->refcount++;
3660 zval** p_rhs = &local_TSt19;
3662 sep_copy_on_write (p_rhs);
3663 zval_ptr_dtor (return_value_ptr);
3664 (*p_rhs)->is_ref = 1;
3665 (*p_rhs)->refcount++;
3666 *return_value_ptr = *p_rhs;
3667 goto end_of_function;
3668 phc_check_invariants (TSRMLS_C);
3670 // Method exit
3671 end_of_function:__attribute__((unused));
3672 if (local_TSt19 != NULL)
3674 zval_ptr_dtor (&local_TSt19);
3676 if (*return_value_ptr)
3677 saved_refcount = (*return_value_ptr)->refcount;
3679 // function getnogallery()
3680 // {
3681 // $TSt20 = $this->mNoGallery;
3682 // return $TSt20;
3683 // }
3684 PHP_METHOD(ParserOutput, getnogallery)
3686 zval* local_TSt20 = NULL;
3687 zval* local_this = getThis();
3688 // Function body
3689 // $TSt20 = $this->mNoGallery;
3691 if (local_this == NULL)
3693 local_this = EG (uninitialized_zval_ptr);
3694 local_this->refcount++;
3696 zval** p_obj = &local_this;
3698 zval field_name;
3699 INIT_ZVAL (field_name);
3700 ZVAL_STRING (&field_name, "mNoGallery", 0);
3702 // I *think* this is correct, but documentation of the Zend API is scarce :)
3703 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
3704 if (local_TSt20 == NULL)
3706 local_TSt20 = EG (uninitialized_zval_ptr);
3707 local_TSt20->refcount++;
3709 zval** p_lhs = &local_TSt20;
3711 write_var (p_lhs, field);
3712 phc_check_invariants (TSRMLS_C);
3714 // return $TSt20;
3716 zval* rhs;
3717 if (local_TSt20 == NULL)
3718 rhs = EG (uninitialized_zval_ptr);
3719 else
3720 rhs = local_TSt20;
3722 // Run-time return by reference has different semantics to compile-time.
3723 // If the function has CTRBR and RTRBR, the the assignment will be
3724 // reference. If one or the other is return-by-copy, the result will be
3725 // by copy. Its a question of whether its separated at return-time (which
3726 // we do here) or at the call-site.
3727 return_value->value = rhs->value;
3728 return_value->type = rhs->type;
3729 zval_copy_ctor (return_value);
3730 goto end_of_function;
3731 phc_check_invariants (TSRMLS_C);
3733 // Method exit
3734 end_of_function:__attribute__((unused));
3735 if (local_TSt20 != NULL)
3737 zval_ptr_dtor (&local_TSt20);
3740 // function getsubtitle()
3741 // {
3742 // $TSt21 = $this->mSubtitle;
3743 // return $TSt21;
3744 // }
3745 PHP_METHOD(ParserOutput, getsubtitle)
3747 zval* local_TSt21 = NULL;
3748 zval* local_this = getThis();
3749 // Function body
3750 // $TSt21 = $this->mSubtitle;
3752 if (local_this == NULL)
3754 local_this = EG (uninitialized_zval_ptr);
3755 local_this->refcount++;
3757 zval** p_obj = &local_this;
3759 zval field_name;
3760 INIT_ZVAL (field_name);
3761 ZVAL_STRING (&field_name, "mSubtitle", 0);
3763 // I *think* this is correct, but documentation of the Zend API is scarce :)
3764 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
3765 if (local_TSt21 == NULL)
3767 local_TSt21 = EG (uninitialized_zval_ptr);
3768 local_TSt21->refcount++;
3770 zval** p_lhs = &local_TSt21;
3772 write_var (p_lhs, field);
3773 phc_check_invariants (TSRMLS_C);
3775 // return $TSt21;
3777 zval* rhs;
3778 if (local_TSt21 == NULL)
3779 rhs = EG (uninitialized_zval_ptr);
3780 else
3781 rhs = local_TSt21;
3783 // Run-time return by reference has different semantics to compile-time.
3784 // If the function has CTRBR and RTRBR, the the assignment will be
3785 // reference. If one or the other is return-by-copy, the result will be
3786 // by copy. Its a question of whether its separated at return-time (which
3787 // we do here) or at the call-site.
3788 return_value->value = rhs->value;
3789 return_value->type = rhs->type;
3790 zval_copy_ctor (return_value);
3791 goto end_of_function;
3792 phc_check_invariants (TSRMLS_C);
3794 // Method exit
3795 end_of_function:__attribute__((unused));
3796 if (local_TSt21 != NULL)
3798 zval_ptr_dtor (&local_TSt21);
3801 // function getoutputhooks()
3802 // {
3803 // $TSt22 = $this->mOutputHooks;
3804 // $TLE23 = (array) $TSt22;
3805 // return $TLE23;
3806 // }
3807 PHP_METHOD(ParserOutput, getoutputhooks)
3809 zval* local_TLE23 = NULL;
3810 zval* local_TSt22 = NULL;
3811 zval* local_this = getThis();
3812 // Function body
3813 // $TSt22 = $this->mOutputHooks;
3815 if (local_this == NULL)
3817 local_this = EG (uninitialized_zval_ptr);
3818 local_this->refcount++;
3820 zval** p_obj = &local_this;
3822 zval field_name;
3823 INIT_ZVAL (field_name);
3824 ZVAL_STRING (&field_name, "mOutputHooks", 0);
3826 // I *think* this is correct, but documentation of the Zend API is scarce :)
3827 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
3828 if (local_TSt22 == NULL)
3830 local_TSt22 = EG (uninitialized_zval_ptr);
3831 local_TSt22->refcount++;
3833 zval** p_lhs = &local_TSt22;
3835 write_var (p_lhs, field);
3836 phc_check_invariants (TSRMLS_C);
3838 // $TLE23 = (array) $TSt22;
3840 if (local_TLE23 == NULL)
3842 local_TLE23 = EG (uninitialized_zval_ptr);
3843 local_TLE23->refcount++;
3845 zval** p_lhs = &local_TLE23;
3847 zval* rhs;
3848 if (local_TSt22 == NULL)
3849 rhs = EG (uninitialized_zval_ptr);
3850 else
3851 rhs = local_TSt22;
3853 if (*p_lhs != rhs)
3855 if ((*p_lhs)->is_ref)
3856 overwrite_lhs (*p_lhs, rhs);
3857 else
3859 zval_ptr_dtor (p_lhs);
3860 if (rhs->is_ref)
3862 // Take a copy of RHS for LHS
3863 *p_lhs = zvp_clone_ex (rhs);
3865 else
3867 // Share a copy
3868 rhs->refcount++;
3869 *p_lhs = rhs;
3876 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
3877 if ((*p_lhs)->type != IS_ARRAY)
3879 sep_copy_on_write (p_lhs);
3880 convert_to_array (*p_lhs);
3883 phc_check_invariants (TSRMLS_C);
3885 // return $TLE23;
3887 zval* rhs;
3888 if (local_TLE23 == NULL)
3889 rhs = EG (uninitialized_zval_ptr);
3890 else
3891 rhs = local_TLE23;
3893 // Run-time return by reference has different semantics to compile-time.
3894 // If the function has CTRBR and RTRBR, the the assignment will be
3895 // reference. If one or the other is return-by-copy, the result will be
3896 // by copy. Its a question of whether its separated at return-time (which
3897 // we do here) or at the call-site.
3898 return_value->value = rhs->value;
3899 return_value->type = rhs->type;
3900 zval_copy_ctor (return_value);
3901 goto end_of_function;
3902 phc_check_invariants (TSRMLS_C);
3904 // Method exit
3905 end_of_function:__attribute__((unused));
3906 if (local_TLE23 != NULL)
3908 zval_ptr_dtor (&local_TLE23);
3910 if (local_TSt22 != NULL)
3912 zval_ptr_dtor (&local_TSt22);
3915 // function getwarnings()
3916 // {
3917 // $TLE102 = param_is_ref (NULL, "array_keys", 0);
3918 // ;
3919 // if (TLE102) goto L131 else goto L132;
3920 // L131:
3921 // $TMIt101 =& $this->mWarnings;
3922 // goto L133;
3923 // L132:
3924 // $TMIt101 = $this->mWarnings;
3925 // goto L133;
3926 // L133:
3927 // $TLE24 = array_keys($TMIt101);
3928 // return $TLE24;
3929 // }
3930 PHP_METHOD(ParserOutput, getwarnings)
3932 zval* local_TLE102 = NULL;
3933 zval* local_TLE24 = NULL;
3934 zval* local_TMIt101 = NULL;
3935 zval* local_this = getThis();
3936 // Function body
3937 // $TLE102 = param_is_ref (NULL, "array_keys", 0);
3938 // ;
3940 initialize_function_call (&array_keys_fci, &array_keys_fcic, "array_keys", "<unknown>", 0 TSRMLS_CC);
3941 zend_function* signature = array_keys_fcic.function_handler;
3942 zend_arg_info* arg_info = signature->common.arg_info;
3943 int count = 0;
3944 while (arg_info && count < 0)
3946 count++;
3947 arg_info++;
3950 if (local_TLE102 == NULL)
3952 local_TLE102 = EG (uninitialized_zval_ptr);
3953 local_TLE102->refcount++;
3955 zval** p_lhs = &local_TLE102;
3957 zval* rhs;
3958 ALLOC_INIT_ZVAL (rhs);
3959 if (arg_info && count == 0)
3961 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
3963 else
3965 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
3967 write_var (p_lhs, rhs);
3968 zval_ptr_dtor (&rhs);
3969 phc_check_invariants (TSRMLS_C);
3971 // if (TLE102) goto L131 else goto L132;
3973 zval* p_cond;
3974 if (local_TLE102 == NULL)
3975 p_cond = EG (uninitialized_zval_ptr);
3976 else
3977 p_cond = local_TLE102;
3979 zend_bool bcond = zend_is_true (p_cond);
3980 if (bcond)
3981 goto L131;
3982 else
3983 goto L132;
3984 phc_check_invariants (TSRMLS_C);
3986 // L131:
3987 L131:;
3988 // $TMIt101 =& $this->mWarnings;
3990 if (local_this == NULL)
3992 local_this = EG (uninitialized_zval_ptr);
3993 local_this->refcount++;
3995 zval** p_obj = &local_this;
3997 zval field_name;
3998 INIT_ZVAL (field_name);
3999 ZVAL_STRING (&field_name, "mWarnings", 0);
4001 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
4002 sep_copy_on_write (field);
4003 if (local_TMIt101 == NULL)
4005 local_TMIt101 = EG (uninitialized_zval_ptr);
4006 local_TMIt101->refcount++;
4008 zval** p_lhs = &local_TMIt101;
4010 copy_into_ref (p_lhs, field);
4011 phc_check_invariants (TSRMLS_C);
4013 // goto L133;
4015 goto L133;
4016 phc_check_invariants (TSRMLS_C);
4018 // L132:
4019 L132:;
4020 // $TMIt101 = $this->mWarnings;
4022 if (local_this == NULL)
4024 local_this = EG (uninitialized_zval_ptr);
4025 local_this->refcount++;
4027 zval** p_obj = &local_this;
4029 zval field_name;
4030 INIT_ZVAL (field_name);
4031 ZVAL_STRING (&field_name, "mWarnings", 0);
4033 // I *think* this is correct, but documentation of the Zend API is scarce :)
4034 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
4035 if (local_TMIt101 == NULL)
4037 local_TMIt101 = EG (uninitialized_zval_ptr);
4038 local_TMIt101->refcount++;
4040 zval** p_lhs = &local_TMIt101;
4042 write_var (p_lhs, field);
4043 phc_check_invariants (TSRMLS_C);
4045 // goto L133;
4047 goto L133;
4048 phc_check_invariants (TSRMLS_C);
4050 // L133:
4051 L133:;
4052 // $TLE24 = array_keys($TMIt101);
4054 initialize_function_call (&array_keys_fci, &array_keys_fcic, "array_keys", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 58 TSRMLS_CC);
4055 zend_function* signature = array_keys_fcic.function_handler;
4056 zend_arg_info* arg_info = signature->common.arg_info; // optional
4058 int by_ref[1];
4059 int abr_index = 0;
4060 // TODO: find names to replace index
4061 if (arg_info)
4063 by_ref[abr_index] = arg_info->pass_by_reference;
4064 arg_info++;
4066 else
4067 by_ref[abr_index] = signature->common.pass_rest_by_reference;
4069 abr_index++;
4072 // Setup array of arguments
4073 // TODO: i think arrays of size 0 is an error
4074 int destruct [1];
4075 zval* args [1];
4076 zval** args_ind [1];
4078 int af_index = 0;
4079 destruct[af_index] = 0;
4080 if (by_ref[af_index])
4082 if (local_TMIt101 == NULL)
4084 local_TMIt101 = EG (uninitialized_zval_ptr);
4085 local_TMIt101->refcount++;
4087 zval** p_arg = &local_TMIt101;
4089 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
4090 assert (!in_copy_on_write (*args_ind[af_index]));
4091 args[af_index] = *args_ind[af_index];
4093 else
4095 zval* arg;
4096 if (local_TMIt101 == NULL)
4097 arg = EG (uninitialized_zval_ptr);
4098 else
4099 arg = local_TMIt101;
4101 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
4102 args_ind[af_index] = &args[af_index];
4104 af_index++;
4107 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 58, NULL TSRMLS_CC);
4109 // save existing parameters, in case of recursion
4110 int param_count_save = array_keys_fci.param_count;
4111 zval*** params_save = array_keys_fci.params;
4112 zval** retval_save = array_keys_fci.retval_ptr_ptr;
4114 zval* rhs = NULL;
4116 // set up params
4117 array_keys_fci.params = args_ind;
4118 array_keys_fci.param_count = 1;
4119 array_keys_fci.retval_ptr_ptr = &rhs;
4121 // call the function
4122 int success = zend_call_function (&array_keys_fci, &array_keys_fcic TSRMLS_CC);
4123 assert(success == SUCCESS);
4125 // restore params
4126 array_keys_fci.params = params_save;
4127 array_keys_fci.param_count = param_count_save;
4128 array_keys_fci.retval_ptr_ptr = retval_save;
4130 // unset the errors
4131 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
4133 int i;
4134 for (i = 0; i < 1; i++)
4136 if (destruct[i])
4138 assert (destruct[i]);
4139 zval_ptr_dtor (args_ind[i]);
4144 // When the Zend engine returns by reference, it allocates a zval into
4145 // retval_ptr_ptr. To return by reference, the callee writes into the
4146 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
4147 // not actually return anything). So the zval returned - whether we return
4148 // it, or it is the allocated zval - has a refcount of 1.
4150 // The caller is responsible for cleaning that up (note, this is unaffected
4151 // by whether it is added to some COW set).
4153 // For reasons unknown, the Zend API resets the refcount and is_ref fields
4154 // of the return value after the function returns (unless the callee is
4155 // interpreted). If the function is supposed to return by reference, this
4156 // loses the refcount. This only happens when non-interpreted code is
4157 // called. We work around it, when compiled code is called, by saving the
4158 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
4159 // that we may create an error if our code is called by a callback, and
4160 // returns by reference, and the callback returns by reference. At least
4161 // this is an obscure case.
4162 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
4164 assert (rhs != EG(uninitialized_zval_ptr));
4165 rhs->is_ref = 1;
4166 if (saved_refcount != 0)
4168 rhs->refcount = saved_refcount;
4170 rhs->refcount++;
4172 saved_refcount = 0; // for 'obscure cases'
4174 if (local_TLE24 == NULL)
4176 local_TLE24 = EG (uninitialized_zval_ptr);
4177 local_TLE24->refcount++;
4179 zval** p_lhs = &local_TLE24;
4181 write_var (p_lhs, rhs);
4184 zval_ptr_dtor (&rhs);
4185 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
4186 zval_ptr_dtor (&rhs);
4188 phc_check_invariants (TSRMLS_C);
4190 // return $TLE24;
4192 zval* rhs;
4193 if (local_TLE24 == NULL)
4194 rhs = EG (uninitialized_zval_ptr);
4195 else
4196 rhs = local_TLE24;
4198 // Run-time return by reference has different semantics to compile-time.
4199 // If the function has CTRBR and RTRBR, the the assignment will be
4200 // reference. If one or the other is return-by-copy, the result will be
4201 // by copy. Its a question of whether its separated at return-time (which
4202 // we do here) or at the call-site.
4203 return_value->value = rhs->value;
4204 return_value->type = rhs->type;
4205 zval_copy_ctor (return_value);
4206 goto end_of_function;
4207 phc_check_invariants (TSRMLS_C);
4209 // Method exit
4210 end_of_function:__attribute__((unused));
4211 if (local_TLE102 != NULL)
4213 zval_ptr_dtor (&local_TLE102);
4215 if (local_TLE24 != NULL)
4217 zval_ptr_dtor (&local_TLE24);
4219 if (local_TMIt101 != NULL)
4221 zval_ptr_dtor (&local_TMIt101);
4224 // function getindexpolicy()
4225 // {
4226 // $TSt25 = $this->mIndexPolicy;
4227 // return $TSt25;
4228 // }
4229 PHP_METHOD(ParserOutput, getindexpolicy)
4231 zval* local_TSt25 = NULL;
4232 zval* local_this = getThis();
4233 // Function body
4234 // $TSt25 = $this->mIndexPolicy;
4236 if (local_this == NULL)
4238 local_this = EG (uninitialized_zval_ptr);
4239 local_this->refcount++;
4241 zval** p_obj = &local_this;
4243 zval field_name;
4244 INIT_ZVAL (field_name);
4245 ZVAL_STRING (&field_name, "mIndexPolicy", 0);
4247 // I *think* this is correct, but documentation of the Zend API is scarce :)
4248 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
4249 if (local_TSt25 == NULL)
4251 local_TSt25 = EG (uninitialized_zval_ptr);
4252 local_TSt25->refcount++;
4254 zval** p_lhs = &local_TSt25;
4256 write_var (p_lhs, field);
4257 phc_check_invariants (TSRMLS_C);
4259 // return $TSt25;
4261 zval* rhs;
4262 if (local_TSt25 == NULL)
4263 rhs = EG (uninitialized_zval_ptr);
4264 else
4265 rhs = local_TSt25;
4267 // Run-time return by reference has different semantics to compile-time.
4268 // If the function has CTRBR and RTRBR, the the assignment will be
4269 // reference. If one or the other is return-by-copy, the result will be
4270 // by copy. Its a question of whether its separated at return-time (which
4271 // we do here) or at the call-site.
4272 return_value->value = rhs->value;
4273 return_value->type = rhs->type;
4274 zval_copy_ctor (return_value);
4275 goto end_of_function;
4276 phc_check_invariants (TSRMLS_C);
4278 // Method exit
4279 end_of_function:__attribute__((unused));
4280 if (local_TSt25 != NULL)
4282 zval_ptr_dtor (&local_TSt25);
4285 // function containsoldmagic()
4286 // {
4287 // $TSt26 = $this->mContainsOldMagic;
4288 // return $TSt26;
4289 // }
4290 PHP_METHOD(ParserOutput, containsoldmagic)
4292 zval* local_TSt26 = NULL;
4293 zval* local_this = getThis();
4294 // Function body
4295 // $TSt26 = $this->mContainsOldMagic;
4297 if (local_this == NULL)
4299 local_this = EG (uninitialized_zval_ptr);
4300 local_this->refcount++;
4302 zval** p_obj = &local_this;
4304 zval field_name;
4305 INIT_ZVAL (field_name);
4306 ZVAL_STRING (&field_name, "mContainsOldMagic", 0);
4308 // I *think* this is correct, but documentation of the Zend API is scarce :)
4309 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
4310 if (local_TSt26 == NULL)
4312 local_TSt26 = EG (uninitialized_zval_ptr);
4313 local_TSt26->refcount++;
4315 zval** p_lhs = &local_TSt26;
4317 write_var (p_lhs, field);
4318 phc_check_invariants (TSRMLS_C);
4320 // return $TSt26;
4322 zval* rhs;
4323 if (local_TSt26 == NULL)
4324 rhs = EG (uninitialized_zval_ptr);
4325 else
4326 rhs = local_TSt26;
4328 // Run-time return by reference has different semantics to compile-time.
4329 // If the function has CTRBR and RTRBR, the the assignment will be
4330 // reference. If one or the other is return-by-copy, the result will be
4331 // by copy. Its a question of whether its separated at return-time (which
4332 // we do here) or at the call-site.
4333 return_value->value = rhs->value;
4334 return_value->type = rhs->type;
4335 zval_copy_ctor (return_value);
4336 goto end_of_function;
4337 phc_check_invariants (TSRMLS_C);
4339 // Method exit
4340 end_of_function:__attribute__((unused));
4341 if (local_TSt26 != NULL)
4343 zval_ptr_dtor (&local_TSt26);
4346 // function settext($text)
4347 // {
4348 // $TLE104 = param_is_ref (NULL, "wfsetvar", 0);
4349 // ;
4350 // if (TLE104) goto L134 else goto L135;
4351 // L134:
4352 // $TMIt103 =& $this->mText;
4353 // goto L136;
4354 // L135:
4355 // $TMIt103 = $this->mText;
4356 // goto L136;
4357 // L136:
4358 // $TLE27 = wfsetvar($TMIt103, $text);
4359 // return $TLE27;
4360 // }
4361 PHP_METHOD(ParserOutput, settext)
4363 zval* local_TLE104 = NULL;
4364 zval* local_TLE27 = NULL;
4365 zval* local_TMIt103 = NULL;
4366 zval* local_text = NULL;
4367 zval* local_this = getThis();
4368 // Add all parameters as local variables
4370 int num_args = ZEND_NUM_ARGS ();
4371 zval* params[1];
4372 zend_get_parameters_array(0, num_args, params);
4373 // param 0
4374 params[0]->refcount++;
4375 if (local_text != NULL)
4377 zval_ptr_dtor (&local_text);
4379 local_text = params[0];
4381 // Function body
4382 // $TLE104 = param_is_ref (NULL, "wfsetvar", 0);
4383 // ;
4385 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "<unknown>", 0 TSRMLS_CC);
4386 zend_function* signature = wfsetvar_fcic.function_handler;
4387 zend_arg_info* arg_info = signature->common.arg_info;
4388 int count = 0;
4389 while (arg_info && count < 0)
4391 count++;
4392 arg_info++;
4395 if (local_TLE104 == NULL)
4397 local_TLE104 = EG (uninitialized_zval_ptr);
4398 local_TLE104->refcount++;
4400 zval** p_lhs = &local_TLE104;
4402 zval* rhs;
4403 ALLOC_INIT_ZVAL (rhs);
4404 if (arg_info && count == 0)
4406 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
4408 else
4410 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
4412 write_var (p_lhs, rhs);
4413 zval_ptr_dtor (&rhs);
4414 phc_check_invariants (TSRMLS_C);
4416 // if (TLE104) goto L134 else goto L135;
4418 zval* p_cond;
4419 if (local_TLE104 == NULL)
4420 p_cond = EG (uninitialized_zval_ptr);
4421 else
4422 p_cond = local_TLE104;
4424 zend_bool bcond = zend_is_true (p_cond);
4425 if (bcond)
4426 goto L134;
4427 else
4428 goto L135;
4429 phc_check_invariants (TSRMLS_C);
4431 // L134:
4432 L134:;
4433 // $TMIt103 =& $this->mText;
4435 if (local_this == NULL)
4437 local_this = EG (uninitialized_zval_ptr);
4438 local_this->refcount++;
4440 zval** p_obj = &local_this;
4442 zval field_name;
4443 INIT_ZVAL (field_name);
4444 ZVAL_STRING (&field_name, "mText", 0);
4446 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
4447 sep_copy_on_write (field);
4448 if (local_TMIt103 == NULL)
4450 local_TMIt103 = EG (uninitialized_zval_ptr);
4451 local_TMIt103->refcount++;
4453 zval** p_lhs = &local_TMIt103;
4455 copy_into_ref (p_lhs, field);
4456 phc_check_invariants (TSRMLS_C);
4458 // goto L136;
4460 goto L136;
4461 phc_check_invariants (TSRMLS_C);
4463 // L135:
4464 L135:;
4465 // $TMIt103 = $this->mText;
4467 if (local_this == NULL)
4469 local_this = EG (uninitialized_zval_ptr);
4470 local_this->refcount++;
4472 zval** p_obj = &local_this;
4474 zval field_name;
4475 INIT_ZVAL (field_name);
4476 ZVAL_STRING (&field_name, "mText", 0);
4478 // I *think* this is correct, but documentation of the Zend API is scarce :)
4479 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
4480 if (local_TMIt103 == NULL)
4482 local_TMIt103 = EG (uninitialized_zval_ptr);
4483 local_TMIt103->refcount++;
4485 zval** p_lhs = &local_TMIt103;
4487 write_var (p_lhs, field);
4488 phc_check_invariants (TSRMLS_C);
4490 // goto L136;
4492 goto L136;
4493 phc_check_invariants (TSRMLS_C);
4495 // L136:
4496 L136:;
4497 // $TLE27 = wfsetvar($TMIt103, $text);
4499 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 62 TSRMLS_CC);
4500 zend_function* signature = wfsetvar_fcic.function_handler;
4501 zend_arg_info* arg_info = signature->common.arg_info; // optional
4503 int by_ref[2];
4504 int abr_index = 0;
4505 // TODO: find names to replace index
4506 if (arg_info)
4508 by_ref[abr_index] = arg_info->pass_by_reference;
4509 arg_info++;
4511 else
4512 by_ref[abr_index] = signature->common.pass_rest_by_reference;
4514 abr_index++;
4515 // TODO: find names to replace index
4516 if (arg_info)
4518 by_ref[abr_index] = arg_info->pass_by_reference;
4519 arg_info++;
4521 else
4522 by_ref[abr_index] = signature->common.pass_rest_by_reference;
4524 abr_index++;
4527 // Setup array of arguments
4528 // TODO: i think arrays of size 0 is an error
4529 int destruct [2];
4530 zval* args [2];
4531 zval** args_ind [2];
4533 int af_index = 0;
4534 destruct[af_index] = 0;
4535 if (by_ref[af_index])
4537 if (local_TMIt103 == NULL)
4539 local_TMIt103 = EG (uninitialized_zval_ptr);
4540 local_TMIt103->refcount++;
4542 zval** p_arg = &local_TMIt103;
4544 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
4545 assert (!in_copy_on_write (*args_ind[af_index]));
4546 args[af_index] = *args_ind[af_index];
4548 else
4550 zval* arg;
4551 if (local_TMIt103 == NULL)
4552 arg = EG (uninitialized_zval_ptr);
4553 else
4554 arg = local_TMIt103;
4556 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
4557 args_ind[af_index] = &args[af_index];
4559 af_index++;
4560 destruct[af_index] = 0;
4561 if (by_ref[af_index])
4563 if (local_text == NULL)
4565 local_text = EG (uninitialized_zval_ptr);
4566 local_text->refcount++;
4568 zval** p_arg = &local_text;
4570 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
4571 assert (!in_copy_on_write (*args_ind[af_index]));
4572 args[af_index] = *args_ind[af_index];
4574 else
4576 zval* arg;
4577 if (local_text == NULL)
4578 arg = EG (uninitialized_zval_ptr);
4579 else
4580 arg = local_text;
4582 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
4583 args_ind[af_index] = &args[af_index];
4585 af_index++;
4588 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 62, NULL TSRMLS_CC);
4590 // save existing parameters, in case of recursion
4591 int param_count_save = wfsetvar_fci.param_count;
4592 zval*** params_save = wfsetvar_fci.params;
4593 zval** retval_save = wfsetvar_fci.retval_ptr_ptr;
4595 zval* rhs = NULL;
4597 // set up params
4598 wfsetvar_fci.params = args_ind;
4599 wfsetvar_fci.param_count = 2;
4600 wfsetvar_fci.retval_ptr_ptr = &rhs;
4602 // call the function
4603 int success = zend_call_function (&wfsetvar_fci, &wfsetvar_fcic TSRMLS_CC);
4604 assert(success == SUCCESS);
4606 // restore params
4607 wfsetvar_fci.params = params_save;
4608 wfsetvar_fci.param_count = param_count_save;
4609 wfsetvar_fci.retval_ptr_ptr = retval_save;
4611 // unset the errors
4612 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
4614 int i;
4615 for (i = 0; i < 2; i++)
4617 if (destruct[i])
4619 assert (destruct[i]);
4620 zval_ptr_dtor (args_ind[i]);
4625 // When the Zend engine returns by reference, it allocates a zval into
4626 // retval_ptr_ptr. To return by reference, the callee writes into the
4627 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
4628 // not actually return anything). So the zval returned - whether we return
4629 // it, or it is the allocated zval - has a refcount of 1.
4631 // The caller is responsible for cleaning that up (note, this is unaffected
4632 // by whether it is added to some COW set).
4634 // For reasons unknown, the Zend API resets the refcount and is_ref fields
4635 // of the return value after the function returns (unless the callee is
4636 // interpreted). If the function is supposed to return by reference, this
4637 // loses the refcount. This only happens when non-interpreted code is
4638 // called. We work around it, when compiled code is called, by saving the
4639 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
4640 // that we may create an error if our code is called by a callback, and
4641 // returns by reference, and the callback returns by reference. At least
4642 // this is an obscure case.
4643 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
4645 assert (rhs != EG(uninitialized_zval_ptr));
4646 rhs->is_ref = 1;
4647 if (saved_refcount != 0)
4649 rhs->refcount = saved_refcount;
4651 rhs->refcount++;
4653 saved_refcount = 0; // for 'obscure cases'
4655 if (local_TLE27 == NULL)
4657 local_TLE27 = EG (uninitialized_zval_ptr);
4658 local_TLE27->refcount++;
4660 zval** p_lhs = &local_TLE27;
4662 write_var (p_lhs, rhs);
4665 zval_ptr_dtor (&rhs);
4666 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
4667 zval_ptr_dtor (&rhs);
4669 phc_check_invariants (TSRMLS_C);
4671 // return $TLE27;
4673 zval* rhs;
4674 if (local_TLE27 == NULL)
4675 rhs = EG (uninitialized_zval_ptr);
4676 else
4677 rhs = local_TLE27;
4679 // Run-time return by reference has different semantics to compile-time.
4680 // If the function has CTRBR and RTRBR, the the assignment will be
4681 // reference. If one or the other is return-by-copy, the result will be
4682 // by copy. Its a question of whether its separated at return-time (which
4683 // we do here) or at the call-site.
4684 return_value->value = rhs->value;
4685 return_value->type = rhs->type;
4686 zval_copy_ctor (return_value);
4687 goto end_of_function;
4688 phc_check_invariants (TSRMLS_C);
4690 // Method exit
4691 end_of_function:__attribute__((unused));
4692 if (local_TLE104 != NULL)
4694 zval_ptr_dtor (&local_TLE104);
4696 if (local_TLE27 != NULL)
4698 zval_ptr_dtor (&local_TLE27);
4700 if (local_TMIt103 != NULL)
4702 zval_ptr_dtor (&local_TMIt103);
4704 if (local_text != NULL)
4706 zval_ptr_dtor (&local_text);
4709 // function setlanguagelinks($ll)
4710 // {
4711 // $TLE106 = param_is_ref (NULL, "wfsetvar", 0);
4712 // ;
4713 // if (TLE106) goto L137 else goto L138;
4714 // L137:
4715 // $TMIt105 =& $this->mLanguageLinks;
4716 // goto L139;
4717 // L138:
4718 // $TMIt105 = $this->mLanguageLinks;
4719 // goto L139;
4720 // L139:
4721 // $TLE28 = wfsetvar($TMIt105, $ll);
4722 // return $TLE28;
4723 // }
4724 PHP_METHOD(ParserOutput, setlanguagelinks)
4726 zval* local_TLE106 = NULL;
4727 zval* local_TLE28 = NULL;
4728 zval* local_TMIt105 = NULL;
4729 zval* local_ll = NULL;
4730 zval* local_this = getThis();
4731 // Add all parameters as local variables
4733 int num_args = ZEND_NUM_ARGS ();
4734 zval* params[1];
4735 zend_get_parameters_array(0, num_args, params);
4736 // param 0
4737 params[0]->refcount++;
4738 if (local_ll != NULL)
4740 zval_ptr_dtor (&local_ll);
4742 local_ll = params[0];
4744 // Function body
4745 // $TLE106 = param_is_ref (NULL, "wfsetvar", 0);
4746 // ;
4748 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "<unknown>", 0 TSRMLS_CC);
4749 zend_function* signature = wfsetvar_fcic.function_handler;
4750 zend_arg_info* arg_info = signature->common.arg_info;
4751 int count = 0;
4752 while (arg_info && count < 0)
4754 count++;
4755 arg_info++;
4758 if (local_TLE106 == NULL)
4760 local_TLE106 = EG (uninitialized_zval_ptr);
4761 local_TLE106->refcount++;
4763 zval** p_lhs = &local_TLE106;
4765 zval* rhs;
4766 ALLOC_INIT_ZVAL (rhs);
4767 if (arg_info && count == 0)
4769 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
4771 else
4773 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
4775 write_var (p_lhs, rhs);
4776 zval_ptr_dtor (&rhs);
4777 phc_check_invariants (TSRMLS_C);
4779 // if (TLE106) goto L137 else goto L138;
4781 zval* p_cond;
4782 if (local_TLE106 == NULL)
4783 p_cond = EG (uninitialized_zval_ptr);
4784 else
4785 p_cond = local_TLE106;
4787 zend_bool bcond = zend_is_true (p_cond);
4788 if (bcond)
4789 goto L137;
4790 else
4791 goto L138;
4792 phc_check_invariants (TSRMLS_C);
4794 // L137:
4795 L137:;
4796 // $TMIt105 =& $this->mLanguageLinks;
4798 if (local_this == NULL)
4800 local_this = EG (uninitialized_zval_ptr);
4801 local_this->refcount++;
4803 zval** p_obj = &local_this;
4805 zval field_name;
4806 INIT_ZVAL (field_name);
4807 ZVAL_STRING (&field_name, "mLanguageLinks", 0);
4809 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
4810 sep_copy_on_write (field);
4811 if (local_TMIt105 == NULL)
4813 local_TMIt105 = EG (uninitialized_zval_ptr);
4814 local_TMIt105->refcount++;
4816 zval** p_lhs = &local_TMIt105;
4818 copy_into_ref (p_lhs, field);
4819 phc_check_invariants (TSRMLS_C);
4821 // goto L139;
4823 goto L139;
4824 phc_check_invariants (TSRMLS_C);
4826 // L138:
4827 L138:;
4828 // $TMIt105 = $this->mLanguageLinks;
4830 if (local_this == NULL)
4832 local_this = EG (uninitialized_zval_ptr);
4833 local_this->refcount++;
4835 zval** p_obj = &local_this;
4837 zval field_name;
4838 INIT_ZVAL (field_name);
4839 ZVAL_STRING (&field_name, "mLanguageLinks", 0);
4841 // I *think* this is correct, but documentation of the Zend API is scarce :)
4842 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
4843 if (local_TMIt105 == NULL)
4845 local_TMIt105 = EG (uninitialized_zval_ptr);
4846 local_TMIt105->refcount++;
4848 zval** p_lhs = &local_TMIt105;
4850 write_var (p_lhs, field);
4851 phc_check_invariants (TSRMLS_C);
4853 // goto L139;
4855 goto L139;
4856 phc_check_invariants (TSRMLS_C);
4858 // L139:
4859 L139:;
4860 // $TLE28 = wfsetvar($TMIt105, $ll);
4862 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 63 TSRMLS_CC);
4863 zend_function* signature = wfsetvar_fcic.function_handler;
4864 zend_arg_info* arg_info = signature->common.arg_info; // optional
4866 int by_ref[2];
4867 int abr_index = 0;
4868 // TODO: find names to replace index
4869 if (arg_info)
4871 by_ref[abr_index] = arg_info->pass_by_reference;
4872 arg_info++;
4874 else
4875 by_ref[abr_index] = signature->common.pass_rest_by_reference;
4877 abr_index++;
4878 // TODO: find names to replace index
4879 if (arg_info)
4881 by_ref[abr_index] = arg_info->pass_by_reference;
4882 arg_info++;
4884 else
4885 by_ref[abr_index] = signature->common.pass_rest_by_reference;
4887 abr_index++;
4890 // Setup array of arguments
4891 // TODO: i think arrays of size 0 is an error
4892 int destruct [2];
4893 zval* args [2];
4894 zval** args_ind [2];
4896 int af_index = 0;
4897 destruct[af_index] = 0;
4898 if (by_ref[af_index])
4900 if (local_TMIt105 == NULL)
4902 local_TMIt105 = EG (uninitialized_zval_ptr);
4903 local_TMIt105->refcount++;
4905 zval** p_arg = &local_TMIt105;
4907 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
4908 assert (!in_copy_on_write (*args_ind[af_index]));
4909 args[af_index] = *args_ind[af_index];
4911 else
4913 zval* arg;
4914 if (local_TMIt105 == NULL)
4915 arg = EG (uninitialized_zval_ptr);
4916 else
4917 arg = local_TMIt105;
4919 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
4920 args_ind[af_index] = &args[af_index];
4922 af_index++;
4923 destruct[af_index] = 0;
4924 if (by_ref[af_index])
4926 if (local_ll == NULL)
4928 local_ll = EG (uninitialized_zval_ptr);
4929 local_ll->refcount++;
4931 zval** p_arg = &local_ll;
4933 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
4934 assert (!in_copy_on_write (*args_ind[af_index]));
4935 args[af_index] = *args_ind[af_index];
4937 else
4939 zval* arg;
4940 if (local_ll == NULL)
4941 arg = EG (uninitialized_zval_ptr);
4942 else
4943 arg = local_ll;
4945 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
4946 args_ind[af_index] = &args[af_index];
4948 af_index++;
4951 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 63, NULL TSRMLS_CC);
4953 // save existing parameters, in case of recursion
4954 int param_count_save = wfsetvar_fci.param_count;
4955 zval*** params_save = wfsetvar_fci.params;
4956 zval** retval_save = wfsetvar_fci.retval_ptr_ptr;
4958 zval* rhs = NULL;
4960 // set up params
4961 wfsetvar_fci.params = args_ind;
4962 wfsetvar_fci.param_count = 2;
4963 wfsetvar_fci.retval_ptr_ptr = &rhs;
4965 // call the function
4966 int success = zend_call_function (&wfsetvar_fci, &wfsetvar_fcic TSRMLS_CC);
4967 assert(success == SUCCESS);
4969 // restore params
4970 wfsetvar_fci.params = params_save;
4971 wfsetvar_fci.param_count = param_count_save;
4972 wfsetvar_fci.retval_ptr_ptr = retval_save;
4974 // unset the errors
4975 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
4977 int i;
4978 for (i = 0; i < 2; i++)
4980 if (destruct[i])
4982 assert (destruct[i]);
4983 zval_ptr_dtor (args_ind[i]);
4988 // When the Zend engine returns by reference, it allocates a zval into
4989 // retval_ptr_ptr. To return by reference, the callee writes into the
4990 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
4991 // not actually return anything). So the zval returned - whether we return
4992 // it, or it is the allocated zval - has a refcount of 1.
4994 // The caller is responsible for cleaning that up (note, this is unaffected
4995 // by whether it is added to some COW set).
4997 // For reasons unknown, the Zend API resets the refcount and is_ref fields
4998 // of the return value after the function returns (unless the callee is
4999 // interpreted). If the function is supposed to return by reference, this
5000 // loses the refcount. This only happens when non-interpreted code is
5001 // called. We work around it, when compiled code is called, by saving the
5002 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
5003 // that we may create an error if our code is called by a callback, and
5004 // returns by reference, and the callback returns by reference. At least
5005 // this is an obscure case.
5006 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
5008 assert (rhs != EG(uninitialized_zval_ptr));
5009 rhs->is_ref = 1;
5010 if (saved_refcount != 0)
5012 rhs->refcount = saved_refcount;
5014 rhs->refcount++;
5016 saved_refcount = 0; // for 'obscure cases'
5018 if (local_TLE28 == NULL)
5020 local_TLE28 = EG (uninitialized_zval_ptr);
5021 local_TLE28->refcount++;
5023 zval** p_lhs = &local_TLE28;
5025 write_var (p_lhs, rhs);
5028 zval_ptr_dtor (&rhs);
5029 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
5030 zval_ptr_dtor (&rhs);
5032 phc_check_invariants (TSRMLS_C);
5034 // return $TLE28;
5036 zval* rhs;
5037 if (local_TLE28 == NULL)
5038 rhs = EG (uninitialized_zval_ptr);
5039 else
5040 rhs = local_TLE28;
5042 // Run-time return by reference has different semantics to compile-time.
5043 // If the function has CTRBR and RTRBR, the the assignment will be
5044 // reference. If one or the other is return-by-copy, the result will be
5045 // by copy. Its a question of whether its separated at return-time (which
5046 // we do here) or at the call-site.
5047 return_value->value = rhs->value;
5048 return_value->type = rhs->type;
5049 zval_copy_ctor (return_value);
5050 goto end_of_function;
5051 phc_check_invariants (TSRMLS_C);
5053 // Method exit
5054 end_of_function:__attribute__((unused));
5055 if (local_TLE106 != NULL)
5057 zval_ptr_dtor (&local_TLE106);
5059 if (local_TLE28 != NULL)
5061 zval_ptr_dtor (&local_TLE28);
5063 if (local_TMIt105 != NULL)
5065 zval_ptr_dtor (&local_TMIt105);
5067 if (local_ll != NULL)
5069 zval_ptr_dtor (&local_ll);
5072 // function setcategorylinks($cl)
5073 // {
5074 // $TLE108 = param_is_ref (NULL, "wfsetvar", 0);
5075 // ;
5076 // if (TLE108) goto L140 else goto L141;
5077 // L140:
5078 // $TMIt107 =& $this->mCategories;
5079 // goto L142;
5080 // L141:
5081 // $TMIt107 = $this->mCategories;
5082 // goto L142;
5083 // L142:
5084 // $TLE29 = wfsetvar($TMIt107, $cl);
5085 // return $TLE29;
5086 // }
5087 PHP_METHOD(ParserOutput, setcategorylinks)
5089 zval* local_TLE108 = NULL;
5090 zval* local_TLE29 = NULL;
5091 zval* local_TMIt107 = NULL;
5092 zval* local_cl = NULL;
5093 zval* local_this = getThis();
5094 // Add all parameters as local variables
5096 int num_args = ZEND_NUM_ARGS ();
5097 zval* params[1];
5098 zend_get_parameters_array(0, num_args, params);
5099 // param 0
5100 params[0]->refcount++;
5101 if (local_cl != NULL)
5103 zval_ptr_dtor (&local_cl);
5105 local_cl = params[0];
5107 // Function body
5108 // $TLE108 = param_is_ref (NULL, "wfsetvar", 0);
5109 // ;
5111 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "<unknown>", 0 TSRMLS_CC);
5112 zend_function* signature = wfsetvar_fcic.function_handler;
5113 zend_arg_info* arg_info = signature->common.arg_info;
5114 int count = 0;
5115 while (arg_info && count < 0)
5117 count++;
5118 arg_info++;
5121 if (local_TLE108 == NULL)
5123 local_TLE108 = EG (uninitialized_zval_ptr);
5124 local_TLE108->refcount++;
5126 zval** p_lhs = &local_TLE108;
5128 zval* rhs;
5129 ALLOC_INIT_ZVAL (rhs);
5130 if (arg_info && count == 0)
5132 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
5134 else
5136 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
5138 write_var (p_lhs, rhs);
5139 zval_ptr_dtor (&rhs);
5140 phc_check_invariants (TSRMLS_C);
5142 // if (TLE108) goto L140 else goto L141;
5144 zval* p_cond;
5145 if (local_TLE108 == NULL)
5146 p_cond = EG (uninitialized_zval_ptr);
5147 else
5148 p_cond = local_TLE108;
5150 zend_bool bcond = zend_is_true (p_cond);
5151 if (bcond)
5152 goto L140;
5153 else
5154 goto L141;
5155 phc_check_invariants (TSRMLS_C);
5157 // L140:
5158 L140:;
5159 // $TMIt107 =& $this->mCategories;
5161 if (local_this == NULL)
5163 local_this = EG (uninitialized_zval_ptr);
5164 local_this->refcount++;
5166 zval** p_obj = &local_this;
5168 zval field_name;
5169 INIT_ZVAL (field_name);
5170 ZVAL_STRING (&field_name, "mCategories", 0);
5172 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
5173 sep_copy_on_write (field);
5174 if (local_TMIt107 == NULL)
5176 local_TMIt107 = EG (uninitialized_zval_ptr);
5177 local_TMIt107->refcount++;
5179 zval** p_lhs = &local_TMIt107;
5181 copy_into_ref (p_lhs, field);
5182 phc_check_invariants (TSRMLS_C);
5184 // goto L142;
5186 goto L142;
5187 phc_check_invariants (TSRMLS_C);
5189 // L141:
5190 L141:;
5191 // $TMIt107 = $this->mCategories;
5193 if (local_this == NULL)
5195 local_this = EG (uninitialized_zval_ptr);
5196 local_this->refcount++;
5198 zval** p_obj = &local_this;
5200 zval field_name;
5201 INIT_ZVAL (field_name);
5202 ZVAL_STRING (&field_name, "mCategories", 0);
5204 // I *think* this is correct, but documentation of the Zend API is scarce :)
5205 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
5206 if (local_TMIt107 == NULL)
5208 local_TMIt107 = EG (uninitialized_zval_ptr);
5209 local_TMIt107->refcount++;
5211 zval** p_lhs = &local_TMIt107;
5213 write_var (p_lhs, field);
5214 phc_check_invariants (TSRMLS_C);
5216 // goto L142;
5218 goto L142;
5219 phc_check_invariants (TSRMLS_C);
5221 // L142:
5222 L142:;
5223 // $TLE29 = wfsetvar($TMIt107, $cl);
5225 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 64 TSRMLS_CC);
5226 zend_function* signature = wfsetvar_fcic.function_handler;
5227 zend_arg_info* arg_info = signature->common.arg_info; // optional
5229 int by_ref[2];
5230 int abr_index = 0;
5231 // TODO: find names to replace index
5232 if (arg_info)
5234 by_ref[abr_index] = arg_info->pass_by_reference;
5235 arg_info++;
5237 else
5238 by_ref[abr_index] = signature->common.pass_rest_by_reference;
5240 abr_index++;
5241 // TODO: find names to replace index
5242 if (arg_info)
5244 by_ref[abr_index] = arg_info->pass_by_reference;
5245 arg_info++;
5247 else
5248 by_ref[abr_index] = signature->common.pass_rest_by_reference;
5250 abr_index++;
5253 // Setup array of arguments
5254 // TODO: i think arrays of size 0 is an error
5255 int destruct [2];
5256 zval* args [2];
5257 zval** args_ind [2];
5259 int af_index = 0;
5260 destruct[af_index] = 0;
5261 if (by_ref[af_index])
5263 if (local_TMIt107 == NULL)
5265 local_TMIt107 = EG (uninitialized_zval_ptr);
5266 local_TMIt107->refcount++;
5268 zval** p_arg = &local_TMIt107;
5270 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
5271 assert (!in_copy_on_write (*args_ind[af_index]));
5272 args[af_index] = *args_ind[af_index];
5274 else
5276 zval* arg;
5277 if (local_TMIt107 == NULL)
5278 arg = EG (uninitialized_zval_ptr);
5279 else
5280 arg = local_TMIt107;
5282 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
5283 args_ind[af_index] = &args[af_index];
5285 af_index++;
5286 destruct[af_index] = 0;
5287 if (by_ref[af_index])
5289 if (local_cl == NULL)
5291 local_cl = EG (uninitialized_zval_ptr);
5292 local_cl->refcount++;
5294 zval** p_arg = &local_cl;
5296 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
5297 assert (!in_copy_on_write (*args_ind[af_index]));
5298 args[af_index] = *args_ind[af_index];
5300 else
5302 zval* arg;
5303 if (local_cl == NULL)
5304 arg = EG (uninitialized_zval_ptr);
5305 else
5306 arg = local_cl;
5308 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
5309 args_ind[af_index] = &args[af_index];
5311 af_index++;
5314 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 64, NULL TSRMLS_CC);
5316 // save existing parameters, in case of recursion
5317 int param_count_save = wfsetvar_fci.param_count;
5318 zval*** params_save = wfsetvar_fci.params;
5319 zval** retval_save = wfsetvar_fci.retval_ptr_ptr;
5321 zval* rhs = NULL;
5323 // set up params
5324 wfsetvar_fci.params = args_ind;
5325 wfsetvar_fci.param_count = 2;
5326 wfsetvar_fci.retval_ptr_ptr = &rhs;
5328 // call the function
5329 int success = zend_call_function (&wfsetvar_fci, &wfsetvar_fcic TSRMLS_CC);
5330 assert(success == SUCCESS);
5332 // restore params
5333 wfsetvar_fci.params = params_save;
5334 wfsetvar_fci.param_count = param_count_save;
5335 wfsetvar_fci.retval_ptr_ptr = retval_save;
5337 // unset the errors
5338 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
5340 int i;
5341 for (i = 0; i < 2; i++)
5343 if (destruct[i])
5345 assert (destruct[i]);
5346 zval_ptr_dtor (args_ind[i]);
5351 // When the Zend engine returns by reference, it allocates a zval into
5352 // retval_ptr_ptr. To return by reference, the callee writes into the
5353 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
5354 // not actually return anything). So the zval returned - whether we return
5355 // it, or it is the allocated zval - has a refcount of 1.
5357 // The caller is responsible for cleaning that up (note, this is unaffected
5358 // by whether it is added to some COW set).
5360 // For reasons unknown, the Zend API resets the refcount and is_ref fields
5361 // of the return value after the function returns (unless the callee is
5362 // interpreted). If the function is supposed to return by reference, this
5363 // loses the refcount. This only happens when non-interpreted code is
5364 // called. We work around it, when compiled code is called, by saving the
5365 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
5366 // that we may create an error if our code is called by a callback, and
5367 // returns by reference, and the callback returns by reference. At least
5368 // this is an obscure case.
5369 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
5371 assert (rhs != EG(uninitialized_zval_ptr));
5372 rhs->is_ref = 1;
5373 if (saved_refcount != 0)
5375 rhs->refcount = saved_refcount;
5377 rhs->refcount++;
5379 saved_refcount = 0; // for 'obscure cases'
5381 if (local_TLE29 == NULL)
5383 local_TLE29 = EG (uninitialized_zval_ptr);
5384 local_TLE29->refcount++;
5386 zval** p_lhs = &local_TLE29;
5388 write_var (p_lhs, rhs);
5391 zval_ptr_dtor (&rhs);
5392 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
5393 zval_ptr_dtor (&rhs);
5395 phc_check_invariants (TSRMLS_C);
5397 // return $TLE29;
5399 zval* rhs;
5400 if (local_TLE29 == NULL)
5401 rhs = EG (uninitialized_zval_ptr);
5402 else
5403 rhs = local_TLE29;
5405 // Run-time return by reference has different semantics to compile-time.
5406 // If the function has CTRBR and RTRBR, the the assignment will be
5407 // reference. If one or the other is return-by-copy, the result will be
5408 // by copy. Its a question of whether its separated at return-time (which
5409 // we do here) or at the call-site.
5410 return_value->value = rhs->value;
5411 return_value->type = rhs->type;
5412 zval_copy_ctor (return_value);
5413 goto end_of_function;
5414 phc_check_invariants (TSRMLS_C);
5416 // Method exit
5417 end_of_function:__attribute__((unused));
5418 if (local_TLE108 != NULL)
5420 zval_ptr_dtor (&local_TLE108);
5422 if (local_TLE29 != NULL)
5424 zval_ptr_dtor (&local_TLE29);
5426 if (local_TMIt107 != NULL)
5428 zval_ptr_dtor (&local_TMIt107);
5430 if (local_cl != NULL)
5432 zval_ptr_dtor (&local_cl);
5435 // function setcontainsoldmagic($com)
5436 // {
5437 // $TLE110 = param_is_ref (NULL, "wfsetvar", 0);
5438 // ;
5439 // if (TLE110) goto L143 else goto L144;
5440 // L143:
5441 // $TMIt109 =& $this->mContainsOldMagic;
5442 // goto L145;
5443 // L144:
5444 // $TMIt109 = $this->mContainsOldMagic;
5445 // goto L145;
5446 // L145:
5447 // $TLE30 = wfsetvar($TMIt109, $com);
5448 // return $TLE30;
5449 // }
5450 PHP_METHOD(ParserOutput, setcontainsoldmagic)
5452 zval* local_TLE110 = NULL;
5453 zval* local_TLE30 = NULL;
5454 zval* local_TMIt109 = NULL;
5455 zval* local_com = NULL;
5456 zval* local_this = getThis();
5457 // Add all parameters as local variables
5459 int num_args = ZEND_NUM_ARGS ();
5460 zval* params[1];
5461 zend_get_parameters_array(0, num_args, params);
5462 // param 0
5463 params[0]->refcount++;
5464 if (local_com != NULL)
5466 zval_ptr_dtor (&local_com);
5468 local_com = params[0];
5470 // Function body
5471 // $TLE110 = param_is_ref (NULL, "wfsetvar", 0);
5472 // ;
5474 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "<unknown>", 0 TSRMLS_CC);
5475 zend_function* signature = wfsetvar_fcic.function_handler;
5476 zend_arg_info* arg_info = signature->common.arg_info;
5477 int count = 0;
5478 while (arg_info && count < 0)
5480 count++;
5481 arg_info++;
5484 if (local_TLE110 == NULL)
5486 local_TLE110 = EG (uninitialized_zval_ptr);
5487 local_TLE110->refcount++;
5489 zval** p_lhs = &local_TLE110;
5491 zval* rhs;
5492 ALLOC_INIT_ZVAL (rhs);
5493 if (arg_info && count == 0)
5495 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
5497 else
5499 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
5501 write_var (p_lhs, rhs);
5502 zval_ptr_dtor (&rhs);
5503 phc_check_invariants (TSRMLS_C);
5505 // if (TLE110) goto L143 else goto L144;
5507 zval* p_cond;
5508 if (local_TLE110 == NULL)
5509 p_cond = EG (uninitialized_zval_ptr);
5510 else
5511 p_cond = local_TLE110;
5513 zend_bool bcond = zend_is_true (p_cond);
5514 if (bcond)
5515 goto L143;
5516 else
5517 goto L144;
5518 phc_check_invariants (TSRMLS_C);
5520 // L143:
5521 L143:;
5522 // $TMIt109 =& $this->mContainsOldMagic;
5524 if (local_this == NULL)
5526 local_this = EG (uninitialized_zval_ptr);
5527 local_this->refcount++;
5529 zval** p_obj = &local_this;
5531 zval field_name;
5532 INIT_ZVAL (field_name);
5533 ZVAL_STRING (&field_name, "mContainsOldMagic", 0);
5535 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
5536 sep_copy_on_write (field);
5537 if (local_TMIt109 == NULL)
5539 local_TMIt109 = EG (uninitialized_zval_ptr);
5540 local_TMIt109->refcount++;
5542 zval** p_lhs = &local_TMIt109;
5544 copy_into_ref (p_lhs, field);
5545 phc_check_invariants (TSRMLS_C);
5547 // goto L145;
5549 goto L145;
5550 phc_check_invariants (TSRMLS_C);
5552 // L144:
5553 L144:;
5554 // $TMIt109 = $this->mContainsOldMagic;
5556 if (local_this == NULL)
5558 local_this = EG (uninitialized_zval_ptr);
5559 local_this->refcount++;
5561 zval** p_obj = &local_this;
5563 zval field_name;
5564 INIT_ZVAL (field_name);
5565 ZVAL_STRING (&field_name, "mContainsOldMagic", 0);
5567 // I *think* this is correct, but documentation of the Zend API is scarce :)
5568 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
5569 if (local_TMIt109 == NULL)
5571 local_TMIt109 = EG (uninitialized_zval_ptr);
5572 local_TMIt109->refcount++;
5574 zval** p_lhs = &local_TMIt109;
5576 write_var (p_lhs, field);
5577 phc_check_invariants (TSRMLS_C);
5579 // goto L145;
5581 goto L145;
5582 phc_check_invariants (TSRMLS_C);
5584 // L145:
5585 L145:;
5586 // $TLE30 = wfsetvar($TMIt109, $com);
5588 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 65 TSRMLS_CC);
5589 zend_function* signature = wfsetvar_fcic.function_handler;
5590 zend_arg_info* arg_info = signature->common.arg_info; // optional
5592 int by_ref[2];
5593 int abr_index = 0;
5594 // TODO: find names to replace index
5595 if (arg_info)
5597 by_ref[abr_index] = arg_info->pass_by_reference;
5598 arg_info++;
5600 else
5601 by_ref[abr_index] = signature->common.pass_rest_by_reference;
5603 abr_index++;
5604 // TODO: find names to replace index
5605 if (arg_info)
5607 by_ref[abr_index] = arg_info->pass_by_reference;
5608 arg_info++;
5610 else
5611 by_ref[abr_index] = signature->common.pass_rest_by_reference;
5613 abr_index++;
5616 // Setup array of arguments
5617 // TODO: i think arrays of size 0 is an error
5618 int destruct [2];
5619 zval* args [2];
5620 zval** args_ind [2];
5622 int af_index = 0;
5623 destruct[af_index] = 0;
5624 if (by_ref[af_index])
5626 if (local_TMIt109 == NULL)
5628 local_TMIt109 = EG (uninitialized_zval_ptr);
5629 local_TMIt109->refcount++;
5631 zval** p_arg = &local_TMIt109;
5633 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
5634 assert (!in_copy_on_write (*args_ind[af_index]));
5635 args[af_index] = *args_ind[af_index];
5637 else
5639 zval* arg;
5640 if (local_TMIt109 == NULL)
5641 arg = EG (uninitialized_zval_ptr);
5642 else
5643 arg = local_TMIt109;
5645 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
5646 args_ind[af_index] = &args[af_index];
5648 af_index++;
5649 destruct[af_index] = 0;
5650 if (by_ref[af_index])
5652 if (local_com == NULL)
5654 local_com = EG (uninitialized_zval_ptr);
5655 local_com->refcount++;
5657 zval** p_arg = &local_com;
5659 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
5660 assert (!in_copy_on_write (*args_ind[af_index]));
5661 args[af_index] = *args_ind[af_index];
5663 else
5665 zval* arg;
5666 if (local_com == NULL)
5667 arg = EG (uninitialized_zval_ptr);
5668 else
5669 arg = local_com;
5671 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
5672 args_ind[af_index] = &args[af_index];
5674 af_index++;
5677 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 65, NULL TSRMLS_CC);
5679 // save existing parameters, in case of recursion
5680 int param_count_save = wfsetvar_fci.param_count;
5681 zval*** params_save = wfsetvar_fci.params;
5682 zval** retval_save = wfsetvar_fci.retval_ptr_ptr;
5684 zval* rhs = NULL;
5686 // set up params
5687 wfsetvar_fci.params = args_ind;
5688 wfsetvar_fci.param_count = 2;
5689 wfsetvar_fci.retval_ptr_ptr = &rhs;
5691 // call the function
5692 int success = zend_call_function (&wfsetvar_fci, &wfsetvar_fcic TSRMLS_CC);
5693 assert(success == SUCCESS);
5695 // restore params
5696 wfsetvar_fci.params = params_save;
5697 wfsetvar_fci.param_count = param_count_save;
5698 wfsetvar_fci.retval_ptr_ptr = retval_save;
5700 // unset the errors
5701 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
5703 int i;
5704 for (i = 0; i < 2; i++)
5706 if (destruct[i])
5708 assert (destruct[i]);
5709 zval_ptr_dtor (args_ind[i]);
5714 // When the Zend engine returns by reference, it allocates a zval into
5715 // retval_ptr_ptr. To return by reference, the callee writes into the
5716 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
5717 // not actually return anything). So the zval returned - whether we return
5718 // it, or it is the allocated zval - has a refcount of 1.
5720 // The caller is responsible for cleaning that up (note, this is unaffected
5721 // by whether it is added to some COW set).
5723 // For reasons unknown, the Zend API resets the refcount and is_ref fields
5724 // of the return value after the function returns (unless the callee is
5725 // interpreted). If the function is supposed to return by reference, this
5726 // loses the refcount. This only happens when non-interpreted code is
5727 // called. We work around it, when compiled code is called, by saving the
5728 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
5729 // that we may create an error if our code is called by a callback, and
5730 // returns by reference, and the callback returns by reference. At least
5731 // this is an obscure case.
5732 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
5734 assert (rhs != EG(uninitialized_zval_ptr));
5735 rhs->is_ref = 1;
5736 if (saved_refcount != 0)
5738 rhs->refcount = saved_refcount;
5740 rhs->refcount++;
5742 saved_refcount = 0; // for 'obscure cases'
5744 if (local_TLE30 == NULL)
5746 local_TLE30 = EG (uninitialized_zval_ptr);
5747 local_TLE30->refcount++;
5749 zval** p_lhs = &local_TLE30;
5751 write_var (p_lhs, rhs);
5754 zval_ptr_dtor (&rhs);
5755 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
5756 zval_ptr_dtor (&rhs);
5758 phc_check_invariants (TSRMLS_C);
5760 // return $TLE30;
5762 zval* rhs;
5763 if (local_TLE30 == NULL)
5764 rhs = EG (uninitialized_zval_ptr);
5765 else
5766 rhs = local_TLE30;
5768 // Run-time return by reference has different semantics to compile-time.
5769 // If the function has CTRBR and RTRBR, the the assignment will be
5770 // reference. If one or the other is return-by-copy, the result will be
5771 // by copy. Its a question of whether its separated at return-time (which
5772 // we do here) or at the call-site.
5773 return_value->value = rhs->value;
5774 return_value->type = rhs->type;
5775 zval_copy_ctor (return_value);
5776 goto end_of_function;
5777 phc_check_invariants (TSRMLS_C);
5779 // Method exit
5780 end_of_function:__attribute__((unused));
5781 if (local_TLE110 != NULL)
5783 zval_ptr_dtor (&local_TLE110);
5785 if (local_TLE30 != NULL)
5787 zval_ptr_dtor (&local_TLE30);
5789 if (local_TMIt109 != NULL)
5791 zval_ptr_dtor (&local_TMIt109);
5793 if (local_com != NULL)
5795 zval_ptr_dtor (&local_com);
5798 // function setcachetime($t)
5799 // {
5800 // $TLE112 = param_is_ref (NULL, "wfsetvar", 0);
5801 // ;
5802 // if (TLE112) goto L146 else goto L147;
5803 // L146:
5804 // $TMIt111 =& $this->mCacheTime;
5805 // goto L148;
5806 // L147:
5807 // $TMIt111 = $this->mCacheTime;
5808 // goto L148;
5809 // L148:
5810 // $TLE31 = wfsetvar($TMIt111, $t);
5811 // return $TLE31;
5812 // }
5813 PHP_METHOD(ParserOutput, setcachetime)
5815 zval* local_TLE112 = NULL;
5816 zval* local_TLE31 = NULL;
5817 zval* local_TMIt111 = NULL;
5818 zval* local_t = NULL;
5819 zval* local_this = getThis();
5820 // Add all parameters as local variables
5822 int num_args = ZEND_NUM_ARGS ();
5823 zval* params[1];
5824 zend_get_parameters_array(0, num_args, params);
5825 // param 0
5826 params[0]->refcount++;
5827 if (local_t != NULL)
5829 zval_ptr_dtor (&local_t);
5831 local_t = params[0];
5833 // Function body
5834 // $TLE112 = param_is_ref (NULL, "wfsetvar", 0);
5835 // ;
5837 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "<unknown>", 0 TSRMLS_CC);
5838 zend_function* signature = wfsetvar_fcic.function_handler;
5839 zend_arg_info* arg_info = signature->common.arg_info;
5840 int count = 0;
5841 while (arg_info && count < 0)
5843 count++;
5844 arg_info++;
5847 if (local_TLE112 == NULL)
5849 local_TLE112 = EG (uninitialized_zval_ptr);
5850 local_TLE112->refcount++;
5852 zval** p_lhs = &local_TLE112;
5854 zval* rhs;
5855 ALLOC_INIT_ZVAL (rhs);
5856 if (arg_info && count == 0)
5858 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
5860 else
5862 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
5864 write_var (p_lhs, rhs);
5865 zval_ptr_dtor (&rhs);
5866 phc_check_invariants (TSRMLS_C);
5868 // if (TLE112) goto L146 else goto L147;
5870 zval* p_cond;
5871 if (local_TLE112 == NULL)
5872 p_cond = EG (uninitialized_zval_ptr);
5873 else
5874 p_cond = local_TLE112;
5876 zend_bool bcond = zend_is_true (p_cond);
5877 if (bcond)
5878 goto L146;
5879 else
5880 goto L147;
5881 phc_check_invariants (TSRMLS_C);
5883 // L146:
5884 L146:;
5885 // $TMIt111 =& $this->mCacheTime;
5887 if (local_this == NULL)
5889 local_this = EG (uninitialized_zval_ptr);
5890 local_this->refcount++;
5892 zval** p_obj = &local_this;
5894 zval field_name;
5895 INIT_ZVAL (field_name);
5896 ZVAL_STRING (&field_name, "mCacheTime", 0);
5898 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
5899 sep_copy_on_write (field);
5900 if (local_TMIt111 == NULL)
5902 local_TMIt111 = EG (uninitialized_zval_ptr);
5903 local_TMIt111->refcount++;
5905 zval** p_lhs = &local_TMIt111;
5907 copy_into_ref (p_lhs, field);
5908 phc_check_invariants (TSRMLS_C);
5910 // goto L148;
5912 goto L148;
5913 phc_check_invariants (TSRMLS_C);
5915 // L147:
5916 L147:;
5917 // $TMIt111 = $this->mCacheTime;
5919 if (local_this == NULL)
5921 local_this = EG (uninitialized_zval_ptr);
5922 local_this->refcount++;
5924 zval** p_obj = &local_this;
5926 zval field_name;
5927 INIT_ZVAL (field_name);
5928 ZVAL_STRING (&field_name, "mCacheTime", 0);
5930 // I *think* this is correct, but documentation of the Zend API is scarce :)
5931 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
5932 if (local_TMIt111 == NULL)
5934 local_TMIt111 = EG (uninitialized_zval_ptr);
5935 local_TMIt111->refcount++;
5937 zval** p_lhs = &local_TMIt111;
5939 write_var (p_lhs, field);
5940 phc_check_invariants (TSRMLS_C);
5942 // goto L148;
5944 goto L148;
5945 phc_check_invariants (TSRMLS_C);
5947 // L148:
5948 L148:;
5949 // $TLE31 = wfsetvar($TMIt111, $t);
5951 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 66 TSRMLS_CC);
5952 zend_function* signature = wfsetvar_fcic.function_handler;
5953 zend_arg_info* arg_info = signature->common.arg_info; // optional
5955 int by_ref[2];
5956 int abr_index = 0;
5957 // TODO: find names to replace index
5958 if (arg_info)
5960 by_ref[abr_index] = arg_info->pass_by_reference;
5961 arg_info++;
5963 else
5964 by_ref[abr_index] = signature->common.pass_rest_by_reference;
5966 abr_index++;
5967 // TODO: find names to replace index
5968 if (arg_info)
5970 by_ref[abr_index] = arg_info->pass_by_reference;
5971 arg_info++;
5973 else
5974 by_ref[abr_index] = signature->common.pass_rest_by_reference;
5976 abr_index++;
5979 // Setup array of arguments
5980 // TODO: i think arrays of size 0 is an error
5981 int destruct [2];
5982 zval* args [2];
5983 zval** args_ind [2];
5985 int af_index = 0;
5986 destruct[af_index] = 0;
5987 if (by_ref[af_index])
5989 if (local_TMIt111 == NULL)
5991 local_TMIt111 = EG (uninitialized_zval_ptr);
5992 local_TMIt111->refcount++;
5994 zval** p_arg = &local_TMIt111;
5996 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
5997 assert (!in_copy_on_write (*args_ind[af_index]));
5998 args[af_index] = *args_ind[af_index];
6000 else
6002 zval* arg;
6003 if (local_TMIt111 == NULL)
6004 arg = EG (uninitialized_zval_ptr);
6005 else
6006 arg = local_TMIt111;
6008 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
6009 args_ind[af_index] = &args[af_index];
6011 af_index++;
6012 destruct[af_index] = 0;
6013 if (by_ref[af_index])
6015 if (local_t == NULL)
6017 local_t = EG (uninitialized_zval_ptr);
6018 local_t->refcount++;
6020 zval** p_arg = &local_t;
6022 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
6023 assert (!in_copy_on_write (*args_ind[af_index]));
6024 args[af_index] = *args_ind[af_index];
6026 else
6028 zval* arg;
6029 if (local_t == NULL)
6030 arg = EG (uninitialized_zval_ptr);
6031 else
6032 arg = local_t;
6034 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
6035 args_ind[af_index] = &args[af_index];
6037 af_index++;
6040 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 66, NULL TSRMLS_CC);
6042 // save existing parameters, in case of recursion
6043 int param_count_save = wfsetvar_fci.param_count;
6044 zval*** params_save = wfsetvar_fci.params;
6045 zval** retval_save = wfsetvar_fci.retval_ptr_ptr;
6047 zval* rhs = NULL;
6049 // set up params
6050 wfsetvar_fci.params = args_ind;
6051 wfsetvar_fci.param_count = 2;
6052 wfsetvar_fci.retval_ptr_ptr = &rhs;
6054 // call the function
6055 int success = zend_call_function (&wfsetvar_fci, &wfsetvar_fcic TSRMLS_CC);
6056 assert(success == SUCCESS);
6058 // restore params
6059 wfsetvar_fci.params = params_save;
6060 wfsetvar_fci.param_count = param_count_save;
6061 wfsetvar_fci.retval_ptr_ptr = retval_save;
6063 // unset the errors
6064 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
6066 int i;
6067 for (i = 0; i < 2; i++)
6069 if (destruct[i])
6071 assert (destruct[i]);
6072 zval_ptr_dtor (args_ind[i]);
6077 // When the Zend engine returns by reference, it allocates a zval into
6078 // retval_ptr_ptr. To return by reference, the callee writes into the
6079 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
6080 // not actually return anything). So the zval returned - whether we return
6081 // it, or it is the allocated zval - has a refcount of 1.
6083 // The caller is responsible for cleaning that up (note, this is unaffected
6084 // by whether it is added to some COW set).
6086 // For reasons unknown, the Zend API resets the refcount and is_ref fields
6087 // of the return value after the function returns (unless the callee is
6088 // interpreted). If the function is supposed to return by reference, this
6089 // loses the refcount. This only happens when non-interpreted code is
6090 // called. We work around it, when compiled code is called, by saving the
6091 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
6092 // that we may create an error if our code is called by a callback, and
6093 // returns by reference, and the callback returns by reference. At least
6094 // this is an obscure case.
6095 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
6097 assert (rhs != EG(uninitialized_zval_ptr));
6098 rhs->is_ref = 1;
6099 if (saved_refcount != 0)
6101 rhs->refcount = saved_refcount;
6103 rhs->refcount++;
6105 saved_refcount = 0; // for 'obscure cases'
6107 if (local_TLE31 == NULL)
6109 local_TLE31 = EG (uninitialized_zval_ptr);
6110 local_TLE31->refcount++;
6112 zval** p_lhs = &local_TLE31;
6114 write_var (p_lhs, rhs);
6117 zval_ptr_dtor (&rhs);
6118 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
6119 zval_ptr_dtor (&rhs);
6121 phc_check_invariants (TSRMLS_C);
6123 // return $TLE31;
6125 zval* rhs;
6126 if (local_TLE31 == NULL)
6127 rhs = EG (uninitialized_zval_ptr);
6128 else
6129 rhs = local_TLE31;
6131 // Run-time return by reference has different semantics to compile-time.
6132 // If the function has CTRBR and RTRBR, the the assignment will be
6133 // reference. If one or the other is return-by-copy, the result will be
6134 // by copy. Its a question of whether its separated at return-time (which
6135 // we do here) or at the call-site.
6136 return_value->value = rhs->value;
6137 return_value->type = rhs->type;
6138 zval_copy_ctor (return_value);
6139 goto end_of_function;
6140 phc_check_invariants (TSRMLS_C);
6142 // Method exit
6143 end_of_function:__attribute__((unused));
6144 if (local_TLE112 != NULL)
6146 zval_ptr_dtor (&local_TLE112);
6148 if (local_TLE31 != NULL)
6150 zval_ptr_dtor (&local_TLE31);
6152 if (local_TMIt111 != NULL)
6154 zval_ptr_dtor (&local_TMIt111);
6156 if (local_t != NULL)
6158 zval_ptr_dtor (&local_t);
6161 // function settitletext($t)
6162 // {
6163 // $TLE114 = param_is_ref (NULL, "wfsetvar", 0);
6164 // ;
6165 // if (TLE114) goto L149 else goto L150;
6166 // L149:
6167 // $TMIt113 =& $this->mTitleText;
6168 // goto L151;
6169 // L150:
6170 // $TMIt113 = $this->mTitleText;
6171 // goto L151;
6172 // L151:
6173 // $TLE32 = wfsetvar($TMIt113, $t);
6174 // return $TLE32;
6175 // }
6176 PHP_METHOD(ParserOutput, settitletext)
6178 zval* local_TLE114 = NULL;
6179 zval* local_TLE32 = NULL;
6180 zval* local_TMIt113 = NULL;
6181 zval* local_t = NULL;
6182 zval* local_this = getThis();
6183 // Add all parameters as local variables
6185 int num_args = ZEND_NUM_ARGS ();
6186 zval* params[1];
6187 zend_get_parameters_array(0, num_args, params);
6188 // param 0
6189 params[0]->refcount++;
6190 if (local_t != NULL)
6192 zval_ptr_dtor (&local_t);
6194 local_t = params[0];
6196 // Function body
6197 // $TLE114 = param_is_ref (NULL, "wfsetvar", 0);
6198 // ;
6200 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "<unknown>", 0 TSRMLS_CC);
6201 zend_function* signature = wfsetvar_fcic.function_handler;
6202 zend_arg_info* arg_info = signature->common.arg_info;
6203 int count = 0;
6204 while (arg_info && count < 0)
6206 count++;
6207 arg_info++;
6210 if (local_TLE114 == NULL)
6212 local_TLE114 = EG (uninitialized_zval_ptr);
6213 local_TLE114->refcount++;
6215 zval** p_lhs = &local_TLE114;
6217 zval* rhs;
6218 ALLOC_INIT_ZVAL (rhs);
6219 if (arg_info && count == 0)
6221 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
6223 else
6225 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
6227 write_var (p_lhs, rhs);
6228 zval_ptr_dtor (&rhs);
6229 phc_check_invariants (TSRMLS_C);
6231 // if (TLE114) goto L149 else goto L150;
6233 zval* p_cond;
6234 if (local_TLE114 == NULL)
6235 p_cond = EG (uninitialized_zval_ptr);
6236 else
6237 p_cond = local_TLE114;
6239 zend_bool bcond = zend_is_true (p_cond);
6240 if (bcond)
6241 goto L149;
6242 else
6243 goto L150;
6244 phc_check_invariants (TSRMLS_C);
6246 // L149:
6247 L149:;
6248 // $TMIt113 =& $this->mTitleText;
6250 if (local_this == NULL)
6252 local_this = EG (uninitialized_zval_ptr);
6253 local_this->refcount++;
6255 zval** p_obj = &local_this;
6257 zval field_name;
6258 INIT_ZVAL (field_name);
6259 ZVAL_STRING (&field_name, "mTitleText", 0);
6261 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
6262 sep_copy_on_write (field);
6263 if (local_TMIt113 == NULL)
6265 local_TMIt113 = EG (uninitialized_zval_ptr);
6266 local_TMIt113->refcount++;
6268 zval** p_lhs = &local_TMIt113;
6270 copy_into_ref (p_lhs, field);
6271 phc_check_invariants (TSRMLS_C);
6273 // goto L151;
6275 goto L151;
6276 phc_check_invariants (TSRMLS_C);
6278 // L150:
6279 L150:;
6280 // $TMIt113 = $this->mTitleText;
6282 if (local_this == NULL)
6284 local_this = EG (uninitialized_zval_ptr);
6285 local_this->refcount++;
6287 zval** p_obj = &local_this;
6289 zval field_name;
6290 INIT_ZVAL (field_name);
6291 ZVAL_STRING (&field_name, "mTitleText", 0);
6293 // I *think* this is correct, but documentation of the Zend API is scarce :)
6294 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
6295 if (local_TMIt113 == NULL)
6297 local_TMIt113 = EG (uninitialized_zval_ptr);
6298 local_TMIt113->refcount++;
6300 zval** p_lhs = &local_TMIt113;
6302 write_var (p_lhs, field);
6303 phc_check_invariants (TSRMLS_C);
6305 // goto L151;
6307 goto L151;
6308 phc_check_invariants (TSRMLS_C);
6310 // L151:
6311 L151:;
6312 // $TLE32 = wfsetvar($TMIt113, $t);
6314 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 67 TSRMLS_CC);
6315 zend_function* signature = wfsetvar_fcic.function_handler;
6316 zend_arg_info* arg_info = signature->common.arg_info; // optional
6318 int by_ref[2];
6319 int abr_index = 0;
6320 // TODO: find names to replace index
6321 if (arg_info)
6323 by_ref[abr_index] = arg_info->pass_by_reference;
6324 arg_info++;
6326 else
6327 by_ref[abr_index] = signature->common.pass_rest_by_reference;
6329 abr_index++;
6330 // TODO: find names to replace index
6331 if (arg_info)
6333 by_ref[abr_index] = arg_info->pass_by_reference;
6334 arg_info++;
6336 else
6337 by_ref[abr_index] = signature->common.pass_rest_by_reference;
6339 abr_index++;
6342 // Setup array of arguments
6343 // TODO: i think arrays of size 0 is an error
6344 int destruct [2];
6345 zval* args [2];
6346 zval** args_ind [2];
6348 int af_index = 0;
6349 destruct[af_index] = 0;
6350 if (by_ref[af_index])
6352 if (local_TMIt113 == NULL)
6354 local_TMIt113 = EG (uninitialized_zval_ptr);
6355 local_TMIt113->refcount++;
6357 zval** p_arg = &local_TMIt113;
6359 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
6360 assert (!in_copy_on_write (*args_ind[af_index]));
6361 args[af_index] = *args_ind[af_index];
6363 else
6365 zval* arg;
6366 if (local_TMIt113 == NULL)
6367 arg = EG (uninitialized_zval_ptr);
6368 else
6369 arg = local_TMIt113;
6371 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
6372 args_ind[af_index] = &args[af_index];
6374 af_index++;
6375 destruct[af_index] = 0;
6376 if (by_ref[af_index])
6378 if (local_t == NULL)
6380 local_t = EG (uninitialized_zval_ptr);
6381 local_t->refcount++;
6383 zval** p_arg = &local_t;
6385 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
6386 assert (!in_copy_on_write (*args_ind[af_index]));
6387 args[af_index] = *args_ind[af_index];
6389 else
6391 zval* arg;
6392 if (local_t == NULL)
6393 arg = EG (uninitialized_zval_ptr);
6394 else
6395 arg = local_t;
6397 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
6398 args_ind[af_index] = &args[af_index];
6400 af_index++;
6403 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 67, NULL TSRMLS_CC);
6405 // save existing parameters, in case of recursion
6406 int param_count_save = wfsetvar_fci.param_count;
6407 zval*** params_save = wfsetvar_fci.params;
6408 zval** retval_save = wfsetvar_fci.retval_ptr_ptr;
6410 zval* rhs = NULL;
6412 // set up params
6413 wfsetvar_fci.params = args_ind;
6414 wfsetvar_fci.param_count = 2;
6415 wfsetvar_fci.retval_ptr_ptr = &rhs;
6417 // call the function
6418 int success = zend_call_function (&wfsetvar_fci, &wfsetvar_fcic TSRMLS_CC);
6419 assert(success == SUCCESS);
6421 // restore params
6422 wfsetvar_fci.params = params_save;
6423 wfsetvar_fci.param_count = param_count_save;
6424 wfsetvar_fci.retval_ptr_ptr = retval_save;
6426 // unset the errors
6427 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
6429 int i;
6430 for (i = 0; i < 2; i++)
6432 if (destruct[i])
6434 assert (destruct[i]);
6435 zval_ptr_dtor (args_ind[i]);
6440 // When the Zend engine returns by reference, it allocates a zval into
6441 // retval_ptr_ptr. To return by reference, the callee writes into the
6442 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
6443 // not actually return anything). So the zval returned - whether we return
6444 // it, or it is the allocated zval - has a refcount of 1.
6446 // The caller is responsible for cleaning that up (note, this is unaffected
6447 // by whether it is added to some COW set).
6449 // For reasons unknown, the Zend API resets the refcount and is_ref fields
6450 // of the return value after the function returns (unless the callee is
6451 // interpreted). If the function is supposed to return by reference, this
6452 // loses the refcount. This only happens when non-interpreted code is
6453 // called. We work around it, when compiled code is called, by saving the
6454 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
6455 // that we may create an error if our code is called by a callback, and
6456 // returns by reference, and the callback returns by reference. At least
6457 // this is an obscure case.
6458 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
6460 assert (rhs != EG(uninitialized_zval_ptr));
6461 rhs->is_ref = 1;
6462 if (saved_refcount != 0)
6464 rhs->refcount = saved_refcount;
6466 rhs->refcount++;
6468 saved_refcount = 0; // for 'obscure cases'
6470 if (local_TLE32 == NULL)
6472 local_TLE32 = EG (uninitialized_zval_ptr);
6473 local_TLE32->refcount++;
6475 zval** p_lhs = &local_TLE32;
6477 write_var (p_lhs, rhs);
6480 zval_ptr_dtor (&rhs);
6481 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
6482 zval_ptr_dtor (&rhs);
6484 phc_check_invariants (TSRMLS_C);
6486 // return $TLE32;
6488 zval* rhs;
6489 if (local_TLE32 == NULL)
6490 rhs = EG (uninitialized_zval_ptr);
6491 else
6492 rhs = local_TLE32;
6494 // Run-time return by reference has different semantics to compile-time.
6495 // If the function has CTRBR and RTRBR, the the assignment will be
6496 // reference. If one or the other is return-by-copy, the result will be
6497 // by copy. Its a question of whether its separated at return-time (which
6498 // we do here) or at the call-site.
6499 return_value->value = rhs->value;
6500 return_value->type = rhs->type;
6501 zval_copy_ctor (return_value);
6502 goto end_of_function;
6503 phc_check_invariants (TSRMLS_C);
6505 // Method exit
6506 end_of_function:__attribute__((unused));
6507 if (local_TLE114 != NULL)
6509 zval_ptr_dtor (&local_TLE114);
6511 if (local_TLE32 != NULL)
6513 zval_ptr_dtor (&local_TLE32);
6515 if (local_TMIt113 != NULL)
6517 zval_ptr_dtor (&local_TMIt113);
6519 if (local_t != NULL)
6521 zval_ptr_dtor (&local_t);
6524 // function setsections($toc)
6525 // {
6526 // $TLE116 = param_is_ref (NULL, "wfsetvar", 0);
6527 // ;
6528 // if (TLE116) goto L152 else goto L153;
6529 // L152:
6530 // $TMIt115 =& $this->mSections;
6531 // goto L154;
6532 // L153:
6533 // $TMIt115 = $this->mSections;
6534 // goto L154;
6535 // L154:
6536 // $TLE33 = wfsetvar($TMIt115, $toc);
6537 // return $TLE33;
6538 // }
6539 PHP_METHOD(ParserOutput, setsections)
6541 zval* local_TLE116 = NULL;
6542 zval* local_TLE33 = NULL;
6543 zval* local_TMIt115 = NULL;
6544 zval* local_this = getThis();
6545 zval* local_toc = NULL;
6546 // Add all parameters as local variables
6548 int num_args = ZEND_NUM_ARGS ();
6549 zval* params[1];
6550 zend_get_parameters_array(0, num_args, params);
6551 // param 0
6552 params[0]->refcount++;
6553 if (local_toc != NULL)
6555 zval_ptr_dtor (&local_toc);
6557 local_toc = params[0];
6559 // Function body
6560 // $TLE116 = param_is_ref (NULL, "wfsetvar", 0);
6561 // ;
6563 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "<unknown>", 0 TSRMLS_CC);
6564 zend_function* signature = wfsetvar_fcic.function_handler;
6565 zend_arg_info* arg_info = signature->common.arg_info;
6566 int count = 0;
6567 while (arg_info && count < 0)
6569 count++;
6570 arg_info++;
6573 if (local_TLE116 == NULL)
6575 local_TLE116 = EG (uninitialized_zval_ptr);
6576 local_TLE116->refcount++;
6578 zval** p_lhs = &local_TLE116;
6580 zval* rhs;
6581 ALLOC_INIT_ZVAL (rhs);
6582 if (arg_info && count == 0)
6584 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
6586 else
6588 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
6590 write_var (p_lhs, rhs);
6591 zval_ptr_dtor (&rhs);
6592 phc_check_invariants (TSRMLS_C);
6594 // if (TLE116) goto L152 else goto L153;
6596 zval* p_cond;
6597 if (local_TLE116 == NULL)
6598 p_cond = EG (uninitialized_zval_ptr);
6599 else
6600 p_cond = local_TLE116;
6602 zend_bool bcond = zend_is_true (p_cond);
6603 if (bcond)
6604 goto L152;
6605 else
6606 goto L153;
6607 phc_check_invariants (TSRMLS_C);
6609 // L152:
6610 L152:;
6611 // $TMIt115 =& $this->mSections;
6613 if (local_this == NULL)
6615 local_this = EG (uninitialized_zval_ptr);
6616 local_this->refcount++;
6618 zval** p_obj = &local_this;
6620 zval field_name;
6621 INIT_ZVAL (field_name);
6622 ZVAL_STRING (&field_name, "mSections", 0);
6624 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
6625 sep_copy_on_write (field);
6626 if (local_TMIt115 == NULL)
6628 local_TMIt115 = EG (uninitialized_zval_ptr);
6629 local_TMIt115->refcount++;
6631 zval** p_lhs = &local_TMIt115;
6633 copy_into_ref (p_lhs, field);
6634 phc_check_invariants (TSRMLS_C);
6636 // goto L154;
6638 goto L154;
6639 phc_check_invariants (TSRMLS_C);
6641 // L153:
6642 L153:;
6643 // $TMIt115 = $this->mSections;
6645 if (local_this == NULL)
6647 local_this = EG (uninitialized_zval_ptr);
6648 local_this->refcount++;
6650 zval** p_obj = &local_this;
6652 zval field_name;
6653 INIT_ZVAL (field_name);
6654 ZVAL_STRING (&field_name, "mSections", 0);
6656 // I *think* this is correct, but documentation of the Zend API is scarce :)
6657 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
6658 if (local_TMIt115 == NULL)
6660 local_TMIt115 = EG (uninitialized_zval_ptr);
6661 local_TMIt115->refcount++;
6663 zval** p_lhs = &local_TMIt115;
6665 write_var (p_lhs, field);
6666 phc_check_invariants (TSRMLS_C);
6668 // goto L154;
6670 goto L154;
6671 phc_check_invariants (TSRMLS_C);
6673 // L154:
6674 L154:;
6675 // $TLE33 = wfsetvar($TMIt115, $toc);
6677 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 68 TSRMLS_CC);
6678 zend_function* signature = wfsetvar_fcic.function_handler;
6679 zend_arg_info* arg_info = signature->common.arg_info; // optional
6681 int by_ref[2];
6682 int abr_index = 0;
6683 // TODO: find names to replace index
6684 if (arg_info)
6686 by_ref[abr_index] = arg_info->pass_by_reference;
6687 arg_info++;
6689 else
6690 by_ref[abr_index] = signature->common.pass_rest_by_reference;
6692 abr_index++;
6693 // TODO: find names to replace index
6694 if (arg_info)
6696 by_ref[abr_index] = arg_info->pass_by_reference;
6697 arg_info++;
6699 else
6700 by_ref[abr_index] = signature->common.pass_rest_by_reference;
6702 abr_index++;
6705 // Setup array of arguments
6706 // TODO: i think arrays of size 0 is an error
6707 int destruct [2];
6708 zval* args [2];
6709 zval** args_ind [2];
6711 int af_index = 0;
6712 destruct[af_index] = 0;
6713 if (by_ref[af_index])
6715 if (local_TMIt115 == NULL)
6717 local_TMIt115 = EG (uninitialized_zval_ptr);
6718 local_TMIt115->refcount++;
6720 zval** p_arg = &local_TMIt115;
6722 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
6723 assert (!in_copy_on_write (*args_ind[af_index]));
6724 args[af_index] = *args_ind[af_index];
6726 else
6728 zval* arg;
6729 if (local_TMIt115 == NULL)
6730 arg = EG (uninitialized_zval_ptr);
6731 else
6732 arg = local_TMIt115;
6734 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
6735 args_ind[af_index] = &args[af_index];
6737 af_index++;
6738 destruct[af_index] = 0;
6739 if (by_ref[af_index])
6741 if (local_toc == NULL)
6743 local_toc = EG (uninitialized_zval_ptr);
6744 local_toc->refcount++;
6746 zval** p_arg = &local_toc;
6748 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
6749 assert (!in_copy_on_write (*args_ind[af_index]));
6750 args[af_index] = *args_ind[af_index];
6752 else
6754 zval* arg;
6755 if (local_toc == NULL)
6756 arg = EG (uninitialized_zval_ptr);
6757 else
6758 arg = local_toc;
6760 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
6761 args_ind[af_index] = &args[af_index];
6763 af_index++;
6766 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 68, NULL TSRMLS_CC);
6768 // save existing parameters, in case of recursion
6769 int param_count_save = wfsetvar_fci.param_count;
6770 zval*** params_save = wfsetvar_fci.params;
6771 zval** retval_save = wfsetvar_fci.retval_ptr_ptr;
6773 zval* rhs = NULL;
6775 // set up params
6776 wfsetvar_fci.params = args_ind;
6777 wfsetvar_fci.param_count = 2;
6778 wfsetvar_fci.retval_ptr_ptr = &rhs;
6780 // call the function
6781 int success = zend_call_function (&wfsetvar_fci, &wfsetvar_fcic TSRMLS_CC);
6782 assert(success == SUCCESS);
6784 // restore params
6785 wfsetvar_fci.params = params_save;
6786 wfsetvar_fci.param_count = param_count_save;
6787 wfsetvar_fci.retval_ptr_ptr = retval_save;
6789 // unset the errors
6790 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
6792 int i;
6793 for (i = 0; i < 2; i++)
6795 if (destruct[i])
6797 assert (destruct[i]);
6798 zval_ptr_dtor (args_ind[i]);
6803 // When the Zend engine returns by reference, it allocates a zval into
6804 // retval_ptr_ptr. To return by reference, the callee writes into the
6805 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
6806 // not actually return anything). So the zval returned - whether we return
6807 // it, or it is the allocated zval - has a refcount of 1.
6809 // The caller is responsible for cleaning that up (note, this is unaffected
6810 // by whether it is added to some COW set).
6812 // For reasons unknown, the Zend API resets the refcount and is_ref fields
6813 // of the return value after the function returns (unless the callee is
6814 // interpreted). If the function is supposed to return by reference, this
6815 // loses the refcount. This only happens when non-interpreted code is
6816 // called. We work around it, when compiled code is called, by saving the
6817 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
6818 // that we may create an error if our code is called by a callback, and
6819 // returns by reference, and the callback returns by reference. At least
6820 // this is an obscure case.
6821 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
6823 assert (rhs != EG(uninitialized_zval_ptr));
6824 rhs->is_ref = 1;
6825 if (saved_refcount != 0)
6827 rhs->refcount = saved_refcount;
6829 rhs->refcount++;
6831 saved_refcount = 0; // for 'obscure cases'
6833 if (local_TLE33 == NULL)
6835 local_TLE33 = EG (uninitialized_zval_ptr);
6836 local_TLE33->refcount++;
6838 zval** p_lhs = &local_TLE33;
6840 write_var (p_lhs, rhs);
6843 zval_ptr_dtor (&rhs);
6844 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
6845 zval_ptr_dtor (&rhs);
6847 phc_check_invariants (TSRMLS_C);
6849 // return $TLE33;
6851 zval* rhs;
6852 if (local_TLE33 == NULL)
6853 rhs = EG (uninitialized_zval_ptr);
6854 else
6855 rhs = local_TLE33;
6857 // Run-time return by reference has different semantics to compile-time.
6858 // If the function has CTRBR and RTRBR, the the assignment will be
6859 // reference. If one or the other is return-by-copy, the result will be
6860 // by copy. Its a question of whether its separated at return-time (which
6861 // we do here) or at the call-site.
6862 return_value->value = rhs->value;
6863 return_value->type = rhs->type;
6864 zval_copy_ctor (return_value);
6865 goto end_of_function;
6866 phc_check_invariants (TSRMLS_C);
6868 // Method exit
6869 end_of_function:__attribute__((unused));
6870 if (local_TLE116 != NULL)
6872 zval_ptr_dtor (&local_TLE116);
6874 if (local_TLE33 != NULL)
6876 zval_ptr_dtor (&local_TLE33);
6878 if (local_TMIt115 != NULL)
6880 zval_ptr_dtor (&local_TMIt115);
6882 if (local_toc != NULL)
6884 zval_ptr_dtor (&local_toc);
6887 // function setindexpolicy($policy)
6888 // {
6889 // $TLE118 = param_is_ref (NULL, "wfsetvar", 0);
6890 // ;
6891 // if (TLE118) goto L155 else goto L156;
6892 // L155:
6893 // $TMIt117 =& $this->mIndexPolicy;
6894 // goto L157;
6895 // L156:
6896 // $TMIt117 = $this->mIndexPolicy;
6897 // goto L157;
6898 // L157:
6899 // $TLE34 = wfsetvar($TMIt117, $policy);
6900 // return $TLE34;
6901 // }
6902 PHP_METHOD(ParserOutput, setindexpolicy)
6904 zval* local_TLE118 = NULL;
6905 zval* local_TLE34 = NULL;
6906 zval* local_TMIt117 = NULL;
6907 zval* local_policy = NULL;
6908 zval* local_this = getThis();
6909 // Add all parameters as local variables
6911 int num_args = ZEND_NUM_ARGS ();
6912 zval* params[1];
6913 zend_get_parameters_array(0, num_args, params);
6914 // param 0
6915 params[0]->refcount++;
6916 if (local_policy != NULL)
6918 zval_ptr_dtor (&local_policy);
6920 local_policy = params[0];
6922 // Function body
6923 // $TLE118 = param_is_ref (NULL, "wfsetvar", 0);
6924 // ;
6926 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "<unknown>", 0 TSRMLS_CC);
6927 zend_function* signature = wfsetvar_fcic.function_handler;
6928 zend_arg_info* arg_info = signature->common.arg_info;
6929 int count = 0;
6930 while (arg_info && count < 0)
6932 count++;
6933 arg_info++;
6936 if (local_TLE118 == NULL)
6938 local_TLE118 = EG (uninitialized_zval_ptr);
6939 local_TLE118->refcount++;
6941 zval** p_lhs = &local_TLE118;
6943 zval* rhs;
6944 ALLOC_INIT_ZVAL (rhs);
6945 if (arg_info && count == 0)
6947 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
6949 else
6951 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
6953 write_var (p_lhs, rhs);
6954 zval_ptr_dtor (&rhs);
6955 phc_check_invariants (TSRMLS_C);
6957 // if (TLE118) goto L155 else goto L156;
6959 zval* p_cond;
6960 if (local_TLE118 == NULL)
6961 p_cond = EG (uninitialized_zval_ptr);
6962 else
6963 p_cond = local_TLE118;
6965 zend_bool bcond = zend_is_true (p_cond);
6966 if (bcond)
6967 goto L155;
6968 else
6969 goto L156;
6970 phc_check_invariants (TSRMLS_C);
6972 // L155:
6973 L155:;
6974 // $TMIt117 =& $this->mIndexPolicy;
6976 if (local_this == NULL)
6978 local_this = EG (uninitialized_zval_ptr);
6979 local_this->refcount++;
6981 zval** p_obj = &local_this;
6983 zval field_name;
6984 INIT_ZVAL (field_name);
6985 ZVAL_STRING (&field_name, "mIndexPolicy", 0);
6987 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
6988 sep_copy_on_write (field);
6989 if (local_TMIt117 == NULL)
6991 local_TMIt117 = EG (uninitialized_zval_ptr);
6992 local_TMIt117->refcount++;
6994 zval** p_lhs = &local_TMIt117;
6996 copy_into_ref (p_lhs, field);
6997 phc_check_invariants (TSRMLS_C);
6999 // goto L157;
7001 goto L157;
7002 phc_check_invariants (TSRMLS_C);
7004 // L156:
7005 L156:;
7006 // $TMIt117 = $this->mIndexPolicy;
7008 if (local_this == NULL)
7010 local_this = EG (uninitialized_zval_ptr);
7011 local_this->refcount++;
7013 zval** p_obj = &local_this;
7015 zval field_name;
7016 INIT_ZVAL (field_name);
7017 ZVAL_STRING (&field_name, "mIndexPolicy", 0);
7019 // I *think* this is correct, but documentation of the Zend API is scarce :)
7020 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
7021 if (local_TMIt117 == NULL)
7023 local_TMIt117 = EG (uninitialized_zval_ptr);
7024 local_TMIt117->refcount++;
7026 zval** p_lhs = &local_TMIt117;
7028 write_var (p_lhs, field);
7029 phc_check_invariants (TSRMLS_C);
7031 // goto L157;
7033 goto L157;
7034 phc_check_invariants (TSRMLS_C);
7036 // L157:
7037 L157:;
7038 // $TLE34 = wfsetvar($TMIt117, $policy);
7040 initialize_function_call (&wfsetvar_fci, &wfsetvar_fcic, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 69 TSRMLS_CC);
7041 zend_function* signature = wfsetvar_fcic.function_handler;
7042 zend_arg_info* arg_info = signature->common.arg_info; // optional
7044 int by_ref[2];
7045 int abr_index = 0;
7046 // TODO: find names to replace index
7047 if (arg_info)
7049 by_ref[abr_index] = arg_info->pass_by_reference;
7050 arg_info++;
7052 else
7053 by_ref[abr_index] = signature->common.pass_rest_by_reference;
7055 abr_index++;
7056 // TODO: find names to replace index
7057 if (arg_info)
7059 by_ref[abr_index] = arg_info->pass_by_reference;
7060 arg_info++;
7062 else
7063 by_ref[abr_index] = signature->common.pass_rest_by_reference;
7065 abr_index++;
7068 // Setup array of arguments
7069 // TODO: i think arrays of size 0 is an error
7070 int destruct [2];
7071 zval* args [2];
7072 zval** args_ind [2];
7074 int af_index = 0;
7075 destruct[af_index] = 0;
7076 if (by_ref[af_index])
7078 if (local_TMIt117 == NULL)
7080 local_TMIt117 = EG (uninitialized_zval_ptr);
7081 local_TMIt117->refcount++;
7083 zval** p_arg = &local_TMIt117;
7085 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
7086 assert (!in_copy_on_write (*args_ind[af_index]));
7087 args[af_index] = *args_ind[af_index];
7089 else
7091 zval* arg;
7092 if (local_TMIt117 == NULL)
7093 arg = EG (uninitialized_zval_ptr);
7094 else
7095 arg = local_TMIt117;
7097 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
7098 args_ind[af_index] = &args[af_index];
7100 af_index++;
7101 destruct[af_index] = 0;
7102 if (by_ref[af_index])
7104 if (local_policy == NULL)
7106 local_policy = EG (uninitialized_zval_ptr);
7107 local_policy->refcount++;
7109 zval** p_arg = &local_policy;
7111 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
7112 assert (!in_copy_on_write (*args_ind[af_index]));
7113 args[af_index] = *args_ind[af_index];
7115 else
7117 zval* arg;
7118 if (local_policy == NULL)
7119 arg = EG (uninitialized_zval_ptr);
7120 else
7121 arg = local_policy;
7123 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
7124 args_ind[af_index] = &args[af_index];
7126 af_index++;
7129 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 69, NULL TSRMLS_CC);
7131 // save existing parameters, in case of recursion
7132 int param_count_save = wfsetvar_fci.param_count;
7133 zval*** params_save = wfsetvar_fci.params;
7134 zval** retval_save = wfsetvar_fci.retval_ptr_ptr;
7136 zval* rhs = NULL;
7138 // set up params
7139 wfsetvar_fci.params = args_ind;
7140 wfsetvar_fci.param_count = 2;
7141 wfsetvar_fci.retval_ptr_ptr = &rhs;
7143 // call the function
7144 int success = zend_call_function (&wfsetvar_fci, &wfsetvar_fcic TSRMLS_CC);
7145 assert(success == SUCCESS);
7147 // restore params
7148 wfsetvar_fci.params = params_save;
7149 wfsetvar_fci.param_count = param_count_save;
7150 wfsetvar_fci.retval_ptr_ptr = retval_save;
7152 // unset the errors
7153 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
7155 int i;
7156 for (i = 0; i < 2; i++)
7158 if (destruct[i])
7160 assert (destruct[i]);
7161 zval_ptr_dtor (args_ind[i]);
7166 // When the Zend engine returns by reference, it allocates a zval into
7167 // retval_ptr_ptr. To return by reference, the callee writes into the
7168 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
7169 // not actually return anything). So the zval returned - whether we return
7170 // it, or it is the allocated zval - has a refcount of 1.
7172 // The caller is responsible for cleaning that up (note, this is unaffected
7173 // by whether it is added to some COW set).
7175 // For reasons unknown, the Zend API resets the refcount and is_ref fields
7176 // of the return value after the function returns (unless the callee is
7177 // interpreted). If the function is supposed to return by reference, this
7178 // loses the refcount. This only happens when non-interpreted code is
7179 // called. We work around it, when compiled code is called, by saving the
7180 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
7181 // that we may create an error if our code is called by a callback, and
7182 // returns by reference, and the callback returns by reference. At least
7183 // this is an obscure case.
7184 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
7186 assert (rhs != EG(uninitialized_zval_ptr));
7187 rhs->is_ref = 1;
7188 if (saved_refcount != 0)
7190 rhs->refcount = saved_refcount;
7192 rhs->refcount++;
7194 saved_refcount = 0; // for 'obscure cases'
7196 if (local_TLE34 == NULL)
7198 local_TLE34 = EG (uninitialized_zval_ptr);
7199 local_TLE34->refcount++;
7201 zval** p_lhs = &local_TLE34;
7203 write_var (p_lhs, rhs);
7206 zval_ptr_dtor (&rhs);
7207 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
7208 zval_ptr_dtor (&rhs);
7210 phc_check_invariants (TSRMLS_C);
7212 // return $TLE34;
7214 zval* rhs;
7215 if (local_TLE34 == NULL)
7216 rhs = EG (uninitialized_zval_ptr);
7217 else
7218 rhs = local_TLE34;
7220 // Run-time return by reference has different semantics to compile-time.
7221 // If the function has CTRBR and RTRBR, the the assignment will be
7222 // reference. If one or the other is return-by-copy, the result will be
7223 // by copy. Its a question of whether its separated at return-time (which
7224 // we do here) or at the call-site.
7225 return_value->value = rhs->value;
7226 return_value->type = rhs->type;
7227 zval_copy_ctor (return_value);
7228 goto end_of_function;
7229 phc_check_invariants (TSRMLS_C);
7231 // Method exit
7232 end_of_function:__attribute__((unused));
7233 if (local_TLE118 != NULL)
7235 zval_ptr_dtor (&local_TLE118);
7237 if (local_TLE34 != NULL)
7239 zval_ptr_dtor (&local_TLE34);
7241 if (local_TMIt117 != NULL)
7243 zval_ptr_dtor (&local_TMIt117);
7245 if (local_policy != NULL)
7247 zval_ptr_dtor (&local_policy);
7250 // function addcategory($c, $sort)
7251 // {
7252 // $TSt35 =& $this->mCategories;
7253 // $TSt35[$c] = $sort;
7254 // }
7255 PHP_METHOD(ParserOutput, addcategory)
7257 zval* local_TSt35 = NULL;
7258 zval* local_c = NULL;
7259 zval* local_sort = NULL;
7260 zval* local_this = getThis();
7261 // Add all parameters as local variables
7263 int num_args = ZEND_NUM_ARGS ();
7264 zval* params[2];
7265 zend_get_parameters_array(0, num_args, params);
7266 // param 0
7267 params[0]->refcount++;
7268 if (local_c != NULL)
7270 zval_ptr_dtor (&local_c);
7272 local_c = params[0];
7273 // param 1
7274 params[1]->refcount++;
7275 if (local_sort != NULL)
7277 zval_ptr_dtor (&local_sort);
7279 local_sort = params[1];
7281 // Function body
7282 // $TSt35 =& $this->mCategories;
7284 if (local_this == NULL)
7286 local_this = EG (uninitialized_zval_ptr);
7287 local_this->refcount++;
7289 zval** p_obj = &local_this;
7291 zval field_name;
7292 INIT_ZVAL (field_name);
7293 ZVAL_STRING (&field_name, "mCategories", 0);
7295 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
7296 sep_copy_on_write (field);
7297 if (local_TSt35 == NULL)
7299 local_TSt35 = EG (uninitialized_zval_ptr);
7300 local_TSt35->refcount++;
7302 zval** p_lhs = &local_TSt35;
7304 copy_into_ref (p_lhs, field);
7305 phc_check_invariants (TSRMLS_C);
7307 // $TSt35[$c] = $sort;
7309 if (local_TSt35 == NULL)
7311 local_TSt35 = EG (uninitialized_zval_ptr);
7312 local_TSt35->refcount++;
7314 zval** p_array = &local_TSt35;
7316 check_array_type (p_array TSRMLS_CC);
7318 zval* index;
7319 if (local_c == NULL)
7320 index = EG (uninitialized_zval_ptr);
7321 else
7322 index = local_c;
7325 // String indexing
7326 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
7328 zval* rhs;
7329 if (local_sort == NULL)
7330 rhs = EG (uninitialized_zval_ptr);
7331 else
7332 rhs = local_sort;
7334 write_string_index (p_array, index, rhs TSRMLS_CC);
7336 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
7338 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
7339 zval* rhs;
7340 if (local_sort == NULL)
7341 rhs = EG (uninitialized_zval_ptr);
7342 else
7343 rhs = local_sort;
7345 if (*p_lhs != rhs)
7347 write_var (p_lhs, rhs);
7350 phc_check_invariants (TSRMLS_C);
7352 // Method exit
7353 end_of_function:__attribute__((unused));
7354 if (local_TSt35 != NULL)
7356 zval_ptr_dtor (&local_TSt35);
7358 if (local_c != NULL)
7360 zval_ptr_dtor (&local_c);
7362 if (local_sort != NULL)
7364 zval_ptr_dtor (&local_sort);
7367 // function addlanguagelink($t)
7368 // {
7369 // $TSt36 =& $this->mLanguageLinks;
7370 // $TSt36[] = $t;
7371 // }
7372 PHP_METHOD(ParserOutput, addlanguagelink)
7374 zval* local_TSt36 = NULL;
7375 zval* local_t = NULL;
7376 zval* local_this = getThis();
7377 // Add all parameters as local variables
7379 int num_args = ZEND_NUM_ARGS ();
7380 zval* params[1];
7381 zend_get_parameters_array(0, num_args, params);
7382 // param 0
7383 params[0]->refcount++;
7384 if (local_t != NULL)
7386 zval_ptr_dtor (&local_t);
7388 local_t = params[0];
7390 // Function body
7391 // $TSt36 =& $this->mLanguageLinks;
7393 if (local_this == NULL)
7395 local_this = EG (uninitialized_zval_ptr);
7396 local_this->refcount++;
7398 zval** p_obj = &local_this;
7400 zval field_name;
7401 INIT_ZVAL (field_name);
7402 ZVAL_STRING (&field_name, "mLanguageLinks", 0);
7404 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
7405 sep_copy_on_write (field);
7406 if (local_TSt36 == NULL)
7408 local_TSt36 = EG (uninitialized_zval_ptr);
7409 local_TSt36->refcount++;
7411 zval** p_lhs = &local_TSt36;
7413 copy_into_ref (p_lhs, field);
7414 phc_check_invariants (TSRMLS_C);
7416 // $TSt36[] = $t;
7418 if (local_TSt36 == NULL)
7420 local_TSt36 = EG (uninitialized_zval_ptr);
7421 local_TSt36->refcount++;
7423 zval** p_array = &local_TSt36;
7425 // Push EG(uninit) and get a pointer to the symtable entry
7426 zval** p_lhs = push_and_index_ht (p_array TSRMLS_CC);
7427 if (p_lhs != NULL)
7429 zval* rhs;
7430 if (local_t == NULL)
7431 rhs = EG (uninitialized_zval_ptr);
7432 else
7433 rhs = local_t;
7435 if (*p_lhs != rhs)
7436 write_var (p_lhs, rhs);
7438 // I think if this is NULL, then the LHS is a bool or similar, and you cant
7439 // push onto it.
7440 phc_check_invariants (TSRMLS_C);
7442 // Method exit
7443 end_of_function:__attribute__((unused));
7444 if (local_TSt36 != NULL)
7446 zval_ptr_dtor (&local_TSt36);
7448 if (local_t != NULL)
7450 zval_ptr_dtor (&local_t);
7453 // function addexternallink($url)
7454 // {
7455 // $TSt37 =& $this->mExternalLinks;
7456 // $TLE38 = 1;
7457 // $TSt37[$url] = $TLE38;
7458 // }
7459 PHP_METHOD(ParserOutput, addexternallink)
7461 zval* local_TLE38 = NULL;
7462 zval* local_TSt37 = NULL;
7463 zval* local_this = getThis();
7464 zval* local_url = NULL;
7465 // Add all parameters as local variables
7467 int num_args = ZEND_NUM_ARGS ();
7468 zval* params[1];
7469 zend_get_parameters_array(0, num_args, params);
7470 // param 0
7471 params[0]->refcount++;
7472 if (local_url != NULL)
7474 zval_ptr_dtor (&local_url);
7476 local_url = params[0];
7478 // Function body
7479 // $TSt37 =& $this->mExternalLinks;
7481 if (local_this == NULL)
7483 local_this = EG (uninitialized_zval_ptr);
7484 local_this->refcount++;
7486 zval** p_obj = &local_this;
7488 zval field_name;
7489 INIT_ZVAL (field_name);
7490 ZVAL_STRING (&field_name, "mExternalLinks", 0);
7492 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
7493 sep_copy_on_write (field);
7494 if (local_TSt37 == NULL)
7496 local_TSt37 = EG (uninitialized_zval_ptr);
7497 local_TSt37->refcount++;
7499 zval** p_lhs = &local_TSt37;
7501 copy_into_ref (p_lhs, field);
7502 phc_check_invariants (TSRMLS_C);
7504 // $TLE38 = 1;
7506 if (local_TLE38 == NULL)
7508 local_TLE38 = EG (uninitialized_zval_ptr);
7509 local_TLE38->refcount++;
7511 zval** p_lhs = &local_TLE38;
7513 zval* value;
7514 if ((*p_lhs)->is_ref)
7516 // Always overwrite the current value
7517 value = *p_lhs;
7518 zval_dtor (value);
7520 else
7522 ALLOC_INIT_ZVAL (value);
7523 zval_ptr_dtor (p_lhs);
7524 *p_lhs = value;
7527 ZVAL_LONG (value, 1);
7529 phc_check_invariants (TSRMLS_C);
7531 // $TSt37[$url] = $TLE38;
7533 if (local_TSt37 == NULL)
7535 local_TSt37 = EG (uninitialized_zval_ptr);
7536 local_TSt37->refcount++;
7538 zval** p_array = &local_TSt37;
7540 check_array_type (p_array TSRMLS_CC);
7542 zval* index;
7543 if (local_url == NULL)
7544 index = EG (uninitialized_zval_ptr);
7545 else
7546 index = local_url;
7549 // String indexing
7550 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
7552 zval* rhs;
7553 if (local_TLE38 == NULL)
7554 rhs = EG (uninitialized_zval_ptr);
7555 else
7556 rhs = local_TLE38;
7558 write_string_index (p_array, index, rhs TSRMLS_CC);
7560 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
7562 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
7563 zval* rhs;
7564 if (local_TLE38 == NULL)
7565 rhs = EG (uninitialized_zval_ptr);
7566 else
7567 rhs = local_TLE38;
7569 if (*p_lhs != rhs)
7571 write_var (p_lhs, rhs);
7574 phc_check_invariants (TSRMLS_C);
7576 // Method exit
7577 end_of_function:__attribute__((unused));
7578 if (local_TLE38 != NULL)
7580 zval_ptr_dtor (&local_TLE38);
7582 if (local_TSt37 != NULL)
7584 zval_ptr_dtor (&local_TSt37);
7586 if (local_url != NULL)
7588 zval_ptr_dtor (&local_url);
7591 // function addwarning($s)
7592 // {
7593 // $TSt39 =& $this->mWarnings;
7594 // $TLE40 = 1;
7595 // $TSt39[$s] = $TLE40;
7596 // }
7597 PHP_METHOD(ParserOutput, addwarning)
7599 zval* local_TLE40 = NULL;
7600 zval* local_TSt39 = NULL;
7601 zval* local_s = NULL;
7602 zval* local_this = getThis();
7603 // Add all parameters as local variables
7605 int num_args = ZEND_NUM_ARGS ();
7606 zval* params[1];
7607 zend_get_parameters_array(0, num_args, params);
7608 // param 0
7609 params[0]->refcount++;
7610 if (local_s != NULL)
7612 zval_ptr_dtor (&local_s);
7614 local_s = params[0];
7616 // Function body
7617 // $TSt39 =& $this->mWarnings;
7619 if (local_this == NULL)
7621 local_this = EG (uninitialized_zval_ptr);
7622 local_this->refcount++;
7624 zval** p_obj = &local_this;
7626 zval field_name;
7627 INIT_ZVAL (field_name);
7628 ZVAL_STRING (&field_name, "mWarnings", 0);
7630 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
7631 sep_copy_on_write (field);
7632 if (local_TSt39 == NULL)
7634 local_TSt39 = EG (uninitialized_zval_ptr);
7635 local_TSt39->refcount++;
7637 zval** p_lhs = &local_TSt39;
7639 copy_into_ref (p_lhs, field);
7640 phc_check_invariants (TSRMLS_C);
7642 // $TLE40 = 1;
7644 if (local_TLE40 == NULL)
7646 local_TLE40 = EG (uninitialized_zval_ptr);
7647 local_TLE40->refcount++;
7649 zval** p_lhs = &local_TLE40;
7651 zval* value;
7652 if ((*p_lhs)->is_ref)
7654 // Always overwrite the current value
7655 value = *p_lhs;
7656 zval_dtor (value);
7658 else
7660 ALLOC_INIT_ZVAL (value);
7661 zval_ptr_dtor (p_lhs);
7662 *p_lhs = value;
7665 ZVAL_LONG (value, 1);
7667 phc_check_invariants (TSRMLS_C);
7669 // $TSt39[$s] = $TLE40;
7671 if (local_TSt39 == NULL)
7673 local_TSt39 = EG (uninitialized_zval_ptr);
7674 local_TSt39->refcount++;
7676 zval** p_array = &local_TSt39;
7678 check_array_type (p_array TSRMLS_CC);
7680 zval* index;
7681 if (local_s == NULL)
7682 index = EG (uninitialized_zval_ptr);
7683 else
7684 index = local_s;
7687 // String indexing
7688 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
7690 zval* rhs;
7691 if (local_TLE40 == NULL)
7692 rhs = EG (uninitialized_zval_ptr);
7693 else
7694 rhs = local_TLE40;
7696 write_string_index (p_array, index, rhs TSRMLS_CC);
7698 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
7700 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
7701 zval* rhs;
7702 if (local_TLE40 == NULL)
7703 rhs = EG (uninitialized_zval_ptr);
7704 else
7705 rhs = local_TLE40;
7707 if (*p_lhs != rhs)
7709 write_var (p_lhs, rhs);
7712 phc_check_invariants (TSRMLS_C);
7714 // Method exit
7715 end_of_function:__attribute__((unused));
7716 if (local_TLE40 != NULL)
7718 zval_ptr_dtor (&local_TLE40);
7720 if (local_TSt39 != NULL)
7722 zval_ptr_dtor (&local_TSt39);
7724 if (local_s != NULL)
7726 zval_ptr_dtor (&local_s);
7729 // function addoutputhook($hook, $data = False)
7730 // {
7731 // $TSt41 =& $this->mOutputHooks;
7732 // unset($TSa42);
7733 // $TSa42 = (array) $TSa42;
7734 // $TSa42[] = $hook;
7735 // $TSa42[] = $data;
7736 // $TSt41[] = $TSa42;
7737 // }
7738 PHP_METHOD(ParserOutput, addoutputhook)
7740 zval* local_TSa42 = NULL;
7741 zval* local_TSt41 = NULL;
7742 zval* local_data = NULL;
7743 zval* local_hook = NULL;
7744 zval* local_this = getThis();
7745 // Add all parameters as local variables
7747 int num_args = ZEND_NUM_ARGS ();
7748 zval* params[2];
7749 zend_get_parameters_array(0, num_args, params);
7750 // param 0
7751 params[0]->refcount++;
7752 if (local_hook != NULL)
7754 zval_ptr_dtor (&local_hook);
7756 local_hook = params[0];
7757 // param 1
7758 if (num_args <= 1)
7760 zval* default_value;
7762 zval* local___static_value__ = NULL;
7763 // $__static_value__ = False;
7765 if (local___static_value__ == NULL)
7767 local___static_value__ = EG (uninitialized_zval_ptr);
7768 local___static_value__->refcount++;
7770 zval** p_lhs = &local___static_value__;
7772 zval* value;
7773 if ((*p_lhs)->is_ref)
7775 // Always overwrite the current value
7776 value = *p_lhs;
7777 zval_dtor (value);
7779 else
7781 ALLOC_INIT_ZVAL (value);
7782 zval_ptr_dtor (p_lhs);
7783 *p_lhs = value;
7786 ZVAL_BOOL (value, 0);
7788 phc_check_invariants (TSRMLS_C);
7790 default_value = local___static_value__;
7791 assert(!default_value->is_ref);
7792 default_value->refcount++;
7793 if (local___static_value__ != NULL)
7795 zval_ptr_dtor (&local___static_value__);
7798 default_value->refcount--;
7799 params[1] = default_value;
7801 params[1]->refcount++;
7802 if (local_data != NULL)
7804 zval_ptr_dtor (&local_data);
7806 local_data = params[1];
7808 // Function body
7809 // $TSt41 =& $this->mOutputHooks;
7811 if (local_this == NULL)
7813 local_this = EG (uninitialized_zval_ptr);
7814 local_this->refcount++;
7816 zval** p_obj = &local_this;
7818 zval field_name;
7819 INIT_ZVAL (field_name);
7820 ZVAL_STRING (&field_name, "mOutputHooks", 0);
7822 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
7823 sep_copy_on_write (field);
7824 if (local_TSt41 == NULL)
7826 local_TSt41 = EG (uninitialized_zval_ptr);
7827 local_TSt41->refcount++;
7829 zval** p_lhs = &local_TSt41;
7831 copy_into_ref (p_lhs, field);
7832 phc_check_invariants (TSRMLS_C);
7834 // unset($TSa42);
7836 if (local_TSa42 != NULL)
7838 zval_ptr_dtor (&local_TSa42);
7839 local_TSa42 = NULL;
7841 phc_check_invariants (TSRMLS_C);
7843 // $TSa42 = (array) $TSa42;
7845 if (local_TSa42 == NULL)
7847 local_TSa42 = EG (uninitialized_zval_ptr);
7848 local_TSa42->refcount++;
7850 zval** p_lhs = &local_TSa42;
7852 zval* rhs;
7853 if (local_TSa42 == NULL)
7854 rhs = EG (uninitialized_zval_ptr);
7855 else
7856 rhs = local_TSa42;
7858 if (*p_lhs != rhs)
7860 if ((*p_lhs)->is_ref)
7861 overwrite_lhs (*p_lhs, rhs);
7862 else
7864 zval_ptr_dtor (p_lhs);
7865 if (rhs->is_ref)
7867 // Take a copy of RHS for LHS
7868 *p_lhs = zvp_clone_ex (rhs);
7870 else
7872 // Share a copy
7873 rhs->refcount++;
7874 *p_lhs = rhs;
7881 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
7882 if ((*p_lhs)->type != IS_ARRAY)
7884 sep_copy_on_write (p_lhs);
7885 convert_to_array (*p_lhs);
7888 phc_check_invariants (TSRMLS_C);
7890 // $TSa42[] = $hook;
7892 if (local_TSa42 == NULL)
7894 local_TSa42 = EG (uninitialized_zval_ptr);
7895 local_TSa42->refcount++;
7897 zval** p_array = &local_TSa42;
7899 // Push EG(uninit) and get a pointer to the symtable entry
7900 zval** p_lhs = push_and_index_ht (p_array TSRMLS_CC);
7901 if (p_lhs != NULL)
7903 zval* rhs;
7904 if (local_hook == NULL)
7905 rhs = EG (uninitialized_zval_ptr);
7906 else
7907 rhs = local_hook;
7909 if (*p_lhs != rhs)
7910 write_var (p_lhs, rhs);
7912 // I think if this is NULL, then the LHS is a bool or similar, and you cant
7913 // push onto it.
7914 phc_check_invariants (TSRMLS_C);
7916 // $TSa42[] = $data;
7918 if (local_TSa42 == NULL)
7920 local_TSa42 = EG (uninitialized_zval_ptr);
7921 local_TSa42->refcount++;
7923 zval** p_array = &local_TSa42;
7925 // Push EG(uninit) and get a pointer to the symtable entry
7926 zval** p_lhs = push_and_index_ht (p_array TSRMLS_CC);
7927 if (p_lhs != NULL)
7929 zval* rhs;
7930 if (local_data == NULL)
7931 rhs = EG (uninitialized_zval_ptr);
7932 else
7933 rhs = local_data;
7935 if (*p_lhs != rhs)
7936 write_var (p_lhs, rhs);
7938 // I think if this is NULL, then the LHS is a bool or similar, and you cant
7939 // push onto it.
7940 phc_check_invariants (TSRMLS_C);
7942 // $TSt41[] = $TSa42;
7944 if (local_TSt41 == NULL)
7946 local_TSt41 = EG (uninitialized_zval_ptr);
7947 local_TSt41->refcount++;
7949 zval** p_array = &local_TSt41;
7951 // Push EG(uninit) and get a pointer to the symtable entry
7952 zval** p_lhs = push_and_index_ht (p_array TSRMLS_CC);
7953 if (p_lhs != NULL)
7955 zval* rhs;
7956 if (local_TSa42 == NULL)
7957 rhs = EG (uninitialized_zval_ptr);
7958 else
7959 rhs = local_TSa42;
7961 if (*p_lhs != rhs)
7962 write_var (p_lhs, rhs);
7964 // I think if this is NULL, then the LHS is a bool or similar, and you cant
7965 // push onto it.
7966 phc_check_invariants (TSRMLS_C);
7968 // Method exit
7969 end_of_function:__attribute__((unused));
7970 if (local_TSa42 != NULL)
7972 zval_ptr_dtor (&local_TSa42);
7974 if (local_TSt41 != NULL)
7976 zval_ptr_dtor (&local_TSt41);
7978 if (local_data != NULL)
7980 zval_ptr_dtor (&local_data);
7982 if (local_hook != NULL)
7984 zval_ptr_dtor (&local_hook);
7987 // function setnewsection($value)
7988 // {
7989 // $TLE43 = (bool) $value;
7990 // $this->mNewSection = $TLE43;
7991 // }
7992 PHP_METHOD(ParserOutput, setnewsection)
7994 zval* local_TLE43 = NULL;
7995 zval* local_this = getThis();
7996 zval* local_value = NULL;
7997 // Add all parameters as local variables
7999 int num_args = ZEND_NUM_ARGS ();
8000 zval* params[1];
8001 zend_get_parameters_array(0, num_args, params);
8002 // param 0
8003 params[0]->refcount++;
8004 if (local_value != NULL)
8006 zval_ptr_dtor (&local_value);
8008 local_value = params[0];
8010 // Function body
8011 // $TLE43 = (bool) $value;
8013 if (local_TLE43 == NULL)
8015 local_TLE43 = EG (uninitialized_zval_ptr);
8016 local_TLE43->refcount++;
8018 zval** p_lhs = &local_TLE43;
8020 zval* rhs;
8021 if (local_value == NULL)
8022 rhs = EG (uninitialized_zval_ptr);
8023 else
8024 rhs = local_value;
8026 if (*p_lhs != rhs)
8028 if ((*p_lhs)->is_ref)
8029 overwrite_lhs (*p_lhs, rhs);
8030 else
8032 zval_ptr_dtor (p_lhs);
8033 if (rhs->is_ref)
8035 // Take a copy of RHS for LHS
8036 *p_lhs = zvp_clone_ex (rhs);
8038 else
8040 // Share a copy
8041 rhs->refcount++;
8042 *p_lhs = rhs;
8049 assert (IS_BOOL >= 0 && IS_BOOL <= 6);
8050 if ((*p_lhs)->type != IS_BOOL)
8052 sep_copy_on_write (p_lhs);
8053 convert_to_boolean (*p_lhs);
8056 phc_check_invariants (TSRMLS_C);
8058 // $this->mNewSection = $TLE43;
8060 if (local_this == NULL)
8062 local_this = EG (uninitialized_zval_ptr);
8063 local_this->refcount++;
8065 zval** p_obj = &local_this;
8067 zval* rhs;
8068 if (local_TLE43 == NULL)
8069 rhs = EG (uninitialized_zval_ptr);
8070 else
8071 rhs = local_TLE43;
8073 zval field_name;
8074 INIT_ZVAL (field_name);
8075 ZVAL_STRING (&field_name, "mNewSection", 0);
8077 Z_OBJ_HT_PP(p_obj)->write_property(*p_obj, &field_name, rhs TSRMLS_CC);
8078 phc_check_invariants (TSRMLS_C);
8080 // Method exit
8081 end_of_function:__attribute__((unused));
8082 if (local_TLE43 != NULL)
8084 zval_ptr_dtor (&local_TLE43);
8086 if (local_value != NULL)
8088 zval_ptr_dtor (&local_value);
8091 // function getnewsection()
8092 // {
8093 // $TSt44 = $this->mNewSection;
8094 // $TLE45 = (bool) $TSt44;
8095 // return $TLE45;
8096 // }
8097 PHP_METHOD(ParserOutput, getnewsection)
8099 zval* local_TLE45 = NULL;
8100 zval* local_TSt44 = NULL;
8101 zval* local_this = getThis();
8102 // Function body
8103 // $TSt44 = $this->mNewSection;
8105 if (local_this == NULL)
8107 local_this = EG (uninitialized_zval_ptr);
8108 local_this->refcount++;
8110 zval** p_obj = &local_this;
8112 zval field_name;
8113 INIT_ZVAL (field_name);
8114 ZVAL_STRING (&field_name, "mNewSection", 0);
8116 // I *think* this is correct, but documentation of the Zend API is scarce :)
8117 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
8118 if (local_TSt44 == NULL)
8120 local_TSt44 = EG (uninitialized_zval_ptr);
8121 local_TSt44->refcount++;
8123 zval** p_lhs = &local_TSt44;
8125 write_var (p_lhs, field);
8126 phc_check_invariants (TSRMLS_C);
8128 // $TLE45 = (bool) $TSt44;
8130 if (local_TLE45 == NULL)
8132 local_TLE45 = EG (uninitialized_zval_ptr);
8133 local_TLE45->refcount++;
8135 zval** p_lhs = &local_TLE45;
8137 zval* rhs;
8138 if (local_TSt44 == NULL)
8139 rhs = EG (uninitialized_zval_ptr);
8140 else
8141 rhs = local_TSt44;
8143 if (*p_lhs != rhs)
8145 if ((*p_lhs)->is_ref)
8146 overwrite_lhs (*p_lhs, rhs);
8147 else
8149 zval_ptr_dtor (p_lhs);
8150 if (rhs->is_ref)
8152 // Take a copy of RHS for LHS
8153 *p_lhs = zvp_clone_ex (rhs);
8155 else
8157 // Share a copy
8158 rhs->refcount++;
8159 *p_lhs = rhs;
8166 assert (IS_BOOL >= 0 && IS_BOOL <= 6);
8167 if ((*p_lhs)->type != IS_BOOL)
8169 sep_copy_on_write (p_lhs);
8170 convert_to_boolean (*p_lhs);
8173 phc_check_invariants (TSRMLS_C);
8175 // return $TLE45;
8177 zval* rhs;
8178 if (local_TLE45 == NULL)
8179 rhs = EG (uninitialized_zval_ptr);
8180 else
8181 rhs = local_TLE45;
8183 // Run-time return by reference has different semantics to compile-time.
8184 // If the function has CTRBR and RTRBR, the the assignment will be
8185 // reference. If one or the other is return-by-copy, the result will be
8186 // by copy. Its a question of whether its separated at return-time (which
8187 // we do here) or at the call-site.
8188 return_value->value = rhs->value;
8189 return_value->type = rhs->type;
8190 zval_copy_ctor (return_value);
8191 goto end_of_function;
8192 phc_check_invariants (TSRMLS_C);
8194 // Method exit
8195 end_of_function:__attribute__((unused));
8196 if (local_TLE45 != NULL)
8198 zval_ptr_dtor (&local_TLE45);
8200 if (local_TSt44 != NULL)
8202 zval_ptr_dtor (&local_TSt44);
8205 // function addlink($title, $id = NULL)
8206 // {
8207 // $ns = $title->getnamespace();
8208 // $dbk = $title->getdbkey();
8209 // $TLE46 = NS_MEDIA;
8210 // $TLE47 = ($ns == $TLE46);
8211 // if (TLE47) goto L164 else goto L165;
8212 // L164:
8213 // $ns = NS_FILE;
8214 // goto L166;
8215 // L165:
8216 // $TLE48 = NS_SPECIAL;
8217 // $TLE49 = ($ns == $TLE48);
8218 // if (TLE49) goto L161 else goto L162;
8219 // L161:
8220 // $TLE50 = NULL;
8221 // return $TLE50;
8222 // goto L163;
8223 // L162:
8224 // $TLE51 = '';
8225 // $TLE52 = ($dbk === $TLE51);
8226 // if (TLE52) goto L158 else goto L159;
8227 // L158:
8228 // $TLE53 = NULL;
8229 // return $TLE53;
8230 // goto L160;
8231 // L159:
8232 // goto L160;
8233 // L160:
8234 // goto L163;
8235 // L163:
8236 // goto L166;
8237 // L166:
8238 // $TMIt119 = $this->mLinks;
8239 // $TLE54 = isset($TMIt119[$ns]);
8240 // $TLE55 = !$TLE54;
8241 // if (TLE55) goto L167 else goto L168;
8242 // L167:
8243 // $TSt56 =& $this->mLinks;
8244 // unset($TSa57);
8245 // $TSa57 = (array) $TSa57;
8246 // $TSt56[$ns] = $TSa57;
8247 // goto L169;
8248 // L168:
8249 // goto L169;
8250 // L169:
8251 // $TLE58 = is_null($id);
8252 // if (TLE58) goto L170 else goto L171;
8253 // L170:
8254 // $id = $title->getarticleid();
8255 // goto L172;
8256 // L171:
8257 // goto L172;
8258 // L172:
8259 // $TSt59 =& $this->mLinks;
8260 // $TSi60 =& $TSt59[$ns];
8261 // $TSi60[$dbk] = $id;
8262 // }
8263 PHP_METHOD(ParserOutput, addlink)
8265 zval* local_TLE46 = NULL;
8266 zval* local_TLE47 = NULL;
8267 zval* local_TLE48 = NULL;
8268 zval* local_TLE49 = NULL;
8269 zval* local_TLE50 = NULL;
8270 zval* local_TLE51 = NULL;
8271 zval* local_TLE52 = NULL;
8272 zval* local_TLE53 = NULL;
8273 zval* local_TLE54 = NULL;
8274 zval* local_TLE55 = NULL;
8275 zval* local_TLE58 = NULL;
8276 zval* local_TMIt119 = NULL;
8277 zval* local_TSa57 = NULL;
8278 zval* local_TSi60 = NULL;
8279 zval* local_TSt56 = NULL;
8280 zval* local_TSt59 = NULL;
8281 zval* local_dbk = NULL;
8282 zval* local_id = NULL;
8283 zval* local_ns = NULL;
8284 zval* local_this = getThis();
8285 zval* local_title = NULL;
8286 // Add all parameters as local variables
8288 int num_args = ZEND_NUM_ARGS ();
8289 zval* params[2];
8290 zend_get_parameters_array(0, num_args, params);
8291 // param 0
8292 params[0]->refcount++;
8293 if (local_title != NULL)
8295 zval_ptr_dtor (&local_title);
8297 local_title = params[0];
8298 // param 1
8299 if (num_args <= 1)
8301 zval* default_value;
8303 zval* local___static_value__ = NULL;
8304 // $__static_value__ = NULL;
8306 if (local___static_value__ == NULL)
8308 local___static_value__ = EG (uninitialized_zval_ptr);
8309 local___static_value__->refcount++;
8311 zval** p_lhs = &local___static_value__;
8313 zval* value;
8314 if ((*p_lhs)->is_ref)
8316 // Always overwrite the current value
8317 value = *p_lhs;
8318 zval_dtor (value);
8320 else
8322 ALLOC_INIT_ZVAL (value);
8323 zval_ptr_dtor (p_lhs);
8324 *p_lhs = value;
8327 ZVAL_NULL (value);
8329 phc_check_invariants (TSRMLS_C);
8331 default_value = local___static_value__;
8332 assert(!default_value->is_ref);
8333 default_value->refcount++;
8334 if (local___static_value__ != NULL)
8336 zval_ptr_dtor (&local___static_value__);
8339 default_value->refcount--;
8340 params[1] = default_value;
8342 params[1]->refcount++;
8343 if (local_id != NULL)
8345 zval_ptr_dtor (&local_id);
8347 local_id = params[1];
8349 // Function body
8350 // $ns = $title->getnamespace();
8352 if (local_title == NULL)
8354 local_title = EG (uninitialized_zval_ptr);
8355 local_title->refcount++;
8357 zval** p_obj = &local_title;
8359 zend_fcall_info fci_object;
8360 zend_fcall_info_cache fcic_object = {0, NULL, NULL, NULL};
8361 initialize_method_call (&fci_object, &fcic_object, p_obj, "getnamespace", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 88 TSRMLS_CC);
8362 zend_function* signature = fcic_object.function_handler;
8363 zend_arg_info* arg_info = signature->common.arg_info; // optional
8365 int by_ref[0];
8366 int abr_index = 0;
8369 // Setup array of arguments
8370 // TODO: i think arrays of size 0 is an error
8371 int destruct [0];
8372 zval* args [0];
8373 zval** args_ind [0];
8375 int af_index = 0;
8378 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 88, NULL TSRMLS_CC);
8380 // save existing parameters, in case of recursion
8381 int param_count_save = fci_object.param_count;
8382 zval*** params_save = fci_object.params;
8383 zval** retval_save = fci_object.retval_ptr_ptr;
8385 zval* rhs = NULL;
8387 // set up params
8388 fci_object.params = args_ind;
8389 fci_object.param_count = 0;
8390 fci_object.retval_ptr_ptr = &rhs;
8392 // call the function
8393 int success = zend_call_function (&fci_object, &fcic_object TSRMLS_CC);
8394 assert(success == SUCCESS);
8396 // restore params
8397 fci_object.params = params_save;
8398 fci_object.param_count = param_count_save;
8399 fci_object.retval_ptr_ptr = retval_save;
8401 // unset the errors
8402 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
8404 int i;
8405 for (i = 0; i < 0; i++)
8407 if (destruct[i])
8409 assert (destruct[i]);
8410 zval_ptr_dtor (args_ind[i]);
8415 // When the Zend engine returns by reference, it allocates a zval into
8416 // retval_ptr_ptr. To return by reference, the callee writes into the
8417 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
8418 // not actually return anything). So the zval returned - whether we return
8419 // it, or it is the allocated zval - has a refcount of 1.
8421 // The caller is responsible for cleaning that up (note, this is unaffected
8422 // by whether it is added to some COW set).
8424 // For reasons unknown, the Zend API resets the refcount and is_ref fields
8425 // of the return value after the function returns (unless the callee is
8426 // interpreted). If the function is supposed to return by reference, this
8427 // loses the refcount. This only happens when non-interpreted code is
8428 // called. We work around it, when compiled code is called, by saving the
8429 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
8430 // that we may create an error if our code is called by a callback, and
8431 // returns by reference, and the callback returns by reference. At least
8432 // this is an obscure case.
8433 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
8435 assert (rhs != EG(uninitialized_zval_ptr));
8436 rhs->is_ref = 1;
8437 if (saved_refcount != 0)
8439 rhs->refcount = saved_refcount;
8441 rhs->refcount++;
8443 saved_refcount = 0; // for 'obscure cases'
8445 if (local_ns == NULL)
8447 local_ns = EG (uninitialized_zval_ptr);
8448 local_ns->refcount++;
8450 zval** p_lhs = &local_ns;
8452 write_var (p_lhs, rhs);
8455 zval_ptr_dtor (&rhs);
8456 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
8457 zval_ptr_dtor (&rhs);
8459 phc_check_invariants (TSRMLS_C);
8461 // $dbk = $title->getdbkey();
8463 if (local_title == NULL)
8465 local_title = EG (uninitialized_zval_ptr);
8466 local_title->refcount++;
8468 zval** p_obj = &local_title;
8470 zend_fcall_info fci_object;
8471 zend_fcall_info_cache fcic_object = {0, NULL, NULL, NULL};
8472 initialize_method_call (&fci_object, &fcic_object, p_obj, "getdbkey", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 89 TSRMLS_CC);
8473 zend_function* signature = fcic_object.function_handler;
8474 zend_arg_info* arg_info = signature->common.arg_info; // optional
8476 int by_ref[0];
8477 int abr_index = 0;
8480 // Setup array of arguments
8481 // TODO: i think arrays of size 0 is an error
8482 int destruct [0];
8483 zval* args [0];
8484 zval** args_ind [0];
8486 int af_index = 0;
8489 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 89, NULL TSRMLS_CC);
8491 // save existing parameters, in case of recursion
8492 int param_count_save = fci_object.param_count;
8493 zval*** params_save = fci_object.params;
8494 zval** retval_save = fci_object.retval_ptr_ptr;
8496 zval* rhs = NULL;
8498 // set up params
8499 fci_object.params = args_ind;
8500 fci_object.param_count = 0;
8501 fci_object.retval_ptr_ptr = &rhs;
8503 // call the function
8504 int success = zend_call_function (&fci_object, &fcic_object TSRMLS_CC);
8505 assert(success == SUCCESS);
8507 // restore params
8508 fci_object.params = params_save;
8509 fci_object.param_count = param_count_save;
8510 fci_object.retval_ptr_ptr = retval_save;
8512 // unset the errors
8513 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
8515 int i;
8516 for (i = 0; i < 0; i++)
8518 if (destruct[i])
8520 assert (destruct[i]);
8521 zval_ptr_dtor (args_ind[i]);
8526 // When the Zend engine returns by reference, it allocates a zval into
8527 // retval_ptr_ptr. To return by reference, the callee writes into the
8528 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
8529 // not actually return anything). So the zval returned - whether we return
8530 // it, or it is the allocated zval - has a refcount of 1.
8532 // The caller is responsible for cleaning that up (note, this is unaffected
8533 // by whether it is added to some COW set).
8535 // For reasons unknown, the Zend API resets the refcount and is_ref fields
8536 // of the return value after the function returns (unless the callee is
8537 // interpreted). If the function is supposed to return by reference, this
8538 // loses the refcount. This only happens when non-interpreted code is
8539 // called. We work around it, when compiled code is called, by saving the
8540 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
8541 // that we may create an error if our code is called by a callback, and
8542 // returns by reference, and the callback returns by reference. At least
8543 // this is an obscure case.
8544 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
8546 assert (rhs != EG(uninitialized_zval_ptr));
8547 rhs->is_ref = 1;
8548 if (saved_refcount != 0)
8550 rhs->refcount = saved_refcount;
8552 rhs->refcount++;
8554 saved_refcount = 0; // for 'obscure cases'
8556 if (local_dbk == NULL)
8558 local_dbk = EG (uninitialized_zval_ptr);
8559 local_dbk->refcount++;
8561 zval** p_lhs = &local_dbk;
8563 write_var (p_lhs, rhs);
8566 zval_ptr_dtor (&rhs);
8567 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
8568 zval_ptr_dtor (&rhs);
8570 phc_check_invariants (TSRMLS_C);
8572 // $TLE46 = NS_MEDIA;
8574 // No null-terminator in length for get_constant.
8575 // zend_get_constant always returns a copy of the constant.
8576 if (local_TLE46 == NULL)
8578 local_TLE46 = EG (uninitialized_zval_ptr);
8579 local_TLE46->refcount++;
8581 zval** p_lhs = &local_TLE46;
8583 if (!(*p_lhs)->is_ref)
8585 zval_ptr_dtor (p_lhs);
8586 get_constant ("NS_MEDIA", 8, p_lhs TSRMLS_CC);
8589 else
8591 zval* constant;
8592 get_constant ("NS_MEDIA", 8, p_lhs TSRMLS_CC);
8593 overwrite_lhs_no_copy (*p_lhs, constant);
8594 safe_free_zval_ptr (constant);
8597 phc_check_invariants (TSRMLS_C);
8599 // $TLE47 = ($ns == $TLE46);
8601 if (local_TLE47 == NULL)
8603 local_TLE47 = EG (uninitialized_zval_ptr);
8604 local_TLE47->refcount++;
8606 zval** p_lhs = &local_TLE47;
8608 zval* left;
8609 if (local_ns == NULL)
8610 left = EG (uninitialized_zval_ptr);
8611 else
8612 left = local_ns;
8614 zval* right;
8615 if (local_TLE46 == NULL)
8616 right = EG (uninitialized_zval_ptr);
8617 else
8618 right = local_TLE46;
8620 if (in_copy_on_write (*p_lhs))
8622 zval_ptr_dtor (p_lhs);
8623 ALLOC_INIT_ZVAL (*p_lhs);
8626 zval old = **p_lhs;
8627 int result_is_operand = (*p_lhs == left || *p_lhs == right);
8628 is_equal_function (*p_lhs, left, right TSRMLS_CC);
8630 // If the result is one of the operands, the operator function
8631 // will already have cleaned up the result
8632 if (!result_is_operand)
8633 zval_dtor (&old);
8634 phc_check_invariants (TSRMLS_C);
8636 // if (TLE47) goto L164 else goto L165;
8638 zval* p_cond;
8639 if (local_TLE47 == NULL)
8640 p_cond = EG (uninitialized_zval_ptr);
8641 else
8642 p_cond = local_TLE47;
8644 zend_bool bcond = zend_is_true (p_cond);
8645 if (bcond)
8646 goto L164;
8647 else
8648 goto L165;
8649 phc_check_invariants (TSRMLS_C);
8651 // L164:
8652 L164:;
8653 // $ns = NS_FILE;
8655 // No null-terminator in length for get_constant.
8656 // zend_get_constant always returns a copy of the constant.
8657 if (local_ns == NULL)
8659 local_ns = EG (uninitialized_zval_ptr);
8660 local_ns->refcount++;
8662 zval** p_lhs = &local_ns;
8664 if (!(*p_lhs)->is_ref)
8666 zval_ptr_dtor (p_lhs);
8667 get_constant ("NS_FILE", 7, p_lhs TSRMLS_CC);
8670 else
8672 zval* constant;
8673 get_constant ("NS_FILE", 7, p_lhs TSRMLS_CC);
8674 overwrite_lhs_no_copy (*p_lhs, constant);
8675 safe_free_zval_ptr (constant);
8678 phc_check_invariants (TSRMLS_C);
8680 // goto L166;
8682 goto L166;
8683 phc_check_invariants (TSRMLS_C);
8685 // L165:
8686 L165:;
8687 // $TLE48 = NS_SPECIAL;
8689 // No null-terminator in length for get_constant.
8690 // zend_get_constant always returns a copy of the constant.
8691 if (local_TLE48 == NULL)
8693 local_TLE48 = EG (uninitialized_zval_ptr);
8694 local_TLE48->refcount++;
8696 zval** p_lhs = &local_TLE48;
8698 if (!(*p_lhs)->is_ref)
8700 zval_ptr_dtor (p_lhs);
8701 get_constant ("NS_SPECIAL", 10, p_lhs TSRMLS_CC);
8704 else
8706 zval* constant;
8707 get_constant ("NS_SPECIAL", 10, p_lhs TSRMLS_CC);
8708 overwrite_lhs_no_copy (*p_lhs, constant);
8709 safe_free_zval_ptr (constant);
8712 phc_check_invariants (TSRMLS_C);
8714 // $TLE49 = ($ns == $TLE48);
8716 if (local_TLE49 == NULL)
8718 local_TLE49 = EG (uninitialized_zval_ptr);
8719 local_TLE49->refcount++;
8721 zval** p_lhs = &local_TLE49;
8723 zval* left;
8724 if (local_ns == NULL)
8725 left = EG (uninitialized_zval_ptr);
8726 else
8727 left = local_ns;
8729 zval* right;
8730 if (local_TLE48 == NULL)
8731 right = EG (uninitialized_zval_ptr);
8732 else
8733 right = local_TLE48;
8735 if (in_copy_on_write (*p_lhs))
8737 zval_ptr_dtor (p_lhs);
8738 ALLOC_INIT_ZVAL (*p_lhs);
8741 zval old = **p_lhs;
8742 int result_is_operand = (*p_lhs == left || *p_lhs == right);
8743 is_equal_function (*p_lhs, left, right TSRMLS_CC);
8745 // If the result is one of the operands, the operator function
8746 // will already have cleaned up the result
8747 if (!result_is_operand)
8748 zval_dtor (&old);
8749 phc_check_invariants (TSRMLS_C);
8751 // if (TLE49) goto L161 else goto L162;
8753 zval* p_cond;
8754 if (local_TLE49 == NULL)
8755 p_cond = EG (uninitialized_zval_ptr);
8756 else
8757 p_cond = local_TLE49;
8759 zend_bool bcond = zend_is_true (p_cond);
8760 if (bcond)
8761 goto L161;
8762 else
8763 goto L162;
8764 phc_check_invariants (TSRMLS_C);
8766 // L161:
8767 L161:;
8768 // $TLE50 = NULL;
8770 if (local_TLE50 == NULL)
8772 local_TLE50 = EG (uninitialized_zval_ptr);
8773 local_TLE50->refcount++;
8775 zval** p_lhs = &local_TLE50;
8777 zval* value;
8778 if ((*p_lhs)->is_ref)
8780 // Always overwrite the current value
8781 value = *p_lhs;
8782 zval_dtor (value);
8784 else
8786 ALLOC_INIT_ZVAL (value);
8787 zval_ptr_dtor (p_lhs);
8788 *p_lhs = value;
8791 ZVAL_NULL (value);
8793 phc_check_invariants (TSRMLS_C);
8795 // return $TLE50;
8797 zval* rhs;
8798 if (local_TLE50 == NULL)
8799 rhs = EG (uninitialized_zval_ptr);
8800 else
8801 rhs = local_TLE50;
8803 // Run-time return by reference has different semantics to compile-time.
8804 // If the function has CTRBR and RTRBR, the the assignment will be
8805 // reference. If one or the other is return-by-copy, the result will be
8806 // by copy. Its a question of whether its separated at return-time (which
8807 // we do here) or at the call-site.
8808 return_value->value = rhs->value;
8809 return_value->type = rhs->type;
8810 zval_copy_ctor (return_value);
8811 goto end_of_function;
8812 phc_check_invariants (TSRMLS_C);
8814 // goto L163;
8816 goto L163;
8817 phc_check_invariants (TSRMLS_C);
8819 // L162:
8820 L162:;
8821 // $TLE51 = '';
8823 if (local_TLE51 == NULL)
8825 local_TLE51 = EG (uninitialized_zval_ptr);
8826 local_TLE51->refcount++;
8828 zval** p_lhs = &local_TLE51;
8830 zval* value;
8831 if ((*p_lhs)->is_ref)
8833 // Always overwrite the current value
8834 value = *p_lhs;
8835 zval_dtor (value);
8837 else
8839 ALLOC_INIT_ZVAL (value);
8840 zval_ptr_dtor (p_lhs);
8841 *p_lhs = value;
8844 ZVAL_STRINGL(value, "", 0, 1);
8846 phc_check_invariants (TSRMLS_C);
8848 // $TLE52 = ($dbk === $TLE51);
8850 if (local_TLE52 == NULL)
8852 local_TLE52 = EG (uninitialized_zval_ptr);
8853 local_TLE52->refcount++;
8855 zval** p_lhs = &local_TLE52;
8857 zval* left;
8858 if (local_dbk == NULL)
8859 left = EG (uninitialized_zval_ptr);
8860 else
8861 left = local_dbk;
8863 zval* right;
8864 if (local_TLE51 == NULL)
8865 right = EG (uninitialized_zval_ptr);
8866 else
8867 right = local_TLE51;
8869 if (in_copy_on_write (*p_lhs))
8871 zval_ptr_dtor (p_lhs);
8872 ALLOC_INIT_ZVAL (*p_lhs);
8875 zval old = **p_lhs;
8876 int result_is_operand = (*p_lhs == left || *p_lhs == right);
8877 is_identical_function (*p_lhs, left, right TSRMLS_CC);
8879 // If the result is one of the operands, the operator function
8880 // will already have cleaned up the result
8881 if (!result_is_operand)
8882 zval_dtor (&old);
8883 phc_check_invariants (TSRMLS_C);
8885 // if (TLE52) goto L158 else goto L159;
8887 zval* p_cond;
8888 if (local_TLE52 == NULL)
8889 p_cond = EG (uninitialized_zval_ptr);
8890 else
8891 p_cond = local_TLE52;
8893 zend_bool bcond = zend_is_true (p_cond);
8894 if (bcond)
8895 goto L158;
8896 else
8897 goto L159;
8898 phc_check_invariants (TSRMLS_C);
8900 // L158:
8901 L158:;
8902 // $TLE53 = NULL;
8904 if (local_TLE53 == NULL)
8906 local_TLE53 = EG (uninitialized_zval_ptr);
8907 local_TLE53->refcount++;
8909 zval** p_lhs = &local_TLE53;
8911 zval* value;
8912 if ((*p_lhs)->is_ref)
8914 // Always overwrite the current value
8915 value = *p_lhs;
8916 zval_dtor (value);
8918 else
8920 ALLOC_INIT_ZVAL (value);
8921 zval_ptr_dtor (p_lhs);
8922 *p_lhs = value;
8925 ZVAL_NULL (value);
8927 phc_check_invariants (TSRMLS_C);
8929 // return $TLE53;
8931 zval* rhs;
8932 if (local_TLE53 == NULL)
8933 rhs = EG (uninitialized_zval_ptr);
8934 else
8935 rhs = local_TLE53;
8937 // Run-time return by reference has different semantics to compile-time.
8938 // If the function has CTRBR and RTRBR, the the assignment will be
8939 // reference. If one or the other is return-by-copy, the result will be
8940 // by copy. Its a question of whether its separated at return-time (which
8941 // we do here) or at the call-site.
8942 return_value->value = rhs->value;
8943 return_value->type = rhs->type;
8944 zval_copy_ctor (return_value);
8945 goto end_of_function;
8946 phc_check_invariants (TSRMLS_C);
8948 // goto L160;
8950 goto L160;
8951 phc_check_invariants (TSRMLS_C);
8953 // L159:
8954 L159:;
8955 // goto L160;
8957 goto L160;
8958 phc_check_invariants (TSRMLS_C);
8960 // L160:
8961 L160:;
8962 // goto L163;
8964 goto L163;
8965 phc_check_invariants (TSRMLS_C);
8967 // L163:
8968 L163:;
8969 // goto L166;
8971 goto L166;
8972 phc_check_invariants (TSRMLS_C);
8974 // L166:
8975 L166:;
8976 // $TMIt119 = $this->mLinks;
8978 if (local_this == NULL)
8980 local_this = EG (uninitialized_zval_ptr);
8981 local_this->refcount++;
8983 zval** p_obj = &local_this;
8985 zval field_name;
8986 INIT_ZVAL (field_name);
8987 ZVAL_STRING (&field_name, "mLinks", 0);
8989 // I *think* this is correct, but documentation of the Zend API is scarce :)
8990 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
8991 if (local_TMIt119 == NULL)
8993 local_TMIt119 = EG (uninitialized_zval_ptr);
8994 local_TMIt119->refcount++;
8996 zval** p_lhs = &local_TMIt119;
8998 write_var (p_lhs, field);
8999 phc_check_invariants (TSRMLS_C);
9001 // $TLE54 = isset($TMIt119[$ns]);
9003 if (local_TLE54 == NULL)
9005 local_TLE54 = EG (uninitialized_zval_ptr);
9006 local_TLE54->refcount++;
9008 zval** p_lhs = &local_TLE54;
9009 zval* value;
9010 if ((*p_lhs)->is_ref)
9012 // Always overwrite the current value
9013 value = *p_lhs;
9014 zval_dtor (value);
9016 else
9018 ALLOC_INIT_ZVAL (value);
9019 zval_ptr_dtor (p_lhs);
9020 *p_lhs = value;
9022 if (local_TMIt119 == NULL)
9024 local_TMIt119 = EG (uninitialized_zval_ptr);
9025 local_TMIt119->refcount++;
9027 zval** u_array = &local_TMIt119;
9028 zval* u_index;
9029 if (local_ns == NULL)
9031 u_index = EG (uninitialized_zval_ptr);
9033 else
9035 u_index = local_ns;
9037 ZVAL_BOOL(value, isset_array (u_array, u_index));
9038 phc_check_invariants (TSRMLS_C);
9040 // $TLE55 = !$TLE54;
9042 if (local_TLE55 == NULL)
9044 local_TLE55 = EG (uninitialized_zval_ptr);
9045 local_TLE55->refcount++;
9047 zval** p_lhs = &local_TLE55;
9049 zval* rhs;
9050 if (local_TLE54 == NULL)
9051 rhs = EG (uninitialized_zval_ptr);
9052 else
9053 rhs = local_TLE54;
9055 if (in_copy_on_write (*p_lhs))
9057 zval_ptr_dtor (p_lhs);
9058 ALLOC_INIT_ZVAL (*p_lhs);
9061 zval old = **p_lhs;
9062 int result_is_operand = (*p_lhs == rhs);
9063 boolean_not_function (*p_lhs, rhs TSRMLS_CC);
9064 if (!result_is_operand)
9065 zval_dtor (&old);
9066 phc_check_invariants (TSRMLS_C);
9068 // if (TLE55) goto L167 else goto L168;
9070 zval* p_cond;
9071 if (local_TLE55 == NULL)
9072 p_cond = EG (uninitialized_zval_ptr);
9073 else
9074 p_cond = local_TLE55;
9076 zend_bool bcond = zend_is_true (p_cond);
9077 if (bcond)
9078 goto L167;
9079 else
9080 goto L168;
9081 phc_check_invariants (TSRMLS_C);
9083 // L167:
9084 L167:;
9085 // $TSt56 =& $this->mLinks;
9087 if (local_this == NULL)
9089 local_this = EG (uninitialized_zval_ptr);
9090 local_this->refcount++;
9092 zval** p_obj = &local_this;
9094 zval field_name;
9095 INIT_ZVAL (field_name);
9096 ZVAL_STRING (&field_name, "mLinks", 0);
9098 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
9099 sep_copy_on_write (field);
9100 if (local_TSt56 == NULL)
9102 local_TSt56 = EG (uninitialized_zval_ptr);
9103 local_TSt56->refcount++;
9105 zval** p_lhs = &local_TSt56;
9107 copy_into_ref (p_lhs, field);
9108 phc_check_invariants (TSRMLS_C);
9110 // unset($TSa57);
9112 if (local_TSa57 != NULL)
9114 zval_ptr_dtor (&local_TSa57);
9115 local_TSa57 = NULL;
9117 phc_check_invariants (TSRMLS_C);
9119 // $TSa57 = (array) $TSa57;
9121 if (local_TSa57 == NULL)
9123 local_TSa57 = EG (uninitialized_zval_ptr);
9124 local_TSa57->refcount++;
9126 zval** p_lhs = &local_TSa57;
9128 zval* rhs;
9129 if (local_TSa57 == NULL)
9130 rhs = EG (uninitialized_zval_ptr);
9131 else
9132 rhs = local_TSa57;
9134 if (*p_lhs != rhs)
9136 if ((*p_lhs)->is_ref)
9137 overwrite_lhs (*p_lhs, rhs);
9138 else
9140 zval_ptr_dtor (p_lhs);
9141 if (rhs->is_ref)
9143 // Take a copy of RHS for LHS
9144 *p_lhs = zvp_clone_ex (rhs);
9146 else
9148 // Share a copy
9149 rhs->refcount++;
9150 *p_lhs = rhs;
9157 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
9158 if ((*p_lhs)->type != IS_ARRAY)
9160 sep_copy_on_write (p_lhs);
9161 convert_to_array (*p_lhs);
9164 phc_check_invariants (TSRMLS_C);
9166 // $TSt56[$ns] = $TSa57;
9168 if (local_TSt56 == NULL)
9170 local_TSt56 = EG (uninitialized_zval_ptr);
9171 local_TSt56->refcount++;
9173 zval** p_array = &local_TSt56;
9175 check_array_type (p_array TSRMLS_CC);
9177 zval* index;
9178 if (local_ns == NULL)
9179 index = EG (uninitialized_zval_ptr);
9180 else
9181 index = local_ns;
9184 // String indexing
9185 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
9187 zval* rhs;
9188 if (local_TSa57 == NULL)
9189 rhs = EG (uninitialized_zval_ptr);
9190 else
9191 rhs = local_TSa57;
9193 write_string_index (p_array, index, rhs TSRMLS_CC);
9195 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
9197 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
9198 zval* rhs;
9199 if (local_TSa57 == NULL)
9200 rhs = EG (uninitialized_zval_ptr);
9201 else
9202 rhs = local_TSa57;
9204 if (*p_lhs != rhs)
9206 write_var (p_lhs, rhs);
9209 phc_check_invariants (TSRMLS_C);
9211 // goto L169;
9213 goto L169;
9214 phc_check_invariants (TSRMLS_C);
9216 // L168:
9217 L168:;
9218 // goto L169;
9220 goto L169;
9221 phc_check_invariants (TSRMLS_C);
9223 // L169:
9224 L169:;
9225 // $TLE58 = is_null($id);
9227 initialize_function_call (&is_null_fci, &is_null_fcic, "is_null", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 104 TSRMLS_CC);
9228 zend_function* signature = is_null_fcic.function_handler;
9229 zend_arg_info* arg_info = signature->common.arg_info; // optional
9231 int by_ref[1];
9232 int abr_index = 0;
9233 // TODO: find names to replace index
9234 if (arg_info)
9236 by_ref[abr_index] = arg_info->pass_by_reference;
9237 arg_info++;
9239 else
9240 by_ref[abr_index] = signature->common.pass_rest_by_reference;
9242 abr_index++;
9245 // Setup array of arguments
9246 // TODO: i think arrays of size 0 is an error
9247 int destruct [1];
9248 zval* args [1];
9249 zval** args_ind [1];
9251 int af_index = 0;
9252 destruct[af_index] = 0;
9253 if (by_ref[af_index])
9255 if (local_id == NULL)
9257 local_id = EG (uninitialized_zval_ptr);
9258 local_id->refcount++;
9260 zval** p_arg = &local_id;
9262 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
9263 assert (!in_copy_on_write (*args_ind[af_index]));
9264 args[af_index] = *args_ind[af_index];
9266 else
9268 zval* arg;
9269 if (local_id == NULL)
9270 arg = EG (uninitialized_zval_ptr);
9271 else
9272 arg = local_id;
9274 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
9275 args_ind[af_index] = &args[af_index];
9277 af_index++;
9280 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 104, NULL TSRMLS_CC);
9282 // save existing parameters, in case of recursion
9283 int param_count_save = is_null_fci.param_count;
9284 zval*** params_save = is_null_fci.params;
9285 zval** retval_save = is_null_fci.retval_ptr_ptr;
9287 zval* rhs = NULL;
9289 // set up params
9290 is_null_fci.params = args_ind;
9291 is_null_fci.param_count = 1;
9292 is_null_fci.retval_ptr_ptr = &rhs;
9294 // call the function
9295 int success = zend_call_function (&is_null_fci, &is_null_fcic TSRMLS_CC);
9296 assert(success == SUCCESS);
9298 // restore params
9299 is_null_fci.params = params_save;
9300 is_null_fci.param_count = param_count_save;
9301 is_null_fci.retval_ptr_ptr = retval_save;
9303 // unset the errors
9304 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
9306 int i;
9307 for (i = 0; i < 1; i++)
9309 if (destruct[i])
9311 assert (destruct[i]);
9312 zval_ptr_dtor (args_ind[i]);
9317 // When the Zend engine returns by reference, it allocates a zval into
9318 // retval_ptr_ptr. To return by reference, the callee writes into the
9319 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
9320 // not actually return anything). So the zval returned - whether we return
9321 // it, or it is the allocated zval - has a refcount of 1.
9323 // The caller is responsible for cleaning that up (note, this is unaffected
9324 // by whether it is added to some COW set).
9326 // For reasons unknown, the Zend API resets the refcount and is_ref fields
9327 // of the return value after the function returns (unless the callee is
9328 // interpreted). If the function is supposed to return by reference, this
9329 // loses the refcount. This only happens when non-interpreted code is
9330 // called. We work around it, when compiled code is called, by saving the
9331 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
9332 // that we may create an error if our code is called by a callback, and
9333 // returns by reference, and the callback returns by reference. At least
9334 // this is an obscure case.
9335 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
9337 assert (rhs != EG(uninitialized_zval_ptr));
9338 rhs->is_ref = 1;
9339 if (saved_refcount != 0)
9341 rhs->refcount = saved_refcount;
9343 rhs->refcount++;
9345 saved_refcount = 0; // for 'obscure cases'
9347 if (local_TLE58 == NULL)
9349 local_TLE58 = EG (uninitialized_zval_ptr);
9350 local_TLE58->refcount++;
9352 zval** p_lhs = &local_TLE58;
9354 write_var (p_lhs, rhs);
9357 zval_ptr_dtor (&rhs);
9358 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
9359 zval_ptr_dtor (&rhs);
9361 phc_check_invariants (TSRMLS_C);
9363 // if (TLE58) goto L170 else goto L171;
9365 zval* p_cond;
9366 if (local_TLE58 == NULL)
9367 p_cond = EG (uninitialized_zval_ptr);
9368 else
9369 p_cond = local_TLE58;
9371 zend_bool bcond = zend_is_true (p_cond);
9372 if (bcond)
9373 goto L170;
9374 else
9375 goto L171;
9376 phc_check_invariants (TSRMLS_C);
9378 // L170:
9379 L170:;
9380 // $id = $title->getarticleid();
9382 if (local_title == NULL)
9384 local_title = EG (uninitialized_zval_ptr);
9385 local_title->refcount++;
9387 zval** p_obj = &local_title;
9389 zend_fcall_info fci_object;
9390 zend_fcall_info_cache fcic_object = {0, NULL, NULL, NULL};
9391 initialize_method_call (&fci_object, &fcic_object, p_obj, "getarticleid", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 105 TSRMLS_CC);
9392 zend_function* signature = fcic_object.function_handler;
9393 zend_arg_info* arg_info = signature->common.arg_info; // optional
9395 int by_ref[0];
9396 int abr_index = 0;
9399 // Setup array of arguments
9400 // TODO: i think arrays of size 0 is an error
9401 int destruct [0];
9402 zval* args [0];
9403 zval** args_ind [0];
9405 int af_index = 0;
9408 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 105, NULL TSRMLS_CC);
9410 // save existing parameters, in case of recursion
9411 int param_count_save = fci_object.param_count;
9412 zval*** params_save = fci_object.params;
9413 zval** retval_save = fci_object.retval_ptr_ptr;
9415 zval* rhs = NULL;
9417 // set up params
9418 fci_object.params = args_ind;
9419 fci_object.param_count = 0;
9420 fci_object.retval_ptr_ptr = &rhs;
9422 // call the function
9423 int success = zend_call_function (&fci_object, &fcic_object TSRMLS_CC);
9424 assert(success == SUCCESS);
9426 // restore params
9427 fci_object.params = params_save;
9428 fci_object.param_count = param_count_save;
9429 fci_object.retval_ptr_ptr = retval_save;
9431 // unset the errors
9432 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
9434 int i;
9435 for (i = 0; i < 0; i++)
9437 if (destruct[i])
9439 assert (destruct[i]);
9440 zval_ptr_dtor (args_ind[i]);
9445 // When the Zend engine returns by reference, it allocates a zval into
9446 // retval_ptr_ptr. To return by reference, the callee writes into the
9447 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
9448 // not actually return anything). So the zval returned - whether we return
9449 // it, or it is the allocated zval - has a refcount of 1.
9451 // The caller is responsible for cleaning that up (note, this is unaffected
9452 // by whether it is added to some COW set).
9454 // For reasons unknown, the Zend API resets the refcount and is_ref fields
9455 // of the return value after the function returns (unless the callee is
9456 // interpreted). If the function is supposed to return by reference, this
9457 // loses the refcount. This only happens when non-interpreted code is
9458 // called. We work around it, when compiled code is called, by saving the
9459 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
9460 // that we may create an error if our code is called by a callback, and
9461 // returns by reference, and the callback returns by reference. At least
9462 // this is an obscure case.
9463 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
9465 assert (rhs != EG(uninitialized_zval_ptr));
9466 rhs->is_ref = 1;
9467 if (saved_refcount != 0)
9469 rhs->refcount = saved_refcount;
9471 rhs->refcount++;
9473 saved_refcount = 0; // for 'obscure cases'
9475 if (local_id == NULL)
9477 local_id = EG (uninitialized_zval_ptr);
9478 local_id->refcount++;
9480 zval** p_lhs = &local_id;
9482 write_var (p_lhs, rhs);
9485 zval_ptr_dtor (&rhs);
9486 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
9487 zval_ptr_dtor (&rhs);
9489 phc_check_invariants (TSRMLS_C);
9491 // goto L172;
9493 goto L172;
9494 phc_check_invariants (TSRMLS_C);
9496 // L171:
9497 L171:;
9498 // goto L172;
9500 goto L172;
9501 phc_check_invariants (TSRMLS_C);
9503 // L172:
9504 L172:;
9505 // $TSt59 =& $this->mLinks;
9507 if (local_this == NULL)
9509 local_this = EG (uninitialized_zval_ptr);
9510 local_this->refcount++;
9512 zval** p_obj = &local_this;
9514 zval field_name;
9515 INIT_ZVAL (field_name);
9516 ZVAL_STRING (&field_name, "mLinks", 0);
9518 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
9519 sep_copy_on_write (field);
9520 if (local_TSt59 == NULL)
9522 local_TSt59 = EG (uninitialized_zval_ptr);
9523 local_TSt59->refcount++;
9525 zval** p_lhs = &local_TSt59;
9527 copy_into_ref (p_lhs, field);
9528 phc_check_invariants (TSRMLS_C);
9530 // $TSi60 =& $TSt59[$ns];
9532 if (local_TSi60 == NULL)
9534 local_TSi60 = EG (uninitialized_zval_ptr);
9535 local_TSi60->refcount++;
9537 zval** p_lhs = &local_TSi60;
9539 if (local_TSt59 == NULL)
9541 local_TSt59 = EG (uninitialized_zval_ptr);
9542 local_TSt59->refcount++;
9544 zval** p_r_array = &local_TSt59;
9546 zval* r_index;
9547 if (local_ns == NULL)
9548 r_index = EG (uninitialized_zval_ptr);
9549 else
9550 r_index = local_ns;
9552 check_array_type (p_r_array TSRMLS_CC);
9553 zval** p_rhs = get_ht_entry (p_r_array, r_index TSRMLS_CC);
9554 sep_copy_on_write (p_rhs);
9555 copy_into_ref (p_lhs, p_rhs);
9556 phc_check_invariants (TSRMLS_C);
9558 // $TSi60[$dbk] = $id;
9560 if (local_TSi60 == NULL)
9562 local_TSi60 = EG (uninitialized_zval_ptr);
9563 local_TSi60->refcount++;
9565 zval** p_array = &local_TSi60;
9567 check_array_type (p_array TSRMLS_CC);
9569 zval* index;
9570 if (local_dbk == NULL)
9571 index = EG (uninitialized_zval_ptr);
9572 else
9573 index = local_dbk;
9576 // String indexing
9577 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
9579 zval* rhs;
9580 if (local_id == NULL)
9581 rhs = EG (uninitialized_zval_ptr);
9582 else
9583 rhs = local_id;
9585 write_string_index (p_array, index, rhs TSRMLS_CC);
9587 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
9589 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
9590 zval* rhs;
9591 if (local_id == NULL)
9592 rhs = EG (uninitialized_zval_ptr);
9593 else
9594 rhs = local_id;
9596 if (*p_lhs != rhs)
9598 write_var (p_lhs, rhs);
9601 phc_check_invariants (TSRMLS_C);
9603 // Method exit
9604 end_of_function:__attribute__((unused));
9605 if (local_TLE46 != NULL)
9607 zval_ptr_dtor (&local_TLE46);
9609 if (local_TLE47 != NULL)
9611 zval_ptr_dtor (&local_TLE47);
9613 if (local_TLE48 != NULL)
9615 zval_ptr_dtor (&local_TLE48);
9617 if (local_TLE49 != NULL)
9619 zval_ptr_dtor (&local_TLE49);
9621 if (local_TLE50 != NULL)
9623 zval_ptr_dtor (&local_TLE50);
9625 if (local_TLE51 != NULL)
9627 zval_ptr_dtor (&local_TLE51);
9629 if (local_TLE52 != NULL)
9631 zval_ptr_dtor (&local_TLE52);
9633 if (local_TLE53 != NULL)
9635 zval_ptr_dtor (&local_TLE53);
9637 if (local_TLE54 != NULL)
9639 zval_ptr_dtor (&local_TLE54);
9641 if (local_TLE55 != NULL)
9643 zval_ptr_dtor (&local_TLE55);
9645 if (local_TLE58 != NULL)
9647 zval_ptr_dtor (&local_TLE58);
9649 if (local_TMIt119 != NULL)
9651 zval_ptr_dtor (&local_TMIt119);
9653 if (local_TSa57 != NULL)
9655 zval_ptr_dtor (&local_TSa57);
9657 if (local_TSi60 != NULL)
9659 zval_ptr_dtor (&local_TSi60);
9661 if (local_TSt56 != NULL)
9663 zval_ptr_dtor (&local_TSt56);
9665 if (local_TSt59 != NULL)
9667 zval_ptr_dtor (&local_TSt59);
9669 if (local_dbk != NULL)
9671 zval_ptr_dtor (&local_dbk);
9673 if (local_id != NULL)
9675 zval_ptr_dtor (&local_id);
9677 if (local_ns != NULL)
9679 zval_ptr_dtor (&local_ns);
9681 if (local_title != NULL)
9683 zval_ptr_dtor (&local_title);
9686 // function addimage($name)
9687 // {
9688 // $TSt61 =& $this->mImages;
9689 // $TLE62 = 1;
9690 // $TSt61[$name] = $TLE62;
9691 // }
9692 PHP_METHOD(ParserOutput, addimage)
9694 zval* local_TLE62 = NULL;
9695 zval* local_TSt61 = NULL;
9696 zval* local_name = NULL;
9697 zval* local_this = getThis();
9698 // Add all parameters as local variables
9700 int num_args = ZEND_NUM_ARGS ();
9701 zval* params[1];
9702 zend_get_parameters_array(0, num_args, params);
9703 // param 0
9704 params[0]->refcount++;
9705 if (local_name != NULL)
9707 zval_ptr_dtor (&local_name);
9709 local_name = params[0];
9711 // Function body
9712 // $TSt61 =& $this->mImages;
9714 if (local_this == NULL)
9716 local_this = EG (uninitialized_zval_ptr);
9717 local_this->refcount++;
9719 zval** p_obj = &local_this;
9721 zval field_name;
9722 INIT_ZVAL (field_name);
9723 ZVAL_STRING (&field_name, "mImages", 0);
9725 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
9726 sep_copy_on_write (field);
9727 if (local_TSt61 == NULL)
9729 local_TSt61 = EG (uninitialized_zval_ptr);
9730 local_TSt61->refcount++;
9732 zval** p_lhs = &local_TSt61;
9734 copy_into_ref (p_lhs, field);
9735 phc_check_invariants (TSRMLS_C);
9737 // $TLE62 = 1;
9739 if (local_TLE62 == NULL)
9741 local_TLE62 = EG (uninitialized_zval_ptr);
9742 local_TLE62->refcount++;
9744 zval** p_lhs = &local_TLE62;
9746 zval* value;
9747 if ((*p_lhs)->is_ref)
9749 // Always overwrite the current value
9750 value = *p_lhs;
9751 zval_dtor (value);
9753 else
9755 ALLOC_INIT_ZVAL (value);
9756 zval_ptr_dtor (p_lhs);
9757 *p_lhs = value;
9760 ZVAL_LONG (value, 1);
9762 phc_check_invariants (TSRMLS_C);
9764 // $TSt61[$name] = $TLE62;
9766 if (local_TSt61 == NULL)
9768 local_TSt61 = EG (uninitialized_zval_ptr);
9769 local_TSt61->refcount++;
9771 zval** p_array = &local_TSt61;
9773 check_array_type (p_array TSRMLS_CC);
9775 zval* index;
9776 if (local_name == NULL)
9777 index = EG (uninitialized_zval_ptr);
9778 else
9779 index = local_name;
9782 // String indexing
9783 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
9785 zval* rhs;
9786 if (local_TLE62 == NULL)
9787 rhs = EG (uninitialized_zval_ptr);
9788 else
9789 rhs = local_TLE62;
9791 write_string_index (p_array, index, rhs TSRMLS_CC);
9793 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
9795 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
9796 zval* rhs;
9797 if (local_TLE62 == NULL)
9798 rhs = EG (uninitialized_zval_ptr);
9799 else
9800 rhs = local_TLE62;
9802 if (*p_lhs != rhs)
9804 write_var (p_lhs, rhs);
9807 phc_check_invariants (TSRMLS_C);
9809 // Method exit
9810 end_of_function:__attribute__((unused));
9811 if (local_TLE62 != NULL)
9813 zval_ptr_dtor (&local_TLE62);
9815 if (local_TSt61 != NULL)
9817 zval_ptr_dtor (&local_TSt61);
9819 if (local_name != NULL)
9821 zval_ptr_dtor (&local_name);
9824 // function addtemplate($title, $page_id, $rev_id)
9825 // {
9826 // $ns = $title->getnamespace();
9827 // $dbk = $title->getdbkey();
9828 // $TMIt120 = $this->mTemplates;
9829 // $TLE63 = isset($TMIt120[$ns]);
9830 // $TLE64 = !$TLE63;
9831 // if (TLE64) goto L173 else goto L174;
9832 // L173:
9833 // $TSt65 =& $this->mTemplates;
9834 // unset($TSa66);
9835 // $TSa66 = (array) $TSa66;
9836 // $TSt65[$ns] = $TSa66;
9837 // goto L175;
9838 // L174:
9839 // goto L175;
9840 // L175:
9841 // $TSt67 =& $this->mTemplates;
9842 // $TSi68 =& $TSt67[$ns];
9843 // $TSi68[$dbk] = $page_id;
9844 // $TMIt121 = $this->mTemplateIds;
9845 // $TLE69 = isset($TMIt121[$ns]);
9846 // $TLE70 = !$TLE69;
9847 // if (TLE70) goto L176 else goto L177;
9848 // L176:
9849 // $TSt71 =& $this->mTemplateIds;
9850 // unset($TSa72);
9851 // $TSa72 = (array) $TSa72;
9852 // $TSt71[$ns] = $TSa72;
9853 // goto L178;
9854 // L177:
9855 // goto L178;
9856 // L178:
9857 // $TSt73 =& $this->mTemplateIds;
9858 // $TSi74 =& $TSt73[$ns];
9859 // $TSi74[$dbk] = $rev_id;
9860 // }
9861 PHP_METHOD(ParserOutput, addtemplate)
9863 zval* local_TLE63 = NULL;
9864 zval* local_TLE64 = NULL;
9865 zval* local_TLE69 = NULL;
9866 zval* local_TLE70 = NULL;
9867 zval* local_TMIt120 = NULL;
9868 zval* local_TMIt121 = NULL;
9869 zval* local_TSa66 = NULL;
9870 zval* local_TSa72 = NULL;
9871 zval* local_TSi68 = NULL;
9872 zval* local_TSi74 = NULL;
9873 zval* local_TSt65 = NULL;
9874 zval* local_TSt67 = NULL;
9875 zval* local_TSt71 = NULL;
9876 zval* local_TSt73 = NULL;
9877 zval* local_dbk = NULL;
9878 zval* local_ns = NULL;
9879 zval* local_page_id = NULL;
9880 zval* local_rev_id = NULL;
9881 zval* local_this = getThis();
9882 zval* local_title = NULL;
9883 // Add all parameters as local variables
9885 int num_args = ZEND_NUM_ARGS ();
9886 zval* params[3];
9887 zend_get_parameters_array(0, num_args, params);
9888 // param 0
9889 params[0]->refcount++;
9890 if (local_title != NULL)
9892 zval_ptr_dtor (&local_title);
9894 local_title = params[0];
9895 // param 1
9896 params[1]->refcount++;
9897 if (local_page_id != NULL)
9899 zval_ptr_dtor (&local_page_id);
9901 local_page_id = params[1];
9902 // param 2
9903 params[2]->refcount++;
9904 if (local_rev_id != NULL)
9906 zval_ptr_dtor (&local_rev_id);
9908 local_rev_id = params[2];
9910 // Function body
9911 // $ns = $title->getnamespace();
9913 if (local_title == NULL)
9915 local_title = EG (uninitialized_zval_ptr);
9916 local_title->refcount++;
9918 zval** p_obj = &local_title;
9920 zend_fcall_info fci_object;
9921 zend_fcall_info_cache fcic_object = {0, NULL, NULL, NULL};
9922 initialize_method_call (&fci_object, &fcic_object, p_obj, "getnamespace", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 115 TSRMLS_CC);
9923 zend_function* signature = fcic_object.function_handler;
9924 zend_arg_info* arg_info = signature->common.arg_info; // optional
9926 int by_ref[0];
9927 int abr_index = 0;
9930 // Setup array of arguments
9931 // TODO: i think arrays of size 0 is an error
9932 int destruct [0];
9933 zval* args [0];
9934 zval** args_ind [0];
9936 int af_index = 0;
9939 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 115, NULL TSRMLS_CC);
9941 // save existing parameters, in case of recursion
9942 int param_count_save = fci_object.param_count;
9943 zval*** params_save = fci_object.params;
9944 zval** retval_save = fci_object.retval_ptr_ptr;
9946 zval* rhs = NULL;
9948 // set up params
9949 fci_object.params = args_ind;
9950 fci_object.param_count = 0;
9951 fci_object.retval_ptr_ptr = &rhs;
9953 // call the function
9954 int success = zend_call_function (&fci_object, &fcic_object TSRMLS_CC);
9955 assert(success == SUCCESS);
9957 // restore params
9958 fci_object.params = params_save;
9959 fci_object.param_count = param_count_save;
9960 fci_object.retval_ptr_ptr = retval_save;
9962 // unset the errors
9963 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
9965 int i;
9966 for (i = 0; i < 0; i++)
9968 if (destruct[i])
9970 assert (destruct[i]);
9971 zval_ptr_dtor (args_ind[i]);
9976 // When the Zend engine returns by reference, it allocates a zval into
9977 // retval_ptr_ptr. To return by reference, the callee writes into the
9978 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
9979 // not actually return anything). So the zval returned - whether we return
9980 // it, or it is the allocated zval - has a refcount of 1.
9982 // The caller is responsible for cleaning that up (note, this is unaffected
9983 // by whether it is added to some COW set).
9985 // For reasons unknown, the Zend API resets the refcount and is_ref fields
9986 // of the return value after the function returns (unless the callee is
9987 // interpreted). If the function is supposed to return by reference, this
9988 // loses the refcount. This only happens when non-interpreted code is
9989 // called. We work around it, when compiled code is called, by saving the
9990 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
9991 // that we may create an error if our code is called by a callback, and
9992 // returns by reference, and the callback returns by reference. At least
9993 // this is an obscure case.
9994 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
9996 assert (rhs != EG(uninitialized_zval_ptr));
9997 rhs->is_ref = 1;
9998 if (saved_refcount != 0)
10000 rhs->refcount = saved_refcount;
10002 rhs->refcount++;
10004 saved_refcount = 0; // for 'obscure cases'
10006 if (local_ns == NULL)
10008 local_ns = EG (uninitialized_zval_ptr);
10009 local_ns->refcount++;
10011 zval** p_lhs = &local_ns;
10013 write_var (p_lhs, rhs);
10016 zval_ptr_dtor (&rhs);
10017 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
10018 zval_ptr_dtor (&rhs);
10020 phc_check_invariants (TSRMLS_C);
10022 // $dbk = $title->getdbkey();
10024 if (local_title == NULL)
10026 local_title = EG (uninitialized_zval_ptr);
10027 local_title->refcount++;
10029 zval** p_obj = &local_title;
10031 zend_fcall_info fci_object;
10032 zend_fcall_info_cache fcic_object = {0, NULL, NULL, NULL};
10033 initialize_method_call (&fci_object, &fcic_object, p_obj, "getdbkey", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 116 TSRMLS_CC);
10034 zend_function* signature = fcic_object.function_handler;
10035 zend_arg_info* arg_info = signature->common.arg_info; // optional
10037 int by_ref[0];
10038 int abr_index = 0;
10041 // Setup array of arguments
10042 // TODO: i think arrays of size 0 is an error
10043 int destruct [0];
10044 zval* args [0];
10045 zval** args_ind [0];
10047 int af_index = 0;
10050 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 116, NULL TSRMLS_CC);
10052 // save existing parameters, in case of recursion
10053 int param_count_save = fci_object.param_count;
10054 zval*** params_save = fci_object.params;
10055 zval** retval_save = fci_object.retval_ptr_ptr;
10057 zval* rhs = NULL;
10059 // set up params
10060 fci_object.params = args_ind;
10061 fci_object.param_count = 0;
10062 fci_object.retval_ptr_ptr = &rhs;
10064 // call the function
10065 int success = zend_call_function (&fci_object, &fcic_object TSRMLS_CC);
10066 assert(success == SUCCESS);
10068 // restore params
10069 fci_object.params = params_save;
10070 fci_object.param_count = param_count_save;
10071 fci_object.retval_ptr_ptr = retval_save;
10073 // unset the errors
10074 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
10076 int i;
10077 for (i = 0; i < 0; i++)
10079 if (destruct[i])
10081 assert (destruct[i]);
10082 zval_ptr_dtor (args_ind[i]);
10087 // When the Zend engine returns by reference, it allocates a zval into
10088 // retval_ptr_ptr. To return by reference, the callee writes into the
10089 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
10090 // not actually return anything). So the zval returned - whether we return
10091 // it, or it is the allocated zval - has a refcount of 1.
10093 // The caller is responsible for cleaning that up (note, this is unaffected
10094 // by whether it is added to some COW set).
10096 // For reasons unknown, the Zend API resets the refcount and is_ref fields
10097 // of the return value after the function returns (unless the callee is
10098 // interpreted). If the function is supposed to return by reference, this
10099 // loses the refcount. This only happens when non-interpreted code is
10100 // called. We work around it, when compiled code is called, by saving the
10101 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
10102 // that we may create an error if our code is called by a callback, and
10103 // returns by reference, and the callback returns by reference. At least
10104 // this is an obscure case.
10105 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
10107 assert (rhs != EG(uninitialized_zval_ptr));
10108 rhs->is_ref = 1;
10109 if (saved_refcount != 0)
10111 rhs->refcount = saved_refcount;
10113 rhs->refcount++;
10115 saved_refcount = 0; // for 'obscure cases'
10117 if (local_dbk == NULL)
10119 local_dbk = EG (uninitialized_zval_ptr);
10120 local_dbk->refcount++;
10122 zval** p_lhs = &local_dbk;
10124 write_var (p_lhs, rhs);
10127 zval_ptr_dtor (&rhs);
10128 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
10129 zval_ptr_dtor (&rhs);
10131 phc_check_invariants (TSRMLS_C);
10133 // $TMIt120 = $this->mTemplates;
10135 if (local_this == NULL)
10137 local_this = EG (uninitialized_zval_ptr);
10138 local_this->refcount++;
10140 zval** p_obj = &local_this;
10142 zval field_name;
10143 INIT_ZVAL (field_name);
10144 ZVAL_STRING (&field_name, "mTemplates", 0);
10146 // I *think* this is correct, but documentation of the Zend API is scarce :)
10147 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
10148 if (local_TMIt120 == NULL)
10150 local_TMIt120 = EG (uninitialized_zval_ptr);
10151 local_TMIt120->refcount++;
10153 zval** p_lhs = &local_TMIt120;
10155 write_var (p_lhs, field);
10156 phc_check_invariants (TSRMLS_C);
10158 // $TLE63 = isset($TMIt120[$ns]);
10160 if (local_TLE63 == NULL)
10162 local_TLE63 = EG (uninitialized_zval_ptr);
10163 local_TLE63->refcount++;
10165 zval** p_lhs = &local_TLE63;
10166 zval* value;
10167 if ((*p_lhs)->is_ref)
10169 // Always overwrite the current value
10170 value = *p_lhs;
10171 zval_dtor (value);
10173 else
10175 ALLOC_INIT_ZVAL (value);
10176 zval_ptr_dtor (p_lhs);
10177 *p_lhs = value;
10179 if (local_TMIt120 == NULL)
10181 local_TMIt120 = EG (uninitialized_zval_ptr);
10182 local_TMIt120->refcount++;
10184 zval** u_array = &local_TMIt120;
10185 zval* u_index;
10186 if (local_ns == NULL)
10188 u_index = EG (uninitialized_zval_ptr);
10190 else
10192 u_index = local_ns;
10194 ZVAL_BOOL(value, isset_array (u_array, u_index));
10195 phc_check_invariants (TSRMLS_C);
10197 // $TLE64 = !$TLE63;
10199 if (local_TLE64 == NULL)
10201 local_TLE64 = EG (uninitialized_zval_ptr);
10202 local_TLE64->refcount++;
10204 zval** p_lhs = &local_TLE64;
10206 zval* rhs;
10207 if (local_TLE63 == NULL)
10208 rhs = EG (uninitialized_zval_ptr);
10209 else
10210 rhs = local_TLE63;
10212 if (in_copy_on_write (*p_lhs))
10214 zval_ptr_dtor (p_lhs);
10215 ALLOC_INIT_ZVAL (*p_lhs);
10218 zval old = **p_lhs;
10219 int result_is_operand = (*p_lhs == rhs);
10220 boolean_not_function (*p_lhs, rhs TSRMLS_CC);
10221 if (!result_is_operand)
10222 zval_dtor (&old);
10223 phc_check_invariants (TSRMLS_C);
10225 // if (TLE64) goto L173 else goto L174;
10227 zval* p_cond;
10228 if (local_TLE64 == NULL)
10229 p_cond = EG (uninitialized_zval_ptr);
10230 else
10231 p_cond = local_TLE64;
10233 zend_bool bcond = zend_is_true (p_cond);
10234 if (bcond)
10235 goto L173;
10236 else
10237 goto L174;
10238 phc_check_invariants (TSRMLS_C);
10240 // L173:
10241 L173:;
10242 // $TSt65 =& $this->mTemplates;
10244 if (local_this == NULL)
10246 local_this = EG (uninitialized_zval_ptr);
10247 local_this->refcount++;
10249 zval** p_obj = &local_this;
10251 zval field_name;
10252 INIT_ZVAL (field_name);
10253 ZVAL_STRING (&field_name, "mTemplates", 0);
10255 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
10256 sep_copy_on_write (field);
10257 if (local_TSt65 == NULL)
10259 local_TSt65 = EG (uninitialized_zval_ptr);
10260 local_TSt65->refcount++;
10262 zval** p_lhs = &local_TSt65;
10264 copy_into_ref (p_lhs, field);
10265 phc_check_invariants (TSRMLS_C);
10267 // unset($TSa66);
10269 if (local_TSa66 != NULL)
10271 zval_ptr_dtor (&local_TSa66);
10272 local_TSa66 = NULL;
10274 phc_check_invariants (TSRMLS_C);
10276 // $TSa66 = (array) $TSa66;
10278 if (local_TSa66 == NULL)
10280 local_TSa66 = EG (uninitialized_zval_ptr);
10281 local_TSa66->refcount++;
10283 zval** p_lhs = &local_TSa66;
10285 zval* rhs;
10286 if (local_TSa66 == NULL)
10287 rhs = EG (uninitialized_zval_ptr);
10288 else
10289 rhs = local_TSa66;
10291 if (*p_lhs != rhs)
10293 if ((*p_lhs)->is_ref)
10294 overwrite_lhs (*p_lhs, rhs);
10295 else
10297 zval_ptr_dtor (p_lhs);
10298 if (rhs->is_ref)
10300 // Take a copy of RHS for LHS
10301 *p_lhs = zvp_clone_ex (rhs);
10303 else
10305 // Share a copy
10306 rhs->refcount++;
10307 *p_lhs = rhs;
10314 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
10315 if ((*p_lhs)->type != IS_ARRAY)
10317 sep_copy_on_write (p_lhs);
10318 convert_to_array (*p_lhs);
10321 phc_check_invariants (TSRMLS_C);
10323 // $TSt65[$ns] = $TSa66;
10325 if (local_TSt65 == NULL)
10327 local_TSt65 = EG (uninitialized_zval_ptr);
10328 local_TSt65->refcount++;
10330 zval** p_array = &local_TSt65;
10332 check_array_type (p_array TSRMLS_CC);
10334 zval* index;
10335 if (local_ns == NULL)
10336 index = EG (uninitialized_zval_ptr);
10337 else
10338 index = local_ns;
10341 // String indexing
10342 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
10344 zval* rhs;
10345 if (local_TSa66 == NULL)
10346 rhs = EG (uninitialized_zval_ptr);
10347 else
10348 rhs = local_TSa66;
10350 write_string_index (p_array, index, rhs TSRMLS_CC);
10352 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
10354 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
10355 zval* rhs;
10356 if (local_TSa66 == NULL)
10357 rhs = EG (uninitialized_zval_ptr);
10358 else
10359 rhs = local_TSa66;
10361 if (*p_lhs != rhs)
10363 write_var (p_lhs, rhs);
10366 phc_check_invariants (TSRMLS_C);
10368 // goto L175;
10370 goto L175;
10371 phc_check_invariants (TSRMLS_C);
10373 // L174:
10374 L174:;
10375 // goto L175;
10377 goto L175;
10378 phc_check_invariants (TSRMLS_C);
10380 // L175:
10381 L175:;
10382 // $TSt67 =& $this->mTemplates;
10384 if (local_this == NULL)
10386 local_this = EG (uninitialized_zval_ptr);
10387 local_this->refcount++;
10389 zval** p_obj = &local_this;
10391 zval field_name;
10392 INIT_ZVAL (field_name);
10393 ZVAL_STRING (&field_name, "mTemplates", 0);
10395 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
10396 sep_copy_on_write (field);
10397 if (local_TSt67 == NULL)
10399 local_TSt67 = EG (uninitialized_zval_ptr);
10400 local_TSt67->refcount++;
10402 zval** p_lhs = &local_TSt67;
10404 copy_into_ref (p_lhs, field);
10405 phc_check_invariants (TSRMLS_C);
10407 // $TSi68 =& $TSt67[$ns];
10409 if (local_TSi68 == NULL)
10411 local_TSi68 = EG (uninitialized_zval_ptr);
10412 local_TSi68->refcount++;
10414 zval** p_lhs = &local_TSi68;
10416 if (local_TSt67 == NULL)
10418 local_TSt67 = EG (uninitialized_zval_ptr);
10419 local_TSt67->refcount++;
10421 zval** p_r_array = &local_TSt67;
10423 zval* r_index;
10424 if (local_ns == NULL)
10425 r_index = EG (uninitialized_zval_ptr);
10426 else
10427 r_index = local_ns;
10429 check_array_type (p_r_array TSRMLS_CC);
10430 zval** p_rhs = get_ht_entry (p_r_array, r_index TSRMLS_CC);
10431 sep_copy_on_write (p_rhs);
10432 copy_into_ref (p_lhs, p_rhs);
10433 phc_check_invariants (TSRMLS_C);
10435 // $TSi68[$dbk] = $page_id;
10437 if (local_TSi68 == NULL)
10439 local_TSi68 = EG (uninitialized_zval_ptr);
10440 local_TSi68->refcount++;
10442 zval** p_array = &local_TSi68;
10444 check_array_type (p_array TSRMLS_CC);
10446 zval* index;
10447 if (local_dbk == NULL)
10448 index = EG (uninitialized_zval_ptr);
10449 else
10450 index = local_dbk;
10453 // String indexing
10454 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
10456 zval* rhs;
10457 if (local_page_id == NULL)
10458 rhs = EG (uninitialized_zval_ptr);
10459 else
10460 rhs = local_page_id;
10462 write_string_index (p_array, index, rhs TSRMLS_CC);
10464 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
10466 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
10467 zval* rhs;
10468 if (local_page_id == NULL)
10469 rhs = EG (uninitialized_zval_ptr);
10470 else
10471 rhs = local_page_id;
10473 if (*p_lhs != rhs)
10475 write_var (p_lhs, rhs);
10478 phc_check_invariants (TSRMLS_C);
10480 // $TMIt121 = $this->mTemplateIds;
10482 if (local_this == NULL)
10484 local_this = EG (uninitialized_zval_ptr);
10485 local_this->refcount++;
10487 zval** p_obj = &local_this;
10489 zval field_name;
10490 INIT_ZVAL (field_name);
10491 ZVAL_STRING (&field_name, "mTemplateIds", 0);
10493 // I *think* this is correct, but documentation of the Zend API is scarce :)
10494 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
10495 if (local_TMIt121 == NULL)
10497 local_TMIt121 = EG (uninitialized_zval_ptr);
10498 local_TMIt121->refcount++;
10500 zval** p_lhs = &local_TMIt121;
10502 write_var (p_lhs, field);
10503 phc_check_invariants (TSRMLS_C);
10505 // $TLE69 = isset($TMIt121[$ns]);
10507 if (local_TLE69 == NULL)
10509 local_TLE69 = EG (uninitialized_zval_ptr);
10510 local_TLE69->refcount++;
10512 zval** p_lhs = &local_TLE69;
10513 zval* value;
10514 if ((*p_lhs)->is_ref)
10516 // Always overwrite the current value
10517 value = *p_lhs;
10518 zval_dtor (value);
10520 else
10522 ALLOC_INIT_ZVAL (value);
10523 zval_ptr_dtor (p_lhs);
10524 *p_lhs = value;
10526 if (local_TMIt121 == NULL)
10528 local_TMIt121 = EG (uninitialized_zval_ptr);
10529 local_TMIt121->refcount++;
10531 zval** u_array = &local_TMIt121;
10532 zval* u_index;
10533 if (local_ns == NULL)
10535 u_index = EG (uninitialized_zval_ptr);
10537 else
10539 u_index = local_ns;
10541 ZVAL_BOOL(value, isset_array (u_array, u_index));
10542 phc_check_invariants (TSRMLS_C);
10544 // $TLE70 = !$TLE69;
10546 if (local_TLE70 == NULL)
10548 local_TLE70 = EG (uninitialized_zval_ptr);
10549 local_TLE70->refcount++;
10551 zval** p_lhs = &local_TLE70;
10553 zval* rhs;
10554 if (local_TLE69 == NULL)
10555 rhs = EG (uninitialized_zval_ptr);
10556 else
10557 rhs = local_TLE69;
10559 if (in_copy_on_write (*p_lhs))
10561 zval_ptr_dtor (p_lhs);
10562 ALLOC_INIT_ZVAL (*p_lhs);
10565 zval old = **p_lhs;
10566 int result_is_operand = (*p_lhs == rhs);
10567 boolean_not_function (*p_lhs, rhs TSRMLS_CC);
10568 if (!result_is_operand)
10569 zval_dtor (&old);
10570 phc_check_invariants (TSRMLS_C);
10572 // if (TLE70) goto L176 else goto L177;
10574 zval* p_cond;
10575 if (local_TLE70 == NULL)
10576 p_cond = EG (uninitialized_zval_ptr);
10577 else
10578 p_cond = local_TLE70;
10580 zend_bool bcond = zend_is_true (p_cond);
10581 if (bcond)
10582 goto L176;
10583 else
10584 goto L177;
10585 phc_check_invariants (TSRMLS_C);
10587 // L176:
10588 L176:;
10589 // $TSt71 =& $this->mTemplateIds;
10591 if (local_this == NULL)
10593 local_this = EG (uninitialized_zval_ptr);
10594 local_this->refcount++;
10596 zval** p_obj = &local_this;
10598 zval field_name;
10599 INIT_ZVAL (field_name);
10600 ZVAL_STRING (&field_name, "mTemplateIds", 0);
10602 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
10603 sep_copy_on_write (field);
10604 if (local_TSt71 == NULL)
10606 local_TSt71 = EG (uninitialized_zval_ptr);
10607 local_TSt71->refcount++;
10609 zval** p_lhs = &local_TSt71;
10611 copy_into_ref (p_lhs, field);
10612 phc_check_invariants (TSRMLS_C);
10614 // unset($TSa72);
10616 if (local_TSa72 != NULL)
10618 zval_ptr_dtor (&local_TSa72);
10619 local_TSa72 = NULL;
10621 phc_check_invariants (TSRMLS_C);
10623 // $TSa72 = (array) $TSa72;
10625 if (local_TSa72 == NULL)
10627 local_TSa72 = EG (uninitialized_zval_ptr);
10628 local_TSa72->refcount++;
10630 zval** p_lhs = &local_TSa72;
10632 zval* rhs;
10633 if (local_TSa72 == NULL)
10634 rhs = EG (uninitialized_zval_ptr);
10635 else
10636 rhs = local_TSa72;
10638 if (*p_lhs != rhs)
10640 if ((*p_lhs)->is_ref)
10641 overwrite_lhs (*p_lhs, rhs);
10642 else
10644 zval_ptr_dtor (p_lhs);
10645 if (rhs->is_ref)
10647 // Take a copy of RHS for LHS
10648 *p_lhs = zvp_clone_ex (rhs);
10650 else
10652 // Share a copy
10653 rhs->refcount++;
10654 *p_lhs = rhs;
10661 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
10662 if ((*p_lhs)->type != IS_ARRAY)
10664 sep_copy_on_write (p_lhs);
10665 convert_to_array (*p_lhs);
10668 phc_check_invariants (TSRMLS_C);
10670 // $TSt71[$ns] = $TSa72;
10672 if (local_TSt71 == NULL)
10674 local_TSt71 = EG (uninitialized_zval_ptr);
10675 local_TSt71->refcount++;
10677 zval** p_array = &local_TSt71;
10679 check_array_type (p_array TSRMLS_CC);
10681 zval* index;
10682 if (local_ns == NULL)
10683 index = EG (uninitialized_zval_ptr);
10684 else
10685 index = local_ns;
10688 // String indexing
10689 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
10691 zval* rhs;
10692 if (local_TSa72 == NULL)
10693 rhs = EG (uninitialized_zval_ptr);
10694 else
10695 rhs = local_TSa72;
10697 write_string_index (p_array, index, rhs TSRMLS_CC);
10699 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
10701 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
10702 zval* rhs;
10703 if (local_TSa72 == NULL)
10704 rhs = EG (uninitialized_zval_ptr);
10705 else
10706 rhs = local_TSa72;
10708 if (*p_lhs != rhs)
10710 write_var (p_lhs, rhs);
10713 phc_check_invariants (TSRMLS_C);
10715 // goto L178;
10717 goto L178;
10718 phc_check_invariants (TSRMLS_C);
10720 // L177:
10721 L177:;
10722 // goto L178;
10724 goto L178;
10725 phc_check_invariants (TSRMLS_C);
10727 // L178:
10728 L178:;
10729 // $TSt73 =& $this->mTemplateIds;
10731 if (local_this == NULL)
10733 local_this = EG (uninitialized_zval_ptr);
10734 local_this->refcount++;
10736 zval** p_obj = &local_this;
10738 zval field_name;
10739 INIT_ZVAL (field_name);
10740 ZVAL_STRING (&field_name, "mTemplateIds", 0);
10742 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
10743 sep_copy_on_write (field);
10744 if (local_TSt73 == NULL)
10746 local_TSt73 = EG (uninitialized_zval_ptr);
10747 local_TSt73->refcount++;
10749 zval** p_lhs = &local_TSt73;
10751 copy_into_ref (p_lhs, field);
10752 phc_check_invariants (TSRMLS_C);
10754 // $TSi74 =& $TSt73[$ns];
10756 if (local_TSi74 == NULL)
10758 local_TSi74 = EG (uninitialized_zval_ptr);
10759 local_TSi74->refcount++;
10761 zval** p_lhs = &local_TSi74;
10763 if (local_TSt73 == NULL)
10765 local_TSt73 = EG (uninitialized_zval_ptr);
10766 local_TSt73->refcount++;
10768 zval** p_r_array = &local_TSt73;
10770 zval* r_index;
10771 if (local_ns == NULL)
10772 r_index = EG (uninitialized_zval_ptr);
10773 else
10774 r_index = local_ns;
10776 check_array_type (p_r_array TSRMLS_CC);
10777 zval** p_rhs = get_ht_entry (p_r_array, r_index TSRMLS_CC);
10778 sep_copy_on_write (p_rhs);
10779 copy_into_ref (p_lhs, p_rhs);
10780 phc_check_invariants (TSRMLS_C);
10782 // $TSi74[$dbk] = $rev_id;
10784 if (local_TSi74 == NULL)
10786 local_TSi74 = EG (uninitialized_zval_ptr);
10787 local_TSi74->refcount++;
10789 zval** p_array = &local_TSi74;
10791 check_array_type (p_array TSRMLS_CC);
10793 zval* index;
10794 if (local_dbk == NULL)
10795 index = EG (uninitialized_zval_ptr);
10796 else
10797 index = local_dbk;
10800 // String indexing
10801 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
10803 zval* rhs;
10804 if (local_rev_id == NULL)
10805 rhs = EG (uninitialized_zval_ptr);
10806 else
10807 rhs = local_rev_id;
10809 write_string_index (p_array, index, rhs TSRMLS_CC);
10811 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
10813 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
10814 zval* rhs;
10815 if (local_rev_id == NULL)
10816 rhs = EG (uninitialized_zval_ptr);
10817 else
10818 rhs = local_rev_id;
10820 if (*p_lhs != rhs)
10822 write_var (p_lhs, rhs);
10825 phc_check_invariants (TSRMLS_C);
10827 // Method exit
10828 end_of_function:__attribute__((unused));
10829 if (local_TLE63 != NULL)
10831 zval_ptr_dtor (&local_TLE63);
10833 if (local_TLE64 != NULL)
10835 zval_ptr_dtor (&local_TLE64);
10837 if (local_TLE69 != NULL)
10839 zval_ptr_dtor (&local_TLE69);
10841 if (local_TLE70 != NULL)
10843 zval_ptr_dtor (&local_TLE70);
10845 if (local_TMIt120 != NULL)
10847 zval_ptr_dtor (&local_TMIt120);
10849 if (local_TMIt121 != NULL)
10851 zval_ptr_dtor (&local_TMIt121);
10853 if (local_TSa66 != NULL)
10855 zval_ptr_dtor (&local_TSa66);
10857 if (local_TSa72 != NULL)
10859 zval_ptr_dtor (&local_TSa72);
10861 if (local_TSi68 != NULL)
10863 zval_ptr_dtor (&local_TSi68);
10865 if (local_TSi74 != NULL)
10867 zval_ptr_dtor (&local_TSi74);
10869 if (local_TSt65 != NULL)
10871 zval_ptr_dtor (&local_TSt65);
10873 if (local_TSt67 != NULL)
10875 zval_ptr_dtor (&local_TSt67);
10877 if (local_TSt71 != NULL)
10879 zval_ptr_dtor (&local_TSt71);
10881 if (local_TSt73 != NULL)
10883 zval_ptr_dtor (&local_TSt73);
10885 if (local_dbk != NULL)
10887 zval_ptr_dtor (&local_dbk);
10889 if (local_ns != NULL)
10891 zval_ptr_dtor (&local_ns);
10893 if (local_page_id != NULL)
10895 zval_ptr_dtor (&local_page_id);
10897 if (local_rev_id != NULL)
10899 zval_ptr_dtor (&local_rev_id);
10901 if (local_title != NULL)
10903 zval_ptr_dtor (&local_title);
10906 // function expired($touched)
10907 // {
10908 // global $wgCacheEpoch;
10909 // $TLE75 = $this->getcachetime();
10910 // $TLE76 = -1;
10911 // $TLE0 = ($TLE75 == $TLE76);
10912 // if (TLE0) goto L179 else goto L180;
10913 // L179:
10914 // $TEF1 = $TLE0;
10915 // goto L181;
10916 // L180:
10917 // $TLE77 = $this->getcachetime();
10918 // $TEF1 = ($TLE77 < $touched);
10919 // goto L181;
10920 // L181:
10921 // $TLE2 = (bool) $TEF1;
10922 // if (TLE2) goto L182 else goto L183;
10923 // L182:
10924 // $TEF3 = $TLE2;
10925 // goto L184;
10926 // L183:
10927 // $TLE78 = $this->getcachetime();
10928 // $TEF3 = ($TLE78 <= $wgCacheEpoch);
10929 // goto L184;
10930 // L184:
10931 // $TLE4 = (bool) $TEF3;
10932 // if (TLE4) goto L185 else goto L186;
10933 // L185:
10934 // $TEF5 = $TLE4;
10935 // goto L187;
10936 // L186:
10937 // $TMIt122 = $this->mVersion;
10938 // $TLE79 = isset($TMIt122);
10939 // $TEF5 = !$TLE79;
10940 // goto L187;
10941 // L187:
10942 // $TLE6 = (bool) $TEF5;
10943 // if (TLE6) goto L191 else goto L192;
10944 // L191:
10945 // $TEF7 = $TLE6;
10946 // goto L193;
10947 // L192:
10948 // $TLE80 = Parser::VERSION;
10949 // $TLE81 = 'lt';
10950 // $TLE124 = param_is_ref (NULL, "version_compare", 0);
10951 // ;
10952 // if (TLE124) goto L188 else goto L189;
10953 // L188:
10954 // $TMIt123 =& $this->mVersion;
10955 // goto L190;
10956 // L189:
10957 // $TMIt123 = $this->mVersion;
10958 // goto L190;
10959 // L190:
10960 // $TEF7 = version_compare($TMIt123, $TLE80, $TLE81);
10961 // goto L193;
10962 // L193:
10963 // $TLE82 = (bool) $TEF7;
10964 // return $TLE82;
10965 // }
10966 PHP_METHOD(ParserOutput, expired)
10968 zval* local_TEF1 = NULL;
10969 zval* local_TEF3 = NULL;
10970 zval* local_TEF5 = NULL;
10971 zval* local_TEF7 = NULL;
10972 zval* local_TLE0 = NULL;
10973 zval* local_TLE124 = NULL;
10974 zval* local_TLE2 = NULL;
10975 zval* local_TLE4 = NULL;
10976 zval* local_TLE6 = NULL;
10977 zval* local_TLE75 = NULL;
10978 zval* local_TLE76 = NULL;
10979 zval* local_TLE77 = NULL;
10980 zval* local_TLE78 = NULL;
10981 zval* local_TLE79 = NULL;
10982 zval* local_TLE80 = NULL;
10983 zval* local_TLE81 = NULL;
10984 zval* local_TLE82 = NULL;
10985 zval* local_TMIt122 = NULL;
10986 zval* local_TMIt123 = NULL;
10987 zval* local_this = getThis();
10988 zval* local_touched = NULL;
10989 zval* local_wgCacheEpoch = NULL;
10990 // Add all parameters as local variables
10992 int num_args = ZEND_NUM_ARGS ();
10993 zval* params[1];
10994 zend_get_parameters_array(0, num_args, params);
10995 // param 0
10996 params[0]->refcount++;
10997 if (local_touched != NULL)
10999 zval_ptr_dtor (&local_touched);
11001 local_touched = params[0];
11003 // Function body
11004 // global $wgCacheEpoch;
11006 if (local_wgCacheEpoch == NULL)
11008 local_wgCacheEpoch = EG (uninitialized_zval_ptr);
11009 local_wgCacheEpoch->refcount++;
11011 zval** p_local = &local_wgCacheEpoch;
11013 zval** p_global = get_st_entry (&EG(symbol_table), "wgCacheEpoch", 12 + 1, 2181899014u TSRMLS_CC);
11015 sep_copy_on_write (p_global);
11016 copy_into_ref (p_local, p_global);
11017 phc_check_invariants (TSRMLS_C);
11019 // $TLE75 = $this->getcachetime();
11021 if (local_this == NULL)
11023 local_this = EG (uninitialized_zval_ptr);
11024 local_this->refcount++;
11026 zval** p_obj = &local_this;
11028 zend_fcall_info fci_object;
11029 zend_fcall_info_cache fcic_object = {0, NULL, NULL, NULL};
11030 initialize_method_call (&fci_object, &fcic_object, p_obj, "getcachetime", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 138 TSRMLS_CC);
11031 zend_function* signature = fcic_object.function_handler;
11032 zend_arg_info* arg_info = signature->common.arg_info; // optional
11034 int by_ref[0];
11035 int abr_index = 0;
11038 // Setup array of arguments
11039 // TODO: i think arrays of size 0 is an error
11040 int destruct [0];
11041 zval* args [0];
11042 zval** args_ind [0];
11044 int af_index = 0;
11047 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 138, NULL TSRMLS_CC);
11049 // save existing parameters, in case of recursion
11050 int param_count_save = fci_object.param_count;
11051 zval*** params_save = fci_object.params;
11052 zval** retval_save = fci_object.retval_ptr_ptr;
11054 zval* rhs = NULL;
11056 // set up params
11057 fci_object.params = args_ind;
11058 fci_object.param_count = 0;
11059 fci_object.retval_ptr_ptr = &rhs;
11061 // call the function
11062 int success = zend_call_function (&fci_object, &fcic_object TSRMLS_CC);
11063 assert(success == SUCCESS);
11065 // restore params
11066 fci_object.params = params_save;
11067 fci_object.param_count = param_count_save;
11068 fci_object.retval_ptr_ptr = retval_save;
11070 // unset the errors
11071 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
11073 int i;
11074 for (i = 0; i < 0; i++)
11076 if (destruct[i])
11078 assert (destruct[i]);
11079 zval_ptr_dtor (args_ind[i]);
11084 // When the Zend engine returns by reference, it allocates a zval into
11085 // retval_ptr_ptr. To return by reference, the callee writes into the
11086 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
11087 // not actually return anything). So the zval returned - whether we return
11088 // it, or it is the allocated zval - has a refcount of 1.
11090 // The caller is responsible for cleaning that up (note, this is unaffected
11091 // by whether it is added to some COW set).
11093 // For reasons unknown, the Zend API resets the refcount and is_ref fields
11094 // of the return value after the function returns (unless the callee is
11095 // interpreted). If the function is supposed to return by reference, this
11096 // loses the refcount. This only happens when non-interpreted code is
11097 // called. We work around it, when compiled code is called, by saving the
11098 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
11099 // that we may create an error if our code is called by a callback, and
11100 // returns by reference, and the callback returns by reference. At least
11101 // this is an obscure case.
11102 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
11104 assert (rhs != EG(uninitialized_zval_ptr));
11105 rhs->is_ref = 1;
11106 if (saved_refcount != 0)
11108 rhs->refcount = saved_refcount;
11110 rhs->refcount++;
11112 saved_refcount = 0; // for 'obscure cases'
11114 if (local_TLE75 == NULL)
11116 local_TLE75 = EG (uninitialized_zval_ptr);
11117 local_TLE75->refcount++;
11119 zval** p_lhs = &local_TLE75;
11121 write_var (p_lhs, rhs);
11124 zval_ptr_dtor (&rhs);
11125 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
11126 zval_ptr_dtor (&rhs);
11128 phc_check_invariants (TSRMLS_C);
11130 // $TLE76 = -1;
11132 if (local_TLE76 == NULL)
11134 local_TLE76 = EG (uninitialized_zval_ptr);
11135 local_TLE76->refcount++;
11137 zval** p_lhs = &local_TLE76;
11139 zval* value;
11140 if ((*p_lhs)->is_ref)
11142 // Always overwrite the current value
11143 value = *p_lhs;
11144 zval_dtor (value);
11146 else
11148 ALLOC_INIT_ZVAL (value);
11149 zval_ptr_dtor (p_lhs);
11150 *p_lhs = value;
11153 ZVAL_LONG (value, -1);
11155 phc_check_invariants (TSRMLS_C);
11157 // $TLE0 = ($TLE75 == $TLE76);
11159 if (local_TLE0 == NULL)
11161 local_TLE0 = EG (uninitialized_zval_ptr);
11162 local_TLE0->refcount++;
11164 zval** p_lhs = &local_TLE0;
11166 zval* left;
11167 if (local_TLE75 == NULL)
11168 left = EG (uninitialized_zval_ptr);
11169 else
11170 left = local_TLE75;
11172 zval* right;
11173 if (local_TLE76 == NULL)
11174 right = EG (uninitialized_zval_ptr);
11175 else
11176 right = local_TLE76;
11178 if (in_copy_on_write (*p_lhs))
11180 zval_ptr_dtor (p_lhs);
11181 ALLOC_INIT_ZVAL (*p_lhs);
11184 zval old = **p_lhs;
11185 int result_is_operand = (*p_lhs == left || *p_lhs == right);
11186 is_equal_function (*p_lhs, left, right TSRMLS_CC);
11188 // If the result is one of the operands, the operator function
11189 // will already have cleaned up the result
11190 if (!result_is_operand)
11191 zval_dtor (&old);
11192 phc_check_invariants (TSRMLS_C);
11194 // if (TLE0) goto L179 else goto L180;
11196 zval* p_cond;
11197 if (local_TLE0 == NULL)
11198 p_cond = EG (uninitialized_zval_ptr);
11199 else
11200 p_cond = local_TLE0;
11202 zend_bool bcond = zend_is_true (p_cond);
11203 if (bcond)
11204 goto L179;
11205 else
11206 goto L180;
11207 phc_check_invariants (TSRMLS_C);
11209 // L179:
11210 L179:;
11211 // $TEF1 = $TLE0;
11213 if (local_TEF1 == NULL)
11215 local_TEF1 = EG (uninitialized_zval_ptr);
11216 local_TEF1->refcount++;
11218 zval** p_lhs = &local_TEF1;
11220 zval* rhs;
11221 if (local_TLE0 == NULL)
11222 rhs = EG (uninitialized_zval_ptr);
11223 else
11224 rhs = local_TLE0;
11226 if (*p_lhs != rhs)
11228 if ((*p_lhs)->is_ref)
11229 overwrite_lhs (*p_lhs, rhs);
11230 else
11232 zval_ptr_dtor (p_lhs);
11233 if (rhs->is_ref)
11235 // Take a copy of RHS for LHS
11236 *p_lhs = zvp_clone_ex (rhs);
11238 else
11240 // Share a copy
11241 rhs->refcount++;
11242 *p_lhs = rhs;
11248 phc_check_invariants (TSRMLS_C);
11250 // goto L181;
11252 goto L181;
11253 phc_check_invariants (TSRMLS_C);
11255 // L180:
11256 L180:;
11257 // $TLE77 = $this->getcachetime();
11259 if (local_this == NULL)
11261 local_this = EG (uninitialized_zval_ptr);
11262 local_this->refcount++;
11264 zval** p_obj = &local_this;
11266 zend_fcall_info fci_object;
11267 zend_fcall_info_cache fcic_object = {0, NULL, NULL, NULL};
11268 initialize_method_call (&fci_object, &fcic_object, p_obj, "getcachetime", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 139 TSRMLS_CC);
11269 zend_function* signature = fcic_object.function_handler;
11270 zend_arg_info* arg_info = signature->common.arg_info; // optional
11272 int by_ref[0];
11273 int abr_index = 0;
11276 // Setup array of arguments
11277 // TODO: i think arrays of size 0 is an error
11278 int destruct [0];
11279 zval* args [0];
11280 zval** args_ind [0];
11282 int af_index = 0;
11285 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 139, NULL TSRMLS_CC);
11287 // save existing parameters, in case of recursion
11288 int param_count_save = fci_object.param_count;
11289 zval*** params_save = fci_object.params;
11290 zval** retval_save = fci_object.retval_ptr_ptr;
11292 zval* rhs = NULL;
11294 // set up params
11295 fci_object.params = args_ind;
11296 fci_object.param_count = 0;
11297 fci_object.retval_ptr_ptr = &rhs;
11299 // call the function
11300 int success = zend_call_function (&fci_object, &fcic_object TSRMLS_CC);
11301 assert(success == SUCCESS);
11303 // restore params
11304 fci_object.params = params_save;
11305 fci_object.param_count = param_count_save;
11306 fci_object.retval_ptr_ptr = retval_save;
11308 // unset the errors
11309 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
11311 int i;
11312 for (i = 0; i < 0; i++)
11314 if (destruct[i])
11316 assert (destruct[i]);
11317 zval_ptr_dtor (args_ind[i]);
11322 // When the Zend engine returns by reference, it allocates a zval into
11323 // retval_ptr_ptr. To return by reference, the callee writes into the
11324 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
11325 // not actually return anything). So the zval returned - whether we return
11326 // it, or it is the allocated zval - has a refcount of 1.
11328 // The caller is responsible for cleaning that up (note, this is unaffected
11329 // by whether it is added to some COW set).
11331 // For reasons unknown, the Zend API resets the refcount and is_ref fields
11332 // of the return value after the function returns (unless the callee is
11333 // interpreted). If the function is supposed to return by reference, this
11334 // loses the refcount. This only happens when non-interpreted code is
11335 // called. We work around it, when compiled code is called, by saving the
11336 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
11337 // that we may create an error if our code is called by a callback, and
11338 // returns by reference, and the callback returns by reference. At least
11339 // this is an obscure case.
11340 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
11342 assert (rhs != EG(uninitialized_zval_ptr));
11343 rhs->is_ref = 1;
11344 if (saved_refcount != 0)
11346 rhs->refcount = saved_refcount;
11348 rhs->refcount++;
11350 saved_refcount = 0; // for 'obscure cases'
11352 if (local_TLE77 == NULL)
11354 local_TLE77 = EG (uninitialized_zval_ptr);
11355 local_TLE77->refcount++;
11357 zval** p_lhs = &local_TLE77;
11359 write_var (p_lhs, rhs);
11362 zval_ptr_dtor (&rhs);
11363 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
11364 zval_ptr_dtor (&rhs);
11366 phc_check_invariants (TSRMLS_C);
11368 // $TEF1 = ($TLE77 < $touched);
11370 if (local_TEF1 == NULL)
11372 local_TEF1 = EG (uninitialized_zval_ptr);
11373 local_TEF1->refcount++;
11375 zval** p_lhs = &local_TEF1;
11377 zval* left;
11378 if (local_TLE77 == NULL)
11379 left = EG (uninitialized_zval_ptr);
11380 else
11381 left = local_TLE77;
11383 zval* right;
11384 if (local_touched == NULL)
11385 right = EG (uninitialized_zval_ptr);
11386 else
11387 right = local_touched;
11389 if (in_copy_on_write (*p_lhs))
11391 zval_ptr_dtor (p_lhs);
11392 ALLOC_INIT_ZVAL (*p_lhs);
11395 zval old = **p_lhs;
11396 int result_is_operand = (*p_lhs == left || *p_lhs == right);
11397 is_smaller_function (*p_lhs, left, right TSRMLS_CC);
11399 // If the result is one of the operands, the operator function
11400 // will already have cleaned up the result
11401 if (!result_is_operand)
11402 zval_dtor (&old);
11403 phc_check_invariants (TSRMLS_C);
11405 // goto L181;
11407 goto L181;
11408 phc_check_invariants (TSRMLS_C);
11410 // L181:
11411 L181:;
11412 // $TLE2 = (bool) $TEF1;
11414 if (local_TLE2 == NULL)
11416 local_TLE2 = EG (uninitialized_zval_ptr);
11417 local_TLE2->refcount++;
11419 zval** p_lhs = &local_TLE2;
11421 zval* rhs;
11422 if (local_TEF1 == NULL)
11423 rhs = EG (uninitialized_zval_ptr);
11424 else
11425 rhs = local_TEF1;
11427 if (*p_lhs != rhs)
11429 if ((*p_lhs)->is_ref)
11430 overwrite_lhs (*p_lhs, rhs);
11431 else
11433 zval_ptr_dtor (p_lhs);
11434 if (rhs->is_ref)
11436 // Take a copy of RHS for LHS
11437 *p_lhs = zvp_clone_ex (rhs);
11439 else
11441 // Share a copy
11442 rhs->refcount++;
11443 *p_lhs = rhs;
11450 assert (IS_BOOL >= 0 && IS_BOOL <= 6);
11451 if ((*p_lhs)->type != IS_BOOL)
11453 sep_copy_on_write (p_lhs);
11454 convert_to_boolean (*p_lhs);
11457 phc_check_invariants (TSRMLS_C);
11459 // if (TLE2) goto L182 else goto L183;
11461 zval* p_cond;
11462 if (local_TLE2 == NULL)
11463 p_cond = EG (uninitialized_zval_ptr);
11464 else
11465 p_cond = local_TLE2;
11467 zend_bool bcond = zend_is_true (p_cond);
11468 if (bcond)
11469 goto L182;
11470 else
11471 goto L183;
11472 phc_check_invariants (TSRMLS_C);
11474 // L182:
11475 L182:;
11476 // $TEF3 = $TLE2;
11478 if (local_TEF3 == NULL)
11480 local_TEF3 = EG (uninitialized_zval_ptr);
11481 local_TEF3->refcount++;
11483 zval** p_lhs = &local_TEF3;
11485 zval* rhs;
11486 if (local_TLE2 == NULL)
11487 rhs = EG (uninitialized_zval_ptr);
11488 else
11489 rhs = local_TLE2;
11491 if (*p_lhs != rhs)
11493 if ((*p_lhs)->is_ref)
11494 overwrite_lhs (*p_lhs, rhs);
11495 else
11497 zval_ptr_dtor (p_lhs);
11498 if (rhs->is_ref)
11500 // Take a copy of RHS for LHS
11501 *p_lhs = zvp_clone_ex (rhs);
11503 else
11505 // Share a copy
11506 rhs->refcount++;
11507 *p_lhs = rhs;
11513 phc_check_invariants (TSRMLS_C);
11515 // goto L184;
11517 goto L184;
11518 phc_check_invariants (TSRMLS_C);
11520 // L183:
11521 L183:;
11522 // $TLE78 = $this->getcachetime();
11524 if (local_this == NULL)
11526 local_this = EG (uninitialized_zval_ptr);
11527 local_this->refcount++;
11529 zval** p_obj = &local_this;
11531 zend_fcall_info fci_object;
11532 zend_fcall_info_cache fcic_object = {0, NULL, NULL, NULL};
11533 initialize_method_call (&fci_object, &fcic_object, p_obj, "getcachetime", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 140 TSRMLS_CC);
11534 zend_function* signature = fcic_object.function_handler;
11535 zend_arg_info* arg_info = signature->common.arg_info; // optional
11537 int by_ref[0];
11538 int abr_index = 0;
11541 // Setup array of arguments
11542 // TODO: i think arrays of size 0 is an error
11543 int destruct [0];
11544 zval* args [0];
11545 zval** args_ind [0];
11547 int af_index = 0;
11550 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 140, NULL TSRMLS_CC);
11552 // save existing parameters, in case of recursion
11553 int param_count_save = fci_object.param_count;
11554 zval*** params_save = fci_object.params;
11555 zval** retval_save = fci_object.retval_ptr_ptr;
11557 zval* rhs = NULL;
11559 // set up params
11560 fci_object.params = args_ind;
11561 fci_object.param_count = 0;
11562 fci_object.retval_ptr_ptr = &rhs;
11564 // call the function
11565 int success = zend_call_function (&fci_object, &fcic_object TSRMLS_CC);
11566 assert(success == SUCCESS);
11568 // restore params
11569 fci_object.params = params_save;
11570 fci_object.param_count = param_count_save;
11571 fci_object.retval_ptr_ptr = retval_save;
11573 // unset the errors
11574 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
11576 int i;
11577 for (i = 0; i < 0; i++)
11579 if (destruct[i])
11581 assert (destruct[i]);
11582 zval_ptr_dtor (args_ind[i]);
11587 // When the Zend engine returns by reference, it allocates a zval into
11588 // retval_ptr_ptr. To return by reference, the callee writes into the
11589 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
11590 // not actually return anything). So the zval returned - whether we return
11591 // it, or it is the allocated zval - has a refcount of 1.
11593 // The caller is responsible for cleaning that up (note, this is unaffected
11594 // by whether it is added to some COW set).
11596 // For reasons unknown, the Zend API resets the refcount and is_ref fields
11597 // of the return value after the function returns (unless the callee is
11598 // interpreted). If the function is supposed to return by reference, this
11599 // loses the refcount. This only happens when non-interpreted code is
11600 // called. We work around it, when compiled code is called, by saving the
11601 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
11602 // that we may create an error if our code is called by a callback, and
11603 // returns by reference, and the callback returns by reference. At least
11604 // this is an obscure case.
11605 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
11607 assert (rhs != EG(uninitialized_zval_ptr));
11608 rhs->is_ref = 1;
11609 if (saved_refcount != 0)
11611 rhs->refcount = saved_refcount;
11613 rhs->refcount++;
11615 saved_refcount = 0; // for 'obscure cases'
11617 if (local_TLE78 == NULL)
11619 local_TLE78 = EG (uninitialized_zval_ptr);
11620 local_TLE78->refcount++;
11622 zval** p_lhs = &local_TLE78;
11624 write_var (p_lhs, rhs);
11627 zval_ptr_dtor (&rhs);
11628 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
11629 zval_ptr_dtor (&rhs);
11631 phc_check_invariants (TSRMLS_C);
11633 // $TEF3 = ($TLE78 <= $wgCacheEpoch);
11635 if (local_TEF3 == NULL)
11637 local_TEF3 = EG (uninitialized_zval_ptr);
11638 local_TEF3->refcount++;
11640 zval** p_lhs = &local_TEF3;
11642 zval* left;
11643 if (local_TLE78 == NULL)
11644 left = EG (uninitialized_zval_ptr);
11645 else
11646 left = local_TLE78;
11648 zval* right;
11649 if (local_wgCacheEpoch == NULL)
11650 right = EG (uninitialized_zval_ptr);
11651 else
11652 right = local_wgCacheEpoch;
11654 if (in_copy_on_write (*p_lhs))
11656 zval_ptr_dtor (p_lhs);
11657 ALLOC_INIT_ZVAL (*p_lhs);
11660 zval old = **p_lhs;
11661 int result_is_operand = (*p_lhs == left || *p_lhs == right);
11662 is_smaller_or_equal_function (*p_lhs, left, right TSRMLS_CC);
11664 // If the result is one of the operands, the operator function
11665 // will already have cleaned up the result
11666 if (!result_is_operand)
11667 zval_dtor (&old);
11668 phc_check_invariants (TSRMLS_C);
11670 // goto L184;
11672 goto L184;
11673 phc_check_invariants (TSRMLS_C);
11675 // L184:
11676 L184:;
11677 // $TLE4 = (bool) $TEF3;
11679 if (local_TLE4 == NULL)
11681 local_TLE4 = EG (uninitialized_zval_ptr);
11682 local_TLE4->refcount++;
11684 zval** p_lhs = &local_TLE4;
11686 zval* rhs;
11687 if (local_TEF3 == NULL)
11688 rhs = EG (uninitialized_zval_ptr);
11689 else
11690 rhs = local_TEF3;
11692 if (*p_lhs != rhs)
11694 if ((*p_lhs)->is_ref)
11695 overwrite_lhs (*p_lhs, rhs);
11696 else
11698 zval_ptr_dtor (p_lhs);
11699 if (rhs->is_ref)
11701 // Take a copy of RHS for LHS
11702 *p_lhs = zvp_clone_ex (rhs);
11704 else
11706 // Share a copy
11707 rhs->refcount++;
11708 *p_lhs = rhs;
11715 assert (IS_BOOL >= 0 && IS_BOOL <= 6);
11716 if ((*p_lhs)->type != IS_BOOL)
11718 sep_copy_on_write (p_lhs);
11719 convert_to_boolean (*p_lhs);
11722 phc_check_invariants (TSRMLS_C);
11724 // if (TLE4) goto L185 else goto L186;
11726 zval* p_cond;
11727 if (local_TLE4 == NULL)
11728 p_cond = EG (uninitialized_zval_ptr);
11729 else
11730 p_cond = local_TLE4;
11732 zend_bool bcond = zend_is_true (p_cond);
11733 if (bcond)
11734 goto L185;
11735 else
11736 goto L186;
11737 phc_check_invariants (TSRMLS_C);
11739 // L185:
11740 L185:;
11741 // $TEF5 = $TLE4;
11743 if (local_TEF5 == NULL)
11745 local_TEF5 = EG (uninitialized_zval_ptr);
11746 local_TEF5->refcount++;
11748 zval** p_lhs = &local_TEF5;
11750 zval* rhs;
11751 if (local_TLE4 == NULL)
11752 rhs = EG (uninitialized_zval_ptr);
11753 else
11754 rhs = local_TLE4;
11756 if (*p_lhs != rhs)
11758 if ((*p_lhs)->is_ref)
11759 overwrite_lhs (*p_lhs, rhs);
11760 else
11762 zval_ptr_dtor (p_lhs);
11763 if (rhs->is_ref)
11765 // Take a copy of RHS for LHS
11766 *p_lhs = zvp_clone_ex (rhs);
11768 else
11770 // Share a copy
11771 rhs->refcount++;
11772 *p_lhs = rhs;
11778 phc_check_invariants (TSRMLS_C);
11780 // goto L187;
11782 goto L187;
11783 phc_check_invariants (TSRMLS_C);
11785 // L186:
11786 L186:;
11787 // $TMIt122 = $this->mVersion;
11789 if (local_this == NULL)
11791 local_this = EG (uninitialized_zval_ptr);
11792 local_this->refcount++;
11794 zval** p_obj = &local_this;
11796 zval field_name;
11797 INIT_ZVAL (field_name);
11798 ZVAL_STRING (&field_name, "mVersion", 0);
11800 // I *think* this is correct, but documentation of the Zend API is scarce :)
11801 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
11802 if (local_TMIt122 == NULL)
11804 local_TMIt122 = EG (uninitialized_zval_ptr);
11805 local_TMIt122->refcount++;
11807 zval** p_lhs = &local_TMIt122;
11809 write_var (p_lhs, field);
11810 phc_check_invariants (TSRMLS_C);
11812 // $TLE79 = isset($TMIt122);
11814 if (local_TLE79 == NULL)
11816 local_TLE79 = EG (uninitialized_zval_ptr);
11817 local_TLE79->refcount++;
11819 zval** p_lhs = &local_TLE79;
11820 zval* value;
11821 if ((*p_lhs)->is_ref)
11823 // Always overwrite the current value
11824 value = *p_lhs;
11825 zval_dtor (value);
11827 else
11829 ALLOC_INIT_ZVAL (value);
11830 zval_ptr_dtor (p_lhs);
11831 *p_lhs = value;
11833 ZVAL_BOOL(value, local_TMIt122 != NULL && !ZVAL_IS_NULL(local_TMIt122));
11834 phc_check_invariants (TSRMLS_C);
11836 // $TEF5 = !$TLE79;
11838 if (local_TEF5 == NULL)
11840 local_TEF5 = EG (uninitialized_zval_ptr);
11841 local_TEF5->refcount++;
11843 zval** p_lhs = &local_TEF5;
11845 zval* rhs;
11846 if (local_TLE79 == NULL)
11847 rhs = EG (uninitialized_zval_ptr);
11848 else
11849 rhs = local_TLE79;
11851 if (in_copy_on_write (*p_lhs))
11853 zval_ptr_dtor (p_lhs);
11854 ALLOC_INIT_ZVAL (*p_lhs);
11857 zval old = **p_lhs;
11858 int result_is_operand = (*p_lhs == rhs);
11859 boolean_not_function (*p_lhs, rhs TSRMLS_CC);
11860 if (!result_is_operand)
11861 zval_dtor (&old);
11862 phc_check_invariants (TSRMLS_C);
11864 // goto L187;
11866 goto L187;
11867 phc_check_invariants (TSRMLS_C);
11869 // L187:
11870 L187:;
11871 // $TLE6 = (bool) $TEF5;
11873 if (local_TLE6 == NULL)
11875 local_TLE6 = EG (uninitialized_zval_ptr);
11876 local_TLE6->refcount++;
11878 zval** p_lhs = &local_TLE6;
11880 zval* rhs;
11881 if (local_TEF5 == NULL)
11882 rhs = EG (uninitialized_zval_ptr);
11883 else
11884 rhs = local_TEF5;
11886 if (*p_lhs != rhs)
11888 if ((*p_lhs)->is_ref)
11889 overwrite_lhs (*p_lhs, rhs);
11890 else
11892 zval_ptr_dtor (p_lhs);
11893 if (rhs->is_ref)
11895 // Take a copy of RHS for LHS
11896 *p_lhs = zvp_clone_ex (rhs);
11898 else
11900 // Share a copy
11901 rhs->refcount++;
11902 *p_lhs = rhs;
11909 assert (IS_BOOL >= 0 && IS_BOOL <= 6);
11910 if ((*p_lhs)->type != IS_BOOL)
11912 sep_copy_on_write (p_lhs);
11913 convert_to_boolean (*p_lhs);
11916 phc_check_invariants (TSRMLS_C);
11918 // if (TLE6) goto L191 else goto L192;
11920 zval* p_cond;
11921 if (local_TLE6 == NULL)
11922 p_cond = EG (uninitialized_zval_ptr);
11923 else
11924 p_cond = local_TLE6;
11926 zend_bool bcond = zend_is_true (p_cond);
11927 if (bcond)
11928 goto L191;
11929 else
11930 goto L192;
11931 phc_check_invariants (TSRMLS_C);
11933 // L191:
11934 L191:;
11935 // $TEF7 = $TLE6;
11937 if (local_TEF7 == NULL)
11939 local_TEF7 = EG (uninitialized_zval_ptr);
11940 local_TEF7->refcount++;
11942 zval** p_lhs = &local_TEF7;
11944 zval* rhs;
11945 if (local_TLE6 == NULL)
11946 rhs = EG (uninitialized_zval_ptr);
11947 else
11948 rhs = local_TLE6;
11950 if (*p_lhs != rhs)
11952 if ((*p_lhs)->is_ref)
11953 overwrite_lhs (*p_lhs, rhs);
11954 else
11956 zval_ptr_dtor (p_lhs);
11957 if (rhs->is_ref)
11959 // Take a copy of RHS for LHS
11960 *p_lhs = zvp_clone_ex (rhs);
11962 else
11964 // Share a copy
11965 rhs->refcount++;
11966 *p_lhs = rhs;
11972 phc_check_invariants (TSRMLS_C);
11974 // goto L193;
11976 goto L193;
11977 phc_check_invariants (TSRMLS_C);
11979 // L192:
11980 L192:;
11981 // $TLE80 = Parser::VERSION;
11983 // No null-terminator in length for get_constant.
11984 // zend_get_constant always returns a copy of the constant.
11985 if (local_TLE80 == NULL)
11987 local_TLE80 = EG (uninitialized_zval_ptr);
11988 local_TLE80->refcount++;
11990 zval** p_lhs = &local_TLE80;
11992 if (!(*p_lhs)->is_ref)
11994 zval_ptr_dtor (p_lhs);
11995 get_constant ("Parser::VERSION", 15, p_lhs TSRMLS_CC);
11998 else
12000 zval* constant;
12001 get_constant ("Parser::VERSION", 15, p_lhs TSRMLS_CC);
12002 overwrite_lhs_no_copy (*p_lhs, constant);
12003 safe_free_zval_ptr (constant);
12006 phc_check_invariants (TSRMLS_C);
12008 // $TLE81 = 'lt';
12010 if (local_TLE81 == NULL)
12012 local_TLE81 = EG (uninitialized_zval_ptr);
12013 local_TLE81->refcount++;
12015 zval** p_lhs = &local_TLE81;
12017 zval* value;
12018 if ((*p_lhs)->is_ref)
12020 // Always overwrite the current value
12021 value = *p_lhs;
12022 zval_dtor (value);
12024 else
12026 ALLOC_INIT_ZVAL (value);
12027 zval_ptr_dtor (p_lhs);
12028 *p_lhs = value;
12031 ZVAL_STRINGL(value, "lt", 2, 1);
12033 phc_check_invariants (TSRMLS_C);
12035 // $TLE124 = param_is_ref (NULL, "version_compare", 0);
12036 // ;
12038 initialize_function_call (&version_compare_fci, &version_compare_fcic, "version_compare", "<unknown>", 0 TSRMLS_CC);
12039 zend_function* signature = version_compare_fcic.function_handler;
12040 zend_arg_info* arg_info = signature->common.arg_info;
12041 int count = 0;
12042 while (arg_info && count < 0)
12044 count++;
12045 arg_info++;
12048 if (local_TLE124 == NULL)
12050 local_TLE124 = EG (uninitialized_zval_ptr);
12051 local_TLE124->refcount++;
12053 zval** p_lhs = &local_TLE124;
12055 zval* rhs;
12056 ALLOC_INIT_ZVAL (rhs);
12057 if (arg_info && count == 0)
12059 ZVAL_BOOL (rhs, arg_info->pass_by_reference);
12061 else
12063 ZVAL_BOOL (rhs, signature->common.pass_rest_by_reference);
12065 write_var (p_lhs, rhs);
12066 zval_ptr_dtor (&rhs);
12067 phc_check_invariants (TSRMLS_C);
12069 // if (TLE124) goto L188 else goto L189;
12071 zval* p_cond;
12072 if (local_TLE124 == NULL)
12073 p_cond = EG (uninitialized_zval_ptr);
12074 else
12075 p_cond = local_TLE124;
12077 zend_bool bcond = zend_is_true (p_cond);
12078 if (bcond)
12079 goto L188;
12080 else
12081 goto L189;
12082 phc_check_invariants (TSRMLS_C);
12084 // L188:
12085 L188:;
12086 // $TMIt123 =& $this->mVersion;
12088 if (local_this == NULL)
12090 local_this = EG (uninitialized_zval_ptr);
12091 local_this->refcount++;
12093 zval** p_obj = &local_this;
12095 zval field_name;
12096 INIT_ZVAL (field_name);
12097 ZVAL_STRING (&field_name, "mVersion", 0);
12099 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
12100 sep_copy_on_write (field);
12101 if (local_TMIt123 == NULL)
12103 local_TMIt123 = EG (uninitialized_zval_ptr);
12104 local_TMIt123->refcount++;
12106 zval** p_lhs = &local_TMIt123;
12108 copy_into_ref (p_lhs, field);
12109 phc_check_invariants (TSRMLS_C);
12111 // goto L190;
12113 goto L190;
12114 phc_check_invariants (TSRMLS_C);
12116 // L189:
12117 L189:;
12118 // $TMIt123 = $this->mVersion;
12120 if (local_this == NULL)
12122 local_this = EG (uninitialized_zval_ptr);
12123 local_this->refcount++;
12125 zval** p_obj = &local_this;
12127 zval field_name;
12128 INIT_ZVAL (field_name);
12129 ZVAL_STRING (&field_name, "mVersion", 0);
12131 // I *think* this is correct, but documentation of the Zend API is scarce :)
12132 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
12133 if (local_TMIt123 == NULL)
12135 local_TMIt123 = EG (uninitialized_zval_ptr);
12136 local_TMIt123->refcount++;
12138 zval** p_lhs = &local_TMIt123;
12140 write_var (p_lhs, field);
12141 phc_check_invariants (TSRMLS_C);
12143 // goto L190;
12145 goto L190;
12146 phc_check_invariants (TSRMLS_C);
12148 // L190:
12149 L190:;
12150 // $TEF7 = version_compare($TMIt123, $TLE80, $TLE81);
12152 initialize_function_call (&version_compare_fci, &version_compare_fcic, "version_compare", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 142 TSRMLS_CC);
12153 zend_function* signature = version_compare_fcic.function_handler;
12154 zend_arg_info* arg_info = signature->common.arg_info; // optional
12156 int by_ref[3];
12157 int abr_index = 0;
12158 // TODO: find names to replace index
12159 if (arg_info)
12161 by_ref[abr_index] = arg_info->pass_by_reference;
12162 arg_info++;
12164 else
12165 by_ref[abr_index] = signature->common.pass_rest_by_reference;
12167 abr_index++;
12168 // TODO: find names to replace index
12169 if (arg_info)
12171 by_ref[abr_index] = arg_info->pass_by_reference;
12172 arg_info++;
12174 else
12175 by_ref[abr_index] = signature->common.pass_rest_by_reference;
12177 abr_index++;
12178 // TODO: find names to replace index
12179 if (arg_info)
12181 by_ref[abr_index] = arg_info->pass_by_reference;
12182 arg_info++;
12184 else
12185 by_ref[abr_index] = signature->common.pass_rest_by_reference;
12187 abr_index++;
12190 // Setup array of arguments
12191 // TODO: i think arrays of size 0 is an error
12192 int destruct [3];
12193 zval* args [3];
12194 zval** args_ind [3];
12196 int af_index = 0;
12197 destruct[af_index] = 0;
12198 if (by_ref[af_index])
12200 if (local_TMIt123 == NULL)
12202 local_TMIt123 = EG (uninitialized_zval_ptr);
12203 local_TMIt123->refcount++;
12205 zval** p_arg = &local_TMIt123;
12207 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
12208 assert (!in_copy_on_write (*args_ind[af_index]));
12209 args[af_index] = *args_ind[af_index];
12211 else
12213 zval* arg;
12214 if (local_TMIt123 == NULL)
12215 arg = EG (uninitialized_zval_ptr);
12216 else
12217 arg = local_TMIt123;
12219 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
12220 args_ind[af_index] = &args[af_index];
12222 af_index++;
12223 destruct[af_index] = 0;
12224 if (by_ref[af_index])
12226 if (local_TLE80 == NULL)
12228 local_TLE80 = EG (uninitialized_zval_ptr);
12229 local_TLE80->refcount++;
12231 zval** p_arg = &local_TLE80;
12233 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
12234 assert (!in_copy_on_write (*args_ind[af_index]));
12235 args[af_index] = *args_ind[af_index];
12237 else
12239 zval* arg;
12240 if (local_TLE80 == NULL)
12241 arg = EG (uninitialized_zval_ptr);
12242 else
12243 arg = local_TLE80;
12245 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
12246 args_ind[af_index] = &args[af_index];
12248 af_index++;
12249 destruct[af_index] = 0;
12250 if (by_ref[af_index])
12252 if (local_TLE81 == NULL)
12254 local_TLE81 = EG (uninitialized_zval_ptr);
12255 local_TLE81->refcount++;
12257 zval** p_arg = &local_TLE81;
12259 args_ind[af_index] = fetch_var_arg_by_ref (p_arg);
12260 assert (!in_copy_on_write (*args_ind[af_index]));
12261 args[af_index] = *args_ind[af_index];
12263 else
12265 zval* arg;
12266 if (local_TLE81 == NULL)
12267 arg = EG (uninitialized_zval_ptr);
12268 else
12269 arg = local_TLE81;
12271 args[af_index] = fetch_var_arg (arg, &destruct[af_index]);
12272 args_ind[af_index] = &args[af_index];
12274 af_index++;
12277 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 142, NULL TSRMLS_CC);
12279 // save existing parameters, in case of recursion
12280 int param_count_save = version_compare_fci.param_count;
12281 zval*** params_save = version_compare_fci.params;
12282 zval** retval_save = version_compare_fci.retval_ptr_ptr;
12284 zval* rhs = NULL;
12286 // set up params
12287 version_compare_fci.params = args_ind;
12288 version_compare_fci.param_count = 3;
12289 version_compare_fci.retval_ptr_ptr = &rhs;
12291 // call the function
12292 int success = zend_call_function (&version_compare_fci, &version_compare_fcic TSRMLS_CC);
12293 assert(success == SUCCESS);
12295 // restore params
12296 version_compare_fci.params = params_save;
12297 version_compare_fci.param_count = param_count_save;
12298 version_compare_fci.retval_ptr_ptr = retval_save;
12300 // unset the errors
12301 phc_setup_error (0, NULL, 0, NULL TSRMLS_CC);
12303 int i;
12304 for (i = 0; i < 3; i++)
12306 if (destruct[i])
12308 assert (destruct[i]);
12309 zval_ptr_dtor (args_ind[i]);
12314 // When the Zend engine returns by reference, it allocates a zval into
12315 // retval_ptr_ptr. To return by reference, the callee writes into the
12316 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
12317 // not actually return anything). So the zval returned - whether we return
12318 // it, or it is the allocated zval - has a refcount of 1.
12320 // The caller is responsible for cleaning that up (note, this is unaffected
12321 // by whether it is added to some COW set).
12323 // For reasons unknown, the Zend API resets the refcount and is_ref fields
12324 // of the return value after the function returns (unless the callee is
12325 // interpreted). If the function is supposed to return by reference, this
12326 // loses the refcount. This only happens when non-interpreted code is
12327 // called. We work around it, when compiled code is called, by saving the
12328 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
12329 // that we may create an error if our code is called by a callback, and
12330 // returns by reference, and the callback returns by reference. At least
12331 // this is an obscure case.
12332 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
12334 assert (rhs != EG(uninitialized_zval_ptr));
12335 rhs->is_ref = 1;
12336 if (saved_refcount != 0)
12338 rhs->refcount = saved_refcount;
12340 rhs->refcount++;
12342 saved_refcount = 0; // for 'obscure cases'
12344 if (local_TEF7 == NULL)
12346 local_TEF7 = EG (uninitialized_zval_ptr);
12347 local_TEF7->refcount++;
12349 zval** p_lhs = &local_TEF7;
12351 write_var (p_lhs, rhs);
12354 zval_ptr_dtor (&rhs);
12355 if(signature->common.return_reference && signature->type != ZEND_USER_FUNCTION)
12356 zval_ptr_dtor (&rhs);
12358 phc_check_invariants (TSRMLS_C);
12360 // goto L193;
12362 goto L193;
12363 phc_check_invariants (TSRMLS_C);
12365 // L193:
12366 L193:;
12367 // $TLE82 = (bool) $TEF7;
12369 if (local_TLE82 == NULL)
12371 local_TLE82 = EG (uninitialized_zval_ptr);
12372 local_TLE82->refcount++;
12374 zval** p_lhs = &local_TLE82;
12376 zval* rhs;
12377 if (local_TEF7 == NULL)
12378 rhs = EG (uninitialized_zval_ptr);
12379 else
12380 rhs = local_TEF7;
12382 if (*p_lhs != rhs)
12384 if ((*p_lhs)->is_ref)
12385 overwrite_lhs (*p_lhs, rhs);
12386 else
12388 zval_ptr_dtor (p_lhs);
12389 if (rhs->is_ref)
12391 // Take a copy of RHS for LHS
12392 *p_lhs = zvp_clone_ex (rhs);
12394 else
12396 // Share a copy
12397 rhs->refcount++;
12398 *p_lhs = rhs;
12405 assert (IS_BOOL >= 0 && IS_BOOL <= 6);
12406 if ((*p_lhs)->type != IS_BOOL)
12408 sep_copy_on_write (p_lhs);
12409 convert_to_boolean (*p_lhs);
12412 phc_check_invariants (TSRMLS_C);
12414 // return $TLE82;
12416 zval* rhs;
12417 if (local_TLE82 == NULL)
12418 rhs = EG (uninitialized_zval_ptr);
12419 else
12420 rhs = local_TLE82;
12422 // Run-time return by reference has different semantics to compile-time.
12423 // If the function has CTRBR and RTRBR, the the assignment will be
12424 // reference. If one or the other is return-by-copy, the result will be
12425 // by copy. Its a question of whether its separated at return-time (which
12426 // we do here) or at the call-site.
12427 return_value->value = rhs->value;
12428 return_value->type = rhs->type;
12429 zval_copy_ctor (return_value);
12430 goto end_of_function;
12431 phc_check_invariants (TSRMLS_C);
12433 // Method exit
12434 end_of_function:__attribute__((unused));
12435 if (local_TEF1 != NULL)
12437 zval_ptr_dtor (&local_TEF1);
12439 if (local_TEF3 != NULL)
12441 zval_ptr_dtor (&local_TEF3);
12443 if (local_TEF5 != NULL)
12445 zval_ptr_dtor (&local_TEF5);
12447 if (local_TEF7 != NULL)
12449 zval_ptr_dtor (&local_TEF7);
12451 if (local_TLE0 != NULL)
12453 zval_ptr_dtor (&local_TLE0);
12455 if (local_TLE124 != NULL)
12457 zval_ptr_dtor (&local_TLE124);
12459 if (local_TLE2 != NULL)
12461 zval_ptr_dtor (&local_TLE2);
12463 if (local_TLE4 != NULL)
12465 zval_ptr_dtor (&local_TLE4);
12467 if (local_TLE6 != NULL)
12469 zval_ptr_dtor (&local_TLE6);
12471 if (local_TLE75 != NULL)
12473 zval_ptr_dtor (&local_TLE75);
12475 if (local_TLE76 != NULL)
12477 zval_ptr_dtor (&local_TLE76);
12479 if (local_TLE77 != NULL)
12481 zval_ptr_dtor (&local_TLE77);
12483 if (local_TLE78 != NULL)
12485 zval_ptr_dtor (&local_TLE78);
12487 if (local_TLE79 != NULL)
12489 zval_ptr_dtor (&local_TLE79);
12491 if (local_TLE80 != NULL)
12493 zval_ptr_dtor (&local_TLE80);
12495 if (local_TLE81 != NULL)
12497 zval_ptr_dtor (&local_TLE81);
12499 if (local_TLE82 != NULL)
12501 zval_ptr_dtor (&local_TLE82);
12503 if (local_TMIt122 != NULL)
12505 zval_ptr_dtor (&local_TMIt122);
12507 if (local_TMIt123 != NULL)
12509 zval_ptr_dtor (&local_TMIt123);
12511 if (local_touched != NULL)
12513 zval_ptr_dtor (&local_touched);
12515 if (local_wgCacheEpoch != NULL)
12517 zval_ptr_dtor (&local_wgCacheEpoch);
12520 // function addheaditem($section, $tag = False)
12521 // {
12522 // $TLE83 = False;
12523 // $TLE84 = ($tag !== $TLE83);
12524 // if (TLE84) goto L194 else goto L195;
12525 // L194:
12526 // $TSt85 =& $this->mHeadItems;
12527 // $TSt85[$tag] = $section;
12528 // goto L196;
12529 // L195:
12530 // $TSt86 =& $this->mHeadItems;
12531 // $TSt86[] = $section;
12532 // goto L196;
12533 // L196:
12534 // }
12535 PHP_METHOD(ParserOutput, addheaditem)
12537 zval* local_TLE83 = NULL;
12538 zval* local_TLE84 = NULL;
12539 zval* local_TSt85 = NULL;
12540 zval* local_TSt86 = NULL;
12541 zval* local_section = NULL;
12542 zval* local_tag = NULL;
12543 zval* local_this = getThis();
12544 // Add all parameters as local variables
12546 int num_args = ZEND_NUM_ARGS ();
12547 zval* params[2];
12548 zend_get_parameters_array(0, num_args, params);
12549 // param 0
12550 params[0]->refcount++;
12551 if (local_section != NULL)
12553 zval_ptr_dtor (&local_section);
12555 local_section = params[0];
12556 // param 1
12557 if (num_args <= 1)
12559 zval* default_value;
12561 zval* local___static_value__ = NULL;
12562 // $__static_value__ = False;
12564 if (local___static_value__ == NULL)
12566 local___static_value__ = EG (uninitialized_zval_ptr);
12567 local___static_value__->refcount++;
12569 zval** p_lhs = &local___static_value__;
12571 zval* value;
12572 if ((*p_lhs)->is_ref)
12574 // Always overwrite the current value
12575 value = *p_lhs;
12576 zval_dtor (value);
12578 else
12580 ALLOC_INIT_ZVAL (value);
12581 zval_ptr_dtor (p_lhs);
12582 *p_lhs = value;
12585 ZVAL_BOOL (value, 0);
12587 phc_check_invariants (TSRMLS_C);
12589 default_value = local___static_value__;
12590 assert(!default_value->is_ref);
12591 default_value->refcount++;
12592 if (local___static_value__ != NULL)
12594 zval_ptr_dtor (&local___static_value__);
12597 default_value->refcount--;
12598 params[1] = default_value;
12600 params[1]->refcount++;
12601 if (local_tag != NULL)
12603 zval_ptr_dtor (&local_tag);
12605 local_tag = params[1];
12607 // Function body
12608 // $TLE83 = False;
12610 if (local_TLE83 == NULL)
12612 local_TLE83 = EG (uninitialized_zval_ptr);
12613 local_TLE83->refcount++;
12615 zval** p_lhs = &local_TLE83;
12617 zval* value;
12618 if ((*p_lhs)->is_ref)
12620 // Always overwrite the current value
12621 value = *p_lhs;
12622 zval_dtor (value);
12624 else
12626 ALLOC_INIT_ZVAL (value);
12627 zval_ptr_dtor (p_lhs);
12628 *p_lhs = value;
12631 ZVAL_BOOL (value, 0);
12633 phc_check_invariants (TSRMLS_C);
12635 // $TLE84 = ($tag !== $TLE83);
12637 if (local_TLE84 == NULL)
12639 local_TLE84 = EG (uninitialized_zval_ptr);
12640 local_TLE84->refcount++;
12642 zval** p_lhs = &local_TLE84;
12644 zval* left;
12645 if (local_tag == NULL)
12646 left = EG (uninitialized_zval_ptr);
12647 else
12648 left = local_tag;
12650 zval* right;
12651 if (local_TLE83 == NULL)
12652 right = EG (uninitialized_zval_ptr);
12653 else
12654 right = local_TLE83;
12656 if (in_copy_on_write (*p_lhs))
12658 zval_ptr_dtor (p_lhs);
12659 ALLOC_INIT_ZVAL (*p_lhs);
12662 zval old = **p_lhs;
12663 int result_is_operand = (*p_lhs == left || *p_lhs == right);
12664 is_not_identical_function (*p_lhs, left, right TSRMLS_CC);
12666 // If the result is one of the operands, the operator function
12667 // will already have cleaned up the result
12668 if (!result_is_operand)
12669 zval_dtor (&old);
12670 phc_check_invariants (TSRMLS_C);
12672 // if (TLE84) goto L194 else goto L195;
12674 zval* p_cond;
12675 if (local_TLE84 == NULL)
12676 p_cond = EG (uninitialized_zval_ptr);
12677 else
12678 p_cond = local_TLE84;
12680 zend_bool bcond = zend_is_true (p_cond);
12681 if (bcond)
12682 goto L194;
12683 else
12684 goto L195;
12685 phc_check_invariants (TSRMLS_C);
12687 // L194:
12688 L194:;
12689 // $TSt85 =& $this->mHeadItems;
12691 if (local_this == NULL)
12693 local_this = EG (uninitialized_zval_ptr);
12694 local_this->refcount++;
12696 zval** p_obj = &local_this;
12698 zval field_name;
12699 INIT_ZVAL (field_name);
12700 ZVAL_STRING (&field_name, "mHeadItems", 0);
12702 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
12703 sep_copy_on_write (field);
12704 if (local_TSt85 == NULL)
12706 local_TSt85 = EG (uninitialized_zval_ptr);
12707 local_TSt85->refcount++;
12709 zval** p_lhs = &local_TSt85;
12711 copy_into_ref (p_lhs, field);
12712 phc_check_invariants (TSRMLS_C);
12714 // $TSt85[$tag] = $section;
12716 if (local_TSt85 == NULL)
12718 local_TSt85 = EG (uninitialized_zval_ptr);
12719 local_TSt85->refcount++;
12721 zval** p_array = &local_TSt85;
12723 check_array_type (p_array TSRMLS_CC);
12725 zval* index;
12726 if (local_tag == NULL)
12727 index = EG (uninitialized_zval_ptr);
12728 else
12729 index = local_tag;
12732 // String indexing
12733 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
12735 zval* rhs;
12736 if (local_section == NULL)
12737 rhs = EG (uninitialized_zval_ptr);
12738 else
12739 rhs = local_section;
12741 write_string_index (p_array, index, rhs TSRMLS_CC);
12743 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
12745 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
12746 zval* rhs;
12747 if (local_section == NULL)
12748 rhs = EG (uninitialized_zval_ptr);
12749 else
12750 rhs = local_section;
12752 if (*p_lhs != rhs)
12754 write_var (p_lhs, rhs);
12757 phc_check_invariants (TSRMLS_C);
12759 // goto L196;
12761 goto L196;
12762 phc_check_invariants (TSRMLS_C);
12764 // L195:
12765 L195:;
12766 // $TSt86 =& $this->mHeadItems;
12768 if (local_this == NULL)
12770 local_this = EG (uninitialized_zval_ptr);
12771 local_this->refcount++;
12773 zval** p_obj = &local_this;
12775 zval field_name;
12776 INIT_ZVAL (field_name);
12777 ZVAL_STRING (&field_name, "mHeadItems", 0);
12779 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
12780 sep_copy_on_write (field);
12781 if (local_TSt86 == NULL)
12783 local_TSt86 = EG (uninitialized_zval_ptr);
12784 local_TSt86->refcount++;
12786 zval** p_lhs = &local_TSt86;
12788 copy_into_ref (p_lhs, field);
12789 phc_check_invariants (TSRMLS_C);
12791 // $TSt86[] = $section;
12793 if (local_TSt86 == NULL)
12795 local_TSt86 = EG (uninitialized_zval_ptr);
12796 local_TSt86->refcount++;
12798 zval** p_array = &local_TSt86;
12800 // Push EG(uninit) and get a pointer to the symtable entry
12801 zval** p_lhs = push_and_index_ht (p_array TSRMLS_CC);
12802 if (p_lhs != NULL)
12804 zval* rhs;
12805 if (local_section == NULL)
12806 rhs = EG (uninitialized_zval_ptr);
12807 else
12808 rhs = local_section;
12810 if (*p_lhs != rhs)
12811 write_var (p_lhs, rhs);
12813 // I think if this is NULL, then the LHS is a bool or similar, and you cant
12814 // push onto it.
12815 phc_check_invariants (TSRMLS_C);
12817 // goto L196;
12819 goto L196;
12820 phc_check_invariants (TSRMLS_C);
12822 // L196:
12823 L196:;
12824 // Method exit
12825 end_of_function:__attribute__((unused));
12826 if (local_TLE83 != NULL)
12828 zval_ptr_dtor (&local_TLE83);
12830 if (local_TLE84 != NULL)
12832 zval_ptr_dtor (&local_TLE84);
12834 if (local_TSt85 != NULL)
12836 zval_ptr_dtor (&local_TSt85);
12838 if (local_TSt86 != NULL)
12840 zval_ptr_dtor (&local_TSt86);
12842 if (local_section != NULL)
12844 zval_ptr_dtor (&local_section);
12846 if (local_tag != NULL)
12848 zval_ptr_dtor (&local_tag);
12851 // public function setdisplaytitle($text)
12852 // {
12853 // $this->displayTitle = $text;
12854 // }
12855 PHP_METHOD(ParserOutput, setdisplaytitle)
12857 zval* local_text = NULL;
12858 zval* local_this = getThis();
12859 // Add all parameters as local variables
12861 int num_args = ZEND_NUM_ARGS ();
12862 zval* params[1];
12863 zend_get_parameters_array(0, num_args, params);
12864 // param 0
12865 params[0]->refcount++;
12866 if (local_text != NULL)
12868 zval_ptr_dtor (&local_text);
12870 local_text = params[0];
12872 // Function body
12873 // $this->displayTitle = $text;
12875 if (local_this == NULL)
12877 local_this = EG (uninitialized_zval_ptr);
12878 local_this->refcount++;
12880 zval** p_obj = &local_this;
12882 zval* rhs;
12883 if (local_text == NULL)
12884 rhs = EG (uninitialized_zval_ptr);
12885 else
12886 rhs = local_text;
12888 zval field_name;
12889 INIT_ZVAL (field_name);
12890 ZVAL_STRING (&field_name, "displayTitle", 0);
12892 Z_OBJ_HT_PP(p_obj)->write_property(*p_obj, &field_name, rhs TSRMLS_CC);
12893 phc_check_invariants (TSRMLS_C);
12895 // Method exit
12896 end_of_function:__attribute__((unused));
12897 if (local_text != NULL)
12899 zval_ptr_dtor (&local_text);
12902 // public function getdisplaytitle()
12903 // {
12904 // $TSt87 = $this->displayTitle;
12905 // return $TSt87;
12906 // }
12907 PHP_METHOD(ParserOutput, getdisplaytitle)
12909 zval* local_TSt87 = NULL;
12910 zval* local_this = getThis();
12911 // Function body
12912 // $TSt87 = $this->displayTitle;
12914 if (local_this == NULL)
12916 local_this = EG (uninitialized_zval_ptr);
12917 local_this->refcount++;
12919 zval** p_obj = &local_this;
12921 zval field_name;
12922 INIT_ZVAL (field_name);
12923 ZVAL_STRING (&field_name, "displayTitle", 0);
12925 // I *think* this is correct, but documentation of the Zend API is scarce :)
12926 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
12927 if (local_TSt87 == NULL)
12929 local_TSt87 = EG (uninitialized_zval_ptr);
12930 local_TSt87->refcount++;
12932 zval** p_lhs = &local_TSt87;
12934 write_var (p_lhs, field);
12935 phc_check_invariants (TSRMLS_C);
12937 // return $TSt87;
12939 zval* rhs;
12940 if (local_TSt87 == NULL)
12941 rhs = EG (uninitialized_zval_ptr);
12942 else
12943 rhs = local_TSt87;
12945 // Run-time return by reference has different semantics to compile-time.
12946 // If the function has CTRBR and RTRBR, the the assignment will be
12947 // reference. If one or the other is return-by-copy, the result will be
12948 // by copy. Its a question of whether its separated at return-time (which
12949 // we do here) or at the call-site.
12950 return_value->value = rhs->value;
12951 return_value->type = rhs->type;
12952 zval_copy_ctor (return_value);
12953 goto end_of_function;
12954 phc_check_invariants (TSRMLS_C);
12956 // Method exit
12957 end_of_function:__attribute__((unused));
12958 if (local_TSt87 != NULL)
12960 zval_ptr_dtor (&local_TSt87);
12963 // public function setflag($flag)
12964 // {
12965 // $TSt88 =& $this->mFlags;
12966 // $TLE89 = True;
12967 // $TSt88[$flag] = $TLE89;
12968 // }
12969 PHP_METHOD(ParserOutput, setflag)
12971 zval* local_TLE89 = NULL;
12972 zval* local_TSt88 = NULL;
12973 zval* local_flag = NULL;
12974 zval* local_this = getThis();
12975 // Add all parameters as local variables
12977 int num_args = ZEND_NUM_ARGS ();
12978 zval* params[1];
12979 zend_get_parameters_array(0, num_args, params);
12980 // param 0
12981 params[0]->refcount++;
12982 if (local_flag != NULL)
12984 zval_ptr_dtor (&local_flag);
12986 local_flag = params[0];
12988 // Function body
12989 // $TSt88 =& $this->mFlags;
12991 if (local_this == NULL)
12993 local_this = EG (uninitialized_zval_ptr);
12994 local_this->refcount++;
12996 zval** p_obj = &local_this;
12998 zval field_name;
12999 INIT_ZVAL (field_name);
13000 ZVAL_STRING (&field_name, "mFlags", 0);
13002 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
13003 sep_copy_on_write (field);
13004 if (local_TSt88 == NULL)
13006 local_TSt88 = EG (uninitialized_zval_ptr);
13007 local_TSt88->refcount++;
13009 zval** p_lhs = &local_TSt88;
13011 copy_into_ref (p_lhs, field);
13012 phc_check_invariants (TSRMLS_C);
13014 // $TLE89 = True;
13016 if (local_TLE89 == NULL)
13018 local_TLE89 = EG (uninitialized_zval_ptr);
13019 local_TLE89->refcount++;
13021 zval** p_lhs = &local_TLE89;
13023 zval* value;
13024 if ((*p_lhs)->is_ref)
13026 // Always overwrite the current value
13027 value = *p_lhs;
13028 zval_dtor (value);
13030 else
13032 ALLOC_INIT_ZVAL (value);
13033 zval_ptr_dtor (p_lhs);
13034 *p_lhs = value;
13037 ZVAL_BOOL (value, 1);
13039 phc_check_invariants (TSRMLS_C);
13041 // $TSt88[$flag] = $TLE89;
13043 if (local_TSt88 == NULL)
13045 local_TSt88 = EG (uninitialized_zval_ptr);
13046 local_TSt88->refcount++;
13048 zval** p_array = &local_TSt88;
13050 check_array_type (p_array TSRMLS_CC);
13052 zval* index;
13053 if (local_flag == NULL)
13054 index = EG (uninitialized_zval_ptr);
13055 else
13056 index = local_flag;
13059 // String indexing
13060 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
13062 zval* rhs;
13063 if (local_TLE89 == NULL)
13064 rhs = EG (uninitialized_zval_ptr);
13065 else
13066 rhs = local_TLE89;
13068 write_string_index (p_array, index, rhs TSRMLS_CC);
13070 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
13072 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
13073 zval* rhs;
13074 if (local_TLE89 == NULL)
13075 rhs = EG (uninitialized_zval_ptr);
13076 else
13077 rhs = local_TLE89;
13079 if (*p_lhs != rhs)
13081 write_var (p_lhs, rhs);
13084 phc_check_invariants (TSRMLS_C);
13086 // Method exit
13087 end_of_function:__attribute__((unused));
13088 if (local_TLE89 != NULL)
13090 zval_ptr_dtor (&local_TLE89);
13092 if (local_TSt88 != NULL)
13094 zval_ptr_dtor (&local_TSt88);
13096 if (local_flag != NULL)
13098 zval_ptr_dtor (&local_flag);
13101 // public function getflag($flag)
13102 // {
13103 // $TMIt125 = $this->mFlags;
13104 // $TLE90 = isset($TMIt125[$flag]);
13105 // return $TLE90;
13106 // }
13107 PHP_METHOD(ParserOutput, getflag)
13109 zval* local_TLE90 = NULL;
13110 zval* local_TMIt125 = NULL;
13111 zval* local_flag = NULL;
13112 zval* local_this = getThis();
13113 // Add all parameters as local variables
13115 int num_args = ZEND_NUM_ARGS ();
13116 zval* params[1];
13117 zend_get_parameters_array(0, num_args, params);
13118 // param 0
13119 params[0]->refcount++;
13120 if (local_flag != NULL)
13122 zval_ptr_dtor (&local_flag);
13124 local_flag = params[0];
13126 // Function body
13127 // $TMIt125 = $this->mFlags;
13129 if (local_this == NULL)
13131 local_this = EG (uninitialized_zval_ptr);
13132 local_this->refcount++;
13134 zval** p_obj = &local_this;
13136 zval field_name;
13137 INIT_ZVAL (field_name);
13138 ZVAL_STRING (&field_name, "mFlags", 0);
13140 // I *think* this is correct, but documentation of the Zend API is scarce :)
13141 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
13142 if (local_TMIt125 == NULL)
13144 local_TMIt125 = EG (uninitialized_zval_ptr);
13145 local_TMIt125->refcount++;
13147 zval** p_lhs = &local_TMIt125;
13149 write_var (p_lhs, field);
13150 phc_check_invariants (TSRMLS_C);
13152 // $TLE90 = isset($TMIt125[$flag]);
13154 if (local_TLE90 == NULL)
13156 local_TLE90 = EG (uninitialized_zval_ptr);
13157 local_TLE90->refcount++;
13159 zval** p_lhs = &local_TLE90;
13160 zval* value;
13161 if ((*p_lhs)->is_ref)
13163 // Always overwrite the current value
13164 value = *p_lhs;
13165 zval_dtor (value);
13167 else
13169 ALLOC_INIT_ZVAL (value);
13170 zval_ptr_dtor (p_lhs);
13171 *p_lhs = value;
13173 if (local_TMIt125 == NULL)
13175 local_TMIt125 = EG (uninitialized_zval_ptr);
13176 local_TMIt125->refcount++;
13178 zval** u_array = &local_TMIt125;
13179 zval* u_index;
13180 if (local_flag == NULL)
13182 u_index = EG (uninitialized_zval_ptr);
13184 else
13186 u_index = local_flag;
13188 ZVAL_BOOL(value, isset_array (u_array, u_index));
13189 phc_check_invariants (TSRMLS_C);
13191 // return $TLE90;
13193 zval* rhs;
13194 if (local_TLE90 == NULL)
13195 rhs = EG (uninitialized_zval_ptr);
13196 else
13197 rhs = local_TLE90;
13199 // Run-time return by reference has different semantics to compile-time.
13200 // If the function has CTRBR and RTRBR, the the assignment will be
13201 // reference. If one or the other is return-by-copy, the result will be
13202 // by copy. Its a question of whether its separated at return-time (which
13203 // we do here) or at the call-site.
13204 return_value->value = rhs->value;
13205 return_value->type = rhs->type;
13206 zval_copy_ctor (return_value);
13207 goto end_of_function;
13208 phc_check_invariants (TSRMLS_C);
13210 // Method exit
13211 end_of_function:__attribute__((unused));
13212 if (local_TLE90 != NULL)
13214 zval_ptr_dtor (&local_TLE90);
13216 if (local_TMIt125 != NULL)
13218 zval_ptr_dtor (&local_TMIt125);
13220 if (local_flag != NULL)
13222 zval_ptr_dtor (&local_flag);
13225 // public function setproperty($name, $value)
13226 // {
13227 // $TSt91 =& $this->mProperties;
13228 // $TSt91[$name] = $value;
13229 // }
13230 PHP_METHOD(ParserOutput, setproperty)
13232 zval* local_TSt91 = NULL;
13233 zval* local_name = NULL;
13234 zval* local_this = getThis();
13235 zval* local_value = NULL;
13236 // Add all parameters as local variables
13238 int num_args = ZEND_NUM_ARGS ();
13239 zval* params[2];
13240 zend_get_parameters_array(0, num_args, params);
13241 // param 0
13242 params[0]->refcount++;
13243 if (local_name != NULL)
13245 zval_ptr_dtor (&local_name);
13247 local_name = params[0];
13248 // param 1
13249 params[1]->refcount++;
13250 if (local_value != NULL)
13252 zval_ptr_dtor (&local_value);
13254 local_value = params[1];
13256 // Function body
13257 // $TSt91 =& $this->mProperties;
13259 if (local_this == NULL)
13261 local_this = EG (uninitialized_zval_ptr);
13262 local_this->refcount++;
13264 zval** p_obj = &local_this;
13266 zval field_name;
13267 INIT_ZVAL (field_name);
13268 ZVAL_STRING (&field_name, "mProperties", 0);
13270 zval** field = Z_OBJ_HT_PP(p_obj)->get_property_ptr_ptr(*p_obj, &field_name TSRMLS_CC);
13271 sep_copy_on_write (field);
13272 if (local_TSt91 == NULL)
13274 local_TSt91 = EG (uninitialized_zval_ptr);
13275 local_TSt91->refcount++;
13277 zval** p_lhs = &local_TSt91;
13279 copy_into_ref (p_lhs, field);
13280 phc_check_invariants (TSRMLS_C);
13282 // $TSt91[$name] = $value;
13284 if (local_TSt91 == NULL)
13286 local_TSt91 = EG (uninitialized_zval_ptr);
13287 local_TSt91->refcount++;
13289 zval** p_array = &local_TSt91;
13291 check_array_type (p_array TSRMLS_CC);
13293 zval* index;
13294 if (local_name == NULL)
13295 index = EG (uninitialized_zval_ptr);
13296 else
13297 index = local_name;
13300 // String indexing
13301 if (Z_TYPE_PP (p_array) == IS_STRING && Z_STRLEN_PP (p_array) > 0)
13303 zval* rhs;
13304 if (local_value == NULL)
13305 rhs = EG (uninitialized_zval_ptr);
13306 else
13307 rhs = local_value;
13309 write_string_index (p_array, index, rhs TSRMLS_CC);
13311 else if (Z_TYPE_PP (p_array) == IS_ARRAY)
13313 zval** p_lhs = get_ht_entry (p_array, index TSRMLS_CC);
13314 zval* rhs;
13315 if (local_value == NULL)
13316 rhs = EG (uninitialized_zval_ptr);
13317 else
13318 rhs = local_value;
13320 if (*p_lhs != rhs)
13322 write_var (p_lhs, rhs);
13325 phc_check_invariants (TSRMLS_C);
13327 // Method exit
13328 end_of_function:__attribute__((unused));
13329 if (local_TSt91 != NULL)
13331 zval_ptr_dtor (&local_TSt91);
13333 if (local_name != NULL)
13335 zval_ptr_dtor (&local_name);
13337 if (local_value != NULL)
13339 zval_ptr_dtor (&local_value);
13342 // public function getproperty($name)
13343 // {
13344 // $TMIt126 = $this->mProperties;
13345 // $TLE92 = isset($TMIt126[$name]);
13346 // if (TLE92) goto L197 else goto L198;
13347 // L197:
13348 // $TSt93 = $this->mProperties;
13349 // $TSi94 = $TSt93[$name];
13350 // $TEF8 = $TSi94;
13351 // goto L199;
13352 // L198:
13353 // $TEF8 = False;
13354 // goto L199;
13355 // L199:
13356 // return $TEF8;
13357 // }
13358 PHP_METHOD(ParserOutput, getproperty)
13360 zval* local_TEF8 = NULL;
13361 zval* local_TLE92 = NULL;
13362 zval* local_TMIt126 = NULL;
13363 zval* local_TSi94 = NULL;
13364 zval* local_TSt93 = NULL;
13365 zval* local_name = NULL;
13366 zval* local_this = getThis();
13367 // Add all parameters as local variables
13369 int num_args = ZEND_NUM_ARGS ();
13370 zval* params[1];
13371 zend_get_parameters_array(0, num_args, params);
13372 // param 0
13373 params[0]->refcount++;
13374 if (local_name != NULL)
13376 zval_ptr_dtor (&local_name);
13378 local_name = params[0];
13380 // Function body
13381 // $TMIt126 = $this->mProperties;
13383 if (local_this == NULL)
13385 local_this = EG (uninitialized_zval_ptr);
13386 local_this->refcount++;
13388 zval** p_obj = &local_this;
13390 zval field_name;
13391 INIT_ZVAL (field_name);
13392 ZVAL_STRING (&field_name, "mProperties", 0);
13394 // I *think* this is correct, but documentation of the Zend API is scarce :)
13395 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
13396 if (local_TMIt126 == NULL)
13398 local_TMIt126 = EG (uninitialized_zval_ptr);
13399 local_TMIt126->refcount++;
13401 zval** p_lhs = &local_TMIt126;
13403 write_var (p_lhs, field);
13404 phc_check_invariants (TSRMLS_C);
13406 // $TLE92 = isset($TMIt126[$name]);
13408 if (local_TLE92 == NULL)
13410 local_TLE92 = EG (uninitialized_zval_ptr);
13411 local_TLE92->refcount++;
13413 zval** p_lhs = &local_TLE92;
13414 zval* value;
13415 if ((*p_lhs)->is_ref)
13417 // Always overwrite the current value
13418 value = *p_lhs;
13419 zval_dtor (value);
13421 else
13423 ALLOC_INIT_ZVAL (value);
13424 zval_ptr_dtor (p_lhs);
13425 *p_lhs = value;
13427 if (local_TMIt126 == NULL)
13429 local_TMIt126 = EG (uninitialized_zval_ptr);
13430 local_TMIt126->refcount++;
13432 zval** u_array = &local_TMIt126;
13433 zval* u_index;
13434 if (local_name == NULL)
13436 u_index = EG (uninitialized_zval_ptr);
13438 else
13440 u_index = local_name;
13442 ZVAL_BOOL(value, isset_array (u_array, u_index));
13443 phc_check_invariants (TSRMLS_C);
13445 // if (TLE92) goto L197 else goto L198;
13447 zval* p_cond;
13448 if (local_TLE92 == NULL)
13449 p_cond = EG (uninitialized_zval_ptr);
13450 else
13451 p_cond = local_TLE92;
13453 zend_bool bcond = zend_is_true (p_cond);
13454 if (bcond)
13455 goto L197;
13456 else
13457 goto L198;
13458 phc_check_invariants (TSRMLS_C);
13460 // L197:
13461 L197:;
13462 // $TSt93 = $this->mProperties;
13464 if (local_this == NULL)
13466 local_this = EG (uninitialized_zval_ptr);
13467 local_this->refcount++;
13469 zval** p_obj = &local_this;
13471 zval field_name;
13472 INIT_ZVAL (field_name);
13473 ZVAL_STRING (&field_name, "mProperties", 0);
13475 // I *think* this is correct, but documentation of the Zend API is scarce :)
13476 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
13477 if (local_TSt93 == NULL)
13479 local_TSt93 = EG (uninitialized_zval_ptr);
13480 local_TSt93->refcount++;
13482 zval** p_lhs = &local_TSt93;
13484 write_var (p_lhs, field);
13485 phc_check_invariants (TSRMLS_C);
13487 // $TSi94 = $TSt93[$name];
13489 if (local_TSi94 == NULL)
13491 local_TSi94 = EG (uninitialized_zval_ptr);
13492 local_TSi94->refcount++;
13494 zval** p_lhs = &local_TSi94;
13496 zval* r_array;
13497 if (local_TSt93 == NULL)
13498 r_array = EG (uninitialized_zval_ptr);
13499 else
13500 r_array = local_TSt93;
13502 zval* r_index;
13503 if (local_name == NULL)
13504 r_index = EG (uninitialized_zval_ptr);
13505 else
13506 r_index = local_name;
13509 zval* rhs;
13510 int is_rhs_new = 0;
13511 if (Z_TYPE_P (r_array) != IS_ARRAY)
13513 if (Z_TYPE_P (r_array) == IS_STRING)
13515 is_rhs_new = 1;
13516 rhs = read_string_index (r_array, r_index TSRMLS_CC);
13518 else
13519 // TODO: warning here?
13520 rhs = EG (uninitialized_zval_ptr);
13522 else
13524 if (check_array_index_type (r_index TSRMLS_CC))
13526 // Read array variable
13527 read_array (&rhs, r_array, r_index TSRMLS_CC);
13529 else
13530 rhs = *p_lhs; // HACK to fail *p_lhs != rhs
13533 if (*p_lhs != rhs)
13534 write_var (p_lhs, rhs);
13536 if (is_rhs_new) zval_ptr_dtor (&rhs);
13537 phc_check_invariants (TSRMLS_C);
13539 // $TEF8 = $TSi94;
13541 if (local_TEF8 == NULL)
13543 local_TEF8 = EG (uninitialized_zval_ptr);
13544 local_TEF8->refcount++;
13546 zval** p_lhs = &local_TEF8;
13548 zval* rhs;
13549 if (local_TSi94 == NULL)
13550 rhs = EG (uninitialized_zval_ptr);
13551 else
13552 rhs = local_TSi94;
13554 if (*p_lhs != rhs)
13556 if ((*p_lhs)->is_ref)
13557 overwrite_lhs (*p_lhs, rhs);
13558 else
13560 zval_ptr_dtor (p_lhs);
13561 if (rhs->is_ref)
13563 // Take a copy of RHS for LHS
13564 *p_lhs = zvp_clone_ex (rhs);
13566 else
13568 // Share a copy
13569 rhs->refcount++;
13570 *p_lhs = rhs;
13576 phc_check_invariants (TSRMLS_C);
13578 // goto L199;
13580 goto L199;
13581 phc_check_invariants (TSRMLS_C);
13583 // L198:
13584 L198:;
13585 // $TEF8 = False;
13587 if (local_TEF8 == NULL)
13589 local_TEF8 = EG (uninitialized_zval_ptr);
13590 local_TEF8->refcount++;
13592 zval** p_lhs = &local_TEF8;
13594 zval* value;
13595 if ((*p_lhs)->is_ref)
13597 // Always overwrite the current value
13598 value = *p_lhs;
13599 zval_dtor (value);
13601 else
13603 ALLOC_INIT_ZVAL (value);
13604 zval_ptr_dtor (p_lhs);
13605 *p_lhs = value;
13608 ZVAL_BOOL (value, 0);
13610 phc_check_invariants (TSRMLS_C);
13612 // goto L199;
13614 goto L199;
13615 phc_check_invariants (TSRMLS_C);
13617 // L199:
13618 L199:;
13619 // return $TEF8;
13621 zval* rhs;
13622 if (local_TEF8 == NULL)
13623 rhs = EG (uninitialized_zval_ptr);
13624 else
13625 rhs = local_TEF8;
13627 // Run-time return by reference has different semantics to compile-time.
13628 // If the function has CTRBR and RTRBR, the the assignment will be
13629 // reference. If one or the other is return-by-copy, the result will be
13630 // by copy. Its a question of whether its separated at return-time (which
13631 // we do here) or at the call-site.
13632 return_value->value = rhs->value;
13633 return_value->type = rhs->type;
13634 zval_copy_ctor (return_value);
13635 goto end_of_function;
13636 phc_check_invariants (TSRMLS_C);
13638 // Method exit
13639 end_of_function:__attribute__((unused));
13640 if (local_TEF8 != NULL)
13642 zval_ptr_dtor (&local_TEF8);
13644 if (local_TLE92 != NULL)
13646 zval_ptr_dtor (&local_TLE92);
13648 if (local_TMIt126 != NULL)
13650 zval_ptr_dtor (&local_TMIt126);
13652 if (local_TSi94 != NULL)
13654 zval_ptr_dtor (&local_TSi94);
13656 if (local_TSt93 != NULL)
13658 zval_ptr_dtor (&local_TSt93);
13660 if (local_name != NULL)
13662 zval_ptr_dtor (&local_name);
13665 // public function getproperties()
13666 // {
13667 // $TMIt127 = $this->mProperties;
13668 // $TLE95 = isset($TMIt127);
13669 // $TLE96 = !$TLE95;
13670 // if (TLE96) goto L200 else goto L201;
13671 // L200:
13672 // unset($TSa97);
13673 // $TSa97 = (array) $TSa97;
13674 // $this->mProperties = $TSa97;
13675 // goto L202;
13676 // L201:
13677 // goto L202;
13678 // L202:
13679 // $TSt98 = $this->mProperties;
13680 // return $TSt98;
13681 // }
13682 PHP_METHOD(ParserOutput, getproperties)
13684 zval* local_TLE95 = NULL;
13685 zval* local_TLE96 = NULL;
13686 zval* local_TMIt127 = NULL;
13687 zval* local_TSa97 = NULL;
13688 zval* local_TSt98 = NULL;
13689 zval* local_this = getThis();
13690 // Function body
13691 // $TMIt127 = $this->mProperties;
13693 if (local_this == NULL)
13695 local_this = EG (uninitialized_zval_ptr);
13696 local_this->refcount++;
13698 zval** p_obj = &local_this;
13700 zval field_name;
13701 INIT_ZVAL (field_name);
13702 ZVAL_STRING (&field_name, "mProperties", 0);
13704 // I *think* this is correct, but documentation of the Zend API is scarce :)
13705 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
13706 if (local_TMIt127 == NULL)
13708 local_TMIt127 = EG (uninitialized_zval_ptr);
13709 local_TMIt127->refcount++;
13711 zval** p_lhs = &local_TMIt127;
13713 write_var (p_lhs, field);
13714 phc_check_invariants (TSRMLS_C);
13716 // $TLE95 = isset($TMIt127);
13718 if (local_TLE95 == NULL)
13720 local_TLE95 = EG (uninitialized_zval_ptr);
13721 local_TLE95->refcount++;
13723 zval** p_lhs = &local_TLE95;
13724 zval* value;
13725 if ((*p_lhs)->is_ref)
13727 // Always overwrite the current value
13728 value = *p_lhs;
13729 zval_dtor (value);
13731 else
13733 ALLOC_INIT_ZVAL (value);
13734 zval_ptr_dtor (p_lhs);
13735 *p_lhs = value;
13737 ZVAL_BOOL(value, local_TMIt127 != NULL && !ZVAL_IS_NULL(local_TMIt127));
13738 phc_check_invariants (TSRMLS_C);
13740 // $TLE96 = !$TLE95;
13742 if (local_TLE96 == NULL)
13744 local_TLE96 = EG (uninitialized_zval_ptr);
13745 local_TLE96->refcount++;
13747 zval** p_lhs = &local_TLE96;
13749 zval* rhs;
13750 if (local_TLE95 == NULL)
13751 rhs = EG (uninitialized_zval_ptr);
13752 else
13753 rhs = local_TLE95;
13755 if (in_copy_on_write (*p_lhs))
13757 zval_ptr_dtor (p_lhs);
13758 ALLOC_INIT_ZVAL (*p_lhs);
13761 zval old = **p_lhs;
13762 int result_is_operand = (*p_lhs == rhs);
13763 boolean_not_function (*p_lhs, rhs TSRMLS_CC);
13764 if (!result_is_operand)
13765 zval_dtor (&old);
13766 phc_check_invariants (TSRMLS_C);
13768 // if (TLE96) goto L200 else goto L201;
13770 zval* p_cond;
13771 if (local_TLE96 == NULL)
13772 p_cond = EG (uninitialized_zval_ptr);
13773 else
13774 p_cond = local_TLE96;
13776 zend_bool bcond = zend_is_true (p_cond);
13777 if (bcond)
13778 goto L200;
13779 else
13780 goto L201;
13781 phc_check_invariants (TSRMLS_C);
13783 // L200:
13784 L200:;
13785 // unset($TSa97);
13787 if (local_TSa97 != NULL)
13789 zval_ptr_dtor (&local_TSa97);
13790 local_TSa97 = NULL;
13792 phc_check_invariants (TSRMLS_C);
13794 // $TSa97 = (array) $TSa97;
13796 if (local_TSa97 == NULL)
13798 local_TSa97 = EG (uninitialized_zval_ptr);
13799 local_TSa97->refcount++;
13801 zval** p_lhs = &local_TSa97;
13803 zval* rhs;
13804 if (local_TSa97 == NULL)
13805 rhs = EG (uninitialized_zval_ptr);
13806 else
13807 rhs = local_TSa97;
13809 if (*p_lhs != rhs)
13811 if ((*p_lhs)->is_ref)
13812 overwrite_lhs (*p_lhs, rhs);
13813 else
13815 zval_ptr_dtor (p_lhs);
13816 if (rhs->is_ref)
13818 // Take a copy of RHS for LHS
13819 *p_lhs = zvp_clone_ex (rhs);
13821 else
13823 // Share a copy
13824 rhs->refcount++;
13825 *p_lhs = rhs;
13832 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
13833 if ((*p_lhs)->type != IS_ARRAY)
13835 sep_copy_on_write (p_lhs);
13836 convert_to_array (*p_lhs);
13839 phc_check_invariants (TSRMLS_C);
13841 // $this->mProperties = $TSa97;
13843 if (local_this == NULL)
13845 local_this = EG (uninitialized_zval_ptr);
13846 local_this->refcount++;
13848 zval** p_obj = &local_this;
13850 zval* rhs;
13851 if (local_TSa97 == NULL)
13852 rhs = EG (uninitialized_zval_ptr);
13853 else
13854 rhs = local_TSa97;
13856 zval field_name;
13857 INIT_ZVAL (field_name);
13858 ZVAL_STRING (&field_name, "mProperties", 0);
13860 Z_OBJ_HT_PP(p_obj)->write_property(*p_obj, &field_name, rhs TSRMLS_CC);
13861 phc_check_invariants (TSRMLS_C);
13863 // goto L202;
13865 goto L202;
13866 phc_check_invariants (TSRMLS_C);
13868 // L201:
13869 L201:;
13870 // goto L202;
13872 goto L202;
13873 phc_check_invariants (TSRMLS_C);
13875 // L202:
13876 L202:;
13877 // $TSt98 = $this->mProperties;
13879 if (local_this == NULL)
13881 local_this = EG (uninitialized_zval_ptr);
13882 local_this->refcount++;
13884 zval** p_obj = &local_this;
13886 zval field_name;
13887 INIT_ZVAL (field_name);
13888 ZVAL_STRING (&field_name, "mProperties", 0);
13890 // I *think* this is correct, but documentation of the Zend API is scarce :)
13891 zval* field = Z_OBJ_HT_PP(p_obj)->read_property(*p_obj, &field_name, BP_VAR_R TSRMLS_CC);
13892 if (local_TSt98 == NULL)
13894 local_TSt98 = EG (uninitialized_zval_ptr);
13895 local_TSt98->refcount++;
13897 zval** p_lhs = &local_TSt98;
13899 write_var (p_lhs, field);
13900 phc_check_invariants (TSRMLS_C);
13902 // return $TSt98;
13904 zval* rhs;
13905 if (local_TSt98 == NULL)
13906 rhs = EG (uninitialized_zval_ptr);
13907 else
13908 rhs = local_TSt98;
13910 // Run-time return by reference has different semantics to compile-time.
13911 // If the function has CTRBR and RTRBR, the the assignment will be
13912 // reference. If one or the other is return-by-copy, the result will be
13913 // by copy. Its a question of whether its separated at return-time (which
13914 // we do here) or at the call-site.
13915 return_value->value = rhs->value;
13916 return_value->type = rhs->type;
13917 zval_copy_ctor (return_value);
13918 goto end_of_function;
13919 phc_check_invariants (TSRMLS_C);
13921 // Method exit
13922 end_of_function:__attribute__((unused));
13923 if (local_TLE95 != NULL)
13925 zval_ptr_dtor (&local_TLE95);
13927 if (local_TLE96 != NULL)
13929 zval_ptr_dtor (&local_TLE96);
13931 if (local_TMIt127 != NULL)
13933 zval_ptr_dtor (&local_TMIt127);
13935 if (local_TSa97 != NULL)
13937 zval_ptr_dtor (&local_TSa97);
13939 if (local_TSt98 != NULL)
13941 zval_ptr_dtor (&local_TSt98);
13944 // ArgInfo structures (necessary to support compile time pass-by-reference)
13945 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_parseroutput_arg_info, 0, 0, 0)
13946 ZEND_ARG_INFO(0, "text")
13947 ZEND_ARG_INFO(0, "languageLinks")
13948 ZEND_ARG_INFO(0, "categoryLinks")
13949 ZEND_ARG_INFO(0, "containsOldMagic")
13950 ZEND_ARG_INFO(0, "titletext")
13951 ZEND_END_ARG_INFO()
13953 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_gettext_arg_info, 0, 0, 0)
13954 ZEND_END_ARG_INFO()
13956 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getlanguagelinks_arg_info, 0, 1, 0)
13957 ZEND_END_ARG_INFO()
13959 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getcategorylinks_arg_info, 0, 0, 0)
13960 ZEND_END_ARG_INFO()
13962 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getcategories_arg_info, 0, 1, 0)
13963 ZEND_END_ARG_INFO()
13965 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getcachetime_arg_info, 0, 0, 0)
13966 ZEND_END_ARG_INFO()
13968 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_gettitletext_arg_info, 0, 0, 0)
13969 ZEND_END_ARG_INFO()
13971 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getsections_arg_info, 0, 0, 0)
13972 ZEND_END_ARG_INFO()
13974 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getlinks_arg_info, 0, 1, 0)
13975 ZEND_END_ARG_INFO()
13977 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_gettemplates_arg_info, 0, 1, 0)
13978 ZEND_END_ARG_INFO()
13980 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getimages_arg_info, 0, 1, 0)
13981 ZEND_END_ARG_INFO()
13983 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getexternallinks_arg_info, 0, 1, 0)
13984 ZEND_END_ARG_INFO()
13986 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getnogallery_arg_info, 0, 0, 0)
13987 ZEND_END_ARG_INFO()
13989 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getsubtitle_arg_info, 0, 0, 0)
13990 ZEND_END_ARG_INFO()
13992 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getoutputhooks_arg_info, 0, 0, 0)
13993 ZEND_END_ARG_INFO()
13995 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getwarnings_arg_info, 0, 0, 0)
13996 ZEND_END_ARG_INFO()
13998 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getindexpolicy_arg_info, 0, 0, 0)
13999 ZEND_END_ARG_INFO()
14001 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_containsoldmagic_arg_info, 0, 0, 0)
14002 ZEND_END_ARG_INFO()
14004 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_settext_arg_info, 0, 0, 0)
14005 ZEND_ARG_INFO(0, "text")
14006 ZEND_END_ARG_INFO()
14008 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setlanguagelinks_arg_info, 0, 0, 0)
14009 ZEND_ARG_INFO(0, "ll")
14010 ZEND_END_ARG_INFO()
14012 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setcategorylinks_arg_info, 0, 0, 0)
14013 ZEND_ARG_INFO(0, "cl")
14014 ZEND_END_ARG_INFO()
14016 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setcontainsoldmagic_arg_info, 0, 0, 0)
14017 ZEND_ARG_INFO(0, "com")
14018 ZEND_END_ARG_INFO()
14020 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setcachetime_arg_info, 0, 0, 0)
14021 ZEND_ARG_INFO(0, "t")
14022 ZEND_END_ARG_INFO()
14024 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_settitletext_arg_info, 0, 0, 0)
14025 ZEND_ARG_INFO(0, "t")
14026 ZEND_END_ARG_INFO()
14028 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setsections_arg_info, 0, 0, 0)
14029 ZEND_ARG_INFO(0, "toc")
14030 ZEND_END_ARG_INFO()
14032 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setindexpolicy_arg_info, 0, 0, 0)
14033 ZEND_ARG_INFO(0, "policy")
14034 ZEND_END_ARG_INFO()
14036 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addcategory_arg_info, 0, 0, 0)
14037 ZEND_ARG_INFO(0, "c")
14038 ZEND_ARG_INFO(0, "sort")
14039 ZEND_END_ARG_INFO()
14041 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addlanguagelink_arg_info, 0, 0, 0)
14042 ZEND_ARG_INFO(0, "t")
14043 ZEND_END_ARG_INFO()
14045 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addexternallink_arg_info, 0, 0, 0)
14046 ZEND_ARG_INFO(0, "url")
14047 ZEND_END_ARG_INFO()
14049 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addwarning_arg_info, 0, 0, 0)
14050 ZEND_ARG_INFO(0, "s")
14051 ZEND_END_ARG_INFO()
14053 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addoutputhook_arg_info, 0, 0, 0)
14054 ZEND_ARG_INFO(0, "hook")
14055 ZEND_ARG_INFO(0, "data")
14056 ZEND_END_ARG_INFO()
14058 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setnewsection_arg_info, 0, 0, 0)
14059 ZEND_ARG_INFO(0, "value")
14060 ZEND_END_ARG_INFO()
14062 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getnewsection_arg_info, 0, 0, 0)
14063 ZEND_END_ARG_INFO()
14065 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addlink_arg_info, 0, 0, 0)
14066 ZEND_ARG_INFO(0, "title")
14067 ZEND_ARG_INFO(0, "id")
14068 ZEND_END_ARG_INFO()
14070 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addimage_arg_info, 0, 0, 0)
14071 ZEND_ARG_INFO(0, "name")
14072 ZEND_END_ARG_INFO()
14074 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addtemplate_arg_info, 0, 0, 0)
14075 ZEND_ARG_INFO(0, "title")
14076 ZEND_ARG_INFO(0, "page_id")
14077 ZEND_ARG_INFO(0, "rev_id")
14078 ZEND_END_ARG_INFO()
14080 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_expired_arg_info, 0, 0, 0)
14081 ZEND_ARG_INFO(0, "touched")
14082 ZEND_END_ARG_INFO()
14084 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addheaditem_arg_info, 0, 0, 0)
14085 ZEND_ARG_INFO(0, "section")
14086 ZEND_ARG_INFO(0, "tag")
14087 ZEND_END_ARG_INFO()
14089 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setdisplaytitle_arg_info, 0, 0, 0)
14090 ZEND_ARG_INFO(0, "text")
14091 ZEND_END_ARG_INFO()
14093 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getdisplaytitle_arg_info, 0, 0, 0)
14094 ZEND_END_ARG_INFO()
14096 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setflag_arg_info, 0, 0, 0)
14097 ZEND_ARG_INFO(0, "flag")
14098 ZEND_END_ARG_INFO()
14100 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getflag_arg_info, 0, 0, 0)
14101 ZEND_ARG_INFO(0, "flag")
14102 ZEND_END_ARG_INFO()
14104 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setproperty_arg_info, 0, 0, 0)
14105 ZEND_ARG_INFO(0, "name")
14106 ZEND_ARG_INFO(0, "value")
14107 ZEND_END_ARG_INFO()
14109 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getproperty_arg_info, 0, 0, 0)
14110 ZEND_ARG_INFO(0, "name")
14111 ZEND_END_ARG_INFO()
14113 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getproperties_arg_info, 0, 0, 0)
14114 ZEND_END_ARG_INFO()
14116 static function_entry ParserOutput_functions[] = {
14117 PHP_ME(ParserOutput, parseroutput, ParserOutput_parseroutput_arg_info, ZEND_ACC_PUBLIC)
14118 PHP_ME(ParserOutput, gettext, ParserOutput_gettext_arg_info, ZEND_ACC_PUBLIC)
14119 PHP_ME(ParserOutput, getlanguagelinks, ParserOutput_getlanguagelinks_arg_info, ZEND_ACC_PUBLIC)
14120 PHP_ME(ParserOutput, getcategorylinks, ParserOutput_getcategorylinks_arg_info, ZEND_ACC_PUBLIC)
14121 PHP_ME(ParserOutput, getcategories, ParserOutput_getcategories_arg_info, ZEND_ACC_PUBLIC)
14122 PHP_ME(ParserOutput, getcachetime, ParserOutput_getcachetime_arg_info, ZEND_ACC_PUBLIC)
14123 PHP_ME(ParserOutput, gettitletext, ParserOutput_gettitletext_arg_info, ZEND_ACC_PUBLIC)
14124 PHP_ME(ParserOutput, getsections, ParserOutput_getsections_arg_info, ZEND_ACC_PUBLIC)
14125 PHP_ME(ParserOutput, getlinks, ParserOutput_getlinks_arg_info, ZEND_ACC_PUBLIC)
14126 PHP_ME(ParserOutput, gettemplates, ParserOutput_gettemplates_arg_info, ZEND_ACC_PUBLIC)
14127 PHP_ME(ParserOutput, getimages, ParserOutput_getimages_arg_info, ZEND_ACC_PUBLIC)
14128 PHP_ME(ParserOutput, getexternallinks, ParserOutput_getexternallinks_arg_info, ZEND_ACC_PUBLIC)
14129 PHP_ME(ParserOutput, getnogallery, ParserOutput_getnogallery_arg_info, ZEND_ACC_PUBLIC)
14130 PHP_ME(ParserOutput, getsubtitle, ParserOutput_getsubtitle_arg_info, ZEND_ACC_PUBLIC)
14131 PHP_ME(ParserOutput, getoutputhooks, ParserOutput_getoutputhooks_arg_info, ZEND_ACC_PUBLIC)
14132 PHP_ME(ParserOutput, getwarnings, ParserOutput_getwarnings_arg_info, ZEND_ACC_PUBLIC)
14133 PHP_ME(ParserOutput, getindexpolicy, ParserOutput_getindexpolicy_arg_info, ZEND_ACC_PUBLIC)
14134 PHP_ME(ParserOutput, containsoldmagic, ParserOutput_containsoldmagic_arg_info, ZEND_ACC_PUBLIC)
14135 PHP_ME(ParserOutput, settext, ParserOutput_settext_arg_info, ZEND_ACC_PUBLIC)
14136 PHP_ME(ParserOutput, setlanguagelinks, ParserOutput_setlanguagelinks_arg_info, ZEND_ACC_PUBLIC)
14137 PHP_ME(ParserOutput, setcategorylinks, ParserOutput_setcategorylinks_arg_info, ZEND_ACC_PUBLIC)
14138 PHP_ME(ParserOutput, setcontainsoldmagic, ParserOutput_setcontainsoldmagic_arg_info, ZEND_ACC_PUBLIC)
14139 PHP_ME(ParserOutput, setcachetime, ParserOutput_setcachetime_arg_info, ZEND_ACC_PUBLIC)
14140 PHP_ME(ParserOutput, settitletext, ParserOutput_settitletext_arg_info, ZEND_ACC_PUBLIC)
14141 PHP_ME(ParserOutput, setsections, ParserOutput_setsections_arg_info, ZEND_ACC_PUBLIC)
14142 PHP_ME(ParserOutput, setindexpolicy, ParserOutput_setindexpolicy_arg_info, ZEND_ACC_PUBLIC)
14143 PHP_ME(ParserOutput, addcategory, ParserOutput_addcategory_arg_info, ZEND_ACC_PUBLIC)
14144 PHP_ME(ParserOutput, addlanguagelink, ParserOutput_addlanguagelink_arg_info, ZEND_ACC_PUBLIC)
14145 PHP_ME(ParserOutput, addexternallink, ParserOutput_addexternallink_arg_info, ZEND_ACC_PUBLIC)
14146 PHP_ME(ParserOutput, addwarning, ParserOutput_addwarning_arg_info, ZEND_ACC_PUBLIC)
14147 PHP_ME(ParserOutput, addoutputhook, ParserOutput_addoutputhook_arg_info, ZEND_ACC_PUBLIC)
14148 PHP_ME(ParserOutput, setnewsection, ParserOutput_setnewsection_arg_info, ZEND_ACC_PUBLIC)
14149 PHP_ME(ParserOutput, getnewsection, ParserOutput_getnewsection_arg_info, ZEND_ACC_PUBLIC)
14150 PHP_ME(ParserOutput, addlink, ParserOutput_addlink_arg_info, ZEND_ACC_PUBLIC)
14151 PHP_ME(ParserOutput, addimage, ParserOutput_addimage_arg_info, ZEND_ACC_PUBLIC)
14152 PHP_ME(ParserOutput, addtemplate, ParserOutput_addtemplate_arg_info, ZEND_ACC_PUBLIC)
14153 PHP_ME(ParserOutput, expired, ParserOutput_expired_arg_info, ZEND_ACC_PUBLIC)
14154 PHP_ME(ParserOutput, addheaditem, ParserOutput_addheaditem_arg_info, ZEND_ACC_PUBLIC)
14155 PHP_ME(ParserOutput, setdisplaytitle, ParserOutput_setdisplaytitle_arg_info, ZEND_ACC_PUBLIC)
14156 PHP_ME(ParserOutput, getdisplaytitle, ParserOutput_getdisplaytitle_arg_info, ZEND_ACC_PUBLIC)
14157 PHP_ME(ParserOutput, setflag, ParserOutput_setflag_arg_info, ZEND_ACC_PUBLIC)
14158 PHP_ME(ParserOutput, getflag, ParserOutput_getflag_arg_info, ZEND_ACC_PUBLIC)
14159 PHP_ME(ParserOutput, setproperty, ParserOutput_setproperty_arg_info, ZEND_ACC_PUBLIC)
14160 PHP_ME(ParserOutput, getproperty, ParserOutput_getproperty_arg_info, ZEND_ACC_PUBLIC)
14161 PHP_ME(ParserOutput, getproperties, ParserOutput_getproperties_arg_info, ZEND_ACC_PUBLIC)
14162 { NULL, NULL, NULL }
14164 // function __MAIN__()
14165 // {
14166 // }
14167 PHP_FUNCTION(__MAIN__)
14169 // Function body
14170 // Method exit
14171 end_of_function:__attribute__((unused));
14173 // Module initialization
14174 PHP_MINIT_FUNCTION(app)
14177 zend_class_entry ce; // temp
14178 zend_class_entry* ce_reg; // once registered, ce_ptr should be used
14179 INIT_CLASS_ENTRY(ce, "ParserOutput", ParserOutput_functions);
14180 ce_reg = zend_register_internal_class(&ce TSRMLS_CC);
14181 ce_reg->type &= ~ZEND_INTERNAL_CLASS;
14183 zval* default_value;
14185 zval* local___static_value__ = NULL;
14186 // $__static_value__ = NULL;
14188 if (local___static_value__ == NULL)
14190 local___static_value__ = EG (uninitialized_zval_ptr);
14191 local___static_value__->refcount++;
14193 zval** p_lhs = &local___static_value__;
14195 zval* value;
14196 if ((*p_lhs)->is_ref)
14198 // Always overwrite the current value
14199 value = *p_lhs;
14200 zval_dtor (value);
14202 else
14204 ALLOC_INIT_ZVAL (value);
14205 zval_ptr_dtor (p_lhs);
14206 *p_lhs = value;
14209 ZVAL_NULL (value);
14211 phc_check_invariants (TSRMLS_C);
14213 default_value = local___static_value__;
14214 assert(!default_value->is_ref);
14215 default_value->refcount++;
14216 if (local___static_value__ != NULL)
14218 zval_ptr_dtor (&local___static_value__);
14221 phc_declare_property(ce_reg, "mText", 5, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14222 zval* default_value;
14224 zval* local___static_value__ = NULL;
14225 // $__static_value__ = NULL;
14227 if (local___static_value__ == NULL)
14229 local___static_value__ = EG (uninitialized_zval_ptr);
14230 local___static_value__->refcount++;
14232 zval** p_lhs = &local___static_value__;
14234 zval* value;
14235 if ((*p_lhs)->is_ref)
14237 // Always overwrite the current value
14238 value = *p_lhs;
14239 zval_dtor (value);
14241 else
14243 ALLOC_INIT_ZVAL (value);
14244 zval_ptr_dtor (p_lhs);
14245 *p_lhs = value;
14248 ZVAL_NULL (value);
14250 phc_check_invariants (TSRMLS_C);
14252 default_value = local___static_value__;
14253 assert(!default_value->is_ref);
14254 default_value->refcount++;
14255 if (local___static_value__ != NULL)
14257 zval_ptr_dtor (&local___static_value__);
14260 phc_declare_property(ce_reg, "mLanguageLinks", 14, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14261 zval* default_value;
14263 zval* local___static_value__ = NULL;
14264 // $__static_value__ = NULL;
14266 if (local___static_value__ == NULL)
14268 local___static_value__ = EG (uninitialized_zval_ptr);
14269 local___static_value__->refcount++;
14271 zval** p_lhs = &local___static_value__;
14273 zval* value;
14274 if ((*p_lhs)->is_ref)
14276 // Always overwrite the current value
14277 value = *p_lhs;
14278 zval_dtor (value);
14280 else
14282 ALLOC_INIT_ZVAL (value);
14283 zval_ptr_dtor (p_lhs);
14284 *p_lhs = value;
14287 ZVAL_NULL (value);
14289 phc_check_invariants (TSRMLS_C);
14291 default_value = local___static_value__;
14292 assert(!default_value->is_ref);
14293 default_value->refcount++;
14294 if (local___static_value__ != NULL)
14296 zval_ptr_dtor (&local___static_value__);
14299 phc_declare_property(ce_reg, "mCategories", 11, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14300 zval* default_value;
14302 zval* local___static_value__ = NULL;
14303 // $__static_value__ = NULL;
14305 if (local___static_value__ == NULL)
14307 local___static_value__ = EG (uninitialized_zval_ptr);
14308 local___static_value__->refcount++;
14310 zval** p_lhs = &local___static_value__;
14312 zval* value;
14313 if ((*p_lhs)->is_ref)
14315 // Always overwrite the current value
14316 value = *p_lhs;
14317 zval_dtor (value);
14319 else
14321 ALLOC_INIT_ZVAL (value);
14322 zval_ptr_dtor (p_lhs);
14323 *p_lhs = value;
14326 ZVAL_NULL (value);
14328 phc_check_invariants (TSRMLS_C);
14330 default_value = local___static_value__;
14331 assert(!default_value->is_ref);
14332 default_value->refcount++;
14333 if (local___static_value__ != NULL)
14335 zval_ptr_dtor (&local___static_value__);
14338 phc_declare_property(ce_reg, "mContainsOldMagic", 17, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14339 zval* default_value;
14341 zval* local___static_value__ = NULL;
14342 // $__static_value__ = NULL;
14344 if (local___static_value__ == NULL)
14346 local___static_value__ = EG (uninitialized_zval_ptr);
14347 local___static_value__->refcount++;
14349 zval** p_lhs = &local___static_value__;
14351 zval* value;
14352 if ((*p_lhs)->is_ref)
14354 // Always overwrite the current value
14355 value = *p_lhs;
14356 zval_dtor (value);
14358 else
14360 ALLOC_INIT_ZVAL (value);
14361 zval_ptr_dtor (p_lhs);
14362 *p_lhs = value;
14365 ZVAL_NULL (value);
14367 phc_check_invariants (TSRMLS_C);
14369 default_value = local___static_value__;
14370 assert(!default_value->is_ref);
14371 default_value->refcount++;
14372 if (local___static_value__ != NULL)
14374 zval_ptr_dtor (&local___static_value__);
14377 phc_declare_property(ce_reg, "mTitleText", 10, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14378 zval* default_value;
14380 zval* local___static_value__ = NULL;
14381 // $__static_value__ = '';
14383 if (local___static_value__ == NULL)
14385 local___static_value__ = EG (uninitialized_zval_ptr);
14386 local___static_value__->refcount++;
14388 zval** p_lhs = &local___static_value__;
14390 zval* value;
14391 if ((*p_lhs)->is_ref)
14393 // Always overwrite the current value
14394 value = *p_lhs;
14395 zval_dtor (value);
14397 else
14399 ALLOC_INIT_ZVAL (value);
14400 zval_ptr_dtor (p_lhs);
14401 *p_lhs = value;
14404 ZVAL_STRINGL(value, "", 0, 1);
14406 phc_check_invariants (TSRMLS_C);
14408 default_value = local___static_value__;
14409 assert(!default_value->is_ref);
14410 default_value->refcount++;
14411 if (local___static_value__ != NULL)
14413 zval_ptr_dtor (&local___static_value__);
14416 phc_declare_property(ce_reg, "mCacheTime", 10, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14417 zval* default_value;
14419 zval* local___static_value__ = NULL;
14420 // $__static_value__ = Parser::VERSION;
14422 // No null-terminator in length for get_constant.
14423 // zend_get_constant always returns a copy of the constant.
14424 if (local___static_value__ == NULL)
14426 local___static_value__ = EG (uninitialized_zval_ptr);
14427 local___static_value__->refcount++;
14429 zval** p_lhs = &local___static_value__;
14431 if (!(*p_lhs)->is_ref)
14433 zval_ptr_dtor (p_lhs);
14434 get_constant ("Parser::VERSION", 15, p_lhs TSRMLS_CC);
14437 else
14439 zval* constant;
14440 get_constant ("Parser::VERSION", 15, p_lhs TSRMLS_CC);
14441 overwrite_lhs_no_copy (*p_lhs, constant);
14442 safe_free_zval_ptr (constant);
14445 phc_check_invariants (TSRMLS_C);
14447 default_value = local___static_value__;
14448 assert(!default_value->is_ref);
14449 default_value->refcount++;
14450 if (local___static_value__ != NULL)
14452 zval_ptr_dtor (&local___static_value__);
14455 phc_declare_property(ce_reg, "mVersion", 8, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14456 zval* default_value;
14458 zval* local_TSa205 = NULL;
14459 zval* local___static_value__ = NULL;
14460 // unset($TSa205);
14462 if (local_TSa205 != NULL)
14464 zval_ptr_dtor (&local_TSa205);
14465 local_TSa205 = NULL;
14467 phc_check_invariants (TSRMLS_C);
14469 // $TSa205 = (array) $TSa205;
14471 if (local_TSa205 == NULL)
14473 local_TSa205 = EG (uninitialized_zval_ptr);
14474 local_TSa205->refcount++;
14476 zval** p_lhs = &local_TSa205;
14478 zval* rhs;
14479 if (local_TSa205 == NULL)
14480 rhs = EG (uninitialized_zval_ptr);
14481 else
14482 rhs = local_TSa205;
14484 if (*p_lhs != rhs)
14486 if ((*p_lhs)->is_ref)
14487 overwrite_lhs (*p_lhs, rhs);
14488 else
14490 zval_ptr_dtor (p_lhs);
14491 if (rhs->is_ref)
14493 // Take a copy of RHS for LHS
14494 *p_lhs = zvp_clone_ex (rhs);
14496 else
14498 // Share a copy
14499 rhs->refcount++;
14500 *p_lhs = rhs;
14507 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
14508 if ((*p_lhs)->type != IS_ARRAY)
14510 sep_copy_on_write (p_lhs);
14511 convert_to_array (*p_lhs);
14514 phc_check_invariants (TSRMLS_C);
14516 // $__static_value__ = $TSa205;
14518 if (local___static_value__ == NULL)
14520 local___static_value__ = EG (uninitialized_zval_ptr);
14521 local___static_value__->refcount++;
14523 zval** p_lhs = &local___static_value__;
14525 zval* rhs;
14526 if (local_TSa205 == NULL)
14527 rhs = EG (uninitialized_zval_ptr);
14528 else
14529 rhs = local_TSa205;
14531 if (*p_lhs != rhs)
14533 if ((*p_lhs)->is_ref)
14534 overwrite_lhs (*p_lhs, rhs);
14535 else
14537 zval_ptr_dtor (p_lhs);
14538 if (rhs->is_ref)
14540 // Take a copy of RHS for LHS
14541 *p_lhs = zvp_clone_ex (rhs);
14543 else
14545 // Share a copy
14546 rhs->refcount++;
14547 *p_lhs = rhs;
14553 phc_check_invariants (TSRMLS_C);
14555 default_value = local___static_value__;
14556 assert(!default_value->is_ref);
14557 default_value->refcount++;
14558 if (local_TSa205 != NULL)
14560 zval_ptr_dtor (&local_TSa205);
14562 if (local___static_value__ != NULL)
14564 zval_ptr_dtor (&local___static_value__);
14567 phc_declare_property(ce_reg, "mLinks", 6, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14568 zval* default_value;
14570 zval* local_TSa206 = NULL;
14571 zval* local___static_value__ = NULL;
14572 // unset($TSa206);
14574 if (local_TSa206 != NULL)
14576 zval_ptr_dtor (&local_TSa206);
14577 local_TSa206 = NULL;
14579 phc_check_invariants (TSRMLS_C);
14581 // $TSa206 = (array) $TSa206;
14583 if (local_TSa206 == NULL)
14585 local_TSa206 = EG (uninitialized_zval_ptr);
14586 local_TSa206->refcount++;
14588 zval** p_lhs = &local_TSa206;
14590 zval* rhs;
14591 if (local_TSa206 == NULL)
14592 rhs = EG (uninitialized_zval_ptr);
14593 else
14594 rhs = local_TSa206;
14596 if (*p_lhs != rhs)
14598 if ((*p_lhs)->is_ref)
14599 overwrite_lhs (*p_lhs, rhs);
14600 else
14602 zval_ptr_dtor (p_lhs);
14603 if (rhs->is_ref)
14605 // Take a copy of RHS for LHS
14606 *p_lhs = zvp_clone_ex (rhs);
14608 else
14610 // Share a copy
14611 rhs->refcount++;
14612 *p_lhs = rhs;
14619 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
14620 if ((*p_lhs)->type != IS_ARRAY)
14622 sep_copy_on_write (p_lhs);
14623 convert_to_array (*p_lhs);
14626 phc_check_invariants (TSRMLS_C);
14628 // $__static_value__ = $TSa206;
14630 if (local___static_value__ == NULL)
14632 local___static_value__ = EG (uninitialized_zval_ptr);
14633 local___static_value__->refcount++;
14635 zval** p_lhs = &local___static_value__;
14637 zval* rhs;
14638 if (local_TSa206 == NULL)
14639 rhs = EG (uninitialized_zval_ptr);
14640 else
14641 rhs = local_TSa206;
14643 if (*p_lhs != rhs)
14645 if ((*p_lhs)->is_ref)
14646 overwrite_lhs (*p_lhs, rhs);
14647 else
14649 zval_ptr_dtor (p_lhs);
14650 if (rhs->is_ref)
14652 // Take a copy of RHS for LHS
14653 *p_lhs = zvp_clone_ex (rhs);
14655 else
14657 // Share a copy
14658 rhs->refcount++;
14659 *p_lhs = rhs;
14665 phc_check_invariants (TSRMLS_C);
14667 default_value = local___static_value__;
14668 assert(!default_value->is_ref);
14669 default_value->refcount++;
14670 if (local_TSa206 != NULL)
14672 zval_ptr_dtor (&local_TSa206);
14674 if (local___static_value__ != NULL)
14676 zval_ptr_dtor (&local___static_value__);
14679 phc_declare_property(ce_reg, "mTemplates", 10, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14680 zval* default_value;
14682 zval* local_TSa207 = NULL;
14683 zval* local___static_value__ = NULL;
14684 // unset($TSa207);
14686 if (local_TSa207 != NULL)
14688 zval_ptr_dtor (&local_TSa207);
14689 local_TSa207 = NULL;
14691 phc_check_invariants (TSRMLS_C);
14693 // $TSa207 = (array) $TSa207;
14695 if (local_TSa207 == NULL)
14697 local_TSa207 = EG (uninitialized_zval_ptr);
14698 local_TSa207->refcount++;
14700 zval** p_lhs = &local_TSa207;
14702 zval* rhs;
14703 if (local_TSa207 == NULL)
14704 rhs = EG (uninitialized_zval_ptr);
14705 else
14706 rhs = local_TSa207;
14708 if (*p_lhs != rhs)
14710 if ((*p_lhs)->is_ref)
14711 overwrite_lhs (*p_lhs, rhs);
14712 else
14714 zval_ptr_dtor (p_lhs);
14715 if (rhs->is_ref)
14717 // Take a copy of RHS for LHS
14718 *p_lhs = zvp_clone_ex (rhs);
14720 else
14722 // Share a copy
14723 rhs->refcount++;
14724 *p_lhs = rhs;
14731 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
14732 if ((*p_lhs)->type != IS_ARRAY)
14734 sep_copy_on_write (p_lhs);
14735 convert_to_array (*p_lhs);
14738 phc_check_invariants (TSRMLS_C);
14740 // $__static_value__ = $TSa207;
14742 if (local___static_value__ == NULL)
14744 local___static_value__ = EG (uninitialized_zval_ptr);
14745 local___static_value__->refcount++;
14747 zval** p_lhs = &local___static_value__;
14749 zval* rhs;
14750 if (local_TSa207 == NULL)
14751 rhs = EG (uninitialized_zval_ptr);
14752 else
14753 rhs = local_TSa207;
14755 if (*p_lhs != rhs)
14757 if ((*p_lhs)->is_ref)
14758 overwrite_lhs (*p_lhs, rhs);
14759 else
14761 zval_ptr_dtor (p_lhs);
14762 if (rhs->is_ref)
14764 // Take a copy of RHS for LHS
14765 *p_lhs = zvp_clone_ex (rhs);
14767 else
14769 // Share a copy
14770 rhs->refcount++;
14771 *p_lhs = rhs;
14777 phc_check_invariants (TSRMLS_C);
14779 default_value = local___static_value__;
14780 assert(!default_value->is_ref);
14781 default_value->refcount++;
14782 if (local_TSa207 != NULL)
14784 zval_ptr_dtor (&local_TSa207);
14786 if (local___static_value__ != NULL)
14788 zval_ptr_dtor (&local___static_value__);
14791 phc_declare_property(ce_reg, "mTemplateIds", 12, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14792 zval* default_value;
14794 zval* local_TSa208 = NULL;
14795 zval* local___static_value__ = NULL;
14796 // unset($TSa208);
14798 if (local_TSa208 != NULL)
14800 zval_ptr_dtor (&local_TSa208);
14801 local_TSa208 = NULL;
14803 phc_check_invariants (TSRMLS_C);
14805 // $TSa208 = (array) $TSa208;
14807 if (local_TSa208 == NULL)
14809 local_TSa208 = EG (uninitialized_zval_ptr);
14810 local_TSa208->refcount++;
14812 zval** p_lhs = &local_TSa208;
14814 zval* rhs;
14815 if (local_TSa208 == NULL)
14816 rhs = EG (uninitialized_zval_ptr);
14817 else
14818 rhs = local_TSa208;
14820 if (*p_lhs != rhs)
14822 if ((*p_lhs)->is_ref)
14823 overwrite_lhs (*p_lhs, rhs);
14824 else
14826 zval_ptr_dtor (p_lhs);
14827 if (rhs->is_ref)
14829 // Take a copy of RHS for LHS
14830 *p_lhs = zvp_clone_ex (rhs);
14832 else
14834 // Share a copy
14835 rhs->refcount++;
14836 *p_lhs = rhs;
14843 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
14844 if ((*p_lhs)->type != IS_ARRAY)
14846 sep_copy_on_write (p_lhs);
14847 convert_to_array (*p_lhs);
14850 phc_check_invariants (TSRMLS_C);
14852 // $__static_value__ = $TSa208;
14854 if (local___static_value__ == NULL)
14856 local___static_value__ = EG (uninitialized_zval_ptr);
14857 local___static_value__->refcount++;
14859 zval** p_lhs = &local___static_value__;
14861 zval* rhs;
14862 if (local_TSa208 == NULL)
14863 rhs = EG (uninitialized_zval_ptr);
14864 else
14865 rhs = local_TSa208;
14867 if (*p_lhs != rhs)
14869 if ((*p_lhs)->is_ref)
14870 overwrite_lhs (*p_lhs, rhs);
14871 else
14873 zval_ptr_dtor (p_lhs);
14874 if (rhs->is_ref)
14876 // Take a copy of RHS for LHS
14877 *p_lhs = zvp_clone_ex (rhs);
14879 else
14881 // Share a copy
14882 rhs->refcount++;
14883 *p_lhs = rhs;
14889 phc_check_invariants (TSRMLS_C);
14891 default_value = local___static_value__;
14892 assert(!default_value->is_ref);
14893 default_value->refcount++;
14894 if (local_TSa208 != NULL)
14896 zval_ptr_dtor (&local_TSa208);
14898 if (local___static_value__ != NULL)
14900 zval_ptr_dtor (&local___static_value__);
14903 phc_declare_property(ce_reg, "mImages", 7, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
14904 zval* default_value;
14906 zval* local_TSa209 = NULL;
14907 zval* local___static_value__ = NULL;
14908 // unset($TSa209);
14910 if (local_TSa209 != NULL)
14912 zval_ptr_dtor (&local_TSa209);
14913 local_TSa209 = NULL;
14915 phc_check_invariants (TSRMLS_C);
14917 // $TSa209 = (array) $TSa209;
14919 if (local_TSa209 == NULL)
14921 local_TSa209 = EG (uninitialized_zval_ptr);
14922 local_TSa209->refcount++;
14924 zval** p_lhs = &local_TSa209;
14926 zval* rhs;
14927 if (local_TSa209 == NULL)
14928 rhs = EG (uninitialized_zval_ptr);
14929 else
14930 rhs = local_TSa209;
14932 if (*p_lhs != rhs)
14934 if ((*p_lhs)->is_ref)
14935 overwrite_lhs (*p_lhs, rhs);
14936 else
14938 zval_ptr_dtor (p_lhs);
14939 if (rhs->is_ref)
14941 // Take a copy of RHS for LHS
14942 *p_lhs = zvp_clone_ex (rhs);
14944 else
14946 // Share a copy
14947 rhs->refcount++;
14948 *p_lhs = rhs;
14955 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
14956 if ((*p_lhs)->type != IS_ARRAY)
14958 sep_copy_on_write (p_lhs);
14959 convert_to_array (*p_lhs);
14962 phc_check_invariants (TSRMLS_C);
14964 // $__static_value__ = $TSa209;
14966 if (local___static_value__ == NULL)
14968 local___static_value__ = EG (uninitialized_zval_ptr);
14969 local___static_value__->refcount++;
14971 zval** p_lhs = &local___static_value__;
14973 zval* rhs;
14974 if (local_TSa209 == NULL)
14975 rhs = EG (uninitialized_zval_ptr);
14976 else
14977 rhs = local_TSa209;
14979 if (*p_lhs != rhs)
14981 if ((*p_lhs)->is_ref)
14982 overwrite_lhs (*p_lhs, rhs);
14983 else
14985 zval_ptr_dtor (p_lhs);
14986 if (rhs->is_ref)
14988 // Take a copy of RHS for LHS
14989 *p_lhs = zvp_clone_ex (rhs);
14991 else
14993 // Share a copy
14994 rhs->refcount++;
14995 *p_lhs = rhs;
15001 phc_check_invariants (TSRMLS_C);
15003 default_value = local___static_value__;
15004 assert(!default_value->is_ref);
15005 default_value->refcount++;
15006 if (local_TSa209 != NULL)
15008 zval_ptr_dtor (&local_TSa209);
15010 if (local___static_value__ != NULL)
15012 zval_ptr_dtor (&local___static_value__);
15015 phc_declare_property(ce_reg, "mExternalLinks", 14, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
15016 zval* default_value;
15018 zval* local___static_value__ = NULL;
15019 // $__static_value__ = False;
15021 if (local___static_value__ == NULL)
15023 local___static_value__ = EG (uninitialized_zval_ptr);
15024 local___static_value__->refcount++;
15026 zval** p_lhs = &local___static_value__;
15028 zval* value;
15029 if ((*p_lhs)->is_ref)
15031 // Always overwrite the current value
15032 value = *p_lhs;
15033 zval_dtor (value);
15035 else
15037 ALLOC_INIT_ZVAL (value);
15038 zval_ptr_dtor (p_lhs);
15039 *p_lhs = value;
15042 ZVAL_BOOL (value, 0);
15044 phc_check_invariants (TSRMLS_C);
15046 default_value = local___static_value__;
15047 assert(!default_value->is_ref);
15048 default_value->refcount++;
15049 if (local___static_value__ != NULL)
15051 zval_ptr_dtor (&local___static_value__);
15054 phc_declare_property(ce_reg, "mNewSection", 11, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
15055 zval* default_value;
15057 zval* local___static_value__ = NULL;
15058 // $__static_value__ = False;
15060 if (local___static_value__ == NULL)
15062 local___static_value__ = EG (uninitialized_zval_ptr);
15063 local___static_value__->refcount++;
15065 zval** p_lhs = &local___static_value__;
15067 zval* value;
15068 if ((*p_lhs)->is_ref)
15070 // Always overwrite the current value
15071 value = *p_lhs;
15072 zval_dtor (value);
15074 else
15076 ALLOC_INIT_ZVAL (value);
15077 zval_ptr_dtor (p_lhs);
15078 *p_lhs = value;
15081 ZVAL_BOOL (value, 0);
15083 phc_check_invariants (TSRMLS_C);
15085 default_value = local___static_value__;
15086 assert(!default_value->is_ref);
15087 default_value->refcount++;
15088 if (local___static_value__ != NULL)
15090 zval_ptr_dtor (&local___static_value__);
15093 phc_declare_property(ce_reg, "mNoGallery", 10, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
15094 zval* default_value;
15096 zval* local_TSa210 = NULL;
15097 zval* local___static_value__ = NULL;
15098 // unset($TSa210);
15100 if (local_TSa210 != NULL)
15102 zval_ptr_dtor (&local_TSa210);
15103 local_TSa210 = NULL;
15105 phc_check_invariants (TSRMLS_C);
15107 // $TSa210 = (array) $TSa210;
15109 if (local_TSa210 == NULL)
15111 local_TSa210 = EG (uninitialized_zval_ptr);
15112 local_TSa210->refcount++;
15114 zval** p_lhs = &local_TSa210;
15116 zval* rhs;
15117 if (local_TSa210 == NULL)
15118 rhs = EG (uninitialized_zval_ptr);
15119 else
15120 rhs = local_TSa210;
15122 if (*p_lhs != rhs)
15124 if ((*p_lhs)->is_ref)
15125 overwrite_lhs (*p_lhs, rhs);
15126 else
15128 zval_ptr_dtor (p_lhs);
15129 if (rhs->is_ref)
15131 // Take a copy of RHS for LHS
15132 *p_lhs = zvp_clone_ex (rhs);
15134 else
15136 // Share a copy
15137 rhs->refcount++;
15138 *p_lhs = rhs;
15145 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
15146 if ((*p_lhs)->type != IS_ARRAY)
15148 sep_copy_on_write (p_lhs);
15149 convert_to_array (*p_lhs);
15152 phc_check_invariants (TSRMLS_C);
15154 // $__static_value__ = $TSa210;
15156 if (local___static_value__ == NULL)
15158 local___static_value__ = EG (uninitialized_zval_ptr);
15159 local___static_value__->refcount++;
15161 zval** p_lhs = &local___static_value__;
15163 zval* rhs;
15164 if (local_TSa210 == NULL)
15165 rhs = EG (uninitialized_zval_ptr);
15166 else
15167 rhs = local_TSa210;
15169 if (*p_lhs != rhs)
15171 if ((*p_lhs)->is_ref)
15172 overwrite_lhs (*p_lhs, rhs);
15173 else
15175 zval_ptr_dtor (p_lhs);
15176 if (rhs->is_ref)
15178 // Take a copy of RHS for LHS
15179 *p_lhs = zvp_clone_ex (rhs);
15181 else
15183 // Share a copy
15184 rhs->refcount++;
15185 *p_lhs = rhs;
15191 phc_check_invariants (TSRMLS_C);
15193 default_value = local___static_value__;
15194 assert(!default_value->is_ref);
15195 default_value->refcount++;
15196 if (local_TSa210 != NULL)
15198 zval_ptr_dtor (&local_TSa210);
15200 if (local___static_value__ != NULL)
15202 zval_ptr_dtor (&local___static_value__);
15205 phc_declare_property(ce_reg, "mHeadItems", 10, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
15206 zval* default_value;
15208 zval* local_TSa211 = NULL;
15209 zval* local___static_value__ = NULL;
15210 // unset($TSa211);
15212 if (local_TSa211 != NULL)
15214 zval_ptr_dtor (&local_TSa211);
15215 local_TSa211 = NULL;
15217 phc_check_invariants (TSRMLS_C);
15219 // $TSa211 = (array) $TSa211;
15221 if (local_TSa211 == NULL)
15223 local_TSa211 = EG (uninitialized_zval_ptr);
15224 local_TSa211->refcount++;
15226 zval** p_lhs = &local_TSa211;
15228 zval* rhs;
15229 if (local_TSa211 == NULL)
15230 rhs = EG (uninitialized_zval_ptr);
15231 else
15232 rhs = local_TSa211;
15234 if (*p_lhs != rhs)
15236 if ((*p_lhs)->is_ref)
15237 overwrite_lhs (*p_lhs, rhs);
15238 else
15240 zval_ptr_dtor (p_lhs);
15241 if (rhs->is_ref)
15243 // Take a copy of RHS for LHS
15244 *p_lhs = zvp_clone_ex (rhs);
15246 else
15248 // Share a copy
15249 rhs->refcount++;
15250 *p_lhs = rhs;
15257 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
15258 if ((*p_lhs)->type != IS_ARRAY)
15260 sep_copy_on_write (p_lhs);
15261 convert_to_array (*p_lhs);
15264 phc_check_invariants (TSRMLS_C);
15266 // $__static_value__ = $TSa211;
15268 if (local___static_value__ == NULL)
15270 local___static_value__ = EG (uninitialized_zval_ptr);
15271 local___static_value__->refcount++;
15273 zval** p_lhs = &local___static_value__;
15275 zval* rhs;
15276 if (local_TSa211 == NULL)
15277 rhs = EG (uninitialized_zval_ptr);
15278 else
15279 rhs = local_TSa211;
15281 if (*p_lhs != rhs)
15283 if ((*p_lhs)->is_ref)
15284 overwrite_lhs (*p_lhs, rhs);
15285 else
15287 zval_ptr_dtor (p_lhs);
15288 if (rhs->is_ref)
15290 // Take a copy of RHS for LHS
15291 *p_lhs = zvp_clone_ex (rhs);
15293 else
15295 // Share a copy
15296 rhs->refcount++;
15297 *p_lhs = rhs;
15303 phc_check_invariants (TSRMLS_C);
15305 default_value = local___static_value__;
15306 assert(!default_value->is_ref);
15307 default_value->refcount++;
15308 if (local_TSa211 != NULL)
15310 zval_ptr_dtor (&local_TSa211);
15312 if (local___static_value__ != NULL)
15314 zval_ptr_dtor (&local___static_value__);
15317 phc_declare_property(ce_reg, "mOutputHooks", 12, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
15318 zval* default_value;
15320 zval* local_TSa212 = NULL;
15321 zval* local___static_value__ = NULL;
15322 // unset($TSa212);
15324 if (local_TSa212 != NULL)
15326 zval_ptr_dtor (&local_TSa212);
15327 local_TSa212 = NULL;
15329 phc_check_invariants (TSRMLS_C);
15331 // $TSa212 = (array) $TSa212;
15333 if (local_TSa212 == NULL)
15335 local_TSa212 = EG (uninitialized_zval_ptr);
15336 local_TSa212->refcount++;
15338 zval** p_lhs = &local_TSa212;
15340 zval* rhs;
15341 if (local_TSa212 == NULL)
15342 rhs = EG (uninitialized_zval_ptr);
15343 else
15344 rhs = local_TSa212;
15346 if (*p_lhs != rhs)
15348 if ((*p_lhs)->is_ref)
15349 overwrite_lhs (*p_lhs, rhs);
15350 else
15352 zval_ptr_dtor (p_lhs);
15353 if (rhs->is_ref)
15355 // Take a copy of RHS for LHS
15356 *p_lhs = zvp_clone_ex (rhs);
15358 else
15360 // Share a copy
15361 rhs->refcount++;
15362 *p_lhs = rhs;
15369 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
15370 if ((*p_lhs)->type != IS_ARRAY)
15372 sep_copy_on_write (p_lhs);
15373 convert_to_array (*p_lhs);
15376 phc_check_invariants (TSRMLS_C);
15378 // $__static_value__ = $TSa212;
15380 if (local___static_value__ == NULL)
15382 local___static_value__ = EG (uninitialized_zval_ptr);
15383 local___static_value__->refcount++;
15385 zval** p_lhs = &local___static_value__;
15387 zval* rhs;
15388 if (local_TSa212 == NULL)
15389 rhs = EG (uninitialized_zval_ptr);
15390 else
15391 rhs = local_TSa212;
15393 if (*p_lhs != rhs)
15395 if ((*p_lhs)->is_ref)
15396 overwrite_lhs (*p_lhs, rhs);
15397 else
15399 zval_ptr_dtor (p_lhs);
15400 if (rhs->is_ref)
15402 // Take a copy of RHS for LHS
15403 *p_lhs = zvp_clone_ex (rhs);
15405 else
15407 // Share a copy
15408 rhs->refcount++;
15409 *p_lhs = rhs;
15415 phc_check_invariants (TSRMLS_C);
15417 default_value = local___static_value__;
15418 assert(!default_value->is_ref);
15419 default_value->refcount++;
15420 if (local_TSa212 != NULL)
15422 zval_ptr_dtor (&local_TSa212);
15424 if (local___static_value__ != NULL)
15426 zval_ptr_dtor (&local___static_value__);
15429 phc_declare_property(ce_reg, "mWarnings", 9, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
15430 zval* default_value;
15432 zval* local_TSa213 = NULL;
15433 zval* local___static_value__ = NULL;
15434 // unset($TSa213);
15436 if (local_TSa213 != NULL)
15438 zval_ptr_dtor (&local_TSa213);
15439 local_TSa213 = NULL;
15441 phc_check_invariants (TSRMLS_C);
15443 // $TSa213 = (array) $TSa213;
15445 if (local_TSa213 == NULL)
15447 local_TSa213 = EG (uninitialized_zval_ptr);
15448 local_TSa213->refcount++;
15450 zval** p_lhs = &local_TSa213;
15452 zval* rhs;
15453 if (local_TSa213 == NULL)
15454 rhs = EG (uninitialized_zval_ptr);
15455 else
15456 rhs = local_TSa213;
15458 if (*p_lhs != rhs)
15460 if ((*p_lhs)->is_ref)
15461 overwrite_lhs (*p_lhs, rhs);
15462 else
15464 zval_ptr_dtor (p_lhs);
15465 if (rhs->is_ref)
15467 // Take a copy of RHS for LHS
15468 *p_lhs = zvp_clone_ex (rhs);
15470 else
15472 // Share a copy
15473 rhs->refcount++;
15474 *p_lhs = rhs;
15481 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
15482 if ((*p_lhs)->type != IS_ARRAY)
15484 sep_copy_on_write (p_lhs);
15485 convert_to_array (*p_lhs);
15488 phc_check_invariants (TSRMLS_C);
15490 // $__static_value__ = $TSa213;
15492 if (local___static_value__ == NULL)
15494 local___static_value__ = EG (uninitialized_zval_ptr);
15495 local___static_value__->refcount++;
15497 zval** p_lhs = &local___static_value__;
15499 zval* rhs;
15500 if (local_TSa213 == NULL)
15501 rhs = EG (uninitialized_zval_ptr);
15502 else
15503 rhs = local_TSa213;
15505 if (*p_lhs != rhs)
15507 if ((*p_lhs)->is_ref)
15508 overwrite_lhs (*p_lhs, rhs);
15509 else
15511 zval_ptr_dtor (p_lhs);
15512 if (rhs->is_ref)
15514 // Take a copy of RHS for LHS
15515 *p_lhs = zvp_clone_ex (rhs);
15517 else
15519 // Share a copy
15520 rhs->refcount++;
15521 *p_lhs = rhs;
15527 phc_check_invariants (TSRMLS_C);
15529 default_value = local___static_value__;
15530 assert(!default_value->is_ref);
15531 default_value->refcount++;
15532 if (local_TSa213 != NULL)
15534 zval_ptr_dtor (&local_TSa213);
15536 if (local___static_value__ != NULL)
15538 zval_ptr_dtor (&local___static_value__);
15541 phc_declare_property(ce_reg, "mSections", 9, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
15542 zval* default_value;
15544 zval* local_TSa214 = NULL;
15545 zval* local___static_value__ = NULL;
15546 // unset($TSa214);
15548 if (local_TSa214 != NULL)
15550 zval_ptr_dtor (&local_TSa214);
15551 local_TSa214 = NULL;
15553 phc_check_invariants (TSRMLS_C);
15555 // $TSa214 = (array) $TSa214;
15557 if (local_TSa214 == NULL)
15559 local_TSa214 = EG (uninitialized_zval_ptr);
15560 local_TSa214->refcount++;
15562 zval** p_lhs = &local_TSa214;
15564 zval* rhs;
15565 if (local_TSa214 == NULL)
15566 rhs = EG (uninitialized_zval_ptr);
15567 else
15568 rhs = local_TSa214;
15570 if (*p_lhs != rhs)
15572 if ((*p_lhs)->is_ref)
15573 overwrite_lhs (*p_lhs, rhs);
15574 else
15576 zval_ptr_dtor (p_lhs);
15577 if (rhs->is_ref)
15579 // Take a copy of RHS for LHS
15580 *p_lhs = zvp_clone_ex (rhs);
15582 else
15584 // Share a copy
15585 rhs->refcount++;
15586 *p_lhs = rhs;
15593 assert (IS_ARRAY >= 0 && IS_ARRAY <= 6);
15594 if ((*p_lhs)->type != IS_ARRAY)
15596 sep_copy_on_write (p_lhs);
15597 convert_to_array (*p_lhs);
15600 phc_check_invariants (TSRMLS_C);
15602 // $__static_value__ = $TSa214;
15604 if (local___static_value__ == NULL)
15606 local___static_value__ = EG (uninitialized_zval_ptr);
15607 local___static_value__->refcount++;
15609 zval** p_lhs = &local___static_value__;
15611 zval* rhs;
15612 if (local_TSa214 == NULL)
15613 rhs = EG (uninitialized_zval_ptr);
15614 else
15615 rhs = local_TSa214;
15617 if (*p_lhs != rhs)
15619 if ((*p_lhs)->is_ref)
15620 overwrite_lhs (*p_lhs, rhs);
15621 else
15623 zval_ptr_dtor (p_lhs);
15624 if (rhs->is_ref)
15626 // Take a copy of RHS for LHS
15627 *p_lhs = zvp_clone_ex (rhs);
15629 else
15631 // Share a copy
15632 rhs->refcount++;
15633 *p_lhs = rhs;
15639 phc_check_invariants (TSRMLS_C);
15641 default_value = local___static_value__;
15642 assert(!default_value->is_ref);
15643 default_value->refcount++;
15644 if (local_TSa214 != NULL)
15646 zval_ptr_dtor (&local_TSa214);
15648 if (local___static_value__ != NULL)
15650 zval_ptr_dtor (&local___static_value__);
15653 phc_declare_property(ce_reg, "mProperties", 11, default_value, ZEND_ACC_PUBLIC TSRMLS_CC);}{
15654 zval* default_value;
15656 zval* local___static_value__ = NULL;
15657 // $__static_value__ = '';
15659 if (local___static_value__ == NULL)
15661 local___static_value__ = EG (uninitialized_zval_ptr);
15662 local___static_value__->refcount++;
15664 zval** p_lhs = &local___static_value__;
15666 zval* value;
15667 if ((*p_lhs)->is_ref)
15669 // Always overwrite the current value
15670 value = *p_lhs;
15671 zval_dtor (value);
15673 else
15675 ALLOC_INIT_ZVAL (value);
15676 zval_ptr_dtor (p_lhs);
15677 *p_lhs = value;
15680 ZVAL_STRINGL(value, "", 0, 1);
15682 phc_check_invariants (TSRMLS_C);
15684 default_value = local___static_value__;
15685 assert(!default_value->is_ref);
15686 default_value->refcount++;
15687 if (local___static_value__ != NULL)
15689 zval_ptr_dtor (&local___static_value__);
15692 phc_declare_property(ce_reg, "mIndexPolicy", 12, default_value, ZEND_ACC_PRIVATE TSRMLS_CC);}{
15693 zval* default_value;
15695 zval* local___static_value__ = NULL;
15696 // $__static_value__ = False;
15698 if (local___static_value__ == NULL)
15700 local___static_value__ = EG (uninitialized_zval_ptr);
15701 local___static_value__->refcount++;
15703 zval** p_lhs = &local___static_value__;
15705 zval* value;
15706 if ((*p_lhs)->is_ref)
15708 // Always overwrite the current value
15709 value = *p_lhs;
15710 zval_dtor (value);
15712 else
15714 ALLOC_INIT_ZVAL (value);
15715 zval_ptr_dtor (p_lhs);
15716 *p_lhs = value;
15719 ZVAL_BOOL (value, 0);
15721 phc_check_invariants (TSRMLS_C);
15723 default_value = local___static_value__;
15724 assert(!default_value->is_ref);
15725 default_value->refcount++;
15726 if (local___static_value__ != NULL)
15728 zval_ptr_dtor (&local___static_value__);
15731 phc_declare_property(ce_reg, "displayTitle", 12, default_value, ZEND_ACC_PRIVATE TSRMLS_CC);}}return SUCCESS;}// ArgInfo structures (necessary to support compile time pass-by-reference)
15732 ZEND_BEGIN_ARG_INFO_EX(app___MAIN___arg_info, 0, 0, 0)
15733 ZEND_END_ARG_INFO()
15735 static function_entry app_functions[] = {
15736 PHP_FE(__MAIN__, app___MAIN___arg_info)
15737 { NULL, NULL, NULL }
15739 // Register the module itself with PHP
15740 zend_module_entry app_module_entry = {
15741 STANDARD_MODULE_HEADER,
15742 "app",
15743 app_functions,
15744 PHP_MINIT(app), /* MINIT */
15745 NULL, /* MSHUTDOWN */
15746 NULL, /* RINIT */
15747 NULL, /* RSHUTDOWN */
15748 NULL, /* MINFO */
15749 "1.0",
15750 STANDARD_MODULE_PROPERTIES
15752 #include <sapi/embed/php_embed.h>
15753 #include <signal.h>
15755 void sighandler(int signum)
15757 switch(signum)
15759 case SIGABRT:
15760 printf("SIGABRT received!\n");
15761 break;
15762 case SIGSEGV:
15763 printf("SIGSEGV received!\n");
15764 break;
15765 default:
15766 printf("Unknown signal received!\n");
15767 break;
15770 printf("This could be a bug in phc. If you suspect it is, please email\n");
15771 printf("a bug report to phc-general@phpcompiler.org.\n");
15772 exit(-1);
15776 main (int argc, char* argv[])
15778 int phc_exit_status;
15779 signal(SIGABRT, sighandler);
15780 signal(SIGSEGV, sighandler);
15782 TSRMLS_D;
15783 int dealloc_pools = 1;
15784 php_embed_init (argc, argv PTSRMLS_CC);
15785 zend_first_try
15788 // initialize the phc runtime
15789 init_runtime();
15791 // load the compiled extension
15792 zend_startup_module (&app_module_entry);
15794 zval main_name;
15795 ZVAL_STRING (&main_name, "__MAIN__", NULL);
15797 zval retval;
15799 // Use standard errors, on stdout
15800 zend_alter_ini_entry ("report_zend_debug", sizeof("report_zend_debug"), "0", sizeof("0") - 1, PHP_INI_ALL, PHP_INI_STAGE_RUNTIME);
15801 zend_alter_ini_entry ("display_startup_errors", sizeof("display_startup_errors"), "1", sizeof("1") - 1, PHP_INI_ALL, PHP_INI_STAGE_RUNTIME);
15803 // initialize all the constants
15804 saved_refcount = 0;
15806 // call __MAIN__
15807 int success = call_user_function(
15808 EG (function_table),
15809 NULL,
15810 &main_name,
15811 &retval,
15813 NULL
15814 TSRMLS_CC);
15816 assert (success == SUCCESS);
15818 // finalize the runtime
15819 finalize_runtime();
15822 zend_catch
15824 dealloc_pools = 0;
15826 zend_end_try ();
15827 if (dealloc_pools)
15830 phc_exit_status = EG(exit_status);
15831 php_embed_shutdown (TSRMLS_C);
15833 return phc_exit_status;