pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*- -  * $Id: builtin.cmod,v 1.88 2002/05/11 00:29:57 nilsson Exp $ +  * $Id: builtin.cmod,v 1.89 2002/05/24 14:12:24 grubba 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:22:   #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"    - #define sp Pike_sp -  +    /*! @decl array(array(int|string)) _describe_program(program p)    *!    *! Debug function for showing the symbol table of a program.    */   PIKEFUN array(array(int|string)) _describe_program(mixed x)    efun;   {    struct program *p;    struct array *res;    int i;    -  if (!(p = program_from_svalue(sp - args))) { +  if (!(p = program_from_svalue(Pike_sp - args))) {    Pike_error("_describe_program(): Bad argument 1 (expected program).\n");    }       for (i=0; i < (int)p->num_identifier_references;i++) {    struct reference *ref = p->identifier_references + i;    struct identifier *id = ID_FROM_PTR(p, ref);    struct inherit *inh = INHERIT_FROM_PTR(p, ref);    push_int(ref->id_flags);    ref_push_string(id->name);    push_int(id->identifier_flags);    if (id->identifier_flags & IDENTIFIER_C_FUNCTION) {    push_int(-2);    } else {    push_int(id->func.offset);    }    push_int(ref->inherit_offset);    push_int(inh->inherit_level);    f_aggregate(6);    }    f_aggregate(p->num_identifier_references); -  res = sp[-1].u.array; -  sp--; +  res = Pike_sp[-1].u.array; +  Pike_sp--;    pop_n_elems(args);    push_array(res);   }      /*! @decl string basetype(mixed x)    *!    *! Same as sprintf("%t",x);    *!    *! @seealso    *! @[sprintf()]
pike.git/src/builtin.cmod:287:    if((a=(struct array *)BEGIN_CYCLIC(data,0)))    {    add_ref(a);    }else{    push_array(a=allocate_array(data->size));    SET_CYCLIC_RET(a);       for(e=0;e<a->size;e++)    index_no_free(ITEM(a)+e, ITEM(data)+e, index);    -  sp--; +  Pike_sp--;    }    END_CYCLIC();    RETURN a;   }      /*! @decl multiset mkmultiset(array a)    *!    *! This function creates a multiset from an array.    *!    *! @seealso
pike.git/src/builtin.cmod:364:    *! This is the inverse operation of @[indices()] and @[values()].    *!    *! @seealso    *! @[indices()], @[values()]    */   PIKEFUN mapping(1:2) mkmapping(array(1=mixed) ind, array(2=mixed) val)    efun;    optflags OPT_TRY_OPTIMIZE|OPT_EXTERNAL_DEPEND;   {    if(ind->size != val->size) -  bad_arg_error("mkmapping", sp-args, args, 2, "array", sp+1-args, +  bad_arg_error("mkmapping", Pike_sp-args, args, 2, "array", Pike_sp+1-args,    "mkmapping called on arrays of different sizes (%d != %d)\n",    ind->size, val->size);       RETURN mkmapping(ind, val);   }      /*! @decl int count(string haystack, string needle)    *! @belongs String    *!    *! Count the number of non-overlapping times the string @[needle] occurrs
pike.git/src/builtin.cmod:593:    * type function(mapping(1=mixed:2=mixed),1:2)|    * function(object,mixed:mixed);    *    * or similar    */    if( map->type == T_MAPPING )    {    struct svalue s;    map_delete_no_free(map->u.mapping, index, &s);    pop_n_elems(args); -  *sp=s; -  sp++; +  *Pike_sp=s; +  Pike_sp++;    }    else if (map->type == T_OBJECT && map->u.object->prog)    {    int id = FIND_LFUN(map->u.object->prog, LFUN__M_DELETE);       if( id == -1 )    SIMPLE_BAD_ARG_ERROR("m_delete", 1, "object with _m_delete");       apply_low( map->u.object, id, 1 );    stack_swap();