pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1: - /* $Id: master.pike.in,v 1.6 1998/04/10 15:23:38 grubba Exp $ + /* $Id: master.pike.in,v 1.7 1998/04/14 18:19:32 hubbe Exp $    *    * Master-file for Pike.    *    * Based on master.pike 1.67.    */      int is_absolute_path(string p)   {   #ifdef __NT__    p=replace(p,"\\","/");
pike.git/lib/master.pike.in:277:   }      /* This function is called when an error occurs that is not caught    * with catch(). It's argument consists of:    * ({ error_string, backtrace }) where backtrace is the output from the    * backtrace() efun.    */   void handle_error(mixed *trace)   {    predef::trace(0); +  if(mixed x=catch {    werror(describe_backtrace(trace)); -  +  }) +  { +  werror("Error in handle_error in master object:\n"); +  werror("%O\nOriginal error:\n%O\n",x,trace);    }    -  + } +    object new(mixed prog, mixed ... args)   {    if(stringp(prog))    prog=cast_to_program(prog,backtrace()[-2][0]);    return prog(@args);   }      /* Note that create is called before add_precompiled_program    */   void create()
pike.git/lib/master.pike.in:778:    case "array":    case "mapping":    case "multiset":    return typ+"["+sizeof(m)+"]";       default:    return sprintf("%t",m);    }   }    + 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; +  } +  +  if(mixed tmp=function_object(p)) +  if(s=describe_program(object_program(tmp))) +  return s+"."+function_name(p); +  return 0; + } +    /* It is possible that this should be a real efun,    * it is currently used by handle_error to convert a backtrace to a    * readable message.    */   string describe_backtrace(mixed *trace)   {    int e;    string ret;       if(arrayp(trace) && sizeof(trace)==2 && stringp(trace[0]))
pike.git/lib/master.pike.in:836:       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{ -  row+="Unknown program"; +  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)) +  desc=tmp;    } -  +  row+=desc;    } -  +  }    else    {    row="Destructed object";    }    ret+=row+"\n";    }    }       return ret;   }