Branch: Tag:

2004-12-22

2004-12-22 18:46:15 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Various object subtype related fixes and FIXME:s.

Rev: src/array.c:1.178
Rev: src/backend.cmod:1.148
Rev: src/builtin_functions.c:1.584
Rev: src/cpp.c:1.157
Rev: src/error.c:1.143
Rev: src/interpret.c:1.360
Rev: src/iterators.cmod:1.57
Rev: src/language.yacc:1.352

2:   || 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: array.c,v 1.177 2004/10/21 17:29:21 nilsson Exp $ + || $Id: array.c,v 1.178 2004/12/22 18:46:14 grubba Exp $   */      #include "global.h"
806:   /* Returns 2 if no relation is established through lfun calls. */   static INLINE int lfun_cmp (const struct svalue *a, const struct svalue *b)   { +  struct program *p;    int fun;    -  if (a->type == T_OBJECT && a->u.object->prog) { -  if ((fun = FIND_LFUN(a->u.object->prog,LFUN_LT)) != -1) { +  if (a->type == T_OBJECT && (p = a->u.object->prog)) { +  if ((fun = FIND_LFUN(p->inherits[a->subtype].prog, LFUN_LT)) != -1) {    push_svalue(b); -  apply_low (a->u.object, fun, 1); +  apply_low(a->u.object, +  fun + p->inherits[a->subtype].identifier_level, 1);    if(!UNSAFE_IS_ZERO(Pike_sp-1))    {    pop_stack();
820:    pop_stack();    }    -  if ((fun = FIND_LFUN(a->u.object->prog,LFUN_GT)) != -1) { +  if ((fun = FIND_LFUN(p->inherits[a->subtype].prog, LFUN_GT)) != -1) {    push_svalue(b); -  apply_low (a->u.object, fun, 1); +  apply_low(a->u.object, +  fun + p->inherits[a->subtype].identifier_level, 1);    if(!UNSAFE_IS_ZERO(Pike_sp-1))    {    pop_stack();
831:    pop_stack();    }    -  if ((fun = FIND_LFUN(a->u.object->prog,LFUN_EQ)) != -1) { +  if ((fun = FIND_LFUN(p->inherits[a->subtype].prog, LFUN_EQ)) != -1) {    push_svalue(b); -  apply_low (a->u.object, fun, 1); +  apply_low(a->u.object, +  fun + p->inherits[a->subtype].identifier_level, 1);    if (!UNSAFE_IS_ZERO(Pike_sp-1)) {    pop_stack();    return 0;
842:    }    }    -  if(b->type == T_OBJECT && b->u.object->prog) { -  if ((fun = FIND_LFUN(b->u.object->prog,LFUN_LT)) != -1) { +  if(b->type == T_OBJECT && (p = b->u.object->prog)) { +  if ((fun = FIND_LFUN(p->inherits[b->subtype].prog, LFUN_LT)) != -1) {    push_svalue(a); -  apply_low (b->u.object, fun, 1); +  apply_low(b->u.object, +  fun + p->inherits[b->subtype].identifier_level, 1);    if(!UNSAFE_IS_ZERO(Pike_sp-1))    {    pop_stack();
854:    pop_stack();    }    -  if ((fun = FIND_LFUN(b->u.object->prog,LFUN_GT)) != -1) { +  if ((fun = FIND_LFUN(p->inherits[b->subtype].prog, LFUN_GT)) != -1) {    push_svalue(a); -  apply_low (b->u.object, fun, 1); +  apply_low(b->u.object, +  fun + p->inherits[b->subtype].identifier_level, 1);    if(!UNSAFE_IS_ZERO(Pike_sp-1))    {    pop_stack();
865:    pop_stack();    }    -  if ((fun = FIND_LFUN(b->u.object->prog,LFUN_EQ)) != -1) { +  if ((fun = FIND_LFUN(p->inherits[b->subtype].prog, LFUN_EQ)) != -1) {    push_svalue(a); -  apply_low (b->u.object, fun, 1); +  apply_low(b->u.object, +  fun + p->inherits[b->subtype].identifier_level, 1);    if (!UNSAFE_IS_ZERO(Pike_sp-1)) {    pop_stack();    return 0;
908:    return 0;       case T_OBJECT: -  if(a->u.object == b->u.object) return 0; +  if((a->u.object == b->u.object) && (a->subtype == b->subtype)) { +  return 0; +  }    break;    }    }
922: Inside #if defined(PIKE_DEBUG)
   if (a->type != T_OBJECT)    Pike_fatal ("Expected objects when both types are the same.\n");   #endif +  +  /* FIXME: Take subtype into account! */ +     if(a->u.object->prog == b->u.object->prog) {    if (a->u.object->prog) {    if(a->u.object < b->u.object) {
1026:    }       case T_OBJECT: -  if(a->u.object == b->u.object) return 0; +  if((a->u.object == b->u.object) && (a->subtype == b->subtype)) { +  return 0; +  }    break;       default:
1894:       case BIT_STRING:    case BIT_PROGRAM: -  case BIT_OBJECT: +     for(e=1; e<a->size; e++)    if(ITEM(a)[e].u.refs != ITEM(a)[0].u.refs)    break;    break;    -  +  case BIT_OBJECT:    case BIT_FUNCTION:    for(e=1; e<a->size; e++)    if(ITEM(a)[e].u.object != ITEM(a)[0].u.object ||