pike.git / src / opcodes.c

version» Context lines:

pike.git/src/opcodes.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: opcodes.c,v 1.149 2003/08/05 12:58:42 mast Exp $ + || $Id: opcodes.c,v 1.150 2003/08/13 15:45:53 grubba Exp $   */      #include "global.h"   #include <errno.h>   #include <math.h>   #include <ctype.h>   #include "interpret.h"   #include "svalue.h"   #include "array.h"   #include "stralloc.h"
pike.git/src/opcodes.c:23:   #include "fd_control.h"   #include "cyclic.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "security.h"   #include "bignum.h"   #include "operators.h"      #define sp Pike_sp    - RCSID("$Id: opcodes.c,v 1.149 2003/08/05 12:58:42 mast Exp $"); + RCSID("$Id: opcodes.c,v 1.150 2003/08/13 15:45:53 grubba Exp $");      void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)   {   #ifdef PIKE_SECURITY    if(what->type <= MAX_COMPLEX)    if(!CHECK_DATA_SECURITY(what->u.array, SECURITY_BIT_INDEX))    Pike_error("Index permission denied.\n");   #endif       switch(what->type)    { - #ifdef AUTO_BIGNUM -  case T_INT: -  { -  INT_TYPE val = what->u.integer; -  -  convert_svalue_to_bignum(what); -  index_no_free(to, what, ind); -  if(IS_UNDEFINED(to)) { -  if (val) { -  if (ind->type == T_STRING && !ind->u.string->size_shift) -  Pike_error("Indexing the integer %"PRINTPIKEINT"d " -  "with unknown method \"%s\".\n", val, ind->u.string->str); -  else -  Pike_error("Indexing the integer %"PRINTPIKEINT"d with %s.\n", -  val, get_name_of_type (ind->type)); -  } else { -  if(ind->type == T_STRING && !ind->u.string->size_shift) -  Pike_error("Indexing the NULL value with \"%s\".\n", ind->u.string->str); -  else -  Pike_error("Indexing the NULL value with %s.\n", -  get_name_of_type (ind->type)); -  } -  } -  } -  break; - #endif /* AUTO_BIGNUM */ -  +     case T_ARRAY:    simple_array_index_no_free(to,what->u.array,ind);    break;       case T_MAPPING:    mapping_index_no_free(to,what->u.mapping,ind);    break;       case T_OBJECT:    object_index_no_free(to, what->u.object, ind);
pike.git/src/opcodes.c:125:    case T_FUNCTION:    {    struct program *p = program_from_svalue(what);    if (p) {    program_index_no_free(to, p, ind);    break;    }    }    /* FALL THROUGH */    + #ifdef AUTO_BIGNUM +  case T_INT: +  if (ind->type == T_STRING) { +  INT_TYPE val = what->u.integer; +  +  convert_svalue_to_bignum(what); +  index_no_free(to, what, ind); +  if(IS_UNDEFINED(to)) { +  if (val) { +  if (!ind->u.string->size_shift) +  Pike_error("Indexing the integer %"PRINTPIKEINT"d " +  "with unknown method \"%s\".\n", +  val, ind->u.string->str); +  else +  Pike_error("Indexing the integer %"PRINTPIKEINT"d " +  "with a wide string.\n", +  val); +  } else { +  if(!ind->u.string->size_shift) +  Pike_error("Indexing the NULL value with \"%s\".\n", +  ind->u.string->str); +  else +  Pike_error("Indexing the NULL value with a wide string.\n"); +  } +  } +  break; +  } +  +  /* FALL_THROUGH */ + #endif /* AUTO_BIGNUM */ +     default:    if (ind->type == T_INT)    Pike_error ("Cannot index %s with %"PRINTPIKEINT"d.\n", -  get_name_of_type (what->type), ind->u.integer); +  (what->type == T_INT && !what->u.integer)? +  "the NULL value":get_name_of_type(what->type), +  ind->u.integer);    else if (ind->type == T_FLOAT)    Pike_error ("Cannot index %s with %"PRINTPIKEFLOAT"g.\n", -  get_name_of_type (what->type), ind->u.float_number); +  (what->type == T_INT && !what->u.integer)? +  "the NULL value":get_name_of_type(what->type), +  ind->u.float_number);    else if (ind->type == T_STRING && !ind->u.string->size_shift) -  Pike_error ("Cannot index %s with \"%s\".\n", get_name_of_type (what->type), +  Pike_error ("Cannot index %s with \"%s\".\n", +  (what->type == T_INT && !what->u.integer)? +  "the NULL value":get_name_of_type(what->type),    ind->u.string->str);    else -  Pike_error ("Cannot index %s with %s.\n", get_name_of_type (what->type), +  Pike_error ("Cannot index %s with %s.\n", +  (what->type == T_INT && !what->u.integer)? +  "the NULL value":get_name_of_type(what->type),    get_name_of_type (ind->type));    }   }      void o_index(void)   {    struct svalue s;    index_no_free(&s,sp-2,sp-1);    pop_n_elems(2);    *sp=s;
pike.git/src/opcodes.c:2118:   MK_VERY_LOW_SSCANF(2,1)   MK_VERY_LOW_SSCANF(1,2)   MK_VERY_LOW_SSCANF(2,2)      /* Simplified interface to very_low_sscanf_{0,1,2}_{0,1,2}(). */   static INT32 low_sscanf(struct pike_string *data, struct pike_string *format)   {    ptrdiff_t matched_chars;    int x;    INT32 i; +  +  check_c_stack(sizeof(struct sscanf_set)*2 + 512); +     switch(data->size_shift*3 + format->size_shift) {    /* input_shift : match_shift */    case 0:    /* 0 : 0 */    i = very_low_sscanf_0_0(STR0(data), data->len,    STR0(format), format->len,    &matched_chars, &x);    break;    case 1:    /* 0 : 1 */