Browse Source

* more generalized cc and export macros

git-svn-id: trunk@11531 -
ivost 17 years ago
parent
commit
14e79700cc

+ 1 - 2
packages/libxml/src/dict.inc

@@ -12,8 +12,7 @@
  * The dictionnary
  *)
 {$IFDEF TYPE}
-  xmlDict = record
-  end;
+  xmlDict = record end;
 {$ENDIF}
 
 {$IFDEF FUNCTION}

+ 2 - 2
packages/libxml/src/encoding.inc

@@ -84,7 +84,7 @@
  *     if the return value is positive, else unpredictiable.
  * The value of @outlen after return is the number of octets consumed.
  *)
-  xmlCharEncodingInputFunc = function(_out: pchar; outlen: pcint; _in: pchar; inlen: pcint): cint; cdecl;
+  xmlCharEncodingInputFunc = function(_out: pchar; outlen: pcint; _in: pchar; inlen: pcint): cint; XMLCDECL;
 
 (**
  * xmlCharEncodingOutputFunc:
@@ -104,7 +104,7 @@
  *     if the return value is positive, else unpredictiable.
  * The value of @outlen after return is the number of octets produced.
  *)
-  xmlCharEncodingOutputFunc = function(_out: pchar; outlen: pcint; _in: pchar; inlen: pcint): cint; cdecl;
+  xmlCharEncodingOutputFunc = function(_out: pchar; outlen: pcint; _in: pchar; inlen: pcint): cint; XMLCDECL;
 
 (*
  * Block defining the handlers for non UTF-8 encodings.

+ 1 - 2
packages/libxml/src/entities.inc

@@ -53,8 +53,7 @@
  * All entities are stored in an hash table.
  * There is 2 separate hash tables for global and parameter entities.
  *)
-  xmlEntitiesTable = record
-  end;
+  xmlEntitiesTable = record end;
 {$ENDIF}
 
 {$IFDEF FUNCTION}

+ 4 - 4
packages/libxml/src/globals.inc

@@ -17,8 +17,8 @@ procedure xmlCleanupGlobals; XMLCALL; XMLPUBFUN;
 {$ENDIF}
 
 {$IFDEF TYPE}
-  xmlParserInputBufferCreateFilenameFunc = function(URI: pchar; enc: xmlCharEncoding): xmlParserInputBufferPtr; cdecl;
-  xmlOutputBufferCreateFilenameFunc = function(URI: pchar; encoder: xmlCharEncodingHandlerPtr; compression: cint): xmlOutputBufferPtr; cdecl;
+  xmlParserInputBufferCreateFilenameFunc = function(URI: pchar; enc: xmlCharEncoding): xmlParserInputBufferPtr; XMLCALL;
+  xmlOutputBufferCreateFilenameFunc = function(URI: pchar; encoder: xmlCharEncodingHandlerPtr; compression: cint): xmlOutputBufferPtr; XMLCALL;
 {$ENDIF}
 
 {$IFDEF FUNCTION}
@@ -32,8 +32,8 @@ function xmlOutputBufferCreateFilenameDefault(func: xmlOutputBufferCreateFilenam
  *)
 
 {$IFDEF TYPE}
-  xmlRegisterNodeFunc = procedure(node: xmlNodePtr);
-  xmlDeregisterNodeFunc = procedure(node: xmlNodePtr);
+  xmlRegisterNodeFunc = procedure(node: xmlNodePtr); XMLCALL;
+  xmlDeregisterNodeFunc = procedure(node: xmlNodePtr); XMLCALL;
 
   xmlGlobalState = record
     xmlParserVersion                        : pchar;

+ 5 - 6
packages/libxml/src/hash.inc

@@ -12,8 +12,7 @@
 (*
  * The hash table.
  *)
-  xmlHashTable = record
-  end;
+  xmlHashTable = record end;
 
 
 (*
@@ -34,7 +33,7 @@
  *
  * Callback to free data from a hash.
  *)
