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
7906634f
Kaydet (Commit)
7906634f
authored
May 12, 2002
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
- Better exception when a NULL CF object is encountered.
- Manually generate a routine with funny error semantics.
üst
69c9266f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
168 additions
and
16 deletions
+168
-16
_CFmodule.c
Mac/Modules/cf/_CFmodule.c
+133
-11
cfscan.py
Mac/Modules/cf/cfscan.py
+1
-0
cfsupport.py
Mac/Modules/cf/cfsupport.py
+34
-5
No files found.
Mac/Modules/cf/_CFmodule.c
Dosyayı görüntüle @
7906634f
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include <CFDictionary.h>
#include <CFDictionary.h>
#include <CFString.h>
#include <CFString.h>
#include <CFURL.h>
#include <CFURL.h>
#include <CFPropertyList.h>
#else
#else
#include <CoreServices/CoreServices.h>
#include <CoreServices/CoreServices.h>
#endif
#endif
...
@@ -137,7 +138,11 @@ typedef struct CFTypeRefObject {
...
@@ -137,7 +138,11 @@ typedef struct CFTypeRefObject {
PyObject
*
CFTypeRefObj_New
(
CFTypeRef
itself
)
PyObject
*
CFTypeRefObj_New
(
CFTypeRef
itself
)
{
{
CFTypeRefObject
*
it
;
CFTypeRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFTypeRefObject
,
&
CFTypeRef_Type
);
it
=
PyObject_NEW
(
CFTypeRefObject
,
&
CFTypeRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
@@ -275,6 +280,35 @@ static PyObject *CFTypeRefObj_CFCopyDescription(CFTypeRefObject *_self, PyObject
...
@@ -275,6 +280,35 @@ static PyObject *CFTypeRefObj_CFCopyDescription(CFTypeRefObject *_self, PyObject
return
_res
;
return
_res
;
}
}
static
PyObject
*
CFTypeRefObj_CFPropertyListCreateXMLData
(
CFTypeRefObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
CFDataRef
_rv
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
_rv
=
CFPropertyListCreateXMLData
((
CFAllocatorRef
)
NULL
,
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"O&"
,
CFDataRefObj_New
,
_rv
);
return
_res
;
}
static
PyObject
*
CFTypeRefObj_CFPropertyListCreateDeepCopy
(
CFTypeRefObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
CFTypeRef
_rv
;
CFOptionFlags
mutabilityOption
;
if
(
!
PyArg_ParseTuple
(
_args
,
"l"
,
&
mutabilityOption
))
return
NULL
;
_rv
=
CFPropertyListCreateDeepCopy
((
CFAllocatorRef
)
NULL
,
_self
->
ob_itself
,
mutabilityOption
);
_res
=
Py_BuildValue
(
"O&"
,
CFTypeRefObj_New
,
_rv
);
return
_res
;
}
static
PyObject
*
CFTypeRefObj_CFShow
(
CFTypeRefObject
*
_self
,
PyObject
*
_args
)
static
PyObject
*
CFTypeRefObj_CFShow
(
CFTypeRefObject
*
_self
,
PyObject
*
_args
)
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
...
@@ -289,6 +323,32 @@ static PyObject *CFTypeRefObj_CFShow(CFTypeRefObject *_self, PyObject *_args)
...
@@ -289,6 +323,32 @@ static PyObject *CFTypeRefObj_CFShow(CFTypeRefObject *_self, PyObject *_args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
CFTypeRefObj_CFPropertyListCreateFromXMLData
(
CFTypeRefObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
CFTypeRef
_rv
;
CFOptionFlags
mutabilityOption
;
CFStringRef
errorString
;
if
(
!
PyArg_ParseTuple
(
_args
,
"l"
,
&
mutabilityOption
))
return
NULL
;
_rv
=
CFPropertyListCreateFromXMLData
((
CFAllocatorRef
)
NULL
,
_self
->
ob_itself
,
mutabilityOption
,
&
errorString
);
if
(
errorString
)
CFRelease
(
errorString
);
if
(
_rv
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"Parse error in XML data"
);
return
NULL
;
}
_res
=
Py_BuildValue
(
"O&"
,
CFTypeRefObj_New
,
_rv
);
return
_res
;
}
static
PyObject
*
CFTypeRefObj_toPython
(
CFTypeRefObject
*
_self
,
PyObject
*
_args
)
static
PyObject
*
CFTypeRefObj_toPython
(
CFTypeRefObject
*
_self
,
PyObject
*
_args
)
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
...
@@ -312,8 +372,14 @@ static PyMethodDef CFTypeRefObj_methods[] = {
...
@@ -312,8 +372,14 @@ static PyMethodDef CFTypeRefObj_methods[] = {
"() -> (CFHashCode _rv)"
},
"() -> (CFHashCode _rv)"
},
{
"CFCopyDescription"
,
(
PyCFunction
)
CFTypeRefObj_CFCopyDescription
,
1
,
{
"CFCopyDescription"
,
(
PyCFunction
)
CFTypeRefObj_CFCopyDescription
,
1
,
"() -> (CFStringRef _rv)"
},
"() -> (CFStringRef _rv)"
},
{
"CFPropertyListCreateXMLData"
,
(
PyCFunction
)
CFTypeRefObj_CFPropertyListCreateXMLData
,
1
,
"() -> (CFDataRef _rv)"
},
{
"CFPropertyListCreateDeepCopy"
,
(
PyCFunction
)
CFTypeRefObj_CFPropertyListCreateDeepCopy
,
1
,
"(CFOptionFlags mutabilityOption) -> (CFTypeRef _rv)"
},
{
"CFShow"
,
(
PyCFunction
)
CFTypeRefObj_CFShow
,
1
,
{
"CFShow"
,
(
PyCFunction
)
CFTypeRefObj_CFShow
,
1
,
"() -> None"
},
"() -> None"
},
{
"CFPropertyListCreateFromXMLData"
,
(
PyCFunction
)
CFTypeRefObj_CFPropertyListCreateFromXMLData
,
1
,
"(CFOptionFlags mutabilityOption) -> (CFTypeRefObj)"
},
{
"toPython"
,
(
PyCFunction
)
CFTypeRefObj_toPython
,
1
,
{
"toPython"
,
(
PyCFunction
)
CFTypeRefObj_toPython
,
1
,
"() -> (python_object)"
},
"() -> (python_object)"
},
{
NULL
,
NULL
,
0
}
{
NULL
,
NULL
,
0
}
...
@@ -386,7 +452,11 @@ typedef struct CFArrayRefObject {
...
@@ -386,7 +452,11 @@ typedef struct CFArrayRefObject {
PyObject
*
CFArrayRefObj_New
(
CFArrayRef
itself
)
PyObject
*
CFArrayRefObj_New
(
CFArrayRef
itself
)
{
{
CFArrayRefObject
*
it
;
CFArrayRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFArrayRefObject
,
&
CFArrayRef_Type
);
it
=
PyObject_NEW
(
CFArrayRefObject
,
&
CFArrayRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
@@ -538,7 +608,11 @@ typedef struct CFMutableArrayRefObject {
...
@@ -538,7 +608,11 @@ typedef struct CFMutableArrayRefObject {
PyObject
*
CFMutableArrayRefObj_New
(
CFMutableArrayRef
itself
)
PyObject
*
CFMutableArrayRefObj_New
(
CFMutableArrayRef
itself
)
{
{
CFMutableArrayRefObject
*
it
;
CFMutableArrayRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFMutableArrayRefObject
,
&
CFMutableArrayRef_Type
);
it
=
PyObject_NEW
(
CFMutableArrayRefObject
,
&
CFMutableArrayRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
@@ -719,7 +793,11 @@ typedef struct CFDictionaryRefObject {
...
@@ -719,7 +793,11 @@ typedef struct CFDictionaryRefObject {
PyObject
*
CFDictionaryRefObj_New
(
CFDictionaryRef
itself
)
PyObject
*
CFDictionaryRefObj_New
(
CFDictionaryRef
itself
)
{
{
CFDictionaryRefObject
*
it
;
CFDictionaryRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFDictionaryRefObject
,
&
CFDictionaryRef_Type
);
it
=
PyObject_NEW
(
CFDictionaryRefObject
,
&
CFDictionaryRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
@@ -853,7 +931,11 @@ typedef struct CFMutableDictionaryRefObject {
...
@@ -853,7 +931,11 @@ typedef struct CFMutableDictionaryRefObject {
PyObject
*
CFMutableDictionaryRefObj_New
(
CFMutableDictionaryRef
itself
)
PyObject
*
CFMutableDictionaryRefObj_New
(
CFMutableDictionaryRef
itself
)
{
{
CFMutableDictionaryRefObject
*
it
;
CFMutableDictionaryRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFMutableDictionaryRefObject
,
&
CFMutableDictionaryRef_Type
);
it
=
PyObject_NEW
(
CFMutableDictionaryRefObject
,
&
CFMutableDictionaryRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
@@ -971,7 +1053,11 @@ typedef struct CFDataRefObject {
...
@@ -971,7 +1053,11 @@ typedef struct CFDataRefObject {
PyObject
*
CFDataRefObj_New
(
CFDataRef
itself
)
PyObject
*
CFDataRefObj_New
(
CFDataRef
itself
)
{
{
CFDataRefObject
*
it
;
CFDataRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFDataRefObject
,
&
CFDataRef_Type
);
it
=
PyObject_NEW
(
CFDataRefObject
,
&
CFDataRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
@@ -982,7 +1068,13 @@ int CFDataRefObj_Convert(PyObject *v, CFDataRef *p_itself)
...
@@ -982,7 +1068,13 @@ int CFDataRefObj_Convert(PyObject *v, CFDataRef *p_itself)
{
{
if
(
v
==
Py_None
)
{
*
p_itself
=
NULL
;
return
1
;
}
if
(
v
==
Py_None
)
{
*
p_itself
=
NULL
;
return
1
;
}
/* Check for other CF objects here */
if
(
PyString_Check
(
v
))
{
char
*
cStr
;
int
cLen
;
if
(
PyString_AsStringAndSize
(
v
,
&
cStr
,
&
cLen
)
<
0
)
return
0
;
*
p_itself
=
CFDataCreate
((
CFAllocatorRef
)
NULL
,
(
unsigned
char
*
)
cStr
,
cLen
);
return
1
;
}
if
(
!
CFDataRefObj_Check
(
v
))
if
(
!
CFDataRefObj_Check
(
v
))
{
{
...
@@ -1046,6 +1138,18 @@ static PyObject *CFDataRefObj_CFStringCreateFromExternalRepresentation(CFDataRef
...
@@ -1046,6 +1138,18 @@ static PyObject *CFDataRefObj_CFStringCreateFromExternalRepresentation(CFDataRef
return
_res
;
return
_res
;
}
}
static
PyObject
*
CFDataRefObj_CFDataGetData
(
CFDataRefObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
int
size
=
CFDataGetLength
(
_self
->
ob_itself
);
char
*
data
=
(
char
*
)
CFDataGetBytePtr
(
_self
->
ob_itself
);
_res
=
(
PyObject
*
)
PyString_FromStringAndSize
(
data
,
size
);
return
_res
;
}
static
PyMethodDef
CFDataRefObj_methods
[]
=
{
static
PyMethodDef
CFDataRefObj_methods
[]
=
{
{
"CFDataCreateCopy"
,
(
PyCFunction
)
CFDataRefObj_CFDataCreateCopy
,
1
,
{
"CFDataCreateCopy"
,
(
PyCFunction
)
CFDataRefObj_CFDataCreateCopy
,
1
,
"() -> (CFDataRef _rv)"
},
"() -> (CFDataRef _rv)"
},
...
@@ -1053,6 +1157,8 @@ static PyMethodDef CFDataRefObj_methods[] = {
...
@@ -1053,6 +1157,8 @@ static PyMethodDef CFDataRefObj_methods[] = {
"() -> (CFIndex _rv)"
},
"() -> (CFIndex _rv)"
},
{
"CFStringCreateFromExternalRepresentation"
,
(
PyCFunction
)
CFDataRefObj_CFStringCreateFromExternalRepresentation
,
1
,
{
"CFStringCreateFromExternalRepresentation"
,
(
PyCFunction
)
CFDataRefObj_CFStringCreateFromExternalRepresentation
,
1
,
"(CFStringEncoding encoding) -> (CFStringRef _rv)"
},
"(CFStringEncoding encoding) -> (CFStringRef _rv)"
},
{
"CFDataGetData"
,
(
PyCFunction
)
CFDataRefObj_CFDataGetData
,
1
,
"() -> (string _rv)"
},
{
NULL
,
NULL
,
0
}
{
NULL
,
NULL
,
0
}
};
};
...
@@ -1123,7 +1229,11 @@ typedef struct CFMutableDataRefObject {
...
@@ -1123,7 +1229,11 @@ typedef struct CFMutableDataRefObject {
PyObject
*
CFMutableDataRefObj_New
(
CFMutableDataRef
itself
)
PyObject
*
CFMutableDataRefObj_New
(
CFMutableDataRef
itself
)
{
{
CFMutableDataRefObject
*
it
;
CFMutableDataRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFMutableDataRefObject
,
&
CFMutableDataRef_Type
);
it
=
PyObject_NEW
(
CFMutableDataRefObject
,
&
CFMutableDataRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
@@ -1329,7 +1439,11 @@ typedef struct CFStringRefObject {
...
@@ -1329,7 +1439,11 @@ typedef struct CFStringRefObject {
PyObject
*
CFStringRefObj_New
(
CFStringRef
itself
)
PyObject
*
CFStringRefObj_New
(
CFStringRef
itself
)
{
{
CFStringRefObject
*
it
;
CFStringRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFStringRefObject
,
&
CFStringRef_Type
);
it
=
PyObject_NEW
(
CFStringRefObject
,
&
CFStringRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
@@ -2010,7 +2124,11 @@ typedef struct CFMutableStringRefObject {
...
@@ -2010,7 +2124,11 @@ typedef struct CFMutableStringRefObject {
PyObject
*
CFMutableStringRefObj_New
(
CFMutableStringRef
itself
)
PyObject
*
CFMutableStringRefObj_New
(
CFMutableStringRef
itself
)
{
{
CFMutableStringRefObject
*
it
;
CFMutableStringRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFMutableStringRefObject
,
&
CFMutableStringRef_Type
);
it
=
PyObject_NEW
(
CFMutableStringRefObject
,
&
CFMutableStringRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
@@ -2339,7 +2457,11 @@ typedef struct CFURLRefObject {
...
@@ -2339,7 +2457,11 @@ typedef struct CFURLRefObject {
PyObject
*
CFURLRefObj_New
(
CFURLRef
itself
)
PyObject
*
CFURLRefObj_New
(
CFURLRef
itself
)
{
{
CFURLRefObject
*
it
;
CFURLRefObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
if
(
itself
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"cannot wrap NULL"
);
return
NULL
;
}
it
=
PyObject_NEW
(
CFURLRefObject
,
&
CFURLRef_Type
);
it
=
PyObject_NEW
(
CFURLRefObject
,
&
CFURLRef_Type
);
if
(
it
==
NULL
)
return
NULL
;
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
it
->
ob_itself
=
itself
;
...
...
Mac/Modules/cf/cfscan.py
Dosyayı görüntüle @
7906634f
...
@@ -97,6 +97,7 @@ class MyScanner(Scanner_OSX):
...
@@ -97,6 +97,7 @@ class MyScanner(Scanner_OSX):
"CFStringSetExternalCharactersNoCopy"
,
"CFStringSetExternalCharactersNoCopy"
,
"CFStringGetCharacterAtIndex"
,
# No format for single unichars yet.
"CFStringGetCharacterAtIndex"
,
# No format for single unichars yet.
"kCFStringEncodingInvalidId"
,
# incompatible constant declaration
"kCFStringEncodingInvalidId"
,
# incompatible constant declaration
"CFPropertyListCreateFromXMLData"
,
# Manually generated
]
]
def
makegreylist
(
self
):
def
makegreylist
(
self
):
...
...
Mac/Modules/cf/cfsupport.py
Dosyayı görüntüle @
7906634f
...
@@ -203,7 +203,11 @@ OptionalCFURLRef = OpaqueByValueType("CFURLRef", "OptionalCFURLRefObj")
...
@@ -203,7 +203,11 @@ OptionalCFURLRef = OpaqueByValueType("CFURLRef", "OptionalCFURLRefObj")
class
MyGlobalObjectDefinition
(
GlobalObjectDefinition
):
class
MyGlobalObjectDefinition
(
GlobalObjectDefinition
):
def
outputCheckNewArg
(
self
):
def
outputCheckNewArg
(
self
):
Output
(
"if (itself == NULL) return PyMac_Error(resNotFound);"
)
Output
(
'if (itself == NULL)'
)
OutLbrace
()
Output
(
'PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");'
)
Output
(
'return NULL;'
)
OutRbrace
()
def
outputStructMembers
(
self
):
def
outputStructMembers
(
self
):
GlobalObjectDefinition
.
outputStructMembers
(
self
)
GlobalObjectDefinition
.
outputStructMembers
(
self
)
Output
(
"void (*ob_freeit)(CFTypeRef ptr);"
)
Output
(
"void (*ob_freeit)(CFTypeRef ptr);"
)
...
@@ -501,10 +505,6 @@ f = ManualGenerator("CFStringGetUnicode", getasunicode_body);
...
@@ -501,10 +505,6 @@ f = ManualGenerator("CFStringGetUnicode", getasunicode_body);
f
.
docstring
=
lambda
:
"() -> (unicode _rv)"
f
.
docstring
=
lambda
:
"() -> (unicode _rv)"
CFStringRef_object
.
add
(
f
)
CFStringRef_object
.
add
(
f
)
toPython_body
=
"""
return PyCF_CF2Python(_self->ob_itself);
"""
# Get data from CFDataRef
# Get data from CFDataRef
getasdata_body
=
"""
getasdata_body
=
"""
int size = CFDataGetLength(_self->ob_itself);
int size = CFDataGetLength(_self->ob_itself);
...
@@ -518,7 +518,36 @@ f = ManualGenerator("CFDataGetData", getasdata_body);
...
@@ -518,7 +518,36 @@ f = ManualGenerator("CFDataGetData", getasdata_body);
f
.
docstring
=
lambda
:
"() -> (string _rv)"
f
.
docstring
=
lambda
:
"() -> (string _rv)"
CFDataRef_object
.
add
(
f
)
CFDataRef_object
.
add
(
f
)
# Manual generator for CFPropertyListCreateFromXMLData because of funny error return
fromxml_body
=
"""
CFTypeRef _rv;
CFOptionFlags mutabilityOption;
CFStringRef errorString;
if (!PyArg_ParseTuple(_args, "l",
&mutabilityOption))
return NULL;
_rv = CFPropertyListCreateFromXMLData((CFAllocatorRef)NULL,
_self->ob_itself,
mutabilityOption,
&errorString);
if (errorString)
CFRelease(errorString);
if (_rv == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Parse error in XML data");
return NULL;
}
_res = Py_BuildValue("O&",
CFTypeRefObj_New, _rv);
return _res;
"""
f
=
ManualGenerator
(
"CFPropertyListCreateFromXMLData"
,
fromxml_body
)
f
.
docstring
=
lambda
:
"(CFOptionFlags mutabilityOption) -> (CFTypeRefObj)"
CFTypeRef_object
.
add
(
f
)
# Convert CF objects to Python objects
toPython_body
=
"""
return PyCF_CF2Python(_self->ob_itself);
"""
f
=
ManualGenerator
(
"toPython"
,
toPython_body
);
f
=
ManualGenerator
(
"toPython"
,
toPython_body
);
f
.
docstring
=
lambda
:
"() -> (python_object)"
f
.
docstring
=
lambda
:
"() -> (python_object)"
...
...
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