Commit | Line | Data |
---|---|---|
7eeb782e AT |
1 | #!/usr/bin/perl |
2 | # This script morphs config.h.in into config.vcin | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | my %defaults = | |
8 | ( CHINESE_RULES => 0, | |
9 | RESIGNATION_ALLOWED => 1, | |
10 | HASHING_SCHEME => 2, | |
11 | DEFAULT_LEVEL => 10, | |
12 | DEFAULT_MEMORY => 8, | |
13 | ENABLE_SOCKET_SUPPORT => 1, | |
14 | ALTERNATE_CONNECTIONS => 1, | |
15 | SEMEAI_NODE_LIMIT => 500, | |
16 | OWL_NODE_LIMIT => 1000, | |
17 | EXPERIMENTAL_SEMEAI => 1, | |
18 | EXPERIMENTAL_OWL_EXT => 0, | |
19 | EXPERIMENTAL_CONNECTIONS => 1, | |
20 | LARGE_SCALE => 0, | |
21 | GRID_OPT => 1, | |
22 | OWL_THREATS => 0, | |
23 | USE_BREAK_IN => 1, | |
24 | COSMIC_GNUGO => 0, | |
25 | ORACLE => 0, | |
26 | USE_VALGRIND => 0, | |
27 | READLINE => 0); | |
28 | ||
29 | my @skip = qw/ | |
30 | GNU_PACKAGE | |
31 | SIZEOF_INT | |
32 | SIZEOF_LONG | |
33 | GNUGO_PATH | |
34 | PACKAGE | |
35 | SIZEOF_INT | |
36 | SIZEOF_LONG | |
37 | const | |
38 | ANSI_COLOR | |
39 | TERMINFO | |
40 | VERSION | |
41 | TIME_WITH_SYS_TIME | |
42 | /; | |
43 | ||
44 | open (CONFIGH, "config.h.in") or | |
45 | die "Couldn't open config.h.in: $!"; | |
46 | ||
47 | open (CONFIGVC, ">config.vcin") or | |
48 | die "Couldn't overwrite config.vcin: $!"; | |
49 | ||
50 | print CONFIGVC | |
51 | q%/* This is the Microsoft Visual C++ version of config.h * | |
52 | * Replace the distributed config.h with this file * | |
53 | * See config.h.in for comments on the meanings of most of the * | |
54 | * defines. This file is autogenerated. Do not modify it. * | |
55 | * See instead, the perl script makevcdist.pl */ | |
56 | ||
57 | #define HAVE_CRTDBG_H 1 | |
58 | #define HAVE_WINSOCK_IO_H 1 | |
59 | #define HAVE__VSNPRINTF 1 | |
60 | ||
61 | %; | |
62 | ||
63 | ||
64 | my $comment = ""; | |
65 | while (<CONFIGH>) { | |
66 | s/\s*$//ms; | |
67 | if (/^\s*$/) { next; } | |
68 | if (m@^/[*].*@) { | |
69 | $comment = $_; | |
70 | next; | |
71 | } | |
72 | if (/\*\/\s*$/) { | |
73 | $comment .= "\n$_"; | |
74 | next; | |
75 | } | |
76 | if (/HAVE_/) { next; } | |
77 | if (! /^#undef\s+([^ ]*)\s*$/ms) { | |
78 | warn "Don't understand: $_"; | |
79 | next; | |
80 | } | |
81 | my $define = $1; | |
82 | if (!defined($defaults{$define})) { | |
83 | my $found =0; | |
84 | foreach (@skip) {$found = 1 if $_ eq $define;} | |
85 | warn "Unknown define: $define" unless $found; | |
86 | next; | |
87 | } | |
88 | print CONFIGVC "$comment\n"; | |
89 | print CONFIGVC "#define $define $defaults{$define}\n\n"; | |
90 | } | |
91 | ||
92 | print CONFIGVC | |
93 | q% | |
94 | /* Version number of package */ | |
95 | #define PACKAGE "gnugo" | |
96 | ||
97 | /* The concatenation of the strings "GNU ", and PACKAGE. */ | |
98 | #define GNU_PACKAGE "GNU " PACKAGE | |
99 | ||
100 | /* The number of bytes in a int. */ | |
101 | #define SIZEOF_INT 4 | |
102 | ||
103 | /* The number of bytes in a long. */ | |
104 | #define SIZEOF_LONG 4 | |
105 | ||
106 | /* Version number of package */ | |
107 | #define VERSION "@VERSION@" | |
108 | ||
109 | #pragma warning(disable: 4244 4305) | |
110 | %; |