pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:114:   #include "compilation.h"      struct pike_string *this_program_string, *this_string, *args_string;   static struct pike_string *this_function_string;   static struct pike_string *UNDEFINED_string;      /* Common compiler subsystems */   struct pike_string *parser_system_string;   struct pike_string *type_check_system_string;    - struct pike_string *compat_lfun_destroy_string; -  +    /* NOTE: There is a corresponding list to this one in    Tools.AutoDoc.PikeObjects       If new lfuns are added it might be beneficial to also add them to    that list.   */   const char *const lfun_names[] = {   #ifdef PIKE_NEW_LFUN_LOOKUP    "__INIT",    "create", -  "_destruct", +  "_destruct destroy",    "_sprintf",    0,       "`+",    "`-",    "`*",    "`/",    "`%",    "`&",    "`|",
pike.git/src/program.c:201: Inside #if defined(PIKE_NEW_LFUN_LOOKUP)
   "_m_delete",    "_m_clear",    "_m_add",    "_atomic_get_set",    0,       "_serialize",    "_deserialize",    0,    -  "next", -  "index", -  "value", +  "_iterator_next next", +  "_iterator_index index", +  "_iterator_value value",    0,    0, /* End marker. */   #else    "__INIT",    "create", -  "_destruct", +  "_destruct destroy",    "`+",    "`-",    "`&",    "`|",    "`^",    "`<<",    "`>>",    "`*",    "`/",    "`%",
pike.git/src/program.c:266:    "_deserialize",    "_size_object",    "_random",    "`**",    "``**",    "_sqrt",    "_annotations",    "_m_clear",    "_m_add",    "_reverse", -  "next", -  "index", -  "value", +  "_iterator_next next", +  "_iterator_index index", +  "_iterator_value value",    "_atomic_get_set",   #endif   };      #ifdef PIKE_NEW_LFUN_LOOKUP   struct pike_string *lfun_strings[0x100]; -  + struct pike_string *lfun_compat_strings[0x100];   #else   struct pike_string *lfun_strings[NELEM(lfun_names)]; -  + struct pike_string *lfun_compat_strings[NELEM(lfun_names)];   #endif      static struct mapping *lfun_ids;      /* mapping(string:type) */   static struct mapping *lfun_types;      static const char *const raw_lfun_types[] = {   #ifdef PIKE_NEW_LFUN_LOOKUP    tFuncV(tNone,tVoid,tVoid), /* "__INIT", */
pike.git/src/program.c:364: Inside #if defined(PIKE_NEW_LFUN_LOOKUP)
   tFuncV(tZero,tVoid,tMix), /* "_m_delete", */    tFuncV(tNone, tVoid, tVoid), /* "_m_clear", */    tFuncV(tZero, tVoid, tVoid), /* "_m_add", */    tFuncV(tZero tZero, tVoid, tMix), /* "_atomic_get_set", */    0,       tFuncV(tObj tZero, tVoid, tVoid), /* "_serialize", */    tFuncV(tObj tZero, tVoid, tVoid), /* "_deserialize", */    0,    -  tFuncV(tNone, tZero, tMix), /* "next", */ -  tFuncV(tNone, tZero, tMix), /* "index", */ -  tFuncV(tNone, tZero, tMix), /* "value", */ +  tFuncV(tNone, tZero, tMix), /* "_iterator_next", */ +  tFuncV(tNone, tZero, tMix), /* "_iterator_index", */ +  tFuncV(tNone, tZero, tMix), /* "_iterator_value", */    0,    0, /* End marker. */      #else    tFuncV(tNone,tVoid,tVoid), /* "__INIT", */    tFuncV(tNone,tZero,tVoid), /* "create", */    tFuncV(tOr(tVoid,tInt),tVoid,tInt01), /* "_destruct", */    tFuncV(tZero,tZero,tMix), /* "`+", */    tFunc(tOr(tVoid,tZero),tMix), /* "`-", */    tFuncV(tNone,tZero,tMix), /* "`&", */
