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.102 1999/12/17 00:27:33 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.103 1999/12/17 22:45:40 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:2139:    }    return low_pike_types_le(a, b, array_cnt);    } else if ((array_cnt > 0) && (EXTRACT_UCHAR(a) == T_ARRAY)) {    while (EXTRACT_UCHAR(a) == T_ARRAY) {    a++;    if (!--array_cnt) break;    }    return low_pike_types_le(a, b, array_cnt);    }    -  if (EXTRACT_UCHAR(b) == T_MIXED) { -  /* any_type <= 'mixed' */ -  if (array_cnt <= 0) { -  /* !array(mixed) */ +  /* NOTE: void only matches void. */ +  if (EXTRACT_UCHAR(a) == T_VOID) { +  /* void <= any_type */ +  if (array_cnt >= 0) { +  /* !array(void) */ +  if (!array_cnt && (EXTRACT_UCHAR(b) == T_VOID)) {    return 1;    } -  +  return 0;    } -  +  }    -  if (EXTRACT_UCHAR(a) == T_MIXED) { -  if (array_cnt >= 0) { -  /* !array(mixed) */ +  if (EXTRACT_UCHAR(b) == T_VOID) { +  if (array_cnt <= 0) { +  /* !array(void) */    return 0;    }    }    -  if (EXTRACT_UCHAR(a) == T_VOID) { -  /* void <= any_type */ -  if (array_cnt >= 0) { -  /* !array(void) */ +  if (EXTRACT_UCHAR(b) == T_MIXED) { +  /* any_type <= 'mixed' */ +  if (array_cnt <= 0) { +  /* !array(mixed) */    return 1;    }    }    -  if (EXTRACT_UCHAR(b) == T_VOID) { -  if (array_cnt <= 0) { -  /* !array(void) */ +  if (EXTRACT_UCHAR(a) == T_MIXED) { +  if (array_cnt >= 0) { +  /* !array(mixed) */    return 0;    }    }       if (EXTRACT_UCHAR(a) == T_ZERO) {    /* void <= zero <= any_type */    if (array_cnt >= 0) {    /* !array(zero) */    return 1;    }
pike.git/src/pike_types.c:2239:    if (EXTRACT_UCHAR(a) == T_FUNCTION) {    /*    * function(A...:B) <= function(C...:D) iff C <= A && B <= D    */    /*    * function(:int) <= function(int:int)    * function(int|string:int) <= function(int:int)    * function(:int) <= function(:void)    * function(string:int) != function(int:int)    * function(int:int) != function(:int) +  * +  * FIXME: Enforcing of all required arguments?    */    a++;    b++;    while(EXTRACT_UCHAR(a)!=T_MANY || EXTRACT_UCHAR(b)!=T_MANY)    {    char *a_tmp,*b_tmp;    if(EXTRACT_UCHAR(a)==T_MANY)    {    a_tmp=a+1;    }else{
pike.git/src/pike_types.c:2262:       if(EXTRACT_UCHAR(b)==T_MANY)    {    b_tmp=b+1;    }else{    b_tmp=b;    b+=type_length(b);    }       if (EXTRACT_UCHAR(a_tmp) != T_VOID) { -  if ((EXTRACT_UCHAR(b_tmp) == T_VOID) && -  (a_tmp != a+1)) { -  /* a is not a many arg */ -  return 0; -  } +     if (!low_pike_types_le(b_tmp, a_tmp, 0)) return 0;    }    }    /* check the 'many' type */    a++;    b++;    if (EXTRACT_UCHAR(a) != T_VOID) {    if (!low_pike_types_le(b, a, 0))    return 0;    }