Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b7c298f8
Kaydet (Commit)
b7c298f8
authored
Haz 28, 2000
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Jack Jansen: Support for conditional inclusion of methods and functions
üst
35c09f2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
8 deletions
+33
-8
bgenGenerator.py
Tools/bgen/bgen/bgenGenerator.py
+16
-5
bgenlocations.py
Tools/bgen/bgen/bgenlocations.py
+3
-3
scantools.py
Tools/bgen/bgen/scantools.py
+14
-0
No files found.
Tools/bgen/bgen/bgenGenerator.py
Dosyayı görüntüle @
b7c298f8
...
@@ -14,20 +14,26 @@ INOUT = IN_OUT = "in-out"
...
@@ -14,20 +14,26 @@ INOUT = IN_OUT = "in-out"
class
BaseFunctionGenerator
:
class
BaseFunctionGenerator
:
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
,
condition
=
None
):
print
"<--"
,
name
print
"<--"
,
name
self
.
name
=
name
self
.
name
=
name
self
.
prefix
=
name
self
.
prefix
=
name
self
.
objecttype
=
"PyObject"
# Type of _self argument to function
self
.
objecttype
=
"PyObject"
# Type of _self argument to function
self
.
condition
=
condition
def
setprefix
(
self
,
prefix
):
def
setprefix
(
self
,
prefix
):
self
.
prefix
=
prefix
self
.
prefix
=
prefix
def
generate
(
self
):
def
generate
(
self
):
print
"-->"
,
self
.
name
print
"-->"
,
self
.
name
if
self
.
condition
:
Output
()
Output
(
self
.
condition
)
self
.
functionheader
()
self
.
functionheader
()
self
.
functionbody
()
self
.
functionbody
()
self
.
functiontrailer
()
self
.
functiontrailer
()
if
self
.
condition
:
Output
(
"#endif"
)
def
functionheader
(
self
):
def
functionheader
(
self
):
Output
()
Output
()
...
@@ -50,8 +56,13 @@ class BaseFunctionGenerator:
...
@@ -50,8 +56,13 @@ class BaseFunctionGenerator:
if
name
is
None
:
if
name
is
None
:
name
=
self
.
name
name
=
self
.
name
docstring
=
self
.
docstring
()
docstring
=
self
.
docstring
()
if
self
.
condition
:
Output
()
Output
(
self
.
condition
)
Output
(
"{
\"
%
s
\"
, (PyCFunction)
%
s_
%
s, 1,"
,
name
,
self
.
prefix
,
self
.
name
)
Output
(
"{
\"
%
s
\"
, (PyCFunction)
%
s_
%
s, 1,"
,
name
,
self
.
prefix
,
self
.
name
)
Output
(
"
%
s},"
,
stringify
(
docstring
))
Output
(
"
%
s},"
,
stringify
(
docstring
))
if
self
.
condition
:
Output
(
"#endif"
)
def
docstring
(
self
):
def
docstring
(
self
):
return
None
return
None
...
@@ -73,8 +84,8 @@ def stringify(str):
...
@@ -73,8 +84,8 @@ def stringify(str):
class
ManualGenerator
(
BaseFunctionGenerator
):
class
ManualGenerator
(
BaseFunctionGenerator
):
def
__init__
(
self
,
name
,
body
):
def
__init__
(
self
,
name
,
body
,
condition
=
None
):
BaseFunctionGenerator
.
__init__
(
self
,
name
)
BaseFunctionGenerator
.
__init__
(
self
,
name
,
condition
=
condition
)
self
.
body
=
body
self
.
body
=
body
def
functionbody
(
self
):
def
functionbody
(
self
):
...
@@ -87,8 +98,8 @@ class ManualGenerator(BaseFunctionGenerator):
...
@@ -87,8 +98,8 @@ class ManualGenerator(BaseFunctionGenerator):
class
FunctionGenerator
(
BaseFunctionGenerator
):
class
FunctionGenerator
(
BaseFunctionGenerator
):
def
__init__
(
self
,
returntype
,
name
,
*
argumentList
):
def
__init__
(
self
,
returntype
,
name
,
*
argumentList
,
**
conditionlist
):
BaseFunctionGenerator
.
__init__
(
self
,
name
)
BaseFunctionGenerator
.
__init__
(
self
,
name
,
**
conditionlist
)
self
.
returntype
=
returntype
self
.
returntype
=
returntype
self
.
argumentList
=
[]
self
.
argumentList
=
[]
self
.
setreturnvar
()
self
.
setreturnvar
()
...
...
Tools/bgen/bgen/bgenlocations.py
Dosyayı görüntüle @
b7c298f8
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
#
#
# Where to find the Universal Header include files:
# Where to find the Universal Header include files:
MWERKSDIR
=
"
flap:Metrowerks
:Metrowerks CodeWarrior:"
MWERKSDIR
=
"
Macintosh HD:SWDev:Codewarrior Pro 5
:Metrowerks CodeWarrior:"
INCLUDEDIR
=
MWERKSDIR
+
"MacOS Support:
Headers:Universal Header
s:"
INCLUDEDIR
=
MWERKSDIR
+
"MacOS Support:
Universal:Interfaces:CInclude
s:"
# Where to put the python definitions file:
# Where to put the python definitions file:
TOOLBOXDIR
=
"
flap
:Jack:Python:Mac:Lib:lib-toolbox:"
TOOLBOXDIR
=
"
Macintosh HD:SWDev
:Jack:Python:Mac:Lib:lib-toolbox:"
# Creator for C files:
# Creator for C files:
CREATOR
=
"CWIE"
CREATOR
=
"CWIE"
Tools/bgen/bgen/scantools.py
Dosyayı görüntüle @
b7c298f8
...
@@ -99,12 +99,23 @@ if missing: raise "Missing Types"
...
@@ -99,12 +99,23 @@ if missing: raise "Missing Types"
def
initblacklists
(
self
):
def
initblacklists
(
self
):
self
.
blacklistnames
=
self
.
makeblacklistnames
()
self
.
blacklistnames
=
self
.
makeblacklistnames
()
self
.
blacklisttypes
=
[
"unknown"
,
"-"
]
+
self
.
makeblacklisttypes
()
self
.
blacklisttypes
=
[
"unknown"
,
"-"
]
+
self
.
makeblacklisttypes
()
self
.
greydictnames
=
self
.
greylist2dict
(
self
.
makegreylist
())
def
greylist2dict
(
self
,
list
):
rv
=
{}
for
define
,
namelist
in
list
:
for
name
in
namelist
:
rv
[
name
]
=
define
return
rv
def
makeblacklistnames
(
self
):
def
makeblacklistnames
(
self
):
return
[]
return
[]
def
makeblacklisttypes
(
self
):
def
makeblacklisttypes
(
self
):
return
[]
return
[]
def
makegreylist
(
self
):
return
[]
def
initrepairinstructions
(
self
):
def
initrepairinstructions
(
self
):
self
.
repairinstructions
=
self
.
makerepairinstructions
()
self
.
repairinstructions
=
self
.
makerepairinstructions
()
...
@@ -395,6 +406,7 @@ if missing: raise "Missing Types"
...
@@ -395,6 +406,7 @@ if missing: raise "Missing Types"
self
.
defsfile
.
write
(
"
%
s =
%
s
\n
"
%
(
name
,
defn
))
self
.
defsfile
.
write
(
"
%
s =
%
s
\n
"
%
(
name
,
defn
))
else
:
else
:
self
.
defsfile
.
write
(
"#
%
s =
%
s
\n
"
%
(
name
,
defn
))
self
.
defsfile
.
write
(
"#
%
s =
%
s
\n
"
%
(
name
,
defn
))
# XXXX No way to handle greylisted names
def
dofuncspec
(
self
):
def
dofuncspec
(
self
):
raw
=
self
.
line
raw
=
self
.
line
...
@@ -519,6 +531,8 @@ if missing: raise "Missing Types"
...
@@ -519,6 +531,8 @@ if missing: raise "Missing Types"
self
.
typeused
(
atype
,
amode
)
self
.
typeused
(
atype
,
amode
)
self
.
specfile
.
write
(
" (
%
s,
%
s,
%
s),
\n
"
%
self
.
specfile
.
write
(
" (
%
s,
%
s,
%
s),
\n
"
%
(
atype
,
`aname`
,
amode
))
(
atype
,
`aname`
,
amode
))
if
self
.
greydictnames
.
has_key
(
name
):
self
.
specfile
.
write
(
" condition=
%
s,
\n
"
%
`self.greydictnames[name]`
)
self
.
specfile
.
write
(
")
\n
"
)
self
.
specfile
.
write
(
")
\n
"
)
self
.
specfile
.
write
(
"
%
s.append(f)
\n\n
"
%
listname
)
self
.
specfile
.
write
(
"
%
s.append(f)
\n\n
"
%
listname
)
...
...
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