Branch: Tag:

2008-05-29

2008-05-29 12:36:35 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Implemented support for extern variables (ie prototypes for variables).

Rev: src/object.c:1.295
Rev: src/program.c:1.708

2:   || 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.707 2008/05/27 19:36:00 grubba Exp $ + || $Id: program.c,v 1.708 2008/05/29 12:36:35 grubba Exp $   */      #include "global.h"
2172:    int found_better=-1;    int funa_is_prototype;    +  /* NOTE: Mixin is currently not supported for PRIVATE symbols. */    if(funp->id_flags & ID_PRIVATE) continue;    funa_is_prototype = fun->func.offset == -1;   /* if(fun->func.offset == -1) continue; * prototype */
2965:    case T_MIXED: return sizeof(struct svalue);    case T_FLOAT: return sizeof(FLOAT_TYPE);    case T_INT: return sizeof(INT_TYPE); +  case PIKE_T_FREE:    case PIKE_T_GET_SET: return 0;    default: return sizeof(void *);    }
2978:    case T_MIXED: return ALIGNOF(struct svalue);    case T_FLOAT: return ALIGNOF(FLOAT_TYPE);    case T_INT: return ALIGNOF(INT_TYPE); +  case PIKE_T_FREE:    case PIKE_T_GET_SET: return 1;    default: return ALIGNOF(void *);    }
3281:    Pike_fatal("Unknown flags in identifier flag field.\n");       if((p->identifiers[e].run_time_type!=T_MIXED) && +  (p->identifiers[e].run_time_type!=PIKE_T_FREE) &&    (p->identifiers[e].run_time_type!=PIKE_T_GET_SET))    check_type(p->identifiers[e].run_time_type);   
3355:    }    size=sizeof_variable(i->run_time_type);    -  if((offset+size > (size_t)p->storage_needed) || offset<0) +  if(size && ((offset+size > (size_t)p->storage_needed) || offset<0))    Pike_fatal("Variable outside storage! (%s)\n",i->name->str);       for(q=0;q<size;q++)
4798:    dummy.total_time=0;   #endif    +  if (run_time_type == PIKE_T_FREE) dummy.func.offset = -1; +     ref.id_flags=flags;    ref.identifier_offset=Pike_compiler->new_program->num_identifiers;    ref.inherit_offset=0;
4991:    }    }    +  if (flags & ID_EXTERN) { +  run_time_type = PIKE_T_FREE; +  } else {    run_time_type=compile_type_to_runtime_type(type);       switch(run_time_type)
5004:    case T_PROGRAM:    run_time_type = T_MIXED;    } +  }       n=low_define_variable(name,type,flags,    low_add_storage(sizeof_variable(run_time_type),