ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/constants.pl.PL
(Generate patch)

Comparing AnyEvent/constants.pl.PL (file contents):
Revision 1.10 by root, Sun Dec 5 11:41:45 2010 UTC vs.
Revision 1.16 by root, Mon Feb 13 14:51:42 2017 UTC

1#! perl 1#! perl
2 2
3# this file is unfortunately only executed at Makefile.PL time 3# this file is unfortunately only executed at Makefile.PL time
4 4
5my ($fh, $oldstdout);
6
7BEGIN {
8 open $fh, ">lib/AnyEvent/constants.pl"
9 or die "lib/AnyEvent/constants.pl: $!\n";
10
11 $oldstdout = select $fh;
12
13 print "# automatically generated from constants.pl.PL\n";
14}
15
16{
17 # from common::sense 3.74
18 use strict qw(vars subs);
19 no warnings;
20 use warnings qw(FATAL closed threads internal debugging pack malloc portable prototype
21 inplace io pipe unpack glob digit printf
22 layer reserved taint closure semicolon);
23 no warnings qw(exec newline unopened);
24
25 BEGIN {
26 print "sub AnyEvent::common_sense {\n";
27 printf " local \$^W;\n";
28 printf " \${^WARNING_BITS} ^= \${^WARNING_BITS} ^ \"%s\";\n",
29 join "", map "\\x$_", unpack "(H2)*", ${^WARNING_BITS};
30 # use strict, use utf8;
31 printf " \$^H |= 0x%x;\n", $^H;
32 print "}\n";
33 }
34}
35
5use Config; 36use Config;
37
38print "# generated for perl $] built for $Config{archname}\n";
6 39
7# when built as part of perl, these are not available 40# when built as part of perl, these are not available
8BEGIN { eval "use Socket ()" } 41BEGIN { eval "use Socket ()" }
9BEGIN { eval "use Fcntl ()" } 42BEGIN { eval "use Fcntl ()" }
10BEGIN { eval "use POSIX ()" } 43BEGIN { eval "use POSIX ()" }
11 44
12open my $fh, ">lib/AnyEvent/constants.pl"
13 or die "lib/AnyEvent/constants.pl: $_[0]\n";
14
15my $oldstdout = select $fh;
16
17print "# automatically generated from constants.pl.PL for perl $] built for $Config{archname}\n";
18
19sub i($$) { 45sub i($$) {
20 print "sub $_[0](){", $_[1]*1, "}\n"; 46 print "sub $_[0](){", $_[1]*1, "}\n";
21} 47}
22 48
23sub n($$) { 49sub n($$) {
42print "package AnyEvent::Base;\n"; 68print "package AnyEvent::Base;\n";
43 69
44# add these purely to avoid loading POSIX, which is slow and bloated. 70# add these purely to avoid loading POSIX, which is slow and bloated.
45 71
46i WNOHANG => eval { POSIX::WNOHANG() } || 1; 72i WNOHANG => eval { POSIX::WNOHANG() } || 1;
73
74print "package AnyEvent::IO;\n";
75
76i O_RDONLY => eval { Fcntl::O_RDONLY() } || 0;
77i O_WRONLY => eval { Fcntl::O_WRONLY() } || 1;
78i O_RDWR => eval { Fcntl::O_RDWR () } || 2;
79i O_CREAT => eval { Fcntl::O_CREAT () } || 64;
80i O_EXCL => eval { Fcntl::O_EXCL () } || 128;
81i O_TRUNC => eval { Fcntl::O_TRUNC () } || 512;
82i O_APPEND => eval { Fcntl::O_APPEND() } || 1024;
47 83
48print "package AnyEvent::Util;\n"; 84print "package AnyEvent::Util;\n";
49 85
50# broken windows perls use undocumented error codes... 86# broken windows perls use undocumented error codes...
51if ($WIN32) { 87if ($WIN32) {
127linux TCP_WINDOW_CLAMP 10 163linux TCP_WINDOW_CLAMP 10
128linux TCP_INFO 11 164linux TCP_INFO 11
129linux TCP_QUICKACK 12 165linux TCP_QUICKACK 12
130linux TCP_CONGESTION 13 166linux TCP_CONGESTION 13
131linux TCP_MD5SIG 14 167linux TCP_MD5SIG 14
168linux TCP_FASTOPEN 23
169linux MSG_DONTWAIT 0x0040
170linux MSG_NOSIGNAL 0x4000
171linux MSG_MORE 0x8000
172linux MSG_FASTOPEN 0x20000000
132netbsd TCP_MAXSEG 2 173netbsd TCP_MAXSEG 2
133netbsd TCP_KEEPIDLE 3 174netbsd TCP_KEEPIDLE 3
134netbsd TCP_NOPUSH 4 175netbsd TCP_NOPUSH 4
135netbsd TCP_KEEPINTVL 5 176netbsd TCP_KEEPINTVL 5
136netbsd TCP_KEEPCNT 6 177netbsd TCP_KEEPCNT 6
137netbsd TCP_KEEPINIT 7 178netbsd TCP_KEEPINIT 7
138netbsd TCP_NOOPT 8 179netbsd TCP_NOOPT 8
139netbsd TCP_MD5SIG 0x10 180netbsd TCP_MD5SIG 0x10
140netbsd TCP_CONGESTION 0x20 181netbsd TCP_CONGESTION 0x20
182netbsd MSG_NOSIGNAL 0x0400
141cygwin TCP_MAXSEG 0x02 183cygwin TCP_MAXSEG 0x02
142cygwin TCP_NOPUSH 0x04 184cygwin TCP_NOPUSH 0x04
143cygwin TCP_NOOPT 0x08 185cygwin TCP_NOOPT 0x08
144freebsd TCP_MAXSEG 0x02 186freebsd TCP_MAXSEG 0x02
145freebsd TCP_NOPUSH 0x04 187freebsd TCP_NOPUSH 0x04
146freebsd TCP_NOOPT 0x08 188freebsd TCP_NOOPT 0x08
147freebsd TCP_MD5SIG 0x10 189freebsd TCP_MD5SIG 0x10
148freebsd TCP_INFO 0x20 190freebsd TCP_INFO 0x20
149freebsd TCP_CONGESTION 0x40 191freebsd TCP_CONGESTION 0x40
192freebsd MSG_NOSIGNAL 0x20000
150solaris TCP_CORK 0x18 193solaris TCP_CORK 0x18
151solaris TCP_LINGER2 0x1C 194solaris TCP_LINGER2 0x1C
152solaris TCP_INIT_CWND 0x15 195solaris TCP_INIT_CWND 0x15
153solaris TCP_KEEPALIVE 0x8 196solaris TCP_KEEPALIVE 0x8
154solaris TCP_MAXSEG 0x02 197solaris TCP_MAXSEG 0x02

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines