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.114 2003/02/01 16:00:25 mast Exp $ + || $Id: builtin.cmod,v 1.115 2003/02/08 03:49: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:365:    */   PIKEFUN int trace(int level, void|string facility, void|int all_threads)    efun;    optflags OPT_SIDE_EFFECT;   {    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"); +  MAKE_CONST_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 = Pike_interpreter.trace_level;    gc_trace = level;   #ifdef PIKE_THREADS    if (!all_threads || UNSAFE_IS_ZERO (all_threads))
pike.git/src/builtin.cmod:451:    struct svalue get;       if (!params) {    push_mapping (allocate_mapping (5));    params = Pike_sp - 1;    }    else if (params->type != T_MAPPING)    SIMPLE_BAD_ARG_ERROR ("Pike.gc_parameters", 1, "void|mapping");      #define HANDLE_PARAM(NAME, CHECK_AND_SET, GET) do { \ -  MAKE_CONSTANT_SHARED_STRING (str, NAME); \ -  free_string (str); /* Got a ref above anyway. */ \ +  MAKE_CONST_STRING (str, NAME); \    if ((set = low_mapping_string_lookup (params->u.mapping, str))) { \    CHECK_AND_SET; \    } \    else { \    GET; \    mapping_string_insert (params->u.mapping, str, &get); \    } \    } while (0)      #define HANDLE_FLOAT_FACTOR(NAME, VAR) \
pike.git/src/builtin.cmod:1631:    }    pop_n_elems( args );    push_int( 0 );    Pike_sp[-1].subtype = 1;    }       PIKEFUN mixed cast( string type )    {    struct pike_string *string_t;    struct pike_string *int_t; -  MAKE_CONSTANT_SHARED_STRING( string_t, "string" ); -  MAKE_CONSTANT_SHARED_STRING( int_t, "int" ); +  MAKE_CONST_STRING( string_t, "string" ); +  MAKE_CONST_STRING( int_t, "int" );       if( type == string_t )    { -  free_string(string_t); -  free_string(int_t); +     pop_n_elems( args );    if( Pike_fp->current_object->refs != 1 )    f_Buffer_get_copy( 0 );    else    f_Buffer_get( 0 );    return;    }    -  free_string(string_t); -  +     if( type == int_t )    {    struct Buffer_struct *str = THIS; -  free_string(int_t); +     pop_stack();    if( Pike_fp->current_object->refs != 1 )    f_Buffer_get_copy( 0 );    else    f_Buffer_get( 0 );    o_cast_to_int( );    return;    } -  free_string(int_t); +     Pike_error("Cannot cast to %s\n", type->str );    }       PIKEFUN object `+( string what )    {    struct Buffer_struct *str = THIS, *str2;    struct object *res = clone_object( Buffer_program, 0 );       if( str->str.s )    {
pike.git/src/builtin.cmod:2294:    *! pike has to have been compiled with bignum support for this    *! variable to contain sensible values.    */       PIKEFUN int `->( string x )    {    extern struct timeval current_time;    struct pike_string *usec;    struct pike_string *sec;    -  MAKE_CONSTANT_SHARED_STRING( sec, "sec" ); -  free_string (sec); -  MAKE_CONSTANT_SHARED_STRING( usec, "usec" ); -  free_string (usec); +  MAKE_CONST_STRING( sec, "sec" ); +  MAKE_CONST_STRING( usec, "usec" );       if( !x )    RETURN 0;       if( THIS->hard_update )    GETTIMEOFDAY( &current_time );       if( x == usec )    RETURN current_time.tv_usec;    if( x == sec )