ack/util/ego/cs/cs_aux.c

70 lines
1.3 KiB
C
Raw Normal View History

1994-06-24 11:31:16 +00:00
/* $Id$ */
1987-03-09 19:15:41 +00:00
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
1984-11-26 13:43:22 +00:00
#include "../share/types.h"
#include "../share/debug.h"
#include "../share/aux.h"
#include "../share/global.h"
#include "../share/lset.h"
#include "cs.h"
#include "cs_entity.h"
offset array_elemsize(vn)
valnum vn;
{
/* Vn is the valuenumber of an entity that points to
* an array-descriptor. The third element of this descriptor holds
* the size of the array-elements.
* IF we can find this entity, AND IF we can find the descriptor AND IF
* this descriptor is located in ROM, then we return the size.
*/
entity_p enp;
enp = find_entity(vn);
if (enp == (entity_p) 0)
return UNKNOWN_SIZE;
if (enp->en_kind != ENAEXTERNAL)
return UNKNOWN_SIZE;
if (enp->en_ext->o_dblock->d_pseudo != DROM)
return UNKNOWN_SIZE;
return aoff(enp->en_ext->o_dblock->d_values, 2);
}
occur_p occ_elem(i)
Lindex i;
{
return (occur_p) Lelem(i);
}
entity_p en_elem(i)
Lindex i;
{
return (entity_p) Lelem(i);
}
/* The value numbers associated with each distinct value
* start at 1.
*/
STATIC valnum val_no;
valnum newvalnum()
{
/* Return a completely new value number. */
return ++val_no;
}
start_valnum()
{
/* Restart value numbering. */
val_no = 0;
}