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