pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*-   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin.cmod,v 1.200 2008/05/28 20:15:57 mast Exp $ + || $Id: builtin.cmod,v 1.201 2008/05/29 20:40:21 mast Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"
pike.git/src/builtin.cmod:437:    *!    *! @param all_threads    *! Trace levels are normally thread local, so changes affect only    *! the current thread. To change the level in all threads, pass a    *! nonzero value in this argument.    *!    *! @returns    *! The old trace level in the current thread is returned.    */   PMOD_EXPORT - PIKEFUN int trace(int level, void|string facility, void|int all_threads) + PIKEFUN int trace(int level, void|string facility, void|zero|int all_threads)    efun;    optflags OPT_SIDE_EFFECT;   {    INT32 old_level;    if (facility) {    struct pike_string *gc_str;    MAKE_CONST_STRING(gc_str, "gc");    if (facility == gc_str) {    old_level = gc_trace;    gc_trace = level;    }    else {    bad_arg_error("trace", Pike_sp-args, args, 2,    "trace facility identifier", Pike_sp-args+1,    "Bad argument 2 to trace(). Unknown trace facility.");    }    }    else {    old_level = Pike_interpreter.trace_level;   #ifdef PIKE_THREADS -  if (!all_threads || UNSAFE_IS_ZERO (all_threads)) +  if (!all_threads)    Pike_interpreter.trace_level = level;    else {    struct thread_state *s;    FOR_EACH_THREAD(s, s->state.trace_level = level);    }   #else    Pike_interpreter.trace_level = level;   #endif    }    RETURN old_level;
pike.git/src/builtin.cmod:910:   }      PMOD_EXPORT   PIKEFUN int get_weak_flag(multiset m)   {    RETURN multiset_get_flags(m) & MULTISET_WEAK;   }      /*! @decl program __empty_program(int|void line, string|void file)    */ - PIKEFUN program __empty_program(int|void line, string|void file) + PIKEFUN program __empty_program(int|zero|void line, string|void file)    efun;    optflags OPT_EXTERNAL_DEPEND;   { -  if (line && line->type != T_INT) -  SIMPLE_BAD_ARG_ERROR("__empty_program", 1, "int|void"); -  else { +     struct program *prog = low_allocate_program(); -  if (file) ext_store_program_line (prog, line->u.integer, file); +  if (file) ext_store_program_line (prog, line, file);    RETURN prog;   } - } +       /*! @decl string function_name(function f)    *!    *! Return the name of the function @[f].    *!    *! If @[f] is a global function defined in the runtime @expr{0@}    *! (zero) will be returned.    *!    *! @seealso    *! @[function_object()]
pike.git/src/builtin.cmod:2699:   #endif    }       PIKEFUN int `[]( string x )    {    f_Time_cq__backtick_2D_3E( args );    }       /*! @decl static void create( int fast );    *! -  *! If fast is true, do not request a new time from the system, +  *! If @[fast] is true, do not request a new time from the system,    *! instead use the global current time variable.    *!    *! This will only work in callbacks, but can save significant amounts    *! of CPU.    */ -  PIKEFUN void create( int|void fast ) +  PIKEFUN void create( int|zero|void fast )    {    THIS->hard_update = !fast;    }   }      /*! @endclass    */      /*! @class Timer    */
pike.git/src/builtin.cmod:2752:    extern struct timeval current_time;    f_Timer_peek( 0 );    THIS->last_time = current_time;    return;    }       /*! @decl static void create( int|void fast )    *! Create a new timer object. The timer keeps track of relative time    *! with sub-second precision.    *! -  *! If fast is specified, the timer will not do system calls to get +  *! If @[fast] is specified, the timer will not do system calls to get    *! the current time but instead use the one maintained by pike. This -  *! will result in faster but somewhat more inexact timekeeping. -  *! Also, if your program never utilizes the pike event loop the pike -  *! maintained current time never change. +  *! will result in faster but more or less inexact timekeeping. +  *! The pike maintained time is only updated when a @[Pike.Backend] +  *! object stops waiting and starts executing code.    */ -  PIKEFUN void create( int|void fast ) +  PIKEFUN void create( int|zero|void fast )    {    extern struct timeval current_time;    THIS->hard_update = !fast;    if( THIS->hard_update )    GETTIMEOFDAY( &current_time );    THIS->last_time = current_time;    }   }      /*! @endclass