1 /* Copyright (C) 2021-2023 Free Software Foundation, Inc.
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)
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. */
24 #include "PreviewExp.h"
25 #include "Data_window.h"
26 #include "DbeSession.h"
31 PreviewExp::PreviewExp (): Experiment () { }
33 PreviewExp::~PreviewExp () { }//~PreviewExp
35 Experiment::Exp_status
36 PreviewExp::experiment_open (char *path
)
38 // Find experiment directory
39 if ((status
= find_expdir (path
)) != SUCCESS
)
41 size_t len
= strlen (path
);
42 is_group
= ((len
> 4) && !strcmp (&path
[len
- 4], NTXT (".erg")));
49 if (status
== FAILURE
)
52 if (status
== INCOMPLETE
&& resume_ts
!= MAX_TIME
)
53 // experiment is incomplete and "resumed" (non-paused)
54 // PreviewExp does not process all the packets, therefore...
55 // ... last_event does not reflect reality
56 // ... we don't know the duration or the end.
57 last_event
= ZERO_TIME
; // mark last_event as uninitialized
64 PreviewExp::preview_info ()
66 Vector
<char*> *info
= new Vector
<char*>;
68 info
->append (GTXT ("Experiment Group"));
70 info
->append (GTXT ("Experiment"));
71 info
->append (expt_name
);
73 if (status
== FAILURE
/* != SUCCESS */)
77 Vector
<char*> *grp_list
= dbeSession
->get_group_or_expt (expt_name
);
78 for (int i
= 0, grp_sz
= grp_list
->size (); i
< grp_sz
; i
++)
80 char *nm
= grp_list
->fetch (i
);
81 char *str
= dbe_sprintf (GTXT ("Exp.#%d"), i
+ 1);
89 info
->append (GTXT ("Error message"));
90 info
->append (mqueue_str (errorq
, GTXT ("No errors\n")));
94 info
->append (GTXT ("Experiment header"));
95 info
->append (mqueue_str (commentq
, GTXT ("Empty header\n")));
96 info
->append (GTXT ("Error message"));
97 info
->append (mqueue_str (errorq
, GTXT ("No errors\n")));
98 info
->append (GTXT ("Warning message"));
99 info
->append (mqueue_str (warnq
, GTXT ("No warnings\n")));
100 info
->append (GTXT ("Notes"));
101 info
->append (mqueue_str (notesq
, GTXT ("\n")));
106 PreviewExp::mqueue_str (Emsgqueue
*msgqueue
, char *null_str
)
108 char *mesgs
= pr_mesgs (msgqueue
->fetch (), null_str
, "");
109 char *last
= mesgs
+ strlen (mesgs
) - 1;