2 * Perform the basic line parsing of input performed by awk.
27 printf("endline(%i): ", nwords );
28 fwrite( ls, 1, p - ls, stdout );
31 for ( i = 0; i < nwords; i++ ) {
33 fwrite( ws[i], 1, we[i] - ws[i], stdout );
41 # The whitespace separating words in a line.
44 # The components in a line to break up. Either a word or a single char of
45 # whitespace. On the word capture characters.
46 blineElements = word >start_word %end_word | whitespace;
48 # Star the break line elements. Just be careful to decrement the leaving
49 # priority as we don't want multiple character identifiers to be treated as
50 # multiple single char identifiers.
51 line = ( blineElements** '\n' ) >start_line @end_line;
53 # Any number of lines.
57 %% write data noerror nofinal;
76 char *p, *pe, *data = buf + have;
77 int len, space = BUFSIZE - have;
78 /* fprintf( stderr, "space: %i\n", space ); */
81 fprintf(stderr, "buffer out of space\n");
85 len = fread( data, 1, space, stdin );
86 /* fprintf( stderr, "len: %i\n", len ); */
90 /* Find the last newline by searching backwards. This is where
91 * we will stop processing on this iteration. */
93 pe = buf + have + len - 1;
94 while ( *pe != '\n' && pe >= buf )
98 /* fprintf( stderr, "running on: %i\n", pe - p ); */
102 /* How much is still in the buffer. */
103 have = data + len - pe;
105 memmove( buf, pe, have );
107 /* fprintf(stderr, "have: %i\n", have ); */
114 fprintf(stderr, "input not newline terminated\n");