Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
c2e3902e
Commit
c2e3902e
authored
Jul 10, 2013
by
mattijs
Browse files
ENH: printStack: offsets are size_t
parent
c2ff0a87
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/OSspecific/POSIX/printStack.C
View file @
c2e3902e
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
3
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -28,7 +28,7 @@ License
#include
"OStringStream.H"
#include
"OSspecific.H"
#include
"IFstream.H"
#include
"
r
eadHex
Label
.H"
#include
"
R
eadHex.H"
#include
<cxxabi.h>
#include
<execinfo.h>
...
...
@@ -100,8 +100,8 @@ void printSourceFileAndLine
unsigned
long
offset
=
ulong
(
info
.
dli_fbase
);
IStringStream
addressStr
(
address
.
substr
(
2
));
l
abel
addressValue
=
r
eadHex
Label
(
addressStr
);
l
abel
relativeAddress
=
addressValue
-
offset
;
l
ong
addressValue
=
R
eadHex
<
long
>
(
addressStr
);
l
ong
relativeAddress
=
addressValue
-
offset
;
// Reconstruct hex word from address
OStringStream
nStream
;
...
...
@@ -211,7 +211,7 @@ void error::printStack(Ostream& os)
{
string
offsetString
(
line
.
substr
(
0
,
line
.
find
(
'-'
)));
IStringStream
offsetStr
(
offsetString
);
addressMap
.
insert
(
libPath
,
r
eadHex
L
abel
(
offsetStr
));
addressMap
.
insert
(
libPath
,
R
eadHex
<
l
abel
>
(
offsetStr
));
}
}
}
...
...
src/OpenFOAM/db/IOstreams/Sstreams/ReadHex.C
0 → 100644
View file @
c2e3902e
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Read a non-delimited hex label
\*---------------------------------------------------------------------------*/
#include
"ReadHex.H"
#include
<cctype>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
<
class
T
>
T
Foam
::
ReadHex
(
ISstream
&
is
)
{
// Takes into account that 'a' (or 'A') is 10
static
const
int
alphaOffset
=
toupper
(
'A'
)
-
10
;
// Takes into account that '0' is 0
static
const
int
zeroOffset
=
int
(
'0'
);
char
c
=
0
;
// Get next non-whitespace character
while
(
is
.
get
(
c
)
&&
isspace
(
c
))
{}
register
T
result
=
0
;
do
{
if
(
isspace
(
c
)
||
c
==
0
)
break
;
if
(
!
isxdigit
(
c
))
{
FatalIOErrorIn
(
"ReadHex(ISstream&)"
,
is
)
<<
"Illegal hex digit: '"
<<
c
<<
"'"
<<
exit
(
FatalIOError
);
}
result
<<=
4
;
if
(
isdigit
(
c
))
{
result
+=
int
(
c
)
-
zeroOffset
;
}
else
{
result
+=
toupper
(
c
)
-
alphaOffset
;
}
}
while
(
is
.
get
(
c
));
return
result
;
}
// ************************************************************************* //
src/OpenFOAM/db/IOstreams/Sstreams/ReadHex.H
0 → 100644
View file @
c2e3902e
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InNamespace
Foam
Description
Read a hex integer from an input stream
SourceFiles
ReadHex.C
\*---------------------------------------------------------------------------*/
#ifndef ReadHex_H
#define ReadHex_H
#include
"ISstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
//- Read a hex label from an input stream
template
<
class
T
>
T
ReadHex
(
ISstream
&
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ReadHex.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
src/OpenFOAM/db/IOstreams/Sstreams/readHexLabel.C
View file @
c2e3902e
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -27,48 +27,13 @@ Description
\*---------------------------------------------------------------------------*/
#include
"readHexLabel.H"
#include
<cctype>
#include
"ReadHex.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam
::
label
Foam
::
readHexLabel
(
ISstream
&
is
)
{
// Takes into account that 'a' (or 'A') is 10
static
const
label
alphaOffset
=
toupper
(
'A'
)
-
10
;
// Takes into account that '0' is 0
static
const
label
zeroOffset
=
int
(
'0'
);
char
c
=
0
;
// Get next non-whitespace character
while
(
is
.
get
(
c
)
&&
isspace
(
c
))
{}
register
label
result
=
0
;
do
{
if
(
isspace
(
c
)
||
c
==
0
)
break
;
if
(
!
isxdigit
(
c
))
{
FatalIOErrorIn
(
"readHexLabel(ISstream&)"
,
is
)
<<
"Illegal hex digit: '"
<<
c
<<
"'"
<<
exit
(
FatalIOError
);
}
result
<<=
4
;
if
(
isdigit
(
c
))
{
result
+=
int
(
c
)
-
zeroOffset
;
}
else
{
result
+=
toupper
(
c
)
-
alphaOffset
;
}
}
while
(
is
.
get
(
c
));
return
result
;
return
ReadHex
<
label
>
(
is
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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