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.102 2003/01/08 13:59:24 grubba Exp $ + || $Id: builtin.cmod,v 1.103 2003/02/01 15:37:22 mast Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "opcodes.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"
pike.git/src/builtin.cmod:24:   #include <math.h>   #include <ctype.h>   #include "module_support.h"   #include "cyclic.h"   #include "bignum.h"   #include "main.h"   #include "operators.h"   #include "builtin_functions.h"   #include "fsort.h"   #include "port.h" + #include "gc.h"      /*! @decl array(array(int|string)) describe_program(program p)    *! @belongs Debug    *!    *! Debug function for showing the symbol table of a program.    */   PIKEFUN array(array(int|string)) _describe_program(mixed x)    efun;   {    struct program *p;
pike.git/src/builtin.cmod:322:    *!    *! The old level is returned.    *!    *! Trace level 1 or higher means that calls to Pike functions are    *! printed to stderr, level 2 or higher means calls to builtin functions    *! are printed, 3 means every opcode interpreted is printed, 4 means    *! arguments to these opcodes are printed as well.    *!    *! See the @tt{-t@} command-line option for more information.    */ - PIKEFUN int trace(int t) + PIKEFUN int trace(int level, void|string facility)    efun;    optflags OPT_SIDE_EFFECT;   { -  pop_n_elems(args); -  push_int(t_flag); -  t_flag=t; +  INT32 old_level; +  if (facility) { +  struct pike_string *gc_str; +  if (facility->type != T_STRING) +  SIMPLE_BAD_ARG_ERROR("trace", 2, "void|string"); +  MAKE_CONSTANT_SHARED_STRING(gc_str, "gc"); +  if (facility->u.string == gc_str) { +  free_string(gc_str); +  old_level = gc_trace; +  gc_trace = level;    } -  +  else { +  free_string(gc_str); +  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 = t_flag; +  t_flag = gc_trace = level; +  } +  RETURN old_level; + }      /*! @decl string ctime(int timestamp)    *!    *! Convert the output from a previous call to @[time()] into a readable    *! string containing the current year, month, day and time.    *!    *! Like @[localtime], this function might throw an error if the    *! ctime(2) call failed on the system. It's platform dependent what    *! time ranges that function can handle, e.g. Windows doesn't handle    *! a negative @[timestamp].