-  xmlHashDeallocator = procedure(payload: pointer; name: xmlCharPtr); cdecl;
+  xmlHashDeallocator = procedure(payload: pointer; name: xmlCharPtr); XMLCALL;
 
 (**
  * xmlHashCopier:
@@ -45,7 +44,7 @@
  *
  * Returns a copy of the data or NULL in case of error.
  *)
-  xmlHashCopier = function(payload: pointer; name: xmlCharPtr): pointer; cdecl;
+  xmlHashCopier = function(payload: pointer; name: xmlCharPtr): pointer; XMLCALL;
 
 (**
  * xmlHashScanner:
@@ -55,7 +54,7 @@
  *
  * Callback when scanning data in a hash with the simple scanner.
  *)
-  xmlHashScanner = procedure(payload: pointer; data: pointer; name: xmlCharPtr); cdecl;
+  xmlHashScanner = procedure(payload: pointer; data: pointer; name: xmlCharPtr); XMLCALL;
 
 (**
  * xmlHashScannerFull:
@@ -67,7 +66,7 @@
  *
  * Callback when scanning data in a hash with the full scanner.
  *)
-  xmlHashScannerFull = procedure(payload: pointer; data: pointer; name, name2, name3: xmlCharPtr); cdecl;
+  xmlHashScannerFull = procedure(payload: pointer; data: pointer; name, name2, name3: xmlCharPtr); XMLCALL;
 {$ENDIF}
 
 {$IFDEF FUNCTION}

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

@@ -229,27 +229,22 @@ const
 
 implementation
 
-procedure fpcxmlFree(mem: pointer); cdecl;
+procedure fpcxmlFree(mem: pointer); XMLCALL;
 begin
   FreeMem(mem);
 end;
 
-function fpcxmlMalloc(size: size_t): pointer; cdecl;
+function fpcxmlMalloc(size: size_t): pointer; XMLCALL;
 begin
   GetMem(Result, size);
 end;
 
-function fpcxmlRealloc(mem: pointer; size: size_t): pointer; cdecl;
+function fpcxmlRealloc(mem: pointer; size: size_t): pointer; XMLCALL;
 begin
   Result := mem;
   ReallocMem(Result, size);
 end;
 
-{procedure fpcxmlErrorHandler(ctx: pointer; msg: pchar; args: array of const); cdecl;
-begin
-  writeln('abcd');
-end;}
-
 initialization
 (*
  * this initialize the library and check potential ABI mismatches

+ 7 - 7
packages/libxml/src/parser.inc

@@ -282,10 +282,10 @@
  *
  * A SAX Locator.
  *)
-  getPublicIdFunc = function(ctx: pointer): xmlCharPtr; cdecl;
-  getSystemIdFunc = function(ctx: pointer): xmlCharPtr; cdecl;
-  getLineNumberFunc = function(ctx: pointer): cint; cdecl;
-  getColumnNumberFunc = function(ctx: pointer): cint; cdecl;
+  getPublicIdFunc = function(ctx: pointer): xmlCharPtr; XMLCALL;
+  getSystemIdFunc = function(ctx: pointer): xmlCharPtr; XMLCALL;
+  getLineNumberFunc = function(ctx: pointer): cint; XMLCALL;
+  getColumnNumberFunc = function(ctx: pointer): cint; XMLCALL;
 
   xmlSAXLocator = record
     getPublicId     : getPublicIdFunc;
@@ -634,7 +634,7 @@
  * the new namespace declarations on the element.
  *)
   startElementNsSAX2Func = procedure(ctx: pointer; localname, prefix, URI: xmlCharPtr; nb_namespaces: cint;
-    namespaces: xmlCharPtrPtr; nb_attributes, nb_defaulted: cint; attributes: xmlCharPtrPtr); cdecl;
+    namespaces: xmlCharPtrPtr; nb_attributes, nb_defaulted: cint; attributes: xmlCharPtrPtr); XMLCALL;
 
 (**
  * endElementNsSAX2Func:
@@ -646,7 +646,7 @@
  * SAX2 callback when an element end has been detected by the parser.
  * It provides the namespace informations for the element.
  *)
