Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
3aa3fe19
Unverified
Commit
3aa3fe19
authored
Sep 30, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better validate diagnostic output
parent
35fcc049
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
11 deletions
+31
-11
include/cif++/category.hpp
+1
-1
src/category.cpp
+26
-6
src/utilities.cpp
+4
-4
No files found.
include/cif++/category.hpp
View file @
3aa3fe19
...
...
@@ -456,7 +456,7 @@ class category
std
::
vector
<
std
::
string
>
get_tag_order
()
const
;
void
write
(
std
::
ostream
&
os
)
const
;
void
write
(
std
::
ostream
&
os
,
const
std
::
vector
<
std
::
string
>
&
order
);
void
write
(
std
::
ostream
&
os
,
const
std
::
vector
<
std
::
string
>
&
order
,
bool
addMissingColumns
=
true
);
private
:
void
write
(
std
::
ostream
&
os
,
const
std
::
vector
<
uint16_t
>
&
order
,
bool
includeEmptyColumns
)
const
;
...
...
src/category.cpp
View file @
3aa3fe19
...
...
@@ -29,6 +29,7 @@
#include <cif++/category.hpp>
#include <cif++/datablock.hpp>
#include <cif++/parser.hpp>
#include <cif++/utilities.hpp>
// TODO: Find out what the rules are exactly for linked items, the current implementation
// is inconsistent. It all depends whether a link is satified if a field taking part in the
...
...
@@ -825,19 +826,35 @@ void category::validate_links() const
continue
;
size_t
missing
=
0
;
category
first_missing_rows
(
name
());
for
(
auto
r
:
*
this
)
{
auto
cond
=
get_parents_condition
(
r
,
*
parent
);
if
(
not
cond
)
continue
;
if
(
not
parent
->
exists
(
std
::
move
(
cond
)))
{
++
missing
;
if
(
VERBOSE
and
first_missing_rows
.
size
()
<
5
)
first_missing_rows
.
emplace
(
r
);
}
}
if
(
missing
)
{
std
::
cerr
<<
"Links for "
<<
link
.
v
->
m_link_group_label
<<
" are incomplete"
<<
std
::
endl
<<
" There are "
<<
missing
<<
" items in "
<<
m_name
<<
" that don't have matching parent items in "
<<
parent
->
m_name
<<
std
::
endl
;
if
(
VERBOSE
)
{
std
::
cerr
<<
"showing first "
<<
first_missing_rows
.
size
()
<<
" rows"
<<
std
::
endl
<<
std
::
endl
;
first_missing_rows
.
write
(
std
::
cerr
,
link
.
v
->
m_child_keys
,
false
);
std
::
cerr
<<
std
::
endl
;
}
}
}
}
...
...
@@ -1829,7 +1846,7 @@ void category::write(std::ostream &os) const
write
(
os
,
order
,
false
);
}
void
category
::
write
(
std
::
ostream
&
os
,
const
std
::
vector
<
std
::
string
>
&
columns
)
void
category
::
write
(
std
::
ostream
&
os
,
const
std
::
vector
<
std
::
string
>
&
columns
,
bool
addMissingColumns
)
{
// make sure all columns are present
for
(
auto
&
c
:
columns
)
...
...
@@ -1841,10 +1858,13 @@ void category::write(std::ostream &os, const std::vector<std::string> &columns)
for
(
auto
&
c
:
columns
)
order
.
push_back
(
get_column_ix
(
c
));
for
(
size_t
i
=
0
;
i
<
m_columns
.
size
();
++
i
)
if
(
addMissingColumns
)
{
if
(
std
::
find
(
order
.
begin
(),
order
.
end
(),
i
)
==
order
.
end
())
order
.
push_back
(
i
);
for
(
size_t
i
=
0
;
i
<
m_columns
.
size
();
++
i
)
{
if
(
std
::
find
(
order
.
begin
(),
order
.
end
(),
i
)
==
order
.
end
())
order
.
push_back
(
i
);
}
}
write
(
os
,
order
,
true
);
...
...
@@ -1862,13 +1882,13 @@ void category::write(std::ostream &os, const std::vector<uint16_t> &order, bool
{
os
<<
"loop_"
<<
'\n'
;
std
::
vector
<
size_t
>
columnWidths
;
std
::
vector
<
size_t
>
columnWidths
(
m_columns
.
size
())
;
for
(
auto
cix
:
order
)
{
auto
&
col
=
m_columns
[
cix
];
os
<<
'_'
<<
m_name
<<
'.'
<<
col
.
m_name
<<
' '
<<
'\n'
;
columnWidths
.
push_back
(
2
)
;
columnWidths
[
cix
]
=
2
;
}
for
(
auto
r
=
m_head
;
r
!=
nullptr
;
r
=
r
->
m_next
)
...
...
src/utilities.cpp
View file @
3aa3fe19
...
...
@@ -38,9 +38,7 @@
#include <sstream>
#include <thread>
#if defined(_MSC_VER)
#define TERM_WIDTH 80
#else
#if not defined(_MSC_VER)
#include <sys/ioctl.h>
#include <termios.h>
#endif
...
...
@@ -82,7 +80,9 @@ namespace cif
uint32_t
get_terminal_width
()
{
return
TERM_WIDTH
;
CONSOLE_SCREEN_BUFFER_INFO
csbi
;
::
GetConsoleScreenBufferInfo
(
::
GetStdHandle
(
STD_OUTPUT_HANDLE
),
&
csbi
);
return
csbi
.
srWindow
.
Right
-
csbi
.
srWindow
.
Left
+
1
;
}
std
::
string
GetExecutablePath
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment