1 --- misc/glib-2.28.1/build/win32/make.msc 2011-04-01 16:52:15.676157900 +0200
2 +++ misc/build/glib-2.28.1/build/win32/make.msc 2011-04-01 16:52:02.168385300 +0200
4 BABL_LIBS = $(BABL)\babl\babl-1.0.lib
6 # force inclusion of the _right_ cairoversion.h even when using without installation
7 -CAIRO_CFLAGS = -FI $(CAIRO)\cairo-version.h -I $(CAIRO)\src -I $(CAIRO)
8 +CAIRO_CFLAGS = -I $(CAIRO)\src -I $(CAIRO)
9 CAIRO_LIBS = $(CAIRO)\src\libcairo.lib
11 DIRENT_CFLAGS = -I ..\build\win32\dirent
12 --- misc/glib-2.28.1/gobject/glib-mkenums 2011-04-01 16:52:15.155128100 +0200
13 +++ misc/build/glib-2.28.1/gobject/glib-mkenums 2011-04-01 16:51:30.994602300 +0200
23 +# Information about the current enumeration
24 +my $flags; # Is enumeration a bitmask?
25 +my $option_underscore_name; # Overriden underscore variant of the enum name
26 + # for example to fix the cases we don't get the
27 + # mixed-case -> underscorized transform right.
28 +my $option_lowercase_name; # DEPRECATED. A lower case name to use as part
29 + # of the *_get_type() function, instead of the
30 + # one that we guess. For instance, when an enum
31 + # uses abnormal capitalization and we can not
32 + # guess where to put the underscores.
33 +my $seenbitshift; # Have we seen bitshift operators?
34 +my $enum_prefix; # Prefix for this enumeration
35 +my $enumname; # Name for this enumeration
36 +my $enumshort; # $enumname without prefix
37 +my $enumname_prefix; # prefix of $enumname
38 +my $enumindex = 0; # Global enum counter
39 +my $firstenum = 1; # Is this the first enumeration per file?
40 +my @entries; # [ $name, $val ] for each entry
41 +my $sandbox = Safe->new; # sandbox for safe evaluation of expressions
47 + for $opt (split /\s*,\s*/, $opts) {
50 + my ($key,$val) = $opt =~ /(\w+)(?:=(.+))?/;
51 + defined $val or $val = 1;
52 + push @opts, $key, $val;
58 + my $file_name = shift;
59 + my $looking_for_name = 0;
62 + # read lines until we have no open comments
63 + while (m@/\*([^*]|\*(?!/))*$@) {
65 + defined ($new = <$file>) || die "Unmatched comment in $ARGV";
68 + # strip comments w/o options
79 + if ($looking_for_name) {
86 + # Handle include files
87 + if (/^\#include\s*<([^>]*)>/ ) {
89 + open NEWFILE, $file or die "Cannot open include file $file: $!\n";
91 + if (parse_entries (\*NEWFILE, $NEWFILE)) {
98 + if (/^\s*\}\s*(\w+)/) {
106 + $looking_for_name = 1;
113 + \s*\w+\s*\(.*\)\s* # macro with multiple args
115 + (?:[^,/]|/(?!\*))* # anything but a comma or comment
122 + my ($name, $value, $options) = ($1,$2,$3);
124 + if (!defined $flags && defined $value && $value =~ /<</) {
128 + if (defined $options) {
129 + my %options = parse_trigraph($options);
130 + if (!defined $options{skip}) {
131 + push @entries, [ $name, $value, $options{nick} ];
134 + push @entries, [ $name, $value ];
136 + } elsif (m@^\s*\#@) {
137 + # ignore preprocessor directives
139 + print STDERR "$0: $file_name:$.: Failed to parse `$_'\n";
147 + print "glib-mkenums version glib-@GLIB_VERSION@\n";
148 + print "glib-mkenums comes with ABSOLUTELY NO WARRANTY.\n";
149 + print "You may redistribute copies of glib-mkenums under the terms of\n";
150 + print "the GNU General Public License which can be found in the\n";
151 + print "GLib source package. Sources, examples and contact\n";
152 + print "information are available at http://www.gtk.org\n";
157 + print " glib-mkenums [OPTION...] [FILES...]\n\n";
158 + print "Help Options:\n";
159 + print " -h, --help Show this help message\n\n";
160 + print "Utility Options:\n";
161 + print " --fhead <text> Output file header\n";
162 + print " --fprod <text> Per input file production\n";
163 + print " --ftail <text> Output file trailer\n";
164 + print " --eprod <text> Per enum text (produced prior to value itarations)\n";
165 + print " --vhead <text> Value header, produced before iterating over enum values\n";
166 + print " --vprod <text> Value text, produced for each enum value\n";
167 + print " --vtail <text> Value tail, produced after iterating over enum values\n";
168 + print " --comments <text> Comment structure\n";
169 + print " --template file Template file\n";
170 + print " -v, --version Print version informations\n\n";
171 + print "Production text substitutions:\n";
172 + print " \@EnumName\@ PrefixTheXEnum\n";
173 + print " \@enum_name\@ prefix_the_xenum\n";
174 + print " \@ENUMNAME\@ PREFIX_THE_XENUM\n";
175 + print " \@ENUMSHORT\@ THE_XENUM\n";
176 + print " \@ENUMPREFIX\@ PREFIX\n";
177 + print " \@VALUENAME\@ PREFIX_THE_XVALUE\n";
178 + print " \@valuenick\@ the-xvalue\n";
179 + print " \@valuenum\@ the integer value (limited support, Since: 2.26)\n";
180 + print " \@type\@ either enum or flags\n";
181 + print " \@Type\@ either Enum or Flags\n";
182 + print " \@TYPE\@ either ENUM or FLAGS\n";
183 + print " \@filename\@ name of current input file\n";
184 + print " \@basename\@ base name of the current input file (Since: 2.22)\n";
188 +# production variables:
189 +my $fhead = ""; # output file header
190 +my $fprod = ""; # per input file production
191 +my $ftail = ""; # output file trailer
192 +my $eprod = ""; # per enum text (produced prior to value itarations)
193 +my $vhead = ""; # value header, produced before iterating over enum values
194 +my $vprod = ""; # value text, produced for each enum value
195 +my $vtail = ""; # value tail, produced after iterating over enum values
196 +my $comment_tmpl = ""; # comment template
198 +sub read_template_file {
200 + my %tmpl = ('file-header', $fhead,
201 + 'file-production', $fprod,
202 + 'file-tail', $ftail,
203 + 'enumeration-production', $eprod,
204 + 'value-header', $vhead,
205 + 'value-production', $vprod,
206 + 'value-tail', $vtail,
207 + 'comment', $comment_tmpl);
209 + open (FILE, $file) || die "Can't open $file: $!\n";
211 + if (/^\/\*\*\*\s+(BEGIN|END)\s+([\w-]+)\s+\*\*\*\//) {
212 + if (($in eq 'junk') && ($1 eq 'BEGIN') && (exists($tmpl{$2}))) {
216 + elsif (($in eq $2) && ($1 eq 'END') && (exists($tmpl{$2}))) {
220 + die "Malformed template file $file\n";
223 + if (!($in eq 'junk')) {
228 + if (!($in eq 'junk')) {
229 + die "Malformed template file $file\n";
231 + $fhead = $tmpl{'file-header'};
232 + $fprod = $tmpl{'file-production'};
233 + $ftail = $tmpl{'file-tail'};
234 + $eprod = $tmpl{'enumeration-production'};
235 + $vhead = $tmpl{'value-header'};
236 + $vprod = $tmpl{'value-production'};
237 + $vtail = $tmpl{'value-tail'};
238 + $comment_tmpl = $tmpl{'comment'};
240 + # default to C-style comments
241 + $comment_tmpl = "/* \@comment\@ */" if $comment_tmpl eq "";
244 +if (!defined $ARGV[0]) {
247 +while ($_=$ARGV[0],/^-/) {
250 + if (/^--template$/) { read_template_file (shift); }
251 + elsif (/^--fhead$/) { $fhead = $fhead . shift }
252 + elsif (/^--fprod$/) { $fprod = $fprod . shift }
253 + elsif (/^--ftail$/) { $ftail = $ftail . shift }
254 + elsif (/^--eprod$/) { $eprod = $eprod . shift }
255 + elsif (/^--vhead$/) { $vhead = $vhead . shift }
256 + elsif (/^--vprod$/) { $vprod = $vprod . shift }
257 + elsif (/^--vtail$/) { $vtail = $vtail . shift }
258 + elsif (/^--comments$/) { $comment_tmpl = shift }
259 + elsif (/^--help$/ || /^-h$/ || /^-\?$/) { usage; }
260 + elsif (/^--version$/ || /^-v$/) { version; }
262 + last if not defined($ARGV[0]);
265 +# put auto-generation comment
267 + my $comment = $comment_tmpl;
268 + $comment =~ s/\@comment\@/Generated data (by glib-mkenums)/;
269 + print "\n" . $comment . "\n\n";
272 +if (length($fhead)) {
274 + my $base = basename ($ARGV[0]);
276 + $prod =~ s/\@filename\@/$ARGV[0]/g;
277 + $prod =~ s/\@basename\@/$base/g;
278 + $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
279 + $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
287 + close (ARGV); # reset line numbering
288 + $firstenum = 1; # Flag to print filename at next enum
291 + # read lines until we have no open comments
292 + while (m@/\*([^*]|\*(?!/))*$@) {
294 + defined ($new = <>) || die "Unmatched comment in $ARGV";
297 + # strip comments w/o options
302 + if (m@^\s*typedef\s+enum\s*
310 + my %options = parse_trigraph ($2);
311 + next if defined $options{skip};
312 + $enum_prefix = $options{prefix};
313 + $flags = $options{flags};
314 + $option_lowercase_name = $options{lowercase_name};
315 + $option_underscore_name = $options{underscore_name};
317 + $enum_prefix = undef;
319 + $option_lowercase_name = undef;
320 + $option_underscore_name = undef;
322 + if (defined $option_lowercase_name) {
323 + if (defined $option_underscore_name) {
324 + print STDERR "$0: $ARGV:$.: lowercase_name overriden with underscore_name\n";
325 + $option_lowercase_name = undef;
327 + print STDERR "$0: $ARGV:$.: lowercase_name is deprecated, use underscore_name\n";
330 + # Didn't have trailing '{' look on next lines
331 + if (!defined $1 && !defined $4) {
342 + # Now parse the entries
343 + parse_entries (\*ARGV, $ARGV);
345 + # figure out if this was a flags or enums enumeration
346 + if (!defined $flags) {
347 + $flags = $seenbitshift;
350 + # Autogenerate a prefix
351 + if (!defined $enum_prefix) {
353 + my $nick = $_->[2];
354 + if (!defined $nick) {
355 + my $name = $_->[0];
356 + if (defined $enum_prefix) {
357 + my $tmp = ~ ($name ^ $enum_prefix);
358 + ($tmp) = $tmp =~ /(^\xff*)/;
359 + $enum_prefix = $enum_prefix & $tmp;
361 + $enum_prefix = $name;
365 + if (!defined $enum_prefix) {
368 + # Trim so that it ends in an underscore
369 + $enum_prefix =~ s/_[^_]*$/_/;
372 + # canonicalize user defined prefixes
373 + $enum_prefix = uc($enum_prefix);
374 + $enum_prefix =~ s/-/_/g;
375 + $enum_prefix =~ s/(.*)([^_])$/$1$2_/;
378 + for $entry (@entries) {
379 + my ($name,$num,$nick) = @{$entry};
380 + if (!defined $nick) {
381 + ($nick = $name) =~ s/^$enum_prefix//;
384 + @{$entry} = ($name, $num, $nick);
389 + # Spit out the output
390 + if (defined $option_underscore_name) {
391 + $enumlong = uc $option_underscore_name;
392 + $enumsym = lc $option_underscore_name;
393 + $enumshort = $enumlong;
394 + $enumshort =~ s/^[A-Z][A-Z0-9]*_//;
396 + $enumname_prefix = $enumlong;
397 + $enumname_prefix =~ s/$enumshort$//;
399 + # enumname is e.g. GMatchType
400 + $enspace = $enumname;
401 + $enspace =~ s/^([A-Z][a-z]*).*$/$1/;
403 + $enumshort = $enumname;
404 + $enumshort =~ s/^[A-Z][a-z]*//;
405 + $enumshort =~ s/([^A-Z])([A-Z])/$1_$2/g;
406 + $enumshort =~ s/([A-Z][A-Z])([A-Z][0-9a-z])/$1_$2/g;
407 + $enumshort = uc($enumshort);
409 + $enumname_prefix = $enumname;
410 + $enumname_prefix =~ s/^([A-Z][a-z]*).*$/$1/;
411 + $enumname_prefix = uc($enumname_prefix);
413 + $enumlong = uc($enspace) . "_" . $enumshort;
414 + $enumsym = lc($enspace) . "_" . lc($enumshort);
416 + if (defined($option_lowercase_name)) {
417 + $enumsym = $option_lowercase_name;
424 + if (length($fprod)) {
426 + my $base = basename ($ARGV);
428 + $prod =~ s/\@filename\@/$ARGV/g;
429 + $prod =~ s/\@basename\@/$base/g;
430 + $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
431 + $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
438 + if (length($eprod)) {
441 + $prod =~ s/\@enum_name\@/$enumsym/g;
442 + $prod =~ s/\@EnumName\@/$enumname/g;
443 + $prod =~ s/\@ENUMSHORT\@/$enumshort/g;
444 + $prod =~ s/\@ENUMNAME\@/$enumlong/g;
445 + $prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
446 + if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
447 + if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
448 + if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
449 + $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
450 + $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
456 + if (length($vhead)) {
459 + $prod =~ s/\@enum_name\@/$enumsym/g;
460 + $prod =~ s/\@EnumName\@/$enumname/g;
461 + $prod =~ s/\@ENUMSHORT\@/$enumshort/g;
462 + $prod =~ s/\@ENUMNAME\@/$enumlong/g;
463 + $prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
464 + if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
465 + if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
466 + if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
467 + $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
468 + $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
474 + if (length($vprod)) {
478 + $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
479 + $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
481 + my ($name,$num,$nick) = @{$_};
482 + my $tmp_prod = $prod;
484 + if ($prod =~ /\@valuenum\@/) {
485 + # only attempt to eval the value if it is requested
486 + # this prevents us from throwing errors otherwise
487 + if (defined $num) {
488 + # use sandboxed perl evaluation as a reasonable
489 + # approximation to C constant folding
490 + $num = $sandbox->reval ($num);
492 + # make sure it parsed to an integer
493 + if (!defined $num or $num !~ /^-?\d+$/) {
494 + die "Unable to parse enum value '$num'";
500 + $tmp_prod =~ s/\@valuenum\@/$num/g;
501 + $next_num = $num + 1;
504 + $tmp_prod =~ s/\@VALUENAME\@/$name/g;
505 + $tmp_prod =~ s/\@valuenick\@/$nick/g;
506 + if ($flags) { $tmp_prod =~ s/\@type\@/flags/g; } else { $tmp_prod =~ s/\@type\@/enum/g; }
507 + if ($flags) { $tmp_prod =~ s/\@Type\@/Flags/g; } else { $tmp_prod =~ s/\@Type\@/Enum/g; }
508 + if ($flags) { $tmp_prod =~ s/\@TYPE\@/FLAGS/g; } else { $tmp_prod =~ s/\@TYPE\@/ENUM/g; }
511 + print "$tmp_prod\n";
515 + if (length($vtail)) {
518 + $prod =~ s/\@enum_name\@/$enumsym/g;
519 + $prod =~ s/\@EnumName\@/$enumname/g;
520 + $prod =~ s/\@ENUMSHORT\@/$enumshort/g;
521 + $prod =~ s/\@ENUMNAME\@/$enumlong/g;
522 + $prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
523 + if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
524 + if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
525 + if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
526 + $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
527 + $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
535 +if (length($ftail)) {
537 + my $base = basename ($ARGV);
539 + $prod =~ s/\@filename\@/$ARGV/g;
540 + $prod =~ s/\@basename\@/$base/g;
541 + $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
542 + $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
548 +# put auto-generation comment
550 + my $comment = $comment_tmpl;
551 + $comment =~ s/\@comment\@/Generated data ends here/;
552 + print "\n" . $comment . "\n\n";