MSDN: "WM_NCHITTEST - Returns HTCLIENT if the control style is
[wine.git] / tools / winapi_check / output.pm
blob59a04ae9fd41bd6d190beb9161046707d3aaec05
1 package output;
3 use strict;
5 sub new {
6 my $proto = shift;
7 my $class = ref($proto) || $proto;
8 my $self = {};
9 bless ($self, $class);
11 my $progress = \${$self->{PROGRESS}};
12 my $last_progress = \${$self->{LAST_PROGRESS}};
13 my $progress_count = \${$self->{PROGRESS_COUNT}};
15 $$progress = "";
16 $$last_progress = "";
17 $progress_count = 0;
19 return $self;
23 sub show_progress {
24 my $self = shift;
25 my $progress = \${$self->{PROGRESS}};
26 my $last_progress = \${$self->{LAST_PROGRESS}};
27 my $progress_count = \${$self->{PROGRESS_COUNT}};
29 $$progress_count++;
31 if($$progress_count > 0 && $$progress) {
32 print STDERR $$progress;
33 $$last_progress = $$progress;
37 sub hide_progress {
38 my $self = shift;
39 my $progress = \${$self->{PROGRESS}};
40 my $last_progress = \${$self->{LAST_PROGRESS}};
41 my $progress_count = \${$self->{PROGRESS_COUNT}};
43 $$progress_count--;
45 if($$last_progress) {
46 my $message;
47 for (1..length($$last_progress)) {
48 $message .= "\b \b";
50 print STDERR $message;
51 undef $$last_progress;
55 sub update_progress {
56 my $self = shift;
57 my $progress = \${$self->{PROGRESS}};
58 my $last_progress = \${$self->{LAST_PROGRESS}};
60 my $prefix = "";
61 my $suffix = "";
62 if($$last_progress) {
63 for (1..length($$last_progress)) {
64 $prefix .= "\b";
67 my $diff = length($$last_progress)-length($$progress);
68 if($diff > 0) {
69 for (1..$diff) {
70 $suffix .= " ";
72 for (1..$diff) {
73 $suffix .= "\b";
77 print STDERR $prefix . $$progress . $suffix;
78 $$last_progress = $$progress;
81 sub progress {
82 my $self = shift;
83 my $progress = \${$self->{PROGRESS}};
85 $$progress = shift;
87 $self->update_progress;
90 sub write {
91 my $self = shift;
93 my $message = shift;
96 $self->hide_progress;
97 print $message;
98 $self->show_progress;