cs_aux.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* $Id$ */
  2. /*
  3. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. * See the copyright notice in the ACK home directory, in the file "Copyright".
  5. */
  6. #include "../share/types.h"
  7. #include "../share/debug.h"
  8. #include "../share/aux.h"
  9. #include "../share/global.h"
  10. #include "../share/lset.h"
  11. #include "cs.h"
  12. #include "cs_entity.h"
  13. offset array_elemsize(valnum vn)
  14. {
  15. /* Vn is the valuenumber of an entity that points to
  16. * an array-descriptor. The third element of this descriptor holds
  17. * the size of the array-elements.
  18. * IF we can find this entity, AND IF we can find the descriptor AND IF
  19. * this descriptor is located in ROM, then we return the size.
  20. */
  21. entity_p enp;
  22. enp = find_entity(vn);
  23. if (enp == (entity_p) 0)
  24. return UNKNOWN_SIZE;
  25. if (enp->en_kind != ENAEXTERNAL)
  26. return UNKNOWN_SIZE;
  27. if (enp->en_ext->o_dblock->d_pseudo != DROM)
  28. return UNKNOWN_SIZE;
  29. return aoff(enp->en_ext->o_dblock->d_values, 2);
  30. }
  31. occur_p occ_elem(Lindex i)
  32. {
  33. return (occur_p) Lelem(i);
  34. }
  35. entity_p en_elem(Lindex i)
  36. {
  37. return (entity_p) Lelem(i);
  38. }
  39. /* The value numbers associated with each distinct value
  40. * start at 1.
  41. */
  42. STATIC valnum val_no;
  43. valnum newvalnum()
  44. {
  45. /* Return a completely new value number. */
  46. return ++val_no;
  47. }
  48. void start_valnum()
  49. {
  50. /* Restart value numbering. */
  51. val_no = 0;
  52. }