Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:6332:      int log_gc_timestamps;   int log_gc_histogram;   int log_gc_verbose;   int log_gc_cycles;      string format_cycle (array(mixed) cycle)   {    array(string) string_parts = ({});    foreach (cycle; int pos; mixed val) { -  /* Idea: identify mapping/array index of the next element in the cycle. -  mixed next_val; -  if (pos < sizeof (cycle) - 1) { -  next_val = cycle[pos + 1]; -  } -  */ -  +     string formatted;       if (arrayp (val)) {    formatted = sprintf ("array(%d)", sizeof (val));    } else if (mappingp (val)) {    formatted = sprintf ("mapping(%d)", sizeof (val));    } else if (multisetp (val)) {    formatted = sprintf ("multiset(%d)", sizeof (val));    } else {    formatted = sprintf ("%O", val);    } -  +  +  /* Identify object/mapping/array index of the next element in the cycle. */ +  mixed next_val; +  if (pos < sizeof (cycle) - 1) { +  next_val = cycle[pos + 1]; +  } else { +  next_val = cycle[0]; +  } +  +  if (multisetp(val)) { +  formatted += "[[index]]"; +  } else { +  array(mixed) inds = indices(val); +  array(mixed) vals = values(val); +  int i = search(vals, next_val); +  if (i >= 0) { +  // Found. +  if (intp(inds[i])) { +  formatted += sprintf("[%d]", inds[i]); +  } else if (stringp(inds[i])) { +  if (sizeof(inds[i]) < 100) { +  formatted += sprintf("[%O]", inds[i]); +  } else { +  formatted += sprintf("[string(%d characters)]", sizeof(inds[i])); +  } +  } else { +  formatted += sprintf("[%t]", inds[i]); +  } +  } else { +  i = search(inds, next_val); +  if (i >= 0) { +  formatted += "[[index]]"; +  } else if (objectp(val)) { +  formatted += "->protected"; +  } +  } +  } +     string_parts += ({ formatted });    }    -  return string_parts * " -> "; +  return string_parts * " ==> ";   }      void reinstall_gc_callbacks()   {    mapping(string:mixed) gc_params = ([ "pre_cb": 0,    "post_cb": 0,    "destruct_cb": 0,    "done_cb": 0 ]);       int gc_start;