pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.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"   #include <math.h> - RCSID("$Id: operators.c,v 1.124 2001/02/20 13:02:12 grubba Exp $"); + RCSID("$Id: operators.c,v 1.125 2001/02/20 15:59:49 grubba Exp $");   #include "interpret.h"   #include "svalue.h"   #include "multiset.h"   #include "mapping.h"   #include "array.h"   #include "stralloc.h"   #include "opcodes.h"   #include "operators.h"   #include "language.h"   #include "pike_memory.h"
pike.git/src/operators.c:1084:    (sp[-2].type == T_FUNCTION)))    {    if (sp[-2].type != T_TYPE)    {    struct program *p = program_from_svalue(sp - 2);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`&", 1, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    free_svalue(sp - 2);    sp[-2].u.string = pop_unfinished_type();    sp[-2].type = T_TYPE;    }    if (sp[-1].type != T_TYPE)    {    struct program *p = program_from_svalue(sp - 1);    if (!p)    {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`&", 2, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    free_svalue(sp - 1);    sp[-1].u.string = pop_unfinished_type();    sp[-1].type = T_TYPE;    }    }    else if (sp[-2].type==T_MAPPING)    switch (sp[-1].type)    {    case T_ARRAY:    {
pike.git/src/operators.c:1203:    struct pike_string *a;    struct pike_string *b;    struct pike_string *t;       p = program_from_svalue(sp - 2);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`&", 1, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    a = pop_unfinished_type();       p = program_from_svalue(sp - 1);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`&", 2, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    b = pop_unfinished_type();       t = and_pike_types(a, b);       pop_n_elems(2);    push_string(t);    sp[-1].type = T_TYPE;    free_string(a);    free_string(b);    return;
pike.git/src/operators.c:1431:    (sp[-1].type == T_FUNCTION)) &&    ((sp[-2].type == T_TYPE) || (sp[-2].type == T_PROGRAM) ||    (sp[-2].type == T_FUNCTION))) {    if (sp[-2].type != T_TYPE) {    struct program *p = program_from_svalue(sp - 2);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`|", 1, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    free_svalue(sp - 2);    sp[-2].u.string = pop_unfinished_type();    sp[-2].type = T_TYPE;    }    if (sp[-1].type != T_TYPE) {    struct program *p = program_from_svalue(sp - 1);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`|", 2, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    free_svalue(sp - 1);    sp[-1].u.string = pop_unfinished_type();    sp[-1].type = T_TYPE;    }    } else {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`|", 2, get_name_of_type(sp[-2].type));    }    }   
pike.git/src/operators.c:1520:    struct pike_string *a;    struct pike_string *b;    struct pike_string *t;       p = program_from_svalue(sp - 2);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`|", 1, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    a = pop_unfinished_type();       p = program_from_svalue(sp - 1);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`|", 2, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    b = pop_unfinished_type();       t = or_pike_types(a, b, 0);       pop_n_elems(2);    push_string(t);    sp[-1].type = T_TYPE;    free_string(a);    free_string(b);    return;
pike.git/src/operators.c:1649:    (sp[-1].type == T_FUNCTION)) &&    ((sp[-2].type == T_TYPE) || (sp[-2].type == T_PROGRAM) ||    (sp[-2].type == T_FUNCTION))) {    if (sp[-2].type != T_TYPE) {    struct program *p = program_from_svalue(sp - 2);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`^", 1, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    free_svalue(sp - 2);    sp[-2].u.string = pop_unfinished_type();    sp[-2].type = T_TYPE;    }    if (sp[-1].type != T_TYPE) {    struct program *p = program_from_svalue(sp - 1);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`^", 2, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    free_svalue(sp - 1);    sp[-1].u.string = pop_unfinished_type();    sp[-1].type = T_TYPE;    }    } else {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`^", 2, get_name_of_type(sp[-2].type));    }    }   
pike.git/src/operators.c:1725:    case T_PROGRAM:    {    struct program *p;       p = program_from_svalue(sp - 1);    if (!p) {    int args = 2;    SIMPLE_BAD_ARG_ERROR("`^", 2, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    pop_stack();    push_string(pop_unfinished_type());    sp[-1].type = T_TYPE;       stack_swap();       p = program_from_svalue(sp - 1);    if (!p) {    int args = 2;    stack_swap();    SIMPLE_BAD_ARG_ERROR("`^", 1, "type");    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    pop_stack();    push_string(pop_unfinished_type());    sp[-1].type = T_TYPE;    }    /* FALL_THROUGH */    case T_TYPE:    {    /* a ^ b == (a&~b)|(~a&b) */    struct pike_string *a;    struct pike_string *b;
pike.git/src/operators.c:2865:       case T_FUNCTION:    case T_PROGRAM:    {    /* !object(p) */    struct program *p = program_from_svalue(sp - 1);    if (!p) {    PIKE_ERROR("`~", "Bad argument.\n", sp, 1);    }    type_stack_mark(); -  push_type_int(p->id); -  push_type(0); -  push_type(T_OBJECT); +  push_object_type(0, p->id);    push_type(T_NOT);    pop_stack();    push_string(pop_unfinished_type());    sp[-1].type = T_TYPE;    }    break;       case T_STRING:    {    struct pike_string *s;