pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.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"   #include <math.h> - RCSID("$Id: operators.c,v 1.102 2000/09/22 12:25:59 grubba Exp $"); + RCSID("$Id: operators.c,v 1.103 2000/09/22 20:41:46 grubba 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:200:    }       case BIT_STRING | BIT_INT:    case BIT_STRING | BIT_FLOAT:    case BIT_STRING | BIT_FLOAT | BIT_INT:    {    struct pike_string *r;    PCHARP buf;    char buffer[50];    int max_shift=0; +  +  if ((sp[-args].type != T_STRING) && (sp[1-args].type != T_STRING)) { +  struct svalue *save_sp = sp; +  /* We need to perform a normal addition first. +  */ +  for (e=-args; e < 0; e++) { +  if (save_sp[e].type == T_STRING) +  break; +  *(sp++) = save_sp[e]; +  } +  /* Perform the addition. */ +  f_add(args+e); +  save_sp[--e] = *(--sp); + #ifdef PIKE_DEBUG +  if (sp != save_sp) { +  fatal("f_add(): Lost track of stack %p != %p\n", sp, save_sp); +  } + #endif /* PIKE_DEBUG */ +  /* Perform the rest of the addition. */ +  f_add(-e); + #ifdef PIKE_DEBUG +  if (sp != save_sp + 1 + e) { +  fatal("f_add(): Lost track of stack (2) %p != %p\n", +  sp, save_sp + 1 + e); +  } + #endif /* PIKE_DEBUG */ +  /* Adjust the stack. */ +  save_sp[-args] = sp[-1]; +  sp = save_sp + 1 - args; +  return; +  } else { +  e = -args; +  } +  +     size=0;    for(e=-args;e<0;e++)    {    switch(sp[e].type)    {    case T_STRING:    size+=sp[e].u.string->len;    if(sp[e].u.string->size_shift > max_shift)    max_shift=sp[e].u.string->size_shift;    break;