grows.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. #ifndef UTILS_ACK_GROWS_H
  6. #define UTILS_ACK_GROWS_H
  7. #ifndef NORCSID
  8. #define RCS_GROWS "$Id$"
  9. #endif
  10. /* struct used to identify and do bookkeeping for growing strings */
  11. typedef struct {
  12. char *gr_string ; /* Points to start of string */
  13. unsigned gr_size ; /* Current string size */
  14. unsigned gr_max ; /* Maximum string size */
  15. } growstring ;
  16. #define GR_MORE 50 /* Steps to grow */
  17. #define gr_start(id) (id).gr_string /* The start of the string */
  18. /* Routines used */
  19. void gr_throw(growstring *id); /* To free the core */
  20. void gr_add(growstring *id, char c); /* To add one character */
  21. void gr_cat(growstring *id, char *string); /* concatenate the contents and the string */
  22. void gr_init(growstring *id); /* Initialize the bookkeeping */
  23. char *gr_final(growstring *id); /* Transform to a stable storage string */
  24. #endif /* UTILS_ACK_GROWS_H */