Filename | C:/tmp64ng/perl/vendor/lib/Win32/Console.pm |
Statements | Executed 322 statements in 0s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
0 | 0 | 0 | 0s | 0s | AUTOLOAD | Win32::Console::
0 | 0 | 0 | 0s | 0s | Attr | Win32::Console::
0 | 0 | 0 | 0s | 0s | Cls | Win32::Console::
0 | 0 | 0 | 0s | 0s | Cursor | Win32::Console::
0 | 0 | 0 | 0s | 0s | DESTROY | Win32::Console::
0 | 0 | 0 | 0s | 0s | Display | Win32::Console::
0 | 0 | 0 | 0s | 0s | FillAttr | Win32::Console::
0 | 0 | 0 | 0s | 0s | FillChar | Win32::Console::
0 | 0 | 0 | 0s | 0s | Flush | Win32::Console::
0 | 0 | 0 | 0s | 0s | GenerateCtrlEvent | Win32::Console::
0 | 0 | 0 | 0s | 0s | GetEvents | Win32::Console::
0 | 0 | 0 | 0s | 0s | Info | Win32::Console::
0 | 0 | 0 | 0s | 0s | Input | Win32::Console::
1 | 1 | 1 | 0s | 0s | InputCP | Win32::Console::
0 | 0 | 0 | 0s | 0s | InputChar | Win32::Console::
0 | 0 | 0 | 0s | 0s | MaxWindow | Win32::Console::
0 | 0 | 0 | 0s | 0s | Mode | Win32::Console::
1 | 1 | 1 | 0s | 0s | OutputCP | Win32::Console::
0 | 0 | 0 | 0s | 0s | PeekInput | Win32::Console::
0 | 0 | 0 | 0s | 0s | ReadAttr | Win32::Console::
0 | 0 | 0 | 0s | 0s | ReadChar | Win32::Console::
0 | 0 | 0 | 0s | 0s | ReadRect | Win32::Console::
0 | 0 | 0 | 0s | 0s | Scroll | Win32::Console::
0 | 0 | 0 | 0s | 0s | Select | Win32::Console::
0 | 0 | 0 | 0s | 0s | SetIcon | Win32::Console::
0 | 0 | 0 | 0s | 0s | Size | Win32::Console::
0 | 0 | 0 | 0s | 0s | Title | Win32::Console::
0 | 0 | 0 | 0s | 0s | Window | Win32::Console::
0 | 0 | 0 | 0s | 0s | Write | Win32::Console::
0 | 0 | 0 | 0s | 0s | WriteAttr | Win32::Console::
0 | 0 | 0 | 0s | 0s | WriteChar | Win32::Console::
0 | 0 | 0 | 0s | 0s | WriteInput | Win32::Console::
0 | 0 | 0 | 0s | 0s | WriteRect | Win32::Console::
1 | 1 | 1 | 0s | 0s | _GetConsoleCP (xsub) | Win32::Console::
1 | 1 | 1 | 0s | 0s | _GetConsoleOutputCP (xsub) | Win32::Console::
1 | 1 | 1 | 0s | 0s | bootstrap (xsub) | Win32::Console::
64 | 30 | 1 | 0s | 0s | constant (xsub) | Win32::Console::
0 | 0 | 0 | 0s | 0s | get_Win32_IPC_HANDLE | Win32::Console::
0 | 0 | 0 | 0s | 0s | new | Win32::Console::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | ####################################################################### | ||||
2 | # | ||||
3 | # Win32::Console - Win32 Console and Character Mode Functions | ||||
4 | # | ||||
5 | ####################################################################### | ||||
6 | |||||
7 | package Win32::Console; | ||||
8 | |||||
9 | 1 | 0s | require Exporter; | ||
10 | 1 | 0s | require DynaLoader; | ||
11 | |||||
12 | 1 | 0s | $VERSION = "0.10"; | ||
13 | |||||
14 | 1 | 0s | @ISA= qw( Exporter DynaLoader ); | ||
15 | 1 | 0s | @EXPORT = qw( | ||
16 | BACKGROUND_BLUE | ||||
17 | BACKGROUND_GREEN | ||||
18 | BACKGROUND_INTENSITY | ||||
19 | BACKGROUND_RED | ||||
20 | CAPSLOCK_ON | ||||
21 | CONSOLE_TEXTMODE_BUFFER | ||||
22 | CTRL_BREAK_EVENT | ||||
23 | CTRL_C_EVENT | ||||
24 | ENABLE_ECHO_INPUT | ||||
25 | ENABLE_LINE_INPUT | ||||
26 | ENABLE_MOUSE_INPUT | ||||
27 | ENABLE_PROCESSED_INPUT | ||||
28 | ENABLE_PROCESSED_OUTPUT | ||||
29 | ENABLE_WINDOW_INPUT | ||||
30 | ENABLE_WRAP_AT_EOL_OUTPUT | ||||
31 | ENHANCED_KEY | ||||
32 | FILE_SHARE_READ | ||||
33 | FILE_SHARE_WRITE | ||||
34 | FOREGROUND_BLUE | ||||
35 | FOREGROUND_GREEN | ||||
36 | FOREGROUND_INTENSITY | ||||
37 | FOREGROUND_RED | ||||
38 | LEFT_ALT_PRESSED | ||||
39 | LEFT_CTRL_PRESSED | ||||
40 | NUMLOCK_ON | ||||
41 | GENERIC_READ | ||||
42 | GENERIC_WRITE | ||||
43 | RIGHT_ALT_PRESSED | ||||
44 | RIGHT_CTRL_PRESSED | ||||
45 | SCROLLLOCK_ON | ||||
46 | SHIFT_PRESSED | ||||
47 | STD_INPUT_HANDLE | ||||
48 | STD_OUTPUT_HANDLE | ||||
49 | STD_ERROR_HANDLE | ||||
50 | $FG_BLACK | ||||
51 | $FG_GRAY | ||||
52 | $FG_BLUE | ||||
53 | $FG_LIGHTBLUE | ||||
54 | $FG_RED | ||||
55 | $FG_LIGHTRED | ||||
56 | $FG_GREEN | ||||
57 | $FG_LIGHTGREEN | ||||
58 | $FG_MAGENTA | ||||
59 | $FG_LIGHTMAGENTA | ||||
60 | $FG_CYAN | ||||
61 | $FG_LIGHTCYAN | ||||
62 | $FG_BROWN | ||||
63 | $FG_YELLOW | ||||
64 | $FG_LIGHTGRAY | ||||
65 | $FG_WHITE | ||||
66 | $BG_BLACK | ||||
67 | $BG_GRAY | ||||
68 | $BG_BLUE | ||||
69 | $BG_LIGHTBLUE | ||||
70 | $BG_RED | ||||
71 | $BG_LIGHTRED | ||||
72 | $BG_GREEN | ||||
73 | $BG_LIGHTGREEN | ||||
74 | $BG_MAGENTA | ||||
75 | $BG_LIGHTMAGENTA | ||||
76 | $BG_CYAN | ||||
77 | $BG_LIGHTCYAN | ||||
78 | $BG_BROWN | ||||
79 | $BG_YELLOW | ||||
80 | $BG_LIGHTGRAY | ||||
81 | $BG_WHITE | ||||
82 | $ATTR_NORMAL | ||||
83 | $ATTR_INVERSE | ||||
84 | @CONSOLE_COLORS | ||||
85 | ); | ||||
86 | |||||
87 | |||||
88 | ####################################################################### | ||||
89 | # This AUTOLOAD is used to 'autoload' constants from the constant() | ||||
90 | # XS function. If a constant is not found then control is passed | ||||
91 | # to the AUTOLOAD in AutoLoader. | ||||
92 | # | ||||
93 | |||||
94 | sub AUTOLOAD { | ||||
95 | my($constname); | ||||
96 | ($constname = $AUTOLOAD) =~ s/.*:://; | ||||
97 | #reset $! to zero to reset any current errors. | ||||
98 | local $! = 0; | ||||
99 | my $val = constant($constname, @_ ? $_[0] : 0); | ||||
100 | if ($! != 0) { | ||||
101 | # if ($! =~ /Invalid/) { | ||||
102 | # $AutoLoader::AUTOLOAD = $AUTOLOAD; | ||||
103 | # goto &AutoLoader::AUTOLOAD; | ||||
104 | # } else { | ||||
105 | ($pack, $file, $line) = caller; undef $pack; | ||||
106 | die "Symbol Win32::Console::$constname not defined, used at $file line $line."; | ||||
107 | # } | ||||
108 | } | ||||
109 | eval "sub $AUTOLOAD { $val }"; | ||||
110 | goto &$AUTOLOAD; | ||||
111 | } | ||||
112 | |||||
113 | |||||
114 | ####################################################################### | ||||
115 | # STATIC OBJECT PROPERTIES | ||||
116 | # | ||||
117 | |||||
118 | # %HandlerRoutineStack = (); | ||||
119 | # $HandlerRoutineRegistered = 0; | ||||
120 | |||||
121 | ####################################################################### | ||||
122 | # PUBLIC METHODS | ||||
123 | # | ||||
124 | |||||
125 | #======== | ||||
126 | sub new { | ||||
127 | #======== | ||||
128 | my($class, $param1, $param2) = @_; | ||||
129 | |||||
130 | my $self = {}; | ||||
131 | |||||
132 | if (defined($param1) | ||||
133 | and ($param1 == constant("STD_INPUT_HANDLE", 0) | ||||
134 | or $param1 == constant("STD_OUTPUT_HANDLE", 0) | ||||
135 | or $param1 == constant("STD_ERROR_HANDLE", 0))) | ||||
136 | { | ||||
137 | $self->{'handle'} = _GetStdHandle($param1); | ||||
138 | } | ||||
139 | else { | ||||
140 | $param1 = constant("GENERIC_READ", 0) | constant("GENERIC_WRITE", 0) unless $param1; | ||||
141 | $param2 = constant("FILE_SHARE_READ", 0) | constant("FILE_SHARE_WRITE", 0) unless $param2; | ||||
142 | $self->{'handle'} = _CreateConsoleScreenBuffer($param1, $param2, | ||||
143 | constant("CONSOLE_TEXTMODE_BUFFER", 0)); | ||||
144 | } | ||||
145 | bless $self, $class; | ||||
146 | return $self; | ||||
147 | } | ||||
148 | |||||
149 | #============ | ||||
150 | sub Display { | ||||
151 | #============ | ||||
152 | my($self) = @_; | ||||
153 | return undef unless ref($self); | ||||
154 | return _SetConsoleActiveScreenBuffer($self->{'handle'}); | ||||
155 | } | ||||
156 | |||||
157 | #=========== | ||||
158 | sub Select { | ||||
159 | #=========== | ||||
160 | my($self, $type) = @_; | ||||
161 | return undef unless ref($self); | ||||
162 | return _SetStdHandle($type, $self->{'handle'}); | ||||
163 | } | ||||
164 | |||||
165 | #=========== | ||||
166 | sub SetIcon { | ||||
167 | #=========== | ||||
168 | my($self, $icon) = @_; | ||||
169 | $icon = $self unless ref($self); | ||||
170 | return _SetConsoleIcon($icon); | ||||
171 | } | ||||
172 | |||||
173 | #========== | ||||
174 | sub Title { | ||||
175 | #========== | ||||
176 | my($self, $title) = @_; | ||||
177 | $title = $self unless ref($self); | ||||
178 | |||||
179 | if (defined($title)) { | ||||
180 | return _SetConsoleTitle($title); | ||||
181 | } | ||||
182 | else { | ||||
183 | return _GetConsoleTitle(); | ||||
184 | } | ||||
185 | } | ||||
186 | |||||
187 | #============== | ||||
188 | sub WriteChar { | ||||
189 | #============== | ||||
190 | my($self, $text, $col, $row) = @_; | ||||
191 | return undef unless ref($self); | ||||
192 | return _WriteConsoleOutputCharacter($self->{'handle'},$text,$col,$row); | ||||
193 | } | ||||
194 | |||||
195 | #============= | ||||
196 | sub ReadChar { | ||||
197 | #============= | ||||
198 | my($self, $size, $col, $row) = @_; | ||||
199 | return undef unless ref($self); | ||||
200 | |||||
201 | my $buffer = (" " x $size); | ||||
202 | if (_ReadConsoleOutputCharacter($self->{'handle'}, $buffer, $size, $col, $row)) { | ||||
203 | return $buffer; | ||||
204 | } | ||||
205 | else { | ||||
206 | return undef; | ||||
207 | } | ||||
208 | } | ||||
209 | |||||
210 | #============== | ||||
211 | sub WriteAttr { | ||||
212 | #============== | ||||
213 | my($self, $attr, $col, $row) = @_; | ||||
214 | return undef unless ref($self); | ||||
215 | return _WriteConsoleOutputAttribute($self->{'handle'}, $attr, $col, $row); | ||||
216 | } | ||||
217 | |||||
218 | #============= | ||||
219 | sub ReadAttr { | ||||
220 | #============= | ||||
221 | my($self, $size, $col, $row) = @_; | ||||
222 | return undef unless ref($self); | ||||
223 | return _ReadConsoleOutputAttribute($self->{'handle'}, $size, $col, $row); | ||||
224 | } | ||||
225 | |||||
226 | #========== | ||||
227 | sub Write { | ||||
228 | #========== | ||||
229 | my($self,$string) = @_; | ||||
230 | return undef unless ref($self); | ||||
231 | return _WriteConsole($self->{'handle'}, $string); | ||||
232 | } | ||||
233 | |||||
234 | #============= | ||||
235 | sub ReadRect { | ||||
236 | #============= | ||||
237 | my($self, $left, $top, $right, $bottom) = @_; | ||||
238 | return undef unless ref($self); | ||||
239 | |||||
240 | my $col = $right - $left + 1; | ||||
241 | my $row = $bottom - $top + 1; | ||||
242 | |||||
243 | my $buffer = (" " x ($col*$row*4)); | ||||
244 | if (_ReadConsoleOutput($self->{'handle'}, $buffer, | ||||
245 | $col, $row, 0, 0, | ||||
246 | $left, $top, $right, $bottom)) | ||||
247 | { | ||||
248 | return $buffer; | ||||
249 | } | ||||
250 | else { | ||||
251 | return undef; | ||||
252 | } | ||||
253 | } | ||||
254 | |||||
255 | #============== | ||||
256 | sub WriteRect { | ||||
257 | #============== | ||||
258 | my($self, $buffer, $left, $top, $right, $bottom) = @_; | ||||
259 | return undef unless ref($self); | ||||
260 | |||||
261 | my $col = $right - $left + 1; | ||||
262 | my $row = $bottom - $top + 1; | ||||
263 | |||||
264 | return _WriteConsoleOutput($self->{'handle'}, $buffer, | ||||
265 | $col, $row, 0, 0, | ||||
266 | $left, $top, $right, $bottom); | ||||
267 | } | ||||
268 | |||||
269 | #=========== | ||||
270 | sub Scroll { | ||||
271 | #=========== | ||||
272 | my($self, $left1, $top1, $right1, $bottom1, | ||||
273 | $col, $row, $char, $attr, | ||||
274 | $left2, $top2, $right2, $bottom2) = @_; | ||||
275 | return undef unless ref($self); | ||||
276 | |||||
277 | return _ScrollConsoleScreenBuffer($self->{'handle'}, | ||||
278 | $left1, $top1, $right1, $bottom1, | ||||
279 | $col, $row, $char, $attr, | ||||
280 | $left2, $top2, $right2, $bottom2); | ||||
281 | } | ||||
282 | |||||
283 | #============== | ||||
284 | sub MaxWindow { | ||||
285 | #============== | ||||
286 | my($self, $flag) = @_; | ||||
287 | return undef unless ref($self); | ||||
288 | |||||
289 | if (not defined($flag)) { | ||||
290 | my @info = _GetConsoleScreenBufferInfo($self->{'handle'}); | ||||
291 | return $info[9], $info[10]; | ||||
292 | } | ||||
293 | else { | ||||
294 | return _GetLargestConsoleWindowSize($self->{'handle'}); | ||||
295 | } | ||||
296 | } | ||||
297 | |||||
298 | #========= | ||||
299 | sub Info { | ||||
300 | #========= | ||||
301 | my($self) = @_; | ||||
302 | return undef unless ref($self); | ||||
303 | return _GetConsoleScreenBufferInfo($self->{'handle'}); | ||||
304 | } | ||||
305 | |||||
306 | #=========== | ||||
307 | sub Window { | ||||
308 | #=========== | ||||
309 | my($self, $flag, $left, $top, $right, $bottom) = @_; | ||||
310 | return undef unless ref($self); | ||||
311 | |||||
312 | if (not defined($flag)) { | ||||
313 | my @info = _GetConsoleScreenBufferInfo($self->{'handle'}); | ||||
314 | return $info[5], $info[6], $info[7], $info[8]; | ||||
315 | } | ||||
316 | else { | ||||
317 | return _SetConsoleWindowInfo($self->{'handle'}, $flag, $left, $top, $right, $bottom); | ||||
318 | } | ||||
319 | } | ||||
320 | |||||
321 | #============== | ||||
322 | sub GetEvents { | ||||
323 | #============== | ||||
324 | my($self) = @_; | ||||
325 | return undef unless ref($self); | ||||
326 | return _GetNumberOfConsoleInputEvents($self->{'handle'}); | ||||
327 | } | ||||
328 | |||||
329 | #========== | ||||
330 | sub Flush { | ||||
331 | #========== | ||||
332 | my($self) = @_; | ||||
333 | return undef unless ref($self); | ||||
334 | return _FlushConsoleInputBuffer($self->{'handle'}); | ||||
335 | } | ||||
336 | |||||
337 | #============== | ||||
338 | sub InputChar { | ||||
339 | #============== | ||||
340 | my($self, $number) = @_; | ||||
341 | return undef unless ref($self); | ||||
342 | |||||
343 | $number = 1 unless defined($number); | ||||
344 | |||||
345 | my $buffer = (" " x $number); | ||||
346 | if (_ReadConsole($self->{'handle'}, $buffer, $number) == $number) { | ||||
347 | return $buffer; | ||||
348 | } | ||||
349 | else { | ||||
350 | return undef; | ||||
351 | } | ||||
352 | } | ||||
353 | |||||
354 | #========== | ||||
355 | sub Input { | ||||
356 | #========== | ||||
357 | my($self) = @_; | ||||
358 | return undef unless ref($self); | ||||
359 | return _ReadConsoleInput($self->{'handle'}); | ||||
360 | } | ||||
361 | |||||
362 | #============== | ||||
363 | sub PeekInput { | ||||
364 | #============== | ||||
365 | my($self) = @_; | ||||
366 | return undef unless ref($self); | ||||
367 | return _PeekConsoleInput($self->{'handle'}); | ||||
368 | } | ||||
369 | |||||
370 | #=============== | ||||
371 | sub WriteInput { | ||||
372 | #=============== | ||||
373 | my($self) = shift; | ||||
374 | return undef unless ref($self); | ||||
375 | return _WriteConsoleInput($self->{'handle'}, @_); | ||||
376 | } | ||||
377 | |||||
378 | #========= | ||||
379 | sub Mode { | ||||
380 | #========= | ||||
381 | my($self, $mode) = @_; | ||||
382 | return undef unless ref($self); | ||||
383 | if (defined($mode)) { | ||||
384 | return _SetConsoleMode($self->{'handle'}, $mode); | ||||
385 | } | ||||
386 | else { | ||||
387 | return _GetConsoleMode($self->{'handle'}); | ||||
388 | } | ||||
389 | } | ||||
390 | |||||
391 | #======== | ||||
392 | sub Cls { | ||||
393 | #======== | ||||
394 | my($self, $attr) = @_; | ||||
395 | return undef unless ref($self); | ||||
396 | |||||
397 | $attr = $ATTR_NORMAL unless defined($attr); | ||||
398 | |||||
399 | my ($x, $y) = $self->Size(); | ||||
400 | my($left, $top, $right ,$bottom) = $self->Window(); | ||||
401 | my $vx = $right - $left; | ||||
402 | my $vy = $bottom - $top; | ||||
403 | $self->FillChar(" ", $x*$y, 0, 0); | ||||
404 | $self->FillAttr($attr, $x*$y, 0, 0); | ||||
405 | $self->Cursor(0, 0); | ||||
406 | $self->Window(1, 0, 0, $vx, $vy); | ||||
407 | } | ||||
408 | |||||
409 | #========= | ||||
410 | sub Attr { | ||||
411 | #========= | ||||
412 | my($self, $attr) = @_; | ||||
413 | return undef unless ref($self); | ||||
414 | |||||
415 | if (not defined($attr)) { | ||||
416 | return (_GetConsoleScreenBufferInfo($self->{'handle'}))[4]; | ||||
417 | } | ||||
418 | else { | ||||
419 | return _SetConsoleTextAttribute($self->{'handle'}, $attr); | ||||
420 | } | ||||
421 | } | ||||
422 | |||||
423 | #=========== | ||||
424 | sub Cursor { | ||||
425 | #=========== | ||||
426 | my($self, $col, $row, $size, $visi) = @_; | ||||
427 | return undef unless ref($self); | ||||
428 | |||||
429 | my $curr_row = 0; | ||||
430 | my $curr_col = 0; | ||||
431 | my $curr_size = 0; | ||||
432 | my $curr_visi = 0; | ||||
433 | my $return = 0; | ||||
434 | my $discard = 0; | ||||
435 | |||||
436 | |||||
437 | if (defined($col)) { | ||||
438 | $row = -1 if not defined($row); | ||||
439 | if ($col == -1 or $row == -1) { | ||||
440 | ($discard, $discard, $curr_col, $curr_row) = _GetConsoleScreenBufferInfo($self->{'handle'}); | ||||
441 | $col=$curr_col if $col==-1; | ||||
442 | $row=$curr_row if $row==-1; | ||||
443 | } | ||||
444 | $return += _SetConsoleCursorPosition($self->{'handle'}, $col, $row); | ||||
445 | if (defined($size) and defined($visi)) { | ||||
446 | if ($size == -1 or $visi == -1) { | ||||
447 | ($curr_size, $curr_visi) = _GetConsoleCursorInfo($self->{'handle'}); | ||||
448 | $size = $curr_size if $size == -1; | ||||
449 | $visi = $curr_visi if $visi == -1; | ||||
450 | } | ||||
451 | $size = 1 if $size < 1; | ||||
452 | $size = 99 if $size > 99; | ||||
453 | $return += _SetConsoleCursorInfo($self->{'handle'}, $size, $visi); | ||||
454 | } | ||||
455 | return $return; | ||||
456 | } | ||||
457 | else { | ||||
458 | ($discard, $discard, $curr_col, $curr_row) = _GetConsoleScreenBufferInfo($self->{'handle'}); | ||||
459 | ($curr_size, $curr_visi) = _GetConsoleCursorInfo($self->{'handle'}); | ||||
460 | return ($curr_col, $curr_row, $curr_size, $curr_visi); | ||||
461 | } | ||||
462 | } | ||||
463 | |||||
464 | #========= | ||||
465 | sub Size { | ||||
466 | #========= | ||||
467 | my($self, $col, $row) = @_; | ||||
468 | return undef unless ref($self); | ||||
469 | |||||
470 | if (not defined($col)) { | ||||
471 | ($col, $row) = _GetConsoleScreenBufferInfo($self->{'handle'}); | ||||
472 | return ($col, $row); | ||||
473 | } | ||||
474 | else { | ||||
475 | $row = -1 if not defined($row); | ||||
476 | if ($col == -1 or $row == -1) { | ||||
477 | ($curr_col, $curr_row) = _GetConsoleScreenBufferInfo($self->{'handle'}); | ||||
478 | $col=$curr_col if $col==-1; | ||||
479 | $row=$curr_row if $row==-1; | ||||
480 | } | ||||
481 | return _SetConsoleScreenBufferSize($self->{'handle'}, $col, $row); | ||||
482 | } | ||||
483 | } | ||||
484 | |||||
485 | #============= | ||||
486 | sub FillAttr { | ||||
487 | #============= | ||||
488 | my($self, $attr, $number, $col, $row) = @_; | ||||
489 | return undef unless ref($self); | ||||
490 | |||||
491 | $number = 1 unless $number; | ||||
492 | |||||
493 | if (!defined($col) or !defined($row) or $col == -1 or $row == -1) { | ||||
494 | ($discard, $discard, | ||||
495 | $curr_col, $curr_row) = _GetConsoleScreenBufferInfo($self->{'handle'}); | ||||
496 | $col = $curr_col if !defined($col) or $col == -1; | ||||
497 | $row = $curr_row if !defined($row) or $row == -1; | ||||
498 | } | ||||
499 | return _FillConsoleOutputAttribute($self->{'handle'}, $attr, $number, $col, $row); | ||||
500 | } | ||||
501 | |||||
502 | #============= | ||||
503 | sub FillChar { | ||||
504 | #============= | ||||
505 | my($self, $char, $number, $col, $row) = @_; | ||||
506 | return undef unless ref($self); | ||||
507 | |||||
508 | if (!defined($col) or !defined($row) or $col == -1 or $row == -1) { | ||||
509 | ($discard, $discard, | ||||
510 | $curr_col, $curr_row) = _GetConsoleScreenBufferInfo($self->{'handle'}); | ||||
511 | $col = $curr_col if !defined($col) or $col == -1; | ||||
512 | $row = $curr_row if !defined($row) or $row == -1; | ||||
513 | } | ||||
514 | return _FillConsoleOutputCharacter($self->{'handle'}, $char, $number, $col, $row); | ||||
515 | } | ||||
516 | |||||
517 | #============ | ||||
518 | # spent 0s within Win32::Console::InputCP which was called:
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 44 of ExtUtils/MakeMaker/Locale.pm | ||||
519 | #============ | ||||
520 | 1 | 0s | my($self, $codepage) = @_; | ||
521 | 1 | 0s | $codepage = $self if (defined($self) and ref($self) ne "Win32::Console"); | ||
522 | 1 | 0s | if (defined($codepage)) { | ||
523 | return _SetConsoleCP($codepage); | ||||
524 | } | ||||
525 | else { | ||||
526 | 1 | 0s | 1 | 0s | return _GetConsoleCP(); # spent 0s making 1 call to Win32::Console::_GetConsoleCP |
527 | } | ||||
528 | } | ||||
529 | |||||
530 | #============= | ||||
531 | # spent 0s within Win32::Console::OutputCP which was called:
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 46 of ExtUtils/MakeMaker/Locale.pm | ||||
532 | #============= | ||||
533 | 1 | 0s | my($self, $codepage) = @_; | ||
534 | 1 | 0s | $codepage = $self if (defined($self) and ref($self) ne "Win32::Console"); | ||
535 | 1 | 0s | if (defined($codepage)) { | ||
536 | return _SetConsoleOutputCP($codepage); | ||||
537 | } | ||||
538 | else { | ||||
539 | 1 | 0s | 1 | 0s | return _GetConsoleOutputCP(); # spent 0s making 1 call to Win32::Console::_GetConsoleOutputCP |
540 | } | ||||
541 | } | ||||
542 | |||||
543 | #====================== | ||||
544 | sub GenerateCtrlEvent { | ||||
545 | #====================== | ||||
546 | my($self, $type, $pid) = @_; | ||||
547 | $type = constant("CTRL_C_EVENT", 0) unless defined($type); | ||||
548 | $pid = 0 unless defined($pid); | ||||
549 | return _GenerateConsoleCtrlEvent($type, $pid); | ||||
550 | } | ||||
551 | |||||
552 | #=================== | ||||
553 | #sub SetCtrlHandler { | ||||
554 | #=================== | ||||
555 | # my($name, $add) = @_; | ||||
556 | # $add = 1 unless defined($add); | ||||
557 | # my @nor = keys(%HandlerRoutineStack); | ||||
558 | # if ($add == 0) { | ||||
559 | # foreach $key (@nor) { | ||||
560 | # delete $HandlerRoutineStack{$key}, last if $HandlerRoutineStack{$key}==$name; | ||||
561 | # } | ||||
562 | # $HandlerRoutineRegistered--; | ||||
563 | # } else { | ||||
564 | # if ($#nor == -1) { | ||||
565 | # my $r = _SetConsoleCtrlHandler(); | ||||
566 | # if (!$r) { | ||||
567 | # print "WARNING: SetConsoleCtrlHandler failed...\n"; | ||||
568 | # } | ||||
569 | # } | ||||
570 | # $HandlerRoutineRegistered++; | ||||
571 | # $HandlerRoutineStack{$HandlerRoutineRegistered} = $name; | ||||
572 | # } | ||||
573 | #} | ||||
574 | |||||
575 | #=================== | ||||
576 | sub get_Win32_IPC_HANDLE { # So Win32::IPC can wait on a console handle | ||||
577 | #=================== | ||||
578 | $_[0]->{'handle'}; | ||||
579 | } | ||||
580 | |||||
581 | ######################################################################## | ||||
582 | # PRIVATE METHODS | ||||
583 | # | ||||
584 | |||||
585 | #================ | ||||
586 | #sub CtrlHandler { | ||||
587 | #================ | ||||
588 | # my($ctrltype) = @_; | ||||
589 | # my $routine; | ||||
590 | # my $result = 0; | ||||
591 | # CALLEM: foreach $routine (sort { $b <=> $a } keys %HandlerRoutineStack) { | ||||
592 | # #print "CtrlHandler: calling $HandlerRoutineStack{$routine}($ctrltype)\n"; | ||||
593 | # $result = &{"main::".$HandlerRoutineStack{$routine}}($ctrltype); | ||||
594 | # last CALLEM if $result; | ||||
595 | # } | ||||
596 | # return $result; | ||||
597 | #} | ||||
598 | |||||
599 | #============ | ||||
600 | sub DESTROY { | ||||
601 | #============ | ||||
602 | my($self) = @_; | ||||
603 | _CloseHandle($self->{'handle'}); | ||||
604 | } | ||||
605 | |||||
606 | ####################################################################### | ||||
607 | # dynamically load in the Console.pll module. | ||||
608 | # | ||||
609 | |||||
610 | 1 | 0s | 1 | 0s | bootstrap Win32::Console; # spent 0s making 1 call to DynaLoader::bootstrap |
611 | |||||
612 | ####################################################################### | ||||
613 | # ADDITIONAL CONSTANTS EXPORTED IN THE MAIN NAMESPACE | ||||
614 | # | ||||
615 | |||||
616 | 1 | 0s | $FG_BLACK = 0; | ||
617 | 1 | 0s | 1 | 0s | $FG_GRAY = constant("FOREGROUND_INTENSITY",0); # spent 0s making 1 call to Win32::Console::constant |
618 | 1 | 0s | 1 | 0s | $FG_BLUE = constant("FOREGROUND_BLUE",0); # spent 0s making 1 call to Win32::Console::constant |
619 | 1 | 0s | 2 | 0s | $FG_LIGHTBLUE = constant("FOREGROUND_BLUE",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
620 | constant("FOREGROUND_INTENSITY",0); | ||||
621 | 1 | 0s | 1 | 0s | $FG_RED = constant("FOREGROUND_RED",0); # spent 0s making 1 call to Win32::Console::constant |
622 | 1 | 0s | 2 | 0s | $FG_LIGHTRED = constant("FOREGROUND_RED",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
623 | constant("FOREGROUND_INTENSITY",0); | ||||
624 | 1 | 0s | 1 | 0s | $FG_GREEN = constant("FOREGROUND_GREEN",0); # spent 0s making 1 call to Win32::Console::constant |
625 | 1 | 0s | 2 | 0s | $FG_LIGHTGREEN = constant("FOREGROUND_GREEN",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
626 | constant("FOREGROUND_INTENSITY",0); | ||||
627 | 1 | 0s | 2 | 0s | $FG_MAGENTA = constant("FOREGROUND_RED",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
628 | constant("FOREGROUND_BLUE",0); | ||||
629 | 1 | 0s | 3 | 0s | $FG_LIGHTMAGENTA = constant("FOREGROUND_RED",0)| # spent 0s making 3 calls to Win32::Console::constant, avg 0s/call |
630 | constant("FOREGROUND_BLUE",0)| | ||||
631 | constant("FOREGROUND_INTENSITY",0); | ||||
632 | 1 | 0s | 2 | 0s | $FG_CYAN = constant("FOREGROUND_GREEN",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
633 | constant("FOREGROUND_BLUE",0); | ||||
634 | 1 | 0s | 3 | 0s | $FG_LIGHTCYAN = constant("FOREGROUND_GREEN",0)| # spent 0s making 3 calls to Win32::Console::constant, avg 0s/call |
635 | constant("FOREGROUND_BLUE",0)| | ||||
636 | constant("FOREGROUND_INTENSITY",0); | ||||
637 | 1 | 0s | 2 | 0s | $FG_BROWN = constant("FOREGROUND_RED",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
638 | constant("FOREGROUND_GREEN",0); | ||||
639 | 1 | 0s | 3 | 0s | $FG_YELLOW = constant("FOREGROUND_RED",0)| # spent 0s making 3 calls to Win32::Console::constant, avg 0s/call |
640 | constant("FOREGROUND_GREEN",0)| | ||||
641 | constant("FOREGROUND_INTENSITY",0); | ||||
642 | 1 | 0s | 3 | 0s | $FG_LIGHTGRAY = constant("FOREGROUND_RED",0)| # spent 0s making 3 calls to Win32::Console::constant, avg 0s/call |
643 | constant("FOREGROUND_GREEN",0)| | ||||
644 | constant("FOREGROUND_BLUE",0); | ||||
645 | 1 | 0s | 4 | 0s | $FG_WHITE = constant("FOREGROUND_RED",0)| # spent 0s making 4 calls to Win32::Console::constant, avg 0s/call |
646 | constant("FOREGROUND_GREEN",0)| | ||||
647 | constant("FOREGROUND_BLUE",0)| | ||||
648 | constant("FOREGROUND_INTENSITY",0); | ||||
649 | |||||
650 | 1 | 0s | $BG_BLACK = 0; | ||
651 | 1 | 0s | 1 | 0s | $BG_GRAY = constant("BACKGROUND_INTENSITY",0); # spent 0s making 1 call to Win32::Console::constant |
652 | 1 | 0s | 1 | 0s | $BG_BLUE = constant("BACKGROUND_BLUE",0); # spent 0s making 1 call to Win32::Console::constant |
653 | 1 | 0s | 2 | 0s | $BG_LIGHTBLUE = constant("BACKGROUND_BLUE",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
654 | constant("BACKGROUND_INTENSITY",0); | ||||
655 | 1 | 0s | 1 | 0s | $BG_RED = constant("BACKGROUND_RED",0); # spent 0s making 1 call to Win32::Console::constant |
656 | 1 | 0s | 2 | 0s | $BG_LIGHTRED = constant("BACKGROUND_RED",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
657 | constant("BACKGROUND_INTENSITY",0); | ||||
658 | 1 | 0s | 1 | 0s | $BG_GREEN = constant("BACKGROUND_GREEN",0); # spent 0s making 1 call to Win32::Console::constant |
659 | 1 | 0s | 2 | 0s | $BG_LIGHTGREEN = constant("BACKGROUND_GREEN",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
660 | constant("BACKGROUND_INTENSITY",0); | ||||
661 | 1 | 0s | 2 | 0s | $BG_MAGENTA = constant("BACKGROUND_RED",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
662 | constant("BACKGROUND_BLUE",0); | ||||
663 | 1 | 0s | 3 | 0s | $BG_LIGHTMAGENTA = constant("BACKGROUND_RED",0)| # spent 0s making 3 calls to Win32::Console::constant, avg 0s/call |
664 | constant("BACKGROUND_BLUE",0)| | ||||
665 | constant("BACKGROUND_INTENSITY",0); | ||||
666 | 1 | 0s | 2 | 0s | $BG_CYAN = constant("BACKGROUND_GREEN",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
667 | constant("BACKGROUND_BLUE",0); | ||||
668 | 1 | 0s | 3 | 0s | $BG_LIGHTCYAN = constant("BACKGROUND_GREEN",0)| # spent 0s making 3 calls to Win32::Console::constant, avg 0s/call |
669 | constant("BACKGROUND_BLUE",0)| | ||||
670 | constant("BACKGROUND_INTENSITY",0); | ||||
671 | 1 | 0s | 2 | 0s | $BG_BROWN = constant("BACKGROUND_RED",0)| # spent 0s making 2 calls to Win32::Console::constant, avg 0s/call |
672 | constant("BACKGROUND_GREEN",0); | ||||
673 | 1 | 0s | 3 | 0s | $BG_YELLOW = constant("BACKGROUND_RED",0)| # spent 0s making 3 calls to Win32::Console::constant, avg 0s/call |
674 | constant("BACKGROUND_GREEN",0)| | ||||
675 | constant("BACKGROUND_INTENSITY",0); | ||||
676 | 1 | 0s | 3 | 0s | $BG_LIGHTGRAY = constant("BACKGROUND_RED",0)| # spent 0s making 3 calls to Win32::Console::constant, avg 0s/call |
677 | constant("BACKGROUND_GREEN",0)| | ||||
678 | constant("BACKGROUND_BLUE",0); | ||||
679 | 1 | 0s | 4 | 0s | $BG_WHITE = constant("BACKGROUND_RED",0)| # spent 0s making 4 calls to Win32::Console::constant, avg 0s/call |
680 | constant("BACKGROUND_GREEN",0)| | ||||
681 | constant("BACKGROUND_BLUE",0)| | ||||
682 | constant("BACKGROUND_INTENSITY",0); | ||||
683 | |||||
684 | 1 | 0s | $ATTR_NORMAL = $FG_LIGHTGRAY|$BG_BLACK; | ||
685 | 1 | 0s | $ATTR_INVERSE = $FG_BLACK|$BG_LIGHTGRAY; | ||
686 | |||||
687 | 1 | 0s | for my $fg ($FG_BLACK, $FG_GRAY, $FG_BLUE, $FG_GREEN, | ||
688 | $FG_CYAN, $FG_RED, $FG_MAGENTA, $FG_BROWN, | ||||
689 | $FG_LIGHTBLUE, $FG_LIGHTGREEN, $FG_LIGHTCYAN, | ||||
690 | $FG_LIGHTRED, $FG_LIGHTMAGENTA, $FG_YELLOW, | ||||
691 | $FG_LIGHTGRAY, $FG_WHITE) | ||||
692 | { | ||||
693 | 16 | 0s | for my $bg ($BG_BLACK, $BG_GRAY, $BG_BLUE, $BG_GREEN, | ||
694 | $BG_CYAN, $BG_RED, $BG_MAGENTA, $BG_BROWN, | ||||
695 | $BG_LIGHTBLUE, $BG_LIGHTGREEN, $BG_LIGHTCYAN, | ||||
696 | $BG_LIGHTRED, $BG_LIGHTMAGENTA, $BG_YELLOW, | ||||
697 | $BG_LIGHTGRAY, $BG_WHITE) | ||||
698 | { | ||||
699 | 256 | 0s | push(@CONSOLE_COLORS, $fg|$bg); | ||
700 | } | ||||
701 | } | ||||
702 | |||||
703 | # Preloaded methods go here. | ||||
704 | |||||
705 | #Currently Autoloading is not implemented in Perl for win32 | ||||
706 | # Autoload methods go after __END__, and are processed by the autosplit program. | ||||
707 | |||||
708 | 1 | 0s | 1; | ||
709 | |||||
710 | __END__ | ||||
# spent 0s within Win32::Console::_GetConsoleCP which was called:
# once (0s+0s) by Win32::Console::InputCP at line 526 | |||||
# spent 0s within Win32::Console::_GetConsoleOutputCP which was called:
# once (0s+0s) by Win32::Console::OutputCP at line 539 | |||||
# spent 0s within Win32::Console::bootstrap which was called:
# once (0s+0s) by DynaLoader::bootstrap at line 216 of DynaLoader.pm | |||||
# spent 0s within Win32::Console::constant which was called 64 times, avg 0s/call:
# 4 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 645, avg 0s/call
# 4 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 679, avg 0s/call
# 3 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 634, avg 0s/call
# 3 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 639, avg 0s/call
# 3 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 676, avg 0s/call
# 3 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 642, avg 0s/call
# 3 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 663, avg 0s/call
# 3 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 629, avg 0s/call
# 3 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 673, avg 0s/call
# 3 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 668, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 656, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 619, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 622, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 625, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 637, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 671, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 653, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 632, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 627, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 666, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 661, avg 0s/call
# 2 times (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 659, avg 0s/call
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 624
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 651
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 617
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 652
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 618
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 621
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 655
# once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 658 |