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
03904bf2
Kaydet (Commit)
03904bf2
authored
Şub 10, 2006
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
For overriding C++ methods we also need to know whether a parameter
is an output parameter or not. Added support for that.
üst
2bc23f51
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
22 deletions
+45
-22
bgenBuffer.py
Tools/bgen/bgen/bgenBuffer.py
+26
-14
bgenHeapBuffer.py
Tools/bgen/bgen/bgenHeapBuffer.py
+6
-2
bgenType.py
Tools/bgen/bgen/bgenType.py
+7
-3
bgenVariable.py
Tools/bgen/bgen/bgenVariable.py
+6
-3
No files found.
Tools/bgen/bgen/bgenBuffer.py
Dosyayı görüntüle @
03904bf2
...
...
@@ -38,15 +38,15 @@ class FixedInputOutputBufferType(InputOnlyType):
self
.
sizeformat
=
sizeformat
or
type2format
[
sizetype
]
self
.
label_needed
=
0
def
getArgDeclarations
(
self
,
name
,
reference
=
False
,
constmode
=
False
):
def
getArgDeclarations
(
self
,
name
,
reference
=
False
,
constmode
=
False
,
outmode
=
False
):
if
reference
:
raise
RuntimeError
,
"Cannot pass buffer types by reference"
return
(
self
.
getBufferDeclarations
(
name
,
constmode
)
+
self
.
getSizeDeclarations
(
name
))
self
.
getSizeDeclarations
(
name
,
outmode
))
def
getBufferDeclarations
(
self
,
name
,
constmode
=
False
):
def
getBufferDeclarations
(
self
,
name
,
constmode
=
False
,
outmode
=
False
):
return
self
.
getInputBufferDeclarations
(
name
,
constmode
)
+
\
self
.
getOutputBufferDeclarations
(
name
,
constmode
)
self
.
getOutputBufferDeclarations
(
name
,
constmode
,
outmode
)
def
getInputBufferDeclarations
(
self
,
name
,
constmode
=
False
):
if
constmode
:
...
...
@@ -55,13 +55,21 @@ class FixedInputOutputBufferType(InputOnlyType):
const
=
""
return
[
"
%
s
%
s *
%
s__in__"
%
(
const
,
self
.
datatype
,
name
)]
def
getOutputBufferDeclarations
(
self
,
name
,
constmode
=
False
):
def
getOutputBufferDeclarations
(
self
,
name
,
constmode
=
False
,
outmode
=
False
):
if
constmode
:
raise
RuntimeError
,
"Cannot use const output buffer"
return
[
"
%
s
%
s__out__[
%
s]"
%
(
self
.
datatype
,
name
,
self
.
size
)]
if
outmode
:
out
=
"*"
else
:
out
=
""
return
[
"
%
s
%
s
%
s__out__[
%
s]"
%
(
self
.
datatype
,
out
,
name
,
self
.
size
)]
def
getSizeDeclarations
(
self
,
name
):
return
[
"
%
s
%
s__len__"
%
(
self
.
sizetype
,
name
)]
def
getSizeDeclarations
(
self
,
name
,
outmode
=
False
):
if
outmode
:
out
=
"*"
else
:
out
=
""
return
[
"
%
s
%
s
%
s__len__"
%
(
self
.
sizetype
,
out
,
name
)]
def
getAuxDeclarations
(
self
,
name
):
return
[
"int
%
s__in_len__"
%
(
name
)]
...
...
@@ -112,7 +120,7 @@ class FixedCombinedInputOutputBufferType(FixedInputOutputBufferType):
class
InputOnlyBufferMixIn
(
InputOnlyMixIn
):
def
getOutputBufferDeclarations
(
self
,
name
,
constmode
=
False
):
def
getOutputBufferDeclarations
(
self
,
name
,
constmode
=
False
,
outmode
=
False
):
return
[]
...
...
@@ -200,16 +208,20 @@ class StructInputOutputBufferType(FixedInputOutputBufferType):
const
=
""
return
[
"
%
s
%
s *
%
s__in__"
%
(
const
,
self
.
type
,
name
)]
def
getSizeDeclarations
(
self
,
name
):
def
getSizeDeclarations
(
self
,
name
,
outmode
=
False
):
return
[]
def
getAuxDeclarations
(
self
,
name
):
return
[
"int
%
s__in_len__"
%
(
name
)]
def
getOutputBufferDeclarations
(
self
,
name
,
constmode
=
False
):
def
getOutputBufferDeclarations
(
self
,
name
,
constmode
=
False
,
outmode
=
False
):
if
constmode
:
raise
RuntimeError
,
"Cannot use const output buffer"
return
[
"
%
s
%
s__out__"
%
(
self
.
type
,
name
)]
if
outmode
:
out
=
"*"
else
:
out
=
""
return
[
"
%
s
%
s
%
s__out__"
%
(
self
.
type
,
out
,
name
)]
def
getargsArgs
(
self
,
name
):
return
"(char **)&
%
s__in__, &
%
s__in_len__"
%
(
name
,
name
)
...
...
@@ -262,7 +274,7 @@ class StructOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType)
Instantiate with the struct type as parameter.
"""
def
getSizeDeclarations
(
self
,
name
):
def
getSizeDeclarations
(
self
,
name
,
outmode
=
False
):
return
[]
def
getAuxDeclarations
(
self
,
name
):
...
...
@@ -279,7 +291,7 @@ class ArrayOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType):
Instantiate with the struct type as parameter.
"""
def
getSizeDeclarations
(
self
,
name
):
def
getSizeDeclarations
(
self
,
name
,
outmode
=
False
):
return
[]
def
getAuxDeclarations
(
self
,
name
):
...
...
Tools/bgen/bgen/bgenHeapBuffer.py
Dosyayı görüntüle @
03904bf2
...
...
@@ -16,10 +16,14 @@ class HeapInputOutputBufferType(FixedInputOutputBufferType):
def
__init__
(
self
,
datatype
=
'char'
,
sizetype
=
'int'
,
sizeformat
=
None
):
FixedInputOutputBufferType
.
__init__
(
self
,
"0"
,
datatype
,
sizetype
,
sizeformat
)
def
getOutputBufferDeclarations
(
self
,
name
,
constmode
=
False
):
def
getOutputBufferDeclarations
(
self
,
name
,
constmode
=
False
,
outmode
=
False
):
if
constmode
:
raise
RuntimeError
,
"Cannot use const output buffer"
return
[
"
%
s *
%
s__out__"
%
(
self
.
datatype
,
name
)]
if
outmode
:
out
=
"*"
else
:
out
=
""
return
[
"
%
s
%
s *
%
s__out__"
%
(
self
.
datatype
,
out
,
name
)]
def
getargsCheck
(
self
,
name
):
Output
(
"if ((
%
s__out__ = malloc(
%
s__in_len__)) == NULL)"
,
name
,
name
)
...
...
Tools/bgen/bgen/bgenType.py
Dosyayı görüntüle @
03904bf2
...
...
@@ -29,7 +29,7 @@ class Type:
for
decl
in
self
.
getAuxDeclarations
(
name
):
Output
(
"
%
s;"
,
decl
)
def
getArgDeclarations
(
self
,
name
,
reference
=
False
,
constmode
=
False
):
def
getArgDeclarations
(
self
,
name
,
reference
=
False
,
constmode
=
False
,
outmode
=
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
:
...
...
@@ -40,7 +40,11 @@ class Type:
const
=
"const "
else
:
const
=
""
return
[
"
%
s
%
s
%
s
%
s"
%
(
const
,
self
.
typeName
,
ref
,
name
)]
if
outmode
:
out
=
"*"
else
:
out
=
""
return
[
"
%
s
%
s
%
s
%
s
%
s"
%
(
const
,
self
.
typeName
,
ref
,
out
,
name
)]
def
getAuxDeclarations
(
self
,
name
):
"""Return any auxiliary declarations needed for implementing this
...
...
@@ -213,7 +217,7 @@ class FakeType(InputOnlyType):
self
.
substitute
=
substitute
self
.
typeName
=
None
# Don't show this argument in __doc__ string
def
getArgDeclarations
(
self
,
name
,
reference
=
False
,
constmode
=
False
):
def
getArgDeclarations
(
self
,
name
,
reference
=
False
,
constmode
=
False
,
outmode
=
False
):
return
[]
def
getAuxDeclarations
(
self
,
name
,
reference
=
False
):
...
...
Tools/bgen/bgen/bgenVariable.py
Dosyayı görüntüle @
03904bf2
...
...
@@ -45,12 +45,15 @@ class Variable:
elif
self
.
flags
!=
SelfMode
:
self
.
type
.
declare
(
self
.
name
)
def
getArgDeclarations
(
self
,
constmode
=
False
):
def
getArgDeclarations
(
self
,
fullmodes
=
False
):
refmode
=
(
self
.
flags
&
RefMode
)
if
constmode
:
constmode
=
False
outmode
=
False
if
fullmodes
:
constmode
=
(
self
.
flags
&
ConstMode
)
outmode
=
(
self
.
flags
&
OutMode
)
return
self
.
type
.
getArgDeclarations
(
self
.
name
,
reference
=
refmode
,
constmode
=
constmode
)
reference
=
refmode
,
constmode
=
constmode
,
outmode
=
outmode
)
def
getAuxDeclarations
(
self
):
return
self
.
type
.
getAuxDeclarations
(
self
.
name
)
...
...
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