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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
debfd250
Commit
debfd250
authored
Jun 05, 2015
by
Jeroen Demeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write "generated by Cython" header also in .h files
parent
bb0dec2f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+5
-0
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+3
-3
No files found.
Cython/Compiler/Code.py
View file @
debfd250
...
@@ -30,6 +30,7 @@ from . import Naming
...
@@ -30,6 +30,7 @@ from . import Naming
from
.
import
Options
from
.
import
Options
from
.
import
DebugFlags
from
.
import
DebugFlags
from
.
import
StringEncoding
from
.
import
StringEncoding
from
.
import
Version
from
..
import
Utils
from
..
import
Utils
from
.Scanning
import
SourceDescriptor
from
.Scanning
import
SourceDescriptor
from
..StringIOTree
import
StringIOTree
from
..StringIOTree
import
StringIOTree
...
@@ -1818,6 +1819,10 @@ class CCodeWriter(object):
...
@@ -1818,6 +1819,10 @@ class CCodeWriter(object):
self
.
putln
(
"%sconst char *%s = NULL;"
%
(
unused
,
Naming
.
filename_cname
))
self
.
putln
(
"%sconst char *%s = NULL;"
%
(
unused
,
Naming
.
filename_cname
))
self
.
putln
(
"%sint %s = 0;"
%
(
unused
,
Naming
.
clineno_cname
))
self
.
putln
(
"%sint %s = 0;"
%
(
unused
,
Naming
.
clineno_cname
))
def
put_generated_by
(
self
):
self
.
putln
(
"/* Generated by Cython %s */"
%
Version
.
watermark
)
self
.
putln
(
""
)
def
put_h_guard
(
self
,
guard
):
def
put_h_guard
(
self
,
guard
):
self
.
putln
(
"#ifndef %s"
%
guard
)
self
.
putln
(
"#ifndef %s"
%
guard
)
self
.
putln
(
"#define %s"
%
guard
)
self
.
putln
(
"#define %s"
%
guard
)
...
...
Cython/Compiler/ModuleNode.py
View file @
debfd250
...
@@ -21,7 +21,6 @@ from . import Naming
...
@@ -21,7 +21,6 @@ from . import Naming
from
.
import
Nodes
from
.
import
Nodes
from
.
import
Options
from
.
import
Options
from
.
import
TypeSlots
from
.
import
TypeSlots
from
.
import
Version
from
.
import
PyrexTypes
from
.
import
PyrexTypes
from
.Errors
import
error
,
warning
from
.Errors
import
error
,
warning
...
@@ -140,6 +139,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -140,6 +139,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
else
:
else
:
i_code
=
None
i_code
=
None
h_code
.
put_generated_by
()
h_guard
=
Naming
.
h_guard_prefix
+
self
.
api_name
(
env
)
h_guard
=
Naming
.
h_guard_prefix
+
self
.
api_name
(
env
)
h_code
.
put_h_guard
(
h_guard
)
h_code
.
put_h_guard
(
h_guard
)
h_code
.
putln
(
""
)
h_code
.
putln
(
""
)
...
@@ -207,6 +207,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -207,6 +207,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
result
.
api_file
=
replace_suffix
(
result
.
c_file
,
"_api.h"
)
result
.
api_file
=
replace_suffix
(
result
.
c_file
,
"_api.h"
)
h_code
=
Code
.
CCodeWriter
()
h_code
=
Code
.
CCodeWriter
()
Code
.
GlobalState
(
h_code
,
self
)
Code
.
GlobalState
(
h_code
,
self
)
h_code
.
put_generated_by
()
api_guard
=
Naming
.
api_guard_prefix
+
self
.
api_name
(
env
)
api_guard
=
Naming
.
api_guard_prefix
+
self
.
api_name
(
env
)
h_code
.
put_h_guard
(
api_guard
)
h_code
.
put_h_guard
(
api_guard
)
h_code
.
putln
(
'#include "Python.h"'
)
h_code
.
putln
(
'#include "Python.h"'
)
...
@@ -562,8 +563,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -562,8 +563,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self
.
generate_cfunction_declarations
(
module
,
modulecode
,
defined_here
)
self
.
generate_cfunction_declarations
(
module
,
modulecode
,
defined_here
)
def
generate_module_preamble
(
self
,
env
,
cimported_modules
,
metadata
,
code
):
def
generate_module_preamble
(
self
,
env
,
cimported_modules
,
metadata
,
code
):
code
.
putln
(
"/* Generated by Cython %s */"
%
Version
.
watermark
)
code
.
put_generated_by
()
code
.
putln
(
""
)
if
metadata
:
if
metadata
:
code
.
putln
(
"/* BEGIN: Cython Metadata"
)
code
.
putln
(
"/* BEGIN: Cython Metadata"
)
code
.
putln
(
json
.
dumps
(
metadata
,
indent
=
4
,
sort_keys
=
True
))
code
.
putln
(
json
.
dumps
(
metadata
,
indent
=
4
,
sort_keys
=
True
))
...
...
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