You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
332 B
C
17 lines
332 B
C
22 years ago
|
#include "byte.h"
|
||
|
#include "buffer.h"
|
||
|
#include "scan.h"
|
||
|
|
||
|
int buffer_get_token_pred(buffer* b,char* x,unsigned int len,string_predicate p) {
|
||
|
int blen;
|
||
|
|
||
|
for (blen=0;blen<len;++blen) {
|
||
|
register int r;
|
||
|
if ((r=buffer_getc(b,x))<0) return r;
|
||
|
if (r==0) break;
|
||
|
if (p(x-blen,blen+1)) break;
|
||
|
++x;
|
||
|
}
|
||
|
return blen;
|
||
|
}
|