Changeset a573c22 for doc/papers/concurrency/examples/Format.c
- Timestamp:
- Feb 6, 2020, 10:27:01 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 53a49cc
- Parents:
- b0795be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/concurrency/examples/Format.c
rb0795be ra573c22 2 2 3 3 typedef struct { 4 void * next;4 int restart, g, b; 5 5 char ch; 6 int g, b;7 6 } Fmt; 8 7 9 8 void comain( Fmt * f ) { 10 if ( __builtin_expect(f->next != 0, 1) ) goto *f->next; 11 f->next = &&s1; 9 static void * states[] = {&&s0, &&s1}; 10 goto *states[f->restart]; 11 s0: f->restart = 1; 12 12 for ( ;; ) { 13 13 for ( f->g = 0; f->g < 5; f->g += 1 ) { // groups 14 14 for ( f->b = 0; f->b < 4; f->b += 1 ) { // blocks 15 return; 16 s1:; while ( f->ch == '\n' ) return; // ignore 15 do { 16 return; s1: ; 17 } while ( f->ch == '\n' ); // ignore 17 18 printf( "%c", f->ch ); // print character 18 19 } … … 24 25 25 26 int main() { 26 Fmt fmt = { NULL};27 Fmt fmt = { 0 }; 27 28 comain( &fmt ); // prime 28 29 for ( ;; ) {
Note: See TracChangeset
for help on using the changeset viewer.