expat/xmlwf xmlwf.c,1.65,1.66

"Fred L. Drake" <[email protected]> Wed, 15 Oct 2003 09:25:46 -0700
Newsgroups gmane.text.xml.expat.cvs
Message-ID <[email protected]>
Update of /cvsroot/expat/expat/xmlwf
In directory sc8-pr-cvs1:/tmp/cvs-serv25971/xmlwf

Modified Files:
	xmlwf.c 
Log Message:
Deal with issue discussed in SF patch #820946: Expat doesn't handle
the use of modified default calling conventions in client code.

To deal with this issue and generally clean up the mass of macros
being used to support bits of the machinery, two new macros are being
added:

- XMLCALL, which expands to whatever is needed to nail down the
  calling convention for all calls across the library boundary.  This
  must match the convention used for the system's malloc()
  implementation.

- XMLIMPORT, defined to be whatever magic is needed to mark an entry
  point as imported from a dynamically loaded module (.dll, .so, .sl,
  whatever).

These macros are used to define the XMLPARSEAPI macro already being
used to define the API entry points.  In addition, XMLCALL is used to
define the types of callback functions, and all example code uses this
explicitly in both the distributed applications and the documentation.


Index: xmlwf.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/xmlwf.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- xmlwf.c	5 Sep 2002 01:48:26 -0000	1.65
+++ xmlwf.c	15 Oct 2003 16:25:44 -0000	1.66
@@ -20,7 +20,7 @@
 
 #define NSSEP T('\001')
 
-static void
+static void XMLCALL
 characterData(void *userData, const XML_Char *s, int len)
 {
   FILE *fp = userData;
@@ -113,7 +113,7 @@
   return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2);
 }
 
-static void
+static void XMLCALL
 startElement(void *userData, const XML_Char *name, const XML_Char **atts)
 {
   int nAtts;
@@ -137,7 +137,7 @@
   puttc(T('>'), fp);
 }
 
-static void
+static void XMLCALL
 endElement(void *userData, const XML_Char *name)
 {
   FILE *fp = userData;
@@ -159,7 +159,7 @@
   return tcscmp(att1, att2);
 }
 
-static void
+static void XMLCALL
 startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
 {
   int nAtts;
@@ -208,7 +208,7 @@
   puttc(T('>'), fp);
 }
 
-static void
+static void XMLCALL
 endElementNS(void *userData, const XML_Char *name)
 {
   FILE *fp = userData;
@@ -227,7 +227,7 @@
 
 #ifndef W3C14N
 
-static void
+static void XMLCALL
 processingInstruction(void *userData, const XML_Char *target,
                       const XML_Char *data)
 {
@@ -243,54 +243,54 @@
 
 #endif /* not W3C14N */
 
-static void
+static void XMLCALL
 defaultCharacterData(void *userData, const XML_Char *s, int len)
 {
   XML_DefaultCurrent((XML_Parser) userData);
 }
 
-static void
+static void XMLCALL
 defaultStartElement(void *userData, const XML_Char *name,
                     const XML_Char **atts)
 {
   XML_DefaultCurrent((XML_Parser) userData);
 }
 
-static void
+static void XMLCALL
 defaultEndElement(void *userData, const XML_Char *name)
 {
   XML_DefaultCurrent((XML_Parser) userData);
 }
 
-static void
+static void XMLCALL
 defaultProcessingInstruction(void *userData, const XML_Char *target,
                              const XML_Char *data)
 {
   XML_DefaultCurrent((XML_Parser) userData);
 }
 
-static void
+static void XMLCALL
 nopCharacterData(void *userData, const XML_Char *s, int len)
 {
 }
 
-static void
+static void XMLCALL
 nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts)
 {
 }
 
-static void
+static void XMLCALL
 nopEndElement(void *userData, const XML_Char *name)
 {
 }
 
-static void
+static void XMLCALL
 nopProcessingInstruction(void *userData, const XML_Char *target,
                          const XML_Char *data)
 {
 }
 
-static void
+static void XMLCALL
 markup(void *userData, const XML_Char *s, int len)
 {
   FILE *fp = XML_GetUserData((XML_Parser) userData);
@@ -324,7 +324,7 @@
   fputts(T("</document>\n"), XML_GetUserData((XML_Parser) userData));
 }
 
-static void
+static void XMLCALL
 metaStartElement(void *userData, const XML_Char *name,
                  const XML_Char **atts)
 {
@@ -359,7 +359,7 @@
     fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaEndElement(void *userData, const XML_Char *name)
 {
   XML_Parser parser = (XML_Parser) userData;
@@ -369,7 +369,7 @@
   fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaProcessingInstruction(void *userData, const XML_Char *target,
                           const XML_Char *data)
 {
@@ -382,7 +382,7 @@
   fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaComment(void *userData, const XML_Char *data)
 {
   XML_Parser parser = (XML_Parser) userData;
@@ -394,7 +394,7 @@
   fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaStartCdataSection(void *userData)
 {
   XML_Parser parser = (XML_Parser) userData;
@@ -404,7 +404,7 @@
   fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaEndCdataSection(void *userData)
 {
   XML_Parser parser = (XML_Parser) userData;
@@ -414,7 +414,7 @@
   fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaCharacterData(void *userData, const XML_Char *s, int len)
 {
   XML_Parser parser = (XML_Parser) userData;
@@ -426,7 +426,7 @@
   fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaStartDoctypeDecl(void *userData,
                      const XML_Char *doctypeName,
                      const XML_Char *sysid,
@@ -440,7 +440,7 @@
   fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaEndDoctypeDecl(void *userData)
 {
   XML_Parser parser = (XML_Parser) userData;
@@ -450,7 +450,7 @@
   fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaNotationDecl(void *userData,
                  const XML_Char *notationName,
                  const XML_Char *base,
@@ -472,7 +472,7 @@
 }
 
 
-static void
+static void XMLCALL
 metaEntityDecl(void *userData,
                const XML_Char *entityName,
                int  is_param,
@@ -516,7 +516,7 @@
   }
 }
 
-static void
+static void XMLCALL
 metaStartNamespaceDecl(void *userData,
                        const XML_Char *prefix,
                        const XML_Char *uri)
@@ -535,7 +535,7 @@
     fputts(T("/>\n"), fp);
 }
 
-static void
+static void XMLCALL
 metaEndNamespaceDecl(void *userData, const XML_Char *prefix)
 {
   XML_Parser parser = (XML_Parser) userData;
@@ -546,13 +546,13 @@
     ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix);
 }
 
-static int
+static int XMLCALL
 unknownEncodingConvert(void *data, const char *p)
 {
   return codepageConvert(*(int *)data, p);
 }
 
-static int
+static int XMLCALL
 unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info)
 {
   int cp;
@@ -588,7 +588,7 @@
   return 1;
 }
 
-static int
+static int XMLCALL
 notStandalone(void *userData)
 {
   return 0;