CVS update: php31/main
| From: | zeev | Date: | Fri, 11 Sep 1998 00:22:54 +0000 |
| Subject: | CVS update: php31/main | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-963@lists.php.net to get a copy of this message | ||
Date: Thursday September 10, 1998 @ 20:22
Author: zeev
Update of /repository/php31/main
In directory asf:/u2/tmp/cvs-serv334/main
Modified Files:
constants.c control_structures_inline.h ini-parser.y
internal_functions.c language-parser.y language-scanner.l
main.c operators.c operators.h php.h post.c token_cache.c
variables.c variables.h
Log Message:
pval naming patch
Index: php31/main/constants.c
diff -c php31/main/constants.c:2.2 php31/main/constants.c:2.3
*** php31/main/constants.c:2.2 Thu Aug 13 19:51:11 1998
--- php31/main/constants.c Thu Sep 10 20:22:50 1998
***************
*** 48,54 ****
{
TLS_VARS;
if (!(c->flags & CONST_PERSISTENT)) {
! yystype_destructor(&c->value _INLINE_TLS);
}
free(c->name);
}
--- 48,54 ----
{
TLS_VARS;
if (!(c->flags & CONST_PERSISTENT)) {
! pval_destructor(&c->value _INLINE_TLS);
}
free(c->name);
}
***************
*** 198,204 ****
} else {
retval=1;
*result = c->value;
! yystype_copy_constructor(result);
}
} else {
retval=0;
--- 198,204 ----
} else {
retval=1;
*result = c->value;
! pval_copy_constructor(result);
}
} else {
retval=0;
***************
*** 265,271 ****
convert_to_string(var);
c.value = *val;
! yystype_copy_constructor(&c.value);
c.flags = case_sensitive | ~CONST_PERSISTENT; /* non persistent */
c.name = php3_strndup(var->value.str.val, var->value.str.len);
c.name_len = var->value.str.len+1;
--- 265,271 ----
convert_to_string(var);
c.value = *val;
! pval_copy_constructor(&c.value);
c.flags = case_sensitive | ~CONST_PERSISTENT; /* non persistent */
c.name = php3_strndup(var->value.str.val, var->value.str.len);
c.name_len = var->value.str.len+1;
Index: php31/main/control_structures_inline.h
diff -c php31/main/control_structures_inline.h:2.9 php31/main/control_structures_inline.h:2.10
*** php31/main/control_structures_inline.h:2.9 Tue Aug 25 14:56:40 1998
--- php31/main/control_structures_inline.h Thu Sep 10 20:22:50 1998
***************
*** 29,35 ****
*/
! /* $Id: control_structures_inline.h,v 2.9 1998/08/25 18:56:40 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 29,35 ----
*/
! /* $Id: control_structures_inline.h,v 2.10 1998/09/11 00:22:50 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 115,121 ****
return FAILURE;
}
if ((varname->type != IS_STRING)) {
! yystype_destructor(varname _INLINE_TLS);
php3_error(E_WARNING, "Incorrect variable type or name in global in function %s()",
GLOBAL(function_state).function_name);
return FAILURE;
}
--- 115,121 ----
return FAILURE;
}
if ((varname->type != IS_STRING)) {
! pval_destructor(varname _INLINE_TLS);
php3_error(E_WARNING, "Incorrect variable type or name in global in function %s()",
GLOBAL(function_state).function_name);
return FAILURE;
}
***************
*** 156,181 ****
php3_error(E_WARNING, "STATIC variable decleration meaningless in main() scope");
STR_FREE(varname->value.str.val);
if (value) {
! yystype_destructor(value _INLINE_TLS);
}
return FAILURE;
}
if ((varname->type != IS_STRING)) {
! yystype_destructor(varname _INLINE_TLS);
! yystype_destructor(value _INLINE_TLS);
php3_error(E_WARNING, "Incorrect variable type or name in static in function %s()",
GLOBAL(function_state).function_name);
return FAILURE;
}
if (_php3_hash_find(GLOBAL(function_state).hosting_function_table,
GLOBAL(function_state).function_name, strlen(GLOBAL(function_state).function_name)+1, (void **)
&func_ent) == FAILURE) {
STR_FREE(varname->value.str.val);
if (value) {
! yystype_destructor(value _INLINE_TLS);
}
return FAILURE;
}
if (!func_ent->value.func.addr.statics) {
func_ent->value.func.addr.statics = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(func_ent->value.func.addr.statics, 0, NULL, pval_DESTRUCTOR, 0);
}
if (_php3_hash_find(func_ent->value.func.addr.statics, varname->value.str.val,
varname->value.str.len+1, (void **) &variable_entry) == FAILURE) {
if (value) {
--- 156,181 ----
php3_error(E_WARNING, "STATIC variable decleration meaningless in main() scope");
STR_FREE(varname->value.str.val);
if (value) {
! pval_destructor(value _INLINE_TLS);
}
return FAILURE;
}
if ((varname->type != IS_STRING)) {
! pval_destructor(varname _INLINE_TLS);
! pval_destructor(value _INLINE_TLS);
php3_error(E_WARNING, "Incorrect variable type or name in static in function %s()",
GLOBAL(function_state).function_name);
return FAILURE;
}
if (_php3_hash_find(GLOBAL(function_state).hosting_function_table,
GLOBAL(function_state).function_name, strlen(GLOBAL(function_state).function_name)+1, (void **)
&func_ent) == FAILURE) {
STR_FREE(varname->value.str.val);
if (value) {
! pval_destructor(value _INLINE_TLS);
}
return FAILURE;
}
if (!func_ent->value.func.addr.statics) {
func_ent->value.func.addr.statics = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(func_ent->value.func.addr.statics, 0, NULL, PVAL_DESTRUCTOR, 0);
}
if (_php3_hash_find(func_ent->value.func.addr.statics, varname->value.str.val,
varname->value.str.len+1, (void **) &variable_entry) == FAILURE) {
if (value) {
***************
*** 189,195 ****
php3_error(E_ERROR, "Inserted static variable got lost");
STR_FREE(varname->value.str.val);
if (value) {
! yystype_destructor(value);
}
return FAILURE;
}
--- 189,195 ----
php3_error(E_ERROR, "Inserted static variable got lost");
STR_FREE(varname->value.str.val);
if (value) {
! pval_destructor(value);
}
return FAILURE;
}
***************
*** 199,205 ****
php3_error(E_ERROR, "Unable to initialize static variable");
STR_FREE(varname->value.str.val);
if (value) {
! yystype_destructor(value _INLINE_TLS);
}
return FAILURE;
} else {
--- 199,205 ----
php3_error(E_ERROR, "Unable to initialize static variable");
STR_FREE(varname->value.str.val);
if (value) {
! pval_destructor(value _INLINE_TLS);
}
return FAILURE;
} else {
***************
*** 217,230 ****
if (GLOBAL(Execute)) {
tc_set_token(&GLOBAL(token_cache_manager), while_token->offset, WHILE);
! if (yystype_true(expr)) {
GLOBAL(ExecuteFlag) = EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
} else {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
! yystype_destructor(expr _INLINE_TLS);
}
}
--- 217,230 ----
if (GLOBAL(Execute)) {
tc_set_token(&GLOBAL(token_cache_manager), while_token->offset, WHILE);
! if (pval_is_true(expr)) {
GLOBAL(ExecuteFlag) = EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
} else {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
! pval_destructor(expr _INLINE_TLS);
}
}
***************
*** 283,295 ****
fprintf(stderr, "end of while, execute=%d, changecount=%d, changetype=%d\n", Execute,
GLOBAL(function_state).loop_change_level, GLOBAL(function_state).loop_change_level);
#endif
! if (GLOBAL(Execute) && yystype_true(expr)) {
! yystype_destructor(expr _INLINE_TLS);
tc_set_token(&GLOBAL(token_cache_manager), do_token->offset, CONTINUED_DOWHILE);
seek_token(&GLOBAL(token_cache_manager), do_token->offset);
} else {
if (GLOBAL(Execute)) {
! yystype_destructor(expr _INLINE_TLS);
}
if ((GLOBAL(function_state).loop_change_type != DO_NOTHING) &&
(GLOBAL(function_state).loop_change_level == GLOBAL(function_state).loop_nest_level)) {
GLOBAL(function_state).loop_change_type = DO_NOTHING;
--- 283,295 ----
fprintf(stderr, "end of while, execute=%d, changecount=%d, changetype=%d\n", Execute,
GLOBAL(function_state).loop_change_level, GLOBAL(function_state).loop_change_level);
#endif
! if (GLOBAL(Execute) && pval_is_true(expr)) {
! pval_destructor(expr _INLINE_TLS);
tc_set_token(&GLOBAL(token_cache_manager), do_token->offset, CONTINUED_DOWHILE);
seek_token(&GLOBAL(token_cache_manager), do_token->offset);
} else {
if (GLOBAL(Execute)) {
! pval_destructor(expr _INLINE_TLS);
}
if ((GLOBAL(function_state).loop_change_type != DO_NOTHING) &&
(GLOBAL(function_state).loop_change_level == GLOBAL(function_state).loop_nest_level)) {
GLOBAL(function_state).loop_change_type = DO_NOTHING;
***************
*** 308,321 ****
stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int)); /* push current state to
stack */
if (GLOBAL(Execute)) { /* we're in a code block that needs to be evaluated */
! if (yystype_true(expr)) { /* the IF expression is yystype_true, execute IF code */
GLOBAL(ExecuteFlag) = EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
} else { /* the IF expression is false, don't execute IF code */
GLOBAL(ExecuteFlag) = BEFORE_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
! yystype_destructor(expr _INLINE_TLS);
} else {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
}
--- 308,321 ----
stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int)); /* push current state to
stack */
if (GLOBAL(Execute)) { /* we're in a code block that needs to be evaluated */
! if (pval_is_true(expr)) { /* the IF expression is pval_is_true, execute IF code */
GLOBAL(ExecuteFlag) = EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
} else { /* the IF expression is false, don't execute IF code */
GLOBAL(ExecuteFlag) = BEFORE_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
! pval_destructor(expr _INLINE_TLS);
} else {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
}
***************
*** 344,363 ****
php3_error(E_ERROR, "Cannot %s from %d loop(s) from nesting level %d",
(op_type == DO_BREAK ? "break" : "continue"), (expr ?
expr->value.lval : 1), GLOBAL(function_state).loop_nest_level);
if (expr) {
! yystype_destructor(expr _INLINE_TLS);
}
return FAILURE;
} else if (GLOBAL(function_state).loop_change_level > GLOBAL(function_state).loop_nest_level)
{
php3_error(E_ERROR, "Cannot continue from %d loops", (expr ? expr->value.lval :
-1));
if (expr) {
! yystype_destructor(expr _INLINE_TLS);
}
return FAILURE;
}
GLOBAL(function_state).loop_change_type = op_type;
GLOBAL(Execute) = 0;
if (expr) {
! yystype_destructor(expr _INLINE_TLS);
}
}
return SUCCESS;
--- 344,363 ----
php3_error(E_ERROR, "Cannot %s from %d loop(s) from nesting level %d",
(op_type == DO_BREAK ? "break" : "continue"), (expr ?
expr->value.lval : 1), GLOBAL(function_state).loop_nest_level);
if (expr) {
! pval_destructor(expr _INLINE_TLS);
}
return FAILURE;
} else if (GLOBAL(function_state).loop_change_level > GLOBAL(function_state).loop_nest_level)
{
php3_error(E_ERROR, "Cannot continue from %d loops", (expr ? expr->value.lval :
-1));
if (expr) {
! pval_destructor(expr _INLINE_TLS);
}
return FAILURE;
}
GLOBAL(function_state).loop_change_type = op_type;
GLOBAL(Execute) = 0;
if (expr) {
! pval_destructor(expr _INLINE_TLS);
}
}
return SUCCESS;
***************
*** 396,406 ****
GLOBAL(Execute) = SHOULD_EXECUTE;
}
if (GLOBAL(ExecuteFlag) == BEFORE_EXECUTE) {
! if (yystype_true(expr)) {
GLOBAL(ExecuteFlag) = EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
! yystype_destructor(expr _INLINE_TLS);
}
}
--- 396,406 ----
GLOBAL(Execute) = SHOULD_EXECUTE;
}
if (GLOBAL(ExecuteFlag) == BEFORE_EXECUTE) {
! if (pval_is_true(expr)) {
GLOBAL(ExecuteFlag) = EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
! pval_destructor(expr _INLINE_TLS);
}
}
***************
*** 433,448 ****
_php3_hash_update(GLOBAL(active_symbol_table), varname->value.str.val,
varname->value.str.len+1, &tmp, sizeof(pval), NULL);
} else if (!_php3_hash_index_is_pointer(GLOBAL(active_symbol_table), GLOBAL(param_index))) { /*
passed by value */
tmp = *data;
! yystype_copy_constructor(&tmp);
_php3_hash_update(GLOBAL(active_symbol_table), varname->value.str.val,
varname->value.str.len+1, &tmp, sizeof(pval), NULL);
if (default_value) {
! yystype_destructor(default_value _INLINE_TLS);
}
} else { /* passed by reference */
_php3_hash_pointer_update(GLOBAL(active_symbol_table), varname->value.str.val,
varname->value.str.len+1, data);
_php3_hash_index_del(GLOBAL(active_symbol_table), GLOBAL(param_index));
if (default_value) {
! yystype_destructor(default_value _INLINE_TLS);
}
}
} else {
--- 433,448 ----
_php3_hash_update(GLOBAL(active_symbol_table), varname->value.str.val,
varname->value.str.len+1, &tmp, sizeof(pval), NULL);
} else if (!_php3_hash_index_is_pointer(GLOBAL(active_symbol_table), GLOBAL(param_index))) { /*
passed by value */
tmp = *data;
! pval_copy_constructor(&tmp);
_php3_hash_update(GLOBAL(active_symbol_table), varname->value.str.val,
varname->value.str.len+1, &tmp, sizeof(pval), NULL);
if (default_value) {
! pval_destructor(default_value _INLINE_TLS);
}
} else { /* passed by reference */
_php3_hash_pointer_update(GLOBAL(active_symbol_table), varname->value.str.val,
varname->value.str.len+1, data);
_php3_hash_index_del(GLOBAL(active_symbol_table), GLOBAL(param_index));
if (default_value) {
! pval_destructor(default_value _INLINE_TLS);
}
}
} else {
***************
*** 486,492 ****
if (_php3_hash_next_index_insert(GLOBAL(function_state).function_symbol_table, expr,
sizeof(pval),NULL) == FAILURE) {
php3_error(E_WARNING, "Error updating symbol table");
! yystype_destructor(expr _INLINE_TLS);
GLOBAL(function_state).function_type = 0; /* don't execute the function call */
}
}
--- 486,492 ----
if (_php3_hash_next_index_insert(GLOBAL(function_state).function_symbol_table, expr,
sizeof(pval),NULL) == FAILURE) {
php3_error(E_WARNING, "Error updating symbol table");
! pval_destructor(expr _INLINE_TLS);
GLOBAL(function_state).function_type = 0; /* don't execute the function call */
}
}
***************
*** 586,608 ****
var_reset(expr3);
}
if (GLOBAL(Execute) && for_token->cs_data.switched) {
! if (yystype_true(expr3)) {
GLOBAL(ExecuteFlag) = EXECUTE;
} else {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
}
GLOBAL(Execute) = SHOULD_EXECUTE;
! yystype_destructor(expr2 _INLINE_TLS);
! yystype_destructor(expr3 _INLINE_TLS);
} else if (GLOBAL(Execute) && !for_token->cs_data.switched) {
! if (yystype_true(expr2)) {
GLOBAL(ExecuteFlag) = EXECUTE;
} else {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
}
GLOBAL(Execute) = SHOULD_EXECUTE;
! yystype_destructor(expr2 _INLINE_TLS);
! yystype_destructor(expr3 _INLINE_TLS);
}
}
--- 586,608 ----
var_reset(expr3);
}
if (GLOBAL(Execute) && for_token->cs_data.switched) {
! if (pval_is_true(expr3)) {
GLOBAL(ExecuteFlag) = EXECUTE;
} else {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
}
GLOBAL(Execute) = SHOULD_EXECUTE;
! pval_destructor(expr2 _INLINE_TLS);
! pval_destructor(expr3 _INLINE_TLS);
} else if (GLOBAL(Execute) && !for_token->cs_data.switched) {
! if (pval_is_true(expr2)) {
GLOBAL(ExecuteFlag) = EXECUTE;
} else {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
}
GLOBAL(Execute) = SHOULD_EXECUTE;
! pval_destructor(expr2 _INLINE_TLS);
! pval_destructor(expr3 _INLINE_TLS);
}
}
***************
*** 670,676 ****
}
if (expr) {
print_variable(expr _INLINE_TLS);
! yystype_destructor(expr _INLINE_TLS);
}
}
}
--- 670,676 ----
}
if (expr) {
print_variable(expr _INLINE_TLS);
! pval_destructor(expr _INLINE_TLS);
}
}
}
***************
*** 708,714 ****
include_file(expr,0);
}
tc_set_included(&GLOBAL(token_cache_manager), include_token->offset);
! yystype_destructor(expr _INLINE_TLS);
}
}
--- 708,714 ----
include_file(expr,0);
}
tc_set_included(&GLOBAL(token_cache_manager), include_token->offset);
! pval_destructor(expr _INLINE_TLS);
}
}
***************
*** 730,743 ****
if (include_file(expr,1)==SUCCESS) {
start_display_source(0 _INLINE_TLS);
}
! yystype_destructor(expr _INLINE_TLS);
}
inline void cs_pre_boolean_or(pval *left_expr INLINE_TLS)
{
stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int));
! if (GLOBAL(Execute) && yystype_true(left_expr)) {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;;
}
--- 730,743 ----
if (include_file(expr,1)==SUCCESS) {
start_display_source(0 _INLINE_TLS);
}
! pval_destructor(expr _INLINE_TLS);
}
inline void cs_pre_boolean_or(pval *left_expr INLINE_TLS)
{
stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int));
! if (GLOBAL(Execute) && pval_is_true(left_expr)) {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;;
}
***************
*** 758,764 ****
inline void cs_pre_boolean_and(pval *left_expr INLINE_TLS)
{
stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int));
! if (GLOBAL(Execute) && !yystype_true(left_expr)) {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
--- 758,764 ----
inline void cs_pre_boolean_and(pval *left_expr INLINE_TLS)
{
stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int));
! if (GLOBAL(Execute) && !pval_is_true(left_expr)) {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
***************
*** 779,785 ****
inline void cs_questionmark_op_pre_expr1(pval *truth_value INLINE_TLS)
{
stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int));
! if (GLOBAL(Execute) && !yystype_true(truth_value)) {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
--- 779,785 ----
inline void cs_questionmark_op_pre_expr1(pval *truth_value INLINE_TLS)
{
stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int));
! if (GLOBAL(Execute) && !pval_is_true(truth_value)) {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
***************
*** 790,796 ****
{
GLOBAL(ExecuteFlag) = stack_int_top(&GLOBAL(css));
GLOBAL(Execute) = SHOULD_EXECUTE;
! if (GLOBAL(Execute) && yystype_true(truth_value)) {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
--- 790,796 ----
{
GLOBAL(ExecuteFlag) = stack_int_top(&GLOBAL(css));
GLOBAL(Execute) = SHOULD_EXECUTE;
! if (GLOBAL(Execute) && pval_is_true(truth_value)) {
GLOBAL(ExecuteFlag) = DONT_EXECUTE;
GLOBAL(Execute) = SHOULD_EXECUTE;
}
***************
*** 803,814 ****
stack_del_top(&GLOBAL(css));
GLOBAL(Execute) = SHOULD_EXECUTE;
if (GLOBAL(Execute)) {
! if (yystype_true(truth_value)) {
*result = *expr1;
} else {
*result = *expr2;
}
! yystype_destructor(truth_value _INLINE_TLS);
}
}
--- 803,814 ----
stack_del_top(&GLOBAL(css));
GLOBAL(Execute) = SHOULD_EXECUTE;
if (GLOBAL(Execute)) {
! if (pval_is_true(truth_value)) {
*result = *expr1;
} else {
*result = *expr2;
}
! pval_destructor(truth_value _INLINE_TLS);
}
}
***************
*** 824,834 ****
pval *data;
if (class_ptr) { /* use member function rather than global function */
! object = (pval *) class_ptr->value.varptr.yystype;
if (!object) {
if (free_function_name) {
! yystype_destructor(function_name _INLINE_TLS);
}
php3_error(E_ERROR, "Member function used on a non-object");
return;
--- 824,834 ----
pval *data;
if (class_ptr) { /* use member function rather than global function */
! object = (pval *) class_ptr->value.varptr.pvalue;
if (!object) {
if (free_function_name) {
! pval_destructor(function_name _INLINE_TLS);
}
php3_error(E_ERROR, "Member function used on a non-object");
return;
***************
*** 838,844 ****
if (function_name->type != IS_STRING) {
php3_error(E_ERROR, "Function names must be strings");
if (free_function_name) {
! yystype_destructor(function_name _INLINE_TLS);
}
return;
}
--- 838,844 ----
if (function_name->type != IS_STRING) {
php3_error(E_ERROR, "Function names must be strings");
if (free_function_name) {
! pval_destructor(function_name _INLINE_TLS);
}
return;
}
***************
*** 866,872 ****
function_name->cs_data.function_call_type=0;
return;
}
! if (_php3_hash_init(GLOBAL(function_state).function_symbol_table, 0, NULL, pval_DESTRUCTOR, 0)
== FAILURE) {
php3_error(E_ERROR, "Unable to initialize new symbol table in function call");
function_name->cs_data.function_call_type=0;
return;
--- 866,872 ----
function_name->cs_data.function_call_type=0;
return;
}
! if (_php3_hash_init(GLOBAL(function_state).function_symbol_table, 0, NULL, PVAL_DESTRUCTOR, 0)
== FAILURE) {
php3_error(E_ERROR, "Unable to initialize new symbol table in function call");
function_name->cs_data.function_call_type=0;
return;
***************
*** 941,947 ****
efree(GLOBAL(function_state).object_pointer);
}
if (free_function_name) {
! yystype_destructor(function_name _INLINE_TLS);
}
while (stack_int_top(&GLOBAL(for_stack)) != -1) { /* pop FOR stack */
--- 941,947 ----
efree(GLOBAL(function_state).object_pointer);
}
if (free_function_name) {
! pval_destructor(function_name _INLINE_TLS);
}
while (stack_int_top(&GLOBAL(for_stack)) != -1) { /* pop FOR stack */
***************
*** 995,1003 ****
/* if case_expr is NULL, we're in the special 'default' case */
if (case_expr) {
expr = se->expr;
! yystype_copy_constructor(&expr);
is_equal_function(&result, &expr, case_expr _INLINE_TLS);
! is_equal = yystype_true(&result);
}
if (!case_expr || is_equal) {
se->offset=-1;
--- 995,1003 ----
/* if case_expr is NULL, we're in the special 'default' case */
if (case_expr) {
expr = se->expr;
! pval_copy_constructor(&expr);
is_equal_function(&result, &expr, case_expr _INLINE_TLS);
! is_equal = pval_is_true(&result);
}
if (!case_expr || is_equal) {
se->offset=-1;
***************
*** 1009,1015 ****
}
} else {
if (case_expr) {
! yystype_destructor(case_expr _INLINE_TLS);
}
}
}
--- 1009,1015 ----
}
} else {
if (case_expr) {
! pval_destructor(case_expr _INLINE_TLS);
}
}
}
***************
*** 1037,1043 ****
stack_top(&GLOBAL(switch_stack), (void **) &se);
if (se->Execute) {
! yystype_destructor(expr _INLINE_TLS);
}
stack_del_top(&GLOBAL(switch_stack));
GLOBAL(function_state).loop_nest_level--;
--- 1037,1043 ----
stack_top(&GLOBAL(switch_stack), (void **) &se);
if (se->Execute) {
! pval_destructor(expr _INLINE_TLS);
}
stack_del_top(&GLOBAL(switch_stack));
GLOBAL(function_state).loop_nest_level--;
***************
*** 1058,1068 ****
return;
}
new_class = *parent_ptr;
! yystype_copy_constructor(&new_class);
} else {
new_class.type = IS_CLASS;
new_class.value.ht = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(new_class.value.ht, 0, NULL, pval_DESTRUCTOR, 0);
}
if (_php3_hash_update(&GLOBAL(function_table), classname->value.str.val,
classname->value.str.len+1, &new_class, sizeof(pval),NULL) == FAILURE) {
php3_error(E_ERROR, "Unable to initialize new class");
--- 1058,1068 ----
return;
}
new_class = *parent_ptr;
! pval_copy_constructor(&new_class);
} else {
new_class.type = IS_CLASS;
new_class.value.ht = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(new_class.value.ht, 0, NULL, PVAL_DESTRUCTOR, 0);
}
if (_php3_hash_update(&GLOBAL(function_table), classname->value.str.val,
classname->value.str.len+1, &new_class, sizeof(pval),NULL) == FAILURE) {
php3_error(E_ERROR, "Unable to initialize new class");
***************
*** 1092,1102 ****
GLOBAL(array_ptr) = NULL;
} else {
if (class_ptr) {
! pval *object=(pval *) class_ptr->value.varptr.yystype;
if (!object) {
GLOBAL(array_ptr)=NULL;
! yystype_destructor(array_name _INLINE_TLS);
return;
}
target_symbol_table = object->value.ht;
--- 1092,1102 ----
GLOBAL(array_ptr) = NULL;
} else {
if (class_ptr) {
! pval *object=(pval *) class_ptr->value.varptr.pvalue;
if (!object) {
GLOBAL(array_ptr)=NULL;
! pval_destructor(array_name _INLINE_TLS);
return;
}
target_symbol_table = object->value.ht;
***************
*** 1122,1135 ****
GLOBAL(array_ptr) = NULL;
}
}
! yystype_destructor(array_name _INLINE_TLS);
}
}
inline void start_dimensions_parsing(pval *result INLINE_TLS)
{
if (GLOBAL(Execute)) {
! result->value.varptr.yystype = GLOBAL(array_ptr);
if (GLOBAL(array_ptr)) {
result->cs_data.array_write=GLOBAL(array_ptr)->cs_data.array_write;
}
--- 1122,1135 ----
GLOBAL(array_ptr) = NULL;
}
}
! pval_destructor(array_name _INLINE_TLS);
}
}
inline void start_dimensions_parsing(pval *result INLINE_TLS)
{
if (GLOBAL(Execute)) {
! result->value.varptr.pvalue = GLOBAL(array_ptr);
if (GLOBAL(array_ptr)) {
result->cs_data.array_write=GLOBAL(array_ptr)->cs_data.array_write;
}
***************
*** 1144,1171 ****
result->cs_data.array_write = dimension->cs_data.array_write;
! if (dimension->value.varptr.yystype) {
! pval *localdata,tmp,*arr_ptr=dimension->value.varptr.yystype;
int new_array=0; /* whether we created the array just now */
if (arr_ptr->type==IS_STRING && arr_ptr->value.str.val!=empty_string &&
arr_ptr->value.str.val!=undefined_variable_string) {
if (dimension->value.varptr.string_offset == -1) { /* ok */
if (!expr) {
php3_error(E_WARNING,"No string index specified");
! result->value.varptr.yystype=NULL;
return;
}
convert_to_long(expr);
if (expr->value.lval<0 || expr->value.lval>=arr_ptr->value.str.len) {
php3_error(E_WARNING,"Illegal string index");
! result->value.varptr.yystype=NULL;
return;
}
result->value.varptr.string_offset = expr->value.lval;
return;
} else {
php3_error(E_WARNING,"Cannot index a string index");
! result->value.varptr.yystype=NULL;
return;
}
}
--- 1144,1171 ----
result->cs_data.array_write = dimension->cs_data.array_write;
! if (dimension->value.varptr.pvalue) {
! pval *localdata,tmp,*arr_ptr=dimension->value.varptr.pvalue;
int new_array=0; /* whether we created the array just now */
if (arr_ptr->type==IS_STRING && arr_ptr->value.str.val!=empty_string &&
arr_ptr->value.str.val!=undefined_variable_string) {
if (dimension->value.varptr.string_offset == -1) { /* ok */
if (!expr) {
php3_error(E_WARNING,"No string index specified");
! result->value.varptr.pvalue=NULL;
return;
}
convert_to_long(expr);
if (expr->value.lval<0 || expr->value.lval>=arr_ptr->value.str.len) {
php3_error(E_WARNING,"Illegal string index");
! result->value.varptr.pvalue=NULL;
return;
}
result->value.varptr.string_offset = expr->value.lval;
return;
} else {
php3_error(E_WARNING,"Cannot index a string index");
! result->value.varptr.pvalue=NULL;
return;
}
}
***************
*** 1175,1182 ****
new_array=1;
} else if (arr_ptr->type!=IS_ARRAY) {
php3_error(E_WARNING,"Index referencing a non-array");
! result->value.varptr.yystype=NULL;
! yystype_destructor(expr _INLINE_TLS);
return;
}
if (expr) {
--- 1175,1182 ----
new_array=1;
} else if (arr_ptr->type!=IS_ARRAY) {
php3_error(E_WARNING,"Index referencing a non-array");
! result->value.varptr.pvalue=NULL;
! pval_destructor(expr _INLINE_TLS);
return;
}
if (expr) {
***************
*** 1187,1193 ****
if (new_array || _php3_hash_index_find(arr_ptr->value.ht, expr->value.lval, (void **)
&localdata) == FAILURE) {
tmp.type = IS_NULL;
_php3_hash_index_update(arr_ptr->value.ht, expr->value.lval, (void *)&tmp,
sizeof(pval),(void **) &localdata);
! result->value.varptr.yystype = localdata;
result->cs_data.array_write = 1;
if (!original_array_write) { /* we raised the write flag just now, record this variable */
variable_tracker vt;
--- 1187,1193 ----
if (new_array || _php3_hash_index_find(arr_ptr->value.ht, expr->value.lval, (void **)
&localdata) == FAILURE) {
tmp.type = IS_NULL;
_php3_hash_index_update(arr_ptr->value.ht, expr->value.lval, (void *)&tmp,
sizeof(pval),(void **) &localdata);
! result->value.varptr.pvalue = localdata;
result->cs_data.array_write = 1;
if (!original_array_write) { /* we raised the write flag just now, record this variable */
variable_tracker vt;
***************
*** 1198,1215 ****
stack_push(&GLOBAL(variable_unassign_stack),(void *) &vt,
sizeof(variable_tracker));
}
} else {
! result->value.varptr.yystype = localdata;
}
break;
case IS_STRING:
if (new_array || _php3_hash_find(arr_ptr->value.ht, expr->value.str.val,
expr->value.str.len+1, (void **) &localdata)==FAILURE) {
tmp.type = IS_NULL;
if (_php3_hash_update(arr_ptr->value.ht, expr->value.str.val,
expr->value.str.len+1, (void *) &tmp, sizeof(pval),(void **) &localdata)==FAILURE) {
! result->value.varptr.yystype=NULL;
STR_FREE(expr->value.str.val);
return;
}
! result->value.varptr.yystype = localdata;
result->cs_data.array_write = 1;
if (!original_array_write) { /* we raised the write flag just now, record this variable */
variable_tracker vt;
--- 1198,1215 ----
stack_push(&GLOBAL(variable_unassign_stack),(void *) &vt,
sizeof(variable_tracker));
}
} else {
! result->value.varptr.pvalue = localdata;
}
break;
case IS_STRING:
if (new_array || _php3_hash_find(arr_ptr->value.ht, expr->value.str.val,
expr->value.str.len+1, (void **) &localdata)==FAILURE) {
tmp.type = IS_NULL;
if (_php3_hash_update(arr_ptr->value.ht, expr->value.str.val,
expr->value.str.len+1, (void *) &tmp, sizeof(pval),(void **) &localdata)==FAILURE) {
! result->value.varptr.pvalue=NULL;
STR_FREE(expr->value.str.val);
return;
}
! result->value.varptr.pvalue = localdata;
result->cs_data.array_write = 1;
if (!original_array_write) { /* we raised the write flag just now, record this variable */
variable_tracker vt;
***************
*** 1221,1231 ****
stack_push(&GLOBAL(variable_unassign_stack),(void *) &vt,
sizeof(variable_tracker));
}
} else {
! result->value.varptr.yystype = localdata;
}
break;
default:
! result->value.varptr.yystype = NULL;
php3_error(E_WARNING, "Illegal index type");
break;
}
--- 1221,1231 ----
stack_push(&GLOBAL(variable_unassign_stack),(void *) &vt,
sizeof(variable_tracker));
}
} else {
! result->value.varptr.pvalue = localdata;
}
break;
default:
! result->value.varptr.pvalue = NULL;
php3_error(E_WARNING, "Illegal index type");
break;
}
***************
*** 1234,1240 ****
tmp.type = IS_NULL;
_php3_hash_next_index_insert(arr_ptr->value.ht, (void *) &tmp, sizeof(pval), (void **)
&localdata);
! result->value.varptr.yystype = localdata;
result->cs_data.array_write=1;
if (!original_array_write) { /* we raised the write flag just now, record this variable */
variable_tracker vt;
--- 1234,1240 ----
tmp.type = IS_NULL;
_php3_hash_next_index_insert(arr_ptr->value.ht, (void *) &tmp, sizeof(pval), (void **)
&localdata);
! result->value.varptr.pvalue = localdata;
result->cs_data.array_write=1;
if (!original_array_write) { /* we raised the write flag just now, record this variable */
variable_tracker vt;
***************
*** 1246,1255 ****
}
}
} else {
! result->value.varptr.yystype=NULL;
}
if (expr) {
! yystype_destructor(expr _INLINE_TLS);
}
}
}
--- 1246,1255 ----
}
}
} else {
! result->value.varptr.pvalue=NULL;
}
if (expr) {
! pval_destructor(expr _INLINE_TLS);
}
}
}
***************
*** 1258,1264 ****
inline void end_array_parsing(pval *result, pval *dimensions INLINE_TLS)
{
if (GLOBAL(Execute)) {
! pval *ptr=(pval *) dimensions->value.varptr.yystype;
*result = *dimensions;
if (ptr && ptr->type==IS_NULL) {
--- 1258,1264 ----
inline void end_array_parsing(pval *result, pval *dimensions INLINE_TLS)
{
if (GLOBAL(Execute)) {
! pval *ptr=(pval *) dimensions->value.varptr.pvalue;
*result = *dimensions;
if (ptr && ptr->type==IS_NULL) {
***************
*** 1294,1310 ****
inline void get_class_variable_pointer(pval *result, pval *class_ptr, pval *varname INLINE_TLS)
{
if (GLOBAL(Execute)) {
! pval *object = (pval *) class_ptr->value.varptr.yystype;
if (!object) {
! result->value.varptr.yystype = NULL;
! yystype_destructor(varname _INLINE_TLS);
return;
}
if ((varname->type != IS_STRING)) {
php3_error(E_WARNING,"Illegal property name");
! result->value.varptr.yystype = NULL;
! yystype_destructor(varname _INLINE_TLS);
return;
} else {
pval *data;
--- 1294,1310 ----
inline void get_class_variable_pointer(pval *result, pval *class_ptr, pval *varname INLINE_TLS)
{
if (GLOBAL(Execute)) {
! pval *object = (pval *) class_ptr->value.varptr.pvalue;
if (!object) {
! result->value.varptr.pvalue = NULL;
! pval_destructor(varname _INLINE_TLS);
return;
}
if ((varname->type != IS_STRING)) {
php3_error(E_WARNING,"Illegal property name");
! result->value.varptr.pvalue = NULL;
! pval_destructor(varname _INLINE_TLS);
return;
} else {
pval *data;
***************
*** 1325,1333 ****
} else {
result->cs_data.array_write = 0;
}
! result->value.varptr.yystype = data;
result->value.str.len = -1; /* Not indexed string */
! yystype_destructor(varname _INLINE_TLS);
}
}
}
--- 1325,1333 ----
} else {
result->cs_data.array_write = 0;
}
! result->value.varptr.pvalue = data;
result->value.str.len = -1; /* Not indexed string */
! pval_destructor(varname _INLINE_TLS);
}
}
}
***************
*** 1352,1358 ****
read_pointer_value(&tmp,var _INLINE_TLS);
if (_php3_hash_next_index_insert(GLOBAL(function_state).function_symbol_table, &tmp,
sizeof(pval),NULL) == FAILURE) {
php3_error(E_WARNING, "Error updating symbol table");
! yystype_destructor(&tmp _INLINE_TLS);
GLOBAL(function_state).function_type = 0; /* don't execute the function call */
return;
}
--- 1352,1358 ----
read_pointer_value(&tmp,var _INLINE_TLS);
if (_php3_hash_next_index_insert(GLOBAL(function_state).function_symbol_table, &tmp,
sizeof(pval),NULL) == FAILURE) {
php3_error(E_WARNING, "Error updating symbol table");
! pval_destructor(&tmp _INLINE_TLS);
GLOBAL(function_state).function_type = 0; /* don't execute the function call */
return;
}
***************
*** 1360,1370 ****
if (var->cs_data.array_write) {
clean_unassigned_variable_top(0 _INLINE_TLS);
}
! if (var->value.varptr.yystype==NULL) {
GLOBAL(function_state).function_type = 0;
return;
}
! if (_php3_hash_next_index_pointer_insert(GLOBAL(function_state).function_symbol_table, (void *)
var->value.varptr.yystype) == FAILURE) {
php3_error(E_WARNING, "Error updating symbol table");
GLOBAL(function_state).function_type = 0; /* don't execute the function call */
return;
--- 1360,1370 ----
if (var->cs_data.array_write) {
clean_unassigned_variable_top(0 _INLINE_TLS);
}
! if (var->value.varptr.pvalue==NULL) {
GLOBAL(function_state).function_type = 0;
return;
}
! if (_php3_hash_next_index_pointer_insert(GLOBAL(function_state).function_symbol_table, (void *)
var->value.varptr.pvalue) == FAILURE) {
php3_error(E_WARNING, "Error updating symbol table");
GLOBAL(function_state).function_type = 0; /* don't execute the function call */
return;
***************
*** 1382,1388 ****
if (GLOBAL(php3_ini)->safe_mode) {
php3_error(E_WARNING,"Cannot execute using backqutoes in safe mode");
! yystype_destructor(expr _INLINE_TLS);
var_reset(result);
return;
}
--- 1382,1388 ----
if (GLOBAL(php3_ini)->safe_mode) {
php3_error(E_WARNING,"Cannot execute using backqutoes in safe mode");
! pval_destructor(expr _INLINE_TLS);
var_reset(result);
return;
}
***************
*** 1459,1465 ****
get_regular_variable_contents(&index,var_index,0 _INLINE_TLS);
get_array_variable(&tmp,varname,&index _INLINE_TLS);
concat_function(result,encaps,&tmp,1 _INLINE_TLS);
! yystype_destructor(&index _INLINE_TLS);
}
}
--- 1459,1465 ----
get_regular_variable_contents(&index,var_index,0 _INLINE_TLS);
get_array_variable(&tmp,varname,&index _INLINE_TLS);
concat_function(result,encaps,&tmp,1 _INLINE_TLS);
! pval_destructor(&index _INLINE_TLS);
}
}
Index: php31/main/ini-parser.y
diff -c php31/main/ini-parser.y:2.1 php31/main/ini-parser.y:2.2
*** php31/main/ini-parser.y:2.1 Sun Sep 6 17:34:35 1998
--- php31/main/ini-parser.y Thu Sep 10 20:22:50 1998
***************
*** 30,36 ****
! /* $Id: ini-parser.y,v 2.1 1998/09/06 21:34:35 zeev Exp $ */
#define DEBUG_CFG_PARSER 1
#ifdef THREAD_SAFE
--- 30,36 ----
! /* $Id: ini-parser.y,v 2.2 1998/09/11 00:22:50 zeev Exp $ */
#define DEBUG_CFG_PARSER 1
#ifdef THREAD_SAFE
***************
*** 79,85 ****
return FAILURE;
}
var = *tmp;
! yystype_copy_constructor(&var);
convert_to_long(&var);
*result = var.value.lval;
return SUCCESS;
--- 79,85 ----
return FAILURE;
}
var = *tmp;
! pval_copy_constructor(&var);
convert_to_long(&var);
*result = var.value.lval;
return SUCCESS;
***************
*** 95,101 ****
return FAILURE;
}
var = *tmp;
! yystype_copy_constructor(&var);
convert_to_double(&var);
*result = var.value.dval;
return SUCCESS;
--- 95,101 ----
return FAILURE;
}
var = *tmp;
! pval_copy_constructor(&var);
convert_to_double(&var);
*result = var.value.dval;
return SUCCESS;
***************
*** 121,139 ****
}
! static void yystype_config_destructor(pval *yystype)
{
! if (yystype->type == IS_STRING && yystype->value.str.val != empty_string) {
! free(yystype->value.str.val);
}
}
! static void yystype_browscap_destructor(pval *yystype)
{
! if (yystype->type == IS_OBJECT || yystype->type == IS_ARRAY) {
! _php3_hash_destroy(yystype->value.ht);
! free(yystype->value.ht);
}
}
--- 121,139 ----
}
! static void pvalue_config_destructor(pval *pvalue)
{
! if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) {
! free(pvalue->value.str.val);
}
}
! static void pvalue_browscap_destructor(pval *pvalue)
{
! if (pvalue->type == IS_OBJECT || pvalue->type == IS_ARRAY) {
! _php3_hash_destroy(pvalue->value.ht);
! free(pvalue->value.ht);
}
}
***************
*** 142,148 ****
{
TLS_VARS;
! if (_php3_hash_init(&configuration_hash, 0, NULL, (void (*)(void
*))yystype_config_destructor, 1)==FAILURE) {
return FAILURE;
}
--- 142,148 ----
{
TLS_VARS;
! if (_php3_hash_init(&configuration_hash, 0, NULL, (void (*)(void *))pvalue_config_destructor,
1)==FAILURE) {
return FAILURE;
}
***************
*** 237,243 ****
TLS_VARS;
if (GLOBAL(php3_ini)->browscap) {
! if (_php3_hash_init(&GLOBAL(browser_hash), 0, NULL, (void (*)(void
*))yystype_browscap_destructor, 1)==FAILURE) {
return FAILURE;
}
--- 237,243 ----
TLS_VARS;
if (GLOBAL(php3_ini)->browscap) {
! if (_php3_hash_init(&GLOBAL(browser_hash), 0, NULL, (void (*)(void
*))pvalue_browscap_destructor, 1)==FAILURE) {
return FAILURE;
}
***************
*** 365,371 ****
/*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/
tmp.value.ht = (HashTable *) malloc(sizeof(HashTable));
! _php3_hash_init(tmp.value.ht, 0, NULL, (void (*)(void *))yystype_config_destructor, 1);
tmp.type = IS_OBJECT;
_php3_hash_update(active__php3_hash_table, $1.value.str.val, $1.value.str.len+1, (void *)
&tmp, sizeof(pval), (void **) ¤t_section);
tmp.value.str.val = php3_strndup($1.value.str.val,$1.value.str.len);
--- 365,371 ----
/*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/
tmp.value.ht = (HashTable *) malloc(sizeof(HashTable));
! _php3_hash_init(tmp.value.ht, 0, NULL, (void (*)(void *))pvalue_config_destructor, 1);
tmp.type = IS_OBJECT;
_php3_hash_update(active__php3_hash_table, $1.value.str.val, $1.value.str.len+1, (void *)
&tmp, sizeof(pval), (void **) ¤t_section);
tmp.value.str.val = php3_strndup($1.value.str.val,$1.value.str.len);
Index: php31/main/internal_functions.c
diff -c php31/main/internal_functions.c:2.7 php31/main/internal_functions.c:2.8
*** php31/main/internal_functions.c:2.7 Wed Sep 2 15:18:23 1998
--- php31/main/internal_functions.c Thu Sep 10 20:22:51 1998
***************
*** 29,35 ****
*/
! /* $Id: internal_functions.c,v 2.7 1998/09/02 19:18:23 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 29,35 ----
*/
! /* $Id: internal_functions.c,v 2.8 1998/09/11 00:22:51 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 206,212 ****
inline PHPAPI int array_init(pval *arg)
{
arg->value.ht = (HashTable *) emalloc(sizeof(HashTable));
! if (!arg->value.ht || _php3_hash_init(arg->value.ht, 0, NULL, pval_DESTRUCTOR, 0)) {
php3_error(E_CORE_ERROR, "Cannot allocate memory for array");
return FAILURE;
}
--- 206,212 ----
inline PHPAPI int array_init(pval *arg)
{
arg->value.ht = (HashTable *) emalloc(sizeof(HashTable));
! if (!arg->value.ht || _php3_hash_init(arg->value.ht, 0, NULL, PVAL_DESTRUCTOR, 0)) {
php3_error(E_CORE_ERROR, "Cannot allocate memory for array");
return FAILURE;
}
***************
*** 217,223 ****
inline PHPAPI int object_init(pval *arg)
{
arg->value.ht = (HashTable *) emalloc(sizeof(HashTable));
! if (!arg->value.ht || _php3_hash_init(arg->value.ht, 0, NULL, pval_DESTRUCTOR, 0)) {
php3_error(E_CORE_ERROR, "Cannot allocate memory for array");
return FAILURE;
}
--- 217,223 ----
inline PHPAPI int object_init(pval *arg)
{
arg->value.ht = (HashTable *) emalloc(sizeof(HashTable));
! if (!arg->value.ht || _php3_hash_init(arg->value.ht, 0, NULL, PVAL_DESTRUCTOR, 0)) {
php3_error(E_CORE_ERROR, "Cannot allocate memory for array");
return FAILURE;
}
Index: php31/main/language-parser.y
diff -c php31/main/language-parser.y:2.8 php31/main/language-parser.y:2.9
*** php31/main/language-parser.y:2.8 Tue Sep 1 13:43:31 1998
--- php31/main/language-parser.y Thu Sep 10 20:22:51 1998
***************
*** 31,37 ****
*/
! /* $Id: language-parser.y,v 2.8 1998/09/01 17:43:31 zeev Exp $ */
/*
--- 31,37 ----
*/
! /* $Id: language-parser.y,v 2.9 1998/09/11 00:22:51 zeev Exp $ */
/*
***************
*** 297,303 ****
| WHILE '(' expr ')' { cs_start_while(&$1, &$3 _INLINE_TLS); }
while_statement { cs_end_while(&$1 _INLINE_TLS); } while_iterations
| DO { cs_start_do_while(&$1 _INLINE_TLS); } statement WHILE { cs_force_eval_do_while(
_INLINE_TLS_VOID); } '(' expr ')' ';'{ cs_end_do_while(&$1,&$7
_INLINE_TLS); } do_while_iterations
| FOR { for_pre_expr1(&$1 _INLINE_TLS); }
! '(' for_expr { if (GLOBAL(Execute)) yystype_destructor(&$4 _INLINE_TLS);
for_pre_expr2(&$1 _INLINE_TLS); }
';' for_expr { for_pre_expr3(&$1,&$7 _INLINE_TLS); }
';' for_expr { for_pre_statement(&$1,&$7,&$10 _INLINE_TLS); }
')' for_statement { for_post_statement(&$1,&$6,&$9,&$12 _INLINE_TLS);
} for_iterations
--- 297,303 ----
| WHILE '(' expr ')' { cs_start_while(&$1, &$3 _INLINE_TLS); }
while_statement { cs_end_while(&$1 _INLINE_TLS); } while_iterations
| DO { cs_start_do_while(&$1 _INLINE_TLS); } statement WHILE { cs_force_eval_do_while(
_INLINE_TLS_VOID); } '(' expr ')' ';'{ cs_end_do_while(&$1,&$7
_INLINE_TLS); } do_while_iterations
| FOR { for_pre_expr1(&$1 _INLINE_TLS); }
! '(' for_expr { if (GLOBAL(Execute)) pval_destructor(&$4 _INLINE_TLS);
for_pre_expr2(&$1 _INLINE_TLS); }
';' for_expr { for_pre_expr3(&$1,&$7 _INLINE_TLS); }
';' for_expr { for_pre_statement(&$1,&$7,&$10 _INLINE_TLS); }
')' for_statement { for_post_statement(&$1,&$6,&$9,&$12 _INLINE_TLS);
} for_iterations
***************
*** 319,325 ****
| CLASS STRING EXTENDS STRING { cs_start_class_decleration(&$2,&$4 _INLINE_TLS); }
'{' class_statement_list '}' { cs_end_class_decleration( _INLINE_TLS_VOID); }
| PHP_ECHO echo_expr_list ';'
| INLINE_HTML { if (GLOBAL(Execute)) { if (php3_header()) PUTS($1.value.str.val); } }
! | expr ';' { if (GLOBAL(Execute)) yystype_destructor(&$1 _INLINE_TLS); }
| REQUIRE { cs_start_include(&$1 _INLINE_TLS); } expr ';' {
cs_end_include(&$1,&$3 _INLINE_TLS); }
| HIGHLIGHT_FILE expr ';' { if (GLOBAL(Execute)) cs_show_source(&$2 _INLINE_TLS); }
| HIGHLIGHT_STRING '(' expr ')' ';' { if (GLOBAL(Execute))
eval_string(&$3,NULL,1 _INLINE_TLS); }
--- 319,325 ----
| CLASS STRING EXTENDS STRING { cs_start_class_decleration(&$2,&$4 _INLINE_TLS); }
'{' class_statement_list '}' { cs_end_class_decleration( _INLINE_TLS_VOID); }
| PHP_ECHO echo_expr_list ';'
| INLINE_HTML { if (GLOBAL(Execute)) { if (php3_header()) PUTS($1.value.str.val); } }
! | expr ';' { if (GLOBAL(Execute)) pval_destructor(&$1 _INLINE_TLS); }
| REQUIRE { cs_start_include(&$1 _INLINE_TLS); } expr ';' {
cs_end_include(&$1,&$3 _INLINE_TLS); }
| HIGHLIGHT_FILE expr ';' { if (GLOBAL(Execute)) cs_show_source(&$2 _INLINE_TLS); }
| HIGHLIGHT_STRING '(' expr ')' ';' { if (GLOBAL(Execute))
eval_string(&$3,NULL,1 _INLINE_TLS); }
***************
*** 362,368 ****
for_iterations:
/* empty */
| for_iterations CONTINUED_FOR { for_pre_expr1(&$2 _INLINE_TLS); }
! '(' for_expr { if (GLOBAL(Execute)) yystype_destructor(&$5 _INLINE_TLS);
for_pre_expr2(&$2 _INLINE_TLS); }
';' for_expr { for_pre_expr3(&$2,&$8 _INLINE_TLS); }
';' for_expr { for_pre_statement(&$2,&$8,&$11 _INLINE_TLS); }
')' for_statement { for_post_statement(&$2,&$7,&$10,&$13
_INLINE_TLS); }
--- 362,368 ----
for_iterations:
/* empty */
| for_iterations CONTINUED_FOR { for_pre_expr1(&$2 _INLINE_TLS); }
! '(' for_expr { if (GLOBAL(Execute)) pval_destructor(&$5 _INLINE_TLS);
for_pre_expr2(&$2 _INLINE_TLS); }
';' for_expr { for_pre_expr3(&$2,&$8 _INLINE_TLS); }
';' for_expr { for_pre_statement(&$2,&$8,&$11 _INLINE_TLS); }
')' for_statement { for_post_statement(&$2,&$7,&$10,&$13
_INLINE_TLS); }
***************
*** 484,497 ****
echo_expr_list:
/* empty */
! | echo_expr_list ',' expr { if (GLOBAL(Execute)) { print_variable(&$3 _INLINE_TLS);
yystype_destructor(&$3 _INLINE_TLS); } }
! | expr { if (GLOBAL(Execute)) { print_variable(&$1 _INLINE_TLS); yystype_destructor(&$1
_INLINE_TLS); } }
;
for_expr:
/* empty */ { $$.value.lval=1; $$.type=IS_LONG; } /* ensure empty truth values are considered
TRUE */
! | for_expr ',' expr { if (GLOBAL(Execute)) { $$ = $3; yystype_destructor(&$1
_INLINE_TLS); } }
| expr { if (GLOBAL(Execute)) $$ = $1; }
;
--- 484,497 ----
echo_expr_list:
/* empty */
! | echo_expr_list ',' expr { if (GLOBAL(Execute)) { print_variable(&$3 _INLINE_TLS);
pval_destructor(&$3 _INLINE_TLS); } }
! | expr { if (GLOBAL(Execute)) { print_variable(&$1 _INLINE_TLS); pval_destructor(&$1
_INLINE_TLS); } }
;
for_expr:
/* empty */ { $$.value.lval=1; $$.type=IS_LONG; } /* ensure empty truth values are considered
TRUE */
! | for_expr ',' expr { if (GLOBAL(Execute)) { $$ = $3; pval_destructor(&$1
_INLINE_TLS); } }
| expr { if (GLOBAL(Execute)) $$ = $1; }
;
***************
*** 554,560 ****
possible_function_call { cs_functioncall_end(&$$,&$4,&$8,1 _INLINE_TLS); }
| NEW var { assign_new_object(&$$,&$2,1 _INLINE_TLS); }
| NEW var { assign_new_object(&$$,&$2,0 _INLINE_TLS); }
! '(' { if (!GLOBAL(shutdown_requested)) { pval object_pointer;
object_pointer.value.varptr.yystype = &$3; cs_functioncall_pre_variable_passing(&$2,
&object_pointer, 1 _INLINE_TLS); } }
function_call_parameter_list ')' { cs_functioncall_post_variable_passing(&$2
_INLINE_TLS); }
possible_function_call { cs_functioncall_end(&$$, &$2, &$7, 1 _INLINE_TLS); $$ =
$3; }
| INT_CAST expr { if (GLOBAL(Execute)) { convert_to_long(&$2); $$ = $2; } }
--- 554,560 ----
possible_function_call { cs_functioncall_end(&$$,&$4,&$8,1 _INLINE_TLS); }
| NEW var { assign_new_object(&$$,&$2,1 _INLINE_TLS); }
| NEW var { assign_new_object(&$$,&$2,0 _INLINE_TLS); }
! '(' { if (!GLOBAL(shutdown_requested)) { pval object_pointer;
object_pointer.value.varptr.pvalue = &$3; cs_functioncall_pre_variable_passing(&$2,
&object_pointer, 1 _INLINE_TLS); } }
function_call_parameter_list ')' { cs_functioncall_post_variable_passing(&$2
_INLINE_TLS); }
possible_function_call { cs_functioncall_end(&$$, &$2, &$7, 1 _INLINE_TLS); $$ =
$3; }
| INT_CAST expr { if (GLOBAL(Execute)) { convert_to_long(&$2); $$ = $2; } }
***************
*** 564,576 ****
| OBJECT_CAST expr { if (GLOBAL(Execute)) { convert_to_object(&$2); $$ = $2; } }
| EXIT { if (GLOBAL(Execute)) { php3_header(); GLOBAL(shutdown_requested)=ABNORMAL_SHUTDOWN;
$$.type=IS_LONG; $$.value.lval=1; } }
| EXIT '(' ')' { if (GLOBAL(Execute)) { php3_header();
GLOBAL(shutdown_requested)=ABNORMAL_SHUTDOWN; $$.type=IS_LONG; $$.value.lval=1; } }
! | EXIT '(' expr ')' { if (GLOBAL(Execute)) { if (php3_header()) {
convert_to_string(&$3); PUTS($3.value.str.val); yystype_destructor(&$3 _INLINE_TLS); }
GLOBAL(shutdown_requested)=ABNORMAL_SHUTDOWN; $$.type=IS_LONG; $$.value.lval=1; } }
| '@' { $1.cs_data.error_reporting=GLOBAL(error_reporting); GLOBAL(error_reporting)=0;
} expr { GLOBAL(error_reporting)=$1.cs_data.error_reporting; $$ = $3; }
| '@' error { php3_error(E_ERROR,"@ operator may only be used on
expressions"); }
| scalar { if (GLOBAL(Execute)) $$ = $1; }
| PHP_ARRAY '(' array_pair_list ')' { if (GLOBAL(Execute)) $$ = $3; }
| '
' encaps_list '' { cs_system(&$$,&$2 _INLINE_TLS); }
! | PHP_PRINT expr { if (GLOBAL(Execute)) { print_variable(&$2 _INLINE_TLS);
yystype_destructor(&$2 _INLINE_TLS); $$.value.lval=1; $$.type=IS_LONG; } }
;
scalar:
--- 564,576 ----
| OBJECT_CAST expr { if (GLOBAL(Execute)) { convert_to_object(&$2); $$ = $2; } }
| EXIT { if (GLOBAL(Execute)) { php3_header(); GLOBAL(shutdown_requested)=ABNORMAL_SHUTDOWN;
$$.type=IS_LONG; $$.value.lval=1; } }
| EXIT '(' ')' { if (GLOBAL(Execute)) { php3_header();
GLOBAL(shutdown_requested)=ABNORMAL_SHUTDOWN; $$.type=IS_LONG; $$.value.lval=1; } }
! | EXIT '(' expr ')' { if (GLOBAL(Execute)) { if (php3_header()) {
convert_to_string(&$3); PUTS($3.value.str.val); pval_destructor(&$3 _INLINE_TLS); }
GLOBAL(shutdown_requested)=ABNORMAL_SHUTDOWN; $$.type=IS_LONG; $$.value.lval=1; } }
| '@' { $1.cs_data.error_reporting=GLOBAL(error_reporting); GLOBAL(error_reporting)=0;
} expr { GLOBAL(error_reporting)=$1.cs_data.error_reporting; $$ = $3; }
| '@' error { php3_error(E_ERROR,"@ operator may only be used on
expressions"); }
| scalar { if (GLOBAL(Execute)) $$ = $1; }
| PHP_ARRAY '(' array_pair_list ')' { if (GLOBAL(Execute)) $$ = $3; }
| '' encaps_list '' { cs_system(&$$,&$2 _INLINE_TLS); }
! | PHP_PRINT expr { if (GLOBAL(Execute)) { print_variable(&$2 _INLINE_TLS);
pval_destructor(&$2 _INLINE_TLS); $$.value.lval=1; $$.type=IS_LONG; } }
;
scalar:
***************
*** 617,623 ****
unambiguous_class_name:
unambiguous_class_name PHP_CLASS_OPERATOR varname_scalar {
get_object_symtable(&$$,&$1,&$3 _INLINE_TLS); }
! | multi_dimensional_array { if (GLOBAL(Execute)) { if ($1.value.varptr.yystype && ((pval
*)$1.value.varptr.yystype)->type == IS_OBJECT) { $$=$1; } else { $$.value.varptr.yystype=NULL; }
} }
| varname_scalar { get_object_symtable(&$$,NULL,&$1 _INLINE_TLS); }
;
--- 617,623 ----
unambiguous_class_name:
unambiguous_class_name PHP_CLASS_OPERATOR varname_scalar {
get_object_symtable(&$$,&$1,&$3 _INLINE_TLS); }
! | multi_dimensional_array { if (GLOBAL(Execute)) { if ($1.value.varptr.pvalue && ((pval
*)$1.value.varptr.pvalue)->type == IS_OBJECT) { $$=$1; } else { $$.value.varptr.pvalue=NULL; } }
}
| varname_scalar { get_object_symtable(&$$,NULL,&$1 _INLINE_TLS); }
;
***************
*** 641,647 ****
| assignment_list ',' {
if (GLOBAL(Execute)) {
$$=$1;
! $2.value.varptr.yystype = NULL; /* $2 is just used as temporary space */
_php3_hash_next_index_insert($$.value.ht,&$2,sizeof(pval),NULL);
}
}
--- 641,647 ----
| assignment_list ',' {
if (GLOBAL(Execute)) {
$$=$1;
! $2.value.varptr.pvalue = NULL; /* $2 is just used as temporary space */
_php3_hash_next_index_insert($$.value.ht,&$2,sizeof(pval),NULL);
}
}
***************
*** 652,658 ****
$$.value.ht = (HashTable *) emalloc(sizeof(HashTable));
_php3_hash_init($$.value.ht,0,NULL,NULL,0);
$$.type = IS_ARRAY;
! tmp.value.varptr.yystype = NULL;
_php3_hash_next_index_insert($$.value.ht,&tmp,sizeof(pval),NULL);
}
}
--- 652,658 ----
$$.value.ht = (HashTable *) emalloc(sizeof(HashTable));
_php3_hash_init($$.value.ht,0,NULL,NULL,0);
$$.type = IS_ARRAY;
! tmp.value.varptr.pvalue = NULL;
_php3_hash_next_index_insert($$.value.ht,&tmp,sizeof(pval),NULL);
}
}
***************
*** 687,693 ****
array_pair_list:
! /* empty */ { if (GLOBAL(Execute)) { $$.value.ht = (HashTable *) emalloc(sizeof(HashTable));
_php3_hash_init($$.value.ht,0,NULL,pval_DESTRUCTOR,0); $$.type = IS_ARRAY; } }
| non_empty_array_pair_list { $$ = $1; }
;
--- 687,693 ----
array_pair_list:
! /* empty */ { if (GLOBAL(Execute)) { $$.value.ht = (HashTable *) emalloc(sizeof(HashTable));
_php3_hash_init($$.value.ht,0,NULL,PVAL_DESTRUCTOR,0); $$.type = IS_ARRAY; } }
| non_empty_array_pair_list { $$ = $1; }
;
***************
*** 784,790 ****
tc_set_token(&GLOBAL(token_cache_manager), func->offset, IC_FUNCTION);
if (object) {
! class_ptr.value.varptr.yystype = object;
cs_functioncall_pre_variable_passing(function_name, &class_ptr, 0 _INLINE_TLS);
} else {
cs_functioncall_pre_variable_passing(function_name,NULL, 0 _INLINE_TLS);
--- 784,790 ----
tc_set_token(&GLOBAL(token_cache_manager), func->offset, IC_FUNCTION);
if (object) {
! class_ptr.value.varptr.pvalue = object;
cs_functioncall_pre_variable_passing(function_name, &class_ptr, 0 _INLINE_TLS);
} else {
cs_functioncall_pre_variable_passing(function_name,NULL, 0 _INLINE_TLS);
Index: php31/main/language-scanner.l
diff -c php31/main/language-scanner.l:2.11 php31/main/language-scanner.l:2.12
*** php31/main/language-scanner.l:2.11 Sun Sep 6 17:34:36 1998
--- php31/main/language-scanner.l Thu Sep 10 20:22:51 1998
***************
*** 225,231 ****
if (!display_source) {
tcm_new(&GLOBAL(token_cache_manager));
} else {
! if (display_source==2 && !yystype_true(return_offset)) {
display_source=1;
}
if (display_source==1) {
--- 225,231 ----
if (!display_source) {
tcm_new(&GLOBAL(token_cache_manager));
} else {
! if (display_source==2 && !pval_is_true(return_offset)) {
display_source=1;
}
if (display_source==1) {
***************
*** 270,276 ****
php3_error(E_WARNING,"Failed opening '%s' for inclusion",
php3_strip_url_passwd(file->value.str.val));
stack_del_top(&GLOBAL(input_source_stack));
! yystype_destructor(file _INLINE_TLS);
return FAILURE;
}
yyin = tmp;
--- 270,276 ----
php3_error(E_WARNING,"Failed opening '%s' for inclusion",
php3_strip_url_passwd(file->value.str.val));
stack_del_top(&GLOBAL(input_source_stack));
! pval_destructor(file _INLINE_TLS);
return FAILURE;
}
yyin = tmp;
Index: php31/main/main.c
diff -c php31/main/main.c:2.35 php31/main/main.c:2.36
*** php31/main/main.c:2.35 Mon Sep 7 17:50:33 1998
--- php31/main/main.c Thu Sep 10 20:22:51 1998
***************
*** 29,35 ****
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 2.35 1998/09/07 21:50:33 shane Exp $ */
/* #define CRASH_DETECTION */
--- 29,35 ----
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 2.36 1998/09/11 00:22:51 zeev Exp $ */
/* #define CRASH_DETECTION */
***************
*** 595,601 ****
}
/* prepare general symbol table hash */
! if (_php3_hash_init(&GLOBAL(symbol_table), 50, NULL, pval_DESTRUCTOR, 0) == FAILURE) {
php3_printf("Unable to initialize symbol table.\n");
return FAILURE;
}
--- 595,601 ----
}
/* prepare general symbol table hash */
! if (_php3_hash_init(&GLOBAL(symbol_table), 50, NULL, PVAL_DESTRUCTOR, 0) == FAILURE) {
php3_printf("Unable to initialize symbol table.\n");
return FAILURE;
}
***************
*** 734,740 ****
switch_expr *se;
while (stack_top(&GLOBAL(switch_stack), (void **) &se) != FAILURE) {
! yystype_destructor(&se->expr _INLINE_TLS);
stack_del_top(&GLOBAL(switch_stack));
}
stack_destroy(&GLOBAL(switch_stack));
--- 734,740 ----
switch_expr *se;
while (stack_top(&GLOBAL(switch_stack), (void **) &se) != FAILURE) {
! pval_destructor(&se->expr _INLINE_TLS);
stack_del_top(&GLOBAL(switch_stack));
}
stack_destroy(&GLOBAL(switch_stack));
***************
*** 937,943 ****
GLOBAL(error_reporting) = E_ALL;
/* prepare function table hash */
! if (_php3_hash_init(&GLOBAL(function_table), 100, NULL, pval_DESTRUCTOR, 1) == FAILURE) {
php3_printf("Unable to initialize function table.\n");
return FAILURE;
}
--- 937,943 ----
GLOBAL(error_reporting) = E_ALL;
/* prepare function table hash */
! if (_php3_hash_init(&GLOBAL(function_table), 100, NULL, PVAL_DESTRUCTOR, 1) == FAILURE) {
php3_printf("Unable to initialize function table.\n");
return FAILURE;
}
***************
*** 1094,1100 ****
TLS_VARS;
arr.value.ht = (HashTable *) emalloc(sizeof(HashTable));
! if (!arr.value.ht || _php3_hash_init(arr.value.ht, 0, NULL, pval_DESTRUCTOR, 0) == FAILURE) {
php3_error(E_WARNING, "Unable to create argv array");
} else {
arr.type = IS_ARRAY;
--- 1094,1100 ----
TLS_VARS;
arr.value.ht = (HashTable *) emalloc(sizeof(HashTable));
! if (!arr.value.ht || _php3_hash_init(arr.value.ht, 0, NULL, PVAL_DESTRUCTOR, 0) == FAILURE) {
php3_error(E_WARNING, "Unable to create argv array");
} else {
arr.type = IS_ARRAY;
Index: php31/main/operators.c
diff -c php31/main/operators.c:2.2 php31/main/operators.c:2.3
*** php31/main/operators.c:2.2 Thu Aug 13 19:51:12 1998
--- php31/main/operators.c Thu Sep 10 20:22:52 1998
***************
*** 29,35 ****
*/
! /* $Id: operators.c,v 2.2 1998/08/13 23:51:12 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 29,35 ----
*/
! /* $Id: operators.c,v 2.3 1998/09/11 00:22:52 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 109,121 ****
case IS_ARRAY:
case IS_OBJECT:
tmp = (_php3_hash_num_elements(op->value.ht)?1:0);
! yystype_destructor(op _INLINE_TLS);
op->value.lval = tmp;
op->type = IS_LONG;
break;
default:
php3_error(E_WARNING, "Cannot convert to ordinal value");
! yystype_destructor(op _INLINE_TLS);
op->value.lval = 0;
op->type = IS_LONG;
break;
--- 109,121 ----
case IS_ARRAY:
case IS_OBJECT:
tmp = (_php3_hash_num_elements(op->value.ht)?1:0);
! pval_destructor(op _INLINE_TLS);
op->value.lval = tmp;
op->type = IS_LONG;
break;
default:
php3_error(E_WARNING, "Cannot convert to ordinal value");
! pval_destructor(op _INLINE_TLS);
op->value.lval = 0;
op->type = IS_LONG;
break;
***************
*** 148,160 ****
case IS_ARRAY:
case IS_OBJECT:
tmp = (_php3_hash_num_elements(op->value.ht)?1:0);
! yystype_destructor(op _INLINE_TLS);
op->value.dval = tmp;
op->type = IS_DOUBLE;
break;
default:
php3_error(E_WARNING, "Cannot convert to real value");
! yystype_destructor(op _INLINE_TLS);
op->value.dval = 0;
op->type = IS_DOUBLE;
break;
--- 148,160 ----
case IS_ARRAY:
case IS_OBJECT:
tmp = (_php3_hash_num_elements(op->value.ht)?1:0);
! pval_destructor(op _INLINE_TLS);
op->value.dval = tmp;
op->type = IS_DOUBLE;
break;
default:
php3_error(E_WARNING, "Cannot convert to real value");
! pval_destructor(op _INLINE_TLS);
op->value.dval = 0;
op->type = IS_DOUBLE;
break;
***************
*** 190,201 ****
case IS_ARRAY:
case IS_OBJECT:
tmp = (_php3_hash_num_elements(op->value.ht)?1:0);
! yystype_destructor(op _INLINE_TLS);
op->value.lval = tmp;
op->type = IS_LONG;
break;
default:
! yystype_destructor(op _INLINE_TLS);
op->value.lval = 0;
op->type = IS_LONG;
break;
--- 190,201 ----
case IS_ARRAY:
case IS_OBJECT:
tmp = (_php3_hash_num_elements(op->value.ht)?1:0);
! pval_destructor(op _INLINE_TLS);
op->value.lval = tmp;
op->type = IS_LONG;
break;
default:
! pval_destructor(op _INLINE_TLS);
op->value.lval = 0;
op->type = IS_LONG;
break;
***************
*** 234,252 ****
break;
}
case IS_ARRAY:
! yystype_destructor(op _INLINE_TLS);
op->value.str.val = estrndup("Array",sizeof("Array")-1);
op->value.str.len = sizeof("Array")-1;
op->type = IS_STRING;
break;
case IS_OBJECT:
! yystype_destructor(op _INLINE_TLS);
op->value.str.val = estrndup("Object",sizeof("Object")-1);
op->value.str.len = sizeof("Object")-1;
op->type = IS_STRING;
break;
default:
! yystype_destructor(op _INLINE_TLS);
var_reset(op);
break;
}
--- 234,252 ----
break;
}
case IS_ARRAY:
! pval_destructor(op _INLINE_TLS);
op->value.str.val = estrndup("Array",sizeof("Array")-1);
op->value.str.len = sizeof("Array")-1;
op->type = IS_STRING;
break;
case IS_OBJECT:
! pval_destructor(op _INLINE_TLS);
op->value.str.val = estrndup("Object",sizeof("Object")-1);
op->value.str.len = sizeof("Object")-1;
op->type = IS_STRING;
break;
default:
! pval_destructor(op _INLINE_TLS);
var_reset(op);
break;
}
***************
*** 258,264 ****
pval tmp = *op;
op->value.ht = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(op->value.ht, 0, NULL, pval_DESTRUCTOR, 0);
switch (type) {
case IS_ARRAY:
_php3_hash_index_update(op->value.ht, 0, (void *) &tmp, sizeof(pval), NULL);
--- 258,264 ----
pval tmp = *op;
op->value.ht = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(op->value.ht, 0, NULL, PVAL_DESTRUCTOR, 0);
switch (type) {
case IS_ARRAY:
_php3_hash_index_update(op->value.ht, 0, (void *) &tmp, sizeof(pval), NULL);
***************
*** 312,320 ****
if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) {
pval tmp;
! _php3_hash_merge(op1->value.ht,op2->value.ht,(void (*)(void *pData))
yystype_copy_constructor, (void *) &tmp, sizeof(pval));
*result = *op1;
! yystype_destructor(op2 _INLINE_TLS);
return SUCCESS;
}
if (GLOBAL(php3_ini)->warn_plus_overloading) {
--- 312,320 ----
if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) {
pval tmp;
! _php3_hash_merge(op1->value.ht,op2->value.ht,(void (*)(void *pData))
pval_copy_constructor, (void *) &tmp, sizeof(pval));
*result = *op1;
! pval_destructor(op2 _INLINE_TLS);
return SUCCESS;
}
if (GLOBAL(php3_ini)->warn_plus_overloading) {
***************
*** 351,358 ****
result->value.dval = op1->value.dval + op2->value.dval;
return SUCCESS;
}
! yystype_destructor(op1 _INLINE_TLS);
! yystype_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
--- 351,358 ----
result->value.dval = op1->value.dval + op2->value.dval;
return SUCCESS;
}
! pval_destructor(op1 _INLINE_TLS);
! pval_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
***************
*** 388,395 ****
result->value.dval = op1->value.dval - op2->value.dval;
return SUCCESS;
}
! yystype_destructor(op1 _INLINE_TLS);
! yystype_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
--- 388,395 ----
result->value.dval = op1->value.dval - op2->value.dval;
return SUCCESS;
}
! pval_destructor(op1 _INLINE_TLS);
! pval_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
***************
*** 425,432 ****
result->value.dval = op1->value.dval * op2->value.dval;
return SUCCESS;
}
! yystype_destructor(op1 _INLINE_TLS);
! yystype_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
--- 425,432 ----
result->value.dval = op1->value.dval * op2->value.dval;
return SUCCESS;
}
! pval_destructor(op1 _INLINE_TLS);
! pval_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
***************
*** 464,471 ****
result->value.dval = op1->value.dval / op2->value.dval;
return SUCCESS;
}
! yystype_destructor(op1 _INLINE_TLS);
! yystype_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
--- 464,471 ----
result->value.dval = op1->value.dval / op2->value.dval;
return SUCCESS;
}
! pval_destructor(op1 _INLINE_TLS);
! pval_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
***************
*** 580,586 ****
}
return SUCCESS;
}
! yystype_destructor(op1 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
--- 580,586 ----
}
return SUCCESS;
}
! pval_destructor(op1 _INLINE_TLS);
var_reset(result);
return FAILURE; /* unknown datatype */
}
***************
*** 705,712 ****
int add_char_to_string(pval *result, pval *op1, pval *op2 INLINE_TLS)
{
if (op1->type != IS_STRING) {
! yystype_destructor(op1 _INLINE_TLS);
! yystype_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE;
}
--- 705,712 ----
int add_char_to_string(pval *result, pval *op1, pval *op2 INLINE_TLS)
{
if (op1->type != IS_STRING) {
! pval_destructor(op1 _INLINE_TLS);
! pval_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE;
}
***************
*** 743,751 ****
}
return SUCCESS;
}
! yystype_destructor(op1 _INLINE_TLS);
if (free_op2) {
! yystype_destructor(op2 _INLINE_TLS);
}
var_reset(result);
return FAILURE; /* unknown datatype */
--- 743,751 ----
}
return SUCCESS;
}
! pval_destructor(op1 _INLINE_TLS);
if (free_op2) {
! pval_destructor(op2 _INLINE_TLS);
}
var_reset(result);
return FAILURE; /* unknown datatype */
***************
*** 779,786 ****
if ((op1->type & IS_HASH) && (op2->type & IS_HASH)) {
php3_error(E_WARNING,"Cannot compare arrays or objects");
}
! yystype_destructor(op1 _INLINE_TLS);
! yystype_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE;
}
--- 779,786 ----
if ((op1->type & IS_HASH) && (op2->type & IS_HASH)) {
php3_error(E_WARNING,"Cannot compare arrays or objects");
}
! pval_destructor(op1 _INLINE_TLS);
! pval_destructor(op2 _INLINE_TLS);
var_reset(result);
return FAILURE;
}
***************
*** 1060,1066 ****
return SUCCESS;
}
! int yystype_true(pval *op)
{
convert_to_boolean_long(op);
return (op->value.lval ? 1 : 0);
--- 1060,1066 ----
return SUCCESS;
}
! int pval_is_true(pval *op)
{
convert_to_boolean_long(op);
return (op->value.lval ? 1 : 0);
Index: php31/main/operators.h
diff -c php31/main/operators.h:2.0 php31/main/operators.h:2.1
*** php31/main/operators.h:2.0 Fri Jul 3 09:17:24 1998
--- php31/main/operators.h Thu Sep 10 20:22:52 1998
***************
*** 30,36 ****
*/
! /* $Id: operators.h,v 2.0 1998/07/03 13:17:24 rasmus Exp $ */
#ifndef _OPERATORS_H
--- 30,36 ----
*/
! /* $Id: operators.h,v 2.1 1998/09/11 00:22:52 zeev Exp $ */
#ifndef _OPERATORS_H
***************
*** 80,86 ****
extern int add_char_to_string(pval *result, pval *op1, pval *op2 INLINE_TLS);
extern PHPAPI void convert_to_double(pval *op);
! extern int yystype_true(pval *op);
extern int compare_function(pval *result, pval *op1, pval *op2 INLINE_TLS);
extern void php3_str_tolower(char *str, unsigned int length);
--- 80,86 ----
extern int add_char_to_string(pval *result, pval *op1, pval *op2 INLINE_TLS);
extern PHPAPI void convert_to_double(pval *op);
! extern int pval_is_true(pval *op);
extern int compare_function(pval *result, pval *op1, pval *op2 INLINE_TLS);
extern void php3_str_tolower(char *str, unsigned int length);
Index: php31/main/php.h
diff -c php31/main/php.h:2.13 php31/main/php.h:2.14
*** php31/main/php.h:2.13 Thu Sep 10 19:17:07 1998
--- php31/main/php.h Thu Sep 10 20:22:52 1998
***************
*** 28,34 ****
+----------------------------------------------------------------------+
*/
! /* $Id: php.h,v 2.13 1998/09/10 23:17:07 zeev Exp $ */
#ifndef _PHP_H
#define _PHP_H
--- 28,34 ----
+----------------------------------------------------------------------+
*/
! /* $Id: php.h,v 2.14 1998/09/11 00:22:52 zeev Exp $ */
#ifndef _PHP_H
#define _PHP_H
***************
*** 259,268 ****
} func;
struct {
! pval *yystype; /* used for implementation of multi-dimensional arrays */
int string_offset;
} varptr;
! } yystype_value;
struct _pval_struct {
--- 259,268 ----
} func;
struct {
! pval *pvalue; /* used for implementation of multi-dimensional arrays */
int string_offset;
} varptr;
! } pvalue_value;
struct _pval_struct {
***************
*** 273,279 ****
control_structure_data cs_data;
unsigned int offset;
! yystype_value value; /* value */
};
typedef struct {
--- 273,279 ----
control_structure_data cs_data;
unsigned int offset;
! pvalue_value value; /* value */
};
typedef struct {
Index: php31/main/post.c
diff -c php31/main/post.c:2.3 php31/main/post.c:2.4
*** php31/main/post.c:2.3 Fri Jul 17 22:52:57 1998
--- php31/main/post.c Thu Sep 10 20:22:52 1998
***************
*** 164,170 ****
}
} else {
if (arr_ptr->type!=IS_ARRAY) {
! yystype_destructor(arr_ptr _INLINE_TLS);
if (array_init(arr_ptr)==FAILURE) {
return;
}
--- 164,170 ----
}
} else {
if (arr_ptr->type!=IS_ARRAY) {
! pval_destructor(arr_ptr _INLINE_TLS);
if (array_init(arr_ptr)==FAILURE) {
return;
}
***************
*** 195,207 ****
if (php3_check_type(ret) == IS_LONG) {
_php3_hash_index_update(arr1.value.ht, atol(ret), &entry, sizeof(pval),NULL); /*
s[ret]=tmp */
if (track_vars_array) {
! yystype_copy_constructor(&entry);
_php3_hash_index_update(arr2.value.ht, atol(ret), &entry, sizeof(pval),NULL);
}
} else {
_php3_hash_update(arr1.value.ht, ret, strlen(ret)+1, &entry, sizeof(pval),NULL); /*
s["ret"]=tmp */
if (track_vars_array) {
! yystype_copy_constructor(&entry);
_php3_hash_update(arr2.value.ht, ret, strlen(ret)+1, &entry, sizeof(pval),NULL);
}
}
--- 195,207 ----
if (php3_check_type(ret) == IS_LONG) {
_php3_hash_index_update(arr1.value.ht, atol(ret), &entry, sizeof(pval),NULL); /*
s[ret]=tmp */
if (track_vars_array) {
! pval_copy_constructor(&entry);
_php3_hash_index_update(arr2.value.ht, atol(ret), &entry, sizeof(pval),NULL);
}
} else {
_php3_hash_update(arr1.value.ht, ret, strlen(ret)+1, &entry, sizeof(pval),NULL); /*
s["ret"]=tmp */
if (track_vars_array) {
! pval_copy_constructor(&entry);
_php3_hash_update(arr2.value.ht, ret, strlen(ret)+1, &entry, sizeof(pval),NULL);
}
}
***************
*** 210,216 ****
} else { /* non-indexed array */
_php3_hash_next_index_insert(arr1.value.ht, &entry, sizeof(pval),NULL);
if (track_vars_array) {
! yystype_copy_constructor(&entry);
_php3_hash_next_index_insert(arr2.value.ht, &entry, sizeof(pval),NULL);
}
}
--- 210,216 ----
} else { /* non-indexed array */
_php3_hash_next_index_insert(arr1.value.ht, &entry, sizeof(pval),NULL);
if (track_vars_array) {
! pval_copy_constructor(&entry);
_php3_hash_next_index_insert(arr2.value.ht, &entry, sizeof(pval),NULL);
}
}
***************
*** 226,232 ****
entry.type = IS_STRING;
_php3_hash_update(GLOBAL(active_symbol_table), var, var_len+1, (void *) &entry,
sizeof(pval),NULL);
if (track_vars_array) {
! yystype_copy_constructor(&entry);
_php3_hash_update(track_vars_array->value.ht, var, var_len+1, (void *) &entry,
sizeof(pval),NULL);
}
}
--- 226,232 ----
entry.type = IS_STRING;
_php3_hash_update(GLOBAL(active_symbol_table), var, var_len+1, (void *) &entry,
sizeof(pval),NULL);
if (track_vars_array) {
! pval_copy_constructor(&entry);
_php3_hash_update(track_vars_array->value.ht, var, var_len+1, (void *) &entry,
sizeof(pval),NULL);
}
}
Index: php31/main/token_cache.c
diff -c php31/main/token_cache.c:2.5 php31/main/token_cache.c:2.6
*** php31/main/token_cache.c:2.5 Tue Sep 1 13:43:32 1998
--- php31/main/token_cache.c Thu Sep 10 20:22:53 1998
***************
*** 29,35 ****
*/
! /* $Id: token_cache.c,v 2.5 1998/09/01 17:43:32 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 29,35 ----
*/
! /* $Id: token_cache.c,v 2.6 1998/09/11 00:22:53 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 305,311 ****
TLS_VARS;
for (i = 0; i < tc->count; i++) {
! yystype_destructor(&tc->tokens[i].phplval _INLINE_TLS);
}
if (tc->tokens) {
efree(tc->tokens);
--- 305,311 ----
TLS_VARS;
for (i = 0; i < tc->count; i++) {
! pval_destructor(&tc->tokens[i].phplval _INLINE_TLS);
}
if (tc->tokens) {
efree(tc->tokens);
Index: php31/main/variables.c
diff -c php31/main/variables.c:2.5 php31/main/variables.c:2.6
*** php31/main/variables.c:2.5 Thu Sep 10 19:17:08 1998
--- php31/main/variables.c Thu Sep 10 20:22:53 1998
***************
*** 29,35 ****
*/
! /* $Id: variables.c,v 2.5 1998/09/10 23:17:08 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 29,35 ----
*/
! /* $Id: variables.c,v 2.6 1998/09/11 00:22:53 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 72,110 ****
! inline void yystype_destructor(pval *yystype INLINE_TLS)
{
! if (yystype->type == IS_STRING) {
! STR_FREE(yystype->value.str.val);
! } else if (yystype->type & (IS_ARRAY | IS_CLASS | IS_OBJECT)) {
! if (yystype->value.ht && (yystype->value.ht != &GLOBAL(symbol_table))) {
! _php3_hash_destroy(yystype->value.ht);
! efree(yystype->value.ht);
}
! } else if (yystype->type==IS_USER_FUNCTION) {
! if (yystype->value.func.addr.statics) {
! _php3_hash_destroy(yystype->value.func.addr.statics);
! efree(yystype->value.func.addr.statics);
}
! if (yystype->value.func.arg_types) {
! efree(yystype->value.func.arg_types);
}
}
}
! PHPAPI void php3tls_yystype_destructor(pval *yystype)
{
TLS_VARS;
! yystype_destructor(yystype _INLINE_TLS);
}
! /* returns 1 if the type of yystype is NOT IS_INTERNAL_FUNCTION */
! inline int is_not_internal_function(pval *yystype)
{
! if (yystype->type == IS_INTERNAL_FUNCTION) {
return 0;
} else {
return 1;
--- 72,110 ----
! inline void pval_destructor(pval *pvalue INLINE_TLS)
{
! if (pvalue->type == IS_STRING) {
! STR_FREE(pvalue->value.str.val);
! } else if (pvalue->type & (IS_ARRAY | IS_CLASS | IS_OBJECT)) {
! if (pvalue->value.ht && (pvalue->value.ht != &GLOBAL(symbol_table))) {
! _php3_hash_destroy(pvalue->value.ht);
! efree(pvalue->value.ht);
}
! } else if (pvalue->type==IS_USER_FUNCTION) {
! if (pvalue->value.func.addr.statics) {
! _php3_hash_destroy(pvalue->value.func.addr.statics);
! efree(pvalue->value.func.addr.statics);
}
! if (pvalue->value.func.arg_types) {
! efree(pvalue->value.func.arg_types);
}
}
}
! PHPAPI void php3tls_pval_destructor(pval *pvalue)
{
TLS_VARS;
! pval_destructor(pvalue _INLINE_TLS);
}
! /* returns 1 if the type of pvalue is NOT IS_INTERNAL_FUNCTION */
! inline int is_not_internal_function(pval *pvalue)
{
! if (pvalue->type == IS_INTERNAL_FUNCTION) {
return 0;
} else {
return 1;
***************
*** 112,159 ****
}
! PHPAPI int yystype_copy_constructor(pval *yystype)
{
TLS_VARS;
! if (yystype->type == IS_STRING && yystype->value.str.val) {
! if (yystype->value.str.len==0) {
! if (yystype->value.str.val==undefined_variable_string) {
! yystype->value.str.val = undefined_variable_string;
} else {
! yystype->value.str.val = empty_string;
}
return SUCCESS;
}
! yystype->value.str.val = (char *) estrndup(yystype->value.str.val,
yystype->value.str.len);
! if (!yystype->value.str.val) {
! var_reset(yystype);
return FAILURE;
}
! } else if (yystype->type & (IS_ARRAY | IS_CLASS | IS_OBJECT)) {
pval tmp;
! if (!yystype->value.ht || (yystype->value.ht == &GLOBAL(symbol_table))) {
! var_reset(yystype);
return FAILURE;
}
! _php3_hash_copy(&(yystype->value.ht), yystype->value.ht, (void (*)(void *pData))
yystype_copy_constructor, (void *) &tmp, sizeof(pval));
! if (!yystype->value.ht) {
! var_reset(yystype);
return FAILURE;
}
! } else if (yystype->type & VALID_FUNCTION) {
! if (yystype->value.func.arg_types) {
! unsigned char *arg_types = yystype->value.func.arg_types;
! yystype->value.func.arg_types = emalloc(sizeof(unsigned char)*(arg_types[0]+1));
! memcpy(yystype->value.func.arg_types, arg_types, sizeof(unsigned char)*(arg_types[0]+1));
}
! if (yystype->type == IS_USER_FUNCTION && yystype->value.func.addr.statics) {
! HashTable *statics = yystype->value.func.addr.statics;
pval tmp;
! _php3_hash_copy(&yystype->value.func.addr.statics, statics, (void (*)(void *))
yystype_copy_constructor, &tmp, sizeof(pval));
}
}
return SUCCESS;
--- 112,159 ----
}
! PHPAPI int pval_copy_constructor(pval *pvalue)
{
TLS_VARS;
! if (pvalue->type == IS_STRING && pvalue->value.str.val) {
! if (pvalue->value.str.len==0) {
! if (pvalue->value.str.val==undefined_variable_string) {
! pvalue->value.str.val = undefined_variable_string;
} else {
! pvalue->value.str.val = empty_string;
}
return SUCCESS;
}
! pvalue->value.str.val = (char *) estrndup(pvalue->value.str.val,
pvalue->value.str.len);
! if (!pvalue->value.str.val) {
! var_reset(pvalue);
return FAILURE;
}
! } else if (pvalue->type & (IS_ARRAY | IS_CLASS | IS_OBJECT)) {
pval tmp;
! if (!pvalue->value.ht || (pvalue->value.ht == &GLOBAL(symbol_table))) {
! var_reset(pvalue);
return FAILURE;
}
! _php3_hash_copy(&(pvalue->value.ht), pvalue->value.ht, (void (*)(void *pData))
pval_copy_constructor, (void *) &tmp, sizeof(pval));
! if (!pvalue->value.ht) {
! var_reset(pvalue);
return FAILURE;
}
! } else if (pvalue->type & VALID_FUNCTION) {
! if (pvalue->value.func.arg_types) {
! unsigned char *arg_types = pvalue->value.func.arg_types;
! pvalue->value.func.arg_types = emalloc(sizeof(unsigned char)*(arg_types[0]+1));
! memcpy(pvalue->value.func.arg_types, arg_types, sizeof(unsigned char)*(arg_types[0]+1));
}
! if (pvalue->type == IS_USER_FUNCTION && pvalue->value.func.addr.statics) {
! HashTable *statics = pvalue->value.func.addr.statics;
pval tmp;
! _php3_hash_copy(&pvalue->value.func.addr.statics, statics, (void (*)(void *))
pval_copy_constructor, &tmp, sizeof(pval));
}
}
return SUCCESS;
***************
*** 171,212 ****
if (_php3_hash_index_find(list->value.ht, i, (void **)&varp) == FAILURE) {
continue;
}
! if (!varp->value.varptr.yystype) {
continue; /* Bad variable name */
}
if (varp->cs_data.array_write) {
clean_unassigned_variable_top(0 _INLINE_TLS);
}
! vardata = (pval *)varp->value.varptr.yystype;
! yystype_destructor(vardata _INLINE_TLS);
if (expr->type != IS_ARRAY) {
if (i != 0) {
var_uninit(vardata);
} else {
*vardata = *expr;
! yystype_copy_constructor(vardata);
}
} else {
if (_php3_hash_index_find(expr->value.ht, i, (void **)&exprdata) == FAILURE) {
var_uninit(vardata);
} else {
*vardata = *exprdata;
! yystype_copy_constructor(vardata);
}
}
}
*result = *expr;
! yystype_destructor(list _INLINE_TLS);
}
}
int assign_to_variable(pval *result, pval *var_ptr, pval *expr, int (*func) (pval *, pval *, pval
* INLINE_TLS) INLINE_TLS)
{
! pval *var = var_ptr->value.varptr.yystype;
if (!var) { /* didn't parse the variable successfully */
! yystype_destructor(expr _INLINE_TLS);
var_uninit(result);
if (var_ptr->cs_data.array_write) { /* I'm not sure it can happen - should check it --
Zeev */
clean_unassigned_variable_top(1 _INLINE_TLS);
--- 171,212 ----
if (_php3_hash_index_find(list->value.ht, i, (void **)&varp) == FAILURE) {
continue;
}
! if (!varp->value.varptr.pvalue) {
continue; /* Bad variable name */
}
if (varp->cs_data.array_write) {
clean_unassigned_variable_top(0 _INLINE_TLS);
}
! vardata = (pval *)varp->value.varptr.pvalue;
! pval_destructor(vardata _INLINE_TLS);
if (expr->type != IS_ARRAY) {
if (i != 0) {
var_uninit(vardata);
} else {
*vardata = *expr;
! pval_copy_constructor(vardata);
}
} else {
if (_php3_hash_index_find(expr->value.ht, i, (void **)&exprdata) == FAILURE) {
var_uninit(vardata);
} else {
*vardata = *exprdata;
! pval_copy_constructor(vardata);
}
}
}
*result = *expr;
! pval_destructor(list _INLINE_TLS);
}
}
int assign_to_variable(pval *result, pval *var_ptr, pval *expr, int (*func) (pval *, pval *, pval
* INLINE_TLS) INLINE_TLS)
{
! pval *var = var_ptr->value.varptr.pvalue;
if (!var) { /* didn't parse the variable successfully */
! pval_destructor(expr _INLINE_TLS);
var_uninit(result);
if (var_ptr->cs_data.array_write) { /* I'm not sure it can happen - should check it --
Zeev */
clean_unassigned_variable_top(1 _INLINE_TLS);
***************
*** 237,247 ****
func(result, var, expr _INLINE_TLS);
*((pval *)var) = *result;
} else {
! yystype_destructor((pval *)var _INLINE_TLS);
*((pval *)var) = *expr;
*result = *expr;
}
! return yystype_copy_constructor(result);
} else { /* indexed string */
if (func) {
php3_error(E_WARNING,"Only simple assignment supported with string indices");
--- 237,247 ----
func(result, var, expr _INLINE_TLS);
*((pval *)var) = *result;
} else {
! pval_destructor((pval *)var _INLINE_TLS);
*((pval *)var) = *expr;
*result = *expr;
}
! return pval_copy_constructor(result);
} else { /* indexed string */
if (func) {
php3_error(E_WARNING,"Only simple assignment supported with string indices");
***************
*** 269,275 ****
php3_error(E_WARNING, "Illegal variable name");
var_reset(result);
if (free_varname) {
! yystype_destructor(varname _INLINE_TLS);
}
return FAILURE;
} else {
--- 269,275 ----
php3_error(E_WARNING, "Illegal variable name");
var_reset(result);
if (free_varname) {
! pval_destructor(varname _INLINE_TLS);
}
return FAILURE;
} else {
***************
*** 285,291 ****
if (free_varname) {
STR_FREE(varname->value.str.val);
}
! return yystype_copy_constructor(result);
}
}
}
--- 285,291 ----
if (free_varname) {
STR_FREE(varname->value.str.val);
}
! return pval_copy_constructor(result);
}
}
}
***************
*** 329,335 ****
return;
} else {
*result = *data;
! if (yystype_copy_constructor(result) == FAILURE) {
var_reset(result);
return;
}
--- 329,335 ----
return;
} else {
*result = *data;
! if (pval_copy_constructor(result) == FAILURE) {
var_reset(result);
return;
}
***************
*** 341,347 ****
return;
} else {
*result = *data;
! if (yystype_copy_constructor(result) == FAILURE) {
var_reset(result);
return;
}
--- 341,347 ----
return;
} else {
*result = *data;
! if (pval_copy_constructor(result) == FAILURE) {
var_reset(result);
return;
}
***************
*** 356,364 ****
int incdec_variable(pval *result, pval *var_ptr, int (*func) (pval *), int post INLINE_TLS)
{
int ret=0;
! pval *var = var_ptr->value.varptr.yystype;
! if (!var_ptr->value.varptr.yystype) { /* didn't successfully parse the array */
var_reset(result);
if (var_ptr->cs_data.array_write) { /* can probably not happen - should check -- Zeev */
clean_unassigned_variable_top(1 _INLINE_TLS);
--- 356,364 ----
int incdec_variable(pval *result, pval *var_ptr, int (*func) (pval *), int post INLINE_TLS)
{
int ret=0;
! pval *var = var_ptr->value.varptr.pvalue;
! if (!var_ptr->value.varptr.pvalue) { /* didn't successfully parse the array */
var_reset(result);
if (var_ptr->cs_data.array_write) { /* can probably not happen - should check -- Zeev */
clean_unassigned_variable_top(1 _INLINE_TLS);
***************
*** 386,398 ****
}
if (post) { /* post increment, use the original value */
! *result = *((pval *)var_ptr->value.varptr.yystype);
! ret=yystype_copy_constructor(result);
}
! func(var_ptr->value.varptr.yystype);
if (!post) {
! *result = *((pval *)var_ptr->value.varptr.yystype);
! ret=yystype_copy_constructor(result);
}
return ret;
--- 386,398 ----
}
if (post) { /* post increment, use the original value */
! *result = *((pval *)var_ptr->value.varptr.pvalue);
! ret=pval_copy_constructor(result);
}
! func(var_ptr->value.varptr.pvalue);
if (!post) {
! *result = *((pval *)var_ptr->value.varptr.pvalue);
! ret=pval_copy_constructor(result);
}
return ret;
***************
*** 419,431 ****
{
if (initialize) {
result->value.ht = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(result->value.ht, 0, NULL, pval_DESTRUCTOR, 0);
result->type = IS_ARRAY;
}
if (index) {
if (index->type == IS_STRING) {
_php3_hash_update(result->value.ht, index->value.str.val, index->value.str.len+1,
value, sizeof(pval),NULL);
! yystype_destructor(index _INLINE_TLS);
return;
} else if (index->type == IS_LONG || index->type == IS_DOUBLE) {
if (index->type == IS_DOUBLE) {
--- 419,431 ----
{
if (initialize) {
result->value.ht = (HashTable *) emalloc(sizeof(HashTable));
! _php3_hash_init(result->value.ht, 0, NULL, PVAL_DESTRUCTOR, 0);
result->type = IS_ARRAY;
}
if (index) {
if (index->type == IS_STRING) {
_php3_hash_update(result->value.ht, index->value.str.val, index->value.str.len+1,
value, sizeof(pval),NULL);
! pval_destructor(index _INLINE_TLS);
return;
} else if (index->type == IS_LONG || index->type == IS_DOUBLE) {
if (index->type == IS_DOUBLE) {
***************
*** 433,440 ****
}
_php3_hash_index_update(result->value.ht, index->value.lval, value, sizeof(pval),NULL);
} else {
! yystype_destructor(index _INLINE_TLS);
! yystype_destructor(value _INLINE_TLS);
var_reset(result);
}
} else {
--- 433,440 ----
}
_php3_hash_index_update(result->value.ht, index->value.lval, value, sizeof(pval),NULL);
} else {
! pval_destructor(index _INLINE_TLS);
! pval_destructor(value _INLINE_TLS);
var_reset(result);
}
} else {
***************
*** 458,465 ****
if (!var_ptr || var_ptr->cs_data.array_write) { /* variable didn't exist before unset(),
remove it completely */
clean_unassigned_variable_top(1 _INLINE_TLS);
} else {
! var = var_ptr->value.varptr.yystype;
! yystype_destructor(var _INLINE_TLS);
var->value.str.val = undefined_variable_string;
var->value.str.len=0;
var->type = IS_STRING;
--- 458,465 ----
if (!var_ptr || var_ptr->cs_data.array_write) { /* variable didn't exist before unset(),
remove it completely */
clean_unassigned_variable_top(1 _INLINE_TLS);
} else {
! var = var_ptr->value.varptr.pvalue;
! pval_destructor(var _INLINE_TLS);
var->value.str.val = undefined_variable_string;
var->value.str.len=0;
var->type = IS_STRING;
***************
*** 478,484 ****
pval *var;
result->type = IS_LONG;
! if (!var_ptr || var_ptr->cs_data.array_write || !(var=var_ptr->value.varptr.yystype)
|| (var->type == IS_STRING && var->value.str.val==undefined_variable_string)) {
result->value.lval=0;
if (var_ptr && var_ptr->cs_data.array_write) {
--- 478,484 ----
pval *var;
result->type = IS_LONG;
! if (!var_ptr || var_ptr->cs_data.array_write || !(var=var_ptr->value.varptr.pvalue)
|| (var->type == IS_STRING && var->value.str.val==undefined_variable_string)) {
result->value.lval=0;
if (var_ptr && var_ptr->cs_data.array_write) {
***************
*** 500,513 ****
php3_isset(result,var_ptr);
if (result->value.lval) { /* variable is set */
! pval var = *((pval *) var_ptr->value.varptr.yystype);
if ((var.type == IS_STRING) && (var.value.str.len == 1) &&
(var.value.str.val[0] == '0')) {
/* don't consider "0" as empty */
result->value.lval=0;
} else {
! yystype_copy_constructor(&var);
! if (yystype_true(&var)) {
result->value.lval=0;
}
result->value.lval=0;
--- 500,513 ----
php3_isset(result,var_ptr);
if (result->value.lval) { /* variable is set */
! pval var = *((pval *) var_ptr->value.varptr.pvalue);
if ((var.type == IS_STRING) && (var.value.str.len == 1) &&
(var.value.str.val[0] == '0')) {
/* don't consider "0" as empty */
result->value.lval=0;
} else {
! pval_copy_constructor(&var);
! if (pval_is_true(&var)) {
result->value.lval=0;
}
result->value.lval=0;
***************
*** 538,554 ****
void get_object_property(pval *result, pval *class_ptr, pval *varname INLINE_TLS)
{
! pval *data,*object=(pval *) class_ptr->value.varptr.yystype;
var_reset(result);
if (!object) {
! yystype_destructor(varname _INLINE_TLS);
return;
}
if (varname->type != IS_STRING) {
php3_error(E_WARNING, "Cannot use a numeric value as a variable name");
! yystype_destructor(varname _INLINE_TLS);
return;
}
if (_php3_hash_find(object->value.ht, varname->value.str.val, varname->value.str.len+1,
(void **) &data) == FAILURE) {
--- 538,554 ----
void get_object_property(pval *result, pval *class_ptr, pval *varname INLINE_TLS)
{
! pval *data,*object=(pval *) class_ptr->value.varptr.pvalue;
var_reset(result);
if (!object) {
! pval_destructor(varname _INLINE_TLS);
return;
}
if (varname->type != IS_STRING) {
php3_error(E_WARNING, "Cannot use a numeric value as a variable name");
! pval_destructor(varname _INLINE_TLS);
return;
}
if (_php3_hash_find(object->value.ht, varname->value.str.val, varname->value.str.len+1,
(void **) &data) == FAILURE) {
***************
*** 558,570 ****
return;
} else {
*result = *data;
! yystype_copy_constructor(result);
STR_FREE(varname->value.str.val);
}
}
! /* Use varptr.yystype to maintain a pointer to the right symbol table.
* At the end of the parsing, we should be pointing to the right symbol table.
* 'parent' doesn't have to be cleaned since its just a pointer and doesn't
* contain any actual data.
--- 558,570 ----
return;
} else {
*result = *data;
! pval_copy_constructor(result);
STR_FREE(varname->value.str.val);
}
}
! /* Use varptr.pvalue to maintain a pointer to the right symbol table.
* At the end of the parsing, we should be pointing to the right symbol table.
* 'parent' doesn't have to be cleaned since its just a pointer and doesn't
* contain any actual data.
***************
*** 576,585 ****
pval *data;
if (parent) {
! pval *object=(pval *) parent->value.varptr.yystype;
if (!object) {
! result->value.varptr.yystype=NULL;
return;
}
target_symbol_table = object->value.ht;
--- 576,585 ----
pval *data;
if (parent) {
! pval *object=(pval *) parent->value.varptr.pvalue;
if (!object) {
! result->value.varptr.pvalue=NULL;
return;
}
target_symbol_table = object->value.ht;
***************
*** 593,607 ****
if (_php3_hash_find(target_symbol_table, child->value.str.val, child->value.str.len+1,
(void **) &data) == FAILURE) {
php3_error(E_WARNING, "Object %s not found", child->value.str.val);
! result->value.varptr.yystype=NULL;
return;
}
if (data->type != IS_OBJECT) {
php3_error(E_WARNING, "$%s is not an object", child->value.str.val);
! result->value.varptr.yystype=NULL;
return;
}
! result->value.varptr.yystype = data; /* not running copy constructor intentionally */
}
}
--- 593,607 ----
if (_php3_hash_find(target_symbol_table, child->value.str.val, child->value.str.len+1,
(void **) &data) == FAILURE) {
php3_error(E_WARNING, "Object %s not found", child->value.str.val);
! result->value.varptr.pvalue=NULL;
return;
}
if (data->type != IS_OBJECT) {
php3_error(E_WARNING, "$%s is not an object", child->value.str.val);
! result->value.varptr.pvalue=NULL;
return;
}
! result->value.varptr.pvalue = data; /* not running copy constructor intentionally */
}
}
***************
*** 619,630 ****
}
*result = *data;
result->type = IS_OBJECT;
! yystype_copy_constructor(result);
if (implicit_ctor) {
if (call_user_function(NULL, result, classname, &ctor_retval, 0, NULL)==SUCCESS) {
! yystype_destructor(&ctor_retval _INLINE_TLS);
}
! yystype_destructor(classname _INLINE_TLS);
}
}
}
--- 619,630 ----
}
*result = *data;
result->type = IS_OBJECT;
! pval_copy_constructor(result);
if (implicit_ctor) {
if (call_user_function(NULL, result, classname, &ctor_retval, 0, NULL)==SUCCESS) {
! pval_destructor(&ctor_retval _INLINE_TLS);
}
! pval_destructor(classname _INLINE_TLS);
}
}
}
***************
*** 632,638 ****
void read_pointer_value(pval *result,pval *var_ptr INLINE_TLS)
{
! pval *var=var_ptr->value.varptr.yystype;
if (var) {
if (var_ptr->cs_data.array_write || (var->type==IS_STRING &&
var->value.str.val==undefined_variable_string)) {
--- 632,638 ----
void read_pointer_value(pval *result,pval *var_ptr INLINE_TLS)
{
! pval *var=var_ptr->value.varptr.pvalue;
if (var) {
if (var_ptr->cs_data.array_write || (var->type==IS_STRING &&
var->value.str.val==undefined_variable_string)) {
***************
*** 657,663 ****
} else {
if (var_ptr->value.str.len == -1) { /* not indexed string */
*result = *((pval *)var);
! yystype_copy_constructor(result);
} else { /* indexed string */
result->value.str.val = (char *) emalloc(2);
result->value.str.val[0]=var->value.str.val[var_ptr->value.str.len];
--- 657,663 ----
} else {
if (var_ptr->value.str.len == -1) { /* not indexed string */
*result = *((pval *)var);
! pval_copy_constructor(result);
} else { /* indexed string */
result->value.str.val = (char *) emalloc(2);
result->value.str.val[0]=var->value.str.val[var_ptr->value.str.len];
***************
*** 677,683 ****
if (GLOBAL(Execute)) {
if ((varname->type != IS_STRING)) {
php3_error(E_WARNING,"Illegal variable name");
! result->value.varptr.yystype = NULL;
return;
} else {
pval *data;
--- 677,683 ----
if (GLOBAL(Execute)) {
if ((varname->type != IS_STRING)) {
php3_error(E_WARNING,"Illegal variable name");
! result->value.varptr.pvalue = NULL;
return;
} else {
pval *data;
***************
*** 698,707 ****
} else {
result->cs_data.array_write = 0;
}
! result->value.varptr.yystype = data;
result->value.str.len = -1; /* Not indexed string */
}
! yystype_destructor(varname _INLINE_TLS);
}
}
--- 698,707 ----
} else {
result->cs_data.array_write = 0;
}
! result->value.varptr.pvalue = data;
result->value.str.len = -1; /* Not indexed string */
}
! pval_destructor(varname _INLINE_TLS);
}
}
Index: php31/main/variables.h
diff -c php31/main/variables.h:2.3 php31/main/variables.h:2.4
*** php31/main/variables.h:2.3 Thu Sep 10 19:17:09 1998
--- php31/main/variables.h Thu Sep 10 20:22:53 1998
***************
*** 29,35 ****
*/
! /* $Id: variables.h,v 2.3 1998/09/10 23:17:09 zeev Exp $ */
#ifndef _VARIABLES_H
--- 29,35 ----
*/
! /* $Id: variables.h,v 2.4 1998/09/11 00:22:53 zeev Exp $ */
#ifndef _VARIABLES_H
***************
*** 45,51 ****
extern int incdec_variable(pval *result, pval *varname, int (*func) (pval *), int post
INLINE_TLS);
/*not used ?? extern void incdec_class_variable(pval *result, pval *classname, pval *varname, int
(*func) (pval *), int post);*/
extern void print_variable(pval *var INLINE_TLS);
! extern int is_not_internal_function(pval *yystype);
extern void array_assign_next(pval *result, pval *varname, pval *expr);
extern void add_array_pair_list(pval *result, pval *idx, pval *value, int initialize INLINE_TLS);
extern void declare_class_variable(pval *varname, pval *expr INLINE_TLS);
--- 45,51 ----
extern int incdec_variable(pval *result, pval *varname, int (*func) (pval *), int post
INLINE_TLS);
/*not used ?? extern void incdec_class_variable(pval *result, pval *classname, pval *varname, int
(*func) (pval *), int post);*/
extern void print_variable(pval *var INLINE_TLS);
! extern int is_not_internal_function(pval *pvalue);
extern void array_assign_next(pval *result, pval *varname, pval *expr);
extern void add_array_pair_list(pval *result, pval *idx, pval *value, int initialize INLINE_TLS);
extern void declare_class_variable(pval *varname, pval *expr INLINE_TLS);
***************
*** 54,64 ****
extern void assign_new_object(pval *result, pval *classname, unsigned char implicit_ctor
INLINE_TLS);
! extern PHPAPI void php3tls_yystype_destructor(pval *yystype);
! extern void yystype_destructor(pval *yystype INLINE_TLS);
! extern PHPAPI int yystype_copy_constructor(pval *yystype);
! #define pval_DESTRUCTOR (void (*)(void *)) yystype_destructor
! #define pval_COPY_CTOR (void (*)(void *)) yystype_copy_constructor
/* Internal functions which have a YACC rule */
extern void php3_unset(pval *result, pval *var_ptr);
--- 54,64 ----
extern void assign_new_object(pval *result, pval *classname, unsigned char implicit_ctor
INLINE_TLS);
! extern PHPAPI void php3tls_pval_destructor(pval *pvalue);
! extern void pval_destructor(pval *pvalue INLINE_TLS);
! extern PHPAPI int pval_copy_constructor(pval *pvalue);
! #define PVAL_DESTRUCTOR (void (*)(void *)) pval_destructor
! #define PVAL_COPY_CTOR (void (*)(void *)) pval_copy_constructor
/* Internal functions which have a YACC rule */
extern void php3_unset(pval *result, pval *var_ptr);
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net