-  endElementNsSAX2Func = procedure(ctx: pointer; localname, prefix, URI: xmlCharPtr);
+  endElementNsSAX2Func = procedure(ctx: pointer; localname, prefix, URI: xmlCharPtr); XMLCALL;
 
   xmlSAXHandler = record
     internalSubset: internalSubsetSAXFunc;
@@ -729,7 +729,7 @@
  *
  * Returns the entity input parser.
  *)
-  xmlExternalEntityLoader = function(URL, ID: pchar; context: xmlParserCtxtPtr): xmlParserInputPtr; cdecl;
+  xmlExternalEntityLoader = function(URL, ID: pchar; context: xmlParserCtxtPtr): xmlParserInputPtr; XMLCALL;
 
 (**
  * xmlParserOption:

+ 3 - 6
packages/libxml/src/relaxng.inc

@@ -11,8 +11,7 @@
 {$IFDEF LIBXML_SCHEMAS_ENABLED}
 
 {$IFDEF TYPE}
-  xmlRelaxNG = record
-  end;
+  xmlRelaxNG = record end;
 
 (**
  * A schemas validation context
@@ -20,11 +19,9 @@
   xmlRelaxNGValidityErrorFunc = procedure(ctx: pointer; msg: pchar; args: array of const); XMLCDECL;
   xmlRelaxNGValidityWarningFunc = procedure(ctx: pointer; msg: pchar; args: array of const); XMLCDECL;
 
-  xmlRelaxNGParserCtxt = record
-  end;
+  xmlRelaxNGParserCtxt = record end;
 
-  xmlRelaxNGValidCtxt = record
-  end;
+  xmlRelaxNGValidCtxt = record end;
 
 (*
  * xmlRelaxNGValidErr:

+ 1 - 1
packages/libxml/src/tree.inc

@@ -466,7 +466,7 @@
  *
  * Returns an xmlNsPtr or NULL in case of an error.
  *)
-  xmlDOMWrapAcquireNsFunction = function (ctxt: xmlDOMWrapCtxtPtr; node: xmlNodePtr; nsName, nsPrefix: xmlCharPtr): xmlNsPtr; cdecl;
+  xmlDOMWrapAcquireNsFunction = function (ctxt: xmlDOMWrapCtxtPtr; node: xmlNodePtr; nsName, nsPrefix: xmlCharPtr): xmlNsPtr; XMLCALL;
 
 (**
  * xmlDOMWrapCtxt:

+ 8 - 8
packages/libxml/src/xmlIO.inc

@@ -22,7 +22,7 @@
  *
  * Returns 1 if yes and 0 if another Input module should be used
  *)
-  xmlInputMatchCallback = function(filename: pchar): cint; cdecl;
+  xmlInputMatchCallback = function(filename: pchar): cint; XMLCALL;
 
 (**
  * xmlInputOpenCallback:
@@ -32,7 +32,7 @@
  *
  * Returns an Input context or NULL in case or error
  *)
-  xmlInputOpenCallback = function(filename: pchar): pointer; cdecl;
+  xmlInputOpenCallback = function(filename: pchar): pointer; XMLCALL;
 
 (**
  * xmlInputReadCallback:
@@ -44,7 +44,7 @@
  *
  * Returns the number of bytes read or -1 in case of error
  *)
-  xmlInputReadCallback = function(context: pointer; buffer: pchar; len: cint): cint; cdecl;
+  xmlInputReadCallback = function(context: pointer; buffer: pchar; len: cint): cint; XMLCALL;
 
 (**
  * xmlInputCloseCallback:
@@ -54,7 +54,7 @@
  *
  * Returns 0 or -1 in case of error
  *)
-  xmlInputCloseCallback = function(context: pointer): cint; cdecl;
+  xmlInputCloseCallback = function(context: pointer): cint; XMLCALL;
 
 {$IFDEF LIBXML_OUTPUT_ENABLED}
 (*
@@ -71,7 +71,7 @@
  *
  * Returns 1 if yes and 0 if another Output module should be used
  *)
-  xmlOutputMatchCallback = function(filename: pchar): cint; cdecl;
+  xmlOutputMatchCallback = function(filename: pchar): cint; XMLCALL;
 
 (**
  * xmlOutputOpenCallback:
@@ -81,7 +81,7 @@
  *
  * Returns an Output context or NULL in case or error
  *)
-  xmlOutputOpenCallback = function(filename: pchar): pointer; cdecl;
+  xmlOutputOpenCallback = function(filename: pchar): pointer; XMLCALL;
 
 (**
  * xmlOutputWriteCallback:
@@ -93,7 +93,7 @@
  *
  * Returns the number of bytes written or -1 in case of error
  *)
-  xmlOutputWriteCallback = function(context: pointer; buffer: pchar; len: cint): cint; cdecl;
+  xmlOutputWriteCallback = function(context: pointer; buffer: pchar; len: cint): cint; XMLCALL;
 
 (**
  * xmlOutputCloseCallback:
@@ -103,7 +103,7 @@
  *
  * Returns 0 or -1 in case of error
  *)
-  xmlOutputCloseCallback = function(context: pointer): cint; cdecl;
+  xmlOutputCloseCallback = function(context: pointer): cint; XMLCALL;
 {$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
 
   xmlParserInputBuffer = record

+ 2 - 2
packages/libxml/src/xmlerror.inc

@@ -824,7 +824,7 @@
  * Signature of the function to use when there is an error and
  * no parsing or validity context available .
  *)
-  xmlGenericErrorFunc = procedure(ctx: pointer; msg: pchar; args: array of const); cdecl;
+  xmlGenericErrorFunc = procedure(ctx: pointer; msg: pchar; args: array of const); XMLCDECL;
 
 (**
  * xmlStructuredErrorFunc:
@@ -834,7 +834,7 @@
  * Signature of the function to use when there is an error and
  * the module handles the new error reporting mechanism.
  *)
-  xmlStructuredErrorFunc = procedure(userData: pointer; error: xmlErrorPtr); cdecl;
+  xmlStructuredErrorFunc = procedure(userData: pointer; error: xmlErrorPtr); XMLCALL;
 
 (*
  * Use the following function to reset the two global variables

+ 2 - 2
packages/libxml/src/xmlexports.inc

@@ -31,7 +31,7 @@
  *
  * Macros which declare an exportable variable
  *)
-//#define XMLPUBVAR extern
+{$DEFINE XMLPUBVAR := cvar; external}
 
 (**
  * XMLCALL:
@@ -46,7 +46,7 @@
  * Macro which declares the calling convention for exported functions that
  * use '...'.
  *)
-//#define XMLCDECL
+{$DEFINE XMLCDECL := cdecl}
 
 (** DOC_DISABLE *)
 

+ 4 - 4
packages/libxml/src/xmlmemory.inc

@@ -44,7 +44,7 @@
  *
  * Signature for a free() implementation.
  *)
-  xmlFreeFunc = procedure(mem: pointer); cdecl;
+  xmlFreeFunc = procedure(mem: pointer); XMLCALL;
 
 (**
  * xmlMallocFunc:
@@ -54,7 +54,7 @@
  *
  * Returns a pointer to the newly allocated block or NULL in case of error.
  *)
-  xmlMallocFunc = function(size: size_t): pointer; cdecl;
+  xmlMallocFunc = function(size: size_t): pointer; XMLCALL;
 
 (**
  * xmlReallocFunc:
@@ -65,7 +65,7 @@
  *
  * Returns a pointer to the newly reallocated block or NULL in case of error.
  *)
-  xmlReallocFunc = function(mem: pointer; size: size_t): pointer; cdecl;
+  xmlReallocFunc = function(mem: pointer; size: size_t): pointer; XMLCALL;
 
 (**
  * xmlStrdupFunc:
@@ -75,7 +75,7 @@
  *
  * Returns the copy of the string or NULL in case of error.
  *)
-  xmlStrdupFunc = function(str: pchar): pchar; cdecl;
+  xmlStrdupFunc = function(str: pchar): pchar; XMLCALL;
 
 (*
  * The 4 interfaces used for all memory handling within libxml.

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

@@ -82,12 +82,11 @@
  *
  * Structure for an xmlReader context.
  *)
-  xmlTextReader = record
-  end;
+  xmlTextReader = record end;
 
   xmlTextReaderLocatorPtr = pointer;
 
-  xmlTextReaderErrorFunc = procedure(arg: pointer; msg: pchar; severity: xmlParserSeverities; locator: xmlTextReaderLocatorPtr); cdecl;
+  xmlTextReaderErrorFunc = procedure(arg: pointer; msg: pchar; severity: xmlParserSeverities; locator: xmlTextReaderLocatorPtr); XMLCALL;
 {$ENDIF}
 
 {$IFDEF FUNCTION}

+ 5 - 7
packages/libxml/src/xmlregexp.inc

@@ -16,21 +16,19 @@
  * A libxml regular expression, they can actually be far more complex
  * thank the POSIX regex expressions.
  *)
