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.13 1997/01/22 05:19:45 hubbe Exp $"); + RCSID("$Id: pike_types.c,v 1.14 1997/01/27 01:28:34 hubbe 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:112:       case T_INT:    case T_FLOAT:    case T_STRING:    case T_PROGRAM:    case T_MIXED:    case T_VOID:    case T_UNKNOWN:    break;    -  +     case T_OBJECT:    t+=sizeof(INT32);    break;    }    return t-q;   }         #define STACK_SIZE 100000   static unsigned char type_stack[STACK_SIZE];
pike.git/src/pike_types.c:699:    if(low_match_types(a,b+1, flags | A_EXACT))    return 0;    return a;    }       /* 'mixed' matches anything */    if(EXTRACT_UCHAR(a) == T_MIXED && !(flags & A_EXACT)) return a;    if(EXTRACT_UCHAR(b) == T_MIXED && !(flags & B_EXACT)) return a;       /* Special case (tm) */ -  if(EXTRACT_UCHAR(a) == T_PROGRAM && EXTRACT_UCHAR(b)==T_FUNCTION) +  +  /* Handle cloning with prog() */ +  if(EXTRACT_UCHAR(a) == T_PROGRAM && +  EXTRACT_UCHAR(b)==T_FUNCTION)    {    return a;    }    -  +  /* Handle the `() operator */ +  if(EXTRACT_UCHAR(a) == T_OBJECT && +  EXTRACT_UCHAR(b)==T_FUNCTION) +  { +  struct program *p; +  if(p=id_to_program(EXTRACT_INT(a+1))) +  { +  int i=p->lfuns[LFUN_CALL]; +  if(i == -1) return 0; +  return low_match_types(ID_FROM_INT(p, i)->type->str, b, flags); +  } +  return a; +  } +     if(EXTRACT_UCHAR(a) != EXTRACT_UCHAR(b)) return 0;       ret=a;    switch(EXTRACT_UCHAR(a))    {    case T_FUNCTION:    correct_args=0;    a++;    b++;    while(EXTRACT_UCHAR(a)!=T_MANY || EXTRACT_UCHAR(b)!=T_MANY)
pike.git/src/pike_types.c:896:   {    switch(EXTRACT_UCHAR(t++))    {    case T_OBJECT:    {    struct program *p=id_to_program(EXTRACT_INT(t));    if(p)    {    if(n->token == F_ARROW)    { -  if(find_identifier("`->",p) != -1 || find_identifier("`->=",p) != -1) +  if(p->lfuns[LFUN_ARROW] != -1 || p->lfuns[LFUN_ASSIGN_ARROW] != -1)    {    reference_shared_string(mixed_type_string);    return mixed_type_string;    }    }else{ -  if(find_identifier("`[]",p) != -1 || find_identifier("`[]=",p) != -1) +  if(p->lfuns[LFUN_INDEX] != -1 || p->lfuns[LFUN_ASSIGN_INDEX] != -1)    {    reference_shared_string(mixed_type_string);    return mixed_type_string;    }    }    if(CDR(n)->token == F_CONSTANT && CDR(n)->u.sval.type==T_STRING)    {    INT32 i;    i=find_shared_string_identifier(CDR(n)->u.sval.u.string, p);    if(i==-1)
pike.git/src/pike_types.c:991:    case T_ARRAY:    return !!low_match_types(int_type_string->str, index_type,0);       case T_OBJECT:    {    struct program *p=id_to_program(EXTRACT_INT(type));    if(p)    {    if(n->token == F_ARROW)    { -  if(find_identifier("`->",p) != -1 || find_identifier("`->=",p) != -1) +  if(p->lfuns[LFUN_ARROW] != -1 || p->lfuns[LFUN_ASSIGN_ARROW] != -1)    return 1;    }else{ -  if(find_identifier("`[]",p) != -1 || find_identifier("`[]=",p) != -1) +  if(p->lfuns[LFUN_INDEX] != -1 || p->lfuns[LFUN_ASSIGN_INDEX] != -1)    return 1;    }    return !!low_match_types(string_type_string->str, index_type,0);    }else{    return 1;    }    }       case T_MULTISET:    case T_MAPPING: