diff options
author | Patrick Monnerat <pm@datasphere.ch> | 2014-05-05 18:16:22 +0200 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2014-10-04 21:13:48 +0800 |
commit | 02fd12987418007568cd9bad12eef08a75fb134b (patch) | |
tree | 62d9e4b35d626f6fde6510d078ac45def28a53c3 /os400 | |
parent | 917e353f2b1f881bd80fe8905f13a728ee99848c (diff) | |
download | libxml2-02fd12987418007568cd9bad12eef08a75fb134b.tar.gz |
OS400: implement XPath macros as procedures for ILE/RPG support.
Diffstat (limited to 'os400')
-rw-r--r-- | os400/README400 | 10 | ||||
-rw-r--r-- | os400/libxmlrpg/xpath.rpgle | 18 | ||||
-rw-r--r-- | os400/make-src.sh | 2 | ||||
-rw-r--r-- | os400/rpgsupport.c | 30 | ||||
-rw-r--r-- | os400/rpgsupport.h | 9 |
5 files changed, 61 insertions, 8 deletions
diff --git a/os400/README400 b/os400/README400 index dd1d1a5c..6c16de91 100644 --- a/os400/README400 +++ b/os400/README400 @@ -189,11 +189,11 @@ const char * xmlVasprintf(xmlDictPtr * dict, ILE/RPG binding: All standard types and procedures are provided. Since ILE/RPG does not -support macros, they have not been ported, with the exceptions of the -global/threaded variables access macros. These variables can be read with -function get_xxx(void), where xxxx is the name of the variable; they may be -set by calling function set_xxxx(value), where value is of the same type as -the variable. +support macros, they have not been ported, with the exceptions of the more +useful ones and the global/threaded variables access macros. These variables +can be read with function get_xxx(void), where xxxx is the name of the +variable; they may be set by calling function set_xxxx(value), where value is +of the same type as the variable. The C va_list is not implemented as such in ILE/RPG. Functions implementing va_list and associated methods are provided: diff --git a/os400/libxmlrpg/xpath.rpgle b/os400/libxmlrpg/xpath.rpgle index 209e6c94..a31a4acb 100644 --- a/os400/libxmlrpg/xpath.rpgle +++ b/os400/libxmlrpg/xpath.rpgle @@ -628,4 +628,22 @@ /undefine XML_TESTVAL /endif + * + * C macros implemented as procedures for ILE/RPG support. + * + /if defined(LIBXML_XPATH_ENABLED) + d xmlXPathNodeSetGetLength... + d pr 10i 0 extproc('__xmlXPathNodeSetGetLength') + d ns value like(xmlNodeSetPtr) + * + d xmlXPathNodeSetItem... + d pr extproc('__xmlXPathNodeSetItem') + d like(xmlNodePtr) + d ns value like(xmlNodeSetPtr) + d index 10i 0 value + * + d xmlXPathNodeSetIsEmpty... + d pr 10i 0 extproc('__xmlXPathNodeSetIsEmpty') + d ns value like(xmlNodeSetPtr) + /endif LIBXML_XPATH_ENABLED /endif XML_XPATH_H__ diff --git a/os400/make-src.sh b/os400/make-src.sh index ccc8ec7e..88248b0f 100644 --- a/os400/make-src.sh +++ b/os400/make-src.sh @@ -193,7 +193,7 @@ for PGMEXP in ${PGMEXPS} do SIGNATURE=`echo "${PGMEXP}" | sed 's/^LIBXML2_//'` eval ENTRIES=\"\${${PGMEXP}}\" echo " STRPGMEXP PGMLVL(*${PGMLVL}) SIGNATURE('${SIGNATURE}')" - for ENTRY in ${OS400SYMS} ${ENTRIES} + for ENTRY in ${ENTRIES} ${OS400SYMS} do echo " EXPORT SYMBOL('${ENTRY}')" done echo ' ENDPGMEXP' diff --git a/os400/rpgsupport.c b/os400/rpgsupport.c index 189212b5..74f3859e 100644 --- a/os400/rpgsupport.c +++ b/os400/rpgsupport.c @@ -11,6 +11,7 @@ #include <stdarg.h> #include "libxml/xmlmemory.h" +#include "libxml/xpath.h" #include "libxml/parser.h" #include "rpgsupport.h" @@ -204,8 +205,35 @@ __xmlVaArg(char * * list, void * dest, size_t argsize) void -_xmlVaEnd(char * * list) +__xmlVaEnd(char * * list) { /* Nothing to do. */ } + + +#ifdef LIBXML_XPATH_ENABLED +int +__xmlXPathNodeSetGetLength(xmlNodeSetPtr ns) + +{ + return ns? ns->nodeNr: 0; +} + + +xmlNodePtr +__xmlXPathNodeSetItem(xmlNodeSetPtr ns, int index) + +{ + return ns && index >= 0 && index < ns->nodeNr && ns->nodeTab? + ns->nodeTab[index]: 0; +} + + +int +__xmlXPathNodeSetIsEmpty(xmlNodeSetPtr ns) + +{ + return !ns || !ns->nodeNr || !ns->nodeTab; +} +#endif diff --git a/os400/rpgsupport.h b/os400/rpgsupport.h index 29a62cc6..20752f51 100644 --- a/os400/rpgsupport.h +++ b/os400/rpgsupport.h @@ -12,6 +12,7 @@ #include <sys/types.h> #include <libxml/xmlmemory.h> +#include <libxml/xpath.h> XMLPUBFUN xmlFreeFunc __get_xmlFree(void); @@ -136,6 +137,12 @@ XMLPUBFUN xmlOutputBufferPtr XMLPUBFUN void __xmlVaStart(char * * list, char * lastargaddr, size_t lastargsize); XMLPUBFUN void * __xmlVaArg(char * * list, void * dest, size_t argsize); -XMLPUBFUN void _xmlVaEnd(char * * list); +XMLPUBFUN void __xmlVaEnd(char * * list); + +#ifdef LIBXML_XPATH_ENABLED +XMLPUBFUN int __xmlXPathNodeSetGetLength(xmlNodeSetPtr ns); +XMLPUBFUN xmlNodePtr __xmlXPathNodeSetItem(xmlNodeSetPtr ns, int index); +XMLPUBFUN int __xmlXPathNodeSetIsEmpty(xmlNodeSetPtr ns); +#endif #endif |