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
b6216dd2
Kaydet (Commit)
b6216dd2
authored
Haz 28, 2005
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More factorization to help C++ support.
üst
02c64d56
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
18 deletions
+51
-18
bgenBuffer.py
Tools/bgen/bgen/bgenBuffer.py
+16
-6
bgenStackBuffer.py
Tools/bgen/bgen/bgenStackBuffer.py
+3
-0
bgenStringBuffer.py
Tools/bgen/bgen/bgenStringBuffer.py
+3
-0
bgenType.py
Tools/bgen/bgen/bgenType.py
+16
-5
bgenVariable.py
Tools/bgen/bgen/bgenVariable.py
+5
-4
scantools.py
Tools/bgen/bgen/scantools.py
+8
-3
No files found.
Tools/bgen/bgen/bgenBuffer.py
Dosyayı görüntüle @
b6216dd2
...
...
@@ -38,10 +38,11 @@ class FixedInputOutputBufferType(InputOnlyType):
self
.
sizeformat
=
sizeformat
or
type2format
[
sizetype
]
self
.
label_needed
=
0
def
getDeclarations
(
self
,
name
,
reference
=
False
):
def
get
Arg
Declarations
(
self
,
name
,
reference
=
False
):
if
reference
:
raise
RuntimeError
,
"Cannot pass buffer types by reference"
return
self
.
getBufferDeclarations
(
name
)
+
self
.
getSizeDeclarations
(
name
)
return
(
self
.
getBufferDeclarations
(
name
)
+
self
.
getSizeDeclarations
(
name
))
def
getBufferDeclarations
(
self
,
name
):
return
self
.
getInputBufferDeclarations
(
name
)
+
self
.
getOutputBufferDeclarations
(
name
)
...
...
@@ -53,10 +54,10 @@ class FixedInputOutputBufferType(InputOnlyType):
return
[
"
%
s
%
s__out__[
%
s]"
%
(
self
.
datatype
,
name
,
self
.
size
)]
def
getSizeDeclarations
(
self
,
name
):
return
[
"
%
s
%
s__len__"
%
(
self
.
sizetype
,
name
),
"int
%
s__in_len__"
%
(
name
)
]
return
[
"
%
s
%
s__len__"
%
(
self
.
sizetype
,
name
)]
def
getAuxDeclarations
(
self
,
name
):
return
[
"int
%
s__in_len__"
%
(
name
)
]
def
getargsFormat
(
self
):
return
"s#"
...
...
@@ -189,6 +190,9 @@ class StructInputOutputBufferType(FixedInputOutputBufferType):
return
[
"
%
s *
%
s__in__"
%
(
self
.
type
,
name
)]
def
getSizeDeclarations
(
self
,
name
):
return
[]
def
getAuxDeclarations
(
self
,
name
):
return
[
"int
%
s__in_len__"
%
(
name
)]
def
getOutputBufferDeclarations
(
self
,
name
):
...
...
@@ -248,6 +252,9 @@ class StructOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType)
def
getSizeDeclarations
(
self
,
name
):
return
[]
def
getAuxDeclarations
(
self
,
name
):
return
[]
def
passOutput
(
self
,
name
):
return
"&
%
s__out__"
%
name
...
...
@@ -262,5 +269,8 @@ class ArrayOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType):
def
getSizeDeclarations
(
self
,
name
):
return
[]
def
getAuxDeclarations
(
self
,
name
):
return
[]
def
passOutput
(
self
,
name
):
return
"
%
s__out__"
%
name
Tools/bgen/bgen/bgenStackBuffer.py
Dosyayı görüntüle @
b6216dd2
...
...
@@ -23,6 +23,9 @@ class VarStackOutputBufferType(StackOutputBufferType):
"""
def
getSizeDeclarations
(
self
,
name
):
return
[]
def
getAuxDeclarations
(
self
,
name
):
return
[
"int
%
s__len__ =
%
s"
%
(
name
,
self
.
size
)]
def
passOutput
(
self
,
name
):
...
...
Tools/bgen/bgen/bgenStringBuffer.py
Dosyayı görüntüle @
b6216dd2
...
...
@@ -26,6 +26,9 @@ class StringBufferMixIn:
def
getSizeDeclarations
(
self
,
name
):
return
[]
def
getAuxDeclarations
(
self
,
name
):
return
[]
def
getargsFormat
(
self
):
return
"s"
...
...
Tools/bgen/bgen/bgenType.py
Dosyayı görüntüle @
b6216dd2
...
...
@@ -24,17 +24,25 @@ class Type:
Example: int.declare('spam') prints "int spam;"
"""
for
decl
in
self
.
getDeclarations
(
name
,
reference
):
for
decl
in
self
.
getArgDeclarations
(
name
,
reference
):
Output
(
"
%
s;"
,
decl
)
for
decl
in
self
.
getAuxDeclarations
(
name
):
Output
(
"
%
s;"
,
decl
)
def
getDeclarations
(
self
,
name
,
reference
=
False
):
"""Return
a string declaring a variable or argument, without
any syntactic adornment
"""
def
get
Arg
Declarations
(
self
,
name
,
reference
=
False
):
"""Return
the main part of the declarations for this type: the items
that will be passed as arguments in the C/C++ function call.
"""
if
reference
:
return
[
"
%
s&
%
s"
%
(
self
.
typeName
,
name
)]
else
:
return
[
"
%
s
%
s"
%
(
self
.
typeName
,
name
)]
def
getAuxDeclarations
(
self
,
name
):
"""Return any auxiliary declarations needed for implementing this
type, such as helper variables used to hold sizes, etc. These declarations
are not part of the C/C++ function call interface."""
return
[]
def
getargs
(
self
):
return
self
.
getargsFormat
(),
self
.
getargsArgs
()
...
...
@@ -187,7 +195,10 @@ class FakeType(InputOnlyType):
self
.
substitute
=
substitute
self
.
typeName
=
None
# Don't show this argument in __doc__ string
def
getDeclarations
(
self
,
name
,
reference
=
False
):
def
getArgDeclarations
(
self
,
name
,
reference
=
False
):
return
[]
def
getAuxDeclarations
(
self
,
name
,
reference
=
False
):
return
[]
def
getargsFormat
(
self
):
...
...
Tools/bgen/bgen/bgenVariable.py
Dosyayı görüntüle @
b6216dd2
...
...
@@ -45,11 +45,12 @@ class Variable:
elif
self
.
flags
!=
SelfMode
:
self
.
type
.
declare
(
self
.
name
)
def
getDeclarations
(
self
):
"""Return the unadorned declaration of the variable,
suitable for use in a formal parameter list."""
def
getArgDeclarations
(
self
):
refmode
=
(
self
.
flags
&
RefMode
)
return
self
.
type
.
getDeclarations
(
self
.
name
,
reference
=
refmode
)
return
self
.
type
.
getArgDeclarations
(
self
.
name
,
reference
=
refmode
)
def
getAuxDeclarations
(
self
):
return
self
.
type
.
getAuxDeclarations
(
self
.
name
)
def
getargsFormat
(
self
):
"""Call the type's getargsFormatmethod."""
...
...
Tools/bgen/bgen/scantools.py
Dosyayı görüntüle @
b6216dd2
...
...
@@ -482,8 +482,7 @@ if missing: raise "Missing Types"
modifiers
=
self
.
getmodifiers
(
match
)
type
=
self
.
pythonizename
(
type
)
name
=
self
.
pythonizename
(
name
)
if
name
in
self
.
alreadydone
:
self
.
report
(
"Name has already been defined:
%
r"
,
name
)
if
self
.
checkduplicate
(
name
):
return
self
.
report
(
"==>
%
s
%
s <=="
,
type
,
name
)
if
self
.
blacklisted
(
type
,
name
):
...
...
@@ -499,7 +498,6 @@ if missing: raise "Missing Types"
## self.report(" %r", arg)
self
.
report
(
"***
%
s
%
s unmanageable"
,
type
,
name
)
return
self
.
alreadydone
.
append
(
name
)
if
modifiers
:
self
.
generate
(
type
,
name
,
arglist
,
modifiers
)
else
:
...
...
@@ -508,6 +506,13 @@ if missing: raise "Missing Types"
def
getmodifiers
(
self
,
match
):
return
[]
def
checkduplicate
(
self
,
name
):
if
name
in
self
.
alreadydone
:
self
.
report
(
"Name has already been defined:
%
r"
,
name
)
return
True
self
.
alreadydone
.
append
(
name
)
return
False
def
pythonizename
(
self
,
name
):
name
=
re
.
sub
(
"
\
*"
,
" ptr"
,
name
)
name
=
name
.
strip
()
...
...
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