pike.git/src/program.c:431:    tFuncV(tNone, tVoid, tInt), /* "_size_object", */    tFuncV(tFunction tFunction, tVoid, tMix), /* "_random", */    tFuncV(tOr3(tInt,tFloat,tObj),tVoid,tOr3(tObj,tInt,tFloat)), /* "pow", */    tFuncV(tOr3(tInt,tFloat,tObj),tVoid,tOr3(tObj,tInt,tFloat)), /* "rpow", */    tFunc(tVoid,tMix), /* "_sqrt", */    tFuncV(tOr(tVoid,tObj) tOr(tVoid,tInt)    tOr(tInt01,tVoid),tVoid,tArray), /* "_annotations", */    tFuncV(tNone, tVoid, tVoid), /* "_m_clear", */    tFuncV(tZero, tVoid, tVoid), /* "_m_add", */    tFuncV(tNone, tOr(tZero, tVoid), tVoid), /* "_reverse", */ -  tFuncV(tNone, tZero, tMix), /* "next", */ -  tFuncV(tNone, tZero, tMix), /* "index", */ -  tFuncV(tNone, tZero, tMix), /* "value", */ +  tFuncV(tNone, tZero, tMix), /* "_iterator_next", */ +  tFuncV(tNone, tZero, tMix), /* "_iterator_index", */ +  tFuncV(tNone, tZero, tMix), /* "_iterator_value", */    tFuncV(tZero tZero, tVoid, tMix), /* "_atomic_get_set", */   #endif   };      /* These two are not true LFUNs! */   static struct pike_type *lfun_getter_type_string = NULL;   static struct pike_type *lfun_setter_type_string = NULL;      /*! @namespace lfun::    *!
pike.git/src/program.c:1647:    *!    *! @seealso    *! @[lfun::_m_delete()], @[lfun::_m_clear()]    */      /*! @decl mixed lfun::_reverse(mixed ... options)    *!    *! Called by @[reverse()].    */    - /* FIXME: lfun::next() */ - /* FIXME: lfun::index() */ - /* FIXME: lfun::prev() */ + /* FIXME: lfun::_iterator_next() */ + /* FIXME: lfun::_iterator_index() */ + /* FIXME: lfun::_iterator_prev() */      /*! @decl mixed _atomic_get_set(mixed index, mixed value)    *!    *! Get and set the value for an index atomically.    *!    *! @param index    *! Index for which to get and set the value.    *!    *! @param value    *! Value to set.
pike.git/src/program.c:8026: Inside #if defined(PIKE_DEBUG)
   if ((size_t)lfun >= NELEM(lfun_strings)) {    return find_lfun_fatal(p, lfun);    }   #endif    lfun_name = lfun_strings[lfun];       i = really_low_find_shared_string_identifier(lfun_name,    dmalloc_touch(struct program *,    p),    SEE_PROTECTED); -  -  if ((i < 0) && (lfun == LFUN__DESTRUCT)) { +  if (i < 0) { +  const struct pike_string *lfun_compat_name = lfun_compat_strings[lfun]; +  if (lfun_compat_name) {    /* Try the Pike 8.0 compatibility name. */ -  i = really_low_find_shared_string_identifier(compat_lfun_destroy_string, +  i = really_low_find_shared_string_identifier(lfun_compat_name,    dmalloc_touch(struct program *,    p),    SEE_PROTECTED);    if ((i >= 0) && !(p->flags & PROGRAM_FINISHED) && !TEST_COMPAT(8,0)) {    struct compilation *c = MAYBE_THIS_COMPILATION;    if (c && !(c->lex.pragmas & ID_NO_DEPRECATION_WARNINGS)) { -  yywarning("Compat: Substituting destroy() for _destruct()."); +  yywarning("Compat: Substituting %S() for %S().", +  lfun_compat_name, lfun_name);    }    }    } -  +  }       if (i < 0 || !(p->flags & PROGRAM_FIXED)) {    return i;    }    id = ID_FROM_INT(p, i);   #if 0    if (IDENTIFIER_IS_PIKE_FUNCTION(id->identifier_flags) &&    (id->func.offset == -1)) {    /* Function prototype. */    return -1;
