pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: pike_types.c,v 1.176 2001/03/31 16:07:39 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.177 2001/04/01 15:40:21 grubba Exp $");   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"   #include "constants.h"   #include "object.h"   #include "multiset.h"
pike.git/src/pike_types.c:571:    add_ref(name);    *Pike_compiler->type_stackp = mk_type(PIKE_T_NAME,    (void *)name,    *Pike_compiler->type_stackp,    PT_COPY_CDR);    TYPE_STACK_DEBUG("push_type_name");   }      void debug_push_finished_type(struct pike_type *t)   { -  copy_type(*(++Pike_compiler->type_stackp), t); +  copy_pike_type(*(++Pike_compiler->type_stackp), t);       TYPE_STACK_DEBUG("push_finished_type");   }      void debug_push_type(unsigned INT16 type)   {    /* fprintf(stderr, "push_type(%d)\n", type); */       switch(type) {    case T_FUNCTION:
pike.git/src/pike_types.c:3430:   }      struct pike_type *index_type(struct pike_type *type,    struct pike_type *index_type,    node *n)   {    struct pike_type *t;    clear_markers();    t = low_index_type(type, index_type, n);    if(!t) { -  copy_type(t, mixed_type_string); +  copy_pike_type(t, mixed_type_string);    }    return t;   }         static struct pike_type *low_array_value_type(struct pike_type *arr_t)   {    struct pike_type *res = NULL;    struct pike_type *sub_t;   
pike.git/src/pike_types.c:3458:    free_type(sub_t);    res = new;    } else {    res = sub_t;    }    }    }    if (arr_t->type != T_ARRAY)    return res;    -  copy_type(sub_t, arr_t->car); +  copy_pike_type(sub_t, arr_t->car);       if (res) {    struct pike_type *new = or_pike_types(res, sub_t, 1);    free_type(res);    free_type(sub_t);    return new;    }    return sub_t;   }      struct pike_type *array_value_type(struct pike_type *array_type)   {    struct pike_type *t = low_array_value_type(array_type);    if (!t) { -  copy_type(t, mixed_type_string); +  copy_pike_type(t, mixed_type_string);    }    return t;   }         #ifdef DEBUG_MALLOC   #define low_key_type(X,Y) ((struct pike_type *)debug_malloc_pass(debug_low_key_type((X),(Y))))   #else   #define low_key_type debug_low_key_type   #endif
pike.git/src/pike_types.c:3553:    case PIKE_T_NAME:    return low_key_type(t->cdr, n);       case T_ARRAY:    case T_STRING: /* always int */    add_ref(int_type_string);    return int_type_string;       case T_MAPPING:    case T_MULTISET: -  copy_type(t, t->car); +  copy_pike_type(t, t->car);    return t;    }   }      struct pike_type *key_type(struct pike_type *type, node *n)   {    struct pike_type *t;    clear_markers();    t = low_key_type(type,n);    if(!t) { -  copy_type(t, mixed_type_string); +  copy_pike_type(t, mixed_type_string);    }    return t;   }            static int low_check_indexing(struct pike_type *type,    struct pike_type *index_type,    node *n)   {
pike.git/src/pike_types.c:3829:    break;       case T_FUNCTION:    if (!pike_types_le(args->type, type->car)) {    if (!match_types(args->type, type->car)) {    /* Bad arg */    } else {    /* Not strict arg */    }    } -  copy_type(tmp_type, type->cdr); +  copy_pike_type(tmp_type, type->cdr);    free_type(type);    type = tmp_type;    (*argno)++;    break;       case T_MANY:    if (!pike_types_le(args->type, type->car)) {    if (!match_types(args->type, type->car)) {    /* Bad arg */    } else {
pike.git/src/pike_types.c:3918:   }      struct pike_type *get_type_of_svalue(struct svalue *s)   {    struct pike_type *ret;    switch(s->type)    {    case T_FUNCTION:    if(s->subtype == FUNCTION_BUILTIN)    { -  copy_type(ret, s->u.efun->type); +  copy_pike_type(ret, s->u.efun->type);    }else{    struct program *p;       p=s->u.object->prog;    if(!p)    { -  copy_type(ret, zero_type_string); +  copy_pike_type(ret, zero_type_string);    }else{ -  copy_type(ret, ID_FROM_INT(p,s->subtype)->type); +  copy_pike_type(ret, ID_FROM_INT(p,s->subtype)->type);    }    }    return ret;       case T_MULTISET:    case T_ARRAY:    {    struct pike_type *arg_type;    struct array *a;       if (s->type == T_MULTISET) {    a = s->u.multiset->ind;    } else {    a = s->u.array;    }   #if 0    int i;       /* FIXME: Circular structures? */ -  copy_type(arg_type, zero_type_string); +  copy_pike_type(arg_type, zero_type_string);    for (i = 0; i < a->size; i++) {    struct pike_type *tmp1 = get_type_of_svalue(a->item+i);    struct pike_type *tmp2 = or_pike_types(arg_type, tmp1, 1);    free_type(arg_type);    free_type(tmp1);    arg_type = tmp2;    }   #else /* !0 */    if (a->size) -  copy_type(arg_type, mixed_type_string); +  copy_pike_type(arg_type, mixed_type_string);    else -  copy_type(arg_type, zero_type_string); +  copy_pike_type(arg_type, zero_type_string);   #endif /* 0 */    type_stack_mark();    push_finished_type(arg_type);    free_type(arg_type);    push_type(s->type);    return pop_unfinished_type();    }          case T_MAPPING:
pike.git/src/pike_types.c:4011:       case T_INT:    if(s->u.integer)    {    type_stack_mark();    /* Fixme, check that the integer is in range of MIN_INT32 .. MAX_INT32!    */    push_int_type(s->u.integer, s->u.integer);    return pop_unfinished_type();    }else{ -  copy_type(ret, zero_type_string); +  copy_pike_type(ret, zero_type_string);    return ret;    }       case T_PROGRAM:    {    /* FIXME: An alternative would be to push program(object(1,p->id)). */    struct pike_type *a;    struct pike_string *tmp;    int id;   
pike.git/src/pike_types.c:7621:   }      struct pike_type *get_type_of_svalue(struct svalue *s)   {    struct pike_type *ret;    switch(s->type)    {    case T_FUNCTION:    if(s->subtype == FUNCTION_BUILTIN)    { -  copy_type(ret, s->u.efun->type); +  copy_pike_type(ret, s->u.efun->type);    }else{    struct program *p;       p=s->u.object->prog;    if(!p)    { -  copy_type(ret, zero_type_string); +  copy_pike_type(ret, zero_type_string);    }else{ -  copy_type(ret, ID_FROM_INT(p,s->subtype)->type); +  copy_pike_type(ret, ID_FROM_INT(p,s->subtype)->type);    }    }    return ret;       case T_MULTISET:    case T_ARRAY:    {    struct pike_type *arg_type;    struct array *a;   
pike.git/src/pike_types.c:7660: Inside #if 0
   copy_shared_string(arg_type, zero_type_string);    for (i = 0; i < a->size; i++) {    struct pike_type *tmp1 = get_type_of_svalue(a->item+i);    struct pike_type *tmp2 = or_pike_types(arg_type, tmp1, 1);    free_type(arg_type);    free_type(tmp1);    arg_type = tmp2;    }   #else /* !0 */    if (a->size) -  copy_type(arg_type, mixed_type_string); +  copy_pike_type(arg_type, mixed_type_string);    else -  copy_type(arg_type, zero_type_string); +  copy_pike_type(arg_type, zero_type_string);   #endif /* 0 */    type_stack_mark();    push_finished_type(arg_type);    free_type(arg_type);    push_type(s->type);    return pop_unfinished_type();    }          case T_MAPPING:
pike.git/src/pike_types.c:7716:       case T_INT:    if(s->u.integer)    {    type_stack_mark();    /* Fixme, check that the integer is in range of MIN_INT32 .. MAX_INT32!    */    push_int_type(s->u.integer, s->u.integer);    return pop_unfinished_type();    }else{ -  copy_type(ret, zero_type_string); +  copy_pike_type(ret, zero_type_string);    }    return ret;       case T_PROGRAM:    {    /* FIXME: An alternative is to push PROGRAM(OBJECT(1, p->id)) */    struct pike_type *t;    int id;       if(s->u.program->identifiers)