pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1: - /* $Id: master.pike.in,v 1.54 1999/08/06 22:06:36 hubbe Exp $ + /* $Id: master.pike.in,v 1.55 1999/08/27 21:40:55 hubbe Exp $    *    * Master-file for Pike.    *    * Based on master.pike 1.67.    */      // Some configurable parameters useful for debugging      // Used by describe_backtrace() et al.   #if !defined(BT_MAX_STRING_LEN) || (BT_MAX_STRING_LEN <= 0)   #undef BT_MAX_STRING_LEN - #define BT_MAX_STRING_LEN 60 + #define BT_MAX_STRING_LEN 255   #endif /* !defined(BT_MAX_STRING_LEN) || (BT_MAX_STRING_LEN <= 0) */      /*    * Functions begin here.    */      int is_absolute_path(string p)   {   #ifdef __NT__    p=replace(p,"\\","/");
pike.git/lib/master.pike.in:1041:   }      string read_include(string f)   {    object o=_static_modules.files()->Fd();    if(o->open(f,"r"))    return o->read();   }      // FIXME - string stupid_describe(mixed m) + string stupid_describe(mixed m, int maxlen)   {    switch(string typ=sprintf("%t",m))    {    case "int":    case "float":    return (string)m;       case "string": -  if(sizeof(m) < BT_MAX_STRING_LEN) +  if(sizeof(m) < maxlen)    {    string t = sprintf("%O", m); -  if (sizeof(t) < (BT_MAX_STRING_LEN + 2)) { +  if (sizeof(t) < (maxlen + 2)) {    return t;    }    t = 0;    } -  +  if(maxlen>10) +  { +  return sprintf("%O+[%d]",m[..maxlen-5],sizeof(m)-(maxlen-5)); +  }else{ +  return "string["+sizeof(m)+"]"; +  }       case "array": -  +  if(!sizeof(m)) return "({})"; +  if(maxlen<5) return "array["+sizeof(m)+"]"; +  return "({" + stupid_describe_comma_list(m,maxlen-2) +"})"; +     case "mapping": -  +  if(!sizeof(m)) return "([])"; +  return "mapping["+sizeof(m)+"]"; +     case "multiset": -  return typ+"["+sizeof(m)+"]"; +  if(!sizeof(m)) return "(<>)"; +  return "multiset["+sizeof(m)+"]";       default:    return typ;    }   }    -  + string stupid_describe_comma_list(array x, int maxlen) + { +  string ret=""; +  +  if(maxlen<0) return ",,,"+sizeof(x); +  +  for(int pos=0;pos<sizeof(x);pos++) +  { +  string tmp=stupid_describe(x[pos],maxlen); +  if(pos) ret+=","; +  ret+=tmp; +  +  if(sizeof(ret) >= maxlen) +  return ret+",,,"+(sizeof(x)-pos); +  } +  return ret; + } +    string describe_program(program p)   {    string s;    if(!p) return 0;    if(s=search(programs,p))    {    if(sscanf(reverse(s),"%s.%s",string ext,string rest) && ext=="domp")    return EXPLODE_PATH(reverse(rest))[-1];    return s;    }
pike.git/lib/master.pike.in:1131:    row="";    if(sizeof(tmp)>=3)    {    if(functionp(tmp[2]))    row=function_name(tmp[2]);    else if (stringp(tmp[2])) {    row = tmp[2];    } else    row="unknown function";    -  row+="("; -  for(int e=3;e<sizeof(tmp);e++) -  { -  row+=stupid_describe(tmp[e])+","; +  row+="("+ +  stupid_describe_comma_list(tmp[3..], BT_MAX_STRING_LEN)+ +  ") in ";    }    -  if(sizeof(tmp)>3) -  row=row[..sizeof(row)-2]; -  row+=") in "; -  } -  +     if(sizeof(tmp)>=2 && stringp(tmp[0]) && intp(tmp[1]))    {    row+="line "+tmp[1]+" in "+trim_file_name(tmp[0]);    }else{    mixed desc="Unknown program";    if(sizeof(tmp)>=3 && functionp(tmp[2]))    {    if(mixed tmp=function_object(tmp[2]))    if(tmp=object_program(tmp))    if(tmp=describe_program(tmp))