Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
76857ed6
Commit
76857ed6
authored
Jun 29, 2005
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added optional suppport for storage modifiers (virtual/static/inline/etc)
and conditional generation of objects and methods.
parent
c3811643
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
Tools/bgen/bgen/bgenGenerator.py
Tools/bgen/bgen/bgenGenerator.py
+13
-2
Tools/bgen/bgen/bgenObjectDefinition.py
Tools/bgen/bgen/bgenObjectDefinition.py
+3
-0
Tools/bgen/bgen/scantools.py
Tools/bgen/bgen/scantools.py
+4
-0
No files found.
Tools/bgen/bgen/bgenGenerator.py
View file @
76857ed6
...
...
@@ -15,18 +15,27 @@ INOUT = IN_OUT = "in-out"
class
BaseFunctionGenerator
:
def
__init__
(
self
,
name
,
condition
=
None
):
def
__init__
(
self
,
name
,
condition
=
None
,
callname
=
None
,
modifiers
=
None
):
if
DEBUG
:
print
"<--"
,
name
self
.
name
=
name
self
.
callname
=
name
if
callname
:
self
.
callname
=
callname
else
:
self
.
callname
=
name
self
.
prefix
=
name
self
.
objecttype
=
"PyObject"
# Type of _self argument to function
self
.
condition
=
condition
self
.
modifiers
=
modifiers
def
setprefix
(
self
,
prefix
):
self
.
prefix
=
prefix
def
checkgenerate
(
self
):
return
True
def
generate
(
self
):
if
not
self
.
checkgenerate
():
return
if
DEBUG
:
print
"-->"
,
self
.
name
if
self
.
condition
:
Output
()
...
...
@@ -51,6 +60,8 @@ class BaseFunctionGenerator:
OutRbrace
()
def
reference
(
self
,
name
=
None
):
if
not
self
.
checkgenerate
():
return
if
name
is
None
:
name
=
self
.
name
docstring
=
self
.
docstring
()
...
...
Tools/bgen/bgen/bgenObjectDefinition.py
View file @
76857ed6
...
...
@@ -219,6 +219,9 @@ class ObjectDefinition(GeneratorGroup):
Output
(
"if (PyType_Ready(&%s) < 0) return;"
,
self
.
typename
)
Output
(
"""Py_INCREF(&%s);"""
,
self
.
typename
)
Output
(
"PyModule_AddObject(m,
\
"
%s
\
"
, (PyObject *)&%s);"
,
self
.
name
,
self
.
typename
);
self
.
outputTypeObjectInitializerCompat
()
def
outputTypeObjectInitializerCompat
(
self
):
Output
(
"/* Backward-compatible name */"
)
Output
(
"""Py_INCREF(&%s);"""
,
self
.
typename
);
Output
(
"PyModule_AddObject(m,
\
"
%sType
\
"
, (PyObject *)&%s);"
,
self
.
name
,
self
.
typename
);
...
...
Tools/bgen/bgen/scantools.py
View file @
76857ed6
...
...
@@ -620,11 +620,15 @@ if missing: raise "Missing Types"
(atype, aname, amode))
if self.greydictnames.has_key(name):
self.specfile.write("
condition
=%
r
,
\
n
"%(self.greydictnames[name],))
self.generatemodifiers(classname, name, modifiers)
self.specfile.write("
)
\
n
")
self.specfile.write("
%
s
.
append
(
f
)
\
n
\
n
" % listname)
def destination(self, type, name, arglist):
return "
FunctionGenerator
", "
functions
"
def generatemodifiers(self, classname, name, modifiers):
pass
def blacklisted(self, type, name):
if type in self.blacklisttypes:
...
...
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