pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:4451:    case "function":    if (string tmp=describe_function([function]m)) res = tmp;    break;    case "program":    if(string tmp=describe_program([program]m)) res = tmp;    break;    default:    /* object or type. */    if (catch {    if(string tmp=sprintf("%O", m)) res = tmp; +  if (sizeof(res) > maxlen) error("Too long.\n");    }) {    // Extra paranoia case. -  res = sprintf("Instance of %O", _typeof(m)); +  if (objectp(m)) { +  res = sprintf("%O(...)", object_program(m));    } -  +  }    break;    }    // Objects may have _sprintfs that output wide characters,    // and function names may be wide, etc...    res = narrowify_string(res);    if (stringp(ident[m]))    return ident[m] + "=" + res;    return res;    }   
pike.git/lib/master.pike.in:4476:    {    string ret="";       if(!sizeof(x)) return "";    if(maxlen<0) return ",,,"+sizeof(x);       int clip=min(maxlen/2,sizeof(x));    int len=maxlen;    int done=0;    +  mapping(mixed:int|string) saved_ident = ident + ([]); +     while(1)    { -  +  int saved_clipped = clipped; +  int saved_canclip = canclip; +     array(string) z=allocate(clip);    array(int) isclipped=allocate(clip);    array(int) clippable=allocate(clip);    for(int e=0;e<clip;e++)    {    clipped=0;    canclip=0;    z[e]=describe(x[e],len);    isclipped[e]=clipped;    clippable[e]=canclip;    }    -  +  clipped = saved_clipped; +  canclip = saved_canclip; +     while(1)    {    string ret = z[..clip-1]*",";    if(done || sizeof(ret)<=maxlen+1)    {    int tmp=sizeof(x)-clip-1;    clipped=`+(0,@isclipped);    if(tmp>=0)    {    clipped++;    ret+=",,,"+tmp; -  +  +  // Ensure that we don't lose any relevant ident assignments +  // due to the clipping. +  // +  // Note that this means that we may get duplicate assignments +  // for the same value and/or unused ident numbers, but this +  // is better than getting getting references to ident numbers +  // without any assignent. Cf [PIKE-141]. +  ident = saved_ident;    }    canclip++;    return ret;    }       int last_newlen=len;    int newlen;    int clipsuggest;    while(1)    {