Branch: Tag:

2005-03-22

2005-03-22 15:42:14 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Updated to the new precompile.pike. Also fixed some minor bugs.

Rev: src/builtin.cmod:1.157

2:   || 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.156 2004/04/25 19:50:18 nilsson Exp $ + || $Id: builtin.cmod,v 1.157 2005/03/22 15:42:14 grubba Exp $   */      #include "global.h"
402:    efun;    optflags OPT_SIDE_EFFECT;   { -  INT32 old_level; +  INT32 old_level = 0;    if (facility) {    struct pike_string *gc_str; -  if (facility->type != T_STRING) -  SIMPLE_BAD_ARG_ERROR("trace", 2, "void|string"); +     MAKE_CONST_STRING(gc_str, "gc"); -  if (facility->u.string == gc_str) { +  if (facility == gc_str) {    old_level = gc_trace;    gc_trace = level;    }
483:    struct svalue get;       if (!params) { -  push_mapping (allocate_mapping (5)); -  params = Pike_sp - 1; +  push_mapping (params = allocate_mapping (5));    } -  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_CONST_STRING (str, NAME); \ -  if ((set = low_mapping_string_lookup (params->u.mapping, str))) { \ +  if ((set = low_mapping_string_lookup (params, str))) { \    CHECK_AND_SET; \    } \    else { \    GET; \ -  mapping_string_insert (params->u.mapping, str, &get); \ +  mapping_string_insert (params, str, &get); \    } \    } while (0)   
537:   #undef HANDLE_PARAM   #undef HANDLE_FLOAT_FACTOR    -  REF_RETURN params->u.mapping; +  REF_RETURN params;   }      /*! @decl string ctime(int timestamp)
855:    efun;    optflags OPT_EXTERNAL_DEPEND;   { -  if (line && line->type != T_INT) -  SIMPLE_BAD_ARG_ERROR("__empty_program", 1, "int|void"); -  else if (file && file->type != T_STRING) -  SIMPLE_BAD_ARG_ERROR("__empty_program", 2, "string|void"); -  else { +     struct program *prog = low_allocate_program(); -  if (file) ext_store_program_line (prog, line->u.integer, file->u.string); +  if (file) ext_store_program_line (prog, line?line->u.integer:0, file);    RETURN prog;   } - } +       /*! @decl string function_name(function f)    *!
1916:       /*! @decl void create(array(string)|void from, array(string)|void to)    */ -  PIKEFUN void create(array(string)|void from_, array(string)|void to_) +  PIKEFUN void create(array(string)|void from, array(string)|void to)    {    int i; -  struct array *from; -  struct array *to; +     if (!args) {    push_int(0);    return;    } -  if (!from_ || !to_) { +  if (!from || !to) {    Pike_error("Bad number of arguments to create().\n");    } -  from = from_->u.array; -  to = to_->u.array; +     if (from->size != to->size) {    Pike_error("Replace must have equal-sized from and to arrays.\n");    }
2205:       /*! @decl void create(string|void del, string|void to)    */ -  PIKEFUN void create(string|void del_, string|void to_) +  PIKEFUN void create(string|void del, string|void to)    { -  struct pike_string *del; -  struct pike_string *to; -  +     /* Clean up... */    exit_single_string_replace_struct();    -  if (!del_) return; +  if (!del) return;    -  if (!to_) { +  if (!to) {    SIMPLE_BAD_ARG_ERROR("String.SingleReplace->create", 2, "string");    }    -  if (del_->u.string == to_->u.string) { +  if (del == to) {    /* No-op... */    return;    }    -  copy_shared_string(THIS->del, del = del_->u.string); -  copy_shared_string(THIS->to, to = to_->u.string); +  copy_shared_string(THIS->del, del); +  copy_shared_string(THIS->to, to);       if (del->len) {    THIS->mojt = simple_compile_memsearcher(del);
2431:    INT_TYPE w = 1;    INT_TYPE k;    for (k=bs->base; ; k+=bs->base) { -  INT_TYPE digit, t; +  INT_TYPE digit = 0, t;    if (input_left < 1 ||    (digit = bootstring_cp_to_digit( EXTRACT_PCHARP( input ) )) < 0) {    free_string_builder( &output );
2703:    */    PIKEFUN void create( int|void fast )    { -  THIS->hard_update = !fast; +  THIS->hard_update = !(fast && fast->u.integer);    }   }   
2757:    PIKEFUN void create( int|void fast )    {    extern struct timeval current_time; -  THIS->hard_update = !fast; +  THIS->hard_update = !(fast || fast->u.integer);    if( THIS->hard_update )    GETTIMEOFDAY( &current_time );    THIS->last_time = current_time;