aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/main_from_wmain.cc
blob: c3e2a716f3303855aff18c37cec773f80d7a23c6 (plain) (blame)
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
#include <qpdf/QUtil.hh>
#include <iostream>

#ifndef QPDF_NO_WCHAR_T
void wmain_test()
{
    auto realmain = [](int argc, char* argv[]) {
                        for (int i = 0; i < argc; ++i) {
                            std::cout << argv[i] << std::endl;
                        } return 0;
                    };
    wchar_t* argv[3];
    argv[0] = const_cast<wchar_t*>(L"ascii");
    argv[1] = const_cast<wchar_t*>(L"10 \xf7 2 = 5");
    argv[2] = const_cast<wchar_t*>(L"qwww\xf7\x03c0");
    QUtil::call_main_from_wmain(3, argv, realmain);
}
#endif // QPDF_NO_WCHAR_T

int main(int argc, char* argv[])
{
#ifndef QPDF_NO_WCHAR_T
    try
    {
	wmain_test();
    }
    catch (std::exception& e)
    {
	std::cout << "unexpected exception: " << e.what() << std::endl;
    }
#endif // QPDF_NO_WCHAR_T

    return 0;
}