pike.git / src / program.c

version» Context lines:

pike.git/src/program.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: program.c,v 1.630 2007/11/15 17:09:42 grubba Exp $ + || $Id: program.c,v 1.631 2007/11/15 17:41:52 grubba Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:1105:    */      /*! @decl mixed lfun::_search(mixed needle, mixed|void start)    *!    *! Search callback.    *!    *! @seealso    *! @[predef::search()]    */    - /*! @decl mixed lfun::`->symbol() + /*! @decl mixed lfun::`symbol() +  *! @decl mixed lfun::`->symbol()    *!    *! Variable retrieval callback (aka "getter").    *!    *! @note    *! Note that the @expr{symbol@} in the name can be any symbol.    *!    *! @note    *! This is not a true LFUN, since it is even more low level!    *!    *! @note    *! This function WILL be called even by inheriting programs    *! when they attempt to access the variable named @expr{symbol@}.    *!    *! @seealso    *! @[lfun::`->symbol=()], @[lfun::`->()]    */    - /*! @decl void lfun::`->symbol=(zero value) + /*! @decl void lfun::`symbol=(zero value) +  *! @decl void lfun::`->symbol=(zero value)    *!    *! Variable assignment callback (aka "setter").    *!    *! @note    *! Note that the @expr{symbol@} in the name can be any symbol.    *!    *! @note    *! This is not a true LFUN, since it is even more low level!    *!    *! @note
pike.git/src/program.c:5312:    if (!match_types(type, lfun_type->u.type)) {    my_yyerror("Type mismatch for callback function %S:", name);    yytype_error(NULL, lfun_type->u.type, type, 0);    Pike_fatal("Type mismatch!\n");    } else if (lex.pragmas & ID_STRICT_TYPES) {    yywarning("Type mismatch for callback function %S:", name);    yytype_error(NULL, lfun_type->u.type, type,    YYTE_IS_WARNING);    }    } -  } else if ((name->len > 3) && +  } else if (((name->len > 3) &&    (index_shared_string(name, 0) == '`') &&    (index_shared_string(name, 1) == '-') && -  (index_shared_string(name, 2) == '>')) { +  (index_shared_string(name, 2) == '>')) || +  ((name->len > 1) && +  (index_shared_string(name, 0) == '`') && +  ((index_shared_string(name, 1) >= 256) || +  isidchar(index_shared_string(name, 1))))) { +  /* Getter setter. */    struct pike_string *symbol = NULL;    struct pike_type *symbol_type = NULL;    struct pike_type *gs_type = NULL; -  /* Getter setter. */ +  int delta = 1; /* new-style */ +  if (index_shared_string(name, 1) == '-') { +  /* Getter setter (old-style). */ +  delta = 3; +  }    if (index_shared_string(name, name->len-1) != '=') {    /* fprintf(stderr, "Got getter: %s\n", name->str); */    gs_type = lfun_getter_type_string;    getter_setter_offset = 0; -  symbol = string_slice(name, 3, name->len-3); +  symbol = string_slice(name, delta, name->len-delta);    symbol_type = get_argument_type(type, -1); -  } else if (name->len > 4) { +  } else if (name->len > delta+1) {    /* fprintf(stderr, "Got setter: %s\n", name->str); */    gs_type = lfun_setter_type_string;    getter_setter_offset =    ((PIKE_OPCODE_T *)(((INT32 *)0) + 1)) - ((PIKE_OPCODE_T *)0); -  symbol = string_slice(name, 3, name->len-4); +  symbol = string_slice(name, delta, name->len-(delta+1));    symbol_type = get_argument_type(type, 0);    }       if (symbol) {    /* We got a getter or a setter. */    struct reference *ref;    if (!pike_types_le(type, gs_type)) {    if (!match_types(type, gs_type)) {    my_yyerror("Type mismatch for callback function %S:", name);    yytype_error(NULL, gs_type, type, 0);