Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b5037005
Commit
b5037005
authored
Mar 30, 2011
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guard C code from inclusion of gecompanion h api code
parent
f7d7598f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+6
-3
tests/compile/a_capi.pyx
tests/compile/a_capi.pyx
+3
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
b5037005
...
@@ -112,12 +112,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -112,12 +112,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
i_code
=
Code
.
PyrexCodeWriter
(
result
.
i_file
)
i_code
=
Code
.
PyrexCodeWriter
(
result
.
i_file
)
else
:
else
:
i_code
=
None
i_code
=
None
guard
=
Naming
.
h_guard_prefix
+
env
.
qualified_name
.
replace
(
"."
,
"__"
)
h_code
.
put_h_guard
(
guard
)
h_guard
=
Naming
.
h_guard_prefix
+
self
.
api_name
(
env
)
h_code
.
put_h_guard
(
h_guard
)
self
.
generate_extern_c_macro_definition
(
h_code
)
self
.
generate_extern_c_macro_definition
(
h_code
)
self
.
generate_type_header_code
(
h_types
,
h_code
)
self
.
generate_type_header_code
(
h_types
,
h_code
)
h_code
.
putln
(
""
)
h_code
.
putln
(
""
)
h_code
.
putln
(
"#ifndef %s"
%
Naming
.
api_guard_prefix
+
self
.
api_name
(
env
))
api_guard
=
Naming
.
api_guard_prefix
+
self
.
api_name
(
env
)
h_code
.
putln
(
"#ifndef %s"
%
api_guard
)
if
h_vars
:
if
h_vars
:
h_code
.
putln
(
""
)
h_code
.
putln
(
""
)
for
entry
in
h_vars
:
for
entry
in
h_vars
:
...
@@ -685,6 +687,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -685,6 +687,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"#define _USE_MATH_DEFINES"
)
code
.
putln
(
"#define _USE_MATH_DEFINES"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#include <math.h>"
)
code
.
putln
(
"#include <math.h>"
)
code
.
putln
(
"#define %s"
%
Naming
.
h_guard_prefix
+
self
.
api_name
(
env
))
code
.
putln
(
"#define %s"
%
Naming
.
api_guard_prefix
+
self
.
api_name
(
env
))
code
.
putln
(
"#define %s"
%
Naming
.
api_guard_prefix
+
self
.
api_name
(
env
))
self
.
generate_includes
(
env
,
cimported_modules
,
code
)
self
.
generate_includes
(
env
,
cimported_modules
,
code
)
code
.
putln
(
""
)
code
.
putln
(
""
)
...
...
tests/compile/a_capi.pyx
View file @
b5037005
...
@@ -19,3 +19,6 @@ cdef public void g(Blarg *x):
...
@@ -19,3 +19,6 @@ cdef public void g(Blarg *x):
cdef
public
api
void
h
(
Zax
*
x
):
cdef
public
api
void
h
(
Zax
*
x
):
pass
pass
cdef
extern
from
"a_capi.h"
:
pass
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