Branch: Tag:

1999-09-06

1999-09-06 11:13:23 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

a few bugfixes

Rev: src/las.c:1.85
Rev: src/module_support.c:1.26
Rev: src/program.c:1.134
Rev: src/program.h:1.56
Rev: src/testsuite.in:1.192
Rev: src/threads.h:1.70

5:   \*/   /**/   #include "global.h" - RCSID("$Id: program.c,v 1.133 1999/08/20 05:08:25 hubbe Exp $"); + RCSID("$Id: program.c,v 1.134 1999/09/06 11:13:19 hubbe Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
1227:    struct inherit inherit;    struct pike_string *s;    -  +     if(!p)    {    yyerror("Illegal program pointer.");    return;    }    -  +  if(p->flags & PROGRAM_USES_PARENT) +  { +  if(!parent && !parent_offset) +  { +  yyerror("Parent pointer lost, cannot inherit!"); +  /* We inherit it anyways, to avoid causing more errors */ +  } +  } +  +  /* parent offset was increased by one for above test.. */ +  parent_offset--; +  +     if(!(p->flags & (PROGRAM_FINISHED | PROGRAM_PASS_1_DONE)))    {    yyerror("Cannot inherit program which is not fully compiled yet.");
1424:    low_inherit(p,    0,    numid, -  n->u.integer.a, +  n->u.integer.a+1,    flags,    name);    break;
1574:       if(n != -1)    { +  /* not inherited */ +  if(new_program->identifier_references[n].inherit_offset == 0) +  { +  my_yyerror("Identifier '%s' defined twice.",name->str); +  return n; +  } +     if (IDENTIFIERP(n)->id_flags & ID_NOMASK)    my_yyerror("Illegal to redefine 'nomask/final' variable/functions \"%s\"", name->str);    -  if(PROG_FROM_INT(new_program, n) == new_program) -  my_yyerror("Variable '%s' defined twice.",name->str); -  +     if(!(IDENTIFIERP(n)->id_flags & ID_INLINE) || compiler_pass!=1)    {    if(ID_FROM_INT(new_program, n)->type != type)
1701:    if(IDENTIFIERP(n)->id_flags & ID_NOMASK)    my_yyerror("Illegal to redefine 'nomask' identifier \"%s\"", name->str);    -  if(PROG_FROM_INT(new_program, n) == new_program) +  /* not inherited */ +  if(new_program->identifier_references[n].inherit_offset == 0) +  {    my_yyerror("Identifier '%s' defined twice.",name->str); -  +  return n; +  }       if(!(IDENTIFIERP(n)->id_flags & ID_INLINE))    {
1875:       if(ref.inherit_offset == 0) /* not inherited */    { -  if(!(!func || func->offset == -1) && !(funp->func.offset == -1)) +  if( !( IDENTIFIER_IS_FUNCTION(funp->identifier_flags) && +  ( (!func || func->offset == -1) || (funp->func.offset == -1))))    { -  my_yyerror("Redeclaration of function %s.",name->str); +  my_yyerror("Identifier '%s' defined twice.",name->str);    return i;    }   
1900:       funp->identifier_flags=function_flags;    }else{ +     if((ref.id_flags & ID_NOMASK)   #if 0    && !(funp->func.offset == -1)
1909:    my_yyerror("Illegal to redefine 'nomask' function %s.",name->str);    }    +     if(ref.id_flags & ID_INLINE)    {    goto make_a_new_def;
2224:    get_name_of_type(ind->type));    }    s = ind->u.string; + #if 0    for (e = p->num_identifier_references; e--; ) {    struct identifier *id;    if (p->identifier_references[e].id_flags & ID_HIDDEN) {
2233:    if (id->name != s) {    continue;    } +  + #else +  e=find_shared_string_identifier(s, p); +  if(e!=-1) +  { +  struct identifier *id; +  id=ID_FROM_INT(p, e); + #endif    if (IDENTIFIER_IS_CONSTANT(id->identifier_flags)) {    struct program *p2 = PROG_FROM_INT(p, e);    assign_svalue_no_free(to, (p2->constants + id->func.offset));
2245:    }    }    } +  + #if 1 +  to->type=T_INT; +  to->subtype=NUMBER_UNDEFINED; +  to->u.integer=0; + #else    if (s->len < 1024) {    error("No such index \"%s\".\n", s->str);    } else {    error("No such index.\n");    } -  + #endif   }      /*