alloc.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. /* I N T E R M E D I A T E C O D E
  7. *
  8. * C O R E A L L O C A T I O N A N D D E A L L O C A T I O N
  9. */
  10. #include <stdlib.h>
  11. #ifdef DEBUG
  12. char *newcore(int size);
  13. void oldcore(char *p, int size);
  14. void coreusage()
  15. #else
  16. char *myalloc(int size);
  17. #define newcore(size) myalloc(size)
  18. #define oldcore(p,size) free((char *)p)
  19. #endif
  20. #define newstruct(t) ((struct t *) newcore (sizeof (struct t)))
  21. #define oldstruct(t,p) oldcore((char *) p,sizeof (struct t))
  22. line_p newline(int optyp);
  23. arg_p newarg(int kind);
  24. short **newmap(short length);
  25. cset newbitvect(short n);
  26. cond_p newcondtab(int l);
  27. void oldline(line_p lnp);
  28. void oldargs(arg_p ap);
  29. void oldargb(argb_p abp);
  30. void oldobjects(obj_p op);
  31. void olddblock(dblock_p dbl);
  32. void oldmap(short **mp, short length);
  33. void oldbitvect(cset s, short n);
  34. void oldcondtab(cond_p tab);
  35. short *newtable(short length);
  36. void oldtable(short **mp, short length);
  37. #define newdblock() (dblock_p) newstruct(dblock)
  38. #define newobject() (obj_p) newstruct(obj)
  39. #define newproc() (proc_p) newstruct(proc)
  40. #define newargb() (argb_p) newstruct(argbytes)
  41. #define newbblock() (bblock_p) newstruct(bblock)
  42. #define newelem() (elem_p) newstruct(elemholder)
  43. #define newloop() (loop_p) newstruct(loop)
  44. #define newuse() (use_p) newstruct(use)
  45. #define newchange() (change_p) newstruct(change)
  46. #define newlocal() (local_p) newstruct(local)
  47. #define oldproc(x) oldstruct(proc,x)
  48. #define oldbblock(x) oldstruct(bblock,x)
  49. #define oldelem(x) oldstruct(elemholder,x)
  50. #define oldloop(x) oldstruct(loop,x)
  51. #define olduse(x) oldstruct(use,x)
  52. #define oldchange(x) oldstruct(change,x)
  53. #define oldlocal(x) oldstruct(local,x)