make.allocd 485 B

12345678910111213141516
  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. :'