pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1:   /*   || 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_functions.c,v 1.450 2002/11/24 14:57:05 marcus Exp $ + || $Id: builtin_functions.c,v 1.451 2002/11/25 00:41:17 nilsson Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.450 2002/11/24 14:57:05 marcus Exp $"); + RCSID("$Id: builtin_functions.c,v 1.451 2002/11/25 00:41:17 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"   #include "constants.h"   #include "mapping.h"   #include "stralloc.h"
pike.git/src/builtin_functions.c:3371:    FIND_LFUN( Pike_sp[-args].u.object->prog, LFUN_CALL ) != -1 )    res = 1;    }    pop_n_elems(args);    push_int(res);   }   #ifndef HAVE_AND_USE_POLL   #undef HAVE_POLL   #endif    - /*! @decl void sleep(int|float s) + /*! @decl void sleep(int|float s, void|int abort_on_signal)    *!    *! This function makes the program stop for @[s] seconds.    *! -  *! Only signal handlers can interrupt the sleep. Other callbacks are -  *! not called during sleep. +  *! Only signal handlers can interrupt the sleep, and only when +  *! @[abort_on_signal] is set. If more than one thread is running +  *! the signal must be sent to the sleeping thread. Other callbacks +  *! are not called during sleep.    *!    *! @seealso -  *! @[signal()] +  *! @[signal()], @[delay()]    */   PMOD_EXPORT void f_sleep(INT32 args)   {   #ifdef HAVE_GETHRTIME    hrtime_t t0,tv;   #else    struct timeval t0,tv;   #endif       double delay=0.0;
pike.git/src/builtin_functions.c:3481:      #undef FIX_LEFT   #undef GET_TIME_ELAPSED   #undef TIME_ELAPSED      /*! @decl void delay(int|float s)    *!    *! This function makes the program stop for @[s] seconds.    *!    *! Only signal handlers can interrupt the sleep. Other callbacks are -  *! not called during sleep. Beware that this function uses busy-waiting +  *! not called during delay. Beware that this function uses busy-waiting    *! to achieve the highest possible accuracy.    *!    *! @seealso    *! @[signal()], @[sleep()]    */   PMOD_EXPORT void f_delay(INT32 args)   {   #define POLL_SLEEP_LIMIT 0.02      #ifdef HAVE_GETHRTIME
pike.git/src/builtin_functions.c:3841:    index_no_free(ITEM(a)+e, val, ITEM(tmp)+e);       Pike_sp--;    dmalloc_touch_svalue(Pike_sp);    pop_n_elems(args);    push_array(a);   }         #ifdef PIKE_DEBUG - /*! @decl void _verify_internals() + /*! @decl void verify_internals() +  *! @belongs Debug    *!    *! Perform sanity checks.    *!    *! This function goes through most of the internal Pike structures and    *! generates a fatal error if one of them is found to be out of order.    *! It is only used for debugging.    *!    *! @note    *! This function is only available if the Pike runtime has been compiled    *! with RTL debug.
pike.git/src/builtin_functions.c:3865: Inside #if defined(PIKE_DEBUG)
   INT32 tmp=d_flag;    CHECK_SECURITY_OR_ERROR(SECURITY_BIT_SECURITY,    ("_verify_internals: permission denied.\n"));    d_flag=0x7fffffff;    do_debug();    d_flag=tmp;    do_gc();    pop_n_elems(args);   }    - /*! @decl int _debug(int(0..) level) + /*! @decl int debug(int(0..) level) +  *! @belongs Debug    *!    *! Set the run-time debug level.    *!    *! @returns    *! The old debug level will be returned.    *!    *! @note    *! This function is only available if the Pike runtime has been compiled    *! with RTL debug.    */
pike.git/src/builtin_functions.c:3889: Inside #if defined(PIKE_DEBUG)
      CHECK_SECURITY_OR_ERROR(SECURITY_BIT_SECURITY,    ("_debug: permission denied.\n"));       get_all_args("_debug", args, "%i", &d);    pop_n_elems(args);    push_int(d_flag);    d_flag = d;   }    - /*! @decl int _optimizer_debug(int(0..) level) + /*! @decl int optimizer_debug(int(0..) level) +  *! @belongs Debug    *!    *! Set the optimizer debug level.    *!    *! @returns    *! The old optimizer debug level will be returned.    *!    *! @note    *! This function is only available if the Pike runtime has been compiled    *! with RTL debug.    */
