Branch: Tag:

2000-03-25

2000-03-25 21:25:31 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

better error message

Rev: lib/master.pike.in:1.106

1:   /* -*- Pike -*-    * -  * $Id: master.pike.in,v 1.105 2000/03/23 20:09:41 mast Exp $ +  * $Id: master.pike.in,v 1.106 2000/03/25 21:25:31 hubbe Exp $    *    * Master-file for Pike.    *
117:    return compile(cpp(data,name||"-", 0, handler), handler);   }    + string master_read_file(string file) + { +  object o=_static_modules.files()->Fd(); +  if(o->open(file,"r")) +  return o->read(); +  return 0; + } +    program compile_file(string file, object|void handler)   {    AUTORELOAD_CHECK_FILE(file); -  return compile(cpp(_static_modules.files()->Fd(file,"r")->read(), +  return compile(cpp(master_read_file(file),    file, 1, handler), handler);   }   
314:    mixed err=catch {    AUTORELOAD_CHECK_FILE(oname);    return programs[fname] = -  decode_value(_static_modules.files()->Fd(oname,"r")->read(), +  decode_value(master_read_file(oname),    Codec());    };    if (handler) {
561:   {    if(object o=low_cast_to_object(oname, current_file))    return o; -  error("Cast to object failed\n"); +  error(sprintf("Cast '%s' to object failed%s.\n",file, +  current_file?sprintf("for '%s'",current_file),""));   }      class dirnode
1033:    exit(0);       case "preprocess": -  _static_modules.files()->_stdout->write(cpp(_static_modules.files()->Fd(opts[1],"r")->read(),opts[1])); +  _static_modules.files()->_stdout->write(cpp(master_read_file(opts[1]), +  opts[1]));    exit(0);    }    }
1262:   string read_include(string f)   {    AUTORELOAD_CHECK_FILE(f) -  object o=_static_modules.files()->Fd(); -  if(o->open(f,"r")) -  return o->read(); +  return master_read_file(f);   }      int clipped=0;