You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2004/07/13 09:38:54 UTC
cvs commit: ws-axis/c/src/xml/txpp/lib Makefile.am xmltok.c xmltok.h xmltok_ns.c xpp.c xmlrole.c xmlrole.h
damitha 2004/07/13 00:38:54
Modified: c/src/xml/txpp/lib Makefile.am xmltok.c xmltok.h xmltok_ns.c
xpp.c
Removed: c/src/xml/txpp/lib xmlrole.c xmlrole.h
Log:
Revision Changes Path
1.2 +1 -1 ws-axis/c/src/xml/txpp/lib/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/ws-axis/c/src/xml/txpp/lib/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.am 26 Mar 2004 08:02:36 -0000 1.1
+++ Makefile.am 13 Jul 2004 07:38:54 -0000 1.2
@@ -1,5 +1,5 @@
lib_LTLIBRARIES = libtxpp.la
AM_CPPFLAGS = -Wall -g -DHAVE_XPP_CONFIG_H
-libtxpp_la_SOURCES = xpp.c xmlrole.c xmltok.c
+libtxpp_la_SOURCES = xpp.c xmltok.c
libtxpp_la_LIBADD =
INCLUDES = -I./ -I../
1.4 +12 -10 ws-axis/c/src/xml/txpp/lib/xmltok.c
Index: xmltok.c
===================================================================
RCS file: /home/cvs/ws-axis/c/src/xml/txpp/lib/xmltok.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xmltok.c 9 Apr 2004 05:35:56 -0000 1.3
+++ xmltok.c 13 Jul 2004 07:38:54 -0000 1.4
@@ -34,6 +34,11 @@
#define IGNORE_SECTION_TOK_VTABLE /* as nothing */
#endif
+/**
+ * xpp_prolog_tok and xpp_content_tok are defined in xmltok_impl.c
+ * xpp_prolog_tok tokenize the xml declaration
+ * xpp_content_tok tokenize the xml content
+ */
#define VTABLE1 \
{ PREFIX(xpp_prolog_tok), PREFIX(xpp_content_tok), \
PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \
@@ -326,6 +331,13 @@
UTF8_cval4 = 0xf0
};
+/** Converts from utf8 to utf8.
+ * @param encoding type
+ * @param
+ * @param
+ * @param
+ * @param
+ */
static void PTRCALL
utf8_toUtf8(const ENCODING *enc,
const char **fromP, const char *fromLim,
@@ -1590,16 +1602,6 @@
* XML_CONTENT_STATE if we're parsing an external text entity, and
* XML_PROLOG_STATE otherwise.
*/
-
-
-static void
-initEncTable(const ENCODING **encodingTable)
-{
- /* *encodingTable = encodingTable[INIT_ENC_INDEX(enc)]; */
- *encodingTable = &utf8_encoding_ns;
-
- return;
-}
static int
initScan(int* parser_state, data_t* data, const ENCODING **encodingTable,
1.5 +12 -5 ws-axis/c/src/xml/txpp/lib/xmltok.h
Index: xmltok.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/xml/txpp/lib/xmltok.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xmltok.h 26 Apr 2004 04:04:40 -0000 1.4
+++ xmltok.h 13 Jul 2004 07:38:54 -0000 1.5
@@ -147,12 +147,15 @@
* const char *,
* const char **);
*/
-typedef int (PTRCALL *SCANNER)(int *, data_t *, const ENCODING *,
- int *,
- char*,
- const char **);
-
+typedef int (PTRCALL *SCANNER)(int *, data_t *, const ENCODING *, int *, char*,
+ const char **);
+/**
+ * This struct is the type which represents encoding. This is struct is assigned
+ * values in xmltok.c.
+ * @see for examplestatic const struct normal_encoding internal_utf8_encoding_ns
+ * in xmltok.c
+ */
struct encoding
{
SCANNER scanners[XML_N_STATES];
@@ -182,6 +185,10 @@
const char *ptr,
const char *end,
const char **badPtr);
+ /* Converts to utf8 which is the parse output encoding which
+ * is decided in
+ * xpp_context_t* ct = (xpp_context_t*) parser_create("UTF-8");
+ */
void (PTRCALL *utf8Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
1.3 +22 -4 ws-axis/c/src/xml/txpp/lib/xmltok_ns.c
Index: xmltok_ns.c
===================================================================
RCS file: /home/cvs/ws-axis/c/src/xml/txpp/lib/xmltok_ns.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- xmltok_ns.c 8 Apr 2004 10:42:02 -0000 1.2
+++ xmltok_ns.c 13 Jul 2004 07:38:54 -0000 1.3
@@ -79,7 +79,26 @@
p->initEnc.updatePosition = initUpdatePosition;
p->encPtr = encPtr;
*encPtr = &(p->initEnc);
- initEncTable(encPtr); /* this is temporary solution by damitha */
+ /*printf("encoding:%d\n", i);*/
+ /** This is where the encoding table(defined in xmltol.c
+ * eg:
+ * #ifdef XML_NS
+ * static const struct normal_encoding utf8_encoding_ns =
+ * {
+ * { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
+ * {
+ * #include "asciitab.h"
+ * #include "utf8tab.h"
+ * },
+ * STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
+ * };
+ * #endif)
+ *
+ * is assigned to the encoding pointer.
+ *
+ */
+ *encPtr = NS(encodings)[i];
+
return 1;
}
@@ -133,8 +152,7 @@
{
/* printf("fromPtr:%s\n", *fromPtr); */
/* printf("rawNameEnd:%s\n", rawNameEnd); */
- XmlUtf8Convert(enc,
- fromPtr, rawNameEnd,
- toPtr, bufEnd);
+ /*This method is defined in xmltok.h*/
+ XmlUtf8Convert(enc, fromPtr, rawNameEnd, toPtr, bufEnd);
}
1.5 +9 -4 ws-axis/c/src/xml/txpp/lib/xpp.c
Index: xpp.c
===================================================================
RCS file: /home/cvs/ws-axis/c/src/xml/txpp/lib/xpp.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xpp.c 9 Apr 2004 05:35:56 -0000 1.4
+++ xpp.c 13 Jul 2004 07:38:54 -0000 1.5
@@ -20,7 +20,6 @@
#include "internal.h"
#include "xpp.h"
#include "xmltok.h"
-#include "xmlrole.h"
#ifdef HAVE_XPP_CONFIG_H
#include "../xpp_config.h"
#endif
@@ -88,7 +87,6 @@
{
/* const XML_Char *encodingName = NULL; */
/* const XML_Char *storedEncName = NULL; */
- const ENCODING *newEncoding = NULL;
const char *version = NULL;
const char *versionend;
/* const XML_Char *storedversion = NULL; */
@@ -97,6 +95,7 @@
if (!(ns
? XmlParseXmlDeclNS
: XmlParseXmlDecl)(isGeneralTextEntity,
+ /*Default encoding*/
encoding,
s,
next,
@@ -104,7 +103,8 @@
&version,
&versionend,
&protocolEncodingName,
- &newEncoding,
+ /*Encoding is taken from the xml file declaration*/
+ &encoding,
&standalone))
return XML_ERROR_SYNTAX;
@@ -136,6 +136,8 @@
{
initialize_encoding(ct);
/* printf("num_chars:%d\n", num_chars); */
+ /* XmlPrologTok is defined in xmltok.h
+ */
ret_status = XmlPrologTok(&state, &ct->data, encoding, &num_chars,
ct->dirty, &ct->next);
if(XML_ERROR_NONE == ret_status)
@@ -150,6 +152,9 @@
{
tok_state = CONTENT;
/* printf("num_chars:%d\n", num_chars); */
+ /* XmlContentTok is defined in xmltok.h.
+ *
+ */
ret_status = XmlContentTok(&state, &ct->data, encoding,
&num_chars, ct->dirty, &ct->next);
/* printf("tempStatus:%d\n", tempStatus); */
@@ -357,7 +362,7 @@
data_t* next(xpp_context_t* ct)
{
data_counter = 0;
- if(!parse(ct))
+ if(XML_ERROR_NONE == parse(ct))
{
process_data(ct, encoding);
return &ct->data;