-  xmlRegexp = record
-  end;
+  xmlRegexp = record end;
 
 (**
  * xmlRegExecCtxtPtr:
  *
  * A libxml progressive regular expression evaluation context
  *)
-  xmlRegExecCtxt = record
-  end;
+  xmlRegExecCtxt = record end;
 
 (*
  * Callback function when doing a transition in the automata
  *)
-  xmlRegExecCallbacks = procedure(exec: xmlRegExecCtxtPtr; token: xmlCharPtr; transdata, inputdata: pointer); cdecl;
+  xmlRegExecCallbacks = procedure(exec: xmlRegExecCtxtPtr; token: xmlCharPtr; transdata, inputdata: pointer); XMLCALL;
 {$ENDIF}
 
 {$IFDEF FUNCTION}
@@ -91,8 +89,8 @@ function xmlExpCtxtNbCons(ctxt: xmlExpCtxtPtr): cint; XMLCALL; XMLPUBFUN;
  * and for the set with just the empty token
  *)
 var
-  forbiddenExp: xmlExpNodePtr; cvar; external;
-  emptyExp: xmlExpNodePtr; cvar; external;
+  forbiddenExp: xmlExpNodePtr; XMLPUBVAR;
+  emptyExp: xmlExpNodePtr; XMLPUBVAR;
 
 (*
  * Expressions are reference counted internally

+ 1 - 2
packages/libxml/src/xmlsave.inc

@@ -23,8 +23,7 @@
     XML_SAVE_NO_XHTML	= 1 shl 3  (* disable XHTML1 specific rules *)
   );
 
