diff --git a/project/java/MainActivity.java b/project/java/MainActivity.java index acdf070cf..bafea538a 100644 --- a/project/java/MainActivity.java +++ b/project/java/MainActivity.java @@ -420,6 +420,11 @@ public class MainActivity extends Activity mGLView.requestFocus(); }; + public boolean isScreenKeyboardShown() + { + return _screenKeyboard != null; + }; + final static int ADVERTISEMENT_POSITION_RIGHT = -1; final static int ADVERTISEMENT_POSITION_BOTTOM = -1; final static int ADVERTISEMENT_POSITION_CENTER = -2; diff --git a/project/java/Video.java b/project/java/Video.java index 829cb16fd..6d86192a0 100644 --- a/project/java/Video.java +++ b/project/java/Video.java @@ -564,6 +564,26 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer context.runOnUiThread(cb); } + public void hideScreenKeyboard() // Called from native code + { + class Callback implements Runnable + { + public MainActivity parent; + public void run() + { + parent.hideScreenKeyboard(); + } + } + Callback cb = new Callback(); + cb.parent = context; + context.runOnUiThread(cb); + } + + public int isScreenKeyboardShown() // Called from native code + { + return context.isScreenKeyboardShown() ? 1 : 0; + } + public void exitApp() { nativeDone(); diff --git a/project/jni/jpeg/include/jpeglib.h b/project/jni/jpeg/include/jpeglib.h index 0f3a54791..96cc5451b 100644 --- a/project/jni/jpeg/include/jpeglib.h +++ b/project/jni/jpeg/include/jpeglib.h @@ -13,6 +13,10 @@ #ifndef JPEGLIB_H #define JPEGLIB_H +#ifdef __cplusplus +extern "C" { +#endif + /* * First we include the configuration files that record how this * installation of the JPEG library is set up. jconfig.h can be @@ -1097,4 +1101,8 @@ struct jpeg_color_quantizer { long dummy; }; #include "jerror.h" /* fetch error codes too */ #endif +#ifdef __cplusplus +} +#endif + #endif /* JPEGLIB_H */ diff --git a/project/jni/mxml/include/mxml.h b/project/jni/mxml/include/mxml.h index a5d7ee6e4..79c711f4c 100644 --- a/project/jni/mxml/include/mxml.h +++ b/project/jni/mxml/include/mxml.h @@ -1,19 +1,17 @@ /* - * "$Id: mxml.h 385 2009-03-19 05:38:52Z mike $" + * "$Id: mxml.h 427 2011-01-03 02:03:29Z mike $" * * Header file for Mini-XML, a small XML-like file parsing library. * - * Copyright 2003-2009 by Michael Sweet. + * Copyright 2003-2011 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ */ /* @@ -98,32 +96,32 @@ typedef void (*mxml_custom_destroy_cb_t)(void *); typedef void (*mxml_error_cb_t)(const char *); /**** Error callback function ****/ -typedef struct mxml_attr_s /**** An XML element attribute value. ****/ +typedef struct mxml_attr_s /**** An XML element attribute value. @private@ ****/ { char *name; /* Attribute name */ char *value; /* Attribute value */ } mxml_attr_t; -typedef struct mxml_element_s /**** An XML element value. ****/ +typedef struct mxml_element_s /**** An XML element value. @private@ ****/ { char *name; /* Name of element */ int num_attrs; /* Number of attributes */ mxml_attr_t *attrs; /* Attributes */ } mxml_element_t; -typedef struct mxml_text_s /**** An XML text value. ****/ +typedef struct mxml_text_s /**** An XML text value. @private@ ****/ { int whitespace; /* Leading whitespace? */ char *string; /* Fragment string */ } mxml_text_t; -typedef struct mxml_custom_s /**** An XML custom value. @since Mini-XML 2.1@ ****/ +typedef struct mxml_custom_s /**** An XML custom value. @private@ ****/ { void *data; /* Pointer to (allocated) custom data */ mxml_custom_destroy_cb_t destroy; /* Pointer to destructor function */ } mxml_custom_t; -typedef union mxml_value_u /**** An XML node value. ****/ +typedef union mxml_value_u /**** An XML node value. @private@ ****/ { mxml_element_t element; /* Element */ int integer; /* Integer number */ @@ -133,7 +131,7 @@ typedef union mxml_value_u /**** An XML node value. ****/ mxml_custom_t custom; /* Custom data @since Mini-XML 2.1@ */ } mxml_value_t; -typedef struct mxml_node_s /**** An XML node. ****/ +struct mxml_node_s /**** An XML node. @private@ ****/ { mxml_type_t type; /* Node type */ struct mxml_node_s *next; /* Next node under same parent */ @@ -144,16 +142,21 @@ typedef struct mxml_node_s /**** An XML node. ****/ mxml_value_t value; /* Node value */ int ref_count; /* Use count */ void *user_data; /* User data */ -} mxml_node_t; +}; -typedef struct mxml_index_s /**** An XML node index. ****/ +typedef struct mxml_node_s mxml_node_t; /**** An XML node. ****/ + +struct mxml_index_s /**** An XML node index. @private@ ****/ { char *attr; /* Attribute used for indexing or NULL */ int num_nodes; /* Number of nodes in index */ int alloc_nodes; /* Allocated nodes in index */ int cur_node; /* Current node */ mxml_node_t **nodes; /* Node array */ -} mxml_index_t; +}; + +typedef struct mxml_index_s mxml_index_t; + /**** An XML node index. ****/ typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *); /**** Custom data load callback function ****/ @@ -207,11 +210,28 @@ extern void mxmlEntityRemoveCallback(mxml_entity_cb_t cb); extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top, const char *name, const char *attr, const char *value, int descend); +extern mxml_node_t *mxmlFindPath(mxml_node_t *node, const char *path); +extern const char *mxmlGetCDATA(mxml_node_t *node); +extern const void *mxmlGetCustom(mxml_node_t *node); +extern const char *mxmlGetElement(mxml_node_t *node); +extern mxml_node_t *mxmlGetFirstChild(mxml_node_t *node); +extern int mxmlGetInteger(mxml_node_t *node); +extern mxml_node_t *mxmlGetLastChild(mxml_node_t *node); +extern mxml_node_t *mxmlGetNextSibling(mxml_node_t *node); +extern const char *mxmlGetOpaque(mxml_node_t *node); +extern mxml_node_t *mxmlGetParent(mxml_node_t *node); +extern mxml_node_t *mxmlGetPrevSibling(mxml_node_t *node); +extern double mxmlGetReal(mxml_node_t *node); +extern int mxmlGetRefCount(mxml_node_t *node); +extern const char *mxmlGetText(mxml_node_t *node, int *whitespace); +extern mxml_type_t mxmlGetType(mxml_node_t *node); +extern void *mxmlGetUserData(mxml_node_t *node); extern void mxmlIndexDelete(mxml_index_t *ind); extern mxml_node_t *mxmlIndexEnum(mxml_index_t *ind); extern mxml_node_t *mxmlIndexFind(mxml_index_t *ind, const char *element, const char *value); +extern int mxmlIndexGetCount(mxml_index_t *ind); extern mxml_index_t *mxmlIndexNew(mxml_node_t *node, const char *element, const char *attr); extern mxml_node_t *mxmlIndexReset(mxml_index_t *ind); @@ -275,6 +295,7 @@ extern int mxmlSetTextf(mxml_node_t *node, int whitespace, __attribute__ ((__format__ (__printf__, 3, 4))) # endif /* __GNUC__ */ ; +extern int mxmlSetUserData(mxml_node_t *node, void *data); extern void mxmlSetWrapMargin(int column); extern mxml_node_t *mxmlWalkNext(mxml_node_t *node, mxml_node_t *top, int descend); @@ -304,5 +325,5 @@ extern mxml_type_t mxml_real_cb(mxml_node_t *node); /* - * End of "$Id: mxml.h 385 2009-03-19 05:38:52Z mike $". + * End of "$Id: mxml.h 427 2011-01-03 02:03:29Z mike $". */ diff --git a/project/jni/mxml/src/config.h b/project/jni/mxml/src/config.h index 02672b483..1f59ba34a 100644 --- a/project/jni/mxml/src/config.h +++ b/project/jni/mxml/src/config.h @@ -1,19 +1,18 @@ +/* config.h. Generated from config.h.in by configure. */ /* - * "$Id: config.h.in 387 2009-04-18 17:05:52Z mike $" + * "$Id: config.h.in 408 2010-09-19 05:26:46Z mike $" * * Configuration file for Mini-XML, a small XML-like file parsing library. * - * Copyright 2003-2009 by Michael Sweet. + * Copyright 2003-2010 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ */ /* @@ -31,14 +30,14 @@ * Version number... */ -#define MXML_VERSION "2.6" +#define MXML_VERSION "Mini-XML v2.7" /* * Inline function support... */ -/* #define inline */ +#define inline /* @@ -93,5 +92,5 @@ extern int _mxml_vsnprintf(char *, size_t, const char *, va_list); # endif /* !HAVE_VSNPRINTF */ /* - * End of "$Id: config.h.in 387 2009-04-18 17:05:52Z mike $". + * End of "$Id: config.h.in 408 2010-09-19 05:26:46Z mike $". */ diff --git a/project/jni/mxml/src/mxml-attr.c b/project/jni/mxml/src/mxml-attr.c index 33a664902..c9950f5fb 100644 --- a/project/jni/mxml/src/mxml-attr.c +++ b/project/jni/mxml/src/mxml-attr.c @@ -1,19 +1,17 @@ /* - * "$Id: mxml-attr.c 308 2007-09-15 20:04:56Z mike $" + * "$Id: mxml-attr.c 408 2010-09-19 05:26:46Z mike $" * * Attribute support code for Mini-XML, a small XML-like file parsing library. * - * Copyright 2003-2007 by Michael Sweet. + * Copyright 2003-2010 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ * * Contents: * @@ -317,5 +315,5 @@ mxml_set_attr(mxml_node_t *node, /* I - Element node */ /* - * End of "$Id: mxml-attr.c 308 2007-09-15 20:04:56Z mike $". + * End of "$Id: mxml-attr.c 408 2010-09-19 05:26:46Z mike $". */ diff --git a/project/jni/mxml/src/mxml-entity.c b/project/jni/mxml/src/mxml-entity.c index c1d0c234c..c5c9f61f7 100644 --- a/project/jni/mxml/src/mxml-entity.c +++ b/project/jni/mxml/src/mxml-entity.c @@ -1,20 +1,18 @@ /* - * "$Id: mxml-entity.c 385 2009-03-19 05:38:52Z mike $" + * "$Id: mxml-entity.c 408 2010-09-19 05:26:46Z mike $" * * Character entity support code for Mini-XML, a small XML-like * file parsing library. * - * Copyright 2003-2009 by Michael Sweet. + * Copyright 2003-2010 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ * * Contents: * @@ -458,5 +456,5 @@ _mxml_entity_cb(const char *name) /* I - Entity name */ /* - * End of "$Id: mxml-entity.c 385 2009-03-19 05:38:52Z mike $". + * End of "$Id: mxml-entity.c 408 2010-09-19 05:26:46Z mike $". */ diff --git a/project/jni/mxml/src/mxml-file.c b/project/jni/mxml/src/mxml-file.c index 906d754e2..992704037 100644 --- a/project/jni/mxml/src/mxml-file.c +++ b/project/jni/mxml/src/mxml-file.c @@ -1,26 +1,24 @@ /* - * "$Id: mxml-file.c 391 2009-05-17 05:20:52Z mike $" + * "$Id: mxml-file.c 438 2011-03-24 05:47:51Z mike $" * * File loading code for Mini-XML, a small XML-like file parsing library. * - * Copyright 2003-2009 by Michael Sweet. + * Copyright 2003-2011 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ * * Contents: * * mxmlLoadFd() - Load a file descriptor into an XML node tree. * mxmlLoadFile() - Load a file into an XML node tree. * mxmlLoadString() - Load a string into an XML node tree. - * mxmlSaveAllocString() - Save an XML node tree to an allocated string. + * mxmlSaveAllocString() - Save an XML tree to an allocated string. * mxmlSaveFd() - Save an XML tree to a file descriptor. * mxmlSaveFile() - Save an XML tree to a file. * mxmlSaveString() - Save an XML node tree to a string. @@ -32,7 +30,7 @@ * using a SAX callback. * mxmlSetCustomHandlers() - Set the handling functions for custom data. * mxmlSetErrorCallback() - Set the error message callback. - * mxmlSetWrapMargin() - Set the the wrap margin when saving XML data. + * mxmlSetWrapMargin() - Set the wrap margin when saving XML data. * mxml_add_char() - Add a character to a buffer, expanding as needed. * mxml_fd_getc() - Read a character from a file descriptor. * mxml_fd_putc() - Write a character to a file descriptor. @@ -232,7 +230,7 @@ mxmlLoadString(mxml_node_t *top, /* I - Top node */ /* - * 'mxmlSaveAllocString()' - Save an XML node tree to an allocated string. + * 'mxmlSaveAllocString()' - Save an XML tree to an allocated string. * * This function returns a pointer to a string containing the textual * representation of the XML node tree. The string should be freed @@ -602,7 +600,7 @@ mxmlSetErrorCallback(mxml_error_cb_t cb)/* I - Error callback function */ /* - * 'mxmlSetWrapMargin()' - Set the the wrap margin when saving XML data. + * 'mxmlSetWrapMargin()' - Set the wrap margin when saving XML data. * * Wrapping is disabled when "column" is 0. * @@ -1567,19 +1565,22 @@ mxml_load_data( if (ch == '<' && whitespace && type == MXML_TEXT) { - node = mxmlNewText(parent, whitespace, ""); - - if (sax_cb) + if (parent) { - (*sax_cb)(node, MXML_SAX_DATA, sax_data); + node = mxmlNewText(parent, whitespace, ""); - if (!mxmlRelease(node)) - node = NULL; + if (sax_cb) + { + (*sax_cb)(node, MXML_SAX_DATA, sax_data); + + if (!mxmlRelease(node)) + node = NULL; + } + + if (!first && node) + first = node; } - if (!first && node) - first = node; - whitespace = 0; } @@ -1652,6 +1653,17 @@ mxml_load_data( *bufptr = '\0'; + if (!parent && first) + { + /* + * There can only be one root element! + */ + + mxml_error("<%s> cannot be a second root node after <%s>", + buffer, first->value.element.name); + goto error; + } + if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* @@ -1709,6 +1721,17 @@ mxml_load_data( *bufptr = '\0'; + if (!parent && first) + { + /* + * There can only be one root element! + */ + + mxml_error("<%s> cannot be a second root node after <%s>", + buffer, first->value.element.name); + goto error; + } + if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* @@ -1765,6 +1788,17 @@ mxml_load_data( *bufptr = '\0'; + if (!parent && first) + { + /* + * There can only be one root element! + */ + + mxml_error("<%s> cannot be a second root node after <%s>", + buffer, first->value.element.name); + goto error; + } + if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* @@ -1840,6 +1874,17 @@ mxml_load_data( *bufptr = '\0'; + if (!parent && first) + { + /* + * There can only be one root element! + */ + + mxml_error("<%s> cannot be a second root node after <%s>", + buffer, first->value.element.name); + goto error; + } + if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* @@ -1904,7 +1949,8 @@ mxml_load_data( { (*sax_cb)(node, MXML_SAX_ELEMENT_CLOSE, sax_data); - mxmlRelease(node); + if (!mxmlRelease(node) && first == node) + first = NULL; } /* @@ -1920,6 +1966,17 @@ mxml_load_data( * Handle open tag... */ + if (!parent && first) + { + /* + * There can only be one root element! + */ + + mxml_error("<%s> cannot be a second root node after <%s>", + buffer, first->value.element.name); + goto error; + } + if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* @@ -2686,257 +2743,253 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */ char s[255]; /* Temporary string */ - while (node != NULL) + /* + * Print the node value... + */ + + switch (node->type) { - /* - * Print the node value... - */ + case MXML_ELEMENT : + col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_OPEN, col, putc_cb); - switch (node->type) - { - case MXML_ELEMENT : - col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_OPEN, col, putc_cb); + if ((*putc_cb)('<', p) < 0) + return (-1); + if (node->value.element.name[0] == '?' || + !strncmp(node->value.element.name, "!--", 3) || + !strncmp(node->value.element.name, "![CDATA[", 8)) + { + /* + * Comments, CDATA, and processing instructions do not + * use character entities. + */ - if ((*putc_cb)('<', p) < 0) - return (-1); - if (node->value.element.name[0] == '?' || - !strncmp(node->value.element.name, "!--", 3) || - !strncmp(node->value.element.name, "![CDATA[", 8)) - { - /* - * Comments, CDATA, and processing instructions do not - * use character entities. - */ - - const char *ptr; /* Pointer into name */ + const char *ptr; /* Pointer into name */ - for (ptr = node->value.element.name; *ptr; ptr ++) - if ((*putc_cb)(*ptr, p) < 0) - return (-1); - } - else if (mxml_write_name(node->value.element.name, p, putc_cb) < 0) - return (-1); + for (ptr = node->value.element.name; *ptr; ptr ++) + if ((*putc_cb)(*ptr, p) < 0) + return (-1); + } + else if (mxml_write_name(node->value.element.name, p, putc_cb) < 0) + return (-1); - col += strlen(node->value.element.name) + 1; + col += strlen(node->value.element.name) + 1; - for (i = node->value.element.num_attrs, attr = node->value.element.attrs; - i > 0; - i --, attr ++) + for (i = node->value.element.num_attrs, attr = node->value.element.attrs; + i > 0; + i --, attr ++) + { + width = strlen(attr->name); + + if (attr->value) + width += strlen(attr->value) + 3; + + if (global->wrap > 0 && (col + width) > global->wrap) { - width = strlen(attr->name); - - if (attr->value) - width += strlen(attr->value) + 3; - - if (global->wrap > 0 && (col + width) > global->wrap) - { - if ((*putc_cb)('\n', p) < 0) - return (-1); - - col = 0; - } - else - { - if ((*putc_cb)(' ', p) < 0) - return (-1); - - col ++; - } - - if (mxml_write_name(attr->name, p, putc_cb) < 0) + if ((*putc_cb)('\n', p) < 0) return (-1); - if (attr->value) - { - if ((*putc_cb)('=', p) < 0) - return (-1); - if ((*putc_cb)('\"', p) < 0) - return (-1); - if (mxml_write_string(attr->value, p, putc_cb) < 0) - return (-1); - if ((*putc_cb)('\"', p) < 0) - return (-1); - } - - col += width; + col = 0; } - - if (node->child) - { - /* - * Write children... - */ - - if ((*putc_cb)('>', p) < 0) - return (-1); - else - col ++; - - col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); - - if ((col = mxml_write_node(node->child, p, cb, col, putc_cb, - global)) < 0) - return (-1); - - /* - * The ? and ! elements are special-cases and have no end tags... - */ - - if (node->value.element.name[0] != '!' && - node->value.element.name[0] != '?') - { - col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_CLOSE, col, putc_cb); - - if ((*putc_cb)('<', p) < 0) - return (-1); - if ((*putc_cb)('/', p) < 0) - return (-1); - if (mxml_write_string(node->value.element.name, p, putc_cb) < 0) - return (-1); - if ((*putc_cb)('>', p) < 0) - return (-1); - - col += strlen(node->value.element.name) + 3; - - col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_CLOSE, col, putc_cb); - } - } - else if (node->value.element.name[0] == '!' || - node->value.element.name[0] == '?') - { - /* - * The ? and ! elements are special-cases... - */ - - if ((*putc_cb)('>', p) < 0) - return (-1); - else - col ++; - - col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); - } else { - if ((*putc_cb)(' ', p) < 0) - return (-1); - if ((*putc_cb)('/', p) < 0) - return (-1); - if ((*putc_cb)('>', p) < 0) + if ((*putc_cb)(' ', p) < 0) return (-1); - col += 3; - - col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); - } - break; - - case MXML_INTEGER : - if (node->prev) - { - if (global->wrap > 0 && col > global->wrap) - { - if ((*putc_cb)('\n', p) < 0) - return (-1); - - col = 0; - } - else if ((*putc_cb)(' ', p) < 0) - return (-1); - else - col ++; - } - - sprintf(s, "%d", node->value.integer); - if (mxml_write_string(s, p, putc_cb) < 0) - return (-1); - - col += strlen(s); - break; - - case MXML_OPAQUE : - if (mxml_write_string(node->value.opaque, p, putc_cb) < 0) - return (-1); - - col += strlen(node->value.opaque); - break; - - case MXML_REAL : - if (node->prev) - { - if (global->wrap > 0 && col > global->wrap) - { - if ((*putc_cb)('\n', p) < 0) - return (-1); - - col = 0; - } - else if ((*putc_cb)(' ', p) < 0) - return (-1); - else - col ++; - } - - sprintf(s, "%f", node->value.real); - if (mxml_write_string(s, p, putc_cb) < 0) - return (-1); - - col += strlen(s); - break; - - case MXML_TEXT : - if (node->value.text.whitespace && col > 0) - { - if (global->wrap > 0 && col > global->wrap) - { - if ((*putc_cb)('\n', p) < 0) - return (-1); - - col = 0; - } - else if ((*putc_cb)(' ', p) < 0) - return (-1); - else - col ++; - } - - if (mxml_write_string(node->value.text.string, p, putc_cb) < 0) - return (-1); - - col += strlen(node->value.text.string); - break; - - case MXML_CUSTOM : - if (global->custom_save_cb) - { - char *data; /* Custom data string */ - const char *newline; /* Last newline in string */ - - - if ((data = (*global->custom_save_cb)(node)) == NULL) - return (-1); - - if (mxml_write_string(data, p, putc_cb) < 0) - return (-1); - - if ((newline = strrchr(data, '\n')) == NULL) - col += strlen(data); - else - col = strlen(newline); - - free(data); - break; + col ++; } - default : /* Should never happen */ - return (-1); - } + if (mxml_write_name(attr->name, p, putc_cb) < 0) + return (-1); - /* - * Next node... - */ + if (attr->value) + { + if ((*putc_cb)('=', p) < 0) + return (-1); + if ((*putc_cb)('\"', p) < 0) + return (-1); + if (mxml_write_string(attr->value, p, putc_cb) < 0) + return (-1); + if ((*putc_cb)('\"', p) < 0) + return (-1); + } - node = node->next; + col += width; + } + + if (node->child) + { + /* + * Write children... + */ + + mxml_node_t *child; /* Current child */ + + + if ((*putc_cb)('>', p) < 0) + return (-1); + else + col ++; + + col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); + + for (child = node->child; child; child = child->next) + { + if ((col = mxml_write_node(child, p, cb, col, putc_cb, global)) < 0) + return (-1); + } + + /* + * The ? and ! elements are special-cases and have no end tags... + */ + + if (node->value.element.name[0] != '!' && + node->value.element.name[0] != '?') + { + col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_CLOSE, col, putc_cb); + + if ((*putc_cb)('<', p) < 0) + return (-1); + if ((*putc_cb)('/', p) < 0) + return (-1); + if (mxml_write_string(node->value.element.name, p, putc_cb) < 0) + return (-1); + if ((*putc_cb)('>', p) < 0) + return (-1); + + col += strlen(node->value.element.name) + 3; + + col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_CLOSE, col, putc_cb); + } + } + else if (node->value.element.name[0] == '!' || + node->value.element.name[0] == '?') + { + /* + * The ? and ! elements are special-cases... + */ + + if ((*putc_cb)('>', p) < 0) + return (-1); + else + col ++; + + col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); + } + else + { + if ((*putc_cb)(' ', p) < 0) + return (-1); + if ((*putc_cb)('/', p) < 0) + return (-1); + if ((*putc_cb)('>', p) < 0) + return (-1); + + col += 3; + + col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); + } + break; + + case MXML_INTEGER : + if (node->prev) + { + if (global->wrap > 0 && col > global->wrap) + { + if ((*putc_cb)('\n', p) < 0) + return (-1); + + col = 0; + } + else if ((*putc_cb)(' ', p) < 0) + return (-1); + else + col ++; + } + + sprintf(s, "%d", node->value.integer); + if (mxml_write_string(s, p, putc_cb) < 0) + return (-1); + + col += strlen(s); + break; + + case MXML_OPAQUE : + if (mxml_write_string(node->value.opaque, p, putc_cb) < 0) + return (-1); + + col += strlen(node->value.opaque); + break; + + case MXML_REAL : + if (node->prev) + { + if (global->wrap > 0 && col > global->wrap) + { + if ((*putc_cb)('\n', p) < 0) + return (-1); + + col = 0; + } + else if ((*putc_cb)(' ', p) < 0) + return (-1); + else + col ++; + } + + sprintf(s, "%f", node->value.real); + if (mxml_write_string(s, p, putc_cb) < 0) + return (-1); + + col += strlen(s); + break; + + case MXML_TEXT : + if (node->value.text.whitespace && col > 0) + { + if (global->wrap > 0 && col > global->wrap) + { + if ((*putc_cb)('\n', p) < 0) + return (-1); + + col = 0; + } + else if ((*putc_cb)(' ', p) < 0) + return (-1); + else + col ++; + } + + if (mxml_write_string(node->value.text.string, p, putc_cb) < 0) + return (-1); + + col += strlen(node->value.text.string); + break; + + case MXML_CUSTOM : + if (global->custom_save_cb) + { + char *data; /* Custom data string */ + const char *newline; /* Last newline in string */ + + + if ((data = (*global->custom_save_cb)(node)) == NULL) + return (-1); + + if (mxml_write_string(data, p, putc_cb) < 0) + return (-1); + + if ((newline = strrchr(data, '\n')) == NULL) + col += strlen(data); + else + col = strlen(newline); + + free(data); + break; + } + + default : /* Should never happen */ + return (-1); } return (col); @@ -3023,5 +3076,5 @@ mxml_write_ws(mxml_node_t *node, /* I - Current node */ /* - * End of "$Id: mxml-file.c 391 2009-05-17 05:20:52Z mike $". + * End of "$Id: mxml-file.c 438 2011-03-24 05:47:51Z mike $". */ diff --git a/project/jni/mxml/src/mxml-get.c b/project/jni/mxml/src/mxml-get.c new file mode 100644 index 000000000..a5356d57e --- /dev/null +++ b/project/jni/mxml/src/mxml-get.c @@ -0,0 +1,471 @@ +/* + * "$Id: mxml-get.c 427 2011-01-03 02:03:29Z mike $" + * + * Node get functions for Mini-XML, a small XML-like file parsing library. + * + * Copyright 2011 by Michael R Sweet. + * + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: + * + * http://www.minixml.org/ + * + * Contents: + * + * mxmlGetCDATA() - Get the value for a CDATA node. + * mxmlGetCustom() - Get the value for a custom node. + * mxmlGetElement() - Get the name for an element node. + * mxmlGetFirstChild() - Get the first child of an element node. + * mxmlGetInteger() - Get the integer value from the specified node or its + * first child. + * mxmlGetLastChild() - Get the last child of an element node. + * mxmlGetNextSibling() - Get the next node for the current parent. + * mxmlGetOpaque() - Get an opaque string value for a node or its first + * child. + * mxmlGetParent() - Get the parent node. + * mxmlGetPrevSibling() - Get the previous node for the current parent. + * mxmlGetReal() - Get the real value for a node or its first child. + * mxmlGetText() - Get the text value for a node or its first child. + * mxmlGetType() - Get the node type. + * mxmlGetUserData() - Get the user data pointer for a node. + */ + +/* + * Include necessary headers... + */ + +#include "config.h" +#include "mxml.h" + + +/* + * 'mxmlGetCDATA()' - Get the value for a CDATA node. + * + * @code NULL@ is returned if the node is not a CDATA element. + * + * @since Mini-XML 2.7@ + */ + +const char * /* O - CDATA value or NULL */ +mxmlGetCDATA(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node || node->type != MXML_ELEMENT || + strncmp(node->value.element.name, "![CDATA[", 8)) + return (NULL); + + /* + * Return the text following the CDATA declaration... + */ + + return (node->value.element.name + 8); +} + + +/* + * 'mxmlGetCustom()' - Get the value for a custom node. + * + * @code NULL@ is returned if the node (or its first child) is not a custom + * value node. + * + * @since Mini-XML 2.7@ + */ + +const void * /* O - Custom value or NULL */ +mxmlGetCustom(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node) + return (NULL); + + /* + * Return the integer value... + */ + + if (node->type == MXML_CUSTOM) + return (node->value.custom.data); + else if (node->type == MXML_ELEMENT && + node->child && + node->child->type == MXML_CUSTOM) + return (node->child->value.custom.data); + else + return (NULL); +} + + +/* + * 'mxmlGetElement()' - Get the name for an element node. + * + * @code NULL@ is returned if the node is not an element node. + * + * @since Mini-XML 2.7@ + */ + +const char * /* O - Element name or NULL */ +mxmlGetElement(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node || node->type != MXML_ELEMENT) + return (NULL); + + /* + * Return the element name... + */ + + return (node->value.element.name); +} + + +/* + * 'mxmlGetFirstChild()' - Get the first child of an element node. + * + * @code NULL@ is returned if the node is not an element node or if the node + * has no children. + * + * @since Mini-XML 2.7@ + */ + +mxml_node_t * /* O - First child or NULL */ +mxmlGetFirstChild(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node || node->type != MXML_ELEMENT) + return (NULL); + + /* + * Return the first child node... + */ + + return (node->child); +} + + +/* + * 'mxmlGetInteger()' - Get the integer value from the specified node or its + * first child. + * + * 0 is returned if the node (or its first child) is not an integer value node. + * + * @since Mini-XML 2.7@ + */ + +int /* O - Integer value or 0 */ +mxmlGetInteger(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node) + return (0); + + /* + * Return the integer value... + */ + + if (node->type == MXML_INTEGER) + return (node->value.integer); + else if (node->type == MXML_ELEMENT && + node->child && + node->child->type == MXML_INTEGER) + return (node->child->value.integer); + else + return (0); +} + + +/* + * 'mxmlGetLastChild()' - Get the last child of an element node. + * + * @code NULL@ is returned if the node is not an element node or if the node + * has no children. + * + * @since Mini-XML 2.7@ + */ + +mxml_node_t * /* O - Last child or NULL */ +mxmlGetLastChild(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node || node->type != MXML_ELEMENT) + return (NULL); + + /* + * Return the node type... + */ + + return (node->last_child); +} + + +/* + * 'mxmlGetNextSibling()' - Get the next node for the current parent. + * + * @code NULL@ is returned if this is the last child for the current parent. + * + * @since Mini-XML 2.7@ + */ + +mxml_node_t * +mxmlGetNextSibling(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node) + return (NULL); + + /* + * Return the node type... + */ + + return (node->next); +} + + +/* + * 'mxmlGetOpaque()' - Get an opaque string value for a node or its first child. + * + * @code NULL@ is returned if the node (or its first child) is not an opaque + * value node. + * + * @since Mini-XML 2.7@ + */ + +const char * /* O - Opaque string or NULL */ +mxmlGetOpaque(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node) + return (NULL); + + /* + * Return the integer value... + */ + + if (node->type == MXML_OPAQUE) + return (node->value.opaque); + else if (node->type == MXML_ELEMENT && + node->child && + node->child->type == MXML_OPAQUE) + return (node->child->value.opaque); + else + return (NULL); +} + + +/* + * 'mxmlGetParent()' - Get the parent node. + * + * @code NULL@ is returned for a root node. + * + * @since Mini-XML 2.7@ + */ + +mxml_node_t * /* O - Parent node or NULL */ +mxmlGetParent(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node) + return (NULL); + + /* + * Return the node type... + */ + + return (node->parent); +} + + +/* + * 'mxmlGetPrevSibling()' - Get the previous node for the current parent. + * + * @code NULL@ is returned if this is the first child for the current parent. + * + * @since Mini-XML 2.7@ + */ + +mxml_node_t * /* O - Previous node or NULL */ +mxmlGetPrevSibling(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node) + return (NULL); + + /* + * Return the node type... + */ + + return (node->prev); +} + + +/* + * 'mxmlGetReal()' - Get the real value for a node or its first child. + * + * 0.0 is returned if the node (or its first child) is not a real value node. + * + * @since Mini-XML 2.7@ + */ + +double /* O - Real value or 0.0 */ +mxmlGetReal(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node) + return (0.0); + + /* + * Return the integer value... + */ + + if (node->type == MXML_REAL) + return (node->value.real); + else if (node->type == MXML_ELEMENT && + node->child && + node->child->type == MXML_REAL) + return (node->child->value.real); + else + return (0.0); +} + + +/* + * 'mxmlGetText()' - Get the text value for a node or its first child. + * + * @code NULL@ is returned if the node (or its first child) is not a text node. + * The "whitespace" argument can be NULL. + * + * @since Mini-XML 2.7@ + */ + +const char * /* O - Text string or NULL */ +mxmlGetText(mxml_node_t *node, /* I - Node to get */ + int *whitespace) /* O - 1 if string is preceded by whitespace, 0 otherwise */ +{ + /* + * Range check input... + */ + + if (!node) + { + if (whitespace) + *whitespace = 0; + + return (NULL); + } + + /* + * Return the integer value... + */ + + if (node->type == MXML_TEXT) + { + if (whitespace) + *whitespace = node->value.text.whitespace; + + return (node->value.text.string); + } + else if (node->type == MXML_ELEMENT && + node->child && + node->child->type == MXML_TEXT) + { + if (whitespace) + *whitespace = node->child->value.text.whitespace; + + return (node->child->value.text.string); + } + else + { + if (whitespace) + *whitespace = 0; + + return (NULL); + } +} + + +/* + * 'mxmlGetType()' - Get the node type. + * + * @code MXML_IGNORE@ is returned if "node" is @code NULL@. + * + * @since Mini-XML 2.7@ + */ + +mxml_type_t /* O - Type of node */ +mxmlGetType(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node) + return (MXML_IGNORE); + + /* + * Return the node type... + */ + + return (node->type); +} + + +/* + * 'mxmlGetUserData()' - Get the user data pointer for a node. + * + * @since Mini-XML 2.7@ + */ + +void * /* O - User data pointer */ +mxmlGetUserData(mxml_node_t *node) /* I - Node to get */ +{ + /* + * Range check input... + */ + + if (!node) + return (NULL); + + /* + * Return the user data pointer... + */ + + return (node->user_data); +} + + +/* + * End of "$Id: mxml-get.c 427 2011-01-03 02:03:29Z mike $". + */ diff --git a/project/jni/mxml/src/mxml-index.c b/project/jni/mxml/src/mxml-index.c index c34a4c2ff..b6efc66f0 100644 --- a/project/jni/mxml/src/mxml-index.c +++ b/project/jni/mxml/src/mxml-index.c @@ -1,31 +1,20 @@ /* - * "$Id: mxml-index.c 184 2005-01-29 07:21:44Z mike $" + * "$Id: mxml-index.c 426 2011-01-01 23:42:17Z mike $" * * Index support code for Mini-XML, a small XML-like file parsing library. * - * Copyright 2003-2005 by Michael Sweet. + * Copyright 2003-2011 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ * * Contents: * - * mxmlIndexDelete() - Delete an index. - * mxmlIndexEnum() - Return the next node in the index. - * mxmlIndexFind() - Find the next matching node. - * mxmlIndexNew() - Create a new index. - * mxmlIndexReset() - Reset the enumeration/find pointer in the index and - * return the first node in the index. - * index_compare() - Compare two nodes. - * index_find() - Compare a node with index values. - * index_sort() - Sort the nodes in the index... */ /* @@ -284,6 +273,30 @@ mxmlIndexFind(mxml_index_t *ind, /* I - Index to search */ } +/* + * 'mxmlIndexGetCount()' - Get the number of nodes in an index. + * + * @since Mini-XML 2.7@ + */ + +int /* I - Number of nodes in index */ +mxmlIndexGetCount(mxml_index_t *ind) /* I - Index of nodes */ +{ + /* + * Range check input... + */ + + if (!ind) + return (0); + + /* + * Return the number of nodes in the index... + */ + + return (ind->num_nodes); +} + + /* * 'mxmlIndexNew()' - Create a new index. * @@ -645,5 +658,5 @@ index_sort(mxml_index_t *ind, /* I - Index to sort */ /* - * End of "$Id: mxml-index.c 184 2005-01-29 07:21:44Z mike $". + * End of "$Id: mxml-index.c 426 2011-01-01 23:42:17Z mike $". */ diff --git a/project/jni/mxml/src/mxml-node.c b/project/jni/mxml/src/mxml-node.c index abfcb2d03..44af759f9 100644 --- a/project/jni/mxml/src/mxml-node.c +++ b/project/jni/mxml/src/mxml-node.c @@ -1,37 +1,36 @@ /* - * "$Id: mxml-node.c 363 2008-10-26 18:28:05Z mike $" + * "$Id: mxml-node.c 436 2011-01-22 01:02:05Z mike $" * * Node support code for Mini-XML, a small XML-like file parsing library. * - * Copyright 2003-2007 by Michael Sweet. + * Copyright 2003-2011 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ * * Contents: * - * mxmlAdd() - Add a node to a tree. - * mxmlDelete() - Delete a node and all of its children. - * mxmlNewCDATA() - Create a new CDATA node. - * mxmlNewCustom() - Create a new custom data node. - * mxmlNewElement() - Create a new element node. - * mxmlNewInteger() - Create a new integer node. - * mxmlNewOpaque() - Create a new opaque string. - * mxmlNewReal() - Create a new real number node. - * mxmlNewText() - Create a new text fragment node. - * mxmlNewTextf() - Create a new formatted text fragment node. - * mxmlNewXML() - Create a new XML document tree. - * mxmlRelease() - Release a node. - * mxmlRemove() - Remove a node from its parent. - * mxmlRetain() - Retain a node. - * mxml_new() - Create a new node. + * mxmlAdd() - Add a node to a tree. + * mxmlDelete() - Delete a node and all of its children. + * mxmlGetRefCount() - Get the current reference (use) count for a node. + * mxmlNewCDATA() - Create a new CDATA node. + * mxmlNewCustom() - Create a new custom data node. + * mxmlNewElement() - Create a new element node. + * mxmlNewInteger() - Create a new integer node. + * mxmlNewOpaque() - Create a new opaque string. + * mxmlNewReal() - Create a new real number node. + * mxmlNewText() - Create a new text fragment node. + * mxmlNewTextf() - Create a new formatted text fragment node. + * mxmlRemove() - Remove a node from its parent. + * mxmlNewXML() - Create a new XML document tree. + * mxmlRelease() - Release a node. + * mxmlRetain() - Retain a node. + * mxml_new() - Create a new node. */ /* @@ -278,6 +277,34 @@ mxmlDelete(mxml_node_t *node) /* I - Node to delete */ } +/* + * 'mxmlGetRefCount()' - Get the current reference (use) count for a node. + * + * The initial reference count of new nodes is 1. Use the @link mxmlRetain@ + * and @link mxmlRelease@ functions to increment and decrement a node's + * reference count. + * + * @since Mini-XML 2.7@. + */ + +int /* O - Reference count */ +mxmlGetRefCount(mxml_node_t *node) /* I - Node */ +{ + /* + * Range check input... + */ + + if (!node) + return (0); + + /* + * Return the reference count... + */ + + return (node->ref_count); +} + + /* * 'mxmlNewCDATA()' - Create a new CDATA node. * @@ -776,5 +803,5 @@ mxml_new(mxml_node_t *parent, /* I - Parent node */ /* - * End of "$Id: mxml-node.c 363 2008-10-26 18:28:05Z mike $". + * End of "$Id: mxml-node.c 436 2011-01-22 01:02:05Z mike $". */ diff --git a/project/jni/mxml/src/mxml-private.c b/project/jni/mxml/src/mxml-private.c index fa5258056..72f3e2320 100644 --- a/project/jni/mxml/src/mxml-private.c +++ b/project/jni/mxml/src/mxml-private.c @@ -1,19 +1,17 @@ /* - * "$Id: mxml-private.c 315 2007-11-22 18:01:52Z mike $" + * "$Id: mxml-private.c 422 2010-11-07 22:55:11Z mike $" * * Private functions for Mini-XML, a small XML-like file parsing library. * - * Copyright 2003-2007 by Michael Sweet. + * Copyright 2003-2010 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ * * Contents: * @@ -31,6 +29,33 @@ #include "mxml-private.h" +/* + * Some crazy people think that unloading a shared object is a good or safe + * thing to do. Unfortunately, most objects are simply *not* safe to unload + * and bad things *will* happen. + * + * The following mess of conditional code allows us to provide a destructor + * function in Mini-XML for our thread-global storage so that it can possibly + * be unloaded safely, although since there is no standard way to do so I + * can't even provide any guarantees that you can do it safely on all platforms. + * + * This code currently supports AIX, HP-UX, Linux, Mac OS X, Solaris, and + * Windows. It might work on the BSDs and IRIX, but I haven't tested that. + */ + +#if defined(__sun) || defined(_AIX) +# pragma fini(_mxml_fini) +# define _MXML_FINI _mxml_fini +#elif defined(__hpux) +# pragma FINI _mxml_fini +# define _MXML_FINI _mxml_fini +#elif defined(__GNUC__) /* Linux and Mac OS X */ +# define _MXML_FINI __attribute((destructor)) _mxml_fini +#else +# define _MXML_FINI _fini +#endif /* __sun */ + + /* * 'mxml_error()' - Display an error message. */ @@ -135,6 +160,38 @@ static void _mxml_init(void); static void _mxml_destructor(void *g); +/* + * '_mxml_destructor()' - Free memory used for globals... + */ + +static void +_mxml_destructor(void *g) /* I - Global data */ +{ + free(g); +} + + +/* + * '_mxml_fini()' - Clean up when unloaded. + */ + +static void +_MXML_FINI(void) +{ + _mxml_global_t *global; /* Global data */ + + + if (_mxml_key != -1) + { + if ((global = (_mxml_global_t *)pthread_getspecific(_mxml_key)) != NULL) + _mxml_destructor(global); + + pthread_key_delete(_mxml_key); + _mxml_key = -1; + } +} + + /* * '_mxml_global()' - Get global data. */ @@ -172,18 +229,7 @@ _mxml_init(void) } -/* - * '_mxml_destructor()' - Free memory used for globals... - */ - -static void -_mxml_destructor(void *g) /* I - Global data */ -{ - free(g); -} - - -#elif defined(WIN32) /**** WIN32 threading ****/ +#elif defined(WIN32) && defined(MXML1_EXPORTS) /**** WIN32 threading ****/ # include static DWORD _mxml_tls_index; /* Index for global storage */ @@ -281,5 +327,5 @@ _mxml_global(void) /* - * End of "$Id: mxml-private.c 315 2007-11-22 18:01:52Z mike $". + * End of "$Id: mxml-private.c 422 2010-11-07 22:55:11Z mike $". */ diff --git a/project/jni/mxml/src/mxml-private.h b/project/jni/mxml/src/mxml-private.h index 6bfe0ed09..8789e6c52 100644 --- a/project/jni/mxml/src/mxml-private.h +++ b/project/jni/mxml/src/mxml-private.h @@ -1,19 +1,17 @@ /* - * "$Id: mxml-private.h 309 2007-09-21 04:46:02Z mike $" + * "$Id: mxml-private.h 408 2010-09-19 05:26:46Z mike $" * * Private definitions for Mini-XML, a small XML-like file parsing library. * - * Copyright 2007 by Michael Sweet. + * Copyright 2003-2010 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ */ /* @@ -48,5 +46,5 @@ extern int _mxml_entity_cb(const char *name); /* - * End of "$Id: mxml-private.h 309 2007-09-21 04:46:02Z mike $". + * End of "$Id: mxml-private.h 408 2010-09-19 05:26:46Z mike $". */ diff --git a/project/jni/mxml/src/mxml-search.c b/project/jni/mxml/src/mxml-search.c index 208ab4655..f975af154 100644 --- a/project/jni/mxml/src/mxml-search.c +++ b/project/jni/mxml/src/mxml-search.c @@ -1,24 +1,23 @@ /* - * "$Id: mxml-search.c 297 2007-09-09 07:16:52Z mike $" + * "$Id: mxml-search.c 427 2011-01-03 02:03:29Z mike $" * * Search/navigation functions for Mini-XML, a small XML-like file * parsing library. * - * Copyright 2003-2007 by Michael Sweet. + * Copyright 2003-2010 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ * * Contents: * * mxmlFindElement() - Find the named element. + * mxmlFindValue() - Find a value with the given path. * mxmlWalkNext() - Walk to the next logical node in the tree. * mxmlWalkPrev() - Walk to the previous logical node in the tree. */ @@ -118,6 +117,93 @@ mxmlFindElement(mxml_node_t *node, /* I - Current node */ } +/* + * 'mxmlFindPath()' - Find a node with the given path. + * + * The "path" is a slash-separated list of element names. The name "*" is + * considered a wildcard for one or more levels of elements. For example, + * "foo/one/two", "bar/two/one", "*\/one", and so forth. + * + * The first child node of the found node is returned if the given node has + * children and the first child is a value node. + * + * @since Mini-XML 2.7@ + */ + +mxml_node_t * /* O - Found node or NULL */ +mxmlFindPath(mxml_node_t *top, /* I - Top node */ + const char *path) /* I - Path to element */ +{ + mxml_node_t *node; /* Current node */ + char element[256]; /* Current element name */ + const char *pathsep; /* Separator in path */ + int descend; /* mxmlFindElement option */ + + + /* + * Range check input... + */ + + if (!top || !path || !*path) + return (NULL); + + /* + * Search each element in the path... + */ + + node = top; + while (*path) + { + /* + * Handle wildcards... + */ + + if (!strncmp(path, "*/", 2)) + { + path += 2; + descend = MXML_DESCEND; + } + else + descend = MXML_DESCEND_FIRST; + + /* + * Get the next element in the path... + */ + + if ((pathsep = strchr(path, '/')) == NULL) + pathsep = path + strlen(path); + + if (pathsep == path || (pathsep - path) >= sizeof(element)) + return (NULL); + + memcpy(element, path, pathsep - path); + element[pathsep - path] = '\0'; + + if (*pathsep) + path = pathsep + 1; + else + path = pathsep; + + /* + * Search for the element... + */ + + if ((node = mxmlFindElement(node, node, element, NULL, NULL, + descend)) == NULL) + return (NULL); + } + + /* + * If we get this far, return the node or its first child... + */ + + if (node->child && node->child->type != MXML_ELEMENT) + return (node->child); + else + return (node); +} + + /* * 'mxmlWalkNext()' - Walk to the next logical node in the tree. * @@ -197,5 +283,5 @@ mxmlWalkPrev(mxml_node_t *node, /* I - Current node */ /* - * End of "$Id: mxml-search.c 297 2007-09-09 07:16:52Z mike $". + * End of "$Id: mxml-search.c 427 2011-01-03 02:03:29Z mike $". */ diff --git a/project/jni/mxml/src/mxml-set.c b/project/jni/mxml/src/mxml-set.c index e143cc8e1..b0bd52790 100644 --- a/project/jni/mxml/src/mxml-set.c +++ b/project/jni/mxml/src/mxml-set.c @@ -1,30 +1,29 @@ /* - * "$Id: mxml-set.c 270 2007-04-23 21:48:03Z mike $" + * "$Id: mxml-set.c 441 2011-12-09 23:49:00Z mike $" * * Node set functions for Mini-XML, a small XML-like file parsing library. * - * Copyright 2003-2007 by Michael Sweet. + * Copyright 2003-2011 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ * * Contents: * - * mxmlSetCustom() - Set the data and destructor of a custom data node. - * mxmlSetCDATA() - Set the element name of a CDATA node. - * mxmlSetElement() - Set the name of an element node. - * mxmlSetInteger() - Set the value of an integer node. - * mxmlSetOpaque() - Set the value of an opaque node. - * mxmlSetReal() - Set the value of a real number node. - * mxmlSetText() - Set the value of a text node. - * mxmlSetTextf() - Set the value of a text node to a formatted string. + * mxmlSetCDATA() - Set the element name of a CDATA node. + * mxmlSetCustom() - Set the data and destructor of a custom data node. + * mxmlSetElement() - Set the name of an element node. + * mxmlSetInteger() - Set the value of an integer node. + * mxmlSetOpaque() - Set the value of an opaque node. + * mxmlSetReal() - Set the value of a real number node. + * mxmlSetText() - Set the value of a text node. + * mxmlSetTextf() - Set the value of a text node to a formatted string. + * mxmlSetUserData() - Set the user data pointer for a node. */ /* @@ -35,10 +34,49 @@ #include "mxml.h" +/* + * 'mxmlSetCDATA()' - Set the element name of a CDATA node. + * + * The node is not changed if it (or its first child) is not a CDATA element node. + * + * @since Mini-XML 2.3@ + */ + +int /* O - 0 on success, -1 on failure */ +mxmlSetCDATA(mxml_node_t *node, /* I - Node to set */ + const char *data) /* I - New data string */ +{ + /* + * Range check input... + */ + + if (node && node->type == MXML_ELEMENT && + strncmp(node->value.element.name, "![CDATA[", 8) && + node->child && node->child->type == MXML_ELEMENT && + !strncmp(node->child->value.element.name, "![CDATA[", 8)) + node = node->child; + + if (!node || node->type != MXML_ELEMENT || !data || + strncmp(node->value.element.name, "![CDATA[", 8)) + return (-1); + + /* + * Free any old element value and set the new value... + */ + + if (node->value.element.name) + free(node->value.element.name); + + node->value.element.name = _mxml_strdupf("![CDATA[%s]]", data); + + return (0); +} + + /* * 'mxmlSetCustom()' - Set the data and destructor of a custom data node. * - * The node is not changed if it is not a custom node. + * The node is not changed if it (or its first child) is not a custom node. * * @since Mini-XML 2.1@ */ @@ -53,6 +91,10 @@ mxmlSetCustom( * Range check input... */ + if (node && node->type == MXML_ELEMENT && + node->child && node->child->type == MXML_CUSTOM) + node = node->child; + if (!node || node->type != MXML_CUSTOM) return (-1); @@ -70,39 +112,6 @@ mxmlSetCustom( } -/* - * 'mxmlSetCDATA()' - Set the element name of a CDATA node. - * - * The node is not changed if it is not a CDATA element node. - * - * @since Mini-XML 2.3@ - */ - -int /* O - 0 on success, -1 on failure */ -mxmlSetCDATA(mxml_node_t *node, /* I - Node to set */ - const char *data) /* I - New data string */ -{ - /* - * Range check input... - */ - - if (!node || node->type != MXML_ELEMENT || !data || - strncmp(node->value.element.name, "![CDATA[", 8)) - return (-1); - - /* - * Free any old element value and set the new value... - */ - - if (node->value.element.name) - free(node->value.element.name); - - node->value.element.name = _mxml_strdupf("![CDATA[%s]]", data); - - return (0); -} - - /* * 'mxmlSetElement()' - Set the name of an element node. * @@ -136,7 +145,7 @@ mxmlSetElement(mxml_node_t *node, /* I - Node to set */ /* * 'mxmlSetInteger()' - Set the value of an integer node. * - * The node is not changed if it is not an integer node. + * The node is not changed if it (or its first child) is not an integer node. */ int /* O - 0 on success, -1 on failure */ @@ -147,6 +156,10 @@ mxmlSetInteger(mxml_node_t *node, /* I - Node to set */ * Range check input... */ + if (node && node->type == MXML_ELEMENT && + node->child && node->child->type == MXML_INTEGER) + node = node->child; + if (!node || node->type != MXML_INTEGER) return (-1); @@ -163,7 +176,7 @@ mxmlSetInteger(mxml_node_t *node, /* I - Node to set */ /* * 'mxmlSetOpaque()' - Set the value of an opaque node. * - * The node is not changed if it is not an opaque node. + * The node is not changed if it (or its first child) is not an opaque node. */ int /* O - 0 on success, -1 on failure */ @@ -174,6 +187,10 @@ mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */ * Range check input... */ + if (node && node->type == MXML_ELEMENT && + node->child && node->child->type == MXML_OPAQUE) + node = node->child; + if (!node || node->type != MXML_OPAQUE || !opaque) return (-1); @@ -193,7 +210,7 @@ mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */ /* * 'mxmlSetReal()' - Set the value of a real number node. * - * The node is not changed if it is not a real number node. + * The node is not changed if it (or its first child) is not a real number node. */ int /* O - 0 on success, -1 on failure */ @@ -204,6 +221,10 @@ mxmlSetReal(mxml_node_t *node, /* I - Node to set */ * Range check input... */ + if (node && node->type == MXML_ELEMENT && + node->child && node->child->type == MXML_REAL) + node = node->child; + if (!node || node->type != MXML_REAL) return (-1); @@ -220,7 +241,7 @@ mxmlSetReal(mxml_node_t *node, /* I - Node to set */ /* * 'mxmlSetText()' - Set the value of a text node. * - * The node is not changed if it is not a text node. + * The node is not changed if it (or its first child) is not a text node. */ int /* O - 0 on success, -1 on failure */ @@ -232,6 +253,10 @@ mxmlSetText(mxml_node_t *node, /* I - Node to set */ * Range check input... */ + if (node && node->type == MXML_ELEMENT && + node->child && node->child->type == MXML_TEXT) + node = node->child; + if (!node || node->type != MXML_TEXT || !string) return (-1); @@ -252,7 +277,7 @@ mxmlSetText(mxml_node_t *node, /* I - Node to set */ /* * 'mxmlSetTextf()' - Set the value of a text node to a formatted string. * - * The node is not changed if it is not a text node. + * The node is not changed if it (or its first child) is not a text node. */ int /* O - 0 on success, -1 on failure */ @@ -268,6 +293,10 @@ mxmlSetTextf(mxml_node_t *node, /* I - Node to set */ * Range check input... */ + if (node && node->type == MXML_ELEMENT && + node->child && node->child->type == MXML_TEXT) + node = node->child; + if (!node || node->type != MXML_TEXT || !format) return (-1); @@ -290,5 +319,31 @@ mxmlSetTextf(mxml_node_t *node, /* I - Node to set */ /* - * End of "$Id: mxml-set.c 270 2007-04-23 21:48:03Z mike $". + * 'mxmlSetUserData()' - Set the user data pointer for a node. + * + * @since Mini-XML 2.7@ + */ + +int /* O - 0 on success, -1 on failure */ +mxmlSetUserData(mxml_node_t *node, /* I - Node to set */ + void *data) /* I - User data pointer */ +{ + /* + * Range check input... + */ + + if (!node) + return (-1); + + /* + * Set the user data pointer and return... + */ + + node->user_data = data; + return (0); +} + + +/* + * End of "$Id: mxml-set.c 441 2011-12-09 23:49:00Z mike $". */ diff --git a/project/jni/mxml/src/mxml-string.c b/project/jni/mxml/src/mxml-string.c index db0a8389e..6be42523f 100644 --- a/project/jni/mxml/src/mxml-string.c +++ b/project/jni/mxml/src/mxml-string.c @@ -1,19 +1,17 @@ /* - * "$Id: mxml-string.c 387 2009-04-18 17:05:52Z mike $" + * "$Id: mxml-string.c 424 2010-12-25 16:21:50Z mike $" * * String functions for Mini-XML, a small XML-like file parsing library. * - * Copyright 2003-2009 by Michael Sweet. + * Copyright 2003-2010 by Michael R Sweet. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. + * These coded instructions, statements, and computer programs are the + * property of Michael R Sweet and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "COPYING" + * which should have been included with this file. If this file is + * missing or damaged, see the license at: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * http://www.minixml.org/ * * Contents: * @@ -31,6 +29,20 @@ #include "config.h" +/* + * The va_copy macro is part of C99, but many compilers don't implement it. + * Provide a "direct assignment" implmentation when va_copy isn't defined... + */ + +#ifndef va_copy +# ifdef __va_copy +# define va_copy(dst,src) __va_copy(dst,src) +# else +# define va_copy(dst,src) memcpy(&dst, &src, sizeof(va_list)) +# endif /* __va_copy */ +#endif /* va_copy */ + + #ifndef HAVE_SNPRINTF /* * '_mxml_snprintf()' - Format a string. @@ -60,7 +72,7 @@ _mxml_snprintf(char *buffer, /* I - Output buffer */ */ #ifndef HAVE_STRDUP -char * /* O - New string pointer */ +char * /* O - New string pointer */ _mxml_strdup(const char *s) /* I - String to duplicate */ { char *t; /* New string pointer */ @@ -420,9 +432,10 @@ char * /* O - New string pointer */ _mxml_vstrdupf(const char *format, /* I - Printf-style format string */ va_list ap) /* I - Pointer to additional arguments */ { - int bytes; /* Number of bytes required */ - char *buffer, /* String buffer */ - temp[256]; /* Small buffer for first vsnprintf */ + int bytes; /* Number of bytes required */ + char *buffer, /* String buffer */ + temp[256]; /* Small buffer for first vsnprintf */ + va_list apcopy; /* Copy of argument list */ /* @@ -430,7 +443,8 @@ _mxml_vstrdupf(const char *format, /* I - Printf-style format string */ * needed... */ - bytes = vsnprintf(temp, sizeof(temp), format, ap); + va_copy(apcopy, ap); + bytes = vsnprintf(temp, sizeof(temp), format, apcopy); if (bytes < sizeof(temp)) { @@ -458,5 +472,5 @@ _mxml_vstrdupf(const char *format, /* I - Printf-style format string */ /* - * End of "$Id: mxml-string.c 387 2009-04-18 17:05:52Z mike $". + * End of "$Id: mxml-string.c 424 2010-12-25 16:21:50Z mike $". */ diff --git a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h index 4f972735b..dc7fba931 100644 --- a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h +++ b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h @@ -108,6 +108,17 @@ extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardTextInput(char * textBu /* Whether user redefined on-screen keyboard layout via SDL menu, app should not enforce it's own layout in that case */ extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardRedefinedByUser(void); +/* API compatible to SDL2, it's a wrapper to the SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput(), it does not block */ + +extern DECLSPEC int SDLCALL SDL_HasScreenKeyboardSupport(void *unused); + +extern DECLSPEC int SDLCALL SDL_ShowScreenKeyboard(void *unused); + +extern DECLSPEC int SDLCALL SDL_HideScreenKeyboard(void *unused); + +extern DECLSPEC int SDLCALL SDL_ToggleScreenKeyboard(void *unused); + +extern DECLSPEC int SDLCALL SDL_IsScreenKeyboardShown(void *unused); #ifdef __cplusplus } diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c index 1416e064b..3f4c050c0 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c @@ -63,6 +63,8 @@ static jobject JavaRenderer = NULL; static jmethodID JavaSwapBuffers = NULL; static jmethodID JavaShowScreenKeyboard = NULL; static jmethodID JavaToggleScreenKeyboardWithoutTextInput = NULL; +static jmethodID JavaHideScreenKeyboard = NULL; +static jmethodID JavaIsScreenKeyboardShown = NULL; static jmethodID JavaGetAdvertisementParams = NULL; static jmethodID JavaSetAdvertisementVisible = NULL; static jmethodID JavaSetAdvertisementPosition = NULL; @@ -287,7 +289,17 @@ void SDL_ANDROID_CallJavaShowScreenKeyboard(const char * oldText, char * outBuf, } } -JNIEXPORT void JNICALL +void SDL_ANDROID_CallJavaHideScreenKeyboard() +{ + (*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaHideScreenKeyboard ); +} + +int SDL_ANDROID_CallJavaIsScreenKeyboardShown() +{ + return (*JavaEnv)->CallIntMethod( JavaEnv, JavaRenderer, JavaIsScreenKeyboardShown ); +} + +JNIEXPORT void JNICALL JAVA_EXPORT_NAME(DemoRenderer_nativeInitJavaCallbacks) ( JNIEnv* env, jobject thiz ) { JavaEnv = env; @@ -297,6 +309,8 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInitJavaCallbacks) ( JNIEnv* env, jobject t JavaSwapBuffers = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "swapBuffers", "()I"); JavaShowScreenKeyboard = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "showScreenKeyboard", "(Ljava/lang/String;I)V"); JavaToggleScreenKeyboardWithoutTextInput = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "showScreenKeyboardWithoutTextInputField", "()V"); + JavaHideScreenKeyboard = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "hideScreenKeyboard", "()V"); + JavaIsScreenKeyboardShown = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "isScreenKeyboardShown", "()I"); // TODO: implement it JavaGetAdvertisementParams = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "getAdvertisementParams", "([I)V"); JavaSetAdvertisementVisible = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "setAdvertisementVisible", "(I)V"); diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h index c24bc205d..78f36c4b4 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h @@ -56,6 +56,8 @@ extern int SDL_ANDROID_ShowScreenUnderFinger; extern SDL_Rect SDL_ANDROID_ShowScreenUnderFingerRect, SDL_ANDROID_ShowScreenUnderFingerRectSrc; extern int SDL_ANDROID_CallJavaSwapBuffers(); extern void SDL_ANDROID_CallJavaShowScreenKeyboard(const char * oldText, char * outBuf, int outBufLen); +extern void SDL_ANDROID_CallJavaHideScreenKeyboard(); +extern int SDL_ANDROID_CallJavaIsScreenKeyboardShown(); extern int SDL_ANDROID_drawTouchscreenKeyboard(); extern void SDL_ANDROID_VideoContextLost(); extern void SDL_ANDROID_VideoContextRecreated(); diff --git a/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c b/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c index ca94dd998..1329e7a6c 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c @@ -1062,3 +1062,33 @@ JAVA_EXPORT_NAME(Settings_nativeSetEnv) ( JNIEnv* env, jobject thiz, jstring j_ (*env)->ReleaseStringUTFChars(env, j_name, name); (*env)->ReleaseStringUTFChars(env, j_value, value); } + +int SDLCALL SDL_HasScreenKeyboardSupport(void *unused) +{ + return 1; +} + +// SDL2 compatibility +int SDLCALL SDL_ShowScreenKeyboard(void *unused) +{ + return SDL_ANDROID_ToggleScreenKeyboardTextInput(NULL); +} + +int SDLCALL SDL_HideScreenKeyboard(void *unused) +{ + SDL_ANDROID_CallJavaHideScreenKeyboard(); + return 1; +} + +int SDLCALL SDL_IsScreenKeyboardShown(void *unused) +{ + return SDL_ANDROID_CallJavaIsScreenKeyboardShown(); +} + +int SDLCALL SDL_ToggleScreenKeyboard(void *unused) +{ + if( SDL_IsScreenKeyboardShown(NULL) ) + return SDL_HideScreenKeyboard(NULL); + else + return SDL_ShowScreenKeyboard(NULL); +}