pike.git / src / opcodes.c

version» Context lines:

pike.git/src/opcodes.c:1:   /*   || 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: opcodes.c,v 1.127 2002/12/01 18:53:05 mast Exp $ + || $Id: opcodes.c,v 1.128 2002/12/07 16:27:00 grubba Exp $   */      #include "global.h"   #include <errno.h>   #include <math.h>   #include <ctype.h>   #include "interpret.h"   #include "svalue.h"   #include "array.h"   #include "stralloc.h"
pike.git/src/opcodes.c:23:   #include "fd_control.h"   #include "cyclic.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "security.h"   #include "bignum.h"   #include "operators.h"      #define sp Pike_sp    - RCSID("$Id: opcodes.c,v 1.127 2002/12/01 18:53:05 mast Exp $"); + RCSID("$Id: opcodes.c,v 1.128 2002/12/07 16:27:00 grubba Exp $");      void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)   {    INT32 i;      #ifdef PIKE_SECURITY    if(what->type <= MAX_COMPLEX)    if(!CHECK_DATA_SECURITY(what->u.array, SECURITY_BIT_INDEX))    Pike_error("Index permission denied.\n");   #endif
pike.git/src/opcodes.c:134:   void o_index(void)   {    struct svalue s;    index_no_free(&s,sp-2,sp-1);    pop_n_elems(2);    *sp=s;    dmalloc_touch_svalue(sp);    sp++;   }    + /*! @class MasterObject +  */ +  + /*! @decl object cast_to_object(string str, string|void current_file) +  *! +  *! Called by the Pike runtime to cast strings to objects. +  *! +  *! @param str +  *! String to cast to object. +  *! +  *! @param current_file +  *! Filename of the file that attempts to perform the cast. +  *! +  *! @returns +  *! Returns the resulting object. +  *! +  *! @seealso +  *! @[cast_to_program()] +  */ +  + /*! @decl program cast_to_program(string str, string|void current_file) +  *! +  *! Called by the Pike runtime to cast strings to programs. +  *! +  *! @param str +  *! String to cast to object. +  *! +  *! @param current_file +  *! Filename of the file that attempts to perform the cast. +  *! +  *! @returns +  *! Returns the resulting program. +  *! +  *! @seealso +  *! @[cast_to_object()] +  */ +  + /*! @endclass +  */ +    /* Special case for casting to int. */   void o_cast_to_int(void)   {    switch(sp[-1].type)    {    case T_OBJECT:    {    struct pike_string *s;    MAKE_CONSTANT_SHARED_STRING(s, "int");    push_string(s);
pike.git/src/opcodes.c:241:    break;       case PIKE_T_INT:    break;       default:    Pike_error("Cannot cast %s to int.\n", get_name_of_type(sp[-1].type));    }   }    + /* Special case for casting to string. */   void o_cast_to_string(void)   {    char buf[200];    switch(sp[-1].type)    {    case PIKE_T_STRING:    return;       case T_OBJECT:    {
pike.git/src/opcodes.c:523:    {    case T_STRING: {    struct pike_string *file;    INT32 lineno;    if(Pike_fp->pc &&    (file = low_get_line(Pike_fp->pc, Pike_fp->context.prog, &lineno))) {    push_string(file);    }else{    push_int(0);    } +  /* FIXME: Ought to allow compile_handler to override. +  */    APPLY_MASTER("cast_to_object",2);    return;    }       case T_FUNCTION:    if (Pike_sp[-1].subtype == FUNCTION_BUILTIN) {    Pike_error("Cannot cast builtin functions to object.\n");    } else {    Pike_sp[-1].type = T_OBJECT;    }
pike.git/src/opcodes.c:552:    {    case T_STRING: {    struct pike_string *file;    INT32 lineno;    if(Pike_fp->pc &&    (file = low_get_line(Pike_fp->pc, Pike_fp->context.prog, &lineno))) {    push_string(file);    }else{    push_int(0);    } +  /* FIXME: Ought to allow compile_handler to override. +  */    APPLY_MASTER("cast_to_program",2);    return;    }       case T_FUNCTION:    {    struct program *p=program_from_function(sp-1);    if(p)    {    add_ref(p);