-  xmlSaveCtxt = record
-  end;
+  xmlSaveCtxt = record end;
 {$ENDIF}
 
 {$IFDEF FUNCTION}

+ 6 - 10
packages/libxml/src/xmlschemas.inc

@@ -70,23 +70,19 @@
 (**
  * The schemas related types are kept internal
  *)
-  xmlSchema = record
-  end;
+  xmlSchema = record end;
 
 (**
  * A schemas validation context
  *)
-  xmlSchemaValidityErrorFunc = procedure(ctx: pointer; msg: pchar; args: array of const); cdecl;
-  xmlSchemaValidityWarningFunc = procedure(ctx: pointer; msg: pchar; args: array of const); cdecl;
+  xmlSchemaValidityErrorFunc = procedure(ctx: pointer; msg: pchar; args: array of const); XMLCDECL;
+  xmlSchemaValidityWarningFunc = procedure(ctx: pointer; msg: pchar; args: array of const); XMLCDECL;
 
-  xmlSchemaParserCtxt = record
-  end;
+  xmlSchemaParserCtxt = record end;
 
-  xmlSchemaValidCtxt = record
-  end;
+  xmlSchemaValidCtxt = record end;
 
-  xmlSchemaSAXPlugStruct = record
-  end;
+  xmlSchemaSAXPlugStruct = record end;
 {$ENDIF}
 
 {$IFDEF FUNCTION}

+ 1 - 2
packages/libxml/src/xmlwriter.inc

@@ -11,8 +11,7 @@
 {$IFDEF LIBXML_WRITER_ENABLED}
 
 {$IFDEF TYPE}
-  xmlTextWriter = record
-  end;
+  xmlTextWriter = record end;
 {$ENDIF}
 
 {$IFDEF FUNCTION}