Browse Source

* progress on libxml2 translation

git-svn-id: trunk@11568 -
ivost 17 years ago
parent
commit
922fa49bb9

+ 59 - 126
packages/libxml/src/catalog.inc

@@ -14,169 +14,102 @@
  * Author: Daniel Veillard
  *)
 
-#ifndef __XML_CATALOG_H__
-#define __XML_CATALOG_H__
-
-#include <stdio.h>
-
-#include <libxml/xmlversion.h>
-#include <libxml/xmlstring.h>
-#include <libxml/tree.h>
-
-{ LIBXML_CATALOG_ENABLED
-
-{ __cplusplus
-extern "C" {
-#endif
+{$IFDEF LIBXML_CATALOG_ENABLED}
 
+{$IFDEF CONST}
 (**
  * XML_CATALOGS_NAMESPACE:
  *
  * The namespace for the XML Catalogs elements.
  *)
-#define XML_CATALOGS_NAMESPACE					\
-    (xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
+  XML_CATALOGS_NAMESPACE: xmlCharPtr = 'urn:oasis:names:tc:entity:xmlns:xml:catalog';
+
 (**
  * XML_CATALOG_PI:
  *
  * The specific XML Catalog Processing Instuction name.
  *)
-#define XML_CATALOG_PI						\
-    (xmlChar *) "oasis-xml-catalog"
+  XML_CATALOG_PI: xmlCharPtr = 'urn:oasis:names:tc:entity:xmlns:xml:catalog';
+{$ENDIF}
 
+{$IFDEF POINTER}
+  xmlCatalogPtr = ^xmlCatalog;
+{$ENDIF}
+
+{$IFDEF TYPE}
 (*
  * The API is voluntarily limited to general cataloging.
  *)
-typedef enum {
+  xmlCatalogPrefer = (
     XML_CATA_PREFER_NONE = 0,
     XML_CATA_PREFER_PUBLIC = 1,
     XML_CATA_PREFER_SYSTEM
-} xmlCatalogPrefer;
+  );
 
-typedef enum {
+  xmlCatalogAllow = (
     XML_CATA_ALLOW_NONE = 0,
     XML_CATA_ALLOW_GLOBAL = 1,
     XML_CATA_ALLOW_DOCUMENT = 2,
     XML_CATA_ALLOW_ALL = 3
-} xmlCatalogAllow;
+  );
 
-typedef struct _xmlCatalog xmlCatalog;
-typedef xmlCatalog *xmlCatalogPtr;
+  xmlCatalog = record end;
+{$ENDIF}
 
+{$IFDEF FUNCTION}
 (*
  * Operations on a given catalog.
  *)
-XMLPUBFUN xmlCatalogPtr XMLCALL
-		xmlNewCatalog		(int sgml);
-XMLPUBFUN xmlCatalogPtr XMLCALL	
-		xmlLoadACatalog		(char *filename);
-XMLPUBFUN xmlCatalogPtr XMLCALL	
-		xmlLoadSGMLSuperCatalog	(char *filename);
-XMLPUBFUN int XMLCALL		
-		xmlConvertSGMLCatalog	(xmlCatalogPtr catal);
-XMLPUBFUN int XMLCALL		
-		xmlACatalogAdd		(xmlCatalogPtr catal,
-					 xmlChar *type,
-					 xmlChar *orig,
-					 xmlChar *replace);
-XMLPUBFUN int XMLCALL		
-		xmlACatalogRemove	(xmlCatalogPtr catal,
-					 xmlChar *value);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlACatalogResolve	(xmlCatalogPtr catal,
-					 xmlChar *pubID,
-	                                 xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlACatalogResolveSystem(xmlCatalogPtr catal,
-					 xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlACatalogResolvePublic(xmlCatalogPtr catal,
-					 xmlChar *pubID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlACatalogResolveURI	(xmlCatalogPtr catal,
-					 xmlChar *URI);
-{ LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlACatalogDump		(xmlCatalogPtr catal,
-					 FILE *out);
-#endif (* LIBXML_OUTPUT_ENABLED *)
-XMLPUBFUN void XMLCALL		
-		xmlFreeCatalog		(xmlCatalogPtr catal);
-XMLPUBFUN int XMLCALL		
-		xmlCatalogIsEmpty	(xmlCatalogPtr catal);
+function xmlNewCatalog(sgml: cint): xmlCatalogPtr; XMLCALL; XMLPUBFUN;
+function xmlLoadACatalog(filename: pchar): xmlCatalogPtr; XMLCALL; XMLPUBFUN;
+function xmlLoadSGMLSuperCatalog(filename: pchar): xmlCatalogPtr; XMLCALL; XMLPUBFUN;
+function xmlLoadACatalog(catal: xmlCatalogPtr): cint; XMLCALL; XMLPUBFUN;
+function xmlACatalogAdd(catal: xmlCatalogPtr; _type, orig, replace: xmlCharPtr): cint; XMLCALL; XMLPUBFUN;
+function xmlACatalogRemove(catal: xmlCatalogPtr; value: xmlCharPtr): cint; XMLCALL; XMLPUBFUN;
+function xmlACatalogResolve(catal: xmlCatalogPtr; pubID, sysID: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlACatalogResolveSystem(catal: xmlCatalogPtr; sysID: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlACatalogResolvePublic(catal: xmlCatalogPtr; pubID: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlACatalogResolveURI(catal: xmlCatalogPtr; URI: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+{$IFDEF LIBXML_OUTPUT_ENABLED}
+procedure xmlACatalogDump(catal: xmlCatalogPtr; _out: PFILE); XMLCALL; XMLPUBFUN;
+{$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
+procedure xmlFreeCatalog(catal: xmlCatalogPtr); XMLCALL; XMLPUBFUN;
+function xmlCatalogIsEmpty(catal: xmlCatalogPtr): cint; XMLCALL; XMLPUBFUN;
 
 (*
  * Global operations.
  *)
-XMLPUBFUN void XMLCALL		
-		xmlInitializeCatalog	(void);
-XMLPUBFUN int XMLCALL		
-		xmlLoadCatalog		(char *filename);
-XMLPUBFUN void XMLCALL		
-		xmlLoadCatalogs		(char *paths);
-XMLPUBFUN void XMLCALL		
-		xmlCatalogCleanup	(void);
-{ LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlCatalogDump		(FILE *out);
-#endif (* LIBXML_OUTPUT_ENABLED *)
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogResolve	(xmlChar *pubID,
-	                                 xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogResolveSystem	(xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogResolvePublic	(xmlChar *pubID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogResolveURI	(xmlChar *URI);
-XMLPUBFUN int XMLCALL		
-		xmlCatalogAdd		(xmlChar *type,
-					 xmlChar *orig,
-					 xmlChar *replace);
-XMLPUBFUN int XMLCALL		
-		xmlCatalogRemove	(xmlChar *value);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlParseCatalogFile	(char *filename);
-XMLPUBFUN int XMLCALL		
-		xmlCatalogConvert	(void);
+procedure xmlInitializeCatalog; XMLCALL; XMLPUBFUN;
+function xmlLoadCatalog(filename: pchar): cint; XMLCALL; XMLPUBFUN;
+function xmlLoadCatalogs(paths: pchar): cint; XMLCALL; XMLPUBFUN;
+procedure xmlCatalogCleanup; XMLCALL; XMLPUBFUN;
+{$IFDEF LIBXML_OUTPUT_ENABLED}
+procedure xmlCatalogDump(_out: PFILE); XMLCALL; XMLPUBFUN;
+{$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
+function xmlCatalogResolve(pubID, sysID: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlCatalogResolveSystem(sysID: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlCatalogResolvePublic(pubID: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlCatalogResolveURI(URI: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlCatalogAdd(_type, orig, replace: xmlCharPtr): cint; XMLCALL; XMLPUBFUN;
+function xmlCatalogRemove(value: xmlCharPtr): cint; XMLCALL; XMLPUBFUN;
+function xmlParseCatalogFile(filename: pchar): xmlDocPtr; XMLCALL; XMLPUBFUN;
+function xmlCatalogConvert: cint; XMLCALL; XMLPUBFUN;
 
 (*
  * Strictly minimal interfaces for per-document catalogs used
  * by the parser.
  *)
-XMLPUBFUN void XMLCALL		
-		xmlCatalogFreeLocal	(void *catalogs);
-XMLPUBFUN void * XMLCALL		
-		xmlCatalogAddLocal	(void *catalogs,
-					 xmlChar *URL);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogLocalResolve	(void *catalogs,
-					 xmlChar *pubID,
-	                                 xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogLocalResolveURI(void *catalogs,
-					 xmlChar *URI);
+procedure xmlCatalogFreeLocal(catalogs: pointer); XMLCALL; XMLPUBFUN;
+function xmlCatalogAddLocal(catalogs: pointer; URL: xmlCharPtr): pointer; XMLCALL; XMLPUBFUN;
+function xmlCatalogLocalResolve(catalogs: pointer; pubID, sysID: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlCatalogLocalResolveURI(catalogs: pointer; URI: xmlCharPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+
 (*
  * Preference settings.
  *)
-XMLPUBFUN int XMLCALL		
-		xmlCatalogSetDebug	(int level);
-XMLPUBFUN xmlCatalogPrefer XMLCALL 
-		xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
-XMLPUBFUN void XMLCALL		
-		xmlCatalogSetDefaults	(xmlCatalogAllow allow);
-XMLPUBFUN xmlCatalogAllow XMLCALL	
-		xmlCatalogGetDefaults	(void);
-
-
-(* DEPRECATED interfaces *)
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogGetSystem	(xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogGetPublic	(xmlChar *pubID);
-
-{ __cplusplus
-}
-#endif
-#endif (* LIBXML_CATALOG_ENABLED *)
-#endif (* __XML_CATALOG_H__ *)
+function xmlCatalogSetDebug(level: cint): cint; XMLCALL; XMLPUBFUN;
+function xmlCatalogSetDefaultPrefer(prefer: xmlCatalogPrefer): cint; XMLCALL; XMLPUBFUN;
+procedure xmlCatalogSetDefaults(allow: xmlCatalogAllow); XMLCALL; XMLPUBFUN;
+function xmlCatalogGetDefaults: xmlCatalogAllow; XMLCALL; XMLPUBFUN;
+{$ENDIF}
+{$ENDIF} (* LIBXML_CATALOG_ENABLED *)

+ 62 - 104
packages/libxml/src/chvalid.inc

@@ -11,49 +11,40 @@
  * Author: William Brack <[email protected]>
  *)
 
-#ifndef __XML_CHVALID_H__
-#define __XML_CHVALID_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/xmlstring.h>
-
-{ __cplusplus
-extern "C" {
-#endif
+{$IFDEF POINTER}
+  xmlChSRangePtr = ^xmlChSRange;
+  xmlChLRangePtr = ^xmlChLRange;
+  xmlChRangeGroupPtr = ^xmlChRangeGroup;
+{$ENDIF}
 
+{$IFDEF TYPE}
 (*
  * Define our typedefs and structures
  *
  *)
-typedef struct _xmlChSRange xmlChSRange;
-typedef xmlChSRange *xmlChSRangePtr;
-struct _xmlChSRange {
-    unsigned short	low;
-    unsigned short	high;
-};
-
-typedef struct _xmlChLRange xmlChLRange;
-typedef xmlChLRange *xmlChLRangePtr;
-struct _xmlChLRange {
-    unsigned int	low;
-    unsigned int	high;
-};
-
-typedef struct _xmlChRangeGroup xmlChRangeGroup;
-typedef xmlChRangeGroup *xmlChRangeGroupPtr;
-struct _xmlChRangeGroup {
-    int			nbShortRange;
-    int			nbLongRange;
-    xmlChSRange	*shortRange;	(* points to an array of ranges *)
-    xmlChLRange	*longRange;
-};
+  xmlChSRange = record
+    low   : cushort;
+    high  : cushort;
+  end;
+
+  xmlChLRange = record
+    low   : cuint;
+    high  : cuint;
+  end;
 
+  xmlChRangeGroup = record
+    nbShortRange  : cint;
+    nbLongRange   : cint;
+    shortRange    : xmlChSRangePtr;
+    longRange     : xmlChLRangePtr;
+  end;
+{$ENDIF}
+
+{$IFDEF FUNCTION}
 (**
  * Range checking routine
  *)
-XMLPUBFUN int XMLCALL
-		xmlCharInRange(unsigned int val, xmlChRangeGroup *group);
-
+function xmlCharInRange(val: cint; group: xmlChRangeGroupPtr): cbool; XMLCALL; XMLPUBFUN;
 
 (**
  * xmlIsBaseChar_ch:
@@ -61,11 +52,7 @@ XMLPUBFUN int XMLCALL
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsBaseChar_ch(c)	(((0x41 <= (c)) && ((c) <= 0x5a)) || \
-				 ((0x61 <= (c)) && ((c) <= 0x7a)) || \
-				 ((0xc0 <= (c)) && ((c) <= 0xd6)) || \
-				 ((0xd8 <= (c)) && ((c) <= 0xf6)) || \
-				  (0xf8 <= (c)))
+function xmlIsBaseChar_ch(c: cint): cbool;
 
 (**
  * xmlIsBaseCharQ:
@@ -73,11 +60,10 @@ XMLPUBFUN int XMLCALL
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsBaseCharQ(c)	(((c) < 0x100) ? \
-				 xmlIsBaseChar_ch((c)) : \
-				 xmlCharInRange((c), &xmlIsBaseCharGroup))
+function xmlIsBaseCharQ(c: cint): cbool;
 
-XMLPUBVAR xmlChRangeGroup xmlIsBaseCharGroup;
+var
+  xmlIsBaseCharGroup: xmlChRangeGroup; XMLPUBVAR;
 
 (**
  * xmlIsBlank_ch:
@@ -85,9 +71,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsBaseCharGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsBlank_ch(c)	(((c) == 0x20) || \
-				 ((0x9 <= (c)) && ((c) <= 0xa)) || \
-				 ((c) == 0xd))
+function xmlIsBlank_ch(c: cint): cbool;
 
 (**
  * xmlIsBlankQ:
@@ -95,9 +79,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsBaseCharGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsBlankQ(c)		(((c) < 0x100) ? \
-				 xmlIsBlank_ch((c)) : 0)
-
+function xmlIsBlankQ(c: cint): cbool;
 
 (**
  * xmlIsChar_ch:
@@ -105,9 +87,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsBaseCharGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsChar_ch(c)		(((0x9 <= (c)) && ((c) <= 0xa)) || \
-				 ((c) == 0xd) || \
-				  (0x20 <= (c)))
+function xmlIsChar_ch(c: cint): cbool;
 
 (**
  * xmlIsCharQ:
@@ -115,13 +95,10 @@ XMLPUBVAR xmlChRangeGroup xmlIsBaseCharGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsCharQ(c)		(((c) < 0x100) ? \
-				 xmlIsChar_ch((c)) :\
-				(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
-				 ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
-				 ((0x10000 <= (c)) && ((c) <= 0x10ffff))))
+function xmlIsCharQ(c: cint): cbool;
 
-XMLPUBVAR xmlChRangeGroup xmlIsCharGroup;
+var
+  xmlIsCharGroup: xmlChRangeGroup; XMLPUBVAR;
 
 (**
  * xmlIsCombiningQ:
@@ -129,11 +106,10 @@ XMLPUBVAR xmlChRangeGroup xmlIsCharGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsCombiningQ(c)	(((c) < 0x100) ? \
-				 0 : \
-				 xmlCharInRange((c), &xmlIsCombiningGroup))
+function xmlIsCombiningQ(c: cint): cbool;
 
-XMLPUBVAR xmlChRangeGroup xmlIsCombiningGroup;
+var
+  xmlIsCombiningGroup: xmlChRangeGroup; XMLPUBVAR;
 
 (**
  * xmlIsDigit_ch:
@@ -141,7 +117,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsCombiningGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsDigit_ch(c)	(((0x30 <= (c)) && ((c) <= 0x39)))
+function xmlIsDigit_ch(c: cint): cbool;
 
 (**
  * xmlIsDigitQ:
@@ -149,11 +125,10 @@ XMLPUBVAR xmlChRangeGroup xmlIsCombiningGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsDigitQ(c)		(((c) < 0x100) ? \
-				 xmlIsDigit_ch((c)) : \
-				 xmlCharInRange((c), &xmlIsDigitGroup))
+function xmlIsDigitQ(c: cint): cbool;
 
-XMLPUBVAR xmlChRangeGroup xmlIsDigitGroup;
+var
+  xmlIsDigitGroup: xmlChRangeGroup; XMLPUBVAR;
 
 (**
  * xmlIsExtender_ch:
@@ -161,7 +136,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsDigitGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsExtender_ch(c)	(((c) == 0xb7))
+function xmlIsExtender_ch(c: cint): cbool;
 
 (**
  * xmlIsExtenderQ:
@@ -169,11 +144,10 @@ XMLPUBVAR xmlChRangeGroup xmlIsDigitGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsExtenderQ(c)	(((c) < 0x100) ? \
-				 xmlIsExtender_ch((c)) : \
-				 xmlCharInRange((c), &xmlIsExtenderGroup))
+function xmlIsExtenderQ(c: cint): cbool;
 
-XMLPUBVAR xmlChRangeGroup xmlIsExtenderGroup;
+var
+  xmlIsExtenderGroup: xmlChRangeGroup; XMLPUBVAR;
 
 (**
  * xmlIsIdeographicQ:
@@ -181,14 +155,11 @@ XMLPUBVAR xmlChRangeGroup xmlIsExtenderGroup;
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsIdeographicQ(c)	(((c) < 0x100) ? \
-				 0 :\
-				(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
-				 ((c) == 0x3007) || \
-				 ((0x3021 <= (c)) && ((c) <= 0x3029))))
+function xmlIsIdeographicQ(c: cint): cbool;
 
-XMLPUBVAR xmlChRangeGroup xmlIsIdeographicGroup;
-XMLPUBVAR unsigned char xmlIsPubidChar_tab[256];
+var
+  xmlIsIdeographicGroup: xmlChRangeGroup; XMLPUBVAR;
+  xmlIsPubidChar_tab: array[0..255] of cbool;
 
 (**
  * xmlIsPubidChar_ch:
@@ -196,7 +167,7 @@ XMLPUBVAR unsigned char xmlIsPubidChar_tab[256];
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsPubidChar_ch(c)	(xmlIsPubidChar_tab[(c)])
+function xmlIsPubidChar_ch(c: cint): cbool;
 
 (**
  * xmlIsPubidCharQ:
@@ -204,27 +175,14 @@ XMLPUBVAR unsigned char xmlIsPubidChar_tab[256];
  *
  * Automatically generated by genChRanges.py
  *)
-#define xmlIsPubidCharQ(c)	(((c) < 0x100) ? \
-				 xmlIsPubidChar_ch((c)) : 0)
-
-XMLPUBFUN int XMLCALL
-		xmlIsBaseChar(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsBlank(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsChar(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsCombining(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsDigit(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsExtender(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsIdeographic(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsPubidChar(unsigned int ch);
-
-{ __cplusplus
-}
-#endif
-#endif (* __XML_CHVALID_H__ *)
+function xmlIsPubidCharQ(c: cint): cbool;
+
+function xmlIsBaseChar(ch: cuint): cbool; XMLCALL; XMLPUBFUN;
+function xmlIsBlank(ch: cuint): cbool; XMLCALL; XMLPUBFUN;
+function xmlIsChar(ch: cuint): cbool; XMLCALL; XMLPUBFUN;
+function xmlIsCombining(ch: cuint): cbool; XMLCALL; XMLPUBFUN;
+function xmlIsDigit(ch: cuint): cbool; XMLCALL; XMLPUBFUN;
+function xmlIsExtender(ch: cuint): cbool; XMLCALL; XMLPUBFUN;
+function xmlIsIdeographic(ch: cuint): cbool; XMLCALL; XMLPUBFUN;
+function xmlIsPubidChar(ch: cuint): cbool; XMLCALL; XMLPUBFUN;
+{$ENDIF}

+ 0 - 1
packages/libxml/src/hash.inc

@@ -18,7 +18,6 @@
  *)
   xmlHashTable = record end;
 
-
 (*
  * Recent version of gcc produce a warning when a function pointer is assigned
  * to an object pointer, or vice versa.  The following macro is a dirty hack

+ 179 - 8
packages/libxml/src/libxml2.pas

@@ -37,14 +37,12 @@ type
   va_list = pointer;
   size_t = {$IF Sizeof(pointer) = 8}qword{$ELSE}longword{$IFEND};
 
-
-  xmlNodeSetPtr = ^xmlNodeSet;
-  xmlNodeSet = record end;
-
 (*
   include pointers (forwarding)
 *)
 {$DEFINE POINTER}
+  {$i catalog.inc}
+  {$i chvalid.inc}
   {$i dict.inc}
   {$i encoding.inc}
   {$i tree.inc}
@@ -57,10 +55,13 @@ type
   {$i schemasInternals.inc}
   {$i valid.inc}
   {$i parser.inc}
+  {$i schematron.inc}
   {$i threads.inc}
   {$i uri.inc}
   {$i relaxng.inc}
   {$i globals.inc}
+  {$i nanoftp.inc}
+  {$i nanohttp.inc}
   {$i xmlautomata.inc}
   {$i xmlIO.inc}
   {$i xmlmodule.inc}
@@ -72,14 +73,19 @@ type
   {$i xmlstring.inc}
   {$i xmlunicode.inc}
   {$i xmlwriter.inc}
-  {.$i xpath.inc}
   {$i c14n.inc}
+  {$i xpath.inc}
+  {$i xlink.inc}
+  {$i xinclude.inc}
+  {$i xpointer.inc}
 {$UNDEF POINTER}
 
 (*
   include types
 *)
 {$DEFINE TYPE}
+  {$i catalog.inc}
+  {$i chvalid.inc}
   {$i dict.inc}
   {$i encoding.inc}
   {$i tree.inc}
@@ -92,10 +98,13 @@ type
   {$i schemasInternals.inc}
   {$i valid.inc}
   {$i parser.inc}
+  {$i schematron.inc}
   {$i threads.inc}
   {$i uri.inc}
   {$i relaxng.inc}
   {$i globals.inc}
+  {$i nanoftp.inc}
+  {$i nanohttp.inc}
   {$i xmlautomata.inc}
   {$i xmlIO.inc}
   {$i xmlmodule.inc}
@@ -107,8 +116,11 @@ type
   {$i xmlstring.inc}
   {$i xmlunicode.inc}
   {$i xmlwriter.inc}
-  {.$i xpath.inc}
   {$i c14n.inc}
+  {$i xpath.inc}
+  {$i xlink.inc}
+  {$i xinclude.inc}
+  {$i xpointer.inc}
 {$UNDEF TYPE}
 
 (*
@@ -116,6 +128,8 @@ type
 *)
 {$DEFINE CONST}
 const
+  {$i catalog.inc}
+  {$i chvalid.inc}
   {$i dict.inc}
   {$i encoding.inc}
   {$i tree.inc}
@@ -128,10 +142,13 @@ const
   {$i hash.inc}
   {$i valid.inc}
   {$i parser.inc}
+  {$i schematron.inc}
   {$i threads.inc}
   {$i uri.inc}
   {$i relaxng.inc}
   {$i globals.inc}
+  {$i nanoftp.inc}
+  {$i nanohttp.inc}
   {$i xmlautomata.inc}
   {$i xmlIO.inc}
   {$i xmlmodule.inc}
@@ -143,14 +160,19 @@ const
   {$i xmlstring.inc}
   {$i xmlunicode.inc}
   {$i xmlwriter.inc}
-  {.$i xpath.inc}
   {$i c14n.inc}
+  {$i xpath.inc}
+  {$i xlink.inc}
+  {$i xinclude.inc}
+  {$i xpointer.inc}
 {$UNDEF CONST}
 
 (*
   include functions
 *)
 {$DEFINE FUNCTION}
+  {$i catalog.inc}
+  {$i chvalid.inc}
   {$i dict.inc}
   {$i encoding.inc}
   {$i tree.inc}
@@ -163,10 +185,13 @@ const
   {$i hash.inc}
   {$i valid.inc}
   {$i parser.inc}
+  {$i schematron.inc}
   {$i threads.inc}
   {$i uri.inc}
   {$i relaxng.inc}
   {$i globals.inc}
+  {$i nanoftp.inc}
+  {$i nanohttp.inc}
   {$i xmlautomata.inc}
   {$i xmlIO.inc}
   {$i xmlmodule.inc}
@@ -178,8 +203,11 @@ const
   {$i xmlstring.inc}
   {$i xmlunicode.inc}
   {$i xmlwriter.inc}
-  {.$i xpath.inc}
   {$i c14n.inc}
+  {$i xpath.inc}
+  {$i xlink.inc}
+  {$i xinclude.inc}
+  {$i xpointer.inc}
 {$UNDEF FUNCTION}
 
 implementation
@@ -211,6 +239,149 @@ begin
 end;
 
 
+(*
+ * macros from chvalid.inc
+ *)
+
+function xmlIsBaseChar_ch(c: cint): cbool;
+begin
+  Result :=
+    ((c >= $41) and (c <= $5A)) or
+    ((c >= $61) and (c <= $7A)) or
+    ((c >= $C0) and (c <= $D6)) or
+    ((c >= $D8) and (c <= $F6)) or
+     (c >= $F8);
+end;
+
+function xmlIsBaseCharQ(c: cint): cbool;
+begin
+  if c < $100 then
+    Result := xmlIsBaseChar_ch(c)
+  else
+    Result := xmlCharInRange(c, @xmlIsBaseCharGroup);
+end;
+
+function xmlIsBlank_ch(c: cint): cbool;
+begin
+  Result := (c = $20) or ((c >= $9) and (c <= $A)) or (c = $D);
+end;
+
+function xmlIsBlankQ(c: cint): cbool;
+begin
+  if c < $100 then
+    Result := xmlIsBaseChar_ch(c)
+  else
+    Result := false;
+end;
+
+function xmlIsChar_ch(c: cint): cbool;
+begin
+  Result := ((c >= $9) and (c <= $A)) or (c = $D) or (c >= $20);
+end;
+
+function xmlIsCharQ(c: cint): cbool;
+begin
+  if c < $100 then
+    Result := xmlIsChar_ch(c)
+  else
+    Result :=
+          ((c >= $000100) and (c <= $00D7FF)) or
+          ((c >= $00E000) and (c <= $00FFFD)) or
+          ((c >= $010000) and (c <= $10FFFF));
+end;
+
+function xmlIsCombiningQ(c: cint): cbool;
+begin
+    if c < $100 then
+    Result := false
+  else
+    Result := xmlCharInRange(c, @xmlIsCombiningGroup);
+end;
+
+function xmlIsDigit_ch(c: cint): cbool;
+begin
+  Result := (c >= $30) and (c <= $39);
+end;
+
+function xmlIsDigitQ(c: cint): cbool;
+begin
+  if c < $100 then
+    Result := xmlIsDigit_ch(c)
+  else
+    Result := xmlCharInRange(c, @xmlIsDigitGroup);
+end;
+
+function xmlIsExtender_ch(c: cint): cbool;
+begin
+  Result := c = $B7;
+end;
+
+function xmlIsExtenderQ(c: cint): cbool;
+begin
+  if c < $100 then
+    Result := xmlIsExtender_ch(c)
+  else
+    Result := xmlCharInRange(c, @xmlIsExtenderGroup);
+end;
+
+function xmlIsIdeographicQ(c: cint): cbool;
+begin
+  if c < $100 then
+    Result := false
+  else
+    Result :=
+      ((c >= $4E00) and (c <= $9FA5)) or
+       (c  = $3007) or
+      ((c >= $3021) and (c <= $3029));
+end;
+
+function xmlIsPubidChar_ch(c: cint): cbool;
+begin
+  if (c >= 0) and (c <= 255) then
+    Result := xmlIsPubidChar_tab[c]
+  else
+    Result := false;
+end;
+
+function xmlIsPubidCharQ(c: cint): cbool;
+begin
+  if c < $100 then
+    Result := xmlIsPubidChar_ch(c)
+  else
+    Result := false;
+end;
+
+
+(*
+ * macros from globals.inc
+ *)
+
+
+(*
+ * macros from xpath.inc
+ *)
+
+function xmlXPathNodeSetGetLength(ns: xmlNodeSetPtr): cint;
+begin
+  if assigned(ns) then
+    Result := ns^.nodeNr
+  else
+    Result := 0;
+end;
+
+function xmlXPathNodeSetItem(ns: xmlNodeSetPtr; index: cint): xmlNodePtr;
+begin
+  if assigned(ns) and (index >= 0) and (index < ns^.nodeNr) then
+    Result := ns^.nodeTab[index]
+  else
+    Result := nil;
+end;
+
+function xmlXPathNodeSetIsEmpty(ns: xmlNodeSetPtr): boolean;
+begin
+  Result := not assigned(ns) or (ns^.nodeNr = 0) or (ns^.nodeTab = nil);
+end;
+
 initialization
 (*
  * this initialize the library and check potential ABI mismatches

+ 32 - 86
packages/libxml/src/nanoftp.inc

@@ -7,18 +7,10 @@
  *
  * Author: Daniel Veillard
  *)
- 
-#ifndef __NANO_FTP_H__
-#define __NANO_FTP_H__
 
-#include <libxml/xmlversion.h>
-
-{ LIBXML_FTP_ENABLED
-
-{ __cplusplus
-extern "C" {
-#endif
+{$IFDEF LIBXML_FTP_ENABLED}
 
+{$IFDEF TYPE}
 (**
  * ftpListCallback: 
  * @userData:  user provided data for the callback
@@ -37,12 +29,8 @@ extern "C" {
  * A callback for the xmlNanoFTPList command.
  * Note that only one of year and day:minute are specified.
  *)
-typedef void (*ftpListCallback) (void *userData,
-	                         char *filename, char *attrib,
-	                         char *owner, char *group,
-				 unsigned long size, int links, int year,
-				 char *month, int day, int hour,
-				 int minute);
+  ftpListCallback = procedure(userData: pointer; filename, attrib, owner, group: pchar; size: culong; links, year: cint; month: pchar; day, hour, minute: cint); XMLCALL;
+
 (**
  * ftpDataCallback: 
  * @userData: the user provided context
@@ -51,93 +39,51 @@ typedef void (*ftpListCallback) (void *userData,
  *
  * A callback for the xmlNanoFTPGet command.
  *)
-typedef void (*ftpDataCallback) (void *userData,
-				 char *data,
-				 int len);
+  ftpDataCallback = procedure(userData: pointer; data: pchar; len: cint); XMLCALL;
+{$ENDIF}
 
+{$IFDEF FUNCTION}
 (*
  * Init
  *)
-XMLPUBFUN void XMLCALL
-	xmlNanoFTPInit		(void);
-XMLPUBFUN void XMLCALL	
-	xmlNanoFTPCleanup	(void);
+procedure xmlNanoFTPInit; XMLCALL; XMLPUBFUN;
+procedure xmlNanoFTPCleanup; XMLCALL; XMLPUBFUN;
 
 (*
  * Creating/freeing contexts.
  *)
-XMLPUBFUN void * XMLCALL	
-	xmlNanoFTPNewCtxt	(char *URL);
-XMLPUBFUN void XMLCALL	
-	xmlNanoFTPFreeCtxt	(void * ctx);
-XMLPUBFUN void * XMLCALL 	
-	xmlNanoFTPConnectTo	(char *server,
-				 int port);
+function xmlNanoFTPNewCtxt(URL: pchar): pointer; XMLCALL; XMLPUBFUN;
+procedure xmlNanoFTPFreeCtxt(ctx: pointer); XMLCALL; XMLPUBFUN;
+function xmlNanoFTPConnectTo(server: pchar; port: cint): pointer; XMLCALL; XMLPUBFUN;
+
 (*
  * Opening/closing session connections.
  *)
-XMLPUBFUN void * XMLCALL 	
-	xmlNanoFTPOpen		(char *URL);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPConnect	(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPClose		(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPQuit		(void *ctx);
-XMLPUBFUN void XMLCALL	
-	xmlNanoFTPScanProxy	(char *URL);
-XMLPUBFUN void XMLCALL	
-	xmlNanoFTPProxy		(char *host,
-				 int port,
-				 char *user,
-				 char *passwd,
-				 int type);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPUpdateURL	(void *ctx,
-				 char *URL);
+function xmlNanoFTPOpen(URL: pchar): pointer; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPConnect(ctx: pointer): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPClose(ctx: pointer): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPQuit(ctx: pointer): cint; XMLCALL; XMLPUBFUN;
+procedure xmlNanoFTPScanProxy(URL: pchar); XMLCALL; XMLPUBFUN;
+procedure xmlNanoFTPProxy(host: pchar; port: cint; user, passwd: pchar; _type: cint); XMLCALL; XMLPUBFUN;
+function xmlNanoFTPUpdateURL(ctx: pointer; URL: pchar): cint; XMLCALL; XMLPUBFUN;
 
 (*
  * Rather internal commands.
  *)
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPGetResponse	(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPCheckResponse	(void *ctx);
+function xmlNanoFTPGetResponse(ctx: pointer): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPCheckResponse(ctx: pointer): cint; XMLCALL; XMLPUBFUN;
 
 (*
  * CD/DIR/GET handlers.
  *)
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPCwd		(void *ctx,
-				 char *directory);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPDele		(void *ctx,
-				 char *file);
-
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPGetConnection	(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPCloseConnection(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPList		(void *ctx,
-				 ftpListCallback callback,
-				 void *userData,
-				 char *filename);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPGetSocket	(void *ctx,
-				 char *filename);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPGet		(void *ctx,
-				 ftpDataCallback callback,
-				 void *userData,
-				 char *filename);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPRead		(void *ctx,
-				 void *dest,
-				 int len);
+function xmlNanoFTPCwd(ctx: pointer; directory: pchar): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPGetResponse(ctx: pointer; _file: pchar): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPGetConnection(ctx: pointer): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPCloseConnection(ctx: pointer): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPList(ctx: pointer; callback: ftpListCallback; userData: pointer; filename: pchar): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPGetSocket(ctx: pointer; filename: pchar): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPGet(ctx: pointer; callback: ftpDataCallback; userData: pointer; filename: pchar): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoFTPRead(ctx: pointer; dest: pointer; len: cint): cint; XMLCALL; XMLPUBFUN;
 
-{ __cplusplus
-}
-#endif
-#endif (* LIBXML_FTP_ENABLED *)
-#endif (* __NANO_FTP_H__ *)
+{$ENDIF}
+{$ENDIF} (* LIBXML_FTP_ENABLED *)

+ 23 - 69
packages/libxml/src/nanohttp.inc

@@ -8,74 +8,28 @@
  * Author: Daniel Veillard
  *)
  
-#ifndef __NANO_HTTP_H__
-#define __NANO_HTTP_H__
+{$IFDEF LIBXML_HTTP_ENABLED}
 
-#include <libxml/xmlversion.h>
+{$IFDEF FUNCTION}
+procedure xmlNanoHTTPInit; XMLCALL; XMLPUBFUN;
+procedure xmlNanoHTTPCleanup; XMLCALL; XMLPUBFUN;
+procedure xmlNanoHTTPScanProxy(URL: pchar); XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPCleanup(URL, filename: pchar; contentType: ppchar): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPMethod(URL, method, input: pchar; contentType: ppchar; headers: pchar; ilen: cint): pointer; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPMethodRedir(URL, method, input: pchar; contentType, redir: ppchar; headers: pchar; ilen: cint): pointer; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPOpen(URL: pchar; contentType: ppchar): pointer; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPOpenRedir(URL: pchar; contentType, redir: ppchar): pointer; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPReturnCode(ctx: pointer): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPAuthHeader(ctx: pointer): pchar; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPRedir(ctx: pointer): pchar; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPContentLength(ctx: pointer): cint; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPEncoding(ctx: pointer): pchar; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPMimeType(ctx: pointer): pchar; XMLCALL; XMLPUBFUN;
+function xmlNanoHTTPRead(ctx: pointer; dest: pointer; len: cint): cint; XMLCALL; XMLPUBFUN;
+{$IFDEF LIBXML_OUTPUT_ENABLED}
+function xmlNanoHTTPSave(ctx: pointer; filename: pchar): cint; XMLCALL; XMLPUBFUN;
+{$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
+procedure xmlNanoHTTPClose(ctx: pointer); XMLCALL; XMLPUBFUN;
+{$ENDIF}
 
-{ LIBXML_HTTP_ENABLED
-
-{ __cplusplus
-extern "C" {
-#endif
-XMLPUBFUN void XMLCALL
-	xmlNanoHTTPInit		(void);
-XMLPUBFUN void XMLCALL	
-	xmlNanoHTTPCleanup	(void);
-XMLPUBFUN void XMLCALL	
-	xmlNanoHTTPScanProxy	(char *URL);
-XMLPUBFUN int XMLCALL	
-	xmlNanoHTTPFetch	(char *URL,
-				 char *filename,
-				 char **contentType);
-XMLPUBFUN void * XMLCALL	
-	xmlNanoHTTPMethod	(char *URL,
-				 char *method,
-				 char *input,
-				 char **contentType,
-				 char *headers,
-				 int   ilen);
-XMLPUBFUN void * XMLCALL	
-	xmlNanoHTTPMethodRedir	(char *URL,
-				 char *method,
-				 char *input,
-				 char **contentType,
-				 char **redir,
-				 char *headers,
-				 int   ilen);
-XMLPUBFUN void * XMLCALL	
-	xmlNanoHTTPOpen		(char *URL,
-				 char **contentType);
-XMLPUBFUN void * XMLCALL	
-	xmlNanoHTTPOpenRedir	(char *URL,
-				 char **contentType,
-				 char **redir);
-XMLPUBFUN int XMLCALL	
-	xmlNanoHTTPReturnCode	(void *ctx);
-XMLPUBFUN char * XMLCALL 
-	xmlNanoHTTPAuthHeader	(void *ctx);
-XMLPUBFUN char * XMLCALL
-	xmlNanoHTTPRedir	(void *ctx);
-XMLPUBFUN int XMLCALL
-	xmlNanoHTTPContentLength( void * ctx );
-XMLPUBFUN char * XMLCALL
-	xmlNanoHTTPEncoding	(void *ctx);
-XMLPUBFUN char * XMLCALL
-	xmlNanoHTTPMimeType	(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoHTTPRead		(void *ctx,
-				 void *dest,
-				 int len);
-{ LIBXML_OUTPUT_ENABLED
-XMLPUBFUN int XMLCALL	
-	xmlNanoHTTPSave		(void *ctxt,
-				 char *filename);
-#endif (* LIBXML_OUTPUT_ENABLED *)
-XMLPUBFUN void XMLCALL	
-	xmlNanoHTTPClose	(void *ctx);
-{ __cplusplus
-}
-#endif
-
-#endif (* LIBXML_HTTP_ENABLED *)
-#endif (* __NANO_HTTP_H__ *)
+{$ENDIF} (* LIBXML_HTTP_ENABLED *)

+ 37 - 61
packages/libxml/src/schematron.inc

@@ -7,60 +7,51 @@
  * Author: Daniel Veillard
  *)
 
+{$IFDEF LIBXML_SCHEMATRON_ENABLED}
 
-#ifndef __XML_SCHEMATRON_H__
-#define __XML_SCHEMATRON_H__
+{$IFDEF CONST}
+  XML_SCHEMATRON_OUT_QUIET = 1 shl 0;	(* quiet no report *)
+  XML_SCHEMATRON_OUT_TEXT = 1 shl 1;	(* build a textual report *)
+  XML_SCHEMATRON_OUT_XML = 1 shl 2;	(* output SVRL *)
+  XML_SCHEMATRON_OUT_ERROR = 1 shl 3;  (* output via xmlStructuredErrorFunc *)
+  XML_SCHEMATRON_OUT_FILE = 1 shl 8;	(* output to a file descriptor *)
+  XML_SCHEMATRON_OUT_BUFFER = 1 shl 9;	(* output to a buffer *)
+  XML_SCHEMATRON_OUT_IO = 1 shl 10;	(* output to I/O mechanism *)
+{$ENDIF}
 
-#include <libxml/xmlversion.h>
+{$IFDEF POINTER}
+  xmlSchematronPtr = ^xmlSchematron;
+  xmlSchematronParserCtxtPtr = ^xmlSchematronParserCtxt;
+  xmlSchematronValidCtxtPtr = ^xmlSchematronValidCtxt;
+{$ENDIF}
 
-{ LIBXML_SCHEMATRON_ENABLED
-
-#include <libxml/tree.h>
-
-{ __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    XML_SCHEMATRON_OUT_QUIET = 1 << 0,	(* quiet no report *)
-    XML_SCHEMATRON_OUT_TEXT = 1 << 1,	(* build a textual report *)
-    XML_SCHEMATRON_OUT_XML = 1 << 2,	(* output SVRL *)
-    XML_SCHEMATRON_OUT_ERROR = 1 << 3,  (* output via xmlStructuredErrorFunc *)
-    XML_SCHEMATRON_OUT_FILE = 1 << 8,	(* output to a file descriptor *)
-    XML_SCHEMATRON_OUT_BUFFER = 1 << 9,	(* output to a buffer *)
-    XML_SCHEMATRON_OUT_IO = 1 << 10	(* output to I/O mechanism *)
-} xmlSchematronValidOptions;
+{$IFDEF TYPE}
+  xmlSchematronValidOptions = type cint;
 
 (**
  * The schemas related types are kept internal
  *)
-typedef struct _xmlSchematron xmlSchematron;
-typedef xmlSchematron *xmlSchematronPtr;
+  xmlSchematron = record end;
 
 (**
  * A schemas validation context
  *)
-typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, char *msg, ...);
-typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, char *msg, ...);
+  xmlSchematronValidityErrorFunc = procedure(ctx: pointer; msg: pchar; args: array of const); XMLCDECL;
+  xmlSchematronValidityWarningFunc = procedure(ctx: pointer; msg: pchar; args: array of const); XMLCDECL;
 
-typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
-typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
+  xmlSchematronParserCtxt = record end;
 
-typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
-typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
+  xmlSchematronValidCtxt = record end;
+{$ENDIF}
 
+{$IFDEF FUNCTION}
 (*
  * Interfaces for parsing.
  *)
-XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL 
-	    xmlSchematronNewParserCtxt	(char *URL);
-XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL 
-	    xmlSchematronNewMemParserCtxt(char *buffer,
-					 int size);
-XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
-	    xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
-XMLPUBFUN void XMLCALL		
-	    xmlSchematronFreeParserCtxt	(xmlSchematronParserCtxtPtr ctxt);
+function xmlSchematronNewParserCtxt(URL: pchar): xmlSchematronParserCtxtPtr; XMLCALL; XMLPUBFUN;
+function xmlSchematronNewMemParserCtxt(buffer: pchar; size: cint): xmlSchematronParserCtxtPtr; XMLCALL; XMLPUBFUN;
+function xmlSchematronNewDocParserCtxt(doc: xmlDocPtr): xmlSchematronParserCtxtPtr; XMLCALL; XMLPUBFUN;
+procedure xmlSchematronFreeParserCtxt(ctxt: xmlSchematronParserCtxtPtr); XMLCALL; XMLPUBFUN;
 (*****
 XMLPUBFUN void XMLCALL		
 	    xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
@@ -75,18 +66,13 @@ XMLPUBFUN int XMLCALL
 XMLPUBFUN int XMLCALL
 		xmlSchematronIsValid	(xmlSchematronValidCtxtPtr ctxt);
  *****)
-XMLPUBFUN xmlSchematronPtr XMLCALL	
-	    xmlSchematronParse		(xmlSchematronParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL		
-	    xmlSchematronFree		(xmlSchematronPtr schema);
+function xmlSchematronParse(ctxt: xmlSchematronParserCtxtPtr): xmlSchematronPtr; XMLCALL; XMLPUBFUN;
+procedure xmlSchematronFree(schema: xmlSchematronPtr); XMLCALL; XMLPUBFUN;
+
 (*
  * Interfaces for validating
  *)
-XMLPUBFUN void XMLCALL
-	    xmlSchematronSetValidStructuredErrors(
-	                                  xmlSchematronValidCtxtPtr ctxt,
-					  xmlStructuredErrorFunc serror,
-					  void *ctx);
+procedure xmlSchematronSetValidStructuredErrors(ctxt: xmlSchematronValidCtxtPtr; serror: xmlStructuredErrorFunc; ctx: pointer); XMLCALL; XMLPUBFUN;
 (******
 XMLPUBFUN void XMLCALL		
 	    xmlSchematronSetValidErrors	(xmlSchematronValidCtxtPtr ctxt,
@@ -107,19 +93,9 @@ XMLPUBFUN int XMLCALL
             xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
 			                 xmlNodePtr elem);
  *******)
+function xmlSchematronNewValidCtxt(schema: xmlSchematronPtr; options: cint): xmlSchematronValidCtxtPtr; XMLCALL; XMLPUBFUN;
+procedure xmlSchematronFreeValidCtxt(ctxt: xmlSchematronValidCtxtPtr); XMLCALL; XMLPUBFUN;
+function xmlSchematronValidateDoc(ctxt: xmlSchematronValidCtxtPtr; instance: xmlDocPtr): cint; XMLCALL; XMLPUBFUN;
 
-XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL	
-	    xmlSchematronNewValidCtxt	(xmlSchematronPtr schema,
-	    				 int options);
-XMLPUBFUN void XMLCALL			
-	    xmlSchematronFreeValidCtxt	(xmlSchematronValidCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			
-	    xmlSchematronValidateDoc	(xmlSchematronValidCtxtPtr ctxt,
-					 xmlDocPtr instance);
-
-{ __cplusplus
-}
-#endif
-
-#endif (* LIBXML_SCHEMATRON_ENABLED *)
-#endif (* __XML_SCHEMATRON_H__ *)
+{$ENDIF}
+{$ENDIF} (* LIBXML_SCHEMATRON_ENABLED *)

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

@@ -17,6 +17,7 @@
   xmlElementContentPtr = ^xmlElementContent;
   xmlElementPtr = ^xmlElement;
   xmlNsPtr = ^xmlNs;
+  xmlNsPtrPtr = ^xmlNsPtr;
   xmlNodePtr = ^xmlNode;
   xmlNodePtrPtr = ^xmlNodePtr;
   xmlDtdPtr = ^xmlDtd;
@@ -55,14 +56,14 @@
  * This is the namespace for the special xml: prefix predefined in the
  * XML Namespace specification.
  *)
-  //XML_XML_NAMESPACE: xmlCharPtr = pchar('http://www.w3.org/XML/1998/namespace');
+  XML_XML_NAMESPACE: xmlCharPtr = 'http://www.w3.org/XML/1998/namespace';
 
 (**
  * XML_XML_ID:
  *
  * This is the name for the special xml:id attribute
  *)
-  //XML_XML_ID: xmlCharPtr = pchar('xml:id');
+  XML_XML_ID: xmlCharPtr = 'xml:id';
 {$ENDIF}
 
 {$IFDEF TYPE}

+ 33 - 53
packages/libxml/src/xinclude.inc

@@ -10,116 +10,96 @@
  * Author: Daniel Veillard
  *)
 
-#ifndef __XML_XINCLUDE_H__
-#define __XML_XINCLUDE_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-{ LIBXML_XINCLUDE_ENABLED
-
-{ __cplusplus
-extern "C" {
-#endif
+{$IFDEF LIBXML_XINCLUDE_ENABLED}
 
+{$IFDEF CONST}
 (**
  * XINCLUDE_NS:
  *
  * Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
  *)
-#define XINCLUDE_NS (xmlChar *) "http://www.w3.org/2003/XInclude"
+  XINCLUDE_NS: xmlCharPtr = 'http://www.w3.org/2003/XInclude';
 (**
  * XINCLUDE_OLD_NS:
  *
  * Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
  *)
-#define XINCLUDE_OLD_NS (xmlChar *) "http://www.w3.org/2001/XInclude"
+  XINCLUDE_OLD_NS: xmlCharPtr = 'http://www.w3.org/2001/XInclude';
 (**
  * XINCLUDE_NODE:
  *
  * Macro defining "include"
  *)
-#define XINCLUDE_NODE (xmlChar *) "include"
+  XINCLUDE_NODE: xmlCharPtr = 'include';
 (**
  * XINCLUDE_FALLBACK:
  *
  * Macro defining "fallback"
  *)
-#define XINCLUDE_FALLBACK (xmlChar *) "fallback"
+  XINCLUDE_FALLBACK: xmlCharPtr = 'fallback';
 (**
  * XINCLUDE_HREF:
  *
  * Macro defining "href"
  *)
-#define XINCLUDE_HREF (xmlChar *) "href"
+  XINCLUDE_HREF: xmlCharPtr = 'href';
 (**
  * XINCLUDE_PARSE:
  *
  * Macro defining "parse"
  *)
-#define XINCLUDE_PARSE (xmlChar *) "parse"
+  XINCLUDE_PARSE: xmlCharPtr = 'parse';
 (**
  * XINCLUDE_PARSE_XML:
  *
  * Macro defining "xml"
  *)
-#define XINCLUDE_PARSE_XML (xmlChar *) "xml"
+  XINCLUDE_PARSE_XML: xmlCharPtr = 'xml';
 (**
  * XINCLUDE_PARSE_TEXT:
  *
  * Macro defining "text"
  *)
-#define XINCLUDE_PARSE_TEXT (xmlChar *) "text"
+  XINCLUDE_PARSE_TEXT: xmlCharPtr = 'text';
 (**
  * XINCLUDE_PARSE_ENCODING:
  *
  * Macro defining "encoding"
  *)
-#define XINCLUDE_PARSE_ENCODING (xmlChar *) "encoding"
+  XINCLUDE_PARSE_ENCODING: xmlCharPtr = 'encoding';
 (**
  * XINCLUDE_PARSE_XPOINTER:
  *
  * Macro defining "xpointer"
  *)
-#define XINCLUDE_PARSE_XPOINTER (xmlChar *) "xpointer"
+  XINCLUDE_PARSE_XPOINTER: xmlCharPtr = 'xpointer';
+{$ENDIF}
 
-typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
-typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
+{$IFDEF POINTER}
+  xmlXIncludeCtxtPtr = ^xmlXIncludeCtxt;
+{$ENDIF}
 
+{$IFDEF TYPE}
+  xmlXIncludeCtxt = record end;
+{$ENDIF}
+
+{$IFDEF FUNCTION}
 (*
  * standalone processing
  *)
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcess	(xmlDocPtr doc);
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcessFlags	(xmlDocPtr doc,
-					 int flags);
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcessFlagsData(xmlDocPtr doc,
-					 int flags,
-					 void *data);
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcessTree	(xmlNodePtr tree);
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
-					 int flags);
+function xmlXIncludeProcess(doc: xmlDocPtr): cint; XMLCALL; XMLPUBFUN;
+function xmlXIncludeProcessFlags(doc: xmlDocPtr; flags: cint): cint; XMLCALL; XMLPUBFUN;
+function xmlXIncludeProcessFlagsData(doc: xmlDocPtr; flags: cint; data: pointer): cint; XMLCALL; XMLPUBFUN;
+function xmlXIncludeProcessTree(tree: xmlNodePtr): cint; XMLCALL; XMLPUBFUN;
+function xmlXIncludeProcessTreeFlags(tree: xmlNodePtr; flags: cint): cint; XMLCALL; XMLPUBFUN;
+
 (*
  * contextual processing
  *)
-XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL
-		xmlXIncludeNewContext	(xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
-		xmlXIncludeSetFlags	(xmlXIncludeCtxtPtr ctxt,
-					 int flags);
-XMLPUBFUN void XMLCALL
-		xmlXIncludeFreeContext	(xmlXIncludeCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-		xmlXIncludeProcessNode	(xmlXIncludeCtxtPtr ctxt,
-					 xmlNodePtr tree);
-{ __cplusplus
-}
-#endif
-
-#endif (* LIBXML_XINCLUDE_ENABLED *)
+function xmlXIncludeNewContext(doc: xmlDocPtr): xmlXIncludeCtxtPtr; XMLCALL; XMLPUBFUN;
+function xmlXIncludeProcessFlags(ctxt: xmlXIncludeCtxtPtr; flags: cint): cint; XMLCALL; XMLPUBFUN;
+procedure xmlXIncludeProcess(ctxt: xmlXIncludeCtxtPtr); XMLCALL; XMLPUBFUN;
+function xmlXIncludeProcessNode(ctxt: xmlXIncludeCtxtPtr; tree: xmlNodePtr): cint; XMLCALL; XMLPUBFUN;
+{$ENDIF}
 
-#endif (* __XML_XINCLUDE_H__ *)
+{$ENDIF} (* LIBXML_XINCLUDE_ENABLED *)

+ 42 - 77
packages/libxml/src/xlink.inc

@@ -7,18 +7,18 @@
  * Author: Daniel Veillard
  *)
 
-#ifndef __XML_XLINK_H__
-#define __XML_XLINK_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-{ LIBXML_XPTR_ENABLED
-
-{ __cplusplus
-extern "C" {
-#endif
-
+{$IFDEF LIBXML_XPTR_ENABLED}
+
+{$IFDEF POINTER}
+  xlinkHRefPtr = ^xlinkHRef;
+  xlinkRolePtr = ^xlinkRole;
+  xlinkTitlePtr = ^xlinkTitle;
+  xlinkShowPtr = ^xlinkShow;
+  xlinkActuatePtr = ^xlinkActuate;
+  xlinkHandlerPtr = ^xlinkHandler;
+{$ENDIF}
+
+{$IFDEF TYPE}
 (**
  * Various defines for the various Link properties.
  *
@@ -29,29 +29,29 @@ extern "C" {
  * NOTE: the link detection layer will expand URI-Refences found on
  *       href attributes by using the base mechanism if found.
  *)
-typedef xmlChar *xlinkHRef;
-typedef xmlChar *xlinkRole;
-typedef xmlChar *xlinkTitle;
+  xlinkHRef = xmlCharPtr;
+  xlinkRole = xmlCharPtr;
+  xlinkTitle = xmlCharPtr;
 
-typedef enum {
+  xlinkType = (
     XLINK_TYPE_NONE = 0,
     XLINK_TYPE_SIMPLE,
     XLINK_TYPE_EXTENDED,
     XLINK_TYPE_EXTENDED_SET
-} xlinkType;
+  );
 
-typedef enum {
+  xlinkShow = (
     XLINK_SHOW_NONE = 0,
     XLINK_SHOW_NEW,
     XLINK_SHOW_EMBED,
     XLINK_SHOW_REPLACE
-} xlinkShow;
+  );
 
-typedef enum {
+  xlinkActuate = (
     XLINK_ACTUATE_NONE = 0,
     XLINK_ACTUATE_AUTO,
     XLINK_ACTUATE_ONREQUEST
-} xlinkActuate;
+  );
 
 (**
  * xlinkNodeDetectFunc:
@@ -61,7 +61,7 @@ typedef enum {
  * This is the prototype for the link detection routine.
  * It calls the default link detection callbacks upon link detection.
  *)
-typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
+  xlinkNodeDetectFunc = procedure(ctx: pointer; node: xmlNodePtr); XMLCALL;
 
 (*
  * The link detection module interact with the upper layers using
@@ -78,12 +78,7 @@ typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
  *
  * This is the prototype for a simple link detection callback.
  *)
-typedef void
-(*xlinkSimpleLinkFunk)	(void *ctx,
-			 xmlNodePtr node,
-			 xlinkHRef href,
-			 xlinkRole role,
-			 xlinkTitle title);
+  xlinkSimpleLinkFunk = procedure(ctx: pointer; node: xmlNodePtr; href: xlinkHRef; role: xlinkRole; title: xlinkTitle); XMLCALL;
 
 (**
  * xlinkExtendedLinkFunk:
@@ -103,20 +98,8 @@ typedef void
  *
  * This is the prototype for a extended link detection callback.
  *)
-typedef void
-(*xlinkExtendedLinkFunk)(void *ctx,
-			 xmlNodePtr node,
-			 int nbLocators,
-			 xlinkHRef *hrefs,
-			 xlinkRole *roles,
-			 int nbArcs,
-			 xlinkRole *from,
-			 xlinkRole *to,
-			 xlinkShow *show,
-			 xlinkActuate *actuate,
-			 int nbTitles,
-			 xlinkTitle *titles,
-			 xmlChar **langs);
+  xlinkExtendedLinkFunk = procedure(ctx: pointer; node: xmlNodePtr; nbLocators: cint; hrefs: xlinkHRefPtr; roles: xlinkRolePtr;
+    nbArcs: cint; from, _to: xlinkRolePtr; show: xlinkShowPtr; actuate: xlinkActuatePtr; nbTitles: cint; titles: xlinkTitlePtr; langs: xmlCharPtrPtr); XMLCALL;
 
 (**
  * xlinkExtendedLinkSetFunk:
@@ -131,15 +114,8 @@ typedef void
  *
  * This is the prototype for a extended link set detection callback.
  *)
-typedef void
-(*xlinkExtendedLinkSetFunk)	(void *ctx,
-				 xmlNodePtr node,
-				 int nbLocators,
-				 xlinkHRef *hrefs,
-				 xlinkRole *roles,
-				 int nbTitles,
-				 xlinkTitle *titles,
-				 xmlChar **langs);
+  xlinkExtendedLinkSetFunk = procedure(ctx: pointer; node: xmlNodePtr; nbLocators: cint; hrefs: xlinkHRefPtr; roles: xlinkRolePtr;
+    nbTitles: cint; titles: xlinkTitlePtr; langs: xmlCharPtrPtr); XMLCALL;
 
 (**
  * This is the structure containing a set of Links detection callbacks.
@@ -147,43 +123,32 @@ typedef void
  * There is no default xlink callbacks, if one want to get link
  * recognition activated, those call backs must be provided before parsing.
  *)
-typedef struct _xlinkHandler xlinkHandler;
-typedef xlinkHandler *xlinkHandlerPtr;
-struct _xlinkHandler {
-    xlinkSimpleLinkFunk simple;
-    xlinkExtendedLinkFunk extended;
-    xlinkExtendedLinkSetFunk set;
-};
-
+  xlinkHandler = record
+    simple    : xlinkSimpleLinkFunk;
+    extended  : xlinkExtendedLinkFunk;
+    _set      : xlinkExtendedLinkSetFunk;
+  end;
+{$ENDIF}
+
+{$IFDEF FUNCTION}
 (*
  * The default detection routine, can be overridden, they call the default
  * detection callbacks. 
  *)
-
-XMLPUBFUN xlinkNodeDetectFunc XMLCALL	
-		xlinkGetDefaultDetect	(void);
-XMLPUBFUN void XMLCALL			
-		xlinkSetDefaultDetect	(xlinkNodeDetectFunc func);
+function xlinkGetDefaultDetect: xlinkNodeDetectFunc; XMLCALL; XMLPUBFUN;
+procedure xlinkSetDefaultDetect(func: xlinkNodeDetectFunc); XMLCALL; XMLPUBFUN;
 
 (*
  * Routines to set/get the default handlers.
  *)
-XMLPUBFUN xlinkHandlerPtr XMLCALL	
-		xlinkGetDefaultHandler	(void);
-XMLPUBFUN void XMLCALL		
-		xlinkSetDefaultHandler	(xlinkHandlerPtr handler);
+function xlinkGetDefaultHandler: xlinkHandlerPtr; XMLCALL; XMLPUBFUN;
+procedure xlinkSetDefaultHandler(handler: xlinkHandlerPtr); XMLCALL; XMLPUBFUN;
 
 (*
  * Link detection module itself.
  *)
-XMLPUBFUN xlinkType XMLCALL	 
-		xlinkIsLink		(xmlDocPtr doc,
-					 xmlNodePtr node);
-
-{ __cplusplus
-}
-#endif
+function xlinkIsLink(doc: xmlDocPtr; node: xmlNodePtr): xlinkType; XMLCALL; XMLPUBFUN;
+{$ENDIF}
 
-#endif (* LIBXML_XPTR_ENABLED *)
+{$ENDIF} (* LIBXML_XPTR_ENABLED *)
 
-#endif (* __XML_XLINK_H__ *)

+ 184 - 260
packages/libxml/src/xpath.inc

@@ -16,36 +16,27 @@
  * Author: Daniel Veillard
  *)
 
-#ifndef __XML_XPATH_H__
-#define __XML_XPATH_H__
-
-#include <libxml/xmlversion.h>
-
-{ LIBXML_XPATH_ENABLED
-
-#include <libxml/xmlerror.h>
-#include <libxml/tree.h>
-#include <libxml/hash.h>
-#endif (* LIBXML_XPATH_ENABLED *)
-
-#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-{ __cplusplus
-extern "C" {
-#endif
-#endif (* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED *)
-	
-{ LIBXML_XPATH_ENABLED
-
-typedef struct _xmlXPathContext xmlXPathContext;
-typedef xmlXPathContext *xmlXPathContextPtr;
-typedef struct _xmlXPathParserContext xmlXPathParserContext;
-typedef xmlXPathParserContext *xmlXPathParserContextPtr;
-
+{$IFDEF LIBXML_XPATH_ENABLED}
+
+{$IFDEF POINTER}
+  xmlXPathContextPtr = ^xmlXPathContext;
+  xmlXPathParserContextPtr = ^xmlXPathParserContext;
+  xmlNodeSetPtr = ^xmlNodeSet;
+  xmlXPathObjectPtr = ^xmlXPathObject;
+  xmlXPathObjectPtrPtr = ^xmlXPathObjectPtr;
+  xmlXPathTypePtr = ^xmlXPathType;
+  xmlXPathVariablePtr = ^xmlXPathVariable;
+  xmlXPathFuncPtr = ^xmlXPathFunc;
+  xmlXPathAxisPtr = ^xmlXPathAxis;
+  xmlXPathCompExprPtr = ^xmlXPathCompExpr;
+{$ENDIF}
+
+{$IFDEF TYPE}
 (**
  * The set of XPath error codes.
  *)
 
-typedef enum {
+  xmlXPathError = (
     XPATH_EXPRESSION_OK = 0,
     XPATH_NUMBER_ERROR,
     XPATH_UNFINISHED_LITERAL_ERROR,
@@ -69,19 +60,17 @@ typedef enum {
     XPATH_ENCODING_ERROR,
     XPATH_INVALID_CHAR_ERROR,
     XPATH_INVALID_CTXT
-} xmlXPathError;
+  );
 
 (*
  * A node-set (an unordered collection of nodes without duplicates).
  *)
-typedef struct _xmlNodeSet xmlNodeSet;
-typedef xmlNodeSet *xmlNodeSetPtr;
-struct _xmlNodeSet {
-    int nodeNr;			(* number of nodes in the set *)
-    int nodeMax;		(* size of the array as allocated *)
-    xmlNodePtr *nodeTab;	(* array of nodes in no particular order *)
+  xmlNodeSet = record
+    nodeNr  : cint;			(* number of nodes in the set *)
+    nodeMax : cint;		(* size of the array as allocated *)
+    nodeTab : xmlNodePtrPtr;	(* array of nodes in no particular order *)
     (* @@ with_ns to check wether namespace nodes should be looked at @@ *)
-};
+  end;
 
 (*
  * An expression is evaluated to yield an object, which
@@ -94,7 +83,7 @@ struct _xmlNodeSet {
  * @@ XPointer will add more types !
  *)
 
-typedef enum {
+  xmlXPathObjectType = (
     XPATH_UNDEFINED = 0,
     XPATH_NODESET = 1,
     XPATH_BOOLEAN = 2,
@@ -105,21 +94,19 @@ typedef enum {
     XPATH_LOCATIONSET = 7,
     XPATH_USERS = 8,
     XPATH_XSLT_TREE = 9  (* An XSLT value tree, non modifiable *)
-} xmlXPathObjectType;
-
-typedef struct _xmlXPathObject xmlXPathObject;
-typedef xmlXPathObject *xmlXPathObjectPtr;
-struct _xmlXPathObject {
-    xmlXPathObjectType type;
-    xmlNodeSetPtr nodesetval;
-    int boolval;
-    double floatval;
-    xmlChar *stringval;
-    void *user;
-    int index;
-    void *user2;
-    int index2;
-};
+  );
+
+  xmlXPathObject = record
+    _type       : xmlXPathObjectType;
+    nodesetval  : xmlNodeSetPtr;
+    boolval     : cint;
+    floatval    : cdouble;
+    stringval   : xmlCharPtr;
+    user        : pointer;
+    index       : cint;
+    user2       : pointer;
+    index2      : cint;
+  end;
 
 (**
  * xmlXPathConvertFunc:
@@ -131,29 +118,23 @@ struct _xmlXPathObject {
  *
  * Returns -1 in case of error, 0 otherwise
  *)
-typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
+  xmlXPathConvertFunc = function(obj: xmlXPathObjectPtr; _type: cint): cint; XMLCALL;
 
 (*
  * Extra type: a name and a conversion function.
  *)
-
-typedef struct _xmlXPathType xmlXPathType;
-typedef xmlXPathType *xmlXPathTypePtr;
-struct _xmlXPathType {
-    xmlChar         *name;		(* the type name *)
-    xmlXPathConvertFunc func;		(* the conversion function *)
-};
+  xmlXPathType = record
+    name  : xmlCharPtr;		(* the type name *)
+    func  : xmlXPathConvertFunc;		(* the conversion function *)
+  end;
 
 (*
  * Extra variable: a name and a value.
  *)
-
-typedef struct _xmlXPathVariable xmlXPathVariable;
-typedef xmlXPathVariable *xmlXPathVariablePtr;
-struct _xmlXPathVariable {
-    xmlChar       *name;		(* the variable name *)
-    xmlXPathObjectPtr value;		(* the value *)
-};
+  xmlXPathVariable = record
+    name  : xmlCharPtr;		(* the variable name *)
+    value : xmlXPathObjectPtr;		(* the value *)
+  end;
 
 (**
  * xmlXPathEvalFunc:
@@ -163,19 +144,16 @@ struct _xmlXPathVariable {
  * An XPath evaluation function, the parameters are on the XPath context stack.
  *)
 
-typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
-	                         int nargs);
+  xmlXPathEvalFunc = procedure(ctxt: xmlXPathParserContextPtr; nargs: cint); XMLCALL;
 
 (*
  * Extra function: a name and a evaluation function.
  *)
 
-typedef struct _xmlXPathFunct xmlXPathFunct;
-typedef xmlXPathFunct *xmlXPathFuncPtr;
-struct _xmlXPathFunct {
-    xmlChar      *name;		(* the function name *)
-    xmlXPathEvalFunc func;		(* the evaluation function *)
-};
+  xmlXPathFunc = record
+    name  : xmlCharPtr;		(* the function name *)
+    func  : xmlXPathEvalFunc;		(* the evaluation function *)
+  end;
 
 (**
  * xmlXPathAxisFunc:
@@ -189,19 +167,15 @@ struct _xmlXPathFunct {
  * Returns the next node in that axis or NULL if at the end of the axis.
  *)
 
-typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
-				 xmlXPathObjectPtr cur);
+  xmlXPathAxisFunc = function(ctxt: xmlXPathParserContextPtr; cur: xmlXPathObjectPtr): xmlXPathObjectPtr; XMLCALL;
 
 (*
  * Extra axis: a name and an axis function.
  *)
-
-typedef struct _xmlXPathAxis xmlXPathAxis;
-typedef xmlXPathAxis *xmlXPathAxisPtr;
-struct _xmlXPathAxis {
-    xmlChar      *name;		(* the axis name *)
-    xmlXPathAxisFunc func;		(* the search function *)
-};
+  xmlXPathAxis = record
+    name  : xmlCharPtr;		(* the axis name *)
+    func  : xmlXPathAxisFunc;		(* the search function *)
+  end;
 
 (**
  * xmlXPathFunction:
@@ -212,8 +186,7 @@ struct _xmlXPathAxis {
  * The arguments (if any) are popped out from the context stack
  * and the result is pushed on the stack.
  *)
-
-typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
+  xmlXPathFunction = procedure(ctxt: xmlXPathParserContextPtr; nargs: cint); XMLCALL;
 
 (*
  * Function and Variable Lookup.
@@ -230,9 +203,7 @@ typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
  *
  * Returns the XPath object value or NULL if not found.
  *)
-typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
-                                         xmlChar *name,
-                                         xmlChar *ns_uri);
+  xmlXPathVariableLookupFunc = function(ctxt: pointer; name, ns_uri: xmlCharPtr): xmlXPathObjectPtr; XMLCALL;
 
 (**
  * xmlXPathFuncLookupFunc:
@@ -245,10 +216,10 @@ typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
  *
  * Returns the XPath function or NULL if not found.
  *)
-typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
-					 xmlChar *name,
-					 xmlChar *ns_uri);
+  xmlXPathFuncLookupFunc = function(ctxt: pointer; name, ns_uri: xmlCharPtr): xmlXPathFunction; XMLCALL;
+{$ENDIF}
 
+{$IFDEF CONST}
 (**
  * xmlXPathFlags:
  * Flags for XPath engine compilation and runtime
@@ -258,14 +229,16 @@ typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
  *
  * check namespaces at compilation
  *)
-#define XML_XPATH_CHECKNS (1<<0)
+  XML_XPATH_CHECKNS = (1 shl 0);
 (**
  * XML_XPATH_NOVAR:
  *
  * forbid variables in expression
  *)
-#define XML_XPATH_NOVAR	  (1<<1)
+  XML_XPATH_NOVAR	 = (1 shl 1);
+{$ENDIF}
 
+{$IFDEF TYPE}
 (**
  * xmlXPathContext:
  *
@@ -283,81 +256,79 @@ typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
  * before the next call.
  *)
 
-struct _xmlXPathContext {
-    xmlDocPtr doc;			(* The current document *)
-    xmlNodePtr node;			(* The current node *)
+  xmlXPathContext = record
+    doc                 : xmlDocPtr;			(* The current document *)
+    node                : xmlNodePtr;			(* The current node *)
 
-    int nb_variables_unused;		(* unused (hash table) *)
-    int max_variables_unused;		(* unused (hash table) *)
-    xmlHashTablePtr varHash;		(* Hash table of defined variables *)
+    nb_variables_unused : cint;		(* unused (hash table) *)
+    max_variables_unused: cint;		(* unused (hash table) *)
+    varHash             : xmlHashTablePtr;		(* Hash table of defined variables *)
 
-    int nb_types;			(* number of defined types *)
-    int max_types;			(* max number of types *)
-    xmlXPathTypePtr types;		(* Array of defined types *)
+    nb_types            : cint;			(* number of defined types *)
+    max_types           : cint;			(* max number of types *)
+    types               : xmlXPathTypePtr;		(* Array of defined types *)
 
-    int nb_funcs_unused;		(* unused (hash table) *)
-    int max_funcs_unused;		(* unused (hash table) *)
-    xmlHashTablePtr funcHash;		(* Hash table of defined funcs *)
+    nb_funcs_unused     : cint;		(* unused (hash table) *)
+    max_funcs_unused    : cint;		(* unused (hash table) *)
+    funcHash            : xmlHashTablePtr;		(* Hash table of defined funcs *)
 
-    int nb_axis;			(* number of defined axis *)
-    int max_axis;			(* max number of axis *)
-    xmlXPathAxisPtr axis;		(* Array of defined axis *)
+    nb_axis             : cint;			(* number of defined axis *)
+    max_axis            : cint;			(* max number of axis *)
+    axis                : xmlXPathAxisPtr;		(* Array of defined axis *)
 
     (* the namespace nodes of the context node *)
-    xmlNsPtr *namespaces;		(* Array of namespaces *)
-    int nsNr;				(* number of namespace in scope *)
-    void *user;				(* function to free *)
+    namespaces          : xmlNsPtrPtr;		(* Array of namespaces *)
+    nsNr                : cint;				(* number of namespace in scope *)
+    user                : pointer;				(* function to free *)
 
     (* extra variables *)
-    int contextSize;			(* the context size *)
-    int proximityPosition;		(* the proximity position *)
+    contextSize         : cint;			(* the context size *)
+    proximityPosition   : cint;		(* the proximity position *)
 
     (* extra stuff for XPointer *)
-    int xptr;				(* is this an XPointer context? *)
-    xmlNodePtr here;			(* for here() *)
-    xmlNodePtr origin;			(* for origin() *)
+    xptr                : cint;				(* is this an XPointer context? *)
+    here                : xmlNodePtr;			(* for here() *)
+    origin              : xmlNodePtr;			(* for origin() *)
 
     (* the set of namespace declarations in scope for the expression *)
-    xmlHashTablePtr nsHash;		(* The namespaces hash table *)
-    xmlXPathVariableLookupFunc varLookupFunc;(* variable lookup func *)
-    void *varLookupData;		(* variable lookup data *)
+    nsHash              : xmlHashTablePtr;		(* The namespaces hash table *)
+    varLookupFunc       : xmlXPathVariableLookupFunc;(* variable lookup func *)
+    varLookupData       : pointer;		(* variable lookup data *)
 
     (* Possibility to link in an extra item *)
-    void *extra;                        (* needed for XSLT *)
+    extra               : pointer;                        (* needed for XSLT *)
 
     (* The function name and URI when calling a function *)
-    xmlChar *function;
-    xmlChar *functionURI;
+    _function           : xmlCharPtr;
+    functionURI         : xmlCharPtr;
 
     (* function lookup function and data *)
-    xmlXPathFuncLookupFunc funcLookupFunc;(* function lookup func *)
-    void *funcLookupData;		(* function lookup data *)
+    funcLookupFunc      : xmlXPathFuncLookupFunc;(* function lookup func *)
+    funcLookupData      : pointer;		(* function lookup data *)
 
     (* temporary namespace lists kept for walking the namespace axis *)
-    xmlNsPtr *tmpNsList;		(* Array of namespaces *)
-    int tmpNsNr;			(* number of namespaces in scope *)
+    tmpNsList           : xmlNsPtr;		(* Array of namespaces *)
+    tmpNsNr             : cint;			(* number of namespaces in scope *)
 
     (* error reporting mechanism *)
-    void *userData;                     (* user specific data block *)
-    xmlStructuredErrorFunc error;       (* the callback in case of errors *)
-    xmlError lastError;			(* the last error *)
-    xmlNodePtr debugNode;		(* the source node XSLT *)
+    userData            : pointer;                     (* user specific data block *)
+    error               : xmlStructuredErrorFunc;       (* the callback in case of errors *)
+    lastError           : xmlError;			(* the last error *)
+    debugNode           : xmlNodePtr;		(* the source node XSLT *)
 
     (* dictionary *)
-    xmlDictPtr dict;			(* dictionary if any *)
+    dict                : xmlDictPtr;			(* dictionary if any *)
 
-    int flags;				(* flags to control compilation *)
+    flags               : cint;				(* flags to control compilation *)
 
     (* Cache for reusal of XPath objects *)
-    void *cache;
-};
+    cache               : pointer;
+  end;
 
 (*
  * The structure of a compiled expression form is not public.
  *)
-
-typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
-typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
+  xmlXPathCompExpr = record end;
 
 (**
  * xmlXPathParserContext:
@@ -365,23 +336,25 @@ typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
  * An XPath parser context. It contains pure parsing informations,
  * an xmlXPathContext, and the stack of objects.
  *)
-struct _xmlXPathParserContext {
-    xmlChar *cur;			(* the current char being parsed *)
-    xmlChar *base;			(* the full expression *)
+  xmlXPathParserContext = record
+    cur           : xmlCharPtr;			(* the current char being parsed *)
+    base          : xmlCharPtr;			(* the full expression *)
 
-    int error;				(* error code *)
+    error         : cint;				(* error code *)
 
-    xmlXPathContextPtr  context;	(* the evaluation context *)
-    xmlXPathObjectPtr     value;	(* the current value *)
-    int                 valueNr;	(* number of values stacked *)
-    int                valueMax;	(* max number of values stacked *)
-    xmlXPathObjectPtr *valueTab;	(* stack of values *)
+    context       : xmlXPathContextPtr;	(* the evaluation context *)
+    value         : xmlXPathObjectPtr;	(* the current value *)
+    valueNr       : cint;	(* number of values stacked *)
+    valueMax      : cint;	(* max number of values stacked *)
+    valueTab      : xmlXPathObjectPtrPtr;	(* stack of values *)
 
-    xmlXPathCompExprPtr comp;		(* the precompiled expression *)
-    int xptr;				(* it this an XPointer expression *)
-    xmlNodePtr         ancestor;	(* used for walking preceding axis *)
-};
+    comp          : xmlXPathCompExprPtr;		(* the precompiled expression *)
+    xptr          : cint;				(* it this an XPointer expression *)
+    ancestor      : xmlNodePtr;	(* used for walking preceding axis *)
+  end;
+{$ENDIF}
 
+{$IFDEF FUNCTION}
 (************************************************************************
  *									*
  *			Public API					*
@@ -392,9 +365,10 @@ struct _xmlXPathParserContext {
  * Objects and Nodesets handling
  *)
 
-XMLPUBVAR double xmlXPathNAN;
-XMLPUBVAR double xmlXPathPINF;
-XMLPUBVAR double xmlXPathNINF;
+var
+  xmlXPathNAN: cdouble; XMLPUBVAR;
+  xmlXPathPINF: cdouble; XMLPUBVAR;
+  xmlXPathNINF: cdouble; XMLPUBVAR;
 
 (* These macros may later turn into functions *)
 (**
@@ -405,7 +379,8 @@ XMLPUBVAR double xmlXPathNINF;
  *
  * Returns the number of nodes in the node-set.
  *)
-#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
+function xmlXPathNodeSetGetLength(ns: xmlNodeSetPtr): cint;
+
 (**
  * xmlXPathNodeSetItem:
  * @ns:  a node-set
@@ -416,11 +391,8 @@ XMLPUBVAR double xmlXPathNINF;
  * Returns the xmlNodePtr at the given @index in @ns or NULL if
  *         @index is out of range (0 to length-1)
  *)
-#define xmlXPathNodeSetItem(ns, index)				\
-		((((ns) != NULL) && 				\
-		  ((index) >= 0) && ((index) < (ns)->nodeNr)) ?	\
-		 (ns)->nodeTab[(index)]				\
-		 : NULL)
+function xmlXPathNodeSetItem(ns: xmlNodeSetPtr; index: cint): xmlNodePtr;
+
 (**
  * xmlXPathNodeSetIsEmpty:
  * @ns: a node-set
@@ -429,118 +401,70 @@ XMLPUBVAR double xmlXPathNINF;
  *
  * Returns %TRUE if @ns is an empty node-set.
  *)
-#define xmlXPathNodeSetIsEmpty(ns)                                      \
-    (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
-
-
-XMLPUBFUN void XMLCALL		   
-		    xmlXPathFreeObject		(xmlXPathObjectPtr obj);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	   
-		    xmlXPathNodeSetCreate	(xmlNodePtr val);
-XMLPUBFUN void XMLCALL		   
-		    xmlXPathFreeNodeSetList	(xmlXPathObjectPtr obj);
-XMLPUBFUN void XMLCALL		   
-		    xmlXPathFreeNodeSet		(xmlNodeSetPtr obj);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathObjectCopy		(xmlXPathObjectPtr val);
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCmpNodes		(xmlNodePtr node1,
-						 xmlNodePtr node2);
+function xmlXPathNodeSetIsEmpty(ns: xmlNodeSetPtr): boolean;
+
+
+procedure xmlXPathFreeObject(obj: xmlXPathObjectPtr); XMLCALL; XMLPUBFUN;
+function xmlXPathNodeSetCreate(val: xmlNodePtr): xmlNodeSetPtr; XMLCALL; XMLPUBFUN;
+procedure xmlXPathFreeNodeSetList(obj: xmlXPathObjectPtr); XMLCALL; XMLPUBFUN;
+procedure xmlXPathFreeNodeSet(obj: xmlNodeSetPtr); XMLCALL; XMLPUBFUN;
+function xmlXPathObjectCopy(val: xmlXPathObjectPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathObjectCopy(node1, node2: xmlNodePtr): cint; XMLCALL; XMLPUBFUN;
+
 (**
  * Conversion functions to basic types.
  *)
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCastNumberToBoolean	(double val);
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCastStringToBoolean	(xmlChar * val);
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCastToBoolean	(xmlXPathObjectPtr val);
-
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastBooleanToNumber	(int val);
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastStringToNumber	(xmlChar * val);
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastNodeToNumber	(xmlNodePtr node);
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastNodeSetToNumber	(xmlNodeSetPtr ns);
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastToNumber	(xmlXPathObjectPtr val);
-
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastBooleanToString	(int val);
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastNumberToString	(double val);
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastNodeToString	(xmlNodePtr node);
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastNodeSetToString	(xmlNodeSetPtr ns);
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastToString	(xmlXPathObjectPtr val);
-
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathConvertBoolean	(xmlXPathObjectPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathConvertNumber	(xmlXPathObjectPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathConvertString	(xmlXPathObjectPtr val);
+function xmlXPathCastNumberToBoolean(val: cdouble): cint; XMLCALL; XMLPUBFUN;
+function xmlXPathCastStringToBoolean(val: xmlCharPtr): cint; XMLCALL; XMLPUBFUN;
+function xmlXPathCastNodeSetToBoolean(ns: xmlNodeSetPtr): cint; XMLCALL; XMLPUBFUN;
+function xmlXPathCastToBoolean(ns: xmlXPathObjectPtr): cint; XMLCALL; XMLPUBFUN;
+
+function xmlXPathCastBooleanToNumber(val: cint): cdouble; XMLCALL; XMLPUBFUN;
+function xmlXPathCastStringToNumber(val: xmlCharPtr): cdouble; XMLCALL; XMLPUBFUN;
+function xmlXPathCastNodeToNumber(val: xmlNodePtr): cdouble; XMLCALL; XMLPUBFUN;
+function xmlXPathCastNodeSetToNumber(val: xmlNodeSetPtr): cdouble; XMLCALL; XMLPUBFUN;
+function xmlXPathCastToNumber(val: xmlXPathObjectPtr): cdouble; XMLCALL; XMLPUBFUN;
+
+function xmlXPathCastBooleanToString(val: cint): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathCastNumberToString(val: cdouble): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathCastNodeToString(val: xmlNodePtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathCastNodeSetToString(val: xmlNodeSetPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathCastToString(val: xmlXPathObjectPtr): xmlCharPtr; XMLCALL; XMLPUBFUN;
+
+function xmlXPathConvertBoolean(val: xmlXPathObjectPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathConvertNumber(val: xmlXPathObjectPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathConvertString(val: xmlXPathObjectPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
 
 (**
  * Context handling.
  *)
-XMLPUBFUN xmlXPathContextPtr XMLCALL 
-		    xmlXPathNewContext		(xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
-		    xmlXPathFreeContext		(xmlXPathContextPtr ctxt);
-XMLPUBFUN int XMLCALL
-		    xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
-				            int active,
-					    int value,
-					    int options);
+function xmlXPathNewContext(doc: xmlDocPtr): xmlXPathContextPtr; XMLCALL; XMLPUBFUN;
+procedure xmlXPathFreeContext(ctxt: xmlXPathContextPtr); XMLCALL; XMLPUBFUN;
+function xmlXPathContextSetCache(ctxt: xmlXPathContextPtr; active, value, options: cint): cint; XMLCALL; XMLPUBFUN;
+
 (**
  * Evaluation functions.
  *)
-XMLPUBFUN long XMLCALL               
-		    xmlXPathOrderDocElems	(xmlDocPtr doc);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathEval		(xmlChar *str,
-						 xmlXPathContextPtr ctx);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathEvalExpression	(xmlChar *str,
-						 xmlXPathContextPtr ctxt);
-XMLPUBFUN int XMLCALL                
-		    xmlXPathEvalPredicate	(xmlXPathContextPtr ctxt,
-						 xmlXPathObjectPtr res);
+function xmlXPathOrderDocElems(doc: xmlDocPtr): clong; XMLCALL; XMLPUBFUN;
+function xmlXPathEval(str: xmlCharPtr; ctx: xmlXPathContextPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathEvalExpression(str: xmlCharPtr; ctx: xmlXPathContextPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathEvalPredicate(ctxt: xmlXPathContextPtr; res: xmlXPathObjectPtr): cint; XMLCALL; XMLPUBFUN;
+
 (**
  * Separate compilation/evaluation entry points.
  *)
-XMLPUBFUN xmlXPathCompExprPtr XMLCALL 
-		    xmlXPathCompile		(xmlChar *str);
-XMLPUBFUN xmlXPathCompExprPtr XMLCALL 
-		    xmlXPathCtxtCompile		(xmlXPathContextPtr ctxt,
-		    				 xmlChar *str);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL   
-		    xmlXPathCompiledEval	(xmlXPathCompExprPtr comp,
-						 xmlXPathContextPtr ctx);
-XMLPUBFUN int XMLCALL   
-		    xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
-						 xmlXPathContextPtr ctxt);
-XMLPUBFUN void XMLCALL                
-		    xmlXPathFreeCompExpr	(xmlXPathCompExprPtr comp);
-#endif (* LIBXML_XPATH_ENABLED *)
-#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN void XMLCALL		   
-		    xmlXPathInit		(void);
-XMLPUBFUN int XMLCALL
-		xmlXPathIsNaN	(double val);
-XMLPUBFUN int XMLCALL
-		xmlXPathIsInf	(double val);
-
-{ __cplusplus
-}
-#endif
-
-#endif (* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*)
-#endif (* ! __XML_XPATH_H__ *)
+function xmlXPathCompile(str: xmlCharPtr): xmlXPathCompExprPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathCtxtCompile(ctxt: xmlXPathContextPtr; str: xmlCharPtr): xmlXPathCompExprPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathCompiledEval(comp: xmlXPathCompExprPtr; ctxt: xmlXPathContextPtr): xmlXPathCompExprPtr; XMLCALL; XMLPUBFUN;
+function xmlXPathCompiledEvalToBoolean(comp: xmlXPathCompExprPtr; ctxt: xmlXPathContextPtr): cint; XMLCALL; XMLPUBFUN;
+procedure xmlXPathFreeCompExpr(comp: xmlXPathCompExprPtr); XMLCALL; XMLPUBFUN;
+{$ENDIF}
+{$ENDIF} (* LIBXML_XPATH_ENABLED *)
+
+{$if defined(LIBXML_XPATH_ENABLED) or defined(LIBXML_SCHEMAS_ENABLED)}
+{$IFDEF FUNCTION}
+procedure xmlXPathInit; XMLCALL; XMLPUBFUN;
+function xmlXPathIsNaN(val: cdouble): cint; XMLCALL; XMLPUBFUN;
+function xmlXPathIsInf(val: cdouble): cint; XMLCALL; XMLPUBFUN;
+{$ENDIF}
+{$ENDIF} (* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*)

+ 35 - 84
packages/libxml/src/xpointer.inc

@@ -14,101 +14,52 @@
  * Author: Daniel Veillard
  *)
 
-#ifndef __XML_XPTR_H__
-#define __XML_XPTR_H__
+{$IFDEF LIBXML_XPTR_ENABLED}
 
-#include <libxml/xmlversion.h>
-
-{ LIBXML_XPTR_ENABLED
-
-#include <libxml/tree.h>
-#include <libxml/xpath.h>
-
-{ __cplusplus
-extern "C" {
-#endif
+{$IFDEF POINTER}
+  xmlLocationSetPtr = ^xmlLocationSet;
+{$ENDIF}
 
+{$IFDEF TYPE}
 (*
  * A Location Set
  *)
-typedef struct _xmlLocationSet xmlLocationSet;
-typedef xmlLocationSet *xmlLocationSetPtr;
-struct _xmlLocationSet {
-    int locNr;		      (* number of locations in the set *)
-    int locMax;		      (* size of the array as allocated *)
-    xmlXPathObjectPtr *locTab;(* array of locations *)
-};
+  xmlLocationSet = record
+    locNr   : cint;		      (* number of locations in the set *)
+    locMax  : cint;		      (* size of the array as allocated *)
+    locTab  : xmlXPathObjectPtrPtr;(* array of locations *)
+  end;
+{$ENDIF}
 
+{$IFDEF FUNCTION}
 (*
  * Handling of location sets.
  *)
-
-XMLPUBFUN xmlLocationSetPtr XMLCALL			
-		    xmlXPtrLocationSetCreate	(xmlXPathObjectPtr val);
-XMLPUBFUN void XMLCALL			
-		    xmlXPtrFreeLocationSet	(xmlLocationSetPtr obj);
-XMLPUBFUN xmlLocationSetPtr XMLCALL	
-		    xmlXPtrLocationSetMerge	(xmlLocationSetPtr val1,
-						 xmlLocationSetPtr val2);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRange		(xmlNodePtr start,
-						 int startindex,
-						 xmlNodePtr end,
-						 int endindex);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRangePoints	(xmlXPathObjectPtr start,
-						 xmlXPathObjectPtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRangeNodePoint	(xmlNodePtr start,
-						 xmlXPathObjectPtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRangePointNode	(xmlXPathObjectPtr start,
-						 xmlNodePtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL			
-		    xmlXPtrNewRangeNodes	(xmlNodePtr start,
-						 xmlNodePtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewLocationSetNodes	(xmlNodePtr start,
-						 xmlNodePtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRangeNodeObject	(xmlNodePtr start,
-						 xmlXPathObjectPtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewCollapsedRange	(xmlNodePtr start);
-XMLPUBFUN void XMLCALL			
-		    xmlXPtrLocationSetAdd	(xmlLocationSetPtr cur,
-						 xmlXPathObjectPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrWrapLocationSet	(xmlLocationSetPtr val);
-XMLPUBFUN void XMLCALL			
-		    xmlXPtrLocationSetDel	(xmlLocationSetPtr cur,
-						 xmlXPathObjectPtr val);
-XMLPUBFUN void XMLCALL			
-		    xmlXPtrLocationSetRemove	(xmlLocationSetPtr cur,
-						 int val);
+function xmlXPtrLocationSetCreate(val: xmlXPathObjectPtr): xmlLocationSetPtr; XMLCALL; XMLPUBFUN;
+procedure xmlXPtrLocationSetCreate(obj: xmlLocationSetPtr); XMLCALL; XMLPUBFUN;
+function xmlXPtrLocationSetMerge(val1, val2: xmlLocationSetPtr): xmlLocationSetPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrNewRange(start: xmlNodePtr; startindex: cint; _end: xmlNodePtr; endindex: cint): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrNewRangePoints(start, _end: xmlXPathObjectPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrNewRangeNodePoint(start: xmlNodePtr; _end: xmlXPathObjectPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrNewRangePointNode(start: xmlXPathObjectPtr; _end: xmlNodePtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrNewRangeNodes(start: xmlNodePtr; _end: xmlNodePtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrNewLocationSetNodes(start: xmlNodePtr; _end: xmlNodePtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrNewLocationSetNodeSet(_set: xmlNodeSetPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrNewRangeNodeObject(start: xmlNodePtr; _end: xmlXPathObjectPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrNewCollapsedRange(start: xmlNodePtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+procedure xmlXPtrLocationSetAdd(cur: xmlLocationSetPtr; val: xmlXPathObjectPtr); XMLCALL; XMLPUBFUN;
+function xmlXPtrWrapLocationSet(val: xmlLocationSetPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+procedure xmlXPtrLocationSetDel(cur: xmlLocationSetPtr; val: xmlXPathObjectPtr); XMLCALL; XMLPUBFUN;
+procedure xmlXPtrLocationSetRemove(cur: xmlLocationSetPtr; val: cint); XMLCALL; XMLPUBFUN;
 
 (*
  * Functions.
  *)
-XMLPUBFUN xmlXPathContextPtr XMLCALL	
-		    xmlXPtrNewContext		(xmlDocPtr doc,
-						 xmlNodePtr here,
-						 xmlNodePtr origin);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrEval			(xmlChar *str,
-						 xmlXPathContextPtr ctx);
-XMLPUBFUN void XMLCALL					    
-		    xmlXPtrRangeToFunction	(xmlXPathParserContextPtr ctxt,
-       						 int nargs);
-XMLPUBFUN xmlNodePtr XMLCALL		
-		    xmlXPtrBuildNodeList	(xmlXPathObjectPtr obj);
-XMLPUBFUN void XMLCALL		
-		    xmlXPtrEvalRangePredicate	(xmlXPathParserContextPtr ctxt);
-{ __cplusplus
-}
-#endif
+function xmlXPtrNewContext(doc: xmlDocPtr; here, origin: xmlNodePtr): xmlXPathContextPtr; XMLCALL; XMLPUBFUN;
+function xmlXPtrEval(str: xmlCharPtr; ctx: xmlXPathContextPtr): xmlXPathObjectPtr; XMLCALL; XMLPUBFUN;
+procedure xmlXPtrRangeToFunction(ctxt: xmlXPathParserContextPtr; nargs: cint); XMLCALL; XMLPUBFUN;
+function xmlXPtrBuildNodeList(obj: xmlXPathObjectPtr): xmlNodePtr; XMLCALL; XMLPUBFUN;
+procedure xmlXPtrEvalRangePredicate(ctxt: xmlXPathParserContextPtr); XMLCALL; XMLPUBFUN;
+{$ENDIF}
 
-#endif (* LIBXML_XPTR_ENABLED *)
-#endif (* __XML_XPTR_H__ *)
+{$ENDIF} (* LIBXML_XPTR_ENABLED *)