pike.git/src/builtin_functions.c:3914: Inside #if defined(PIKE_DEBUG)
   CHECK_SECURITY_OR_ERROR(SECURITY_BIT_SECURITY,    ("_optimizer_debug: permission denied.\n"));       get_all_args("_optimizer_debug", args, "%i", &l);    pop_n_elems(args);    push_int(l_flag);    l_flag = l;   }       - /*! @decl int _assembler_debug(int(0..) level) + /*! @decl int assembler_debug(int(0..) level) +  *! @belongs Debug    *!    *! Set the assembler debug level.    *!    *! @returns    *! The old assembler debug level will be returned.    *!    *! @note    *! This function is only available if the Pike runtime has been compiled    *! with RTL debug.    */
pike.git/src/builtin_functions.c:3941: Inside #if defined(PIKE_DEBUG)
      get_all_args("_assembler_debug", args, "%i", &l);    pop_n_elems(args);    push_int(a_flag);    a_flag = l;   }         #ifdef YYDEBUG    - /*! @decl int _compiler_trace(int(0..) level) + /*! @decl int compiler_trace(int(0..) level) +  *! @belongs Debug    *!    *! Set the compiler trace level.    *!    *! @returns    *! The old compiler trace level will be returned.    *!    *! @note    *! This function is only available if the Pike runtime has been compiled    *! with RTL debug.    */
pike.git/src/builtin_functions.c:5681:      static struct callback_list memory_usage_callback;      struct callback *add_memory_usage_callback(callback_func call,    void *arg,    callback_func free_func)   {    return add_to_callback(&memory_usage_callback, call, arg, free_func);   }    - /*! @decl mapping(string:int) _memory_usage() + /*! @decl mapping(string:int) memory_usage() +  *! @belongs Debug    *!    *! Check memory usage.    *!    *! This function is mostly intended for debugging. It delivers a mapping    *! with information about how many arrays/mappings/strings etc. there    *! are currently allocated and how much memory they use.    *!    *! @note    *! Exactly what this function returns is version dependant.    *!
pike.git/src/builtin_functions.c:6377:    out->type_field=BIT_ARRAY;    pop_n_elems(args);    push_array(out);    return;   }      /*! @endmodule    */      #ifdef DEBUG_MALLOC - /*! @decl void _reset_dmalloc() + /*! @decl void reset_dmalloc() +  *! @belongs Debug +  *! +  *! @note +  *! Only available when compiled with dmalloc.    */   PMOD_EXPORT void f__reset_dmalloc(INT32 args)   {    CHECK_SECURITY_OR_ERROR(SECURITY_BIT_SECURITY,    ("_reset_dmalloc: permission denied.\n"));    pop_n_elems(args);    reset_debug_malloc();   }    - /*! @decl void _dmalloc_set_name(string filename, int linenumber) + /*! @decl void dmalloc_set_name(string filename, int linenumber) +  *! @belongs Debug +  *! +  *! @note +  *! Only available when compiled with dmalloc.    */   PMOD_EXPORT void f__dmalloc_set_name(INT32 args)   {    char *s;    INT_TYPE i;    extern char * dynamic_location(const char *file, int line);    extern char * dmalloc_default_location;       if(args)    {    get_all_args("_dmalloc_set_name", args, "%s%i", &s, &i);    dmalloc_default_location = dynamic_location(s, i);    }else{    dmalloc_default_location=0;    }    pop_n_elems(args);   }    - /*! @decl void _list_open_fds() + /*! @decl void list_open_fds() +  *! @belongs Debug +  *! +  *! @note +  *! Only available when comiled with dmalloc.    */   PMOD_EXPORT void f__list_open_fds(INT32 args)   {    extern void list_open_fds(void);    list_open_fds();   }   #endif      #ifdef PIKE_DEBUG - /*! @decl mapping(string:int) _locate_references(string|array|mapping| @ -  *! multiset|function|object| @ -  *! program|type o) + /*! @decl mapping(string:int) locate_references(string|array|mapping| @ +  *! multiset|function|object| @ +  *! program|type o) +  *! @belongs Debug    *!    *! This function is mostly intended for debugging. It will search through    *! all data structures in Pike looking for @[o] and print the    *! locations on stderr. @[o] can be anything but @tt{int@} or    *! @tt{float@}.    *!    *! @note    *! This function only exists if the Pike runtime has been compiled    *! with RTL debug.    */   PMOD_EXPORT void f__locate_references(INT32 args)   {    CHECK_SECURITY_OR_ERROR(SECURITY_BIT_SECURITY,    ("_locate_references: permission denied.\n"));    if(args)    locate_references(Pike_sp[-args].u.refs);    pop_n_elems(args-1);   }    - /*! @decl mixed _describe(mixed x) + /*! @decl mixed describe(mixed x) +  *! @belongs Debug    *!    *! Prints out a description of the thing @[x] to standard error.    *! The description contains various internal info associated with    *! @[x].    *!    *! @note    *! This function only exists if the Pike runtime has been compiled    *! with RTL debug.    */   PMOD_EXPORT void f__describe(INT32 args)   {    struct svalue *s;       CHECK_SECURITY_OR_ERROR(SECURITY_BIT_SECURITY,    ("_describe: permission denied.\n"));    get_all_args("_describe", args, "%*", &s);    debug_describe_svalue(debug_malloc_pass(s));    pop_n_elems(args-1);   }    - /*! @decl void _gc_set_watch(array|multiset|mapping|object|function|program|string x) + /*! @decl void gc_set_watch(array|multiset|mapping|object|function|program|string x) +  *! @belongs Debug    *!    *! Sets a watch on the given thing, so that the gc will print a    *! message whenever it's encountered. Intended to be used together    *! with breakpoints to debug the garbage collector.    *!    *! @note    *! This function only exists if the Pike runtime has been compiled    *! with RTL debug.    */   PMOD_EXPORT void f__gc_set_watch(INT32 args)
pike.git/src/builtin_functions.c:6481: Inside #if defined(PIKE_DEBUG)
   CHECK_SECURITY_OR_ERROR(SECURITY_BIT_SECURITY,    ("_gc_set_watch: permission denied.\n"));    if (args < 1)    SIMPLE_TOO_FEW_ARGS_ERROR("_gc_set_watch", 1);    if (Pike_sp[-args].type > MAX_REF_TYPE)    SIMPLE_BAD_ARG_ERROR("_gc_set_watch", 1, "reference type");    gc_watch(Pike_sp[-args].u.refs);    pop_n_elems(args);   }    - /*! @decl void _dump_backlog() + /*! @decl void dump_backlog() +  *! @belongs Debug    *!    *! Dumps the 1024 latest executed opcodes, along with the source    *! code lines, to standard error. The backlog is only collected on    *! debug level 1 or higher, set with @[_debug] or with the @tt{-d@}    *! argument on the command line.    *!    *! @note    *! This function only exists if the Pike runtime has been compiled    *! with RTL debug.    */
