Branch: Tag:

2001-02-19

2001-02-19 23:50:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Introduced struct pike_type in preparation for new implementation of type type.
Added copy_type() & free_type() for the same reason.
f_cast() now expects a value of type type as the first argument.

Rev: src/builtin_functions.c:1.342
Rev: src/constants.c:1.25
Rev: src/constants.h:1.16
Rev: src/docode.c:1.104
Rev: src/global.h:1.57
Rev: src/interpret.h:1.77
Rev: src/interpret_functions.h:1.45
Rev: src/language.yacc:1.224
Rev: src/las.c:1.234
Rev: src/las.h:1.47
Rev: src/opcodes.c:1.99
Rev: src/opcodes.h:1.12
Rev: src/pike_types.c:1.147
Rev: src/pike_types.h:1.48
Rev: src/program.c:1.295
Rev: src/program.h:1.116
Rev: src/svalue.h:1.76
Rev: src/treeopt.in:1.56

110:   /* This is the grammar definition of Pike. */      #include "global.h" - RCSID("$Id: language.yacc,v 1.223 2001/01/20 01:15:44 grubba Exp $"); + RCSID("$Id: language.yacc,v 1.224 2001/02/19 23:50:00 grubba Exp $");   #ifdef HAVE_MEMORY_H   #include <memory.h>   #endif
546:    check_type_string(check_node_hash($1)->u.sval.u.string);   #endif /* PIKE_DEBUG */    if(Pike_compiler->compiler_frame->current_type) -  free_string(Pike_compiler->compiler_frame->current_type); -  copy_shared_string(Pike_compiler->compiler_frame->current_type,$1->u.sval.u.string); +  free_type(Pike_compiler->compiler_frame->current_type); +  copy_type(Pike_compiler->compiler_frame->current_type, $1->u.sval.u.type);    free_node($1);    }    ;
587:    !Pike_compiler->compiler_frame->previous->current_type)    {    yyerror("Internal compiler fault."); -  copy_shared_string(Pike_compiler->compiler_frame->current_type, +  copy_type(Pike_compiler->compiler_frame->current_type,    mixed_type_string);    }else{ -  copy_shared_string(Pike_compiler->compiler_frame->current_type, +  copy_type(Pike_compiler->compiler_frame->current_type,    Pike_compiler->compiler_frame->previous->current_type);    }    }
608:    while(--$3>=0) push_type(T_ARRAY);       if(Pike_compiler->compiler_frame->current_return_type) -  free_string(Pike_compiler->compiler_frame->current_return_type); +  free_type(Pike_compiler->compiler_frame->current_return_type);    Pike_compiler->compiler_frame->current_return_type=compiler_pop_type();       push_finished_type(Pike_compiler->compiler_frame->current_return_type);
651:   #endif       new_type = or_pike_types(s, id->type, 1); -  free_string(s); +  free_type(s);    s = new_type;       fprintf(stderr, "Resulting type:\n");
681:    fprintf(stderr, "Pass %d: Identifier %s:\n",    Pike_compiler->compiler_pass, $4->u.sval.u.string->str);    -  free_string(s); -  copy_shared_string(s, id->type); +  free_type(s); +  copy_type(s, id->type);       fprintf(stderr, "Resulting type:\n");   #ifdef PIKE_DEBUG
696:    }       $<n>$=mkstrnode(s); -  free_string(s); +  free_type(s);    }      
772:    /* The following is needed to go around the optimization in    * mksoftcastnode().    */ -  free_string(local_node->type); -  copy_shared_string(local_node->type, mixed_type_string); +  free_type(local_node->type); +  copy_type(local_node->type, mixed_type_string);       check_args =    mknode(F_COMMA_EXPR, check_args,
852:    }    | modifiers type_or_error optional_stars bad_identifier    { -  free_string(compiler_pop_type()); +  free_type(compiler_pop_type());    }    '(' arguments ')' block_or_semi    {
1052:    {    struct pike_string *s=compiler_pop_type();    $$=mkstrnode(s); -  free_string(s); +  free_type(s);    }    ;   
1060:    {    struct pike_string *s=compiler_pop_type();    $$=mkstrnode(s); -  free_string(s); +  free_type(s);    }    ;   
1096:    s, s->str, $$->u.sval.u.string, $$->u.sval.u.string->str);    }   #endif /* PIKE_DEBUG */ -  free_string(s); +  free_type(s);    }    ;   
1110:    s, s->str, $$->u.sval.u.string, $$->u.sval.u.string->str);    }   #endif /* PIKE_DEBUG */ -  free_string(s); +  free_type(s);    }    ;   
1124:    s, s->str, $$->u.sval.u.string, $$->u.sval.u.string->str);    }   #endif /* PIKE_DEBUG */ -  free_string(s); +  free_type(s);    }    ;   
1406:    type=compiler_pop_type();    define_variable($2->u.sval.u.string, type,    Pike_compiler->current_modifiers); -  free_string(type); +  free_type(type);    free_node($2);    }    | optional_stars bad_identifier {}
1425:    }    $<number>$=define_variable($2->u.sval.u.string, type,    Pike_compiler->current_modifiers & (~ID_EXTERN)); -  free_string(type); +  free_type(type);    }    expr0    {
1703:    {    debug_malloc_touch(Pike_compiler->compiler_frame->current_return_type);    if(Pike_compiler->compiler_frame->current_return_type) -  free_string(Pike_compiler->compiler_frame->current_return_type); -  copy_shared_string(Pike_compiler->compiler_frame->current_return_type,any_type_string); +  free_type(Pike_compiler->compiler_frame->current_return_type); +  copy_type(Pike_compiler->compiler_frame->current_return_type, +  any_type_string);    }    func_args    {
1724:       if(type) {    push_finished_type(type); -  free_string(type); +  free_type(type);    } else    push_type(T_MIXED);   
1767:    $$ = mkidentifiernode(f);    }    free_string(name); -  free_string(type); +  free_type(type);    pop_compiler_frame();    }    | TOK_LAMBDA push_compiler_frame1 error
1787:       debug_malloc_touch(Pike_compiler->compiler_frame->current_return_type);    if(Pike_compiler->compiler_frame->current_return_type) -  free_string(Pike_compiler->compiler_frame->current_return_type); -  copy_shared_string(Pike_compiler->compiler_frame->current_return_type, -  $<n>0->u.sval.u.string); +  free_type(Pike_compiler->compiler_frame->current_return_type); +  copy_type(Pike_compiler->compiler_frame->current_return_type, +  $<n>0->u.sval.u.type);          /***/
1909:    while($1--) push_type(T_ARRAY);       if(Pike_compiler->compiler_frame->current_return_type) -  free_string(Pike_compiler->compiler_frame->current_return_type); +  free_type(Pike_compiler->compiler_frame->current_return_type);    Pike_compiler->compiler_frame->current_return_type=compiler_pop_type();       /***/
2035:    Pike_compiler->current_modifiers);    add_local_name($4->u.sval.u.string, type, 0);    -  /* free_string(type); */ +  /* free_type(type); */    free_node($4);    $$=0;    }
2117:    /* The following is needed to go around the optimization in    * mksoftcastnode().    */ -  free_string(local_node->type); -  copy_shared_string(local_node->type, mixed_type_string); +  free_type(local_node->type); +  copy_type(local_node->type, mixed_type_string);       local_node = mksoftcastnode(Pike_compiler->compiler_frame->    variable[e].type, local_node);
2158:       pop_compiler_frame();    free_node($4); -  free_string(type); +  free_type(type);    free_string(create_string);    }    ;
2656:    {    debug_malloc_touch(Pike_compiler->compiler_frame->current_return_type);    if(Pike_compiler->compiler_frame->current_return_type) -  free_string(Pike_compiler->compiler_frame->current_return_type); -  copy_shared_string(Pike_compiler->compiler_frame->current_return_type,any_type_string); +  free_type(Pike_compiler->compiler_frame->current_return_type); +  copy_type(Pike_compiler->compiler_frame->current_return_type, +  any_type_string);       /* block code */    $<number>1=Pike_compiler->num_used_modules;
2680:       if(type) {    push_finished_type(type); -  free_string(type); +  free_type(type);    } else    push_type(T_MIXED);   
2716:    $$ = mkidentifiernode(f);    }    free_string(name); -  free_string(type); +  free_type(type);    pop_compiler_frame();    }    ;
3466:    yywarning("Declaring local variable with type void "    "(converted to type zero).");    } -  free_string(type); -  copy_shared_string(type, zero_type_string); +  free_type(type); +  copy_type(type, zero_type_string);    }    frame->variable[frame->current_number_of_locals].type = type;    frame->variable[frame->current_number_of_locals].name = str;