make.allocd 920 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. sed -e '
  3. s:^.*[ ]ALLOCDEF[ ].*"\(.*\)"[ ]*\([0-9][0-9]*\).*$:\
  4. /* allocation definitions of struct \1 */\
  5. extern char *st_alloc();\
  6. extern struct \1 *h_\1;\
  7. #ifdef DEBUG\
  8. extern int cnt_\1;\
  9. extern char *std_alloc();\
  10. #define new_\1() ((struct \1 *) std_alloc((char **)\&h_\1, sizeof(struct \1), \2, \&cnt_\1))\
  11. #else\
  12. #define new_\1() ((struct \1 *) st_alloc((char **)\&h_\1, sizeof(struct \1), \2))\
  13. #endif\
  14. #define free_\1(p) st_free(p, \&h_\1, sizeof(struct \1))\
  15. :' -e '
  16. s:^.*[ ]STATICALLOCDEF[ ].*"\(.*\)"[ ]*\([0-9][0-9]*\).*$:\
  17. /* allocation definitions of struct \1 */\
  18. extern char *st_alloc();\
  19. struct \1 *h_\1;\
  20. #ifdef DEBUG\
  21. int cnt_\1;\
  22. #define new_\1() ((struct \1 *) std_alloc((char **)\&h_\1, sizeof(struct \1), \2, \&cnt_\1))\
  23. #else\
  24. #define new_\1() ((struct \1 *) st_alloc((char **)\&h_\1, sizeof(struct \1), \2))\
  25. #endif\
  26. #define free_\1(p) st_free(p, \&h_\1, sizeof(struct \1))\
  27. :'