Changeset 3ac5fd8 for tests/coroutine/.expect
- Timestamp:
- Aug 17, 2024, 3:15:21 PM (3 months ago)
- Branches:
- master
- Children:
- df2e00f
- Parents:
- afb15cf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/coroutine/.expect/fmtLines.txt
rafb15cf r3ac5fd8 9 9 E" d istr ibut ed w ith 10 10 Cfor all. //// fmt Line 11 s.cc --/ /// Auth or 12 : P eter A. 13 Buhr // C reat ed O n 14 : Su n Se p 17 21: 15 56:1 5 20 17// Las t Mo 16 difi ed B y : Pete r A. 17 Buh r// Last Mod ifie 18 d On : F ri M ar 2 2 13 19 :41: 03 2 019/ / Up date 20 Cou nt : 33/ /#in 21 clud e <f stre am.h fa># 22 incl ude <cor outi ne.h 23 fa>c orou tine For mat 24 { ch ar c h; 25 // used for com muni 26 cati on i nt g , b; 27 / / gl obal bec 28 ause use d in des truc 29 tor} ;voi d ?{ }( F orma 30 t & fmt ) { r esum 31 e( f mt ) ; / 32 / st art coro utin e}vo 33 id ^ ?{}( For mat & fm 34 t ) { if ( fm t.g 35 != 0 || fmt. b != 0 ) 36 sou t | nl;} void mai 37 n( F orma t & fmt ) { 38 for ( ;; ) { 39 // for as many cha 40 ract ers for ( f mt.g 41 = 0 ; fm t.g < 5; fmt 42 .g + = 1 ) { // grou 11 s.cc -- form at c hara 12 cter s in to b lock s of 13 4 a nd g roup s of 5 b 14 lock s pe r li ne// // A 15 utho r : Pe 16 ter A. B uhr/ / Cr eate 17 d On : Sun Sep 18 17 21:5 6:15 201 7// 19 Last Mod ifie d By : P 20 eter A. Buhr // L ast 21 Modi fied On : Sa t Au 22 g 17 14: 26:0 3 20 24// 23 Upd ate Coun t : 24 60// #inc lude <fs trea 25 m.hf a>#i nclu de < coro 26 utin e.hf a>co rout ine 27 Form at { cha r ch ; 28 // u sed for 29 comm unic atio n in t g, 30 b; // glo 31 bal beca use used in 32 dest ruct or}; void mai 33 n( F orma t & fmt ) wi 34 th( fmt ) { for () { 35 / / fo r as 36 man y ch arac ters fo 37 r ( g = 0; g < 5 ; g 38 += 1 ) { // grou 43 39 ps o f 5 bloc ks for 44 ( f mt.b = 0 ; fm t.b 45 < 4; fmt .b + = 1 ) { 46 // b lock s of 4 c hara 47 cter s for ( ; ; ) 48 { // f or n ewli 49 ne c hara cter s su 50 spen d; i f ( fmt. 51 ch ! = '\ n' ) bre ak; 52 // igno re n ewli ne 53 } // f or so ut | 54 fmt .ch; / / pr 55 int char acte r } // 56 for s out | " "; 57 / / pr int bloc 58 k se para tor } / / fo 59 r s out | nl ; 60 // pri nt g roup sep 61 arat or } // for} // 62 main void prt ( Fo rmat 63 & f mt, char ch ) { 64 f mt.c h = ch; r 65 esum e( f mt ) ;} / / pr 66 tint mai n() { Fo rmat 67 fmt ; ch ar c h; f or ( 68 ;; ) { sin | c h; 69 // r ead one 70 char acte r if ( eof 71 ( si n ) ) br eak; 72 / / eo f ? prt ( fm 73 t, c h ); } / / fo r} / 74 / ma in// Loc al V aria 75 bles : // // t ab-w idth 76 : 4 //// com pile -com 77 mand : "c fa f mtLi nes. 78 cfa" /// / En d: / / 40 ( b = 0 ; b < 4; b + 41 = 1 ) { / / bl ocks 42 of 4 ch arac ters 43 for () { // f 44 or n ewli ne c hara cter 45 s su spen d; 46 if ( ch != ' \n' ) br 47 eak; // i gnor e ne 48 wlin e } / / fo r 49 sou t | ch; / 50 / pr int char acte r 51 } // for s out | " 52 "; / / pr int 53 bloc k se para tor } / 54 / fo r s out | nl ; 55 / / pr int grou 56 p se para tor } // for 57 } // mai nvoi d ?{ }( F 58 orma t & fmt ) { resu 59 me( fmt ); 60 // p rime (st art) cor 61 outi ne}v oid ^?{} ( Fo 62 rmat & f mt ) wit h( f 63 mt ) { i f ( g != 0 | 64 | b != 0 ) s out | nl 65 ;}vo id f orma t( F orma 66 t & fmt ) { resu me( 67 fmt );} // f orma tint 68 mai n() { Fo rmat fmt 69 ; so ut | nlO ff; 70 // turn off aut 71 o ne wlin e tr y { for 72 () { / / re 73 ad u ntil end of file 74 s in | fmt .ch; 75 // r ead one char 76 acte r form at( fmt 77 ); // pus h ch 78 arac ter for form atti 79 ng } // for } c atch 80 ( en d_of _fil e * ) { 81 } // try } // mai n
Note: See TracChangeset
for help on using the changeset viewer.