diff options
Diffstat (limited to 'plugins/Variables/src')
51 files changed, 835 insertions, 3061 deletions
diff --git a/plugins/Variables/src/Version.h b/plugins/Variables/src/Version.h new file mode 100644 index 0000000000..530648d0ff --- /dev/null +++ b/plugins/Variables/src/Version.h @@ -0,0 +1,14 @@ +#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 2
+#define __RELEASE_NUM 3
+#define __BUILD_NUM 9
+
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+
+#define __PLUGIN_NAME "Variables"
+#define __FILENAME "Variables.dll"
+#define __DESCRIPTION "Adds support for dynamic variables in strings for plugins."
+#define __AUTHOR "P Boon"
+#define __AUTHOREMAIL "unregistered@users.sourceforge.net"
+#define __AUTHORWEB "http://miranda-ng.org/"
+#define __COPYRIGHT "© 2003-2008 P. Boon, Ricardo Pescuma, George Hazan"
diff --git a/plugins/Variables/src/action_variables.cpp b/plugins/Variables/src/action_variables.cpp index e4d1a17aa1..2d7f60a015 100644 --- a/plugins/Variables/src/action_variables.cpp +++ b/plugins/Variables/src/action_variables.cpp @@ -17,10 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// This file has not been converted to unicode yet
+
#include "variables.h"
-#include "m_trigger.h"
-#include "trigger_variables.h"
-#include "resource.h"
static void parseStringThread(void *arg) {
diff --git a/plugins/Variables/src/buildnumber.h b/plugins/Variables/src/buildnumber.h deleted file mode 100644 index 2e38a77fad..0000000000 --- a/plugins/Variables/src/buildnumber.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _BUILDNUMBER_
-#define BUILDNUMBER 0
-#define __FILEVERSION_STRING 0,2,3,9
-#define __VERSION_STRING "0.2.3.9"
-#define __VERSION_DWORD 0x20309
-#endif //_BUILDNUMBER_
diff --git a/plugins/Variables/src/condition_variables.cpp b/plugins/Variables/src/condition_variables.cpp index c58703cc54..4ebe86a05d 100644 --- a/plugins/Variables/src/condition_variables.cpp +++ b/plugins/Variables/src/condition_variables.cpp @@ -17,10 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// This file has not been converted to unicode yet
+
#include "variables.h"
-#include "m_trigger.h"
-#include "trigger_variables.h"
-#include "resource.h"
int ParseStringCondition(DWORD conditionID, REPORTINFO *ri) {
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index d392cb78ff..f83653836e 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "contact.h"
struct _tagType
{
diff --git a/plugins/Variables/src/dbhelpers.h b/plugins/Variables/src/dbhelpers.h index 3eb3c7e330..c121d9c0a3 100644 --- a/plugins/Variables/src/dbhelpers.h +++ b/plugins/Variables/src/dbhelpers.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#ifndef PREFIX_ITH
#define PREFIX_ITH ""
#endif
diff --git a/plugins/Variables/src/enumprocs.cpp b/plugins/Variables/src/enumprocs.cpp index 56df0acfc8..6650b685b5 100644 --- a/plugins/Variables/src/enumprocs.cpp +++ b/plugins/Variables/src/enumprocs.cpp @@ -20,11 +20,8 @@ //
// EnumProc.c
//
-#include <windows.h>
-#include <stdio.h>
-#include <tlhelp32.h>
-#include <vdmdbg.h>
-#include "enumprocs.h"
+
+#include "variables.h"
typedef struct {
DWORD dwPID;
diff --git a/plugins/Variables/src/enumprocs.h b/plugins/Variables/src/enumprocs.h index 118c40b67c..78374a02a6 100644 --- a/plugins/Variables/src/enumprocs.h +++ b/plugins/Variables/src/enumprocs.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
/*** Process names are ANSI only ***/
typedef BOOL (CALLBACK *PROCENUMPROC)(DWORD, WORD, char *, LPARAM);
BOOL WINAPI EnumProcs(PROCENUMPROC lpProc, LPARAM lParam);
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index ac4ecaf702..5569ef522d 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -16,13 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "variables.h"
-#include "contact.h"
-#include <commctrl.h>
-#include <m_clui.h>
-#include <m_clc.h>
-extern BOOL (WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD);
+#include "variables.h"
struct HELPDLGDATA
{
@@ -438,7 +433,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam }
}
- if (!_tcscmp(tr->tszTokenString, _T(EXTRATEXT))) {
+ if (!_tcscmp(tr->tszTokenString, _T(MIR_EXTRATEXT))) {
if (hdd->vhs->flags&VHF_HIDEEXTRATEXTTOKEN) {
continue;
}
diff --git a/plugins/Variables/src/libxml/c14n.h b/plugins/Variables/src/libxml/c14n.h deleted file mode 100644 index 75ace8a4a4..0000000000 --- a/plugins/Variables/src/libxml/c14n.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * "Canonical XML" implementation - * http://www.w3.org/TR/xml-c14n - * - * "Exclusive XML Canonicalization" implementation - * http://www.w3.org/TR/xml-exc-c14n - - * See Copyright for the status of this software. - * - * Author: Aleksey Sanin <aleksey@aleksey.com> - */ -#ifndef __XML_C14N_H__ -#define __XML_C14N_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include <libxml/tree.h> -#include <libxml/xpath.h> - -/* - * XML Canonicazation - * http://www.w3.org/TR/xml-c14n - * - * Exclusive XML Canonicazation - * http://www.w3.org/TR/xml-exc-c14n - * - * Canonical form of an XML document could be created if and only if - * a) default attributes (if any) are added to all nodes - * b) all character and parsed entity references are resolved - * In order to achive this in libxml2 the document MUST be loaded with - * following global setings: - * - * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - * xmlSubstituteEntitiesDefault(1); - * - * or corresponding parser context setting: - * xmlParserCtxtPtr ctxt; - * - * ... - * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - * ctxt->replaceEntities = 1; - * ... - */ - - -int xmlC14NDocSaveTo (xmlDocPtr doc, - xmlNodeSetPtr nodes, - int exclusive, - xmlChar **inclusive_ns_prefixes, - int with_comments, - xmlOutputBufferPtr buf); - -int xmlC14NDocDumpMemory (xmlDocPtr doc, - xmlNodeSetPtr nodes, - int exclusive, - xmlChar **inclusive_ns_prefixes, - int with_comments, - xmlChar **doc_txt_ptr); - -int xmlC14NDocSave (xmlDocPtr doc, - xmlNodeSetPtr nodes, - int exclusive, - xmlChar **inclusive_ns_prefixes, - int with_comments, - const char* filename, - int compression); - - -/** - * This is the core C14N function - */ -typedef int (*xmlC14NIsVisibleCallback) (void* user_data, - xmlNodePtr node, - xmlNodePtr parent); - -int xmlC14NExecute (xmlDocPtr doc, - xmlC14NIsVisibleCallback is_visible_callback, - void* user_data, - int exclusive, - xmlChar **inclusive_ns_prefixes, - int with_comments, - xmlOutputBufferPtr buf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __XML_C14N_H__ */ - diff --git a/plugins/Variables/src/libxml/nanoftp.h b/plugins/Variables/src/libxml/nanoftp.h deleted file mode 100644 index a0ba2ceeb3..0000000000 --- a/plugins/Variables/src/libxml/nanoftp.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * nanohttp.c: minimalist FTP implementation to fetch external subsets. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#ifndef __NANO_FTP_H__ -#define __NANO_FTP_H__ - -#include <libxml/xmlversion.h> - -#ifdef LIBXML_FTP_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * ftpListCallback: - * @userData: user provided data for the callback - * @filename: the file name (including "->" when links are shown) - * @attrib: the attribute string - * @owner: the owner string - * @group: the group string - * @size: the file size - * @links: the link count - * @year: the year - * @month: the month - * @day: the day - * @hour: the hour - * @minute: the minute - * - * A callback for the xmlNanoFTPList command. - * Note that only one of year and day:minute are specified. - */ -typedef void (*ftpListCallback) (void *userData, - const char *filename, const char *attrib, - const char *owner, const char *group, - unsigned long size, int links, int year, - const char *month, int day, int hour, - int minute); -/** - * ftpDataCallback: - * @userData: the user provided context - * @data: the data received - * @len: its size in bytes - * - * A callback for the xmlNanoFTPGet command. - */ -typedef void (*ftpDataCallback) (void *userData, - const char *data, - int len); - -/* - * Init - */ -void xmlNanoFTPInit (void); -void xmlNanoFTPCleanup (void); - -/* - * Creating/freeing contexts. - */ -void * xmlNanoFTPNewCtxt (const char *URL); -void xmlNanoFTPFreeCtxt (void * ctx); -void * xmlNanoFTPConnectTo (const char *server, - int port); -/* - * Opening/closing session connections. - */ -void * xmlNanoFTPOpen (const char *URL); -int xmlNanoFTPConnect (void *ctx); -int xmlNanoFTPClose (void *ctx); -int xmlNanoFTPQuit (void *ctx); -void xmlNanoFTPScanProxy (const char *URL); -void xmlNanoFTPProxy (const char *host, - int port, - const char *user, - const char *passwd, - int type); -int xmlNanoFTPUpdateURL (void *ctx, - const char *URL); - -/* - * Rather internal commands. - */ -int xmlNanoFTPGetResponse (void *ctx); -int xmlNanoFTPCheckResponse (void *ctx); - -/* - * CD/DIR/GET handlers. - */ -int xmlNanoFTPCwd (void *ctx, - char *directory); - -int xmlNanoFTPGetConnection (void *ctx); -int xmlNanoFTPCloseConnection(void *ctx); -int xmlNanoFTPList (void *ctx, - ftpListCallback callback, - void *userData, - char *filename); -int xmlNanoFTPGetSocket (void *ctx, - const char *filename); -int xmlNanoFTPGet (void *ctx, - ftpDataCallback callback, - void *userData, - const char *filename); -int xmlNanoFTPRead (void *ctx, - void *dest, - int len); - -#ifdef __cplusplus -} -#endif /* LIBXML_FTP_ENABLED */ -#endif -#endif /* __NANO_FTP_H__ */ diff --git a/plugins/Variables/src/libxml/nanohttp.h b/plugins/Variables/src/libxml/nanohttp.h deleted file mode 100644 index 4fb4e1d256..0000000000 --- a/plugins/Variables/src/libxml/nanohttp.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * nanohttp.c: minimalist HTTP implementation to fetch external subsets. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#ifndef __NANO_HTTP_H__ -#define __NANO_HTTP_H__ - -#include <libxml/xmlversion.h> - -#ifdef LIBXML_HTTP_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif -void xmlNanoHTTPInit (void); -void xmlNanoHTTPCleanup (void); -void xmlNanoHTTPScanProxy (const char *URL); -int xmlNanoHTTPFetch (const char *URL, - const char *filename, - char **contentType); -void * xmlNanoHTTPMethod (const char *URL, - const char *method, - const char *input, - char **contentType, - const char *headers, - int ilen); -void * xmlNanoHTTPMethodRedir (const char *URL, - const char *method, - const char *input, - char **contentType, - char **redir, - const char *headers, - int ilen); -void * xmlNanoHTTPOpen (const char *URL, - char **contentType); -void * xmlNanoHTTPOpenRedir (const char *URL, - char **contentType, - char **redir); -int xmlNanoHTTPReturnCode (void *ctx); -const char * xmlNanoHTTPAuthHeader(void *ctx); -int xmlNanoHTTPRead (void *ctx, - void *dest, - int len); -int xmlNanoHTTPSave (void *ctxt, - const char *filename); -void xmlNanoHTTPClose (void *ctx); -#ifdef __cplusplus -} - -#endif /* LIBXML_HTTP_ENABLED */ -#endif -#endif /* __NANO_HTTP_H__ */ diff --git a/plugins/Variables/src/libxml/parserInternals.h b/plugins/Variables/src/libxml/parserInternals.h deleted file mode 100644 index 8507442be8..0000000000 --- a/plugins/Variables/src/libxml/parserInternals.h +++ /dev/null @@ -1,413 +0,0 @@ -/* - * parserInternals.h : internals routines exported by the parser. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - * - */ - -#ifndef __XML_PARSER_INTERNALS_H__ -#define __XML_PARSER_INTERNALS_H__ - -#include <libxml/parser.h> -#include <libxml/HTMLparser.h> - -#ifdef __cplusplus -extern "C" { -#endif - - /** - * XML_MAX_NAMELEN: - * - * Identifiers can be longer, but this will be more costly - * at runtime. - */ -#define XML_MAX_NAMELEN 100 - -/** - * INPUT_CHUNK: - * - * The parser tries to always have that amount of input ready. - * One of the point is providing context when reporting errors. - */ -#define INPUT_CHUNK 250 - -/************************************************************************ - * * - * UNICODE version of the macros. * - * * - ************************************************************************/ -/** - * IS_CHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] - * | [#x10000-#x10FFFF] - * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. - */ -#define IS_CHAR(c) \ - ((((c) >= 0x20) && ((c) <= 0xD7FF)) || \ - ((c) == 0x09) || ((c) == 0x0A) || ((c) == 0x0D) || \ - (((c) >= 0xE000) && ((c) <= 0xFFFD)) || \ - (((c) >= 0x10000) && ((c) <= 0x10FFFF))) - -/** - * IS_BLANK: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [3] S ::= (#x20 | #x9 | #xD | #xA)+ - */ -#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \ - ((c) == 0x0D)) - -/** - * IS_BASECHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [85] BaseChar ::= ... long list see REC ... - */ -#define IS_BASECHAR(c) xmlIsBaseChar(c) - -/** - * IS_DIGIT: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [88] Digit ::= ... long list see REC ... - */ -#define IS_DIGIT(c) xmlIsDigit(c) - -/** - * IS_COMBINING: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [87] CombiningChar ::= ... long list see REC ... - */ -#define IS_COMBINING(c) xmlIsCombining(c) - -/** - * IS_EXTENDER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | - * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | - * [#x309D-#x309E] | [#x30FC-#x30FE] - */ -#define IS_EXTENDER(c) xmlIsExtender(c) - -/** - * IS_IDEOGRAPHIC: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] - */ -#define IS_IDEOGRAPHIC(c) xmlIsIdeographic(c) - -/** - * IS_LETTER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [84] Letter ::= BaseChar | Ideographic - */ -#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) - - -/** - * IS_PUBIDCHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] - */ -#define IS_PUBIDCHAR(c) xmlIsPubidChar(c) - -/** - * SKIP_EOL: - * @p: and UTF8 string pointer - * - * Skips the end of line chars. - */ -#define SKIP_EOL(p) \ - if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ - if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } - -/** - * MOVETO_ENDTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '>' char. - */ -#define MOVETO_ENDTAG(p) \ - while ((*p) && (*(p) != '>')) (p)++ - -/** - * MOVETO_STARTTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '<' char. - */ -#define MOVETO_STARTTAG(p) \ - while ((*p) && (*(p) != '<')) (p)++ - -/** - * Global variables used for predefined strings. - */ -LIBXML_DLL_IMPORT extern const xmlChar xmlStringText[]; -LIBXML_DLL_IMPORT extern const xmlChar xmlStringTextNoenc[]; -LIBXML_DLL_IMPORT extern const xmlChar xmlStringComment[]; - -/* - * Function to finish the work of the macros where needed. - */ -int xmlIsBaseChar (int c); -int xmlIsBlank (int c); -int xmlIsPubidChar (int c); -int xmlIsLetter (int c); -int xmlIsDigit (int c); -int xmlIsIdeographic(int c); -int xmlIsExtender (int c); -int xmlIsCombining (int c); -int xmlIsChar (int c); - -/** - * Parser context. - */ -xmlParserCtxtPtr xmlCreateFileParserCtxt (const char *filename); -xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, - int size); -xmlParserCtxtPtr xmlNewParserCtxt (void); -xmlParserCtxtPtr xmlCreateEntityParserCtxt(const xmlChar *URL, - const xmlChar *ID, - const xmlChar *base); -int xmlSwitchEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncoding enc); -int xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncodingHandlerPtr handler); - -/** - * Entities - */ -void xmlHandleEntity (xmlParserCtxtPtr ctxt, - xmlEntityPtr entity); - -/** - * Input Streams. - */ -xmlParserInputPtr xmlNewStringInputStream (xmlParserCtxtPtr ctxt, - const xmlChar *buffer); -xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, - xmlEntityPtr entity); -void xmlPushInput (xmlParserCtxtPtr ctxt, - xmlParserInputPtr input); -xmlChar xmlPopInput (xmlParserCtxtPtr ctxt); -void xmlFreeInputStream (xmlParserInputPtr input); -xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt, - const char *filename); -xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt); - -/** - * Namespaces. - */ -xmlChar * xmlSplitQName (xmlParserCtxtPtr ctxt, - const xmlChar *name, - xmlChar **prefix); -xmlChar * xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); -xmlChar * xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, - xmlChar **prefix); -xmlChar * xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseQuotedString (xmlParserCtxtPtr ctxt); -void xmlParseNamespace (xmlParserCtxtPtr ctxt); - -/** - * Generic production rules. - */ -xmlChar * xmlScanName (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseName (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseNmtoken (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseEntityValue (xmlParserCtxtPtr ctxt, - xmlChar **orig); -xmlChar * xmlParseAttValue (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); -xmlChar * xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); -void xmlParseCharData (xmlParserCtxtPtr ctxt, - int cdata); -xmlChar * xmlParseExternalID (xmlParserCtxtPtr ctxt, - xmlChar **publicID, - int strict); -void xmlParseComment (xmlParserCtxtPtr ctxt); -xmlChar * xmlParsePITarget (xmlParserCtxtPtr ctxt); -void xmlParsePI (xmlParserCtxtPtr ctxt); -void xmlParseNotationDecl (xmlParserCtxtPtr ctxt); -void xmlParseEntityDecl (xmlParserCtxtPtr ctxt); -int xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, - xmlChar **value); -xmlEnumerationPtr xmlParseNotationType (xmlParserCtxtPtr ctxt); -xmlEnumerationPtr xmlParseEnumerationType (xmlParserCtxtPtr ctxt); -int xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -int xmlParseAttributeType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -void xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); -xmlElementContentPtr xmlParseElementMixedContentDecl - (xmlParserCtxtPtr ctxt, - xmlParserInputPtr inputchk); -xmlElementContentPtr xmlParseElementChildrenContentDecl - (xmlParserCtxtPtr ctxt, - xmlParserInputPtr inputchk); -int xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, - xmlChar *name, - xmlElementContentPtr *result); -int xmlParseElementDecl (xmlParserCtxtPtr ctxt); -void xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); -int xmlParseCharRef (xmlParserCtxtPtr ctxt); -xmlEntityPtr xmlParseEntityRef (xmlParserCtxtPtr ctxt); -void xmlParseReference (xmlParserCtxtPtr ctxt); -void xmlParsePEReference (xmlParserCtxtPtr ctxt); -void xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseAttribute (xmlParserCtxtPtr ctxt, - xmlChar **value); -xmlChar * xmlParseStartTag (xmlParserCtxtPtr ctxt); -void xmlParseEndTag (xmlParserCtxtPtr ctxt); -void xmlParseCDSect (xmlParserCtxtPtr ctxt); -void xmlParseContent (xmlParserCtxtPtr ctxt); -void xmlParseElement (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseVersionNum (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseVersionInfo (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseEncName (xmlParserCtxtPtr ctxt); -xmlChar * xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); -int xmlParseSDDecl (xmlParserCtxtPtr ctxt); -void xmlParseXMLDecl (xmlParserCtxtPtr ctxt); -void xmlParseTextDecl (xmlParserCtxtPtr ctxt); -void xmlParseMisc (xmlParserCtxtPtr ctxt); -void xmlParseExternalSubset (xmlParserCtxtPtr ctxt, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * XML_SUBSTITUTE_NONE: - * - * If no entities need to be substituted. - */ -#define XML_SUBSTITUTE_NONE 0 -/** - * XML_SUBSTITUTE_REF: - * - * Whether general entities need to be substituted. - */ -#define XML_SUBSTITUTE_REF 1 -/** - * XML_SUBSTITUTE_PEREF: - * - * Whether parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_PEREF 2 -/** - * XML_SUBSTITUTE_BOTH: - * - * Both general and parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_BOTH 3 - -xmlChar * xmlDecodeEntities (xmlParserCtxtPtr ctxt, - int len, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); -xmlChar * xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, - const xmlChar *str, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); - -/* - * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. - */ -int nodePush (xmlParserCtxtPtr ctxt, - xmlNodePtr value); -xmlNodePtr nodePop (xmlParserCtxtPtr ctxt); -int inputPush (xmlParserCtxtPtr ctxt, - xmlParserInputPtr value); -xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt); -xmlChar *namePop (xmlParserCtxtPtr ctxt); -int namePush (xmlParserCtxtPtr ctxt, - xmlChar *value); - -/* - * other commodities shared between parser.c and parserInternals. - */ -int xmlSkipBlankChars (xmlParserCtxtPtr ctxt); -int xmlStringCurrentChar (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - int *len); -void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); -void xmlParserHandleReference(xmlParserCtxtPtr ctxt); -int xmlCheckLanguageID (const xmlChar *lang); - -/* - * Really core function shared with HTML parser. - */ -int xmlCurrentChar (xmlParserCtxtPtr ctxt, - int *len); -int xmlCopyCharMultiByte (xmlChar *out, - int val); -int xmlCopyChar (int len, - xmlChar *out, - int val); -void xmlNextChar (xmlParserCtxtPtr ctxt); -void xmlParserInputShrink (xmlParserInputPtr in); - -#ifdef LIBXML_HTML_ENABLED -/* - * Actually comes from the HTML parser but launched from the init stuff. - */ -void htmlInitAutoClose (void); -htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename, - const char *encoding); -#endif - -/* - * Specific function to keep track of entities references - * and used by the XSLT debugger. - */ -/** - * xmlEntityReferenceFunc: - * @ent: the entity - * @firstNode: the fist node in the chunk - * @lastNode: the last nod in the chunk - * - * Callback function used when one needs to be able to track back the - * provenance of a chunk of nodes inherited from an entity replacement. - */ -typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, - xmlNodePtr firstNode, - xmlNodePtr lastNode); - -void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); - - -#ifdef __cplusplus -} -#endif -#endif /* __XML_PARSER_INTERNALS_H__ */ diff --git a/plugins/Variables/src/libxml/schemasInternals.h b/plugins/Variables/src/libxml/schemasInternals.h deleted file mode 100644 index fb1f7eeb39..0000000000 --- a/plugins/Variables/src/libxml/schemasInternals.h +++ /dev/null @@ -1,354 +0,0 @@ -/* - * schemasInternals.h : internal interfaces for the XML Schemas handling - * and schema validity checking - * - * See Copyright for the status of this software. - * - * Daniel.Veillard@w3.org - */ - - -#ifndef __XML_SCHEMA_INTERNALS_H__ -#define __XML_SCHEMA_INTERNALS_H__ - -#include <libxml/xmlversion.h> - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include <libxml/xmlregexp.h> -#include <libxml/hash.h> - -#ifdef __cplusplus -extern "C" { -#endif - - -/* - * XML Schemas defines multiple type of types. - */ -typedef enum { - XML_SCHEMA_TYPE_BASIC = 1, - XML_SCHEMA_TYPE_ANY, - XML_SCHEMA_TYPE_FACET, - XML_SCHEMA_TYPE_SIMPLE, - XML_SCHEMA_TYPE_COMPLEX, - XML_SCHEMA_TYPE_SEQUENCE, - XML_SCHEMA_TYPE_CHOICE, - XML_SCHEMA_TYPE_ALL, - XML_SCHEMA_TYPE_SIMPLE_CONTENT, - XML_SCHEMA_TYPE_COMPLEX_CONTENT, - XML_SCHEMA_TYPE_UR, - XML_SCHEMA_TYPE_RESTRICTION, - XML_SCHEMA_TYPE_EXTENSION, - XML_SCHEMA_TYPE_ELEMENT, - XML_SCHEMA_TYPE_ATTRIBUTE, - XML_SCHEMA_TYPE_ATTRIBUTEGROUP, - XML_SCHEMA_TYPE_GROUP, - XML_SCHEMA_TYPE_NOTATION, - XML_SCHEMA_TYPE_LIST, - XML_SCHEMA_TYPE_UNION, - XML_SCHEMA_FACET_MININCLUSIVE = 1000, - XML_SCHEMA_FACET_MINEXCLUSIVE, - XML_SCHEMA_FACET_MAXINCLUSIVE, - XML_SCHEMA_FACET_MAXEXCLUSIVE, - XML_SCHEMA_FACET_TOTALDIGITS, - XML_SCHEMA_FACET_FRACTIONDIGITS, - XML_SCHEMA_FACET_PATTERN, - XML_SCHEMA_FACET_ENUMERATION, - XML_SCHEMA_FACET_WHITESPACE, - XML_SCHEMA_FACET_LENGTH, - XML_SCHEMA_FACET_MAXLENGTH, - XML_SCHEMA_FACET_MINLENGTH -} xmlSchemaTypeType; - -typedef enum { - XML_SCHEMA_CONTENT_UNKNOWN = 0, - XML_SCHEMA_CONTENT_EMPTY = 1, - XML_SCHEMA_CONTENT_ELEMENTS, - XML_SCHEMA_CONTENT_MIXED, - XML_SCHEMA_CONTENT_SIMPLE, - XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, - XML_SCHEMA_CONTENT_BASIC, - XML_SCHEMA_CONTENT_ANY -} xmlSchemaContentType; - -typedef struct _xmlSchemaVal xmlSchemaVal; -typedef xmlSchemaVal *xmlSchemaValPtr; - -typedef struct _xmlSchemaType xmlSchemaType; -typedef xmlSchemaType *xmlSchemaTypePtr; - -typedef struct _xmlSchemaFacet xmlSchemaFacet; -typedef xmlSchemaFacet *xmlSchemaFacetPtr; - -/** - * Annotation - */ -typedef struct _xmlSchemaAnnot xmlSchemaAnnot; -typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; -struct _xmlSchemaAnnot { - struct _xmlSchemaAnnot *next; - xmlNodePtr content; /* the annotation */ -}; - -/** - * An attribute definition. - */ - -#define XML_SCHEMAS_ANYATTR_SKIP 1 -#define XML_SCHEMAS_ANYATTR_LAX 2 -#define XML_SCHEMAS_ANYATTR_STRICT 3 - -typedef struct _xmlSchemaAttribute xmlSchemaAttribute; -typedef xmlSchemaAttribute *xmlSchemaAttributePtr; -struct _xmlSchemaAttribute { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ - xmlChar *name; - xmlChar *id; - xmlChar *ref; - xmlChar *refNs; - xmlChar *typeName; - xmlChar *typeNs; - xmlSchemaAnnotPtr annot; - - xmlSchemaTypePtr base; - int occurs; - xmlChar *defValue; - xmlSchemaTypePtr subtypes; -}; - -/** - * An attribute group definition. - * - * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures - * must be kept similar - */ -typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; -typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; -struct _xmlSchemaAttributeGroup { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ - xmlChar *name; - xmlChar *id; - xmlChar *ref; - xmlChar *refNs; - xmlSchemaAnnotPtr annot; - - xmlSchemaAttributePtr attributes; -}; - - -/** - * XML_SCHEMAS_TYPE_MIXED: - * - * the element content type is mixed - */ -#define XML_SCHEMAS_TYPE_MIXED 1 << 0 - -/** - * _xmlSchemaType: - * - * Schemas type definition. - */ -struct _xmlSchemaType { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaType *next;/* the next type if in a sequence ... */ - xmlChar *name; - xmlChar *id; - xmlChar *ref; - xmlChar *refNs; - xmlSchemaAnnotPtr annot; - xmlSchemaTypePtr subtypes; - xmlSchemaAttributePtr attributes; - xmlNodePtr node; - int minOccurs; - int maxOccurs; - - int flags; - xmlSchemaContentType contentType; - xmlChar *base; - xmlChar *baseNs; - xmlSchemaTypePtr baseType; - xmlSchemaFacetPtr facets; -}; - -/** - * xmlSchemaElement: - * An element definition. - * - * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of - * structures must be kept similar - */ -/** - * XML_SCHEMAS_ELEM_NILLABLE: - * - * the element is nillable - */ -#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 -/** - * XML_SCHEMAS_ELEM_GLOBAL: - * - * the element is global - */ -#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 -/** - * XML_SCHEMAS_ELEM_DEFAULT: - * - * the element has a default value - */ -#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 -/** - * XML_SCHEMAS_ELEM_FIXED: - * - * the element has a fixed value - */ -#define XML_SCHEMAS_ELEM_FIXED 1 << 3 -/** - * XML_SCHEMAS_ELEM_ABSTRACT: - * - * the element is abstract - */ -#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 -/** - * XML_SCHEMAS_ELEM_TOPLEVEL: - * - * the element is top level - */ -#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 -/** - * XML_SCHEMAS_ELEM_REF: - * - * the element is a reference to a type - */ -#define XML_SCHEMAS_ELEM_REF 1 << 6 - -typedef struct _xmlSchemaElement xmlSchemaElement; -typedef xmlSchemaElement *xmlSchemaElementPtr; -struct _xmlSchemaElement { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaType *next;/* the next type if in a sequence ... */ - xmlChar *name; - xmlChar *id; - xmlChar *ref; - xmlChar *refNs; - xmlSchemaAnnotPtr annot; - xmlSchemaTypePtr subtypes; - xmlSchemaAttributePtr attributes; - xmlNodePtr node; - int minOccurs; - int maxOccurs; - - int flags; - xmlChar *targetNamespace; - xmlChar *namedType; - xmlChar *namedTypeNs; - xmlChar *substGroup; - xmlChar *substGroupNs; - xmlChar *scope; - xmlChar *value; - struct _xmlSchemaElement *refDecl; - xmlRegexpPtr contModel; - xmlSchemaContentType contentType; -}; - -/* - * XML_SCHEMAS_FACET_UNKNOWN: - * - * unknown facet handling - */ -#define XML_SCHEMAS_FACET_UNKNOWN 0 -/* - * XML_SCHEMAS_FACET_PRESERVE: - * - * preserve the type of the facet - */ -#define XML_SCHEMAS_FACET_PRESERVE 1 -/* - * XML_SCHEMAS_FACET_REPLACE: - * - * replace the type of the facet - */ -#define XML_SCHEMAS_FACET_REPLACE 2 -/* - * XML_SCHEMAS_FACET_COLLAPSE: - * - * collapse the types of the facet - */ -#define XML_SCHEMAS_FACET_COLLAPSE 3 - -/** - * A facet definition. - */ -struct _xmlSchemaFacet { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ - xmlChar *value; - xmlChar *id; - xmlSchemaAnnotPtr annot; - xmlNodePtr node; - int fixed; - int whitespace; - xmlSchemaValPtr val; - xmlRegexpPtr regexp; -}; - -/** - * A notation definition. - */ -typedef struct _xmlSchemaNotation xmlSchemaNotation; -typedef xmlSchemaNotation *xmlSchemaNotationPtr; -struct _xmlSchemaNotation { - xmlSchemaTypeType type; /* The kind of type */ - xmlChar *name; - xmlSchemaAnnotPtr annot; - xmlChar *identifier; -}; - -/** - * XML_SCHEMAS_QUALIF_ELEM: - * - * the shemas requires qualified elements - */ -#define XML_SCHEMAS_QUALIF_ELEM 1 << 0 -/** - * XML_SCHEMAS_QUALIF_ATTR: - * - * the shemas requires qualified attributes - */ -#define XML_SCHEMAS_QUALIF_ATTR 1 << 1 -/** - * _xmlSchema: - * - * A Schemas definition - */ -struct _xmlSchema { - xmlChar *name; /* schema name */ - xmlChar *targetNamespace; /* the target namespace */ - xmlChar *version; - xmlChar *id; - xmlDocPtr doc; - xmlSchemaAnnotPtr annot; - int flags; - - xmlHashTablePtr typeDecl; - xmlHashTablePtr attrDecl; - xmlHashTablePtr attrgrpDecl; - xmlHashTablePtr elemDecl; - xmlHashTablePtr notaDecl; - - xmlHashTablePtr schemasImports; - - void *_private; /* unused by the library for users or bindings */ -}; - -void xmlSchemaFreeType (xmlSchemaTypePtr type); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_INTERNALS_H__ */ - - diff --git a/plugins/Variables/src/libxml/uri.h b/plugins/Variables/src/libxml/uri.h deleted file mode 100644 index 319c509d1b..0000000000 --- a/plugins/Variables/src/libxml/uri.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * uri.c: library of generic URI related routines - * - * Reference: RFC 2396 - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#ifndef __XML_URI_H__ -#define __XML_URI_H__ - -#include <libxml/tree.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlURI: - * - * A parsed URI reference. This is a struct containing the various fields - * as described in RFC 2396 but separated for further processing. - */ -typedef struct _xmlURI xmlURI; -typedef xmlURI *xmlURIPtr; -struct _xmlURI { - char *scheme; /* the URI scheme */ - char *opaque; /* opaque part */ - char *authority; /* the authority part */ - char *server; /* the server part */ - char *user; /* the user part */ - int port; /* the port number */ - char *path; /* the path string */ - char *query; /* the query string */ - char *fragment; /* the fragment identifier */ - int cleanup; /* parsing potentially unclean URI */ -}; - -/* - * This function is in tree.h: - * xmlChar * xmlNodeGetBase (xmlDocPtr doc, - * xmlNodePtr cur); - */ -xmlURIPtr xmlCreateURI (void); -xmlChar * xmlBuildURI (const xmlChar *URI, - const xmlChar *base); -xmlURIPtr xmlParseURI (const char *str); -int xmlParseURIReference (xmlURIPtr uri, - const char *str); -xmlChar * xmlSaveUri (xmlURIPtr uri); -void xmlPrintURI (FILE *stream, - xmlURIPtr uri); -xmlChar * xmlURIEscapeStr (const xmlChar *str, - const xmlChar *list); -char * xmlURIUnescapeString (const char *str, - int len, - char *target); -int xmlNormalizeURIPath (char *path); -xmlChar * xmlURIEscape (const xmlChar *str); -void xmlFreeURI (xmlURIPtr uri); -xmlChar* xmlCanonicPath (const xmlChar *path); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_URI_H__ */ diff --git a/plugins/Variables/src/libxml/xmlschemas.h b/plugins/Variables/src/libxml/xmlschemas.h deleted file mode 100644 index 14b9230832..0000000000 --- a/plugins/Variables/src/libxml/xmlschemas.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * schemas.h : interface to the XML Schemas handling and schema validity - * checking - * - * See Copyright for the status of this software. - * - * Daniel.Veillard@w3.org - */ - - -#ifndef __XML_SCHEMA_H__ -#define __XML_SCHEMA_H__ - -#include <libxml/xmlversion.h> - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include <libxml/tree.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - XML_SCHEMAS_ERR_OK = 0, - XML_SCHEMAS_ERR_NOROOT = 1, - XML_SCHEMAS_ERR_UNDECLAREDELEM, - XML_SCHEMAS_ERR_NOTTOPLEVEL, - XML_SCHEMAS_ERR_MISSING, - XML_SCHEMAS_ERR_WRONGELEM, - XML_SCHEMAS_ERR_NOTYPE, - XML_SCHEMAS_ERR_NOROLLBACK, - XML_SCHEMAS_ERR_ISABSTRACT, - XML_SCHEMAS_ERR_NOTEMPTY, - XML_SCHEMAS_ERR_ELEMCONT, - XML_SCHEMAS_ERR_HAVEDEFAULT, - XML_SCHEMAS_ERR_NOTNILLABLE, - XML_SCHEMAS_ERR_EXTRACONTENT, - XML_SCHEMAS_ERR_INVALIDATTR, - XML_SCHEMAS_ERR_INVALIDELEM, - XML_SCHEMAS_ERR_NOTDETERMINIST, - XML_SCHEMAS_ERR_CONSTRUCT, - XML_SCHEMAS_ERR_INTERNAL, - XML_SCHEMAS_ERR_NOTSIMPLE, - XML_SCHEMAS_ERR_ATTRUNKNOWN, - XML_SCHEMAS_ERR_ATTRINVALID, - XML_SCHEMAS_ERR_, - XML_SCHEMAS_ERR_XXX -} xmlSchemaValidError; - - -/** - * The schemas related types are kept internal - */ -typedef struct _xmlSchema xmlSchema; -typedef xmlSchema *xmlSchemaPtr; - -/** - * A schemas validation context - */ -typedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...); -typedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...); - -typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; -typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; - -typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; -typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; - -/* - * Interfaces for parsing. - */ -xmlSchemaParserCtxtPtr xmlSchemaNewParserCtxt (const char *URL); -xmlSchemaParserCtxtPtr xmlSchemaNewMemParserCtxt(const char *buffer, - int size); -void xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); -void xmlSchemaSetParserErrors(xmlSchemaParserCtxtPtr ctxt, - xmlSchemaValidityErrorFunc err, - xmlSchemaValidityWarningFunc warn, - void *ctx); -xmlSchemaPtr xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); -void xmlSchemaFree (xmlSchemaPtr schema); -void xmlSchemaDump (FILE *output, - xmlSchemaPtr schema); -/* - * Interfaces for validating - */ -void xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, - xmlSchemaValidityErrorFunc err, - xmlSchemaValidityWarningFunc warn, - void *ctx); -xmlSchemaValidCtxtPtr xmlSchemaNewValidCtxt (xmlSchemaPtr schema); -void xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); -int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, - xmlDocPtr instance); -int xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, - xmlParserInputBufferPtr input, - xmlCharEncoding enc, - xmlSAXHandlerPtr sax, - void *user_data); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_H__ */ diff --git a/plugins/Variables/src/libxml/xmlschemastypes.h b/plugins/Variables/src/libxml/xmlschemastypes.h deleted file mode 100644 index a758c128e5..0000000000 --- a/plugins/Variables/src/libxml/xmlschemastypes.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * schemastypes.c : interface of the XML Schema Datatypes - * definition and validity checking - * - * See Copyright for the status of this software. - * - * Daniel Veillard <veillard@redhat.com> - */ - - -#ifndef __XML_SCHEMA_TYPES_H__ -#define __XML_SCHEMA_TYPES_H__ - -#include <libxml/xmlversion.h> - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include <libxml/schemasInternals.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void xmlSchemaInitTypes (void); -void xmlSchemaCleanupTypes (void); -xmlSchemaTypePtr xmlSchemaGetPredefinedType (const xmlChar *name, - const xmlChar *ns); -int xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val); -int xmlSchemaValidateFacet (xmlSchemaTypePtr base, - xmlSchemaFacetPtr facet, - const xmlChar *value, - xmlSchemaValPtr val); -void xmlSchemaFreeValue (xmlSchemaValPtr val); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_TYPES_H__ */ diff --git a/plugins/Variables/src/libxml/xmlunicode.h b/plugins/Variables/src/libxml/xmlunicode.h deleted file mode 100644 index f0f1fe9ce9..0000000000 --- a/plugins/Variables/src/libxml/xmlunicode.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * xmlunicode.h: this header exports interfaces for the Unicode character APIs - * - * This file is automatically generated from the - * UCS description files of the Unicode Character Database - * http://www.unicode.org/Public/3.1-Update/UnicodeCharacterDatabase-3.1.0.html - * using the genUnicode.py Python script. - * - * Generation date: Tue Apr 16 17:28:05 2002 - * Sources: Blocks-4.txt UnicodeData-3.1.0.txt - * Daniel Veillard <veillard@redhat.com> - */ - -#ifndef __XML_UNICODE_H__ -#define __XML_UNICODE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -int xmlUCSIsAlphabeticPresentationForms (int code); -int xmlUCSIsArabic (int code); -int xmlUCSIsArabicPresentationFormsA (int code); -int xmlUCSIsArabicPresentationFormsB (int code); -int xmlUCSIsArmenian (int code); -int xmlUCSIsArrows (int code); -int xmlUCSIsBasicLatin (int code); -int xmlUCSIsBengali (int code); -int xmlUCSIsBlockElements (int code); -int xmlUCSIsBopomofo (int code); -int xmlUCSIsBopomofoExtended (int code); -int xmlUCSIsBoxDrawing (int code); -int xmlUCSIsBraillePatterns (int code); -int xmlUCSIsByzantineMusicalSymbols (int code); -int xmlUCSIsCJKCompatibility (int code); -int xmlUCSIsCJKCompatibilityForms (int code); -int xmlUCSIsCJKCompatibilityIdeographs (int code); -int xmlUCSIsCJKCompatibilityIdeographsSupplement (int code); -int xmlUCSIsCJKRadicalsSupplement (int code); -int xmlUCSIsCJKSymbolsandPunctuation (int code); -int xmlUCSIsCJKUnifiedIdeographs (int code); -int xmlUCSIsCJKUnifiedIdeographsExtensionA (int code); -int xmlUCSIsCJKUnifiedIdeographsExtensionB (int code); -int xmlUCSIsCherokee (int code); -int xmlUCSIsCombiningDiacriticalMarks (int code); -int xmlUCSIsCombiningHalfMarks (int code); -int xmlUCSIsCombiningMarksforSymbols (int code); -int xmlUCSIsControlPictures (int code); -int xmlUCSIsCurrencySymbols (int code); -int xmlUCSIsCyrillic (int code); -int xmlUCSIsDeseret (int code); -int xmlUCSIsDevanagari (int code); -int xmlUCSIsDingbats (int code); -int xmlUCSIsEnclosedAlphanumerics (int code); -int xmlUCSIsEnclosedCJKLettersandMonths (int code); -int xmlUCSIsEthiopic (int code); -int xmlUCSIsGeneralPunctuation (int code); -int xmlUCSIsGeometricShapes (int code); -int xmlUCSIsGeorgian (int code); -int xmlUCSIsGothic (int code); -int xmlUCSIsGreek (int code); -int xmlUCSIsGreekExtended (int code); -int xmlUCSIsGujarati (int code); -int xmlUCSIsGurmukhi (int code); -int xmlUCSIsHalfwidthandFullwidthForms (int code); -int xmlUCSIsHangulCompatibilityJamo (int code); -int xmlUCSIsHangulJamo (int code); -int xmlUCSIsHangulSyllables (int code); -int xmlUCSIsHebrew (int code); -int xmlUCSIsHighPrivateUseSurrogates (int code); -int xmlUCSIsHighSurrogates (int code); -int xmlUCSIsHiragana (int code); -int xmlUCSIsIPAExtensions (int code); -int xmlUCSIsIdeographicDescriptionCharacters (int code); -int xmlUCSIsKanbun (int code); -int xmlUCSIsKangxiRadicals (int code); -int xmlUCSIsKannada (int code); -int xmlUCSIsKatakana (int code); -int xmlUCSIsKhmer (int code); -int xmlUCSIsLao (int code); -int xmlUCSIsLatin1Supplement (int code); -int xmlUCSIsLatinExtendedA (int code); -int xmlUCSIsLatinExtendedB (int code); -int xmlUCSIsLatinExtendedAdditional (int code); -int xmlUCSIsLetterlikeSymbols (int code); -int xmlUCSIsLowSurrogates (int code); -int xmlUCSIsMalayalam (int code); -int xmlUCSIsMathematicalAlphanumericSymbols (int code); -int xmlUCSIsMathematicalOperators (int code); -int xmlUCSIsMiscellaneousSymbols (int code); -int xmlUCSIsMiscellaneousTechnical (int code); -int xmlUCSIsMongolian (int code); -int xmlUCSIsMusicalSymbols (int code); -int xmlUCSIsMyanmar (int code); -int xmlUCSIsNumberForms (int code); -int xmlUCSIsOgham (int code); -int xmlUCSIsOldItalic (int code); -int xmlUCSIsOpticalCharacterRecognition (int code); -int xmlUCSIsOriya (int code); -int xmlUCSIsPrivateUse (int code); -int xmlUCSIsRunic (int code); -int xmlUCSIsSinhala (int code); -int xmlUCSIsSmallFormVariants (int code); -int xmlUCSIsSpacingModifierLetters (int code); -int xmlUCSIsSpecials (int code); -int xmlUCSIsSuperscriptsandSubscripts (int code); -int xmlUCSIsSyriac (int code); -int xmlUCSIsTags (int code); -int xmlUCSIsTamil (int code); -int xmlUCSIsTelugu (int code); -int xmlUCSIsThaana (int code); -int xmlUCSIsThai (int code); -int xmlUCSIsTibetan (int code); -int xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code); -int xmlUCSIsYiRadicals (int code); -int xmlUCSIsYiSyllables (int code); - -int xmlUCSIsBlock (int code, - const char *block); - -int xmlUCSIsCatC (int code); -int xmlUCSIsCatCc (int code); -int xmlUCSIsCatCf (int code); -int xmlUCSIsCatCo (int code); -int xmlUCSIsCatCs (int code); -int xmlUCSIsCatL (int code); -int xmlUCSIsCatLl (int code); -int xmlUCSIsCatLm (int code); -int xmlUCSIsCatLo (int code); -int xmlUCSIsCatLt (int code); -int xmlUCSIsCatLu (int code); -int xmlUCSIsCatM (int code); -int xmlUCSIsCatMc (int code); -int xmlUCSIsCatMe (int code); -int xmlUCSIsCatMn (int code); -int xmlUCSIsCatN (int code); -int xmlUCSIsCatNd (int code); -int xmlUCSIsCatNl (int code); -int xmlUCSIsCatNo (int code); -int xmlUCSIsCatP (int code); -int xmlUCSIsCatPc (int code); -int xmlUCSIsCatPd (int code); -int xmlUCSIsCatPe (int code); -int xmlUCSIsCatPf (int code); -int xmlUCSIsCatPi (int code); -int xmlUCSIsCatPo (int code); -int xmlUCSIsCatPs (int code); -int xmlUCSIsCatS (int code); -int xmlUCSIsCatSc (int code); -int xmlUCSIsCatSk (int code); -int xmlUCSIsCatSm (int code); -int xmlUCSIsCatSo (int code); -int xmlUCSIsCatZ (int code); -int xmlUCSIsCatZl (int code); -int xmlUCSIsCatZp (int code); -int xmlUCSIsCatZs (int code); - -int xmlUCSIsCat (int code, - const char *cat); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_UNICODE_H__ */ diff --git a/plugins/Variables/src/libxml/xpathInternals.h b/plugins/Variables/src/libxml/xpathInternals.h deleted file mode 100644 index 59a4e35d53..0000000000 --- a/plugins/Variables/src/libxml/xpathInternals.h +++ /dev/null @@ -1,580 +0,0 @@ -/* - * xpathInternals.c: internal interfaces for XML Path Language implementation - * used to build new modules on top of XPath - * - * See COPYRIGHT for the status of this software - * - * Author: daniel@veillard.com - */ - -#ifndef __XML_XPATH_INTERNALS_H__ -#define __XML_XPATH_INTERNALS_H__ - -#include <libxml/xmlversion.h> -#include <libxml/xpath.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/************************************************************************ - * * - * Helpers * - * * - ************************************************************************/ - -/** - * Many of these macros may later turn into functions. They - * shouldn't be used in #ifdef's preprocessor instructions. - */ -/** - * xmlXPathSetError: - * @ctxt: an XPath parser context - * @err: an xmlXPathError code - * - * Raises an error. - */ -#define xmlXPathSetError(ctxt, err) \ - { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ - (ctxt)->error = (err); } - -/** - * xmlXPathSetArityError: - * @ctxt: an XPath parser context - * - * Raises an XPATH_INVALID_ARITY error. - */ -#define xmlXPathSetArityError(ctxt) \ - xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) - -/** - * xmlXPathSetTypeError: - * @ctxt: an XPath parser context - * - * Raises an XPATH_INVALID_TYPE error. - */ -#define xmlXPathSetTypeError(ctxt) \ - xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) - -/** - * xmlXPathGetError: - * @ctxt: an XPath parser context - * - * Get the error code of an XPath context. - * - * Returns the context error. - */ -#define xmlXPathGetError(ctxt) ((ctxt)->error) - -/** - * xmlXPathCheckError: - * @ctxt: an XPath parser context - * - * Check if an XPath error was raised. - * - * Returns true if an error has been raised, false otherwise. - */ -#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) - -/** - * xmlXPathGetDocument: - * @ctxt: an XPath parser context - * - * Get the document of an XPath context. - * - * Returns the context document. - */ -#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) - -/** - * xmlXPathGetContextNode: - * @ctxt: an XPath parser context - * - * Get the context node of an XPath context. - * - * Returns the context node. - */ -#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) - -int xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); -double xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); -xmlChar * xmlXPathPopString (xmlXPathParserContextPtr ctxt); -xmlNodeSetPtr xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); -void * xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); - -/** - * xmlXPathReturnBoolean: - * @ctxt: an XPath parser context - * @val: a boolean - * - * Pushes the boolean @val on the context stack. - */ -#define xmlXPathReturnBoolean(ctxt, val) \ - valuePush((ctxt), xmlXPathNewBoolean(val)) - -/** - * xmlXPathReturnTrue: - * @ctxt: an XPath parser context - * - * Pushes true on the context stack. - */ -#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) - -/** - * xmlXPathReturnFalse: - * @ctxt: an XPath parser context - * - * Pushes false on the context stack. - */ -#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) - -/** - * xmlXPathReturnNumber: - * @ctxt: an XPath parser context - * @val: a double - * - * Pushes the double @val on the context stack. - */ -#define xmlXPathReturnNumber(ctxt, val) \ - valuePush((ctxt), xmlXPathNewFloat(val)) - -/** - * xmlXPathReturnString: - * @ctxt: an XPath parser context - * @str: a string - * - * Pushes the string @str on the context stack. - */ -#define xmlXPathReturnString(ctxt, str) \ - valuePush((ctxt), xmlXPathWrapString(str)) - -/** - * xmlXPathReturnEmptyString: - * @ctxt: an XPath parser context - * - * Pushes an empty string on the stack. - */ -#define xmlXPathReturnEmptyString(ctxt) \ - valuePush((ctxt), xmlXPathNewCString("")) - -/** - * xmlXPathReturnNodeSet: - * @ctxt: an XPath parser context - * @ns: a node-set - * - * Pushes the node-set @ns on the context stack. - */ -#define xmlXPathReturnNodeSet(ctxt, ns) \ - valuePush((ctxt), xmlXPathWrapNodeSet(ns)) - -/** - * xmlXPathReturnEmptyNodeSet: - * @ctxt: an XPath parser context - * - * Pushes an empty node-set on the context stack. - */ -#define xmlXPathReturnEmptyNodeSet(ctxt) \ - valuePush((ctxt), xmlXPathNewNodeSet(NULL)) - -/** - * xmlXPathReturnExternal: - * @ctxt: an XPath parser context - * @val: user data - * - * Pushes user data on the context stack. - */ -#define xmlXPathReturnExternal(ctxt, val) \ - valuePush((ctxt), xmlXPathWrapExternal(val)) - -/** - * xmlXPathStackIsNodeSet: - * @ctxt: an XPath parser context - * - * Check if the current value on the XPath stack is a node set or - * an XSLT value tree. - * - * Returns true if the current object on the stack is a node-set. - */ -#define xmlXPathStackIsNodeSet(ctxt) \ - (((ctxt)->value != NULL) \ - && (((ctxt)->value->type == XPATH_NODESET) \ - || ((ctxt)->value->type == XPATH_XSLT_TREE))) - -/** - * xmlXPathStackIsExternal: - * @ctxt: an XPath parser context - * - * Checks if the current value on the XPath stack is an external - * object. - * - * Returns true if the current object on the stack is an external - * object. - */ -#define xmlXPathStackIsExternal(ctxt) \ - ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) - -/** - * xmlXPathEmptyNodeSet: - * @ns: a node-set - * - * Empties a node-set. - */ -#define xmlXPathEmptyNodeSet(ns) \ - { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; } - -/** - * CHECK_ERROR: - * - * Macro to return from the function if an XPath error was detected. - */ -#define CHECK_ERROR \ - if (ctxt->error != XPATH_EXPRESSION_OK) return - -/** - * CHECK_ERROR0: - * - * Macro to return 0 from the function if an XPath error was detected. - */ -#define CHECK_ERROR0 \ - if (ctxt->error != XPATH_EXPRESSION_OK) return(0) - -/** - * XP_ERROR: - * @X: the error code - * - * Macro to raise an XPath error and return. - */ -#define XP_ERROR(X) \ - { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \ - ctxt->error = (X); return; } - -/** - * XP_ERROR0: - * @X: the error code - * - * Macro to raise an XPath error and return 0. - */ -#define XP_ERROR0(X) \ - { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \ - ctxt->error = (X); return(0); } - -/** - * CHECK_TYPE: - * @typeval: the XPath type - * - * Macro to check that the value on top of the XPath stack is of a given - * type. - */ -#define CHECK_TYPE(typeval) \ - if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ - XP_ERROR(XPATH_INVALID_TYPE) - -/** - * CHECK_TYPE0: - * @typeval: the XPath type - * - * Macro to check that the value on top of the XPath stack is of a given - * type. Return(0) in case of failure - */ -#define CHECK_TYPE0(typeval) \ - if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ - XP_ERROR0(XPATH_INVALID_TYPE) - -/** - * CHECK_ARITY: - * @x: the number of expected args - * - * Macro to check that the number of args passed to an XPath function matches. - */ -#define CHECK_ARITY(x) \ - if (nargs != (x)) \ - XP_ERROR(XPATH_INVALID_ARITY); - -/** - * CAST_TO_STRING: - * - * Macro to try to cast the value on the top of the XPath stack to a string. - */ -#define CAST_TO_STRING \ - if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ - xmlXPathStringFunction(ctxt, 1); - -/** - * CAST_TO_NUMBER: - * - * Macro to try to cast the value on the top of the XPath stack to a number. - */ -#define CAST_TO_NUMBER \ - if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ - xmlXPathNumberFunction(ctxt, 1); - -/** - * CAST_TO_BOOLEAN: - * - * Macro to try to cast the value on the top of the XPath stack to a boolean. - */ -#define CAST_TO_BOOLEAN \ - if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ - xmlXPathBooleanFunction(ctxt, 1); - -/* - * Variable Lookup forwarding. - */ -/** - * xmlXPathVariableLookupFunc: - * @ctxt: an XPath context - * @name: name of the variable - * @ns_uri: the namespace name hosting this variable - * - * Prototype for callbacks used to plug variable lookup in the XPath - * engine. - * - * Returns the XPath object value or NULL if not found. - */ -typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, - const xmlChar *name, - const xmlChar *ns_uri); - -void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, - xmlXPathVariableLookupFunc f, - void *data); - -/* - * Function Lookup forwarding. - */ -/** - * xmlXPathFuncLookupFunc: - * @ctxt: an XPath context - * @name: name of the function - * @ns_uri: the namespace name hosting this function - * - * Prototype for callbacks used to plug function lookup in the XPath - * engine. - * - * Returns the XPath function or NULL if not found. - */ -typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, - const xmlChar *name, - const xmlChar *ns_uri); - -void xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, - xmlXPathFuncLookupFunc f, - void *funcCtxt); - -/* - * Error reporting. - */ -void xmlXPatherror (xmlXPathParserContextPtr ctxt, - const char *file, - int line, - int no); - -void xmlXPathDebugDumpObject (FILE *output, - xmlXPathObjectPtr cur, - int depth); -void xmlXPathDebugDumpCompExpr(FILE *output, - xmlXPathCompExprPtr comp, - int depth); - -/** - * NodeSet handling. - */ -int xmlXPathNodeSetContains (xmlNodeSetPtr cur, - xmlNodePtr val); -xmlNodeSetPtr xmlXPathDifference (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); -xmlNodeSetPtr xmlXPathIntersection (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - -xmlNodeSetPtr xmlXPathDistinctSorted (xmlNodeSetPtr nodes); -xmlNodeSetPtr xmlXPathDistinct (xmlNodeSetPtr nodes); - -int xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - -xmlNodeSetPtr xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, - xmlNodePtr node); -xmlNodeSetPtr xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); -xmlNodeSetPtr xmlXPathNodeLeading (xmlNodeSetPtr nodes, - xmlNodePtr node); -xmlNodeSetPtr xmlXPathLeading (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - -xmlNodeSetPtr xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, - xmlNodePtr node); -xmlNodeSetPtr xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); -xmlNodeSetPtr xmlXPathNodeTrailing (xmlNodeSetPtr nodes, - xmlNodePtr node); -xmlNodeSetPtr xmlXPathTrailing (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - - -/** - * Extending a context. - */ - -int xmlXPathRegisterNs (xmlXPathContextPtr ctxt, - const xmlChar *prefix, - const xmlChar *ns_uri); -const xmlChar * xmlXPathNsLookup (xmlXPathContextPtr ctxt, - const xmlChar *prefix); -void xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); - -int xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, - const xmlChar *name, - xmlXPathFunction f); -int xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri, - xmlXPathFunction f); -int xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, - const xmlChar *name, - xmlXPathObjectPtr value); -int xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri, - xmlXPathObjectPtr value); -xmlXPathFunction xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, - const xmlChar *name); -xmlXPathFunction xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri); -void xmlXPathRegisteredFuncsCleanup(xmlXPathContextPtr ctxt); -xmlXPathObjectPtr xmlXPathVariableLookup (xmlXPathContextPtr ctxt, - const xmlChar *name); -xmlXPathObjectPtr xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri); -void xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); - -/** - * Utilities to extend XPath. - */ -xmlXPathParserContextPtr - xmlXPathNewParserContext (const xmlChar *str, - xmlXPathContextPtr ctxt); -void xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); - -/* TODO: remap to xmlXPathValuePop and Push. */ -xmlXPathObjectPtr valuePop (xmlXPathParserContextPtr ctxt); -int valuePush (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr value); - -xmlXPathObjectPtr xmlXPathNewString (const xmlChar *val); -xmlXPathObjectPtr xmlXPathNewCString (const char *val); -xmlXPathObjectPtr xmlXPathWrapString (xmlChar *val); -xmlXPathObjectPtr xmlXPathWrapCString (char * val); -xmlXPathObjectPtr xmlXPathNewFloat (double val); -xmlXPathObjectPtr xmlXPathNewBoolean (int val); -xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val); -xmlXPathObjectPtr xmlXPathNewValueTree (xmlNodePtr val); -void xmlXPathNodeSetAdd (xmlNodeSetPtr cur, - xmlNodePtr val); -void xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, - xmlNodePtr val); -void xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, - xmlNodePtr node, - xmlNsPtr ns); -void xmlXPathNodeSetSort (xmlNodeSetPtr set); - -void xmlXPathRoot (xmlXPathParserContextPtr ctxt); -void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); -xmlChar * xmlXPathParseName (xmlXPathParserContextPtr ctxt); -xmlChar * xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); - -/* - * Existing functions. - */ -double xmlXPathStringEvalNumber(const xmlChar *str); -int xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr res); -void xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt); -xmlNodeSetPtr xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2); -void xmlXPathNodeSetDel(xmlNodeSetPtr cur, xmlNodePtr val); -void xmlXPathNodeSetRemove(xmlNodeSetPtr cur, int val); -xmlXPathObjectPtr xmlXPathNewNodeSetList(xmlNodeSetPtr val); -xmlXPathObjectPtr xmlXPathWrapNodeSet(xmlNodeSetPtr val); -xmlXPathObjectPtr xmlXPathWrapExternal(void *val); - -int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); -int xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); -int xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); -void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); -void xmlXPathAddValues(xmlXPathParserContextPtr ctxt); -void xmlXPathSubValues(xmlXPathParserContextPtr ctxt); -void xmlXPathMultValues(xmlXPathParserContextPtr ctxt); -void xmlXPathDivValues(xmlXPathParserContextPtr ctxt); -void xmlXPathModValues(xmlXPathParserContextPtr ctxt); - -int xmlXPathIsNodeType(const xmlChar *name); - -/* - * Some of the axis navigation routines. - */ -xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -/* - * The official core of XPath functions. - */ -void xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); -void xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); - -/** - * Really internal functions - */ -void xmlXPathNodeSetFreeNs(xmlNsPtr ns); - -#ifdef __cplusplus -} -#endif -#endif /* ! __XML_XPATH_INTERNALS_H__ */ diff --git a/plugins/Variables/src/libxml/xpointer.h b/plugins/Variables/src/libxml/xpointer.h deleted file mode 100644 index 80c465c70f..0000000000 --- a/plugins/Variables/src/libxml/xpointer.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * xpointer.h : API to handle XML Pointers - * - * World Wide Web Consortium Working Draft 03-March-1998 - * http://www.w3.org/TR/1998/WD-xptr-19980303 - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#ifndef __XML_XPTR_H__ -#define __XML_XPTR_H__ - -#include <libxml/tree.h> -#include <libxml/xpath.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * 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 */ -}; - -/* - * Handling of location sets. - */ - -xmlLocationSetPtr xmlXPtrLocationSetCreate(xmlXPathObjectPtr val); -void xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); -xmlLocationSetPtr xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, - xmlLocationSetPtr val2); -xmlXPathObjectPtr xmlXPtrNewRange (xmlNodePtr start, - int startindex, - xmlNodePtr end, - int endindex); -xmlXPathObjectPtr xmlXPtrNewRangePoints (xmlXPathObjectPtr start, - xmlXPathObjectPtr end); -xmlXPathObjectPtr xmlXPtrNewRangeNodePoint(xmlNodePtr start, - xmlXPathObjectPtr end); -xmlXPathObjectPtr xmlXPtrNewRangePointNode(xmlXPathObjectPtr start, - xmlNodePtr end); -xmlXPathObjectPtr xmlXPtrNewRangeNodes (xmlNodePtr start, - xmlNodePtr end); -xmlXPathObjectPtr xmlXPtrNewLocationSetNodes(xmlNodePtr start, - xmlNodePtr end); -xmlXPathObjectPtr xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); -xmlXPathObjectPtr xmlXPtrNewRangeNodeObject(xmlNodePtr start, - xmlXPathObjectPtr end); -xmlXPathObjectPtr xmlXPtrNewCollapsedRange(xmlNodePtr start); -void xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, - xmlXPathObjectPtr val); -xmlXPathObjectPtr xmlXPtrWrapLocationSet (xmlLocationSetPtr val); -void xmlXPtrLocationSetDel (xmlLocationSetPtr cur, - xmlXPathObjectPtr val); -void xmlXPtrLocationSetRemove(xmlLocationSetPtr cur, - int val); - -/* - * Functions. - */ -xmlXPathContextPtr xmlXPtrNewContext (xmlDocPtr doc, - xmlNodePtr here, - xmlNodePtr origin); -xmlXPathObjectPtr xmlXPtrEval (const xmlChar *str, - xmlXPathContextPtr ctx); -void xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, - int nargs); -xmlNodePtr xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); -void xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_XPTR_H__ */ diff --git a/plugins/Variables/src/lookup3.cpp b/plugins/Variables/src/lookup3.cpp index f2c930950c..b75c9bbe0c 100644 --- a/plugins/Variables/src/lookup3.cpp +++ b/plugins/Variables/src/lookup3.cpp @@ -1,640 +1,637 @@ -/* -------------------------------------------------------------------------------- -lookup3.c, by Bob Jenkins, May 2006, Public Domain. -These are functions for producing 32-bit hashes for hash table lookup. -hashword(), hashlittle(), hashbig(), mix(), and final() are externally -useful functions. Routines to test the hash are included if SELF_TEST -is defined. You can use this mir_free for any purpose. It has no warranty. - -You probably want to use hashlittle(). hashlittle() and hashbig() -hash byte arrays. hashlittle() is is faster than hashbig() on -little-endian machines. Intel and AMD are little-endian machines. - -If you want to find a hash of, say, exactly 7 integers, do - a = i1; b = i2; c = i3; - mix(a,b,c); - a += i4; b += i5; c += i6; - mix(a,b,c); - a += i7; - final(a,b,c); -then use c as the hash value. If you have a variable length array of -4-byte integers to hash, use hashword(). If you have a byte array (like -a character string), use hashlittle(). If you have several byte arrays, or -a mix of things, see the comments above hashlittle(). -------------------------------------------------------------------------------- -*/ -//#define SELF_TEST 1 - -#include <stdio.h> -#include <stddef.h> -#include <stdlib.h> -#include <time.h> - -typedef unsigned long int uint32; /* unsigned 4-byte quantities */ -typedef unsigned short int uint16; /* unsigned 2-byte quantities */ -typedef unsigned char uint8; /* unsigned 1-byte quantities */ - -/* - * My best guess at if you are big-endian or little-endian. This may - * need adjustment. - */ -#if defined(i386) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL) -# define HASH_LITTLE_ENDIAN 1 -# define HASH_BIG_ENDIAN 0 -#elif defined(sparc) -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 1 -#else -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 0 -#endif - -#define hashsize(n) ((uint32)1<<(n)) -#define hashmask(n) (hashsize(n)-1) -#define rot(x,k) (((x)<<(k)) ^ ((x)>>(32-(k)))) - -/* -------------------------------------------------------------------------------- -mix -- mix 3 32-bit values reversibly. - -This is reversible, so any information in (a,b,c) before mix() is -still in (a,b,c) after mix(). - -If four pairs of (a,b,c) inputs are run through mix(), or through -mix() in reverse, there are at least 32 bits of the output that -are sometimes the same for one pair and different for another pair. -This was tested for: -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that -satisfy this are - 4 6 8 16 19 4 - 9 15 3 18 27 15 - 14 9 3 7 17 3 -Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing -for "differ" defined as + with a one-bit base and a two-bit delta. I -used http://burtleburtle.net/bob/hash/avalanche.html to choose -the operations, constants, and arrangements of the variables. - -This does not achieve avalanche. There are input bits of (a,b,c) -that fail to affect some output bits of (a,b,c), especially of a. The -most thoroughly mixed value is c, but it doesn't really even achieve -avalanche in c. - -This allows some parallelism. Read-after-writes are good at doubling -the number of bits affected, so the goal of mixing pulls in the opposite -direction as the goal of parallelism. I did what I could. Rotates -seem to cost as much as shifts on every machine I could lay my hands -on, and rotates are much kinder to the top and bottom bits, so I used -rotates. -------------------------------------------------------------------------------- -*/ -#define mix(a,b,c) \ -{ \ - a -= c; a ^= rot(c, 4); c += b; \ - b -= a; b ^= rot(a, 6); a += c; \ - c -= b; c ^= rot(b, 8); b += a; \ - a -= c; a ^= rot(c,16); c += b; \ - b -= a; b ^= rot(a,19); a += c; \ - c -= b; c ^= rot(b, 4); b += a; \ -} - -/* -------------------------------------------------------------------------------- -final -- final mixing of 3 32-bit values (a,b,c) into c - -Pairs of (a,b,c) values differing in only a few bits will usually -produce values of c that look totally different. This was tested for -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -These constants passed: - 14 11 25 16 4 14 24 - 12 14 25 16 4 14 24 -and these came close: - 4 8 15 26 3 22 24 - 10 8 15 26 3 22 24 - 11 8 15 26 3 22 24 -------------------------------------------------------------------------------- -*/ -#define final(a,b,c) \ -{ \ - c ^= b; c -= rot(b,14); \ - a ^= c; a -= rot(c,11); \ - b ^= a; b -= rot(a,25); \ - c ^= b; c -= rot(b,16); \ - a ^= c; a -= rot(c,4); \ - b ^= a; b -= rot(a,14); \ - c ^= b; c -= rot(b,24); \ -} - -/* --------------------------------------------------------------------- - This works on all machines. To be useful, it requires - -- that the key be an array of uint32's, and - -- that all your machines have the same endianness, and - -- that the length be the number of uint32's in the key - - The function hashword() is identical to hashlittle() on little-endian - machines, and identical to hashbig() on big-endian machines, - except that the length has to be measured in uint32s rather than in - bytes. hashlittle() is more complicated than hashword() only because - hashlittle() has to dance around fitting the key bytes into registers. --------------------------------------------------------------------- -*/ -uint32 hashword( uint32 *k, size_t length, uint32 initval) -{ - uint32 a,b,c; - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + (((uint32)length)<<2) + initval; - - /*------------------------------------------------- handle most of the key */ - while (length > 3) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 3; - k += 3; - } - - /*--------------------------------------------- handle the last 3 uint32's */ - switch(length) /* all the case statements fall through */ - { - case 3 : c+=k[2]; - case 2 : b+=k[1]; - case 1 : a+=k[0]; - final(a,b,c); - case 0: /* case 0: nothing left to add */ - break; - } - /*------------------------------------------------------ report the result */ - return c; -} - - -/* -------------------------------------------------------------------------------- -hashlittle() -- hash a variable-length key into a 32-bit value - k : the key (the unaligned variable-length array of bytes) - length : the length of the key, counting by bytes - initval : can be any 4-byte value -Returns a 32-bit value. Every bit of the key affects every bit of -the return value. Two keys differing by one or two bits will have -totally different hash values. - -The best hash table sizes are powers of 2. There is no need to do -mod a prime (mod is sooo slow!). If you need less than 32 bits, -use a bitmask. For example, if you need only 10 bits, do - h = (h & hashmask(10)); -In which case, the hash table should have hashsize(10) elements. - -If you are hashing n strings (uint8 **)k, do it like this: - for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h); - -By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this -code any way you wish, private, educational, or commercial. It's mir_free. - -Use for hash table lookup, or anything where one collision in 2^^32 is -acceptable. Do NOT use for cryptographic purposes. -------------------------------------------------------------------------------- -*/ - -uint32 hashlittle( void *key, size_t length, uint32 initval) -{ - uint32 a,b,c; - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + ((uint32)length) + initval; - - if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x3)) { - uint32 *k = ( uint32 *)key; /* read 32-bit chunks */ - - /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 12; - k += 3; - } - - /*----------------------------- handle the last (probably partial) block */ - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; - case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; - case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=k[1]&0xffffff; a+=k[0]; break; - case 6 : b+=k[1]&0xffff; a+=k[0]; break; - case 5 : b+=k[1]&0xff; a+=k[0]; break; - case 4 : a+=k[0]; break; - case 3 : a+=k[0]&0xffffff; break; - case 2 : a+=k[0]&0xffff; break; - case 1 : a+=k[0]&0xff; break; - case 0 : return c; /* zero length strings require no mixing */ - } - - } else if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x1)) { - uint16 *k = (uint16 *)key; /* read 16-bit chunks */ - - /*--------------- all but last block: aligned reads and different mixing */ - while (length > 12) - { - a += k[0] + (((uint32)k[1])<<16); - b += k[2] + (((uint32)k[3])<<16); - c += k[4] + (((uint32)k[5])<<16); - mix(a,b,c); - length -= 12; - k += 6; - } - - /*----------------------------- handle the last (probably partial) block */ - switch(length) - { - case 12: c+=k[4]+(((uint32)k[5])<<16); - b+=k[2]+(((uint32)k[3])<<16); - a+=k[0]+(((uint32)k[1])<<16); - break; - case 11: c+=((uint32)(k[5]&0xff))<<16;/* fall through */ - case 10: c+=k[4]; - b+=k[2]+(((uint32)k[3])<<16); - a+=k[0]+(((uint32)k[1])<<16); - break; - case 9 : c+=k[4]&0xff; /* fall through */ - case 8 : b+=k[2]+(((uint32)k[3])<<16); - a+=k[0]+(((uint32)k[1])<<16); - break; - case 7 : b+=((uint32)(k[3]&0xff))<<16;/* fall through */ - case 6 : b+=k[2]; - a+=k[0]+(((uint32)k[1])<<16); - break; - case 5 : b+=k[2]&0xff; /* fall through */ - case 4 : a+=k[0]+(((uint32)k[1])<<16); - break; - case 3 : a+=((uint32)(k[1]&0xff))<<16;/* fall through */ - case 2 : a+=k[0]; - break; - case 1 : a+=k[0]&0xff; - break; - case 0 : return c; /* zero length requires no mixing */ - } - - } else { /* need to read the key one byte at a time */ - uint8 *k = (uint8 *)key; - - /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - a += ((uint32)k[1])<<8; - a += ((uint32)k[2])<<16; - a += ((uint32)k[3])<<24; - b += k[4]; - b += ((uint32)k[5])<<8; - b += ((uint32)k[6])<<16; - b += ((uint32)k[7])<<24; - c += k[8]; - c += ((uint32)k[9])<<8; - c += ((uint32)k[10])<<16; - c += ((uint32)k[11])<<24; - mix(a,b,c); - length -= 12; - k += 12; - } - - /*-------------------------------- last block: affect all 32 bits of (c) */ - switch(length) /* all the case statements fall through */ - { - case 12: c+=((uint32)k[11])<<24; - case 11: c+=((uint32)k[10])<<16; - case 10: c+=((uint32)k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32)k[7])<<24; - case 7 : b+=((uint32)k[6])<<16; - case 6 : b+=((uint32)k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32)k[3])<<24; - case 3 : a+=((uint32)k[2])<<16; - case 2 : a+=((uint32)k[1])<<8; - case 1 : a+=k[0]; - break; - case 0 : return c; - } - } - - final(a,b,c); - return c; -} - - - -/* - * hashbig(): - * This is the same as hashword() on big-endian machines. It is different - * from hashlittle() on all machines. hashbig() takes advantage of - * big-endian byte ordering. - */ -uint32 hashbig( void *key, size_t length, uint32 initval) -{ - uint32 a,b,c; - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + ((uint32)length) + initval; - - if (HASH_BIG_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x3)) { - uint32 *k = (uint32 *)key; /* read 32-bit chunks */ - - /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 12; - k += 3; - } - - /*----------------------------- handle the last (probably partial) block */ - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=k[2]<<8; b+=k[1]; a+=k[0]; break; - case 10: c+=k[2]<<16; b+=k[1]; a+=k[0]; break; - case 9 : c+=k[2]<<24; b+=k[1]; a+=k[0]; break; - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=k[1]<<8; a+=k[0]; break; - case 6 : b+=k[1]<<16; a+=k[0]; break; - case 5 : b+=k[1]<<24; a+=k[0]; break; - case 4 : a+=k[0]; break; - case 3 : a+=k[0]<<8; break; - case 2 : a+=k[0]<<16; break; - case 1 : a+=k[0]<<24; break; - case 0 : return c; /* zero length strings require no mixing */ - } - - } else { /* need to read the key one byte at a time */ - uint8 *k = (uint8 *)key; - - /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ - while (length > 12) - { - a += ((uint32)k[0])<<24; - a += ((uint32)k[1])<<16; - a += ((uint32)k[2])<<8; - a += ((uint32)k[3]); - b += ((uint32)k[4])<<24; - b += ((uint32)k[5])<<16; - b += ((uint32)k[6])<<8; - b += ((uint32)k[7]); - c += ((uint32)k[8])<<24; - c += ((uint32)k[9])<<16; - c += ((uint32)k[10])<<8; - c += ((uint32)k[11]); - mix(a,b,c); - length -= 12; - k += 12; - } - - /*-------------------------------- last block: affect all 32 bits of (c) */ - switch(length) /* all the case statements fall through */ - { - case 12: c+=((uint32)k[11])<<24; - case 11: c+=((uint32)k[10])<<16; - case 10: c+=((uint32)k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32)k[7])<<24; - case 7 : b+=((uint32)k[6])<<16; - case 6 : b+=((uint32)k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32)k[3])<<24; - case 3 : a+=((uint32)k[2])<<16; - case 2 : a+=((uint32)k[1])<<8; - case 1 : a+=k[0]; - break; - case 0 : return c; - } - } - - final(a,b,c); - return c; -} - - -#ifdef SELF_TEST - -/* used for timings */ -void driver1() -{ - uint8 buf[256]; - uint32 i; - uint32 h=0; - time_t a,z; - - time(&a); - for (i=0; i<256; ++i) buf[i] = 'x'; - for (i=0; i<1; ++i) - { - h = hashlittle(&buf[0],1,h); - } - time(&z); - if (z-a > 0) printf("time %ld %.8lx\n", z-a, h); -} - -/* check that every input bit changes every output bit half the time */ -#define HASHSTATE 1 -#define HASHLEN 1 -#define MAXPAIR 60 -#define MAXLEN 70 -void driver2() -{ - uint8 qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1]; - uint32 c[HASHSTATE], d[HASHSTATE], i, j=0, k, l, m, z; - uint32 e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE]; - uint32 x[HASHSTATE],y[HASHSTATE]; - uint32 hlen; - - printf("No more than %d trials should ever be needed \n",MAXPAIR/2); - for (hlen=0; hlen < MAXLEN; ++hlen) - { - z=0; - for (i=0; i<hlen; ++i) /*----------------------- for each input byte, */ - { - for (j=0; j<8; ++j) /*------------------------ for each input bit, */ - { - for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */ - { - for (l=0; l<HASHSTATE; ++l) e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32)0); - - /*---- check that every output bit is affected by that input bit */ - for (k=0; k<MAXPAIR; k+=2) - { - uint32 finished=1; - /* keys have one bit different */ - for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8)0;} - /* have a and b be two keys differing in only one bit */ - a[i] ^= (k<<j); - a[i] ^= (k>>(8-j)); - c[0] = hashlittle(a, hlen, m); - b[i] ^= ((k+1)<<j); - b[i] ^= ((k+1)>>(8-j)); - d[0] = hashlittle(b, hlen, m); - /* check every bit is 1, 0, set, and not set at least once */ - for (l=0; l<HASHSTATE; ++l) - { - e[l] &= (c[l]^d[l]); - f[l] &= ~(c[l]^d[l]); - g[l] &= c[l]; - h[l] &= ~c[l]; - x[l] &= d[l]; - y[l] &= ~d[l]; - if (e[l]|f[l]|g[l]|h[l]|x[l]|y[l]) finished=0; - } - if (finished) break; - } - if (k>z) z=k; - if (k==MAXPAIR) - { - printf("Some bit didn't change: "); - printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx ", - e[0],f[0],g[0],h[0],x[0],y[0]); - printf("i %ld j %ld m %ld len %ld\n",i,j,m,hlen); - } - if (z==MAXPAIR) goto done; - } - } - } - done: - if (z < MAXPAIR) - { - printf("Mix success %2ld bytes %2ld initvals ",i,m); - printf("required %ld trials\n",z/2); - } - } - printf("\n"); -} - -/* Check for reading beyond the end of the buffer and alignment problems */ -void driver3() -{ - uint8 buf[MAXLEN+20], *b; - uint32 len; - uint8 q[] = "This is the time for all good men to come to the aid of their country..."; - //uint32 dummy1; - uint8 qq[] = "xThis is the time for all good men to come to the aid of their country..."; - //uint32 dummy2; - uint8 qqq[] = "xxThis is the time for all good men to come to the aid of their country..."; - //uint32 dummy3; - uint8 qqqq[] = "xxxThis is the time for all good men to come to the aid of their country..."; - uint32 h,i,j,ref,x,y; - uint8 *p; - - printf("Endianness. These lines should all be the same (for values filled in):\n"); - printf("%.8lx %.8lx %.8lx\n", - hashword((uint32 *)q, (sizeof(q)-1)/4, 13), - hashword((uint32 *)q, (sizeof(q)-5)/4, 13), - hashword((uint32 *)q, (sizeof(q)-9)/4, 13)); - p = q; - printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n", - hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), - hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), - hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), - hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), - hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), - hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); - p = &qq[1]; - printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n", - hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), - hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), - hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), - hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), - hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), - hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); - p = &qqq[2]; - printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n", - hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), - hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), - hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), - hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), - hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), - hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); - p = &qqqq[3]; - printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n", - hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), - hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), - hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), - hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), - hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), - hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); - printf("\n"); - for (h=0, b=buf+1; h<8; ++h, ++b) - { - for (i=0; i<MAXLEN; ++i) - { - len = i; - for (j=0; j<i; ++j) *(b+j)=0; - - /* these should all be equal */ - ref = hashlittle(b, len, (uint32)1); - *(b+i)=(uint8)~0; - *(b-1)=(uint8)~0; - x = hashlittle(b, len, (uint32)1); - y = hashlittle(b, len, (uint32)1); - if ((ref != x) || (ref != y)) - { - printf("alignment error: %.8lx %.8lx %.8lx %ld %ld\n",ref,x,y,h,i); - } - } - } -} - -/* check for problems with nulls */ - void driver4() -{ - uint8 buf[1]; - uint32 h,i,state[HASHSTATE]; - - - buf[0] = ~0; - for (i=0; i<HASHSTATE; ++i) state[i] = 1; - printf("These should all be different\n"); - for (i=0, h=0; i<8; ++i) - { - h = hashlittle(buf, (uint32)0, h); - printf("%2ld 0-byte strings, hash is %.8lx\n", i, h); - } -} - - -int main() -{ - driver1(); /* test that the key is hashed: used for timings */ - driver2(); /* test that whole key is hashed thoroughly */ - driver3(); /* test that nothing but the key is hashed */ - driver4(); /* test hashing multiple buffers (all buffers are null) */ - return 1; -} - -#endif /* SELF_TEST */ +/*
+-------------------------------------------------------------------------------
+lookup3.c, by Bob Jenkins, May 2006, Public Domain.
+These are functions for producing 32-bit hashes for hash table lookup.
+hashword(), hashlittle(), hashbig(), mix(), and final() are externally
+useful functions. Routines to test the hash are included if SELF_TEST
+is defined. You can use this mir_free for any purpose. It has no warranty.
+
+You probably want to use hashlittle(). hashlittle() and hashbig()
+hash byte arrays. hashlittle() is is faster than hashbig() on
+little-endian machines. Intel and AMD are little-endian machines.
+
+If you want to find a hash of, say, exactly 7 integers, do
+ a = i1; b = i2; c = i3;
+ mix(a,b,c);
+ a += i4; b += i5; c += i6;
+ mix(a,b,c);
+ a += i7;
+ final(a,b,c);
+then use c as the hash value. If you have a variable length array of
+4-byte integers to hash, use hashword(). If you have a byte array (like
+a character string), use hashlittle(). If you have several byte arrays, or
+a mix of things, see the comments above hashlittle().
+-------------------------------------------------------------------------------
+*/
+//#define SELF_TEST 1
+
+#include "variables.h"
+
+typedef unsigned long int uint32; /* unsigned 4-byte quantities */
+typedef unsigned short int uint16; /* unsigned 2-byte quantities */
+typedef unsigned char uint8; /* unsigned 1-byte quantities */
+
+/*
+ * My best guess at if you are big-endian or little-endian. This may
+ * need adjustment.
+ */
+#if defined(i386) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL)
+# define HASH_LITTLE_ENDIAN 1
+# define HASH_BIG_ENDIAN 0
+#elif defined(sparc)
+# define HASH_LITTLE_ENDIAN 0
+# define HASH_BIG_ENDIAN 1
+#else
+# define HASH_LITTLE_ENDIAN 0
+# define HASH_BIG_ENDIAN 0
+#endif
+
+#define hashsize(n) ((uint32)1<<(n))
+#define hashmask(n) (hashsize(n)-1)
+#define rot(x,k) (((x)<<(k)) ^ ((x)>>(32-(k))))
+
+/*
+-------------------------------------------------------------------------------
+mix -- mix 3 32-bit values reversibly.
+
+This is reversible, so any information in (a,b,c) before mix() is
+still in (a,b,c) after mix().
+
+If four pairs of (a,b,c) inputs are run through mix(), or through
+mix() in reverse, there are at least 32 bits of the output that
+are sometimes the same for one pair and different for another pair.
+This was tested for:
+* pairs that differed by one bit, by two bits, in any combination
+ of top bits of (a,b,c), or in any combination of bottom bits of
+ (a,b,c).
+* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
+ the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
+ is commonly produced by subtraction) look like a single 1-bit
+ difference.
+* the base values were pseudorandom, all zero but one bit set, or
+ all zero plus a counter that starts at zero.
+
+Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that
+satisfy this are
+ 4 6 8 16 19 4
+ 9 15 3 18 27 15
+ 14 9 3 7 17 3
+Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing
+for "differ" defined as + with a one-bit base and a two-bit delta. I
+used http://burtleburtle.net/bob/hash/avalanche.html to choose
+the operations, constants, and arrangements of the variables.
+
+This does not achieve avalanche. There are input bits of (a,b,c)
+that fail to affect some output bits of (a,b,c), especially of a. The
+most thoroughly mixed value is c, but it doesn't really even achieve
+avalanche in c.
+
+This allows some parallelism. Read-after-writes are good at doubling
+the number of bits affected, so the goal of mixing pulls in the opposite
+direction as the goal of parallelism. I did what I could. Rotates
+seem to cost as much as shifts on every machine I could lay my hands
+on, and rotates are much kinder to the top and bottom bits, so I used
+rotates.
+-------------------------------------------------------------------------------
+*/
+#define mix(a,b,c) \
+{ \
+ a -= c; a ^= rot(c, 4); c += b; \
+ b -= a; b ^= rot(a, 6); a += c; \
+ c -= b; c ^= rot(b, 8); b += a; \
+ a -= c; a ^= rot(c,16); c += b; \
+ b -= a; b ^= rot(a,19); a += c; \
+ c -= b; c ^= rot(b, 4); b += a; \
+}
+
+/*
+-------------------------------------------------------------------------------
+final -- final mixing of 3 32-bit values (a,b,c) into c
+
+Pairs of (a,b,c) values differing in only a few bits will usually
+produce values of c that look totally different. This was tested for
+* pairs that differed by one bit, by two bits, in any combination
+ of top bits of (a,b,c), or in any combination of bottom bits of
+ (a,b,c).
+* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
+ the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
+ is commonly produced by subtraction) look like a single 1-bit
+ difference.
+* the base values were pseudorandom, all zero but one bit set, or
+ all zero plus a counter that starts at zero.
+
+These constants passed:
+ 14 11 25 16 4 14 24
+ 12 14 25 16 4 14 24
+and these came close:
+ 4 8 15 26 3 22 24
+ 10 8 15 26 3 22 24
+ 11 8 15 26 3 22 24
+-------------------------------------------------------------------------------
+*/
+#define final(a,b,c) \
+{ \
+ c ^= b; c -= rot(b,14); \
+ a ^= c; a -= rot(c,11); \
+ b ^= a; b -= rot(a,25); \
+ c ^= b; c -= rot(b,16); \
+ a ^= c; a -= rot(c,4); \
+ b ^= a; b -= rot(a,14); \
+ c ^= b; c -= rot(b,24); \
+}
+
+/*
+--------------------------------------------------------------------
+ This works on all machines. To be useful, it requires
+ -- that the key be an array of uint32's, and
+ -- that all your machines have the same endianness, and
+ -- that the length be the number of uint32's in the key
+
+ The function hashword() is identical to hashlittle() on little-endian
+ machines, and identical to hashbig() on big-endian machines,
+ except that the length has to be measured in uint32s rather than in
+ bytes. hashlittle() is more complicated than hashword() only because
+ hashlittle() has to dance around fitting the key bytes into registers.
+--------------------------------------------------------------------
+*/
+uint32 hashword( uint32 *k, size_t length, uint32 initval)
+{
+ uint32 a,b,c;
+
+ /* Set up the internal state */
+ a = b = c = 0xdeadbeef + (((uint32)length)<<2) + initval;
+
+ /*------------------------------------------------- handle most of the key */
+ while (length > 3)
+ {
+ a += k[0];
+ b += k[1];
+ c += k[2];
+ mix(a,b,c);
+ length -= 3;
+ k += 3;
+ }
+
+ /*--------------------------------------------- handle the last 3 uint32's */
+ switch(length) /* all the case statements fall through */
+ {
+ case 3 : c+=k[2];
+ case 2 : b+=k[1];
+ case 1 : a+=k[0];
+ final(a,b,c);
+ case 0: /* case 0: nothing left to add */
+ break;
+ }
+ /*------------------------------------------------------ report the result */
+ return c;
+}
+
+
+/*
+-------------------------------------------------------------------------------
+hashlittle() -- hash a variable-length key into a 32-bit value
+ k : the key (the unaligned variable-length array of bytes)
+ length : the length of the key, counting by bytes
+ initval : can be any 4-byte value
+Returns a 32-bit value. Every bit of the key affects every bit of
+the return value. Two keys differing by one or two bits will have
+totally different hash values.
+
+The best hash table sizes are powers of 2. There is no need to do
+mod a prime (mod is sooo slow!). If you need less than 32 bits,
+use a bitmask. For example, if you need only 10 bits, do
+ h = (h & hashmask(10));
+In which case, the hash table should have hashsize(10) elements.
+
+If you are hashing n strings (uint8 **)k, do it like this:
+ for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h);
+
+By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this
+code any way you wish, private, educational, or commercial. It's mir_free.
+
+Use for hash table lookup, or anything where one collision in 2^^32 is
+acceptable. Do NOT use for cryptographic purposes.
+-------------------------------------------------------------------------------
+*/
+
+uint32 hashlittle( void *key, size_t length, uint32 initval)
+{
+ uint32 a,b,c;
+
+ /* Set up the internal state */
+ a = b = c = 0xdeadbeef + ((uint32)length) + initval;
+
+ if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x3)) {
+ uint32 *k = ( uint32 *)key; /* read 32-bit chunks */
+
+ /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
+ while (length > 12)
+ {
+ a += k[0];
+ b += k[1];
+ c += k[2];
+ mix(a,b,c);
+ length -= 12;
+ k += 3;
+ }
+
+ /*----------------------------- handle the last (probably partial) block */
+ switch(length)
+ {
+ case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
+ case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break;
+ case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break;
+ case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break;
+ case 8 : b+=k[1]; a+=k[0]; break;
+ case 7 : b+=k[1]&0xffffff; a+=k[0]; break;
+ case 6 : b+=k[1]&0xffff; a+=k[0]; break;
+ case 5 : b+=k[1]&0xff; a+=k[0]; break;
+ case 4 : a+=k[0]; break;
+ case 3 : a+=k[0]&0xffffff; break;
+ case 2 : a+=k[0]&0xffff; break;
+ case 1 : a+=k[0]&0xff; break;
+ case 0 : return c; /* zero length strings require no mixing */
+ }
+
+ } else if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x1)) {
+ uint16 *k = (uint16 *)key; /* read 16-bit chunks */
+
+ /*--------------- all but last block: aligned reads and different mixing */
+ while (length > 12)
+ {
+ a += k[0] + (((uint32)k[1])<<16);
+ b += k[2] + (((uint32)k[3])<<16);
+ c += k[4] + (((uint32)k[5])<<16);
+ mix(a,b,c);
+ length -= 12;
+ k += 6;
+ }
+
+ /*----------------------------- handle the last (probably partial) block */
+ switch(length)
+ {
+ case 12: c+=k[4]+(((uint32)k[5])<<16);
+ b+=k[2]+(((uint32)k[3])<<16);
+ a+=k[0]+(((uint32)k[1])<<16);
+ break;
+ case 11: c+=((uint32)(k[5]&0xff))<<16;/* fall through */
+ case 10: c+=k[4];
+ b+=k[2]+(((uint32)k[3])<<16);
+ a+=k[0]+(((uint32)k[1])<<16);
+ break;
+ case 9 : c+=k[4]&0xff; /* fall through */
+ case 8 : b+=k[2]+(((uint32)k[3])<<16);
+ a+=k[0]+(((uint32)k[1])<<16);
+ break;
+ case 7 : b+=((uint32)(k[3]&0xff))<<16;/* fall through */
+ case 6 : b+=k[2];
+ a+=k[0]+(((uint32)k[1])<<16);
+ break;
+ case 5 : b+=k[2]&0xff; /* fall through */
+ case 4 : a+=k[0]+(((uint32)k[1])<<16);
+ break;
+ case 3 : a+=((uint32)(k[1]&0xff))<<16;/* fall through */
+ case 2 : a+=k[0];
+ break;
+ case 1 : a+=k[0]&0xff;
+ break;
+ case 0 : return c; /* zero length requires no mixing */
+ }
+
+ } else { /* need to read the key one byte at a time */
+ uint8 *k = (uint8 *)key;
+
+ /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
+ while (length > 12)
+ {
+ a += k[0];
+ a += ((uint32)k[1])<<8;
+ a += ((uint32)k[2])<<16;
+ a += ((uint32)k[3])<<24;
+ b += k[4];
+ b += ((uint32)k[5])<<8;
+ b += ((uint32)k[6])<<16;
+ b += ((uint32)k[7])<<24;
+ c += k[8];
+ c += ((uint32)k[9])<<8;
+ c += ((uint32)k[10])<<16;
+ c += ((uint32)k[11])<<24;
+ mix(a,b,c);
+ length -= 12;
+ k += 12;
+ }
+
+ /*-------------------------------- last block: affect all 32 bits of (c) */
+ switch(length) /* all the case statements fall through */
+ {
+ case 12: c+=((uint32)k[11])<<24;
+ case 11: c+=((uint32)k[10])<<16;
+ case 10: c+=((uint32)k[9])<<8;
+ case 9 : c+=k[8];
+ case 8 : b+=((uint32)k[7])<<24;
+ case 7 : b+=((uint32)k[6])<<16;
+ case 6 : b+=((uint32)k[5])<<8;
+ case 5 : b+=k[4];
+ case 4 : a+=((uint32)k[3])<<24;
+ case 3 : a+=((uint32)k[2])<<16;
+ case 2 : a+=((uint32)k[1])<<8;
+ case 1 : a+=k[0];
+ break;
+ case 0 : return c;
+ }
+ }
+
+ final(a,b,c);
+ return c;
+}
+
+
+
+/*
+ * hashbig():
+ * This is the same as hashword() on big-endian machines. It is different
+ * from hashlittle() on all machines. hashbig() takes advantage of
+ * big-endian byte ordering.
+ */
+uint32 hashbig( void *key, size_t length, uint32 initval)
+{
+ uint32 a,b,c;
+
+ /* Set up the internal state */
+ a = b = c = 0xdeadbeef + ((uint32)length) + initval;
+
+ if (HASH_BIG_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x3)) {
+ uint32 *k = (uint32 *)key; /* read 32-bit chunks */
+
+ /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
+ while (length > 12)
+ {
+ a += k[0];
+ b += k[1];
+ c += k[2];
+ mix(a,b,c);
+ length -= 12;
+ k += 3;
+ }
+
+ /*----------------------------- handle the last (probably partial) block */
+ switch(length)
+ {
+ case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
+ case 11: c+=k[2]<<8; b+=k[1]; a+=k[0]; break;
+ case 10: c+=k[2]<<16; b+=k[1]; a+=k[0]; break;
+ case 9 : c+=k[2]<<24; b+=k[1]; a+=k[0]; break;
+ case 8 : b+=k[1]; a+=k[0]; break;
+ case 7 : b+=k[1]<<8; a+=k[0]; break;
+ case 6 : b+=k[1]<<16; a+=k[0]; break;
+ case 5 : b+=k[1]<<24; a+=k[0]; break;
+ case 4 : a+=k[0]; break;
+ case 3 : a+=k[0]<<8; break;
+ case 2 : a+=k[0]<<16; break;
+ case 1 : a+=k[0]<<24; break;
+ case 0 : return c; /* zero length strings require no mixing */
+ }
+
+ } else { /* need to read the key one byte at a time */
+ uint8 *k = (uint8 *)key;
+
+ /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
+ while (length > 12)
+ {
+ a += ((uint32)k[0])<<24;
+ a += ((uint32)k[1])<<16;
+ a += ((uint32)k[2])<<8;
+ a += ((uint32)k[3]);
+ b += ((uint32)k[4])<<24;
+ b += ((uint32)k[5])<<16;
+ b += ((uint32)k[6])<<8;
+ b += ((uint32)k[7]);
+ c += ((uint32)k[8])<<24;
+ c += ((uint32)k[9])<<16;
+ c += ((uint32)k[10])<<8;
+ c += ((uint32)k[11]);
+ mix(a,b,c);
+ length -= 12;
+ k += 12;
+ }
+
+ /*-------------------------------- last block: affect all 32 bits of (c) */
+ switch(length) /* all the case statements fall through */
+ {
+ case 12: c+=((uint32)k[11])<<24;
+ case 11: c+=((uint32)k[10])<<16;
+ case 10: c+=((uint32)k[9])<<8;
+ case 9 : c+=k[8];
+ case 8 : b+=((uint32)k[7])<<24;
+ case 7 : b+=((uint32)k[6])<<16;
+ case 6 : b+=((uint32)k[5])<<8;
+ case 5 : b+=k[4];
+ case 4 : a+=((uint32)k[3])<<24;
+ case 3 : a+=((uint32)k[2])<<16;
+ case 2 : a+=((uint32)k[1])<<8;
+ case 1 : a+=k[0];
+ break;
+ case 0 : return c;
+ }
+ }
+
+ final(a,b,c);
+ return c;
+}
+
+
+#ifdef SELF_TEST
+
+/* used for timings */
+void driver1()
+{
+ uint8 buf[256];
+ uint32 i;
+ uint32 h=0;
+ time_t a,z;
+
+ time(&a);
+ for (i=0; i<256; ++i) buf[i] = 'x';
+ for (i=0; i<1; ++i)
+ {
+ h = hashlittle(&buf[0],1,h);
+ }
+ time(&z);
+ if (z-a > 0) printf("time %ld %.8lx\n", z-a, h);
+}
+
+/* check that every input bit changes every output bit half the time */
+#define HASHSTATE 1
+#define HASHLEN 1
+#define MAXPAIR 60
+#define MAXLEN 70
+void driver2()
+{
+ uint8 qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1];
+ uint32 c[HASHSTATE], d[HASHSTATE], i, j=0, k, l, m, z;
+ uint32 e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE];
+ uint32 x[HASHSTATE],y[HASHSTATE];
+ uint32 hlen;
+
+ printf("No more than %d trials should ever be needed \n",MAXPAIR/2);
+ for (hlen=0; hlen < MAXLEN; ++hlen)
+ {
+ z=0;
+ for (i=0; i<hlen; ++i) /*----------------------- for each input byte, */
+ {
+ for (j=0; j<8; ++j) /*------------------------ for each input bit, */
+ {
+ for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */
+ {
+ for (l=0; l<HASHSTATE; ++l) e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32)0);
+
+ /*---- check that every output bit is affected by that input bit */
+ for (k=0; k<MAXPAIR; k+=2)
+ {
+ uint32 finished=1;
+ /* keys have one bit different */
+ for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8)0;}
+ /* have a and b be two keys differing in only one bit */
+ a[i] ^= (k<<j);
+ a[i] ^= (k>>(8-j));
+ c[0] = hashlittle(a, hlen, m);
+ b[i] ^= ((k+1)<<j);
+ b[i] ^= ((k+1)>>(8-j));
+ d[0] = hashlittle(b, hlen, m);
+ /* check every bit is 1, 0, set, and not set at least once */
+ for (l=0; l<HASHSTATE; ++l)
+ {
+ e[l] &= (c[l]^d[l]);
+ f[l] &= ~(c[l]^d[l]);
+ g[l] &= c[l];
+ h[l] &= ~c[l];
+ x[l] &= d[l];
+ y[l] &= ~d[l];
+ if (e[l]|f[l]|g[l]|h[l]|x[l]|y[l]) finished=0;
+ }
+ if (finished) break;
+ }
+ if (k>z) z=k;
+ if (k==MAXPAIR)
+ {
+ printf("Some bit didn't change: ");
+ printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx ",
+ e[0],f[0],g[0],h[0],x[0],y[0]);
+ printf("i %ld j %ld m %ld len %ld\n",i,j,m,hlen);
+ }
+ if (z==MAXPAIR) goto done;
+ }
+ }
+ }
+ done:
+ if (z < MAXPAIR)
+ {
+ printf("Mix success %2ld bytes %2ld initvals ",i,m);
+ printf("required %ld trials\n",z/2);
+ }
+ }
+ printf("\n");
+}
+
+/* Check for reading beyond the end of the buffer and alignment problems */
+void driver3()
+{
+ uint8 buf[MAXLEN+20], *b;
+ uint32 len;
+ uint8 q[] = "This is the time for all good men to come to the aid of their country...";
+ //uint32 dummy1;
+ uint8 qq[] = "xThis is the time for all good men to come to the aid of their country...";
+ //uint32 dummy2;
+ uint8 qqq[] = "xxThis is the time for all good men to come to the aid of their country...";
+ //uint32 dummy3;
+ uint8 qqqq[] = "xxxThis is the time for all good men to come to the aid of their country...";
+ uint32 h,i,j,ref,x,y;
+ uint8 *p;
+
+ printf("Endianness. These lines should all be the same (for values filled in):\n");
+ printf("%.8lx %.8lx %.8lx\n",
+ hashword((uint32 *)q, (sizeof(q)-1)/4, 13),
+ hashword((uint32 *)q, (sizeof(q)-5)/4, 13),
+ hashword((uint32 *)q, (sizeof(q)-9)/4, 13));
+ p = q;
+ printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n",
+ hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
+ hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13),
+ hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13),
+ hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13),
+ hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13),
+ hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13));
+ p = &qq[1];
+ printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n",
+ hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
+ hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13),
+ hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13),
+ hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13),
+ hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13),
+ hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13));
+ p = &qqq[2];
+ printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n",
+ hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
+ hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13),
+ hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13),
+ hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13),
+ hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13),
+ hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13));
+ p = &qqqq[3];
+ printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n",
+ hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
+ hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13),
+ hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13),
+ hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13),
+ hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13),
+ hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13));
+ printf("\n");
+ for (h=0, b=buf+1; h<8; ++h, ++b)
+ {
+ for (i=0; i<MAXLEN; ++i)
+ {
+ len = i;
+ for (j=0; j<i; ++j) *(b+j)=0;
+
+ /* these should all be equal */
+ ref = hashlittle(b, len, (uint32)1);
+ *(b+i)=(uint8)~0;
+ *(b-1)=(uint8)~0;
+ x = hashlittle(b, len, (uint32)1);
+ y = hashlittle(b, len, (uint32)1);
+ if ((ref != x) || (ref != y))
+ {
+ printf("alignment error: %.8lx %.8lx %.8lx %ld %ld\n",ref,x,y,h,i);
+ }
+ }
+ }
+}
+
+/* check for problems with nulls */
+ void driver4()
+{
+ uint8 buf[1];
+ uint32 h,i,state[HASHSTATE];
+
+
+ buf[0] = ~0;
+ for (i=0; i<HASHSTATE; ++i) state[i] = 1;
+ printf("These should all be different\n");
+ for (i=0, h=0; i<8; ++i)
+ {
+ h = hashlittle(buf, (uint32)0, h);
+ printf("%2ld 0-byte strings, hash is %.8lx\n", i, h);
+ }
+}
+
+
+int main()
+{
+ driver1(); /* test that the key is hashed: used for timings */
+ driver2(); /* test that whole key is hashed thoroughly */
+ driver3(); /* test that nothing but the key is hashed */
+ driver4(); /* test hashing multiple buffers (all buffers are null) */
+ return 1;
+}
+
+#endif /* SELF_TEST */
diff --git a/plugins/Variables/src/main.cpp b/plugins/Variables/src/main.cpp index e3abe97e8b..b107d12023 100644 --- a/plugins/Variables/src/main.cpp +++ b/plugins/Variables/src/main.cpp @@ -17,25 +17,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "variables.h"
-#include "buildnumber.h"
HINSTANCE hInst;
DWORD g_mirandaVersion;
int hLangpack = 0;
-
-static HANDLE hExitHook, hModulesLoadedHook;
-
-static int Exit(WPARAM wParam, LPARAM lParam)
+static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- UnhookEvent(hExitHook);
- return 0;
-}
-
-static int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
-
- UnhookEvent(hModulesLoadedHook);
// trigger plugin
#if !defined(WINE)
initTriggerModule();
@@ -44,9 +33,9 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) { return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
- hInst=hinstDLL;
+ hInst = hinstDLL;
return TRUE;
}
@@ -55,15 +44,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
- "Variables",
- __VERSION_DWORD,
- "Adds support for dynamic variables in strings for plugins.",
- "P Boon",
- "unregistered@users.sourceforge.net",
- "© 2003-2008 P. Boon, Ricardo Pescuma, George Hazan",
- "http://miranda-ng.org/",
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
UNICODE_AWARE,
- { 0x59b0036e, 0x5403, 0x422e, { 0x88, 0x3b, 0xc9, 0xaa, 0xf4, 0x25, 0x68, 0x2b } } // {59B0036E-5403-422e-883B-C9AAF425682B}
+ // {59B0036E-5403-422E-883B-C9AAF425682B}
+ {0x59b0036e, 0x5403, 0x422e, {0x88, 0x3b, 0xc9, 0xaa, 0xf4, 0x25, 0x68, 0x2b}}
};
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
@@ -79,8 +69,7 @@ extern "C" int __declspec(dllexport) Load(void) {
mir_getLP( &pluginInfoEx );
- hExitHook = HookEvent(ME_SYSTEM_OKTOEXIT, Exit);
- hModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
LoadVarModule();
return 0;
diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp index 0220386564..e6d3577fb3 100644 --- a/plugins/Variables/src/options.cpp +++ b/plugins/Variables/src/options.cpp @@ -16,11 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "variables.h"
-extern HINSTANCE hInst;
-extern struct ParseOptions gParseOpts;
-extern int hLangpack;
+#include "variables.h"
static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index 4c859df110..233a7f761a 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_alias.h"
static CRITICAL_SECTION csAliasRegister;
static ALIASREGISTER *ar = NULL;
diff --git a/plugins/Variables/src/parse_alias.h b/plugins/Variables/src/parse_alias.h index d868841fb8..0d867f9e54 100644 --- a/plugins/Variables/src/parse_alias.h +++ b/plugins/Variables/src/parse_alias.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
typedef struct {
TCHAR *szAlias;
unsigned int argc;
diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index b8b0b5f942..2a0ade2768 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -16,9 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_external.h"
-#include "ac/ac.h"
static int (WINAPI *acEval)(const char *, char *) = NULL;
static int (WINAPI *acFormat)(const char *, char *) = NULL;
diff --git a/plugins/Variables/src/parse_external.h b/plugins/Variables/src/parse_external.h index 201b1e26a3..51e05ac242 100644 --- a/plugins/Variables/src/parse_external.h +++ b/plugins/Variables/src/parse_external.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#define WINAMPSONG "winampsong"
#define WINAMPSTATE "winampstate"
#define DEF_WINAMPTITLE "Winamp3"
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index 0fe84a7ae5..7947294a0c 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -16,9 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_inet.h"
-#include <wininet.h>
static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) {
char hex[8];
diff --git a/plugins/Variables/src/parse_inet.h b/plugins/Variables/src/parse_inet.h index 8e9bf66e1b..dc9faf4b10 100644 --- a/plugins/Variables/src/parse_inet.h +++ b/plugins/Variables/src/parse_inet.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#define URLENC "urlenc"
#define URLDEC "urldec"
#define NTOA "ntoa"
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp index 6a22c5c736..f0d33e7c79 100644 --- a/plugins/Variables/src/parse_logic.cpp +++ b/plugins/Variables/src/parse_logic.cpp @@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_logic.h"
static TCHAR *parseAnd(ARGUMENTSINFO *ai) {
diff --git a/plugins/Variables/src/parse_logic.h b/plugins/Variables/src/parse_logic.h index 774a94b670..5ce1c4c786 100644 --- a/plugins/Variables/src/parse_logic.h +++ b/plugins/Variables/src/parse_logic.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#define AND "and"
#define STR_FALSE "false"
#define FOR "for"
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp index 5c3c51f7aa..63e11fe8f5 100644 --- a/plugins/Variables/src/parse_math.cpp +++ b/plugins/Variables/src/parse_math.cpp @@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_math.h"
static TCHAR *parseAdd(ARGUMENTSINFO *ai) {
if (ai->argc < 3) {
diff --git a/plugins/Variables/src/parse_math.h b/plugins/Variables/src/parse_math.h index f185749399..d24cc31a62 100644 --- a/plugins/Variables/src/parse_math.h +++ b/plugins/Variables/src/parse_math.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#define ADD "add"
#define DIV "div"
#define HEX "hex"
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 98df006c8c..dd552ecb9b 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -18,10 +18,6 @@ */
#include "variables.h"
-#include "parse_metacontacts.h"
-#include "contact.h"
-
-#include "m_metacontacts.h"
static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
{
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 85c1c7e238..7216811be9 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -16,9 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_miranda.h"
-#include "contact.h"
static TCHAR *parseCodeToStatus(ARGUMENTSINFO *ai)
{
@@ -806,7 +805,7 @@ int registerMirandaTokens() { registerIntToken(_T(CODETOSTATUS), parseCodeToStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("translates status code x into a status description"));
registerIntToken(_T(CONTACT), parseContact, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z)\t"LPGEN("zth contact with property y described by x, example: (unregistered,nick) (z is optional)"));
registerIntToken(_T(CONTACTCOUNT), parseContactCount, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("number of contacts with property y described by x, example: (unregistered,nick)"));
- registerIntToken(_T(CONTACTINFO), parseContactInfo, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("info property y of contact x"));
+ registerIntToken(_T(MIR_CONTACTINFO), parseContactInfo, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("info property y of contact x"));
registerIntToken(_T(DBPROFILENAME), parseDBProfileName, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("db profile name"));
registerIntToken(_T(DBPROFILEPATH), parseDBProfilePath, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("db profile path"));
registerIntToken(_T(DBSETTING), parseDBSetting, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z,w)\t"LPGEN("db setting z of module y of contact x and return w if z isn't exist (w is optional)"));
diff --git a/plugins/Variables/src/parse_miranda.h b/plugins/Variables/src/parse_miranda.h index 0d429d67bb..0dd207f6c5 100644 --- a/plugins/Variables/src/parse_miranda.h +++ b/plugins/Variables/src/parse_miranda.h @@ -16,11 +16,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#define VERSIONSTRING "mirandaversion"
#define CODETOSTATUS "code2status"
#define CONTACT "contact"
#define CONTACTCOUNT "ccount"
-#define CONTACTINFO "cinfo"
+#define MIR_CONTACTINFO "cinfo"
#define DBPROFILENAME "dbprofile"
#define DBPROFILEPATH "dbprofilepath"
#define DBSETTING "dbsetting"
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index 87b3925e2d..d8ea5c31b3 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -16,10 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_regexp.h"
-#define PCRE_STATIC
-#include "pcre.h"
/*
pattern, subject
diff --git a/plugins/Variables/src/parse_regexp.h b/plugins/Variables/src/parse_regexp.h index 00d38cab59..28183e7f79 100644 --- a/plugins/Variables/src/parse_regexp.h +++ b/plugins/Variables/src/parse_regexp.h @@ -16,5 +16,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#define REGEXPCHECK "regexp_check"
#define REGEXPSUBSTR "regexp_substr"
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index df9eef63c4..37b8c4af4b 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_str.h"
static TCHAR *parseCaps(ARGUMENTSINFO *ai)
{
@@ -392,7 +392,8 @@ static TCHAR *parseRepeat(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseReplace(ARGUMENTSINFO *ai) {
+static TCHAR *parseReplace(ARGUMENTSINFO *ai)
+{
if ((ai->argc < 4) || (ai->argc%2 != 0)) {
return NULL;
}
@@ -422,7 +423,8 @@ static TCHAR *parseReplace(ARGUMENTSINFO *ai) { return res;
}
-static TCHAR *parseRight(ARGUMENTSINFO *ai) {
+static TCHAR *parseRight(ARGUMENTSINFO *ai)
+{
int len;
TCHAR *res;
@@ -842,44 +844,44 @@ static TCHAR *parseExtratext(ARGUMENTSINFO *ai) int registerStrTokens() {
- registerIntToken(_T(CAPS), parseCaps, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase, all others to lowercase"));
- registerIntToken(_T(CAPS2), parseCaps2, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase"));
- registerIntToken(_T(CRLF), parseCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t()\t"LPGEN("inserts 'end of line' character"));
- registerIntToken(_T(EXTRATEXT), parseExtratext, TRF_FIELD, LPGEN("String Functions")"\t"LPGEN("depends on calling plugin"));
- registerIntToken(_T(EOL2CRLF), parseEolToCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("Replace all occurrences of \\n (Unix) by \\r\\n (Windows)"));
- registerIntToken(_T(FIXEOL), parseFixeol, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("cuts x after the first line and appends y (y is optional)"));
- registerIntToken(_T(FIXEOL2), parseFixeol2, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("replaces all end of line characters by y (y is optional)"));
- registerIntToken(_T(INSERT), parseInsert, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("inserts string y at position z in string x"));
- registerIntToken(_T(LEFT), parseLeft, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping first y characters"));
- registerIntToken(_T(LEN), parseLen, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("length of x"));
- registerIntToken(_T(LINECOUNT), parseLineCount, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("the number of lines in string x"));
- registerIntToken(_T(LONGEST), parseLongest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the longest string of the arguments"));
- registerIntToken(_T(LOWER), parseLower, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to lowercase"));
- registerIntToken(_T(NOOP), parseNoOp, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("no operation, x as given"));
- registerIntToken(_T(PAD), parsePad, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z (z is optional)"));
- registerIntToken(_T(PADRIGHT), parsePadright, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y appending character z (z is optional)"));
- registerIntToken(_T(PADCUT), parsePadcut, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z, or cut if x is longer (z is optional)"));
- registerIntToken(_T(PADCUTRIGHT), parsePadcutright, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y appending character z, or cut if x is longer (z is optional)"));
- registerIntToken(_T(REPEAT), parseRepeat, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("repeats x y times"));
- registerIntToken(_T(REPLACE), parseReplace, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("replace all occurrences of y in x with z, multiple y and z arguments allowed"));
- registerIntToken(_T(RIGHT), parseRight, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping last y characters"));
- registerIntToken(_T(SCROLL), parseScroll, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("moves string x, z characters to the left and trims it to y characters"));
- registerIntToken(_T(STRCMP), parseStrcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y"));
- registerIntToken(_T(STRMCMP), parseStrmcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("TRUE if x equals any of the following arguments"));
- registerIntToken(_T(STRNCMP), parseStrncmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("TRUE if the first z characters of x equal y"));
- registerIntToken(_T(STRICMP), parseStricmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y, ignoring case"));
- registerIntToken(_T(STRNICMP), parseStrnicmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if the first z characters of x equal y, ignoring case"));
- registerIntToken(_T(SHORTEST), parseShortest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the shortest string of the arguments"));
- registerIntToken(_T(STRCHR), parseStrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of character y in string x"));
- registerIntToken(_T(STRRCHR), parseStrrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of last occurrence of character y in string x"));
- registerIntToken(_T(STRSTR), parseStrstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of string y in x"));
- registerIntToken(_T(SUBSTR), parseSubstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("substring of x starting from position y to z"));
- registerIntToken(_T(SELECT), parseSelect, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the xth string of the arguments"));
- registerIntToken(_T(SWITCH), parseSwitch, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("z if y equals x, multiple y and z arguments allowed"));
- registerIntToken(_T(TRIM), parseTrim, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("removes white spaces in before and after x"));
- registerIntToken(_T(TAB), parseTab, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("inserts x tab characters (x is optional)"));
- registerIntToken(_T(UPPER), parseUpper, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to upper case"));
- registerIntToken(_T(WORD), parseWord, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("words (separated by white spaces) number y to z from string x (z is optional)"));
+ registerIntToken(_T(MIR_CAPS), parseCaps, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase, all others to lowercase"));
+ registerIntToken(_T(MIR_CAPS2), parseCaps2, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase"));
+ registerIntToken(_T(MIR_CRLF), parseCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t()\t"LPGEN("inserts 'end of line' character"));
+ registerIntToken(_T(MIR_EXTRATEXT), parseExtratext, TRF_FIELD, LPGEN("String Functions")"\t"LPGEN("depends on calling plugin"));
+ registerIntToken(_T(MIR_EOL2CRLF), parseEolToCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("Replace all occurrences of \\n (Unix) by \\r\\n (Windows)"));
+ registerIntToken(_T(MIR_FIXEOL), parseFixeol, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("cuts x after the first line and appends y (y is optional)"));
+ registerIntToken(_T(MIR_FIXEOL2), parseFixeol2, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("replaces all end of line characters by y (y is optional)"));
+ registerIntToken(_T(MIR_INSERT), parseInsert, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("inserts string y at position z in string x"));
+ registerIntToken(_T(MIR_LEFT), parseLeft, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping first y characters"));
+ registerIntToken(_T(MIR_LEN), parseLen, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("length of x"));
+ registerIntToken(_T(MIR_LINECOUNT), parseLineCount, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("the number of lines in string x"));
+ registerIntToken(_T(MIR_LONGEST), parseLongest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the longest string of the arguments"));
+ registerIntToken(_T(MIR_LOWER), parseLower, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to lowercase"));
+ registerIntToken(_T(MIR_NOOP), parseNoOp, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("no operation, x as given"));
+ registerIntToken(_T(MIR_PAD), parsePad, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z (z is optional)"));
+ registerIntToken(_T(MIR_PADRIGHT), parsePadright, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y appending character z (z is optional)"));
+ registerIntToken(_T(MIR_PADCUT), parsePadcut, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z, or cut if x is longer (z is optional)"));
+ registerIntToken(_T(MIR_PADCUTRIGHT), parsePadcutright, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y appending character z, or cut if x is longer (z is optional)"));
+ registerIntToken(_T(MIR_REPEAT), parseRepeat, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("repeats x y times"));
+ registerIntToken(_T(MIR_REPLACE), parseReplace, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("replace all occurrences of y in x with z, multiple y and z arguments allowed"));
+ registerIntToken(_T(MIR_RIGHT), parseRight, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping last y characters"));
+ registerIntToken(_T(MIR_SCROLL), parseScroll, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("moves string x, z characters to the left and trims it to y characters"));
+ registerIntToken(_T(MIR_STRCMP), parseStrcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y"));
+ registerIntToken(_T(MIR_STRMCMP), parseStrmcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("TRUE if x equals any of the following arguments"));
+ registerIntToken(_T(MIR_STRNCMP), parseStrncmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("TRUE if the first z characters of x equal y"));
+ registerIntToken(_T(MIR_STRICMP), parseStricmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y, ignoring case"));
+ registerIntToken(_T(MIR_STRNICMP), parseStrnicmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if the first z characters of x equal y, ignoring case"));
+ registerIntToken(_T(MIR_SHORTEST), parseShortest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the shortest string of the arguments"));
+ registerIntToken(_T(MIR_STRCHR), parseStrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of character y in string x"));
+ registerIntToken(_T(MIR_STRRCHR), parseStrrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of last occurrence of character y in string x"));
+ registerIntToken(_T(MIR_STRSTR), parseStrstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of string y in x"));
+ registerIntToken(_T(MIR_SUBSTR), parseSubstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("substring of x starting from position y to z"));
+ registerIntToken(_T(MIR_SELECT), parseSelect, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the xth string of the arguments"));
+ registerIntToken(_T(MIR_SWITCH), parseSwitch, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("z if y equals x, multiple y and z arguments allowed"));
+ registerIntToken(_T(MIR_TRIM), parseTrim, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("removes white spaces in before and after x"));
+ registerIntToken(_T(MIR_TAB), parseTab, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("inserts x tab characters (x is optional)"));
+ registerIntToken(_T(MIR_UPPER), parseUpper, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to upper case"));
+ registerIntToken(_T(MIR_WORD), parseWord, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("words (separated by white spaces) number y to z from string x (z is optional)"));
return 0;
}
diff --git a/plugins/Variables/src/parse_str.h b/plugins/Variables/src/parse_str.h index 7942da455f..53fcd78300 100644 --- a/plugins/Variables/src/parse_str.h +++ b/plugins/Variables/src/parse_str.h @@ -16,41 +16,42 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define CAPS "caps"
-#define CAPS2 "caps2"
-#define CRLF "crlf"
-//#define EXTRATEXT "extratext" // defined in variables.h
-#define EOL2CRLF "eol2crlf"
-#define FIXEOL "fix_eol"
-#define FIXEOL2 "fix_eol2"
-#define INSERT "insert"
-#define LEFT "left"
-#define LEN "len"
-#define LINECOUNT "linecount"
-#define LONGEST "longest"
-#define LOWER "lower"
-#define NOOP "noop"
-#define PAD "pad"
-#define PADRIGHT "pad_right"
-#define PADCUT "padcut"
-#define PADCUTRIGHT "padcut_right"
-#define REPEAT "repeat"
-#define REPLACE "replace"
-#define RIGHT "right"
-#define SCROLL "scroll"
-#define SHORTEST "shortest"
-#define STRCHR "strchr"
-#define STRRCHR "strrchr"
-#define STRSTR "strstr"
-#define STRCMP "strcmp"
-#define STRNCMP "strncmp"
-#define STRMCMP "strmcmp"
-#define STRICMP "stricmp"
-#define STRNICMP "strnicmp"
-#define SUBSTR "substr"
-#define SELECT "select"
-#define SWITCH "switch"
-#define TRIM "trim"
-#define TAB "tab"
-#define UPPER "upper"
-#define WORD "word"
+
+#define MIR_CAPS "caps"
+#define MIR_CAPS2 "caps2"
+#define MIR_CRLF "crlf"
+//#define MIR_EXTRATEXT "extratext" // defined in variables.h
+#define MIR_EOL2CRLF "eol2crlf"
+#define MIR_FIXEOL "fix_eol"
+#define MIR_FIXEOL2 "fix_eol2"
+#define MIR_INSERT "insert"
+#define MIR_LEFT "left"
+#define MIR_LEN "len"
+#define MIR_LINECOUNT "linecount"
+#define MIR_LONGEST "longest"
+#define MIR_LOWER "lower"
+#define MIR_NOOP "noop"
+#define MIR_PAD "pad"
+#define MIR_PADRIGHT "pad_right"
+#define MIR_PADCUT "padcut"
+#define MIR_PADCUTRIGHT "padcut_right"
+#define MIR_REPEAT "repeat"
+#define MIR_REPLACE "replace"
+#define MIR_RIGHT "right"
+#define MIR_SCROLL "scroll"
+#define MIR_SHORTEST "shortest"
+#define MIR_STRCHR "strchr"
+#define MIR_STRRCHR "strrchr"
+#define MIR_STRSTR "strstr"
+#define MIR_STRCMP "strcmp"
+#define MIR_STRNCMP "strncmp"
+#define MIR_STRMCMP "strmcmp"
+#define MIR_STRICMP "stricmp"
+#define MIR_STRNICMP "strnicmp"
+#define MIR_SUBSTR "substr"
+#define MIR_SELECT "select"
+#define MIR_SWITCH "switch"
+#define MIR_TRIM "trim"
+#define MIR_TAB "tab"
+#define MIR_UPPER "upper"
+#define MIR_WORD "word"
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index e702ca9ea1..67ebf3dd0e 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -16,22 +16,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_system.h"
-#include <tchar.h>
-#include <lmcons.h>
-#include <sys/stat.h>
-
-#ifdef WINE
- #ifdef _WIN32_WINNT
- #undef _WIN32_WINNT
- #endif
- #define _WIN32_WINNT 0x400
-#else
- #include "enumprocs.h"
-#endif
-static TCHAR *parseComputerName(ARGUMENTSINFO *ai) {
+static TCHAR *parseComputerName(ARGUMENTSINFO *ai)
+{
if (ai->argc != 1)
return NULL;
diff --git a/plugins/Variables/src/parse_system.h b/plugins/Variables/src/parse_system.h index d4349130f7..24bf78ef60 100644 --- a/plugins/Variables/src/parse_system.h +++ b/plugins/Variables/src/parse_system.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#define COMPUTERNAME "computername"
#define CPULOAD "cpuload"
#define CDATE "cdate"
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index 8f311e1ab6..2563d0e954 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_variables.h"
// this is for get and put(s)
static CRITICAL_SECTION csVarRegister;
diff --git a/plugins/Variables/src/parse_variables.h b/plugins/Variables/src/parse_variables.h index 5bde654f5f..b46ede4351 100644 --- a/plugins/Variables/src/parse_variables.h +++ b/plugins/Variables/src/parse_variables.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
typedef struct {
TCHAR *szName;
TCHAR *szText;
diff --git a/plugins/Variables/src/parse_xml.cpp b/plugins/Variables/src/parse_xml.cpp index 2a4a8a0a7b..98c622622b 100644 --- a/plugins/Variables/src/parse_xml.cpp +++ b/plugins/Variables/src/parse_xml.cpp @@ -16,21 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
-#include "parse_xml.h"
-
-#include <string.h>
-#include "libxml/xmlmemory.h"
-#include "libxml/debugXML.h"
-#include "libxml/HTMLtree.h"
-#include "libxml/xmlIO.h"
-#include "libxml/DOCBparser.h"
-#include "libxml/xinclude.h"
-#include "libxml/catalog.h"
-#include "libxslt/xslt.h"
-#include "libxslt/xsltInternals.h"
-#include "libxslt/transform.h"
-#include "libxslt/xsltutils.h"
xsltStylesheetPtr (*pXsltParseStylesheetDoc)(xmlDocPtr doc);
xmlDocPtr (*pXmlParseMemory)(const char * buffer, int size);
diff --git a/plugins/Variables/src/pcre/include/pcreposix.h b/plugins/Variables/src/pcre/include/pcreposix.h deleted file mode 100644 index c77c0b0523..0000000000 --- a/plugins/Variables/src/pcre/include/pcreposix.h +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -#ifndef _PCREPOSIX_H -#define _PCREPOSIX_H - -/* This is the header for the POSIX wrapper interface to the PCRE Perl- -Compatible Regular Expression library. It defines the things POSIX says should -be there. I hope. - - Copyright (c) 1997-2012 University of Cambridge - ------------------------------------------------------------------------------ -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the University of Cambridge nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------ -*/ - -/* Have to include stdlib.h in order to ensure that size_t is defined. */ - -#include <stdlib.h> - -/* Allow for C++ users */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Options, mostly defined by POSIX, but with some extras. */ - -#define REG_ICASE 0x0001 /* Maps to PCRE_CASELESS */ -#define REG_NEWLINE 0x0002 /* Maps to PCRE_MULTILINE */ -#define REG_NOTBOL 0x0004 /* Maps to PCRE_NOTBOL */ -#define REG_NOTEOL 0x0008 /* Maps to PCRE_NOTEOL */ -#define REG_DOTALL 0x0010 /* NOT defined by POSIX; maps to PCRE_DOTALL */ -#define REG_NOSUB 0x0020 /* Maps to PCRE_NO_AUTO_CAPTURE */ -#define REG_UTF8 0x0040 /* NOT defined by POSIX; maps to PCRE_UTF8 */ -#define REG_STARTEND 0x0080 /* BSD feature: pass subject string by so,eo */ -#define REG_NOTEMPTY 0x0100 /* NOT defined by POSIX; maps to PCRE_NOTEMPTY */ -#define REG_UNGREEDY 0x0200 /* NOT defined by POSIX; maps to PCRE_UNGREEDY */ -#define REG_UCP 0x0400 /* NOT defined by POSIX; maps to PCRE_UCP */ - -/* This is not used by PCRE, but by defining it we make it easier -to slot PCRE into existing programs that make POSIX calls. */ - -#define REG_EXTENDED 0 - -/* Error values. Not all these are relevant or used by the wrapper. */ - -enum { - REG_ASSERT = 1, /* internal error ? */ - REG_BADBR, /* invalid repeat counts in {} */ - REG_BADPAT, /* pattern error */ - REG_BADRPT, /* ? * + invalid */ - REG_EBRACE, /* unbalanced {} */ - REG_EBRACK, /* unbalanced [] */ - REG_ECOLLATE, /* collation error - not relevant */ - REG_ECTYPE, /* bad class */ - REG_EESCAPE, /* bad escape sequence */ - REG_EMPTY, /* empty expression */ - REG_EPAREN, /* unbalanced () */ - REG_ERANGE, /* bad range inside [] */ - REG_ESIZE, /* expression too big */ - REG_ESPACE, /* failed to get memory */ - REG_ESUBREG, /* bad back reference */ - REG_INVARG, /* bad argument */ - REG_NOMATCH /* match failed */ -}; - - -/* The structure representing a compiled regular expression. */ - -typedef struct { - void *re_pcre; - size_t re_nsub; - size_t re_erroffset; -} regex_t; - -/* The structure in which a captured offset is returned. */ - -typedef int regoff_t; - -typedef struct { - regoff_t rm_so; - regoff_t rm_eo; -} regmatch_t; - -/* When an application links to a PCRE DLL in Windows, the symbols that are -imported have to be identified as such. When building PCRE, the appropriate -export settings are needed, and are set in pcreposix.c before including this -file. */ - -#if defined(_WIN32) && !defined(PCRE_STATIC) && !defined(PCREPOSIX_EXP_DECL) -# define PCREPOSIX_EXP_DECL extern __declspec(dllimport) -# define PCREPOSIX_EXP_DEFN __declspec(dllimport) -#endif - -/* By default, we use the standard "extern" declarations. */ - -#ifndef PCREPOSIX_EXP_DECL -# ifdef __cplusplus -# define PCREPOSIX_EXP_DECL extern "C" -# define PCREPOSIX_EXP_DEFN extern "C" -# else -# define PCREPOSIX_EXP_DECL extern -# define PCREPOSIX_EXP_DEFN extern -# endif -#endif - -/* The functions */ - -PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int); -PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t, - regmatch_t *, int); -PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t); -PCREPOSIX_EXP_DECL void regfree(regex_t *); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* End of pcreposix.h */ diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp index 5da24aed01..67c89301ae 100644 --- a/plugins/Variables/src/tokenregister.cpp +++ b/plugins/Variables/src/tokenregister.cpp @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
typedef struct {
diff --git a/plugins/Variables/src/trigger_variables.cpp b/plugins/Variables/src/trigger_variables.cpp index 6b90088c4f..f00b02d969 100644 --- a/plugins/Variables/src/trigger_variables.cpp +++ b/plugins/Variables/src/trigger_variables.cpp @@ -16,12 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "variables.h"
-#include "m_trigger.h"
-#include "trigger_variables.h"
-#include "resource.h"
-extern HINSTANCE hInst;
+#include "variables.h"
static TRG_VAR_CACHE *tvc = NULL;
static int tvcCount = 0;
diff --git a/plugins/Variables/src/trigger_variables.h b/plugins/Variables/src/trigger_variables.h index 6b80087e2d..6ebea2fbe3 100644 --- a/plugins/Variables/src/trigger_variables.h +++ b/plugins/Variables/src/trigger_variables.h @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#define TRIGGERNAME "Variables: String changed"
#define SETTING_TRIGGERTEXT "trigger_TriggerText"
#define CHECKSTRINGDELAY 5000
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index 86c8efe983..4758f9f167 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "variables.h"
BOOL (WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
@@ -38,8 +39,6 @@ HCURSOR hCurSplitNS; struct ParseOptions gParseOpts;
-extern HINSTANCE hInst;
-
TCHAR *getArguments(TCHAR *string, TCHAR ***aargv, int *aargc) {
BOOL bDontParse, bNewArg, bDone;
diff --git a/plugins/Variables/src/variables.h b/plugins/Variables/src/variables.h index 3030b41f2e..533bc8ae98 100644 --- a/plugins/Variables/src/variables.h +++ b/plugins/Variables/src/variables.h @@ -19,35 +19,67 @@ #define _CRT_NON_CONFORMING_SWPRINTFS
#define _CRT_SECURE_NO_WARNINGS
+#define PCRE_STATIC
-#include <tchar.h>
#include <malloc.h>
-
#include <windows.h>
-#include <commctrl.h>
-#include "uxtheme.h"
-#include <stdio.h>
+#include <uxtheme.h>
#include <time.h>
-#include "resource.h"
-#ifndef WINE
+#include <tlhelp32.h>
+#include <vdmdbg.h>
+#include <lmcons.h>
+
#include <win2k.h>
-#endif
#include <newpluginapi.h>
-#include <m_system_cpp.h>
#include <m_langpack.h>
#include <m_database.h>
#include <m_protosvc.h>
#include <m_clist.h>
#include <m_contacts.h>
-#include <m_awaymsg.h>
#include <m_options.h>
-#include <m_utils.h>
#include <m_icolib.h>
-#include "m_variables.h"
+#include <m_clui.h>
+#include <m_clc.h>
+
+#include <m_variables.h>
+#include <m_trigger.h>
+#include <m_metacontacts.h>
+
+#include "..\helpers\gen_helpers.h"
+
+#include "ac\ac.h"
+#include "pcre\include\pcre.h"
+#include "libxml\xmlmemory.h"
+#include "libxml\debugXML.h"
+#include "libxml\HTMLtree.h"
+#include "libxml\xmlIO.h"
+#include "libxml\DOCBparser.h"
+#include "libxml\xinclude.h"
+#include "libxml\catalog.h"
+#include "libxslt\xslt.h"
+#include "libxslt\xsltInternals.h"
+#include "libxslt\transform.h"
+#include "libxslt\xsltutils.h"
-#define MODULENAME "Variables"
+#include "resource.h"
+#include "version.h"
+#include "contact.h"
+#include "trigger_variables.h"
+#include "enumprocs.h"
+#include "parse_alias.h"
+#include "parse_external.h"
+#include "parse_inet.h"
+#include "parse_logic.h"
+#include "parse_math.h"
+#include "parse_metacontacts.h"
+#include "parse_miranda.h"
+#include "parse_regexp.h"
+#include "parse_str.h"
+#include "parse_system.h"
+#include "parse_variables.h"
+#include "parse_xml.h"
-#include "../helpers/gen_helpers.h"
+#define MODULENAME "Variables"
#define SETTING_STARTUPTEXT "StartupText"
#define SETTING_STRIPCRLF "StripCRLF"
@@ -67,7 +99,7 @@ // special tokens
#define SUBJECT "subject"
-#define EXTRATEXT "extratext"
+#define MIR_EXTRATEXT "extratext"
// options
#define IDT_PARSE 1
@@ -104,6 +136,11 @@ struct ParseOptions { BOOL bStripAll;
};
+extern BOOL (WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD);
+extern HINSTANCE hInst;
+extern struct ParseOptions gParseOpts;
+extern int hLangpack;
+
// variables.c
//TCHAR *getArguments(char *string, char ***aargv, int *aargc);
//int isValidTokenChar(char c);
|