cs_aux.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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(vn)
  14. valnum vn;
  15. {
  16. /* Vn is the valuenumber of an entity that points to
  17. * an array-descriptor. The third element of this descriptor holds
  18. * the size of the array-elements.
  19. * IF we can find this entity, AND IF we can find the descriptor AND IF
  20. * this descriptor is located in ROM, then we return the size.
  21. */
  22. entity_p enp;
  23. enp = find_entity(vn);
  24. if (enp == (entity_p) 0)
  25. return UNKNOWN_SIZE;
  26. if (enp->en_kind != ENAEXTERNAL)
  27. return UNKNOWN_SIZE;
  28. if (enp->en_ext->o_dblock->d_pseudo != DROM)
  29. return UNKNOWN_SIZE;
  30. return aoff(enp->en_ext->o_dblock->d_values, 2);
  31. }
  32. occur_p occ_elem(i)
  33. Lindex i;
  34. {
  35. return (occur_p) Lelem(i);
  36. }
  37. entity_p en_elem(i)
  38. Lindex i;
  39. {
  40. return (entity_p) Lelem(i);
  41. }
  42. /* The value numbers associated with each distinct value
  43. * start at 1.
  44. */
  45. STATIC valnum val_no;
  46. valnum newvalnum()
  47. {
  48. /* Return a completely new value number. */
  49. return ++val_no;
  50. }
  51. start_valnum()
  52. {
  53. /* Restart value numbering. */
  54. val_no = 0;
  55. }