Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
d9fbb88c
Commit
d9fbb88c
authored
Jul 29, 2015
by
Thomas Jahns
🤸
Browse files
Add necessary logic to Fortran 77 binding generator to handle C++ conditionals.
parent
1cc87b3f
Changes
6
Hide whitespace changes
Inline
Side-by-side
doc/tex/c_quick_ref.tex
View file @
d9fbb88c
...
...
@@ -88,7 +88,7 @@ Define the reference URI for an unstructured grid.
\section*
{
\tt
\htmlref
{
gridDefUUID
}{
gridDefUUID
}}
\begin{verbatim}
void gridDefUUID (int gridID, const unsigned char
*
uuid);
void gridDefUUID (int gridID, const unsigned char uuid
[CDI
_
UUID
_
SIZE]
);
\end{verbatim}
Define the UUID of an unstructured grid.
...
...
doc/tex/f_quick_ref.tex
View file @
d9fbb88c
...
...
@@ -88,7 +88,7 @@ Define the reference URI for an unstructured grid.
\section*
{
\tt
\htmlref
{
gridDefUUID
}{
gridDefUUID
}}
\begin{verbatim}
SUBROUTINE gridDefUUID (INTEGER gridID, INTEGER*1(
*
) uuid)
SUBROUTINE gridDefUUID (INTEGER gridID, INTEGER*1(
16
) uuid)
\end{verbatim}
Define the UUID of an unstructured grid.
...
...
src/cdi.h
View file @
d9fbb88c
...
...
@@ -842,7 +842,11 @@ void gridDefReference(int gridID, const char *reference);
int
gridInqReference
(
int
gridID
,
char
*
reference
);
/* gridDefUUID: Define the UUID of an unstructured grid */
#ifdef __cplusplus
void
gridDefUUID
(
int
gridID
,
const
unsigned
char
*
uuid
);
#else
void
gridDefUUID
(
int
gridID
,
const
unsigned
char
uuid
[
CDI_UUID_SIZE
]);
#endif
/* gridInqUUID: Get the UUID of an unstructured grid */
void
gridInqUUID
(
int
gridID
,
unsigned
char
*
uuid
);
...
...
src/cdi.inc
View file @
d9fbb88c
...
...
@@ -1714,7 +1714,7 @@
!
gridDefUUID
!
(
INTEGER
gridID
,
!
INTEGER
*
1
(
*
)
uuid
)
!
INTEGER
*
1
(
16
)
uuid
)
EXTERNAL
gridDefUUID
!
gridInqUUID
...
...
src/make_fint.c
View file @
d9fbb88c
...
...
@@ -296,16 +296,20 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
if
(
reCompile
(
&
docCommentRE
,
docCommentREString
,
&
line
,
&
lineBufSize
))
exit
(
EXIT_FAILURE
);
}
/* compile keep-conditional regular expression */
/* if(n)def and endif preprocessor conditionals followed by
make_fint keep are copied to the Fortran interface file */
regex_t
cppCondRE
;
{
static
const
char
cppCondREString
[]
=
"^"
WS
"*#"
WS
"*(ifn?def"
WS
"+"
SYMRE
"|endif)"
WS
"
+
/
\\
*
"
WS
"*make_fint keep"
WS
"*
\\
*/
"
;
=
"^"
WS
"*#"
WS
"*(
(
ifn?def
)
"
WS
"+"
SYMRE
"|endif)"
WS
"
*(
/
\\
*
[^*]*
\\
*/|//.*)?
"
;
if
(
reCompile
(
&
cppCondRE
,
cppCondREString
,
&
line
,
&
lineBufSize
))
exit
(
EXIT_FAILURE
);
}
regex_t
cppElseRE
;
{
static
const
char
cppElseREString
[]
=
"^"
WS
"*#"
WS
"*else"
WS
"*(/
\\
*[^*]*
\\
*/|//.*)?"
;
if
(
reCompile
(
&
cppElseRE
,
cppElseREString
,
&
line
,
&
lineBufSize
))
exit
(
EXIT_FAILURE
);
}
regex_t
emptyStringRE
;
{
static
const
char
emptyStringREString
[]
=
"^"
WS
"*"
;
...
...
@@ -349,6 +353,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
ssize_t
lineLen
;
while
((
lineLen
=
getline
(
&
line
,
&
lineBufSize
,
fpin
))
>=
0
)
{
static
const
char
cplusplus_macro
[]
=
"__cplusplus"
;
lineno
++
;
functype
=
ISVOID
;
size_t
funcargc
=
0
;
...
...
@@ -385,6 +390,8 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
funcname
[
funcnameLen
]
=
0
;
pline
+=
reMatch
[
0
].
rm_eo
;
}
while
(
0
);
int
cppSwitchLen
,
cppSymLen
;
if
(
declType
==
FUNC_DECL
)
{
funcargname
[
funcargc
].
rm_so
=
(
regoff_t
)(
pline
-
line
);
...
...
@@ -744,11 +751,18 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
" PARAMETER (%-22s = %2d)
\n
"
,
parname
,
parname
,
parvalue
);
}
else
if
(
!
regexec
(
&
cppCondRE
,
line
,
maxMatch
,
reMatch
,
0
))
else
if
(
!
regexec
(
&
cppCondRE
,
line
,
maxMatch
,
reMatch
,
0
)
&&
((
cppSwitchLen
=
reMatch
[
2
].
rm_eo
-
reMatch
[
2
].
rm_so
)
==
5
)
&&
((
size_t
)(
cppSymLen
=
reMatch
[
3
].
rm_eo
-
reMatch
[
3
].
rm_so
)
==
sizeof
(
cplusplus_macro
)
-
1
)
&&
!
memcmp
(
line
+
reMatch
[
3
].
rm_so
,
cplusplus_macro
,
sizeof
(
cplusplus_macro
)
-
1
))
{
/* fortran include */
fputs
(
line
,
fpint
);
}
fprintf
(
stderr
,
"Found conditional C++ block, skipping to #else
\n
"
);
while
((
lineLen
=
getline
(
&
line
,
&
lineBufSize
,
fpin
))
>=
0
)
if
(
!
regexec
(
&
cppElseRE
,
line
,
maxMatch
,
reMatch
,
0
))
break
;
}
else
if
(
detectComment
(
&
line
,
&
lineLen
,
&
lineBufSize
,
maxMatch
,
reMatch
,
xname
,
&
xnameLen
,
xdes
,
...
...
@@ -762,8 +776,8 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
}
}
fp
rintf
(
fpint
,
"
\n
"
);
fprintf
(
fpint
,
"#endif
\n
"
);
fp
uts
(
"
\n
"
"#endif
\n
"
,
fpint
);
fclose
(
fpin
);
fclose
(
fpinc
);
...
...
src/mo_cdi.f90
View file @
d9fbb88c
...
...
@@ -479,6 +479,7 @@ module mo_cdi
public
gridInqPosition
public
gridDefReference
public
gridInqReference
public
gridDefUUID
public
gridDefLCC
public
gridInqLCC
public
gridDefLcc2
...
...
@@ -5572,6 +5573,19 @@ contains
end
do
end
function
gridInqReference
subroutine
gridDefUUID
(
gridID_dummy
,
uuid_dummy
)
integer
(
c_int
),
value
::
gridID_dummy
character
(
kind
=
c_char
),
intent
(
in
)
::
uuid_dummy
(
CDI_UUID_SIZE
)
interface
subroutine
lib_gridDefUUID
(
gridID_dummy
,
uuid_dummy
)
bind
(
c
,
name
=
'gridDefUUID'
)
import
c_char
,
c_int
integer
(
c_int
),
value
::
gridID_dummy
character
(
kind
=
c_char
),
intent
(
in
)
::
uuid_dummy
(
*
)
end
subroutine
lib_gridDefUUID
end
interface
call
lib_gridDefUUID
(
gridID_dummy
,
uuid_dummy
)
end
subroutine
gridDefUUID
subroutine
gridDefLCC
(
gridID_dummy
,
originLon_dummy
,
originLat_dummy
,
lonParY_dummy
,
lat1_dummy
,
lat2_dummy
,
xinc_dummy
,
yinc_dumm
&
&
y
,
projflag_dummy
,
scanflag_dummy
)
integer
(
c_int
),
value
::
gridID_dummy
...
...
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