1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2019 University of Waterloo |
---|
3 | // |
---|
4 | // manipulatorsInput.cfa -- |
---|
5 | // |
---|
6 | // Author : Peter A. Buhr |
---|
7 | // Created On : Sat Jun 8 17:58:54 2019 |
---|
8 | // Last Modified By : Peter A. Buhr |
---|
9 | // Last Modified On : Sat Sep 2 14:27:46 2023 |
---|
10 | // Update Count : 65 |
---|
11 | // |
---|
12 | |
---|
13 | #include <fstream.hfa> |
---|
14 | #include <stdio.h> // scanf |
---|
15 | |
---|
16 | int main() { |
---|
17 | { |
---|
18 | char s[] = "yyyyyyyyyyyyyyyyyyyy"; |
---|
19 | const char sk[] = "abc"; |
---|
20 | scanf( "abc " ); scanf( sk ); for ( 5 ) scanf( "%*c" ); printf( "1 %s\n", s ); |
---|
21 | scanf( "%s", s ); printf( "2 %s\n", s ); |
---|
22 | scanf( "%*s" ); printf( "3 %s\n", s ); |
---|
23 | scanf( "%8s", s ); printf( "4 %s\n", s ); |
---|
24 | scanf( "%*8s" ); printf( "5 %s\n", s ); |
---|
25 | |
---|
26 | scanf( "%[abc]", s ); printf( "6 %s\n", s ); |
---|
27 | scanf( "%[^abc]", s ); printf( "7 %s\n", s ); |
---|
28 | scanf( "%*[abc]" ); printf( "8 %s\n", s ); |
---|
29 | scanf( "%*[^abc]" ); printf( "9 %s\n", s ); |
---|
30 | scanf( "%8[abc]", s ); printf( "10 %s\n", s ); |
---|
31 | scanf( "%8[^abc]", s ); printf( "11 %s\n", s ); |
---|
32 | scanf( "%*8[abc]" ); printf( "12 %s\n", s ); |
---|
33 | scanf( "%*8[^abc]" ); printf( "13 %s\n", s ); |
---|
34 | } |
---|
35 | { |
---|
36 | char s[] = "yyyyyyyyyyyyyyyyyyyy"; |
---|
37 | char sk[] = "abc"; |
---|
38 | sin | "abc " | skip( sk ) | skip( 5 ); sout | "1" | s; |
---|
39 | sin | wdi( sizeof(s), s ); sout | "2" | s; |
---|
40 | sin | ignore( s ); sout | "3" | s; |
---|
41 | sin | wdi( sizeof(s), 8, s ); sout | "4" | s; |
---|
42 | sin | ignore( wdi( sizeof(s), 8, s ) ); sout | "5" | s; |
---|
43 | |
---|
44 | sin | incl( "abc", wdi( sizeof(s), s ) ); sout | "6" | s; |
---|
45 | sin | excl( "abc", wdi( sizeof(s), s ) ); sout | "7" | s; |
---|
46 | sin | ignore( incl( "abc", wdi( sizeof(s), s ) ) ); sout | "8" | s; |
---|
47 | sin | ignore( excl( "abc", wdi( sizeof(s), s ) ) ); sout | "9" | s; |
---|
48 | sin | incl( "abc", wdi( sizeof(s), 8, s ) ); sout | "10" | s; |
---|
49 | sin | excl( "abc", wdi( sizeof(s), 8, s ) ); sout | "11" | s; |
---|
50 | sin | ignore( incl( "abc", wdi( sizeof(s), 8, s ) ) ); sout | "12" | s; |
---|
51 | sin | ignore( excl( "abc", wdi( sizeof(s), 8, s ) ) ); sout | "13" | s; |
---|
52 | } |
---|
53 | /* Keep harmonized with collections/string-istream-manip */ |
---|
54 | { |
---|
55 | char c; |
---|
56 | sin | c; sout | c; |
---|
57 | sin | ignore( c ); sout | c; |
---|
58 | |
---|
59 | signed char sc; |
---|
60 | sin | sc; sout | sc; |
---|
61 | sin | wdi( 3, sc ); sout | sc; |
---|
62 | sin | ignore( sc ); sout | sc; |
---|
63 | sin | ignore( wdi( 3, sc ) ); sout | sc; |
---|
64 | |
---|
65 | unsigned char usc; |
---|
66 | sin | usc; sout | usc; |
---|
67 | sin | wdi( 3, usc ); sout | usc; |
---|
68 | sin | ignore( usc ); sout | usc; |
---|
69 | sin | ignore( wdi( 3, usc ) ); sout | usc; |
---|
70 | |
---|
71 | signed short int ssi; |
---|
72 | sin | ssi; sout | ssi; |
---|
73 | sin | wdi( 3, ssi ); sout | ssi; |
---|
74 | sin | ignore( ssi ); sout | ssi; |
---|
75 | sin | ignore( wdi( 3, ssi ) ); sout | ssi; |
---|
76 | |
---|
77 | unsigned short int usi; |
---|
78 | sin | usi; sout | usi; |
---|
79 | sin | wdi( 3, usi ); sout | usi; |
---|
80 | sin | ignore( usi ); sout | usi; |
---|
81 | sin | ignore( wdi( 3, usi ) ); sout | usi; |
---|
82 | |
---|
83 | signed int si; |
---|
84 | sin | si; sout | si; |
---|
85 | sin | wdi( 3, si ); sout | si; |
---|
86 | sin | ignore( si ); sout | si; |
---|
87 | sin | ignore( wdi( 3, si ) ); sout | si; |
---|
88 | |
---|
89 | unsigned int ui; |
---|
90 | sin | ui; sout | ui; |
---|
91 | sin | wdi( 3, ui ); sout | ui; |
---|
92 | sin | ignore( ui ); sout | ui; |
---|
93 | sin | ignore( wdi( 3, ui ) ); sout | ui; |
---|
94 | |
---|
95 | signed long int sli; |
---|
96 | sin | sli; sout | sli; |
---|
97 | sin | wdi( 3, sli ); sout | sli; |
---|
98 | sin | ignore( sli ); sout | sli; |
---|
99 | sin | ignore( wdi( 3, sli ) ); sout | sli; |
---|
100 | |
---|
101 | unsigned long int uli; |
---|
102 | sin | uli; sout | uli; |
---|
103 | sin | wdi( 3, uli ); sout | uli; |
---|
104 | sin | ignore( uli ); sout | uli; |
---|
105 | sin | ignore( wdi( 3, uli ) ); sout | uli; |
---|
106 | |
---|
107 | signed long long int slli; |
---|
108 | sin | slli; sout | slli; |
---|
109 | sin | wdi( 3, slli ); sout | slli; |
---|
110 | sin | ignore( slli ); sout | slli; |
---|
111 | sin | ignore( wdi( 3, slli ) ); sout | slli; |
---|
112 | |
---|
113 | unsigned long long int ulli; |
---|
114 | sin | ulli; sout | ulli; |
---|
115 | sin | wdi( 3, ulli ); sout | ulli; |
---|
116 | sin | ignore( ulli ); sout | ulli; |
---|
117 | sin | ignore( wdi( 3, ulli ) ); sout | ulli; |
---|
118 | |
---|
119 | float f; |
---|
120 | sin | f; sout | f; |
---|
121 | sin | wdi( 8, f ); sout | f; |
---|
122 | sin | ignore( f ); sout | f; |
---|
123 | sin | ignore( wdi( 8, f ) ); sout | f; |
---|
124 | |
---|
125 | double d; |
---|
126 | sin | d; sout | d; |
---|
127 | sin | wdi( 8, d ); sout | d; |
---|
128 | sin | ignore( d ); sout | d; |
---|
129 | sin | ignore( wdi( 8, d ) ); sout | d; |
---|
130 | |
---|
131 | long double ld; |
---|
132 | sin | ld; sout | ld; |
---|
133 | sin | wdi( 8, ld ); sout | ld; |
---|
134 | sin | ignore( ld ); sout | ld; |
---|
135 | sin | ignore( wdi( 8, ld ) ); sout | ld; |
---|
136 | |
---|
137 | float _Complex fc; |
---|
138 | sin | fc; sout | fc; |
---|
139 | sin | wdi( 8, fc ); sout | fc; |
---|
140 | sin | ignore( fc ); sout | fc; |
---|
141 | sin | ignore( wdi( 8, fc ) ); sout | fc; |
---|
142 | |
---|
143 | double _Complex dc; |
---|
144 | sin | dc; sout | dc; |
---|
145 | sin | wdi( 8, dc ); sout | dc; |
---|
146 | sin | ignore( dc ); sout | dc; |
---|
147 | sin | ignore( wdi( 8, dc ) ); sout | dc; |
---|
148 | |
---|
149 | long double _Complex ldc; |
---|
150 | sin | ldc; sout | ldc; |
---|
151 | sin | wdi( 8, ldc ); sout | ldc; |
---|
152 | sin | ignore( ldc ); sout | ldc; |
---|
153 | sin | ignore( wdi( 8, ldc ) ); sout | ldc; |
---|
154 | } |
---|
155 | #if defined( __SIZEOF_INT128__ ) |
---|
156 | { |
---|
157 | int128 val; |
---|
158 | for ( 15 ) { |
---|
159 | sin | val; |
---|
160 | sout | val; |
---|
161 | } |
---|
162 | } |
---|
163 | #endif // __SIZEOF_INT128__ |
---|
164 | } // main |
---|
165 | |
---|
166 | // Local Variables: // |
---|
167 | // tab-width: 4 // |
---|
168 | // compile-command: "cfa -Wall -Wextra manipulatorsInput.cfa" // |
---|
169 | // End: // |
---|