mirror of
https://github.com/GNOME/libxml2.git
synced 2025-03-13 18:47:01 +08:00
applied a trio update patch from Bjorn Reese which should work with MinGW
* trio.c trio.h triodef.h trionan.c trionan.h triop.h triostr.c triostr.h: applied a trio update patch from Bjorn Reese which should work with MinGW Daniel
This commit is contained in:
parent
bd9afb5290
commit
b7c29c38f5
@ -1,3 +1,9 @@
|
||||
Thu Sep 26 00:31:46 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* trio.c trio.h triodef.h trionan.c trionan.h triop.h
|
||||
triostr.c triostr.h: applied a trio update patch from
|
||||
Bjorn Reese which should work with MinGW
|
||||
|
||||
Thu Sep 26 00:21:18 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* tree.c: improving some documentation comments
|
||||
|
@ -119,7 +119,7 @@ A:link, A:visited, A:active { text-decoration: underline }
|
||||
Not Use libxml1</span></strong>, use libxml2</li>
|
||||
<li>
|
||||
<em>Where can I get libxml</em> ?
|
||||
<p>The original distribution comes from <a href="ftp://rpmfind.net/pub/libxml/">rpmfind.net</a> or <a href="ftp://ftp.gnome.org/pub/GNOME/stable/sources/libxml/">gnome.org</a>
|
||||
<p>The original distribution comes from <a href="ftp://rpmfind.net/pub/libxml/">rpmfind.net</a> or <a href="ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.4/">gnome.org</a>
|
||||
</p>
|
||||
<p>Most Linux and BSD distributions include libxml, this is probably the
|
||||
safer way for end-users to use libxml.</p>
|
||||
|
@ -89,9 +89,8 @@ A:link, A:visited, A:active { text-decoration: underline }
|
||||
</td></tr></table></td>
|
||||
<td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd">
|
||||
<p>The latest versions of libxml can be found on <a href="ftp://xmlsoft.org/">xmlsoft.org</a> (<a href="ftp://speakeasy.rpmfind.net/pub/libxml/">Seattle</a>, <a href="ftp://fr.rpmfind.net/pub/libxml/">France</a>) or on the <a href="ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html">Gnome FTP server</a> either
|
||||
as a <a href="ftp://ftp.gnome.org/pub/GNOME/stable/sources/libxml/">source
|
||||
archive</a> or <a href="ftp://ftp.gnome.org/pub/GNOME/stable/redhat/i386/libxml/">RPM
|
||||
packages</a>, Antonin Sprinzl also provide <a href="ftp://gd.tuwien.ac.at/pub/libxml/">a mirror in Austria</a>. (NOTE that
|
||||
as a <a href="ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.4/">source
|
||||
archive</a>, Antonin Sprinzl also provide <a href="ftp://gd.tuwien.ac.at/pub/libxml/">a mirror in Austria</a>. (NOTE that
|
||||
you need both the <a href="http://rpmfind.net/linux/RPM/libxml2.html">libxml(2)</a> and <a href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml(2)-devel</a>
|
||||
packages installed to compile applications using libxml.) <a href="mailto:igor@stud.fh-frankfurt.de">Igor Zlatkovic</a> is now the
|
||||
maintainer of the Windows port, <a href="http://www.fh-frankfurt.de/~igor/projects/libxml/index.html">he
|
||||
|
133
trio.h
133
trio.h
@ -23,8 +23,14 @@
|
||||
#define TRIO_TRIO_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#if defined(TRIO_COMPILER_ANCIENT)
|
||||
# include <varargs.h>
|
||||
#else
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#if !defined(WITHOUT_TRIO)
|
||||
|
||||
/*
|
||||
* Use autoconf defines if present. Packages using trio must define
|
||||
@ -34,22 +40,12 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if !defined(WITHOUT_TRIO)
|
||||
#include "triodef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* make utility and C++ compiler in Windows NT fails to find this symbol */
|
||||
#if defined(WIN32) && !defined(isascii)
|
||||
# define isascii ((unsigned)(x) < 0x80)
|
||||
#endif
|
||||
|
||||
/* Error macros */
|
||||
#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF)
|
||||
#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
|
||||
#define TRIO_ERROR_NAME(x) trio_strerror(x)
|
||||
|
||||
/*
|
||||
* Error codes.
|
||||
*
|
||||
@ -63,72 +59,95 @@ enum {
|
||||
TRIO_EGAP = 5,
|
||||
TRIO_ENOMEM = 6,
|
||||
TRIO_ERANGE = 7,
|
||||
TRIO_ERRNO = 8
|
||||
TRIO_ERRNO = 8,
|
||||
TRIO_ECUSTOM = 9
|
||||
};
|
||||
|
||||
const char *trio_strerror(int);
|
||||
/* Error macros */
|
||||
#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF)
|
||||
#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
|
||||
#define TRIO_ERROR_NAME(x) trio_strerror(x)
|
||||
|
||||
typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int));
|
||||
typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t));
|
||||
|
||||
TRIO_CONST char *trio_strerror TRIO_PROTO((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_printf TRIO_PROTO((TRIO_CONST char *format, ...));
|
||||
int trio_vprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
|
||||
int trio_printfv TRIO_PROTO((TRIO_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_fprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
|
||||
int trio_vfprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
|
||||
int trio_fprintfv TRIO_PROTO((FILE *file, TRIO_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);
|
||||
int trio_dprintf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
|
||||
int trio_vdprintf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
|
||||
int trio_dprintfv TRIO_PROTO((int fd, TRIO_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_vsprintf(char *buffer, const char *format, va_list args);
|
||||
int trio_sprintfv(char *buffer, const char *format, void **args);
|
||||
int trio_cprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, ...));
|
||||
int trio_vcprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, va_list args));
|
||||
int trio_cprintfv TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
|
||||
TRIO_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_sprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, ...));
|
||||
int trio_vsprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, va_list args));
|
||||
int trio_sprintfv TRIO_PROTO((char *buffer, TRIO_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);
|
||||
int trio_snprintf TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
|
||||
int trio_vsnprintf TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
|
||||
va_list args));
|
||||
int trio_snprintfv TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
|
||||
void **args));
|
||||
|
||||
char *trio_aprintf(const char *format, ...);
|
||||
char *trio_vaprintf(const char *format, va_list args);
|
||||
int trio_snprintfcat TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
|
||||
int trio_vsnprintfcat TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_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);
|
||||
char *trio_aprintf TRIO_PROTO((TRIO_CONST char *format, ...));
|
||||
char *trio_vaprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
|
||||
|
||||
int trio_asprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, ...));
|
||||
int trio_vasprintf TRIO_PROTO((char **ret, TRIO_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_scanf TRIO_PROTO((TRIO_CONST char *format, ...));
|
||||
int trio_vscanf TRIO_PROTO((TRIO_CONST char *format, va_list args));
|
||||
int trio_scanfv TRIO_PROTO((TRIO_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_fscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
|
||||
int trio_vfscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
|
||||
int trio_fscanfv TRIO_PROTO((FILE *file, TRIO_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_dscanf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
|
||||
int trio_vdscanf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
|
||||
int trio_dscanfv TRIO_PROTO((int fd, TRIO_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);
|
||||
int trio_cscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, ...));
|
||||
int trio_vcscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, va_list args));
|
||||
int trio_cscanfv TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
|
||||
TRIO_CONST char *format, void **args));
|
||||
|
||||
int trio_sscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, ...));
|
||||
int trio_vsscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, va_list args));
|
||||
int trio_sscanfv TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, void **args));
|
||||
|
||||
/*************************************************************************
|
||||
* Locale Functions
|
||||
*/
|
||||
void trio_locale_set_decimal_point TRIO_PROTO((char *decimalPoint));
|
||||
void trio_locale_set_thousand_separator TRIO_PROTO((char *thousandSeparator));
|
||||
void trio_locale_set_grouping TRIO_PROTO((char *grouping));
|
||||
|
||||
/*************************************************************************
|
||||
* Renaming
|
||||
|
68
triodef.h
68
triodef.h
@ -34,8 +34,12 @@
|
||||
# define TRIO_COMPILER_XLC /* Workaround for old xlc */
|
||||
#elif defined(__DECC) || defined(__DECCXX)
|
||||
# define TRIO_COMPILER_DECC
|
||||
#elif defined(__osf__) && defined(__LANGUAGE_C__)
|
||||
# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */
|
||||
#elif defined(_MSC_VER)
|
||||
# define TRIO_COMPILER_MSVC
|
||||
#elif defined(__BORLANDC__)
|
||||
# define TRIO_COMPILER_BCB
|
||||
#endif
|
||||
|
||||
#if defined(unix) || defined(__unix) || defined(__unix__)
|
||||
@ -61,9 +65,10 @@
|
||||
# define TRIO_PLATFORM_MPEIX
|
||||
#endif
|
||||
|
||||
#if defined(__STDC__)
|
||||
# define TRIO_COMPILER_SUPPORTS_C90
|
||||
#if defined(__STDC__) || defined(TRIO_COMPILER_MSVC)
|
||||
# define TRIO_COMPILER_SUPPORTS_C89
|
||||
# if defined(__STDC_VERSION__)
|
||||
# define TRIO_COMPILER_SUPPORTS_C90
|
||||
# if (__STDC_VERSION__ >= 199409L)
|
||||
# define TRIO_COMPILER_SUPPORTS_C94
|
||||
# endif
|
||||
@ -84,6 +89,9 @@
|
||||
# if (_XOPEN_VERSION >= 500)
|
||||
# define TRIO_COMPILER_SUPPORTS_UNIX98
|
||||
# endif
|
||||
# if (_XOPEN_VERSION >= 600)
|
||||
# define TRIO_COMPILER_SUPPORTS_UNIX01
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
@ -97,22 +105,64 @@
|
||||
# define TRIO_PRIVATE static
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_COMPILER_SUPPORTS_C90) || defined(__cplusplus)
|
||||
# define TRIO_CONST const
|
||||
# define TRIO_VOLATILE volatile
|
||||
# define TRIO_POINTER void *
|
||||
# define TRIO_PROTO(x) x
|
||||
#else
|
||||
#if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus))
|
||||
# define TRIO_COMPILER_ANCIENT
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_COMPILER_ANCIENT)
|
||||
# define TRIO_CONST
|
||||
# define TRIO_VOLATILE
|
||||
# define TRIO_POINTER char *
|
||||
# define TRIO_SIGNED
|
||||
typedef double trio_long_double_t;
|
||||
typedef char * trio_pointer_t;
|
||||
# define TRIO_SUFFIX_LONG(x) x
|
||||
# define TRIO_PROTO(x) ()
|
||||
# define TRIO_NOARGS
|
||||
# define TRIO_ARGS1(list,a1) list a1;
|
||||
# define TRIO_ARGS2(list,a1,a2) list a1; a2;
|
||||
# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3;
|
||||
# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4;
|
||||
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5;
|
||||
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6;
|
||||
# define TRIO_VARGS2(list,a1,a2) list a1; a2
|
||||
# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3
|
||||
# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4
|
||||
# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5
|
||||
# define TRIO_VA_DECL va_dcl
|
||||
# define TRIO_VA_START(x,y) va_start((x))
|
||||
# define TRIO_VA_END(x) va_end(x)
|
||||
#else /* ANSI C */
|
||||
# define TRIO_CONST const
|
||||
# define TRIO_VOLATILE volatile
|
||||
# define TRIO_SIGNED signed
|
||||
typedef long double trio_long_double_t;
|
||||
typedef void * trio_pointer_t;
|
||||
# define TRIO_SUFFIX_LONG(x) x ## L
|
||||
# define TRIO_PROTO(x) x
|
||||
# define TRIO_NOARGS void
|
||||
# define TRIO_ARGS1(list,a1) (a1)
|
||||
# define TRIO_ARGS2(list,a1,a2) (a1,a2)
|
||||
# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3)
|
||||
# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4)
|
||||
# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5)
|
||||
# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6)
|
||||
# define TRIO_VARGS2 TRIO_ARGS2
|
||||
# define TRIO_VARGS3 TRIO_ARGS3
|
||||
# define TRIO_VARGS4 TRIO_ARGS4
|
||||
# define TRIO_VARGS5 TRIO_ARGS5
|
||||
# define TRIO_VA_DECL ...
|
||||
# define TRIO_VA_START(x,y) va_start((x),(y))
|
||||
# define TRIO_VA_END(x) va_end(x)
|
||||
#endif
|
||||
|
||||
#if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus)
|
||||
# define TRIO_INLINE inline
|
||||
#elif defined(TRIO_COMPILER_GCC)
|
||||
# define TRIO_INLINE __inline__
|
||||
#elif defined(TRIO_COMPILER_MSVC)
|
||||
# define TRIO_INLINE _inline
|
||||
#elif defined(TRIO_COMPILER_BCB)
|
||||
# define TRIO_INLINE __inline
|
||||
#else
|
||||
# define TRIO_INLINE
|
||||
#endif
|
||||
|
189
trionan.c
189
trionan.c
@ -29,40 +29,13 @@
|
||||
* 2. Use IEEE 754 bit-patterns if possible.
|
||||
* 3. Use platform-specific techniques.
|
||||
*
|
||||
* This program has been tested on the following platforms (in
|
||||
* alphabetic order)
|
||||
*
|
||||
* OS CPU Compiler
|
||||
* -------------------------------------------------
|
||||
* AIX 4.1.4 PowerPC gcc
|
||||
* Darwin 1.3.7 PowerPC gcc
|
||||
* FreeBSD 2.2 x86 gcc
|
||||
* FreeBSD 3.3 x86 gcc
|
||||
* FreeBSD 4.3 x86 gcc
|
||||
* FreeBSD 4.3 Alpha gcc
|
||||
* HP-UX 10.20 PA-RISC gcc
|
||||
* HP-UX 10.20 PA-RISC HP C++
|
||||
* IRIX 6.5 MIPS MIPSpro C
|
||||
* Linux 2.2 x86 gcc
|
||||
* Linux 2.2 Alpha gcc
|
||||
* Linux 2.4 IA64 gcc
|
||||
* Linux 2.4 StrongARM gcc
|
||||
* NetBSD 1.4 x86 gcc
|
||||
* NetBSD 1.4 StrongARM gcc
|
||||
* NetBSD 1.5 Alpha gcc
|
||||
* OpenVMS 7.1 Alpha DEC C 6.0
|
||||
* RISC OS 4 StrongARM Norcroft C
|
||||
* Solaris 2.5.1 x86 gcc
|
||||
* Solaris 2.5.1 Sparc gcc
|
||||
* Solaris 2.6 Sparc WorkShop 4.2
|
||||
* Solaris 8 Sparc Forte C 6
|
||||
* Tru64 4.0D Alpha gcc
|
||||
* Tru64 5.1 Alpha gcc
|
||||
* WinNT x86 MSVC 5.0 & 6.0
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
static const char rcsid[] = "@(#)$Id$";
|
||||
/*
|
||||
* TODO:
|
||||
* o Put all the magic into trio_fpclassify_and_signbit(), and use this from
|
||||
* trio_isnan() etc.
|
||||
*/
|
||||
|
||||
/*************************************************************************
|
||||
* Include files
|
||||
@ -102,7 +75,9 @@ static const char rcsid[] = "@(#)$Id$";
|
||||
# if defined(TRIO_PLATFORM_VMS)
|
||||
# error "Must be compiled with option /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE"
|
||||
# else
|
||||
# error "Must be compiled with option -ieee"
|
||||
# if !defined(_CFE)
|
||||
# error "Must be compiled with option -ieee"
|
||||
# endif
|
||||
# endif
|
||||
# elif defined(TRIO_COMPILER_GCC) && (defined(__osf__) || defined(__linux__))
|
||||
# error "Must be compiled with option -mieee"
|
||||
@ -128,9 +103,11 @@ static const char rcsid[] = "@(#)$Id$";
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Data
|
||||
* Constants
|
||||
*/
|
||||
|
||||
static TRIO_CONST char rcsid[] = "@(#)$Id$";
|
||||
|
||||
#if defined(USE_IEEE_754)
|
||||
|
||||
/*
|
||||
@ -187,7 +164,9 @@ static TRIO_CONST unsigned char ieee_754_qnan_array[] = {
|
||||
* trio_make_double
|
||||
*/
|
||||
TRIO_PRIVATE double
|
||||
trio_make_double(TRIO_CONST unsigned char *values)
|
||||
trio_make_double
|
||||
TRIO_ARGS1((values),
|
||||
TRIO_CONST unsigned char *values)
|
||||
{
|
||||
TRIO_VOLATILE double result;
|
||||
int i;
|
||||
@ -202,8 +181,10 @@ trio_make_double(TRIO_CONST unsigned char *values)
|
||||
* trio_is_special_quantity
|
||||
*/
|
||||
TRIO_PRIVATE int
|
||||
trio_is_special_quantity(double number,
|
||||
int *has_mantissa)
|
||||
trio_is_special_quantity
|
||||
TRIO_ARGS2((number, has_mantissa),
|
||||
double number,
|
||||
int *has_mantissa)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned char current;
|
||||
@ -224,7 +205,9 @@ trio_is_special_quantity(double number,
|
||||
* trio_is_negative
|
||||
*/
|
||||
TRIO_PRIVATE int
|
||||
trio_is_negative(double number)
|
||||
trio_is_negative
|
||||
TRIO_ARGS1((number),
|
||||
double number)
|
||||
{
|
||||
unsigned int i;
|
||||
int is_negative = TRIO_FALSE;
|
||||
@ -236,22 +219,33 @@ trio_is_negative(double number)
|
||||
return is_negative;
|
||||
}
|
||||
|
||||
TRIO_PUBLIC double
|
||||
trio_nzero(void)
|
||||
{
|
||||
return trio_make_double(ieee_754_negzero_array);
|
||||
}
|
||||
|
||||
#endif /* USE_IEEE_754 */
|
||||
|
||||
|
||||
/**
|
||||
Generate negative zero.
|
||||
|
||||
@return Floating-point representation of negative zero.
|
||||
*/
|
||||
TRIO_PUBLIC double
|
||||
trio_nzero(TRIO_NOARGS)
|
||||
{
|
||||
#if defined(USE_IEEE_754)
|
||||
return trio_make_double(ieee_754_negzero_array);
|
||||
#else
|
||||
TRIO_VOLATILE double zero = 0.0;
|
||||
|
||||
return -zero;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
Generate positive infinity.
|
||||
|
||||
@return Floating-point representation of positive infinity.
|
||||
*/
|
||||
TRIO_PUBLIC double
|
||||
trio_pinf(void)
|
||||
trio_pinf(TRIO_NOARGS)
|
||||
{
|
||||
/* Cache the result */
|
||||
static double result = 0.0;
|
||||
@ -295,7 +289,7 @@ trio_pinf(void)
|
||||
@return Floating-point value of negative infinity.
|
||||
*/
|
||||
TRIO_PUBLIC double
|
||||
trio_ninf(void)
|
||||
trio_ninf(TRIO_NOARGS)
|
||||
{
|
||||
static double result = 0.0;
|
||||
|
||||
@ -316,7 +310,7 @@ trio_ninf(void)
|
||||
@return Floating-point representation of NaN.
|
||||
*/
|
||||
TRIO_PUBLIC double
|
||||
trio_nan(void)
|
||||
trio_nan(TRIO_NOARGS)
|
||||
{
|
||||
/* Cache the result */
|
||||
static double result = 0.0;
|
||||
@ -364,9 +358,12 @@ trio_nan(void)
|
||||
@return Boolean value indicating whether or not the number is a NaN.
|
||||
*/
|
||||
TRIO_PUBLIC int
|
||||
trio_isnan(TRIO_VOLATILE double number)
|
||||
trio_isnan
|
||||
TRIO_ARGS1((number),
|
||||
double number)
|
||||
{
|
||||
#if defined(isnan) || defined(TRIO_COMPILER_SUPPORTS_UNIX95)
|
||||
#if (defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isnan)) \
|
||||
|| defined(TRIO_COMPILER_SUPPORTS_UNIX95)
|
||||
/*
|
||||
* C99 defines isnan() as a macro. UNIX95 defines isnan() as a
|
||||
* function. This function was already present in XPG4, but this
|
||||
@ -407,7 +404,7 @@ trio_isnan(TRIO_VOLATILE double number)
|
||||
status = (/*
|
||||
* NaN is the only number which does not compare to itself
|
||||
*/
|
||||
(number != number) ||
|
||||
((TRIO_VOLATILE double)number != (TRIO_VOLATILE double)number) ||
|
||||
/*
|
||||
* Fallback solution if NaN compares to NaN
|
||||
*/
|
||||
@ -431,7 +428,9 @@ trio_isnan(TRIO_VOLATILE double number)
|
||||
@return 1 if positive infinity, -1 if negative infinity, 0 otherwise.
|
||||
*/
|
||||
TRIO_PUBLIC int
|
||||
trio_isinf(TRIO_VOLATILE double number)
|
||||
trio_isinf
|
||||
TRIO_ARGS1((number),
|
||||
double number)
|
||||
{
|
||||
#if defined(TRIO_COMPILER_DECC)
|
||||
/*
|
||||
@ -441,12 +440,14 @@ trio_isinf(TRIO_VOLATILE double number)
|
||||
return ((fp_class(number) == FP_POS_INF)
|
||||
? 1
|
||||
: ((fp_class(number) == FP_NEG_INF) ? -1 : 0));
|
||||
|
||||
|
||||
#elif defined(isinf)
|
||||
/*
|
||||
* C99 defines isinf() as a macro.
|
||||
*/
|
||||
return isinf(number);
|
||||
return isinf(number)
|
||||
? ((number > 0.0) ? 1 : -1)
|
||||
: 0;
|
||||
|
||||
#elif defined(TRIO_COMPILER_MSVC)
|
||||
/*
|
||||
@ -503,9 +504,11 @@ trio_isinf(TRIO_VOLATILE double number)
|
||||
@return Boolean value indicating whether or not the number is a finite.
|
||||
*/
|
||||
TRIO_PUBLIC int
|
||||
trio_isfinite(TRIO_VOLATILE double number)
|
||||
trio_isfinite
|
||||
TRIO_ARGS1((number),
|
||||
double number)
|
||||
{
|
||||
#if defined(isfinite)
|
||||
#if defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isfinite)
|
||||
/*
|
||||
* C99 defines isfinite() as a macro.
|
||||
*/
|
||||
@ -538,9 +541,11 @@ trio_isfinite(TRIO_VOLATILE double number)
|
||||
/*
|
||||
* The sign of NaN is always false
|
||||
*/
|
||||
TRIO_PRIVATE int
|
||||
trio_fpclass(TRIO_VOLATILE double number,
|
||||
int *is_negative)
|
||||
TRIO_PUBLIC int
|
||||
trio_fpclassify_and_signbit
|
||||
TRIO_ARGS2((number, is_negative),
|
||||
double number,
|
||||
int *is_negative)
|
||||
{
|
||||
#if defined(fpclassify) && defined(signbit)
|
||||
/*
|
||||
@ -637,7 +642,46 @@ trio_fpclass(TRIO_VOLATILE double number,
|
||||
*is_negative = (number < 0.0);
|
||||
return TRIO_FP_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
#elif defined(FP_PLUS_NORM) || defined(__hpux)
|
||||
|
||||
/*
|
||||
* HP-UX 9.x and 10.x have an fpclassify() function, that is different
|
||||
* from the C99 fpclassify() macro supported on HP-UX 11.x.
|
||||
*/
|
||||
switch (fpclassify(number)) {
|
||||
case FP_QNAN:
|
||||
case FP_SNAN:
|
||||
*is_negative = TRIO_FALSE;
|
||||
return TRIO_FP_NAN;
|
||||
case FP_PLUS_INF:
|
||||
*is_negative = TRIO_FALSE;
|
||||
return TRIO_FP_INFINITE;
|
||||
case FP_MINUS_INF:
|
||||
*is_negative = TRIO_TRUE;
|
||||
return TRIO_FP_INFINITE;
|
||||
case FP_PLUS_DENORM:
|
||||
*is_negative = TRIO_FALSE;
|
||||
return TRIO_FP_SUBNORMAL;
|
||||
case FP_MINUS_DENORM:
|
||||
*is_negative = TRIO_TRUE;
|
||||
return TRIO_FP_SUBNORMAL;
|
||||
case FP_PLUS_ZERO:
|
||||
*is_negative = TRIO_FALSE;
|
||||
return TRIO_FP_ZERO;
|
||||
case FP_MINUS_ZERO:
|
||||
*is_negative = TRIO_TRUE;
|
||||
return TRIO_FP_ZERO;
|
||||
case FP_PLUS_NORM:
|
||||
*is_negative = TRIO_FALSE;
|
||||
return TRIO_FP_NORMAL;
|
||||
case FP_MINUS_NORM:
|
||||
*is_negative = TRIO_TRUE;
|
||||
return TRIO_FP_NORMAL;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
* Fallback solution.
|
||||
@ -687,11 +731,13 @@ trio_fpclass(TRIO_VOLATILE double number,
|
||||
sign bit set (i.e. is negative).
|
||||
*/
|
||||
TRIO_PUBLIC int
|
||||
trio_signbit(TRIO_VOLATILE double number)
|
||||
trio_signbit
|
||||
TRIO_ARGS1((number),
|
||||
double number)
|
||||
{
|
||||
int is_negative;
|
||||
|
||||
(void)trio_fpclass(number, &is_negative);
|
||||
(void)trio_fpclassify_and_signbit(number, &is_negative);
|
||||
return is_negative;
|
||||
}
|
||||
|
||||
@ -702,11 +748,13 @@ trio_signbit(TRIO_VOLATILE double number)
|
||||
@return Enumerable value indicating the class of @p number
|
||||
*/
|
||||
TRIO_PUBLIC int
|
||||
trio_fpclassify(TRIO_VOLATILE double number)
|
||||
trio_fpclassify
|
||||
TRIO_ARGS1((number),
|
||||
double number)
|
||||
{
|
||||
int dummy;
|
||||
|
||||
return trio_fpclass(number, &dummy);
|
||||
return trio_fpclassify_and_signbit(number, &dummy);
|
||||
}
|
||||
|
||||
|
||||
@ -723,7 +771,10 @@ trio_fpclassify(TRIO_VOLATILE double number)
|
||||
#if defined(STANDALONE)
|
||||
# include <stdio.h>
|
||||
|
||||
static const char *getClassification(int type)
|
||||
static TRIO_CONST char *
|
||||
getClassification
|
||||
TRIO_ARGS1((type)
|
||||
int type)
|
||||
{
|
||||
switch (type) {
|
||||
case TRIO_FP_INFINITE:
|
||||
@ -741,7 +792,11 @@ static const char *getClassification(int type)
|
||||
}
|
||||
}
|
||||
|
||||
static void print_class(const char *prefix, double number)
|
||||
static void
|
||||
print_class
|
||||
TRIO_ARGS2((prefix, number)
|
||||
TRIO_CONST char *prefix,
|
||||
double number)
|
||||
{
|
||||
printf("%-6s: %s %-15s %g\n",
|
||||
prefix,
|
||||
@ -750,13 +805,13 @@ static void print_class(const char *prefix, double number)
|
||||
number);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(TRIO_NOARGS)
|
||||
{
|
||||
double my_nan;
|
||||
double my_pinf;
|
||||
double my_ninf;
|
||||
# if defined(TRIO_PLATFORM_UNIX)
|
||||
void (*signal_handler)(int);
|
||||
void (*signal_handler) TRIO_PROTO((int));
|
||||
# endif
|
||||
|
||||
my_nan = trio_nan();
|
||||
|
23
trionan.h
23
trionan.h
@ -35,39 +35,44 @@ enum {
|
||||
/*
|
||||
* Return NaN (Not-a-Number).
|
||||
*/
|
||||
TRIO_PUBLIC double trio_nan(void);
|
||||
TRIO_PUBLIC double trio_nan TRIO_PROTO((void));
|
||||
|
||||
/*
|
||||
* Return positive infinity.
|
||||
*/
|
||||
TRIO_PUBLIC double trio_pinf(void);
|
||||
TRIO_PUBLIC double trio_pinf TRIO_PROTO((void));
|
||||
|
||||
/*
|
||||
* Return negative infinity.
|
||||
*/
|
||||
TRIO_PUBLIC double trio_ninf(void);
|
||||
TRIO_PUBLIC double trio_ninf TRIO_PROTO((void));
|
||||
|
||||
/*
|
||||
* Return negative zero.
|
||||
*/
|
||||
TRIO_PUBLIC double trio_nzero TRIO_PROTO((TRIO_NOARGS));
|
||||
|
||||
/*
|
||||
* If number is a NaN return non-zero, otherwise return zero.
|
||||
*/
|
||||
TRIO_PUBLIC int trio_isnan(double number);
|
||||
TRIO_PUBLIC int trio_isnan TRIO_PROTO((double number));
|
||||
|
||||
/*
|
||||
* If number is positive infinity return 1, if number is negative
|
||||
* infinity return -1, otherwise return 0.
|
||||
*/
|
||||
TRIO_PUBLIC int trio_isinf(double number);
|
||||
TRIO_PUBLIC int trio_isinf TRIO_PROTO((double number));
|
||||
|
||||
/*
|
||||
* If number is finite return non-zero, otherwise return zero.
|
||||
*/
|
||||
TRIO_PUBLIC int trio_isfinite(double number);
|
||||
TRIO_PUBLIC int trio_isfinite TRIO_PROTO((double number));
|
||||
|
||||
TRIO_PUBLIC int trio_signbit(double number);
|
||||
TRIO_PUBLIC int trio_signbit TRIO_PROTO((double number));
|
||||
|
||||
TRIO_PUBLIC int trio_fpclassify(double number);
|
||||
TRIO_PUBLIC int trio_fpclassify TRIO_PROTO((double number));
|
||||
|
||||
TRIO_PUBLIC double trio_nzero(void);
|
||||
TRIO_PUBLIC int trio_fpclassify_and_signbit TRIO_PROTO((double number, int *is_negative));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
111
triop.h
111
triop.h
@ -26,8 +26,14 @@
|
||||
#ifndef TRIO_TRIOP_H
|
||||
#define TRIO_TRIOP_H
|
||||
|
||||
#include "triodef.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#if defined(TRIO_COMPILER_ANCIENT)
|
||||
# include <varargs.h>
|
||||
#else
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -71,70 +77,71 @@ extern "C" {
|
||||
# define TRIO_FREE(x) free(x)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* User-defined specifiers
|
||||
*/
|
||||
|
||||
typedef int (*trio_callback_t)(void *);
|
||||
typedef int (*trio_callback_t) TRIO_PROTO((trio_pointer_t));
|
||||
|
||||
void *trio_register(trio_callback_t callback, const char *name);
|
||||
void trio_unregister(void *handle);
|
||||
trio_pointer_t trio_register TRIO_PROTO((trio_callback_t callback, const char *name));
|
||||
void trio_unregister TRIO_PROTO((trio_pointer_t handle));
|
||||
|
||||
const char *trio_get_format(void *ref);
|
||||
void *trio_get_argument(void *ref);
|
||||
TRIO_CONST char *trio_get_format TRIO_PROTO((trio_pointer_t ref));
|
||||
trio_pointer_t trio_get_argument TRIO_PROTO((trio_pointer_t 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);
|
||||
int trio_get_width TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_width TRIO_PROTO((trio_pointer_t ref, int width));
|
||||
int trio_get_precision TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_precision TRIO_PROTO((trio_pointer_t ref, int precision));
|
||||
int trio_get_base TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_base TRIO_PROTO((trio_pointer_t ref, int base));
|
||||
int trio_get_padding TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_padding TRIO_PROTO((trio_pointer_t ref, int is_padding));
|
||||
int trio_get_short TRIO_PROTO((trio_pointer_t ref)); /* h */
|
||||
void trio_set_shortshort TRIO_PROTO((trio_pointer_t ref, int is_shortshort));
|
||||
int trio_get_shortshort TRIO_PROTO((trio_pointer_t ref)); /* hh */
|
||||
void trio_set_short TRIO_PROTO((trio_pointer_t ref, int is_short));
|
||||
int trio_get_long TRIO_PROTO((trio_pointer_t ref)); /* l */
|
||||
void trio_set_long TRIO_PROTO((trio_pointer_t ref, int is_long));
|
||||
int trio_get_longlong TRIO_PROTO((trio_pointer_t ref)); /* ll */
|
||||
void trio_set_longlong TRIO_PROTO((trio_pointer_t ref, int is_longlong));
|
||||
int trio_get_longdouble TRIO_PROTO((trio_pointer_t ref)); /* L */
|
||||
void trio_set_longdouble TRIO_PROTO((trio_pointer_t ref, int is_longdouble));
|
||||
int trio_get_alternative TRIO_PROTO((trio_pointer_t ref)); /* # */
|
||||
void trio_set_alternative TRIO_PROTO((trio_pointer_t ref, int is_alternative));
|
||||
int trio_get_alignment TRIO_PROTO((trio_pointer_t ref)); /* - */
|
||||
void trio_set_alignment TRIO_PROTO((trio_pointer_t ref, int is_leftaligned));
|
||||
int trio_get_spacing TRIO_PROTO((trio_pointer_t ref)); /* TRIO_PROTO((space) */
|
||||
void trio_set_spacing TRIO_PROTO((trio_pointer_t ref, int is_space));
|
||||
int trio_get_sign TRIO_PROTO((trio_pointer_t ref)); /* + */
|
||||
void trio_set_sign TRIO_PROTO((trio_pointer_t ref, int is_showsign));
|
||||
int trio_get_quote TRIO_PROTO((trio_pointer_t ref)); /* ' */
|
||||
void trio_set_quote TRIO_PROTO((trio_pointer_t ref, int is_quote));
|
||||
int trio_get_upper TRIO_PROTO((trio_pointer_t ref));
|
||||
void trio_set_upper TRIO_PROTO((trio_pointer_t ref, int is_upper));
|
||||
#if 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);
|
||||
int trio_get_largest TRIO_PROTO((trio_pointer_t ref)); /* j */
|
||||
void trio_set_largest TRIO_PROTO((trio_pointer_t ref, int is_largest));
|
||||
int trio_get_ptrdiff TRIO_PROTO((trio_pointer_t ref)); /* t */
|
||||
void trio_set_ptrdiff TRIO_PROTO((trio_pointer_t ref, int is_ptrdiff));
|
||||
int trio_get_size TRIO_PROTO((trio_pointer_t ref)); /* z / Z */
|
||||
void trio_set_size TRIO_PROTO((trio_pointer_t 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);
|
||||
int trio_print_ref TRIO_PROTO((trio_pointer_t ref, const char *format, ...));
|
||||
int trio_vprint_ref TRIO_PROTO((trio_pointer_t ref, const char *format, va_list args));
|
||||
int trio_printv_ref TRIO_PROTO((trio_pointer_t ref, const char *format, trio_pointer_t *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);
|
||||
void trio_print_int TRIO_PROTO((trio_pointer_t ref, int number));
|
||||
void trio_print_uint TRIO_PROTO((trio_pointer_t ref, unsigned int number));
|
||||
/* void trio_print_long TRIO_PROTO((trio_pointer_t ref, long number)); */
|
||||
/* void trio_print_ulong TRIO_PROTO((trio_pointer_t ref, unsigned long number)); */
|
||||
void trio_print_double TRIO_PROTO((trio_pointer_t ref, double number));
|
||||
void trio_print_string TRIO_PROTO((trio_pointer_t ref, char *string));
|
||||
void trio_print_pointer TRIO_PROTO((trio_pointer_t ref, trio_pointer_t pointer));
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
144
triostr.h
144
triostr.h
@ -31,42 +31,50 @@ enum {
|
||||
TRIO_HASH_TWOSIGNED
|
||||
};
|
||||
|
||||
#if !defined(TRIO_STRING_PUBLIC)
|
||||
# if !defined(TRIO_PUBLIC)
|
||||
# define TRIO_PUBLIC
|
||||
# endif
|
||||
# define TRIO_STRING_PUBLIC TRIO_PUBLIC
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* String functions
|
||||
*/
|
||||
|
||||
int trio_append(char *target, const char *source);
|
||||
int trio_append_max(char *target, size_t max, const char *source);
|
||||
int trio_contains(const char *string, const char *substring);
|
||||
int trio_copy(char *target, const char *source);
|
||||
int trio_copy_max(char *target, size_t max, const char *source);
|
||||
char *trio_create(size_t size);
|
||||
void trio_destroy(char *string);
|
||||
char *trio_duplicate(const char *source);
|
||||
char *trio_duplicate_max(const char *source, size_t max);
|
||||
int trio_equal(const char *first, const char *second);
|
||||
int trio_equal_case(const char *first, const char *second);
|
||||
int trio_equal_case_max(const char *first, size_t max, const char *second);
|
||||
int trio_equal_locale(const char *first, const char *second);
|
||||
int trio_equal_max(const char *first, size_t max, const char *second);
|
||||
const char *trio_error(int);
|
||||
size_t trio_format_date_max(char *target, size_t max, const char *format, const struct tm *datetime);
|
||||
unsigned long trio_hash(const char *string, int type);
|
||||
char *trio_index(const char *string, char character);
|
||||
char *trio_index_last(const char *string, char character);
|
||||
size_t trio_length(const char *string);
|
||||
int trio_lower(char *target);
|
||||
int trio_match(const char *string, const char *pattern);
|
||||
int trio_match_case(const char *string, const char *pattern);
|
||||
size_t trio_span_function(char *target, const char *source, int (*Function)(int));
|
||||
char *trio_substring(const char *string, const char *substring);
|
||||
char *trio_substring_max(const char *string, size_t max, const char *substring);
|
||||
char *trio_tokenize(char *string, const char *delimiters);
|
||||
float trio_to_float(const char *source, const char **endp);
|
||||
double trio_to_double(const char *source, const char **endp);
|
||||
long trio_to_long(const char *source, char **endp, int base);
|
||||
unsigned long trio_to_unsigned_long(const char *source, char **endp, int base);
|
||||
int trio_upper(char *target);
|
||||
TRIO_STRING_PUBLIC int trio_append TRIO_PROTO((char *target, const char *source));
|
||||
TRIO_STRING_PUBLIC int trio_append_max TRIO_PROTO((char *target, size_t max, const char *source));
|
||||
TRIO_STRING_PUBLIC int trio_contains TRIO_PROTO((const char *string, const char *substring));
|
||||
TRIO_STRING_PUBLIC int trio_copy TRIO_PROTO((char *target, const char *source));
|
||||
TRIO_STRING_PUBLIC int trio_copy_max TRIO_PROTO((char *target, size_t max, const char *source));
|
||||
TRIO_STRING_PUBLIC char *trio_create TRIO_PROTO((size_t size));
|
||||
TRIO_STRING_PUBLIC void trio_destroy TRIO_PROTO((char *string));
|
||||
TRIO_STRING_PUBLIC char *trio_duplicate TRIO_PROTO((const char *source));
|
||||
TRIO_STRING_PUBLIC char *trio_duplicate_max TRIO_PROTO((const char *source, size_t max));
|
||||
TRIO_STRING_PUBLIC int trio_equal TRIO_PROTO((const char *first, const char *second));
|
||||
TRIO_STRING_PUBLIC int trio_equal_case TRIO_PROTO((const char *first, const char *second));
|
||||
TRIO_STRING_PUBLIC int trio_equal_case_max TRIO_PROTO((const char *first, size_t max, const char *second));
|
||||
TRIO_STRING_PUBLIC int trio_equal_locale TRIO_PROTO((const char *first, const char *second));
|
||||
TRIO_STRING_PUBLIC int trio_equal_max TRIO_PROTO((const char *first, size_t max, const char *second));
|
||||
TRIO_STRING_PUBLIC TRIO_CONST char *trio_error TRIO_PROTO((int));
|
||||
TRIO_STRING_PUBLIC size_t trio_format_date_max TRIO_PROTO((char *target, size_t max, const char *format, const struct tm *datetime));
|
||||
TRIO_STRING_PUBLIC unsigned long trio_hash TRIO_PROTO((const char *string, int type));
|
||||
TRIO_STRING_PUBLIC char *trio_index TRIO_PROTO((const char *string, int character));
|
||||
TRIO_STRING_PUBLIC char *trio_index_last TRIO_PROTO((const char *string, int character));
|
||||
TRIO_STRING_PUBLIC size_t trio_length TRIO_PROTO((const char *string));
|
||||
TRIO_STRING_PUBLIC int trio_lower TRIO_PROTO((char *target));
|
||||
TRIO_STRING_PUBLIC int trio_match TRIO_PROTO((const char *string, const char *pattern));
|
||||
TRIO_STRING_PUBLIC int trio_match_case TRIO_PROTO((const char *string, const char *pattern));
|
||||
TRIO_STRING_PUBLIC size_t trio_span_function TRIO_PROTO((char *target, const char *source, int (*Function) TRIO_PROTO((int))));
|
||||
TRIO_STRING_PUBLIC char *trio_substring TRIO_PROTO((const char *string, const char *substring));
|
||||
TRIO_STRING_PUBLIC char *trio_substring_max TRIO_PROTO((const char *string, size_t max, const char *substring));
|
||||
TRIO_STRING_PUBLIC double trio_to_double TRIO_PROTO((const char *source, char **endp));
|
||||
TRIO_STRING_PUBLIC float trio_to_float TRIO_PROTO((const char *source, char **endp));
|
||||
TRIO_STRING_PUBLIC trio_long_double_t trio_to_long_double TRIO_PROTO((const char *source, char **endp));
|
||||
TRIO_STRING_PUBLIC long trio_to_long TRIO_PROTO((const char *source, char **endp, int base));
|
||||
TRIO_STRING_PUBLIC unsigned long trio_to_unsigned_long TRIO_PROTO((const char *source, char **endp, int base));
|
||||
TRIO_STRING_PUBLIC char *trio_tokenize TRIO_PROTO((char *string, const char *delimiters));
|
||||
TRIO_STRING_PUBLIC int trio_upper TRIO_PROTO((char *target));
|
||||
|
||||
/*************************************************************************
|
||||
* Dynamic string functions
|
||||
@ -77,43 +85,43 @@ int trio_upper(char *target);
|
||||
*/
|
||||
typedef struct _trio_string_t trio_string_t;
|
||||
|
||||
trio_string_t *trio_string_create(int initial_size);
|
||||
void trio_string_destroy(trio_string_t *self);
|
||||
char *trio_string_get(trio_string_t *self, int offset);
|
||||
void trio_xstring_set(trio_string_t *self, char *buffer);
|
||||
char *trio_string_extract(trio_string_t *self);
|
||||
int trio_string_size(trio_string_t *self);
|
||||
void trio_string_terminate(trio_string_t *self);
|
||||
TRIO_STRING_PUBLIC trio_string_t *trio_string_create TRIO_PROTO((int initial_size));
|
||||
TRIO_STRING_PUBLIC void trio_string_destroy TRIO_PROTO((trio_string_t *self));
|
||||
TRIO_STRING_PUBLIC char *trio_string_get TRIO_PROTO((trio_string_t *self, int offset));
|
||||
TRIO_STRING_PUBLIC void trio_xstring_set TRIO_PROTO((trio_string_t *self, char *buffer));
|
||||
TRIO_STRING_PUBLIC char *trio_string_extract TRIO_PROTO((trio_string_t *self));
|
||||
TRIO_STRING_PUBLIC int trio_string_size TRIO_PROTO((trio_string_t *self));
|
||||
TRIO_STRING_PUBLIC void trio_string_terminate TRIO_PROTO((trio_string_t *self));
|
||||
|
||||
int trio_string_append(trio_string_t *self, trio_string_t *other);
|
||||
int trio_string_contains(trio_string_t *self, trio_string_t *other);
|
||||
int trio_string_copy(trio_string_t *self, trio_string_t *other);
|
||||
trio_string_t *trio_string_duplicate(trio_string_t *other);
|
||||
int trio_string_equal(trio_string_t *self, trio_string_t *other);
|
||||
int trio_string_equal_max(trio_string_t *self, size_t max, trio_string_t *second);
|
||||
int trio_string_equal_case(trio_string_t *self, trio_string_t *other);
|
||||
int trio_string_equal_case_max(trio_string_t *self, size_t max, trio_string_t *other);
|
||||
size_t trio_string_format_date_max(trio_string_t *self, size_t max, const char *format, const struct tm *datetime);
|
||||
char *trio_string_index(trio_string_t *self, int character);
|
||||
char *trio_string_index_last(trio_string_t *self, int character);
|
||||
int trio_string_length(trio_string_t *self);
|
||||
int trio_string_lower(trio_string_t *self);
|
||||
int trio_string_match(trio_string_t *self, trio_string_t *other);
|
||||
int trio_string_match_case(trio_string_t *self, trio_string_t *other);
|
||||
char *trio_string_substring(trio_string_t *self, trio_string_t *other);
|
||||
int trio_string_upper(trio_string_t *self);
|
||||
TRIO_STRING_PUBLIC int trio_string_append TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC int trio_string_contains TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC int trio_string_copy TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC trio_string_t *trio_string_duplicate TRIO_PROTO((trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC int trio_string_equal TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC int trio_string_equal_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *second));
|
||||
TRIO_STRING_PUBLIC int trio_string_equal_case TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC int trio_string_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC size_t trio_string_format_date_max TRIO_PROTO((trio_string_t *self, size_t max, const char *format, const struct tm *datetime));
|
||||
TRIO_STRING_PUBLIC char *trio_string_index TRIO_PROTO((trio_string_t *self, int character));
|
||||
TRIO_STRING_PUBLIC char *trio_string_index_last TRIO_PROTO((trio_string_t *self, int character));
|
||||
TRIO_STRING_PUBLIC int trio_string_length TRIO_PROTO((trio_string_t *self));
|
||||
TRIO_STRING_PUBLIC int trio_string_lower TRIO_PROTO((trio_string_t *self));
|
||||
TRIO_STRING_PUBLIC int trio_string_match TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC int trio_string_match_case TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC char *trio_string_substring TRIO_PROTO((trio_string_t *self, trio_string_t *other));
|
||||
TRIO_STRING_PUBLIC int trio_string_upper TRIO_PROTO((trio_string_t *self));
|
||||
|
||||
int trio_xstring_append_char(trio_string_t *self, char character);
|
||||
int trio_xstring_append(trio_string_t *self, const char *other);
|
||||
int trio_xstring_contains(trio_string_t *self, const char *other);
|
||||
int trio_xstring_copy(trio_string_t *self, const char *other);
|
||||
trio_string_t *trio_xstring_duplicate(const char *other);
|
||||
int trio_xstring_equal(trio_string_t *self, const char *other);
|
||||
int trio_xstring_equal_max(trio_string_t *self, size_t max, const char *other);
|
||||
int trio_xstring_equal_case(trio_string_t *self, const char *other);
|
||||
int trio_xstring_equal_case_max(trio_string_t *self, size_t max, const char *other);
|
||||
int trio_xstring_match(trio_string_t *self, const char *other);
|
||||
int trio_xstring_match_case(trio_string_t *self, const char *other);
|
||||
char *trio_xstring_substring(trio_string_t *self, const char *other);
|
||||
TRIO_STRING_PUBLIC int trio_xstring_append_char TRIO_PROTO((trio_string_t *self, char character));
|
||||
TRIO_STRING_PUBLIC int trio_xstring_append TRIO_PROTO((trio_string_t *self, const char *other));
|
||||
TRIO_STRING_PUBLIC int trio_xstring_contains TRIO_PROTO((trio_string_t *self, const char *other));
|
||||
TRIO_STRING_PUBLIC int trio_xstring_copy TRIO_PROTO((trio_string_t *self, const char *other));
|
||||
TRIO_STRING_PUBLIC trio_string_t *trio_xstring_duplicate TRIO_PROTO((const char *other));
|
||||
TRIO_STRING_PUBLIC int trio_xstring_equal TRIO_PROTO((trio_string_t *self, const char *other));
|
||||
TRIO_STRING_PUBLIC int trio_xstring_equal_max TRIO_PROTO((trio_string_t *self, size_t max, const char *other));
|
||||
TRIO_STRING_PUBLIC int trio_xstring_equal_case TRIO_PROTO((trio_string_t *self, const char *other));
|
||||
TRIO_STRING_PUBLIC int trio_xstring_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, const char *other));
|
||||
TRIO_STRING_PUBLIC int trio_xstring_match TRIO_PROTO((trio_string_t *self, const char *other));
|
||||
TRIO_STRING_PUBLIC int trio_xstring_match_case TRIO_PROTO((trio_string_t *self, const char *other));
|
||||
TRIO_STRING_PUBLIC char *trio_xstring_substring TRIO_PROTO((trio_string_t *self, const char *other));
|
||||
|
||||
#endif /* TRIO_TRIOSTR_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user