Debian Codegraph @

src/main.cpp

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2009 Ingo Ruhnke <[email protected]>cxx . . $ `<file>/src/main.cpp`/
2 // SPDX-License-Identifier: GPL-3.0-or-later
3
4 #include <iostream>
5 #include <cstring>
6 #include <cstdlib>
7
8 #include <gtkmm.h>
9
10 #include "joystick_config_files.hpp"cxx . . $ `<file>/src/joystick_config_files.hpp`/
11 #include "joystick_test_widget.hpp"cxx . . $ `<file>/src/joystick_test_widget.hpp`/
12 #include "main.hpp"cxx . . $ `<file>/src/main.hpp`/
13
14 Maincxx . . $ Main#* Maincxx . . $ Main#::current_cxx . . $ Main#current_. = 0;
15 bool m_verbosecxx . . $ m_verbose. = false;
16
17 #ifndef JSTEST_GTK_DATADIRcxx . . $ `<built-in>:452:9`!
18 # define JSTEST_GTK_DATADIR "data/"
19 #endif
20
21 #ifndef JSTEST_GTK_VERSIONcxx . . $ `<built-in>:453:9`!
22 # define JSTEST_GTK_VERSION "unknown"
23 #endif
24
25 Maincxx . . $ Main#::Maincxx . . $ Main#Main(49f6e7a06ebc5aa8).() :
26 Gtkcxx . . $ Gtk/::Applicationcxx . . $ Gtk/Application#("com.gmail.grumbel.jstest-gtk"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9)., Giocxx . . $ Gio/::APPLICATION_HANDLES_OPENcxx . . $ Gio/APPLICATION_HANDLES_OPEN.),
27 datadircxx . . $ Main#datadir.(JSTEST_GTK_DATADIRcxx . . $ `<built-in>:452:9`!),
28 m_simple_uicxx . . $ Main#m_simple_ui.(false)
29 {
30 current_cxx . . $ Main#current_. = this;
31 }
32
33 Maincxx . . $ Main#::~cxx . . $ Main#`~Main`(49f6e7a06ebc5aa8).Maincxx . . $ Main#()
34 {
35 }
36
37 int
38 Maincxx . . $ Main#::runcxx . . $ Main#run(afcd3168fc1188a4).(int argc, char** argv)
39 {
40 stdcxx . . $ std/::stringcxx . . $ std/string# device_filecxx . . $ std/__cxx11/basic_string#basic_string(49f6e7a06ebc5aa8).;
41
42 for (int i = 1; i < argc; ++i)
43 {
44 if (strcmp("--help", argv[i]) == 0 || strcmp("-h", argv[i]) == 0)
45 {
46 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Usage: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[0] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " [OPTIONS]... [DEVICE]\n"
47 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "A graphical joystick tester.\n"
48 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"
49 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Options:\n"
50 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " -h, --help Display this help and exit\n"
51 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " -v, --version Display version information and exit\n"
52 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --simple Hide graphical representation of axis\n"
53 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --verbose Print useful extra information\n"
54 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --datadir DIR Load application data from DIR\n"
55 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"
56 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Report bugs to Ingo Ruhnke <[email protected]>.\n";
57 return 0;
58 }
59 else if (strcmp("--version", argv[i]) == 0 || strcmp("-v", argv[i]) == 0)
60 {
61 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "jstest-gtk " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). JSTEST_GTK_VERSIONcxx . . $ `<built-in>:453:9`! <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
62 return 0;
63 }
64 else if (strcmp("--simple", argv[i]) == 0)
65 {
66 m_simple_uicxx . . $ Main#m_simple_ui. = true;
67 }
68 else if (strcmp("--verbose", argv[i]) == 0)
69 {
70 m_verbosecxx . . $ m_verbose. = true;
71 }
72 else if (strcmp("--datadir", argv[i]) == 0)
73 {
74 i += 1;
75 if (i >= argc)
76 {
77 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Error: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[0] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ": argument to --datadir is missing" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
78 return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!;
79 }
80 datadircxx . . $ Main#datadir. =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). argv[i];
81 if (!datadircxx . . $ Main#datadir..emptycxx . . $ std/__cxx11/basic_string#empty(50ce9a9e25b4a850).() && datadircxx . . $ Main#datadir..backcxx . . $ std/__cxx11/basic_string#back(abfeeb4cf402a9b1).() != '/')
82 datadircxx . . $ Main#datadir. +=cxx . . $ std/__cxx11/basic_string#`operator+=`(63cc1ae870623930). '/';
83 }
84 else if (argv[i][0] == '-')
85 {
86 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Error: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[0] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ": unrecognized option '" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[i] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "'" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
87 return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!;
88 }
89 else
90 {
91 if (!device_file.emptycxx . . $ std/__cxx11/basic_string#empty(50ce9a9e25b4a850).())
92 {
93 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Error: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[0] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ": multiple device files given, only one allowed: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[i] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
94 return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!;
95 }
96 device_file =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). argv[i];
97 }
98 }
99
100 joystick_configscxx . . $ joystick_configs. =cxx . . $ std/vector#`operator=`(27b3db0518c64371). load_all_configscxx . . $ load_all_configs(dd0b087177d19225).(datadircxx . . $ Main#datadir. +cxx . . $ std/operator+(40fc1db9226233c6). "mappings");
101
102 try
103 {
104 JoystickTestWidgetcxx . . $ JoystickTestWidget# windowcxx . . $ JoystickTestWidget#JoystickTestWidget(a6d8bc3e36d41cda).(m_simple_uicxx . . $ Main#m_simple_ui., device_file);
105 window.show_allcxx . . $ Gtk/Widget#show_all(49f6e7a06ebc5aa8).();
106 return Gtkcxx . . $ Gtk/::Applicationcxx . . $ Gtk/Application#::runcxx . . $ Gtk/Application#run(3e7518dfcaf80f6b).(window);
107 }
108 catch (stdcxx . . $ std/::exception& err)
109 {
110 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Error: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). err.what() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
111 return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!;
112 }
113 catch (Glibcxx . . $ Glib/::Exceptioncxx . . $ Glib/Exception#& err)
114 {
115 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Error: " <<cxx . . $ Glib/`operator<<`(d3a65685b7328161). err.whatcxx . . $ Glib/Exception#what(fff0f585954e56f3).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
116 return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!;
117 }
118 }
119
120 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char** argv)
121 {
122 try
123 {
124 Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Maincxx . . $ Main#> app = Maincxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::createcxx . . $ Main#create(b177c74efe3d33dc).();
125 return app->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).runcxx . . $ Main#run(afcd3168fc1188a4).(argc, argv);
126 }
127 catch (stdcxx . . $ std/::exception& err)
128 {
129 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Error: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). err.what() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
130 return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!;
131 }
132 }
133
134 Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Maincxx . . $ Main#> Maincxx . . $ Main#::createcxx . . $ Main#create(b177c74efe3d33dc).()
135 {
136 return Glibcxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::RefPtrcxx . . $ Glib/RefPtr#<Maincxx . . $ Main#>(new Maincxx . . $ Main#);
137 }
138
139 /* EOF */