1995-08-17
1995-08-17 09:35:27 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
-
f90e54df65b1b7fa38a1e1bfd9fae3850a4bd56d
(50 lines)
(+25/-25)
[
Show
| Annotate
]
Branch: branches/E-12
64 bittar och b{ttre bsd fd tjafs..
Rev: lib/simulate.lpc:1.2
Rev: src/BUGS:1.2
Rev: src/Makefile.in:1.3
Rev: src/array.c:1.2
Rev: src/backend.c:1.2
Rev: src/configure.in:1.3
Rev: src/docode.c:1.2
Rev: src/interpret.c:1.2
Rev: src/language.y:1.2
Rev: src/las.h:1.2
Rev: src/lex.c:1.2
Rev: src/list.c:1.2
Rev: src/macros.h:1.2
Rev: src/main.c:1.4
Rev: src/mapping.c:1.2
Rev: src/modules/files/file.c:1.2
Rev: src/modules/files/socket.c:1.2
Rev: src/modules/regexp/regexp.c:1.2
Rev: src/opcodes.c:1.2
Rev: src/port.c:1.3
Rev: src/port.h:1.3
Rev: src/program.c:1.2
Rev: src/rusage.c:1.2
Rev: src/stralloc.c:1.2
Rev: src/stralloc.h:1.2
Rev: src/svalue.c:1.2
188:
*/
#define INS_BLOCK(PTR,PTRS,TYPE,AREA) \
+ prog->PTR=(TYPE *)p; \
if((prog->PTRS = areas[AREA].s.len/sizeof(TYPE))) \
{ \
- prog->PTR = (TYPE *)p; \
+
MEMCPY(p,areas[AREA].s.str, areas[AREA].s.len); \
- p+=ALIGN(areas[AREA].s.len); \
- }else{ \
- prog->PTR = 0; \
+ p+=MY_ALIGN(areas[AREA].s.len); \
}
struct program *end_program()
231:
prog=0;
}else{
setup_fake_program();
- size = ALIGN(sizeof (struct program));
- for (i=0; i<NUM_AREAS; i++) size += ALIGN(areas[i].s.len);
- size+=ALIGN(fake_program.num_identifier_references * sizeof(unsigned short));
+ size = MY_ALIGN(sizeof (struct program));
+ for (i=0; i<NUM_AREAS; i++) size += MY_ALIGN(areas[i].s.len);
+ size+=MY_ALIGN(fake_program.num_identifier_references * sizeof(unsigned short));
p = (char *)xalloc(size);
prog = (struct program *)p;
*prog = fake_program;
prog->total_size = size;
prog->refs = 1;
- p += ALIGN(sizeof (struct program));
+ p += MY_ALIGN(sizeof (struct program));
INS_BLOCK(program,program_size,unsigned char,A_PROGRAM);
INS_BLOCK(linenumbers,num_linenumbers,char,A_LINENUMBERS);
286:
prog->num_identifier_indexes=e;
fsort((void *)prog->identifier_index, e,sizeof(unsigned short),(fsortfun)funcmp);
- p+=ALIGN(prog->num_identifier_indexes*sizeof(unsigned short));
+ p+=MY_ALIGN(prog->num_identifier_indexes*sizeof(unsigned short));
for (i=0; i<NUM_AREAS; i++) toss_buffer(areas+i);
345:
{
SIZE_T offset;
offset=fake_program.storage_needed;
- size=ALIGN(size);
+ size=MY_ALIGN(size);
fake_program.storage_needed += size;
return offset;
}
824: Inside #if defined(FIND_FUNCTION_HASHSIZE)
unsigned int hashval;
hashval=my_hash_string(name);
hashval+=prog->id;
- hashval^=(unsigned int)prog;
+ hashval^=(unsigned long)prog;
hashval-=name->str[0];
hashval%=FIND_FUNCTION_HASHSIZE;
if(is_same_string(cache[hashval].name,name) &&
1124: Inside #if defined(DEBUG)
if(p->storage_needed < 0)
fatal("Program->storage_needed < 0.\n");
- size=ALIGN(sizeof(struct program));
- size+=ALIGN(p->num_linenumbers);
- size+=ALIGN(p->program_size);
- size+=ALIGN(p->num_constants * sizeof(struct svalue));
- size+=ALIGN(p->num_strings * sizeof(struct lpc_string *));
- size+=ALIGN(p->num_identifiers * sizeof(struct identifier));
- size+=ALIGN(p->num_identifier_references * sizeof(struct reference));
- size+=ALIGN(p->num_inherits * sizeof(struct inherit));
+ size=MY_ALIGN(sizeof(struct program));
+ size+=MY_ALIGN(p->num_linenumbers);
+ size+=MY_ALIGN(p->program_size);
+ size+=MY_ALIGN(p->num_constants * sizeof(struct svalue));
+ size+=MY_ALIGN(p->num_strings * sizeof(struct lpc_string *));
+ size+=MY_ALIGN(p->num_identifiers * sizeof(struct identifier));
+ size+=MY_ALIGN(p->num_identifier_references * sizeof(struct reference));
+ size+=MY_ALIGN(p->num_inherits * sizeof(struct inherit));
- size+=ALIGN(p->num_identifier_indexes * sizeof(INT16));
+ size+=MY_ALIGN(p->num_identifier_indexes * sizeof(INT16));
- if(size < p->total_size)
+ if(size > p->total_size)
fatal("Program size is in error.\n");
- size-=ALIGN(p->num_identifier_indexes * sizeof(INT16));
- size+=ALIGN(p->num_identifier_references * sizeof(INT16));
+ size-=MY_ALIGN(p->num_identifier_indexes * sizeof(INT16));
+ size+=MY_ALIGN(p->num_identifier_references * sizeof(INT16));
- if(size > p->total_size)
+ if(size < p->total_size)
fatal("Program size is in error.\n");
1185:
if(p->identifiers[e].flags & ~7)
fatal("Unknown flags in identifier flag field.\n");
+ if(p->identifiers[e].run_time_type!=T_MIXED)
check_type(p->identifiers[e].run_time_type);
}