Debian Codegraph @

Ref_Data/nested2a.cdump_ref

raw
1
2
3 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
4 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
5 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #1 ****
6 $Shell::POSIX::Select::DEBUG > 1 and 1 == 1 and
7 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
8 _SEL_LOOP1: { # **** NEW SCOPE FOR SELECTLOOP #1 ****
9
10 # critical for values's contents to be resolved in user's scope
11 local @Shell::POSIX::Select::looplist=(1);
12 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
13
14 $Shell::POSIX::Select::DEBUG > 4 and do {
15 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
16 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
17 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
18 };
19 local $_; # LOOP-VAR DECLARATION REQUESTED (perhaps by default) # loop-var declaration appears here
20
21 ;
22 local (
23 $Shell::POSIX::Select::Prompt[1],
24 $Shell::POSIX::Select::menu
25 ) =
26 Shell::POSIX::Select::make_menu(
27 $Shell::POSIX::Select::Heading || "",
28 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
29 @Shell::POSIX::Select::looplist
30 );
31
32 # no point in prompting a pipe!
33 local $Shell::POSIX::Select::do_prompt[1] = (-t) ? 1 : 0 ;
34 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[1]\n";
35 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
36 while (1) { # for repeating prompt for selections
37 # localize, so I don't have to reset for
38 # outer loop on exit from inner
39 local ($Reply);
40 while (1) { # for validating user's input
41 local $Shell::POSIX::Select::bad = 0;
42
43 # local decl suppresses newline on prompt when -l switch turned on
44 {
45 local $\;
46 if ($Shell::POSIX::Select::do_prompt[1]) {
47
48 # When transferring from INNER to OUTER loop,
49 # extra NL before prompt is visually desirable
50
51 if ( $Shell::POSIX::Select::_extra_nl) {
52 print STDERR "\n\n";
53 $Shell::POSIX::Select::_extra_nl=0;
54 }
55 print STDERR
56 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[1] ";
57 }
58 }
59
60 # $Shell::POSIX::Select::do_prompt=0;
61 # constant prompting depends on style
62 $Shell::POSIX::Select::do_prompt[1]= 0;
63
64 if ( $Shell::POSIX::Select::dump_data ) {
65 $Reply = undef;
66 # dump filtered source for comparison against expected
67 print STDERR "copacetic
68 "; # ensure some output, and flush pending
69 exit 222; # code for graceful, expected, early exit
70 }
71 else {
72 # $^W=0;
73 # warn "Waiting for input";
74 $Eof=0;
75 $Reply = <STDIN>;
76 # warn "Got input";
77 # $^W=1;
78
79 if ( !defined( $Reply ) ) {
80 defined "" and "" ne "" and print STDERR "";
81
82 # need to undef loop var; user may check it!
83 undef $_;
84
85 # last Shell::POSIX::Select::_SEL_LOOP1; # Syntax error!
86 # If returning to outer loop, show the prompt for it
87 # warn "User hit ^D";
88 if ( 1 > 1 and -t ) { # reset prompting for outer loop
89 $Shell::POSIX::Select::do_prompt[1-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
90 }
91 0 > 2 and warn "Lasting out of _SEL_LOOP1\n";
92 $Eof=1;
93 last _SEL_LOOP1;
94 }
95 !defined $Reply and die "REPLY accessed, while undefined";
96 chomp $Reply;
97
98 # undo emboldening of user input
99 defined "" and "" ne "" and print STDERR "";
100
101 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
102 if ( $Reply eq "" ) { # interpreted as re-print menu request
103 # Empty input is legit, means redisplay menu
104 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
105 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[1] = 1;
106 }
107 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
108 $Shell::POSIX::Select::U_WARN > 0
109 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
110 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
111 }
112 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
113 $Shell::POSIX::Select::U_WARN > 0
114 and warn
115 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
116 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
117 }
118
119 # warn "BAD is now: $Shell::POSIX::Select::bad";
120 $Shell::POSIX::Select::bad or
121 0 > 2 and warn "About to last out of Reply Validator Loop
122 ";
123 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
124 } # if for validating user input
125 } # infinite while for validating user input
126
127 $_ = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
128
129 # USER'S LOOP-BLOCK BELOW
130
131 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
132 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
133 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #2 ****
134 $Shell::POSIX::Select::DEBUG > 1 and 2 == 1 and
135 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
136 _SEL_LOOP2: { # **** NEW SCOPE FOR SELECTLOOP #2 ****
137
138 # critical for values's contents to be resolved in user's scope
139 local @Shell::POSIX::Select::looplist=(2);
140 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
141
142 $Shell::POSIX::Select::DEBUG > 4 and do {
143 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
144 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
145 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
146 };
147 local $_; # LOOP-VAR DECLARATION REQUESTED (perhaps by default) # loop-var declaration appears here
148
149 ;
150 local (
151 $Shell::POSIX::Select::Prompt[2],
152 $Shell::POSIX::Select::menu
153 ) =
154 Shell::POSIX::Select::make_menu(
155 $Shell::POSIX::Select::Heading || "",
156 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
157 @Shell::POSIX::Select::looplist
158 );
159
160 # no point in prompting a pipe!
161 local $Shell::POSIX::Select::do_prompt[2] = (-t) ? 1 : 0 ;
162 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[2]\n";
163 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
164 while (1) { # for repeating prompt for selections
165 # localize, so I don't have to reset for
166 # outer loop on exit from inner
167 local ($Reply);
168 while (1) { # for validating user's input
169 local $Shell::POSIX::Select::bad = 0;
170
171 # local decl suppresses newline on prompt when -l switch turned on
172 {
173 local $\;
174 if ($Shell::POSIX::Select::do_prompt[2]) {
175
176 # When transferring from INNER to OUTER loop,
177 # extra NL before prompt is visually desirable
178
179 if ( $Shell::POSIX::Select::_extra_nl) {
180 print STDERR "\n\n";
181 $Shell::POSIX::Select::_extra_nl=0;
182 }
183 print STDERR
184 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[2] ";
185 }
186 }
187
188 # $Shell::POSIX::Select::do_prompt=0;
189 # constant prompting depends on style
190 $Shell::POSIX::Select::do_prompt[2]= 0;
191
192 if ( $Shell::POSIX::Select::dump_data ) {
193 $Reply = undef;
194 # dump filtered source for comparison against expected
195 print STDERR "copacetic
196 "; # ensure some output, and flush pending
197 exit 222; # code for graceful, expected, early exit
198 }
199 else {
200 # $^W=0;
201 # warn "Waiting for input";
202 $Eof=0;
203 $Reply = <STDIN>;
204 # warn "Got input";
205 # $^W=1;
206
207 if ( !defined( $Reply ) ) {
208 defined "" and "" ne "" and print STDERR "";
209
210 # need to undef loop var; user may check it!
211 undef $_;
212
213 # last Shell::POSIX::Select::_SEL_LOOP2; # Syntax error!
214 # If returning to outer loop, show the prompt for it
215 # warn "User hit ^D";
216 if ( 2 > 1 and -t ) { # reset prompting for outer loop
217 $Shell::POSIX::Select::do_prompt[2-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
218 }
219 0 > 2 and warn "Lasting out of _SEL_LOOP2\n";
220 $Eof=1;
221 last _SEL_LOOP2;
222 }
223 !defined $Reply and die "REPLY accessed, while undefined";
224 chomp $Reply;
225
226 # undo emboldening of user input
227 defined "" and "" ne "" and print STDERR "";
228
229 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
230 if ( $Reply eq "" ) { # interpreted as re-print menu request
231 # Empty input is legit, means redisplay menu
232 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
233 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[2] = 1;
234 }
235 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
236 $Shell::POSIX::Select::U_WARN > 0
237 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
238 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
239 }
240 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
241 $Shell::POSIX::Select::U_WARN > 0
242 and warn
243 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
244 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
245 }
246
247 # warn "BAD is now: $Shell::POSIX::Select::bad";
248 $Shell::POSIX::Select::bad or
249 0 > 2 and warn "About to last out of Reply Validator Loop
250 ";
251 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
252 } # if for validating user input
253 } # infinite while for validating user input
254
255 $_ = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
256
257 # USER'S LOOP-BLOCK BELOW
258 print "$_\n" ; # ** USING DEFAULT CODEBLOCK **;
259
260 # USER'S LOOP-BLOCK ABOVE
261 # Making sure there's colon (maybe
262 # even two) after codestring above,
263 # in case user omitted after last
264 # statement in block. I might add
265 # another statement below it someday!
266 0 > 2 and warn "At end of prompt-repeating loop
267 ";
268 } # infinite while for repeating collection of selections
269 0 and warn "BEYOND end of prompt-repeating loop
270 ";
271 } # endif (defined $Shell::POSIX::Select::menu)
272 else {
273 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #2 has no list, so no iterations\n";
274
275 if ( $Shell::POSIX::Select::dump_data ) {
276 $Reply = undef;
277 # dump filtered source for comparison against expected
278 print STDERR "copacetic
279 "; # ensure some output, and flush pending
280 exit 222; # code for graceful, expected, early exit
281 }
282 }
283 # return omitted above, to get last expression's value
284 # returned automatically, just like shell's version
285
286
287 } # **** END NEW SCOPE FOR SELECTLOOP #2 ****
288 } # **** END WRAPPER SCOPE FOR SELECTLOOP #2 ****
289 # vi:ts=2 sw=2:
290 ;
291
292 # USER'S LOOP-BLOCK ABOVE
293 # Making sure there's colon (maybe
294 # even two) after codestring above,
295 # in case user omitted after last
296 # statement in block. I might add
297 # another statement below it someday!
298 0 > 2 and warn "At end of prompt-repeating loop
299 ";
300 } # infinite while for repeating collection of selections
301 0 and warn "BEYOND end of prompt-repeating loop
302 ";
303 } # endif (defined $Shell::POSIX::Select::menu)
304 else {
305 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #1 has no list, so no iterations\n";
306
307 if ( $Shell::POSIX::Select::dump_data ) {
308 $Reply = undef;
309 # dump filtered source for comparison against expected
310 print STDERR "copacetic
311 "; # ensure some output, and flush pending
312 exit 222; # code for graceful, expected, early exit
313 }
314 }
315 # return omitted above, to get last expression's value
316 # returned automatically, just like shell's version
317
318
319 } # **** END NEW SCOPE FOR SELECTLOOP #1 ****
320 } # **** END WRAPPER SCOPE FOR SELECTLOOP #1 ****
321 # vi:ts=2 sw=2:
322