Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
433 B

  1. #include "byte.h"
  2. #include "stralloc.h"
  3. #include "buffer.h"
  4. #include <errno.h>
  5. int buffer_get_token_sa_pred(buffer* b,stralloc* sa,sa_predicate p) {
  6. for (;;) {
  7. char x;
  8. if (!stralloc_readyplus(sa,1)) return -1;
  9. switch (buffer_getc(b,&x)) {
  10. case -1: return -1;
  11. case 0: return 0;
  12. }
  13. stralloc_append(sa,&x);
  14. switch (p(sa)) {
  15. case -1: return -1;
  16. case 0: break;
  17. case 1: return 0;
  18. }
  19. }
  20. }