pike.git/src/program.c:9448:    MAKE_CONST_STRING(parser_system_string, "parser");    MAKE_CONST_STRING(type_check_system_string, "type_check");       MAKE_CONST_STRING(compat_lfun_destroy_string, "destroy");       /* NB: One extra entry needed for lfun::destroy(). */    lfun_ids = allocate_mapping(NUM_LFUNS + 1);    lfun_types = allocate_mapping(NUM_LFUNS + 1);   #ifdef PIKE_NEW_LFUN_LOOKUP    for (i=0; i < NELEM(lfun_names); i++,n++) { +  const char *name, *compat_name;    if (!lfun_names[i]) {    n |= 0xf;    continue;    } -  +  name = lfun_names[i]; +  compat_name = strchr(name, ' '); +  if (compat_name) {    lfun_strings[n] = -  make_shared_static_string(lfun_names[i], -  strlen(lfun_names[i]), eightbit); +  make_shared_static_string(name, compat_name - name, eightbit); +  lfun_compat_strings[n] = +  make_shared_static_string(compat_name + 1, +  strlen(compat_name + 1), eightbit); +  } else { +  lfun_strings[n] = +  make_shared_static_string(name, strlen(name), eightbit); +  lfun_compat_strings[n] = NULL; +  }       SET_SVAL(id, T_INT, NUMBER_NUMBER, integer, n);    SET_SVAL(key, T_STRING, 0, string, lfun_strings[n]);    mapping_insert(lfun_ids, &key, &id);       SET_SVAL(val, T_TYPE, 0, type, make_pike_type(raw_lfun_types[i]));    mapping_insert(lfun_types, &key, &val);    -  if (n == LFUN__DESTRUCT) { -  /* Special case for lfun::destroy(). */ -  SET_SVAL(key, T_STRING, 0, string, compat_lfun_destroy_string); +  if (compat_name) { +  /* Special case for lfun::destroy() et al. */ +  SET_SVAL(key, T_STRING, 0, string, lfun_compat_strings[n]);    /* FIXME: Adjust the type to be __deprecated__? */    mapping_insert(lfun_types, &key, &val);    free_type(val.u.type);       SET_SVAL(id, T_INT, NUMBER_NUMBER, integer, n);    mapping_insert(lfun_ids, &key, &id);    } else {    free_type(val.u.type);    }    }   #else    for (i=0; i < NELEM(lfun_names); i++) { -  lfun_strings[i] = make_shared_static_string(lfun_names[i], strlen(lfun_names[i]), eightbit); +  const char *name, *compat_name; +  name = lfun_names[i]; +  compat_name = strchr(name, ' '); +  if (compat_name) { +  lfun_strings[i] = +  make_shared_static_string(name, compat_name - name, eightbit); +  lfun_compat_strings[i] = +  make_shared_static_string(compat_name + 1, +  strlen(compat_name + 1), eightbit); +  } else { +  lfun_strings[i] = +  make_shared_static_string(name, strlen(name), eightbit); +  lfun_compat_strings[i] = NULL; +  }       SET_SVAL(id, T_INT, NUMBER_NUMBER, integer, i);    SET_SVAL(key, T_STRING, 0, string, lfun_strings[i]);    mapping_insert(lfun_ids, &key, &id);       SET_SVAL(val, T_TYPE, 0, type, make_pike_type(raw_lfun_types[i]));    mapping_insert(lfun_types, &key, &val);    -  if (i == LFUN__DESTRUCT) { -  /* Special case for lfun::destroy(). */ -  SET_SVAL(key, T_STRING, 0, string, compat_lfun_destroy_string); +  if (compat_name) { +  /* Special case for lfun::destroy() et al. */ +  SET_SVAL(key, T_STRING, 0, string, lfun_compat_strings[i]);    /* FIXME: Adjust the type to be __deprecated__? */    mapping_insert(lfun_types, &key, &val);    free_type(val.u.type);       SET_SVAL(id, T_INT, NUMBER_NUMBER, integer, i);    mapping_insert(lfun_ids, &key, &id);    } else {    free_type(val.u.type);    }    }