1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!/usr/bin/perl -w
use strict;
use warnings;
my $header = <<'END';
/*
* Copyright 2016-2018 Andrey Semashev
*
* Distributed under the Boost Software License, Version 1.0.
* See http://www.boost.org/LICENSE_1_0.txt
*/
#ifndef BOOST_WINAPI_ERROR_CODES_HPP_INCLUDED_
#define BOOST_WINAPI_ERROR_CODES_HPP_INCLUDED_
#include <boost/winapi/basic_types.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
namespace winapi {
END
my $footer = <<'END';
} // namespace winapi
} // namespace boost
#endif // BOOST_WINAPI_ERROR_CODES_HPP_INCLUDED_
END
print $header;
while (<>)
{
my $line = $_;
chomp($line);
if ($line =~ /^\s*#\s*define\s+([a-zA-Z_\d]+)\s+(0[xX][[:xdigit:]]+|\d+|[a-zA-Z_\d]+)[lLuU]*\s*(\/\/.*|\/\*.*)?$/)
{
# We define some of the constants in other headers
if ($1 ne "FORCEINLINE" && $1 ne "WAIT_TIMEOUT")
{
my $value = $2;
print "BOOST_CONSTEXPR_OR_CONST DWORD_ ", $1 , "_ = ";
if ($value =~ /0[xX][[:xdigit:]]+|\d+/)
{
print $value;
}
else
{
print $value, "_";
}
print ";\n";
}
}
}
print $footer;
|