Commit 70a9da54 authored by Bjorn Reese's avatar Bjorn Reese

trio upgrade and integration

parent 34b1b3a8
Sat Apr 21 18:27:51 CEST 2001 Bjorn Reese <breese@users.sourceforge.net>
* libxml.h: new header used only for the compilation of libxml
* HTMLparser.c HTMLtree.c SAX.c debugXML.c encoding.c entities.c
error.c hash.c list.c nanoftp.c nanohttp.c parser.c
parserInternals.c testHTML.c testSAX.c testURI.c testXPath.c
tree.c uri.c valid.c xinclude.c xlink.c xmlIO.c xmllint.c
xmlmemory.c xpath.c xpointer.c: libxml.h integration
* trio.[ch] triop.h strio.[ch]: upgraded to the latest trio
baseline (version 1.2 plus a single patch).
* xpath.c result/XPath/expr/floats test/XPath/expr/floats: parses
scientific notation for numbers. Tests added.
* xpath.c: formatting of numbers changed to use sprintf
(contribution from William Brack)
Sat Apr 21 16:12:59 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* valid.c: cleanup, more useful debugging
......
......@@ -6,15 +6,9 @@
* Daniel.Veillard@w3.org
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include <libxml/xmlversion.h>
#include "libxml.h"
#ifdef LIBXML_HTML_ENABLED
#include <stdio.h>
#include <string.h>
#ifdef HAVE_CTYPE_H
#include <ctype.h>
......
......@@ -7,16 +7,9 @@
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include <libxml/xmlversion.h>
#include "libxml.h"
#ifdef LIBXML_HTML_ENABLED
#include <stdio.h>
#include <string.h> /* for memset() only ! */
#ifdef HAVE_CTYPE_H
......
......@@ -7,12 +7,7 @@
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include <stdio.h>
#include "libxml.h"
#include <stdlib.h>
#include <string.h>
#include <libxml/xmlmemory.h>
......
......@@ -7,16 +7,9 @@
* Daniel Veillard <Daniel.Veillard@w3.org>
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include <libxml/xmlversion.h>
#include "libxml.h"
#ifdef LIBXML_DEBUG_ENABLED
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
......
......@@ -20,13 +20,8 @@
* Daniel.Veillard@w3.org
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include "libxml.h"
#include <stdio.h>
#include <string.h>
#ifdef HAVE_CTYPE_H
......@@ -35,7 +30,6 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <libxml/xmlversion.h>
#ifdef LIBXML_ICONV_ENABLED
#ifdef HAVE_ERRNO_H
#include <errno.h>
......
......@@ -6,13 +6,8 @@
* Daniel.Veillard@w3.org
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include "libxml.h"
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
......
......@@ -6,13 +6,8 @@
* Daniel Veillard <Daniel.Veillard@w3.org>
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include "libxml.h"
#include <stdio.h>
#include <stdarg.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
......
......@@ -14,14 +14,10 @@
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
*
* Author: bjorn.reese@systematic.dk
* Author: breese@users.sourceforge.net
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include "libxml.h"
#include <string.h>
#include <libxml/hash.h>
......
/*
* libxml.h: internal header only used during the compilation of libxml
*
* See COPYRIGHT for the status of this software
*
* Author: breese@users.sourceforge.net
*/
#ifndef __XML_LIBXML_H__
#define __XML_LIBXML_H__
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include <libxml/xmlversion.h>
#ifdef WITHOUT_TRIO
#include <stdio.h>
#else
#define TRIO_REPLACE_STDIO
#include "trio.h"
#endif
#endif /* ! __XML_LIBXML_H__ */
......@@ -15,11 +15,7 @@
* Author: Gary.Pennington@uk.sun.com
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include "libxml.h"
#include <stdlib.h>
#include <string.h>
......
......@@ -12,19 +12,19 @@
#define HAVE_NETINET_IN_H
#define HAVE_NETDB_H
#define HAVE_SYS_TIME_H
#else /* STANDALONE */
#ifdef WIN32
#define INCLUDE_WINSOCK
#include "win32config.h"
#include <libxml/xmlversion.h>
#ifdef WITHOUT_TRIO
#include <stdio.h>
#else
#include "config.h"
#define TRIO_REPLACE_STDIO
#include "trio.h"
#endif
#else /* STANDALONE */
#include "libxml.h"
#endif /* STANDALONE */
#include <libxml/xmlversion.h>
#ifdef LIBXML_FTP_ENABLED
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STDLIB_H
......
......@@ -14,17 +14,9 @@
/* TODO add compression support, Send the Accept- , and decompress on the
fly with ZLIB if found at compile-time */
#ifdef WIN32
#define INCLUDE_WINSOCK
#include "win32config.h"
#else
#include "config.h"
#endif
#include <libxml/xmlversion.h>
#include "libxml.h"
#ifdef LIBXML_HTTP_ENABLED
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STDLIB_H
......
......@@ -33,15 +33,14 @@
* and xmlDoValidityCheckingDefaultValue for VMS
*/
#include "libxml.h"
#ifdef WIN32
#include "win32config.h"
#define XML_DIR_SEP '\\'
#else
#include "config.h"
#define XML_DIR_SEP '/'
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libxml/xmlmemory.h>
......
......@@ -7,15 +7,14 @@
* Daniel.Veillard@w3.org
*/
#include "libxml.h"
#ifdef WIN32
#include "win32config.h"
#define XML_DIR_SEP '\\'
#else
#include "config.h"
#define XML_DIR_SEP '/'
#endif
#include <stdio.h>
#include <string.h>
#ifdef HAVE_CTYPE_H
#include <ctype.h>
......
......@@ -15,6 +15,14 @@ Object is a number : 1.23
Expression: 0.123
Object is a number : 0.123
========================
Expression: 1.23e3
Object is a number : 1230
========================
Expression: 1.23e-3
Object is a number : 0.00123
========================
Expression: 1 div 0
Object is a number : inf
......
......@@ -15,12 +15,9 @@
*
************************************************************************/
/* DV for libxml */
#include <libxml/xmlversion.h>
#ifdef WITH_TRIO
/* FIXME
* StrToLongDouble
/*
* TODO
* - StrToLongDouble
*/
static const char rcsid[] = "@(#)$Id$";
......@@ -389,9 +386,9 @@ char *StrSubstringMax(const char *string, size_t max, const char *find)
assert(VALID(find));
size = StrLength(find);
if (size >= max)
if (size <= max)
{
for (count = 0; count > max - size; count++)
for (count = 0; count <= max - size; count++)
{
if (StrEqualMax(find, size, &string[count]))
{
......@@ -563,6 +560,3 @@ int StrToUpper(char *target)
}
return i;
}
/* DV for libxml */
#endif /* WITH_TRIO */
......@@ -15,13 +15,16 @@
*
************************************************************************/
#ifndef H_STRIO
#define H_STRIO
#ifndef TRIO_STRIO_H
#define TRIO_STRIO_H
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "assert.h"
#ifndef DEBUG
# define NDEBUG
#endif
#include <assert.h>
/*
* StrAppend(target, source)
......@@ -122,7 +125,7 @@
enum {
STRIO_HASH_NONE = 0,
STRIO_HASH_PLAIN,
STRIO_HASH_TWOSIGNED
STRIO_HASH_TWOSIGNED,
};
#if !defined(DEBUG) || defined(__DECC)
......@@ -213,4 +216,4 @@ float StrToFloat(const char *source, const char **target);
double StrToDouble(const char *source, const char **target);
int StrToUpper(char *target);
#endif /* H_STRIO */
#endif /* TRIO_STRIO_H */
......@@ -2,6 +2,8 @@
123
1.23
0.123
1.23e3
1.23e-3
1 div 0
-1 div 0
0 div 0
......
......@@ -6,17 +6,14 @@
* Daniel.Veillard@w3.org
*/
#include "libxml.h"
#ifdef LIBXML_HTML_ENABLED
#ifdef WIN32
#include "win32config.h"
#undef LIBXML_DLL_IMPORT
#else
#include "config.h"
#endif
#include <libxml/xmlversion.h>
#ifdef LIBXML_HTML_ENABLED
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
......
......@@ -6,14 +6,12 @@
* Daniel.Veillard@w3.org
*/
#include "libxml.h"
#ifdef WIN32
#include "win32config.h"
#undef LIBXML_DLL_IMPORT
#else
#include "config.h"
#endif
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
......
......@@ -6,18 +6,12 @@
* Daniel.Veillard@w3.org
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include "libxml.h"
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlmemory.h>
#include <libxml/uri.h>
......
......@@ -6,16 +6,9 @@
* Daniel.Veillard@w3.org
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include <libxml/xmlversion.h>
#include "libxml.h"
#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
#include <stdio.h>
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
......
......@@ -11,13 +11,8 @@
*
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include "libxml.h"
#include <stdio.h>
#include <string.h> /* for memset() only ! */
#ifdef HAVE_CTYPE_H
......
This diff is collapsed.
......@@ -15,13 +15,23 @@
*
************************************************************************/
#ifndef H_TRIO
#define H_TRIO
#ifndef TRIO_TRIO_H
#define TRIO_TRIO_H
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
/*
* Use autoconf defines if present. Packages using trio must define
* HAVE_CONFIG_H as a compiler option themselves.
*/
#if defined(HAVE_CONFIG_H)
# include <config.h>
#endif
#if !defined(WITHOUT_TRIO)
/*
* Error codes.
*
......@@ -34,7 +44,7 @@ enum {
TRIO_EDBLREF = 4,
TRIO_EGAP = 5,
TRIO_ENOMEM = 6,
TRIO_ERANGE = 7
TRIO_ERANGE = 7,
};
/* Error macros */
......@@ -42,61 +52,117 @@ enum {
#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
#define TRIO_ERROR_NAME(x) trio_strerror(x)
/*
* trio_sprintf(target, format, ...)
* trio_snprintf(target, maxsize, format, ...)
*
* Build 'target' according to 'format' and succesive
* arguments. This is equal to the sprintf() and
* snprintf() functions.
const char *trio_strerror(int);
/*************************************************************************
* Print Functions
*/
int trio_printf(const char *format, ...);
int trio_vprintf(const char *format, va_list args);
int trio_printfv(const char *format, void **args);
int trio_fprintf(FILE *file, const char *format, ...);
int trio_vfprintf(FILE *file, const char *format, va_list args);
int trio_fprintfv(FILE *file, const char *format, void **args);
int trio_dprintf(int fd, const char *format, ...);
int trio_vdprintf(int fd, const char *format, va_list args);
int trio_dprintfv(int fd, const char *format, void **args);
/* trio_sprintf(target, format, ...)
* trio_snprintf(target, maxsize, format, ...)
*
* Build 'target' according to 'format' and succesive
* arguments. This is equal to the sprintf() and
* snprintf() functions.
*/
int trio_sprintf(char *buffer, const char *format, ...);
int trio_snprintf(char *buffer, size_t max, const char *format, ...);
int trio_snprintfcat(char *buffer, size_t max, const char *format, ...);
int trio_vsprintf(char *buffer, const char *format, va_list args);
int trio_sprintfv(char *buffer, const char *format, void **args);
int trio_snprintf(char *buffer, size_t max, const char *format, ...);
int trio_vsnprintf(char *buffer, size_t bufferSize, const char *format,
va_list args);
int trio_snprintfv(char *buffer, size_t bufferSize, const char *format,
void **args);
int trio_snprintfcat(char *buffer, size_t max, const char *format, ...);
int trio_vsnprintfcat(char *buffer, size_t bufferSize, const char *format,
va_list args);
char *trio_aprintf(const char *format, ...);
char *trio_vaprintf(const char *format, va_list args);
int trio_asprintf(char **ret, const char *format, ...);
int trio_vasprintf(char **ret, const char *format, va_list args);
/*************************************************************************
* Scan Functions
*/
int trio_scanf(const char *format, ...);
int trio_vscanf(const char *format, va_list args);
int trio_scanfv(const char *format, void **args);
int trio_fscanf(FILE *file, const char *format, ...);
int trio_vfscanf(FILE *file, const char *format, va_list args);
int trio_fscanfv(FILE *file, const char *format, void **args);
int trio_dscanf(int fd, const char *format, ...);
int trio_vdscanf(int fd, const char *format, va_list args);
int trio_dscanfv(int fd, const char *format, void **args);
int trio_sscanf(const char *buffer, const char *format, ...);
int trio_vsscanf(const char *buffer, const char *format, va_list args);
int trio_sscanfv(const char *buffer, const char *format, void **args);
const char *trio_strerror(int);
/*************************************************************************
* Renaming
*/
#ifdef TRIO_REPLACE_STDIO
/* Replace the <stdio.h> functions */
#define printf trio_printf
#define vprintf trio_vprintf
#define fprintf trio_fprintf
#define vfprintf trio_vfprintf
#define sprintf trio_sprintf
#define vsprintf trio_vsprintf
#define snprintf trio_snprintf
#define vsnprintf trio_vsnprintf
#define scanf trio_scanf
#define vscanf trio_vscanf
#define fscanf trio_fscanf
#define vfscanf trio_vfscanf
#define sscanf trio_sscanf
#define vsscanf trio_vsscanf
#ifndef HAVE_PRINTF
# define printf trio_printf
#endif
#ifndef HAVE_VPRINTF
# define vprintf trio_vprintf
#endif
#ifndef HAVE_FPRINTF
# define fprintf trio_fprintf
#endif
#ifndef HAVE_VFPRINTF
# define vfprintf trio_vfprintf
#endif
#ifndef HAVE_SPRINTF
# define sprintf trio_sprintf
#endif
#ifndef HAVE_VSPRINTF
# define vsprintf trio_vsprintf
#endif
#ifndef HAVE_SNPRINTF
# define snprintf trio_snprintf
#endif
#ifndef HAVE_VSNPRINTF
# define vsnprintf trio_vsnprintf
#endif
#ifndef HAVE_SCANF
# define scanf trio_scanf
#endif
#ifndef HAVE_VSCANF
# define vscanf trio_vscanf
#endif
#ifndef HAVE_FSCANF
# define fscanf trio_fscanf
#endif
#ifndef HAVE_VFSCANF
# define vfscanf trio_vfscanf
#endif
#ifndef HAVE_SSCANF
# define sscanf trio_sscanf
#endif
#ifndef HAVE_VSSCANF
# define vsscanf trio_vsscanf
#endif
/* These aren't stdio functions, but we make them look similar */
#define dprintf trio_dprintf
#define vdprintf trio_vdprintf
......@@ -109,10 +175,12 @@ const char *trio_strerror(int);
#endif
/* strio compatible names */
#define StrScan sscanf /* FIXME: must be trio_sscanf */
#define StrScan trio_sscanf
#define StrFormat trio_sprintf
#define StrFormatMax trio_snprintf
#define StrFormatAlloc trio_aprintf
#define StrFormatAppendMax trio_snprintfcat
#endif /* H_TRIO */
#endif /* TRIO_IGNORE */
#endif /* TRIO_TRIO_H */
/*************************************************************************
*
* $Id$
*
* Copyright (C) 2000 Bjorn Reese and Daniel Stenberg.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
*
************************************************************************
*
* Private functions, types, etc. used for callback functions.
*
* The ref pointer is an opaque type and should remain as such.
* Private data must only be accessible through the getter and
* setter functions.
*
************************************************************************/
#ifndef TRIO_TRIOP_H
#define TRIO_TRIOP_H
#if defined(__STDC__) && (__STDC_VERSION__ >= 199901L)
# define TRIO_C99
#endif
#define TRIO_BSD
#define TRIO_GNU
#define TRIO_MISC
#define TRIO_UNIX98
#define TRIO_EXTENSION
#define TRIO_ERRORS
typedef int (*trio_callback_t)(void *ref);
void *trio_register(trio_callback_t callback, const char *name);
void trio_unregister(void *handle);
const char *trio_get_format(void *ref);
void *trio_get_argument(void *ref);
/* Modifiers */
int trio_get_width(void *ref);
void trio_set_width(void *ref, int width);
int trio_get_precision(void *ref);
void trio_set_precision(void *ref, int precision);
int trio_get_base(void *ref);
void trio_set_base(void *ref, int base);
int trio_get_padding(void *ref);
void trio_set_padding(void *ref, int is_padding);
int trio_get_short(void *ref); /* h */
void trio_set_shortshort(void *ref, int is_shortshort);
int trio_get_shortshort(void *ref); /* hh */
void trio_set_short(void *ref, int is_short);
int trio_get_long(void *ref); /* l */
void trio_set_long(void *ref, int is_long);
int trio_get_longlong(void *ref); /* ll */
void trio_set_longlong(void *ref, int is_longlong);
int trio_get_longdouble(void *ref); /* L */
void trio_set_longdouble(void *ref, int is_longdouble);
int trio_get_alternative(void *ref); /* # */
void trio_set_alternative(void *ref, int is_alternative);
int trio_get_alignment(void *ref); /* - */
void trio_set_alignment(void *ref, int is_leftaligned);
int trio_get_spacing(void *ref); /* (space) */
void trio_set_spacing(void *ref, int is_space);
int trio_get_sign(void *ref); /* + */
void trio_set_sign(void *ref, int is_showsign);
int trio_get_quote(void *ref); /* ' */
void trio_set_quote(void *ref, int is_quote);
int trio_get_upper(void *ref);
void trio_set_upper(void *ref, int is_upper);
#if defined(TRIO_C99)
int trio_get_largest(void *ref); /* j */
void trio_set_largest(void *ref, int is_largest);
int trio_get_ptrdiff(void *ref); /* t */
void trio_set_ptrdiff(void *ref, int is_ptrdiff);
int trio_get_size(void *ref); /* z / Z */
void trio_set_size(void *ref, int is_size);
#endif
/* Printing */
int trio_print_ref(void *ref, const char *format, ...);
int trio_vprint_ref(void *ref, const char *format, va_list args);
int trio_printv_ref(void *ref, const char *format, void **args);
void trio_print_int(void *ref, int number);
void trio_print_uint(void *ref, unsigned int number);
/* void trio_print_long(void *ref, long number); */
/* void trio_print_ulong(void *ref, unsigned long number); */
void trio_print_double(void *ref, double number);
void trio_print_string(void *ref, char *string);
void trio_print_pointer(void *ref, void *pointer);
#endif /* TRIO_TRIOP_H */
......@@ -8,14 +8,12 @@
* Daniel.Veillard@w3.org
*/
#include "libxml.h"