ack/util/ego/cs/cs_aux.c

67 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/utils.h"
1984-11-26 13:43:22 +00:00
#include "../share/global.h"
#include "../share/lset.h"
#include "cs.h"
#include "cs_entity.h"
2018-02-05 21:09:30 +00:00
offset array_elemsize(valnum vn)
1984-11-26 13:43:22 +00:00
{
/* 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);
}
2018-02-05 21:09:30 +00:00
occur_p occ_elem(Lindex i)
1984-11-26 13:43:22 +00:00
{
return (occur_p) Lelem(i);
}
2018-02-05 21:09:30 +00:00
entity_p en_elem(Lindex i)
1984-11-26 13:43:22 +00:00
{
return (entity_p) Lelem(i);
}
/* The value numbers associated with each distinct value
* start at 1.
*/
STATIC valnum val_no;
2018-02-05 21:09:30 +00:00
valnum newvalnum(void)
1984-11-26 13:43:22 +00:00
{
/* Return a completely new value number. */
return ++val_no;
}
2018-02-05 21:09:30 +00:00
void start_valnum(void)
1984-11-26 13:43:22 +00:00
{
/* Restart value numbering. */
val_no = 0;
}