Branch: Tag:

2016-02-09

2016-02-09 13:02:20 by Henrik Grubbström (Grubba) <grubba@grubba.org>

ADT.Heap: Added _sprintf().

This should make it easier to find the cause for [bug 7644 (#7644)].

13:       protected int `<(mixed other) { return value < other; }    protected int `>(mixed other) { return value > other; } +  +  protected string _sprintf(int c) +  { +  if (c != 'O') return "ADT.Heap()->Element()"; +  return sprintf("ADT.Heap()->Element(%O)[%d]", value, pos);    } -  + }      #define SWAP(X,Y) do{ mixed tmp=values[X]; (values[X]=values[Y])->pos = X; (values[Y]=tmp)->pos = Y; }while(0)   
229:       verify_heap();   } +  + protected string _sprintf(int c) + { +  if (c != 'O') return "ADT.Heap()"; +  int cnt = num_values; +  Element e = sizeof(values) && values[0]; +  if (cnt) { +  return sprintf("ADT.Heap(%d elements, top: %O)", cnt, e); +  } +  return "ADT.Heap(0 elements)"; + }