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
8ceeaba0
Kaydet (Commit)
8ceeaba0
authored
Haz 21, 2005
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added support for optional modifiers to functions/methods (such as C++ const,
static for methods, inline, etc).
üst
da99d1cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
bgenVariable.py
Tools/bgen/bgen/bgenVariable.py
+3
-1
scantools.py
Tools/bgen/bgen/scantools.py
+16
-5
No files found.
Tools/bgen/bgen/bgenVariable.py
Dosyayı görüntüle @
8ceeaba0
...
@@ -14,6 +14,7 @@ SelfMode = 4+InMode # this is 'self' -- don't declare it
...
@@ -14,6 +14,7 @@ SelfMode = 4+InMode # this is 'self' -- don't declare it
ReturnMode
=
8
+
OutMode
# this is the function return value
ReturnMode
=
8
+
OutMode
# this is the function return value
ErrorMode
=
16
+
OutMode
# this is an error status -- turn it into an exception
ErrorMode
=
16
+
OutMode
# this is an error status -- turn it into an exception
RefMode
=
32
RefMode
=
32
ConstMode
=
64
class
Variable
:
class
Variable
:
...
@@ -47,7 +48,8 @@ class Variable:
...
@@ -47,7 +48,8 @@ class Variable:
def
getDeclaration
(
self
):
def
getDeclaration
(
self
):
"""Return the unadorned declaration of the variable,
"""Return the unadorned declaration of the variable,
suitable for use in a formal parameter list."""
suitable for use in a formal parameter list."""
return
self
.
type
.
getDeclaration
(
self
.
name
)
refmode
=
(
self
.
flags
&
RefMode
)
return
self
.
type
.
getDeclaration
(
self
.
name
,
reference
=
refmode
)
def
getargsFormat
(
self
):
def
getargsFormat
(
self
):
"""Call the type's getargsFormatmethod."""
"""Call the type's getargsFormatmethod."""
...
...
Tools/bgen/bgen/scantools.py
Dosyayı görüntüle @
8ceeaba0
...
@@ -479,6 +479,7 @@ if missing: raise "Missing Types"
...
@@ -479,6 +479,7 @@ if missing: raise "Missing Types"
self
.
report
(
"(but type matched)"
)
self
.
report
(
"(but type matched)"
)
return
return
type
,
name
,
args
=
match
.
group
(
'type'
,
'name'
,
'args'
)
type
,
name
,
args
=
match
.
group
(
'type'
,
'name'
,
'args'
)
modifiers
=
self
.
getmodifiers
(
match
)
type
=
self
.
pythonizename
(
type
)
type
=
self
.
pythonizename
(
type
)
name
=
self
.
pythonizename
(
name
)
name
=
self
.
pythonizename
(
name
)
if
name
in
self
.
alreadydone
:
if
name
in
self
.
alreadydone
:
...
@@ -499,8 +500,14 @@ if missing: raise "Missing Types"
...
@@ -499,8 +500,14 @@ if missing: raise "Missing Types"
self
.
report
(
"***
%
s
%
s unmanageable"
,
type
,
name
)
self
.
report
(
"***
%
s
%
s unmanageable"
,
type
,
name
)
return
return
self
.
alreadydone
.
append
(
name
)
self
.
alreadydone
.
append
(
name
)
self
.
generate
(
type
,
name
,
arglist
)
if
modifiers
:
self
.
generate
(
type
,
name
,
arglist
,
modifiers
)
else
:
self
.
generate
(
type
,
name
,
arglist
)
def
getmodifiers
(
self
,
match
):
return
[]
def
pythonizename
(
self
,
name
):
def
pythonizename
(
self
,
name
):
name
=
re
.
sub
(
"
\
*"
,
" ptr"
,
name
)
name
=
re
.
sub
(
"
\
*"
,
" ptr"
,
name
)
name
=
name
.
strip
()
name
=
name
.
strip
()
...
@@ -592,12 +599,16 @@ if missing: raise "Missing Types"
...
@@ -592,12 +599,16 @@ if missing: raise "Missing Types"
##self.report("new: %r", new)
##self.report("new: %r", new)
return
new
return
new
def
generate
(
self
,
type
,
name
,
arglist
):
def
generate
(
self
,
tp
,
name
,
arglist
,
modifiers
=
[]):
self
.
typeused
(
type
,
'return'
)
classname
,
listname
=
self
.
destination
(
type
,
name
,
arglist
)
self
.
typeused
(
tp
,
'return'
)
if
modifiers
:
classname
,
listname
=
self
.
destination
(
tp
,
name
,
arglist
,
modifiers
)
else
:
classname
,
listname
=
self
.
destination
(
tp
,
name
,
arglist
)
if
not
classname
or
not
listname
:
return
if
not
classname
or
not
listname
:
return
if
not
self
.
specfile
:
return
if
not
self
.
specfile
:
return
self
.
specfile
.
write
(
"f =
%
s(
%
s,
%
r,
\n
"
%
(
classname
,
t
ype
,
name
))
self
.
specfile
.
write
(
"f =
%
s(
%
s,
%
r,
\n
"
%
(
classname
,
t
p
,
name
))
for
atype
,
aname
,
amode
in
arglist
:
for
atype
,
aname
,
amode
in
arglist
:
self
.
typeused
(
atype
,
amode
)
self
.
typeused
(
atype
,
amode
)
self
.
specfile
.
write
(
" (
%
s,
%
r,
%
s),
\n
"
%
self
.
specfile
.
write
(
" (
%
s,
%
r,
%
s),
\n
"
%
...
...
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