Debian Codegraph @

Ref_Data/nested2c.cdump_ref

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