5000
  +   /ˆl–ßi~”Ên-jqA
ãOÜªbÑ¿Ë„®ºç_†I|¥�+ÀÊ ?÷     //**
 * @file
 * 
 * @brief internal interfaces for XML Path Language implementation
 * 
 * internal interfaces for XML Path Language implementation
 *              used to build new modules on top of XPath like XPointer and
 *              XSLT
 *
 * @copyright See Copyright for the status of this software.
 *
 * @author Daniel Veillard
 */

#ifndef __XML_XPATH_INTERNALS_H__
#define __XML_XPATH_INTERNALS_H__

#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/xpath.h>

#ifdef LIBXML_XPATH_ENABLED

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Push a value on the stack
 *
 * @deprecated Use #xmlXPathValuePush
 */
#define valuePush xmlXPathValuePush
/**
 * Pop a value from the stack
 *
 * @deprecated Use #xmlXPathValuePop
 */
#define valuePop xmlXPathValuePop

/************************************************************************
 *									*
 *			Helpers						*
 *									*
 ************************************************************************/

/*
 * Many of these macros may later turn into functions. They
 * shouldn't be used in \#ifdef's preprocessor instructions.
 */
/**
 * Raises an error.
 *
 * @param ctxt  an XPath parser context
 * @param err  an xmlXPathError code
 */
#define xmlXPathSetError(ctxt, err)					\
    { xmlXPatherror((ctxt), __FILE__, __LINE__, (err));			\
      if ((ctxt) != NULL) (ctxt)->error = (err); }

/**
 * Raises an XPATH_INVALID_ARITY error.
 *
 * @param ctxt  an XPath parser context
 */
#define xmlXPathSetArityError(ctxt)					\
    xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)

/**
 * Raises an XPATH_INVALID_TYPE error.
 *
 * @param ctxt  an XPath parser context
 */
#define xmlXPathSetTypeError(ctxt)					\
    xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)

/**
 * Get the error code of an XPath context.
 *
 * @param ctxt  an XPath parser context
 * @returns the context error.
 */
#define xmlXPathGetError(ctxt)	  ((ctxt)->error)

/**
 * Check if an XPath error was raised.
 *
 * @param ctxt  an XPath parser context
 * @returns true if an error has been raised, false otherwise.
 */
#define xmlXPathCheckError(ctxt)  ((ctxt)->error != XPATH_EXPRESSION_OK)

/**
 * Get the document of an XPath context.
 *
 * @param ctxt  an XPath parser context
 * @returns the context document.
 */
#define xmlXPathGetDocument(ctxt)	((ctxt)->context->doc)

/**
 * Get the context node of an XPath context.
 *
 * @param ctxt  an XPath parser context
 * @returns the context node.
 */
#define xmlXPathGetContextNode(ctxt)	((ctxt)->context->node)

XMLPUBFUN int
		xmlXPathPopBoolean	(xmlXPathParserContext *ctxt);
XMLPUBFUN double
		xmlXPathPopNumber	(xmlXPathParserContext *ctxt);
XMLPUBFUN xmlChar *
		xmlXPathPopString	(xmlXPathParserContext *ctxt);
XMLPUBFUN xmlNodeSet *
		xmlXPathPopNodeSet	(xmlXPathParserContext *ctxt);
XMLPUBFUN void *
		xmlXPathPopExternal	(xmlXPathParserContext *ctxt);

/**
 * Pushes the boolean `val` on the context stack.
 *
 * @param ctxt  an XPath parser context
 * @param val  a boolean
 */
#define xmlXPathReturnBoolean(ctxt, val)				\
    valuePush((ctxt), xmlXPathNewBoolean(val))

/**
 * Pushes true on the context stack.
 *
 * @param ctxt  an XPath parser context
 */
#define xmlXPathReturnTrue(ctxt)   xmlXPathReturnBoolean((ctxt), 1)

/**
 * Pushes false on the context stack.
 *
 * @param ctxt  an XPath parser context
 */
#define xmlXPathReturnFalse(ctxt)  xmlXPathReturnBoolean((ctxt), 0)

/**
 * Pushes the double `val` on the context stack.
 *
 * @param ctxt  an XPath parser context
 * @param val  a double
 */
#define xmlXPathReturnNumber(ctxt, val)					\
    valuePush((ctxt), xmlXPathNewFloat(val))

/**
 * Pushes the string `str` on the context stack.
 *
 * @param ctxt  an XPath parser context
 * @param str  a string
 */
#define xmlXPathReturnString(ctxt, str)					\
    valuePush((ctxt), xmlXPathWrapString(str))

/**
 * Pushes an empty string on the stack.
 *
 * @param ctxt  an XPath parser context
 */
#define xmlXPathReturnEmptyString(ctxt)					\
    valuePush((ctxt), xmlXPathNewCString(""))

/**
 * Pushes t