Automatic date update in version.in
[binutils-gdb.git] / gprofng / src / DbeApplication.cc
blob382bd45f433ff586bd5beae105cfbab44a867186
1 /* Copyright (C) 2021 Free Software Foundation, Inc.
2 Contributed by Oracle.
4 This file is part of GNU Binutils.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
21 #include "config.h"
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <strings.h>
26 #include "DbeSession.h"
27 #include "DbeApplication.h"
28 #include "LoadObject.h"
29 #include "Experiment.h"
30 #include "PreviewExp.h"
31 #include "Function.h"
32 #include "Hist_data.h"
33 #include "Module.h"
34 #include "DataObject.h"
35 #include "Sample.h"
36 #include "CallStack.h"
37 #include "Print.h"
38 #include "util.h"
39 #include "libgen.h"
40 #include "i18n.h"
42 DbeApplication *theDbeApplication;
44 DbeApplication::DbeApplication (int argc, char *argv[], char* _run_dir)
45 : Application (argc, argv, _run_dir)
47 theDbeApplication = this;
48 ipcMode = false;
49 rdtMode = false;
50 if (argc > 1)
51 if (strcmp (argv[1], NTXT ("-IPC")) == 0
52 || strcmp (argv[1], NTXT ("-DIPC")) == 0)
53 ipcMode = true;
54 lic_found = 0;
55 lic_err = NULL;
57 // Instantiate a session
58 (void) new DbeSession (settings, ipcMode, rdtMode);
61 DbeApplication::~DbeApplication ()
63 delete dbeSession;
64 theDbeApplication = NULL;
67 Vector<char*> *
68 DbeApplication::initApplication (char *fdhome, char *licpath, ProgressFunc func)
70 // set the home directory
71 if (fdhome != NULL)
72 set_run_dir (fdhome);
74 // Set progress function
75 set_progress_func (func);
77 // Get license
78 char *license_err = NULL;
79 char *sts;
80 if (licpath != NULL)
82 lic_found = 0;
83 if (lic_found == 0)
85 lic_err = dbe_strdup (DbeApplication::get_version ());
86 sts = dbe_strdup (GTXT ("OK"));
88 else if (lic_found == 2)
90 lic_err = dbe_strdup (license_err);
91 sts = dbe_strdup (GTXT ("WARN"));
93 else if (lic_found == 3)
95 lic_err = dbe_strdup (license_err);
96 sts = dbe_strdup (GTXT ("FATAL"));
98 else
100 lic_err = dbe_strdup (license_err);
101 sts = dbe_strdup (GTXT ("ERROR"));
104 else
106 lic_err = dbe_strdup (DbeApplication::get_version ());
107 sts = dbe_strdup (GTXT ("OK"));
109 Vector<char*> *data = new Vector<char*>(2);
110 data->store (0, sts);
111 data->store (1, lic_err);
112 return data;