pike.git/src/builtin_functions.c:7543:    * Used to prototype the master object.    */    start_new_program();    ADD_PROTOTYPE("_main", tFunc(tArr(tStr) tArr(tStr),tVoid), 0);       ADD_PROTOTYPE("cast_to_object", tFunc(tString tString, tObj), 0);    ADD_PROTOTYPE("cast_to_program", tFunc(tStr tStr tOr(tVoid, tObj), tPrg(tObj)), 0);    ADD_PROTOTYPE("compile_error", tFunc(tStr tInt tStr, tVoid), 0);    ADD_PROTOTYPE("compile_warning", tFunc(tStr tInt tStr, tVoid), 0);    ADD_PROTOTYPE("decode_charset", tFunc(tStr tStr, tStr), 0); -  ADD_PROTOTYPE("describe_backtrace", tFunc(tOr(tObj, tArr(tMix)), tStr), 0); +  ADD_PROTOTYPE("describe_backtrace", tFunc(tOr(tObj, tArr(tMix)) tOr(tVoid, tInt), tStr), 0);    ADD_PROTOTYPE("handle_error", tFunc(tOr(tArr(tMix),tObj), tVoid), 0);    ADD_PROTOTYPE("handle_import",    tFunc(tStr tOr(tStr, tVoid) tOr(tObj, tVoid), tMix), 0);    ADD_PROTOTYPE("handle_include", tFunc(tStr tStr tInt, tStr), 0);    ADD_PROTOTYPE("handle_inherit", tFunc(tStr tStr tOr(tObj, tVoid), tPrg(tObj)), 0);       /* FIXME: Are these three actually supposed to be used?    * They are called by encode.c:rec_restore_value    * /grubba 2000-03-13    */