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.101 2002/12/01 18:58:20 mast Exp $ + || $Id: builtin.cmod,v 1.102 2003/01/05 00:54:02 nilsson 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:37:    *!    *! 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(Pike_sp - args))) { -  Pike_error("_describe_program(): Bad argument 1 (expected program).\n"); -  } +  if (!(p = program_from_svalue(Pike_sp - args))) +  SIMPLE_BAD_ARG_ERROR("_describe_program", 1, "program");       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);
pike.git/src/builtin.cmod:151:    if(Pike_sp[-1].type == T_STRING)    {    stack_swap();    pop_stack();    return;    }    Pike_error("Non-string returned from _sprintf()\n");    }    }    if(x->type != T_INT) -  Pike_error("Bad argument 1 to int2char.\n"); +  SIMPLE_BAD_ARG_ERROR("int2char", 1, "int");       c=x->u.integer;       if(c>=0 && c<256)    {    struct pike_string *s;    s=begin_shared_string(1);    s->str[0]=c;    RETURN end_shared_string(s);    }else{
pike.git/src/builtin.cmod:204:    if(Pike_sp[-1].type == T_STRING)    {    stack_swap();    pop_stack();    return;    }    Pike_error("Non-string returned from _sprintf()\n");    }    }    if(x->type != T_INT) -  Pike_error("Bad argument 1 to int2hex.\n"); +  SIMPLE_BAD_ARG_ERROR("int2hex", 1, "int");       c=x->u.integer;       len=1;    if(c<0) {    len++;    n=(-c)&((unsigned int)(-1));    }else{    n=c;    }
pike.git/src/builtin.cmod:677:    *! @seealso    *! @[function_object()]    */   PIKEFUN string function_name(program|function func)    efun;    optflags OPT_TRY_OPTIMIZE;   {    switch(func->type)    {    default: -  bad_arg_error("function_name", Pike_sp-args, args, 1, -  "function|program", Pike_sp-args, -  "Bad argument.\n"); +  SIMPLE_BAD_ARG_ERROR("function_name", 1, "function|program");    return; /* NOTREACHED */       case PIKE_T_PROGRAM:    {    struct program *p=func->u.program;       if(p->parent)    {    int e;    p=p->parent;