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
c3345040
Kaydet (Commit)
c3345040
authored
Ara 13, 2005
tarafından
Fredrik Lundh
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
added cobject-based expat dispatch mechanism to pyexpat
üst
e2f8e3c1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
0 deletions
+76
-0
pyexpat.h
Include/pyexpat.h
+45
-0
pyexpat.c
Modules/pyexpat.c
+31
-0
No files found.
Include/pyexpat.h
0 → 100644
Dosyayı görüntüle @
c3345040
/* Stuff to export relevant 'expat' entry points from pyexpat to other
* parser modules, such as cElementTree. */
/* note: you must import expat.h before importing this module! */
#define PyExpat_DISPATCH_MAGIC "pyexpat.dispatch 1.0"
struct
PyExpat_Dispatch
{
int
size
;
/* set to sizeof(struct PyExpat_Dispatch) */
int
MAJOR_VERSION
;
/* XXX: use the ExpatVersionInfo instead? */
int
MINOR_VERSION
;
int
MICRO_VERSION
;
/* pointers to selected expat functions. add new functions at
the end, if needed */
const
XML_LChar
*
(
*
ErrorString
)(
enum
XML_Error
code
);
int
(
*
GetCurrentColumnNumber
)(
XML_Parser
parser
);
int
(
*
GetCurrentLineNumber
)(
XML_Parser
parser
);
enum
XML_Status
(
*
Parse
)(
XML_Parser
parser
,
const
char
*
s
,
int
len
,
int
isFinal
);
XML_Parser
(
*
ParserCreate_MM
)(
const
XML_Char
*
encoding
,
const
XML_Memory_Handling_Suite
*
memsuite
,
const
XML_Char
*
namespaceSeparator
);
void
(
*
ParserFree
)(
XML_Parser
parser
);
void
(
*
SetCharacterDataHandler
)(
XML_Parser
parser
,
XML_CharacterDataHandler
handler
);
void
(
*
SetCommentHandler
)(
XML_Parser
parser
,
XML_CommentHandler
handler
);
void
(
*
SetDefaultHandlerExpand
)(
XML_Parser
parser
,
XML_DefaultHandler
handler
);
void
(
*
SetElementHandler
)(
XML_Parser
parser
,
XML_StartElementHandler
start
,
XML_EndElementHandler
end
);
void
(
*
SetNamespaceDeclHandler
)(
XML_Parser
parser
,
XML_StartNamespaceDeclHandler
start
,
XML_EndNamespaceDeclHandler
end
);
void
(
*
SetProcessingInstructionHandler
)(
XML_Parser
parser
,
XML_ProcessingInstructionHandler
handler
);
void
(
*
SetUnknownEncodingHandler
)(
XML_Parser
parser
,
XML_UnknownEncodingHandler
handler
,
void
*
encodingHandlerData
);
void
(
*
SetUserData
)(
XML_Parser
parser
,
void
*
userData
);
/* always add new stuff to the end! */
};
Modules/pyexpat.c
Dosyayı görüntüle @
c3345040
...
...
@@ -4,6 +4,8 @@
#include "frameobject.h"
#include "expat.h"
#include "pyexpat.h"
#define XML_COMBINED_VERSION (10000*XML_MAJOR_VERSION+100*XML_MINOR_VERSION+XML_MICRO_VERSION)
#ifndef PyDoc_STRVAR
...
...
@@ -1838,6 +1840,8 @@ MODULE_INITFUNC(void)
PyObject
*
modelmod_name
;
PyObject
*
model_module
;
PyObject
*
sys_modules
;
static
struct
PyExpat_Dispatch
dispatch
;
PyObject
*
dispatch_object
;
if
(
errmod_name
==
NULL
)
return
;
...
...
@@ -2011,6 +2015,33 @@ MODULE_INITFUNC(void)
MYCONST
(
XML_CQUANT_REP
);
MYCONST
(
XML_CQUANT_PLUS
);
#undef MYCONST
/* initialize pyexpat dispatch table */
dispatch
.
size
=
sizeof
(
dispatch
);
dispatch
.
MAJOR_VERSION
=
XML_MAJOR_VERSION
;
dispatch
.
MINOR_VERSION
=
XML_MINOR_VERSION
;
dispatch
.
MICRO_VERSION
=
XML_MICRO_VERSION
;
dispatch
.
ErrorString
=
XML_ErrorString
;
dispatch
.
GetCurrentColumnNumber
=
XML_GetCurrentColumnNumber
;
dispatch
.
GetCurrentLineNumber
=
XML_GetCurrentLineNumber
;
dispatch
.
Parse
=
XML_Parse
;
dispatch
.
ParserCreate_MM
=
XML_ParserCreate_MM
;
dispatch
.
ParserFree
=
XML_ParserFree
;
dispatch
.
SetCharacterDataHandler
=
XML_SetCharacterDataHandler
;
dispatch
.
SetCommentHandler
=
XML_SetCommentHandler
;
dispatch
.
SetDefaultHandlerExpand
=
XML_SetDefaultHandlerExpand
;
dispatch
.
SetElementHandler
=
XML_SetElementHandler
;
dispatch
.
SetNamespaceDeclHandler
=
XML_SetNamespaceDeclHandler
;
dispatch
.
SetProcessingInstructionHandler
=
XML_SetProcessingInstructionHandler
;
dispatch
.
SetUnknownEncodingHandler
=
XML_SetUnknownEncodingHandler
;
dispatch
.
SetUserData
=
XML_SetUserData
;
/* export as cobject */
dispatch_object
=
PyCObject_FromVoidPtrAndDesc
(
&
dispatch
,
PyExpat_DISPATCH_MAGIC
,
NULL
);
if
(
dispatch_object
)
PyModule_AddObject
(
m
,
"dispatch"
,
dispatch_object
);
}
static
void
...
...
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