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.9 1996/11/18 20:56:25 hubbe Exp $"); + RCSID("$Id: pike_types.c,v 1.10 1996/11/25 21:31:54 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"   #include "mapping.h"   #include "macros.h"   #include "error.h"    -  + int max_correct_args; +    static void internal_parse_type(char **s);   static int type_length(char *t);      /*    * basic types are represented by just their value in a string    * basic type are string, int, float, object and program    * arrays are coded like by the value T_ARRAY followed by the    * data type, if the type is not known it is T_MIXED, ie:    * T_ARRAY <data type>    * mappings are followed by two arguments, the first is the type
pike.git/src/pike_types.c:642:      #define A_EXACT 1   #define B_EXACT 2      /*    * match two type strings, return zero if they don't match, and return    * the part of 'a' that _did_ match if it did.    */   static char *low_match_types(char *a,char *b, int flags)   { +  int correct_args;    char *ret;    if(a == b) return a;       switch(EXTRACT_UCHAR(a))    {    case T_AND:    a++;    ret=low_match_types(a,b,flags);    if(!ret) return 0;    a+=type_length(a);
pike.git/src/pike_types.c:705:    {    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)    {    char *a_tmp,*b_tmp;    if(EXTRACT_UCHAR(a)==T_MANY)    {    a_tmp=a+1;    }else{    a_tmp=a;
pike.git/src/pike_types.c:727:       if(EXTRACT_UCHAR(b)==T_MANY)    {    b_tmp=b+1;    }else{    b_tmp=b;    b+=type_length(b);    }       if(!low_match_types(a_tmp, b_tmp, flags)) return 0; +  if(++correct_args > max_correct_args) +  max_correct_args=correct_args;    }    /* check the 'many' type */    a++;    b++;    if(EXTRACT_UCHAR(b)==T_VOID || EXTRACT_UCHAR(a)==T_VOID)    {    a+=type_length(a);    b+=type_length(b);    }else{    if(!low_match_types(a,b,flags)) return 0;
pike.git/src/pike_types.c:997:    if(EXTRACT_UCHAR(q)!=T_VOID) return ~num;    return num;   }      struct pike_string *check_call(struct pike_string *args,    struct pike_string *type)   {    CHECK_TYPE(args);    CHECK_TYPE(type);    reset_type_stack(); +  max_correct_args=0;    if(low_get_return_type(type->str,args->str))    {    return pop_type();    }else{    return 0;    }   }      void check_array_type(struct array *a)   {