source: tests/coroutine/.expect/fmtLines.txt@ 9a1aec6

Last change on this file since 9a1aec6 was 3ac5fd8, checked in by Peter A. Buhr <pabuhr@…>, 14 months ago

first attempt changing end-of-file to an exception

  • Property mode set to 100644
File size: 2.4 KB
Line 
1//// Cfo rall Ver sion
2 1.0 .0 C opyr ight (C)
3 201 7 Un iver sity of
4Wate rloo //// The con
5tent s of thi s fi le a
6re c over ed u nder the
7 lic ence agr eeme nt i
8n th e// file "LI CENC
9E" d istr ibut ed w ith
10Cfor all. //// fmt Line
11s.cc -- form at c hara
12cter s in to b lock s of
13 4 a nd g roup s of 5 b
14lock s pe r li ne// // A
15utho r : Pe
16ter A. B uhr/ / Cr eate
17d On : Sun Sep
18 17 21:5 6:15 201 7//
19Last Mod ifie d By : P
20eter A. Buhr // L ast
21Modi fied On : Sa t Au
22g 17 14: 26:0 3 20 24//
23 Upd ate Coun t :
2460// #inc lude <fs trea
25m.hf a>#i nclu de < coro
26utin e.hf a>co rout ine
27Form at { cha r ch ;
28 // u sed for
29comm unic atio n in t g,
30 b; // glo
31bal beca use used in
32dest ruct or}; void mai
33n( F orma t & fmt ) wi
34th( fmt ) { for () {
35 / / fo r as
36 man y ch arac ters fo
37r ( g = 0; g < 5 ; g
38+= 1 ) { // grou
39ps o f 5 bloc ks for
40 ( b = 0 ; b < 4; b +
41= 1 ) { / / bl ocks
42 of 4 ch arac ters
43for () { // f
44or n ewli ne c hara cter
45s su spen d;
46if ( ch != ' \n' ) br
47eak; // i gnor e ne
48wlin e } / / fo r
49 sou t | ch; /
50/ pr int char acte r
51} // for s out | "
52 "; / / pr int
53bloc k se para tor } /
54/ fo r s out | nl ;
55 / / pr int grou
56p se para tor } // for
57} // mai nvoi d ?{ }( F
58orma t & fmt ) { resu
59me( fmt );
60// p rime (st art) cor
61outi ne}v oid ^?{} ( Fo
62rmat & f mt ) wit h( f
63mt ) { i f ( g != 0 |
64| b != 0 ) s out | nl
65;}vo id f orma t( F orma
66t & fmt ) { resu me(
67fmt );} // f orma tint
68 mai n() { Fo rmat fmt
69; so ut | nlO ff;
70 // turn off aut
71o ne wlin e tr y { for
72 () { / / re
73ad u ntil end of file
74 s in | fmt .ch;
75 // r ead one char
76acte r form at( fmt
77); // pus h ch
78arac ter for form atti
79ng } // for } c atch
80( en d_of _fil e * ) {
81} // try } // mai n
Note: See TracBrowser for help on using the repository browser.