Branch: Tag:

2002-05-22

2002-05-22 10:00:10 by Martin Nilsson <mani@lysator.liu.se>

Make error a built in function. Since most modules use it now, it saves us a module load on startup.

Rev: lib/master.pike.in:1.199
Rev: lib/modules/error.pmod:1.7(DEAD)

6:   // Pike is distributed as GPL (General Public License)   // See the files COPYING and DISCLAIMER for more information.   // - // $Id: master.pike.in,v 1.198 2002/05/15 14:50:42 grubba Exp $ + // $Id: master.pike.in,v 1.199 2002/05/22 10:00:09 nilsson Exp $      #pike __REAL_VERSION__   
61:      // --- Functions begin here.    - #define error(X) throw( ({ (X), backtrace()/*[0..sizeof(backtrace())-2]*/ }) ) +    #define Stat _static_modules.files.Stat   #define capitalize(X) (upper_case((X)[..0])+(X)[1..])    -  + //! @appears error + //! Identical to @tt{throw( ({ sprintf(f, @args), backtrace() }) )@}. + void error(string f, mixed ... args) { +  array(array) b = backtrace(); +  if (sizeof(args)) f = sprintf(f, @args); +  throw( ({ f, b[..sizeof(b)-2] }) ); + } +    // FIXME: Should the pikeroot-things be private?   #ifdef PIKE_FAKEROOT   object o;
721:    if(program p=cast_to_program(prog,backtrace()[-2][0]))    return p(@args);    else -  error(sprintf("new: failed to find program %s.\n",prog)); +  error("Failed to find program %s.\n", prog);    }    return prog(@args);   }
738:    * that a replacing master-object may want to override.    */   constant master_efuns = ({ +  "error",    "basename",    "dirname",    "is_absolute_path",