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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
8 deletions
+28
-8
include/cif++/category.hpp
+1
-1
src/category.cpp
+23
-3
src/utilities.cpp
+4
-4
No files found.
include/cif++/category.hpp
View file @
3aa3fe19
...
@@ -456,7 +456,7 @@ class category
...
@@ -456,7 +456,7 @@ class category
std
::
vector
<
std
::
string
>
get_tag_order
()
const
;
std
::
vector
<
std
::
string
>
get_tag_order
()
const
;
void
write
(
std
::
ostream
&
os
)
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
:
private
:
void
write
(
std
::
ostream
&
os
,
const
std
::
vector
<
uint16_t
>
&
order
,
bool
includeEmptyColumns
)
const
;
void
write
(
std
::
ostream
&
os
,
const
std
::
vector
<
uint16_t
>
&
order
,
bool
includeEmptyColumns
)
const
;
...
...
src/category.cpp
View file @
3aa3fe19
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <cif++/category.hpp>
#include <cif++/category.hpp>
#include <cif++/datablock.hpp>
#include <cif++/datablock.hpp>
#include <cif++/parser.hpp>
#include <cif++/parser.hpp>
#include <cif++/utilities.hpp>
// TODO: Find out what the rules are exactly for linked items, the current implementation
// 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
// 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
...
@@ -825,19 +826,35 @@ void category::validate_links() const
continue
;
continue
;
size_t
missing
=
0
;
size_t
missing
=
0
;
category
first_missing_rows
(
name
());
for
(
auto
r
:
*
this
)
for
(
auto
r
:
*
this
)
{
{
auto
cond
=
get_parents_condition
(
r
,
*
parent
);
auto
cond
=
get_parents_condition
(
r
,
*
parent
);
if
(
not
cond
)
if
(
not
cond
)
continue
;
continue
;
if
(
not
parent
->
exists
(
std
::
move
(
cond
)))
if
(
not
parent
->
exists
(
std
::
move
(
cond
)))
{
++
missing
;
++
missing
;
if
(
VERBOSE
and
first_missing_rows
.
size
()
<
5
)
first_missing_rows
.
emplace
(
r
);
}
}
}
if
(
missing
)
if
(
missing
)
{
{
std
::
cerr
<<
"Links for "
<<
link
.
v
->
m_link_group_label
<<
" are incomplete"
<<
std
::
endl
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
;
<<
" 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
...
@@ -1829,7 +1846,7 @@ void category::write(std::ostream &os) const
write
(
os
,
order
,
false
);
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
// make sure all columns are present
for
(
auto
&
c
:
columns
)
for
(
auto
&
c
:
columns
)
...
@@ -1841,11 +1858,14 @@ void category::write(std::ostream &os, const std::vector<std::string> &columns)
...
@@ -1841,11 +1858,14 @@ void category::write(std::ostream &os, const std::vector<std::string> &columns)
for
(
auto
&
c
:
columns
)
for
(
auto
&
c
:
columns
)
order
.
push_back
(
get_column_ix
(
c
));
order
.
push_back
(
get_column_ix
(
c
));
if
(
addMissingColumns
)
{
for
(
size_t
i
=
0
;
i
<
m_columns
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
m_columns
.
size
();
++
i
)
{
{
if
(
std
::
find
(
order
.
begin
(),
order
.
end
(),
i
)
==
order
.
end
())
if
(
std
::
find
(
order
.
begin
(),
order
.
end
(),
i
)
==
order
.
end
())
order
.
push_back
(
i
);
order
.
push_back
(
i
);
}
}
}
write
(
os
,
order
,
true
);
write
(
os
,
order
,
true
);
}
}
...
@@ -1862,13 +1882,13 @@ void category::write(std::ostream &os, const std::vector<uint16_t> &order, bool
...
@@ -1862,13 +1882,13 @@ void category::write(std::ostream &os, const std::vector<uint16_t> &order, bool
{
{
os
<<
"loop_"
<<
'\n'
;
os
<<
"loop_"
<<
'\n'
;
std
::
vector
<
size_t
>
columnWidths
;
std
::
vector
<
size_t
>
columnWidths
(
m_columns
.
size
())
;
for
(
auto
cix
:
order
)
for
(
auto
cix
:
order
)
{
{
auto
&
col
=
m_columns
[
cix
];
auto
&
col
=
m_columns
[
cix
];
os
<<
'_'
<<
m_name
<<
'.'
<<
col
.
m_name
<<
' '
<<
'\n'
;
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
)
for
(
auto
r
=
m_head
;
r
!=
nullptr
;
r
=
r
->
m_next
)
...
...
src/utilities.cpp
View file @
3aa3fe19
...
@@ -38,9 +38,7 @@
...
@@ -38,9 +38,7 @@
#include <sstream>
#include <sstream>
#include <thread>
#include <thread>
#if defined(_MSC_VER)
#if not defined(_MSC_VER)
#define TERM_WIDTH 80
#else
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <termios.h>
#endif
#endif
...
@@ -82,7 +80,9 @@ namespace cif
...
@@ -82,7 +80,9 @@ namespace cif
uint32_t
get_terminal_width
()
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
()
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