pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.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: operators.c,v 1.
178
2003/05/15 15:
10
:
56
mast Exp $
+
|| $Id: operators.c,v 1.
179
2003/05/15 15:
33
:
30
mast Exp $
*/ #include "global.h" #include <math.h>
-
RCSID("$Id: operators.c,v 1.
178
2003/05/15 15:
10
:
56
mast Exp $");
+
RCSID("$Id: operators.c,v 1.
179
2003/05/15 15:
33
:
30
mast Exp $");
#include "interpret.h" #include "svalue.h" #include "multiset.h" #include "mapping.h" #include "array.h" #include "stralloc.h" #include "opcodes.h" #include "operators.h" #include "language.h" #include "pike_memory.h"
pike.git/src/operators.c:3531:
*! *! String index operator. */ static void f_string_assignment_index(INT32 args) { ptrdiff_t len = THIS->s->len; INT_TYPE i, p; get_all_args("string[]",args,"%i",&p); i = p < 0 ? p + len : p; if(i<0 || i>=len)
-
Pike_error("
String
index
%"PRINTPIKEINT"d is out of range "
+
Pike_error("
Index
%"PRINTPIKEINT"d is out of
string
range "
"%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n", p, -len, len - 1); else i=index_shared_string(THIS->s,i); pop_n_elems(args); push_int(i); } /*! @decl int `[]=(int i, int j) *!
pike.git/src/operators.c:3557:
union anything *u; ptrdiff_t len; get_all_args("string[]=",args,"%i%i",&p,&j); if((u=get_pointer_if_this_type(THIS->lval, T_STRING))) { len = u->string->len; i = p < 0 ? p + len : p; if(i<0 || i>=len)
-
Pike_error("
String
index
%"PRINTPIKEINT"d is out of range "
+
Pike_error("
Index
%"PRINTPIKEINT"d is out of
string
range "
"%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n", p, -len, len - 1); free_string(THIS->s); u->string=modify_shared_string(u->string,i,j); copy_shared_string(THIS->s, u->string); } else{ lvalue_to_svalue_no_free(sp,THIS->lval); sp++; dmalloc_touch_svalue(Pike_sp-1); if(sp[-1].type != T_STRING) Pike_error("string[]= failed.\n"); len = sp[-1].u.string->len; i = p < 0 ? p + len : p; if(i<0 || i>=len)
-
Pike_error("
String
index
%"PRINTPIKEINT"d is out of range "
+
Pike_error("
Index
%"PRINTPIKEINT"d is out of
string
range "
"%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n", p, -len, len - 1); sp[-1].u.string=modify_shared_string(sp[-1].u.string,i,j); assign_lvalue(THIS->lval, sp-1); pop_stack(); } pop_n_elems(args); push_int(j); }