Browse Source

* progress on libxml2 translation

git-svn-id: trunk@11572 -
ivost 17 years ago
parent
commit
81ff2df54d

+ 8 - 18
packages/libxml/src/HTMLparser.inc

@@ -10,17 +10,9 @@
  * Author: Daniel Veillard
  *)
 
-#ifndef __HTML_PARSER_H__
-#define __HTML_PARSER_H__
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-
-{ LIBXML_HTML_ENABLED
-
-{ __cplusplus
-extern "C" {
-#endif
+{$IFDEF LIBXML_HTML_ENABLED}
 
+{$IFDEF TYPE_}
 (*
  * Most of the back-end structures from XML and HTML are shared.
  *)
@@ -79,7 +71,9 @@ struct _htmlEntityDesc {
     char *name;	(* The entity name *)
     char *desc;   (* the description *)
 };
+{$ENDIF}
 
+{$IFDEF FUNCTION_}
 (*
  * There is only few public functions.
  *)
@@ -145,7 +139,7 @@ XMLPUBFUN int XMLCALL
 XMLPUBFUN int XMLCALL
 			htmlHandleOmittedElem(int val);
 
-{ LIBXML_PUSH_ENABLED
+{$IFDEF LIBXML_PUSH_ENABLED}
 (**
  * Interfaces for the Push mode.
  *)
@@ -161,7 +155,7 @@ XMLPUBFUN int XMLCALL
 						 char *chunk,
 						 int size,
 						 int terminate);
-#endif (* LIBXML_PUSH_ENABLED *)
+{$ENDIF} (* LIBXML_PUSH_ENABLED *)
 
 XMLPUBFUN void XMLCALL
 			htmlFreeParserCtxt	(htmlParserCtxtPtr ctxt);
@@ -293,11 +287,7 @@ XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(htmlNodePtr, int) ;
  * Returns the attributes required for the specified element.
  *)
 #define htmlRequiredAttrs(elt) (elt)->attrs_req
+{$ENDIF}
 
+{$ENDIF} (* LIBXML_HTML_ENABLED *)
 
-{ __cplusplus
-}
-#endif
-
-#endif (* LIBXML_HTML_ENABLED *)
-#endif (* __HTML_PARSER_H__ *)

+ 13 - 29
packages/libxml/src/HTMLtree.inc

@@ -8,57 +8,47 @@
  * Author: Daniel Veillard
  *)
 
-#ifndef __HTML_TREE_H__
-#define __HTML_TREE_H__
-
-#include <stdio.h>
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-#include <libxml/HTMLparser.h>
-
-{ LIBXML_HTML_ENABLED
-
-{ __cplusplus
-extern "C" {
-#endif
-
+{$IFDEF LIBXML_HTML_ENABLED}
 
+{$IFDEF CONST}
 (**
  * HTML_TEXT_NODE:
  *
  * Macro. A text node in a HTML document is really implemented
  * the same way as a text node in an XML document.
  *)
-#define HTML_TEXT_NODE		XML_TEXT_NODE
+  HTML_TEXT_NODE		= XML_TEXT_NODE;
 (**
  * HTML_ENTITY_REF_NODE:
  *
  * Macro. An entity reference in a HTML document is really implemented
  * the same way as an entity reference in an XML document.
  *)
-#define HTML_ENTITY_REF_NODE	XML_ENTITY_REF_NODE
+  HTML_ENTITY_REF_NODE	= XML_ENTITY_REF_NODE;
 (**
  * HTML_COMMENT_NODE:
  *
  * Macro. A comment in a HTML document is really implemented
  * the same way as a comment in an XML document.
  *)
-#define HTML_COMMENT_NODE	XML_COMMENT_NODE
+  HTML_COMMENT_NODE	= XML_COMMENT_NODE;
 (**
  * HTML_PRESERVE_NODE:
  *
  * Macro. A preserved node in a HTML document is really implemented
  * the same way as a CDATA section in an XML document.
  *)
-#define HTML_PRESERVE_NODE	XML_CDATA_SECTION_NODE
+  HTML_PRESERVE_NODE	= XML_CDATA_SECTION_NODE;
 (**
  * HTML_PI_NODE:
  *
  * Macro. A processing instruction in a HTML document is really implemented
  * the same way as a processing instruction in an XML document.
  *)
-#define HTML_PI_NODE		XML_PI_NODE
+  HTML_PI_NODE		= XML_PI_NODE;
+{$ENDIF}
 
+{$IFDEF FUNCTION_}
 XMLPUBFUN htmlDocPtr XMLCALL
 		htmlNewDoc		(xmlChar *URI,
 					 xmlChar *ExternalID);
@@ -70,7 +60,7 @@ XMLPUBFUN xmlChar * XMLCALL
 XMLPUBFUN int XMLCALL
 		htmlSetMetaEncoding	(htmlDocPtr doc,
 					 xmlChar *encoding);
-{ LIBXML_OUTPUT_ENABLED
+{$IFDEF LIBXML_OUTPUT_ENABLED}
 XMLPUBFUN void XMLCALL
 		htmlDocDumpMemory	(xmlDocPtr cur,
 					 xmlChar **mem,
@@ -131,17 +121,11 @@ XMLPUBFUN void XMLCALL
 					 xmlNodePtr cur,
 					 char *encoding);
 
-#endif (* LIBXML_OUTPUT_ENABLED *)
+{$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
 
 XMLPUBFUN int XMLCALL
 		htmlIsBooleanAttr	(xmlChar *name);
 
+{$ENDIF}
 
-{ __cplusplus
-}
-#endif
-
-#endif (* LIBXML_HTML_ENABLED *)
-
-#endif (* __HTML_TREE_H__ *)
-
+{$ENDIF} (* LIBXML_HTML_ENABLED *)

+ 10 - 26
packages/libxml/src/SAX.inc

@@ -8,21 +8,10 @@
  * Author: Daniel Veillard
  *)
 
+{$IFDEF LIBXML_LEGACY_ENABLED}
 
-#ifndef __XML_SAX_H__
-#define __XML_SAX_H__
+{$IFDEF FUNCTION_}
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-#include <libxml/xlink.h>
-
-{ LIBXML_LEGACY_ENABLED
-
-{ __cplusplus
-extern "C" {
-#endif
 XMLPUBFUN xmlChar * XMLCALL
 		getPublicId			(void *ctx);
 XMLPUBFUN xmlChar * XMLCALL	
@@ -150,24 +139,19 @@ XMLPUBFUN void XMLCALL
 						 xmlChar *value,
 						 int len);
 
-{ LIBXML_SAX1_ENABLED
+{$IFDEF LIBXML_SAX1_ENABLED}
 XMLPUBFUN void XMLCALL		
 		initxmlDefaultSAXHandler	(xmlSAXHandlerV1 *hdlr,
 						 int warning);
-{ LIBXML_HTML_ENABLED
+{$IFDEF LIBXML_HTML_ENABLED}
 XMLPUBFUN void XMLCALL		
 		inithtmlDefaultSAXHandler	(xmlSAXHandlerV1 *hdlr);
-#endif
-{ LIBXML_DOCB_ENABLED
+{$ENDIF}
+{$IFDEF LIBXML_DOCB_ENABLED}
 XMLPUBFUN void XMLCALL		
 		initdocbDefaultSAXHandler	(xmlSAXHandlerV1 *hdlr);
-#endif
-#endif (* LIBXML_SAX1_ENABLED *)
-
-{ __cplusplus
-}
-#endif
-
-#endif (* LIBXML_LEGACY_ENABLED *)
+{$ENDIF}
+{$ENDIF} (* LIBXML_SAX1_ENABLED *)
+{$ENDIF}
 
-#endif (* __XML_SAX_H__ *)
+{$ENDIF} (* LIBXML_LEGACY_ENABLED *)

+ 11 - 25
packages/libxml/src/SAX2.inc

@@ -8,19 +8,7 @@
  * Author: Daniel Veillard
  *)
 
-
-#ifndef __XML_SAX2_H__
-#define __XML_SAX2_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-#include <libxml/xlink.h>
-
-{ __cplusplus
-extern "C" {
-#endif
+{$IFDEF FUNCTION_}
 XMLPUBFUN xmlChar * XMLCALL
 		xmlSAX2GetPublicId		(void *ctx);
 XMLPUBFUN xmlChar * XMLCALL	
@@ -98,7 +86,7 @@ XMLPUBFUN void XMLCALL
 		xmlSAX2StartDocument		(void *ctx);
 XMLPUBFUN void XMLCALL		
 		xmlSAX2EndDocument		(void *ctx);
-#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
+{$IF defined(LIBXML_SAX1_ENABLED) or defined(LIBXML_HTML_ENABLED) or defined(LIBXML_WRITER_ENABLED) or defined(LIBXML_DOCB_ENABLED)}
 XMLPUBFUN void XMLCALL		
 		xmlSAX2StartElement		(void *ctx,
 						 xmlChar *fullname,
@@ -106,7 +94,7 @@ XMLPUBFUN void XMLCALL
 XMLPUBFUN void XMLCALL		
 		xmlSAX2EndElement		(void *ctx,
 						 xmlChar *name);
-#endif (* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED *)
+{$ENDIF} (* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED *)
 XMLPUBFUN void XMLCALL
 		xmlSAX2StartElementNs		(void *ctx,
 						 xmlChar *localname,
@@ -145,10 +133,10 @@ XMLPUBFUN void XMLCALL
 						 xmlChar *value,
 						 int len);
 
-{ LIBXML_SAX1_ENABLED
+{$IFDEF LIBXML_SAX1_ENABLED}
 XMLPUBFUN int XMLCALL
 		xmlSAXDefaultVersion		(int version);
-#endif (* LIBXML_SAX1_ENABLED *)
+{$ENDIF} (* LIBXML_SAX1_ENABLED *)
 
 XMLPUBFUN int XMLCALL
 		xmlSAXVersion			(xmlSAXHandler *hdlr,
@@ -156,21 +144,19 @@ XMLPUBFUN int XMLCALL
 XMLPUBFUN void XMLCALL		
 		xmlSAX2InitDefaultSAXHandler    (xmlSAXHandler *hdlr,
 						 int warning);
-{ LIBXML_HTML_ENABLED
+{$IFDEF LIBXML_HTML_ENABLED}
 XMLPUBFUN void XMLCALL		
 		xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
 XMLPUBFUN void XMLCALL		
 		htmlDefaultSAXHandlerInit	(void);
-#endif
-{ LIBXML_DOCB_ENABLED
+{$ENDIF}
+{$IFDEF LIBXML_DOCB_ENABLED}
 XMLPUBFUN void XMLCALL		
 		xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr);
 XMLPUBFUN void XMLCALL		
 		docbDefaultSAXHandlerInit	(void);
-#endif
+{$ENDIF}
 XMLPUBFUN void XMLCALL		
 		xmlDefaultSAXHandlerInit	(void);
-{ __cplusplus
-}
-#endif
-#endif (* __XML_SAX2_H__ *)
+
+{$ENDIF}

+ 16 - 0
packages/libxml/src/libxml2.pas

@@ -62,6 +62,10 @@ type
   {$i globals.inc}
   {$i nanoftp.inc}
   {$i nanohttp.inc}
+  {$i SAX.inc}
+  {$i SAX2.inc}
+  {$i HTMLtree.inc}
+  {$i HTMLparser.inc}
   {$i xmlautomata.inc}
   {$i xmlIO.inc}
   {$i xmlmodule.inc}
@@ -105,6 +109,10 @@ type
   {$i globals.inc}
   {$i nanoftp.inc}
   {$i nanohttp.inc}
+  {$i SAX.inc}
+  {$i SAX2.inc}
+  {$i HTMLtree.inc}
+  {$i HTMLparser.inc}
   {$i xmlautomata.inc}
   {$i xmlIO.inc}
   {$i xmlmodule.inc}
@@ -149,6 +157,10 @@ const
   {$i globals.inc}
   {$i nanoftp.inc}
   {$i nanohttp.inc}
+  {$i SAX.inc}
+  {$i SAX2.inc}
+  {$i HTMLtree.inc}
+  {$i HTMLparser.inc}
   {$i xmlautomata.inc}
   {$i xmlIO.inc}
   {$i xmlmodule.inc}
@@ -192,6 +204,10 @@ const
   {$i globals.inc}
   {$i nanoftp.inc}
   {$i nanohttp.inc}
+  {$i SAX.inc}
+  {$i SAX2.inc}
+  {$i HTMLtree.inc}
+  {$i HTMLparser.inc}
   {$i xmlautomata.inc}
   {$i xmlIO.inc}
   {$i xmlmodule.inc}

+ 8 - 2
packages/libxml/src/tree.inc

@@ -288,8 +288,13 @@
  *
  * A namespace declaration node.
  *)
-{$DEFINE XML_LOCAL_NAMESPACE := XML_NAMESPACE_DECL}
+{$ENDIF}
+
+{$IFDEF CONST}
+  XML_LOCAL_NAMESPACE = XML_NAMESPACE_DECL;
+{$ENDIF}
 
+{$IFDEF TYPE}
   xmlNsType = xmlElementType;
 
 (**
@@ -411,12 +416,13 @@
   end;
 {$ENDIF}
 
-{$IFDEF MACROIMPL}
+{$IFDEF FUNCTION}
 (**
  * XML_GET_CONTENT:
  *
  * Macro to extract the content pointer of a node.
  *)
+
 {#define XML_GET_CONTENT(n)					\
     ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)}