pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: pike_types.c,v 1.257 2006/08/15 10:43:57 grubba Exp $ + || $Id: pike_types.c,v 1.258 2006/10/27 18:19:42 grubba Exp $   */      #include "global.h"   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"
pike.git/src/pike_types.c:160:    case T_STRING: return "string";    case T_TYPE: return "type";    case T_ZERO: return "zero";    case T_VOID: return "void";    case T_MIXED: return "mixed";    case T_STORAGE: return "object storage";    case T_MAPPING_DATA: return "mapping_data";    case T_PIKE_FRAME: return "pike_frame";    case T_MULTISET_DATA: return "multiset_data";    case T_STRUCT_CALLABLE: return "callable"; +  case PIKE_T_GET_SET: return "getter/setter";    default: return "unknown";    }   }         #define TWOT(X,Y) (((X) << 8)+(Y))      static int low_pike_types_le(struct pike_type *a, struct pike_type *b,    int array_cnt, unsigned int flags);   static int low_check_indexing(struct pike_type *type,
pike.git/src/pike_types.c:4273:    free_string(type_t);    }    }    return pop_unfinished_type();    }else{    pop_stack_mark();    return 0;    }   }    + /* Get the type for the specified argument in a function type. +  * Argument number -1 is the return type. +  * True arguments are counted from zero. +  */ + struct pike_type *get_argument_type(struct pike_type *fun, int arg_no) + { +  loop: +  switch(fun->type) { +  case T_OR: +  return or_pike_types(get_argument_type(fun->car, arg_no), +  get_argument_type(fun->cdr, arg_no), +  1); +  case T_FUNCTION: +  if (arg_no > 0) { +  arg_no--; +  fun = fun->cdr; +  goto loop; +  } +  /* FALL_THROUGH */ +  case T_MANY: +  if (arg_no < 0) { +  add_ref(fun->cdr); +  return fun->cdr; +  } +  add_ref(fun->car); +  return fun->car; +  +  case T_MIXED: +  add_ref(fun); +  return fun; +  +  case T_ARRAY: +  if (arg_no < 0) { +  type_stack_mark(); +  push_finished_type(fun = get_argument_type(fun->car, arg_no)); +  push_type(T_ARRAY); +  free_type(fun); +  return pop_unfinished_type(); +  } +  return get_argument_type(fun->car, arg_no); +  +  default: +  add_ref(zero_type_string); +  return zero_type_string; +  } + } +    /* NOTE: type loses a reference. */   struct pike_type *new_check_call(node *fun, int *argno,    struct pike_type *type, node *args)   {    struct pike_type *tmp_type = NULL;       while (args && (args->token == F_ARG_LIST)) {    type = new_check_call(fun, argno, type, CAR(args));    args = CDR(args);    }