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.151 2003/08/26 17:35:15 grubba Exp $ + || $Id: opcodes.c,v 1.152 2003/09/10 09:42:05 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.151 2003/08/26 17:35:15 grubba Exp $"); + RCSID("$Id: opcodes.c,v 1.152 2003/09/10 09:42:05 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)
pike.git/src/opcodes.c:1489:    PIKE_CONCAT(p_wchar, INPUT_SHIFT) *input, \    ptrdiff_t input_len, \    PIKE_CONCAT(p_wchar, MATCH_SHIFT) *match, \    ptrdiff_t match_len, \    ptrdiff_t *chars_matched, \    int *success) \   { \    struct svalue sval; \    INT32 matches, arg; \    ptrdiff_t cnt, eye, e, field_length = 0; \ -  int no_assign = 0, minus_flag = 0; \ +  int no_assign = 0, minus_flag = 0, plus_flag = 0; \    struct sscanf_set set; \    \    \    set.a = 0; \    success[0] = 0; \    \    eye = arg = matches = 0; \    \    for(cnt = 0; cnt < match_len; cnt++) \    { \
pike.git/src/opcodes.c:1534:    DO_IF_DEBUG( \    if(match[cnt]!='%' || match[cnt+1]=='%') \    { \    Pike_fatal("Error in sscanf.\n"); \    } \    ); \    \    no_assign=0; \    field_length=-1; \    minus_flag=0; \ +  plus_flag=0; \    \    cnt++; \    if(cnt>=match_len) \    Pike_error("Error in sscanf format string.\n"); \    \    while(1) \    { \    switch(match[cnt]) \    { \    case '*': \
pike.git/src/opcodes.c:1565:    &t,10); \    cnt = SUBTRACT_PCHARP(t, MKPCHARP(match, MATCH_SHIFT)); \    continue; \    } \    \    case '-': \    minus_flag=1; \    cnt++; \    continue; \    \ +  case '+': \ +  plus_flag=1; \ +  cnt++; \ +  continue; \ +  \    case '{': \    { \    ONERROR err; \    ptrdiff_t tmp; \    for(e=cnt+1,tmp=1;tmp;e++) \    { \    if(e>=match_len) \    { \    Pike_error("Missing %%} in format string.\n"); \    break; /* UNREACHED */ \
pike.git/src/opcodes.c:1654:    { \    chars_matched[0]=eye; \    return matches; \    } \    } \   ) \    sval.u.integer=0; \    if (minus_flag) \    { \    int x, pos=0; \ -  \ +  if (field_length >= 0) { \ +  pos = (eye += field_length); \ +  } \ +  if (plus_flag && (--field_length >= 0)) { \ +  sval.u.integer = (signed char)input[--pos]; \ +  } \    while(--field_length >= 0) \    { \ -  x = input[eye]; \ -  \ +     DO_IF_BIGNUM( \ -  if(INT_TYPE_LSH_OVERFLOW(x, pos)) \ +  if(INT_TYPE_LSH_OVERFLOW(sval.u.integer, 8)) \    { \    push_int(sval.u.integer); \    convert_stack_top_to_bignum(); \    \    while(field_length-- >= 0) \    { \ -  push_int(input[eye]); \ -  convert_stack_top_to_bignum(); \ -  push_int(pos); \ +  push_int(8); \    o_lsh(); \ -  +  push_int(input[--pos]); \    o_or(); \ -  pos+=8; \ -  eye++; \ +     } \    dmalloc_touch_svalue(Pike_sp-1); \    sval=*--sp; \    break; \    } \    ); \ -  sval.u.integer|=x<<pos; \ -  \ -  pos+=8; \ -  eye++; \ +  sval.u.integer<<=8; \ +  sval.u.integer |= input[--pos]; \    } \ -  +  } else { \ +  if (plus_flag && (--field_length >= 0)) { \ +  sval.u.integer = (signed char)input[eye++]; \    } \ -  else \ +     while(--field_length >= 0) \    { \    DO_IF_BIGNUM( \    if(INT_TYPE_LSH_OVERFLOW(sval.u.integer, 8)) \    { \    push_int(sval.u.integer); \    convert_stack_top_to_bignum(); \    \    while(field_length-- >= 0) \    { \
pike.git/src/opcodes.c:1712:    } \    dmalloc_touch_svalue(Pike_sp-1); \    sval=*--sp; \    break; \    } \    ); \    sval.u.integer<<=8; \    sval.u.integer |= input[eye]; \    eye++; \    } \ +  } \    break; \    } \    \    case 'b': \    case 'o': \    case 'd': \    case 'x': \    case 'D': \    case 'i': \    { \